Re: About primary keys.
От | Tom Lane |
---|---|
Тема | Re: About primary keys. |
Дата | |
Msg-id | 18736.1060963060@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: About primary keys. (Tim Andersen <timander37@yahoo.com>) |
Ответы |
Re: About primary keys.
|
Список | pgsql-sql |
Tim Andersen <timander37@yahoo.com> 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 по дате отправления: