Re: About primary keys.

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: About primary keys.
Дата
Msg-id
18736.1060963060@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Re: About primary keys. David BOURIAUD <david.bouriaud@ac-rouen.fr>
Tim Andersen  writes:
> The query I have so far only gets columns that are
> part of a primary key.
>        ...
>        and pga1.attnum = i.indkey[pga2.attnum-1];

This is wrong because you are looking at only one indkey position, and
the attribute could be in any position of the primary key.  I think
what you want is to drop pga2 from the query and instead use something
like
... and pga1.attnum in (i.indkey[0], i.indkey[1], i.indkey[2], ...)

(carrying it out to whatever you think is a reasonable upper bound on
the number of columns in a primary key --- the normal Postgres limit
is 32 keys but I can't believe anyone would use that many in practice).
		regards, tom lane

В списке pgsql-sql по дате отправления
От: Tim Andersen
Дата:
Сообщение: Re: About primary keys.
От: Tim Andersen
Дата:
Сообщение: Re: About primary keys.
FAQ