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.
This commit is contained in:
parent
9f5c4f55c7
commit
0a87822ee4
@ -157,6 +157,7 @@ CREATE VIEW reorg.primary_keys AS
|
||||
SELECT indrelid, (reorg.array_accum(indexrelid))[1] AS indexrelid
|
||||
FROM (SELECT indrelid, indexrelid FROM pg_index
|
||||
WHERE indisunique
|
||||
AND indisvalid
|
||||
AND 0 <> ALL(indkey)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM pg_attribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user