Avoid choosing an invalid index as primary key
Avoid choosing an invalid index as primary key

Fixing the other functions selecting pg_index (as in Josh original patch)
doesn't seem necessary as they are only called with an index oid, and we
should only call them with a valid index as argument.

ossc-db/pg_reorg,reorg/pg_reorg,bwtakacy/pg_repack,reorg/pg_repack,reorg/pg_repack,mr-mustash/pg_repack,reorg/pg_reorg