[BUGS] Meaning of pg_constraint.conindid for foreign keys

Поиск
Список
Период
Сортировка
От Roy Brokvam
Тема [BUGS] Meaning of pg_constraint.conindid for foreign keys
Дата
Msg-id CADhin7Xj7FFp3N+d_J=4ya8iqo+hnoyX23vYEA35guMDDuGzbg@mail.gmail.com
обсуждение исходный текст
Ответы Re: [BUGS] Meaning of pg_constraint.conindid for foreign keys  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: [BUGS] Meaning of pg_constraint.conindid for foreign keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Trying to write a query to find unindexed foreign keys referencing a table, I tried to do this:

SELECT *
FROM pg_constraint
WHERE contype = 'f'
AND confrelid = <the oid of the referenced table>
AND conindid = 0

To my surprise, the query did not return any rows, even though I knew there existed indexless foreign keys referencing my table. After investigating further, saw that conindid contained the oid of the referenced table's primary key, not the oid of the index "implementing" the foreign key.

I'm running PostgreSQL 9.5 running on Ubuntu linux 3.19.0-49-generic.

Before posting this as a bug, I wanted to check here whether my understanding of conind for foreign keys is correct. The documentation for conindid (https://www.postgresql.org/docs/9.5/static/catalog-pg-constraint.html) says

conindidoidpg_class.oidThe index supporting this constraint, if it's a unique, primary key, foreign key, or exclusion constraint; else 0

Regards,
Roy Brokvam

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: [BUGS] Meaning of pg_constraint.conindid for foreign keys