Re: BUG #1006: information schema constraint information.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #1006: information schema constraint information.
Дата
Msg-id 4715.1071451373@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #1006: information schema constraint information.  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
Ответы Re: BUG #1006: information schema constraint information.  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-bugs
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> [ information_schema.constraint_column_usage gives wrong answers ]

I think this part of the view's definition:

            AND (CASE WHEN c.contype = 'f' THEN c.confkey[pos.n] = a.attnum
                      ELSE c.conkey[pos.n] = a.attnum END)

should just be

            AND c.conkey[pos.n] = a.attnum

The confkey array shows column numbers of the referenced columns, which
is not the right thing to look at.

If the view were also supposed to show referenced columns, then I think
we'd need an additional UNION arm that joined on confrelid and confkey[]
instead of conrelid/conkey[].  But if I read SQL99 correctly, only
referencing not referenced columns are supposed to be shown.

BTW, I also recommend deleting the clause

            AND a.attnum > 0

since for instance a UNIQUE constraint on the OID column is legitimate.

Peter, does this change look right to you?

            regards, tom lane

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

Предыдущее
От: "PostgreSQL Bugs List"
Дата:
Сообщение: BUG #1006: information schema constraint information.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: libpq3 + ssl memory leak