From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tim Andersen <timander37@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: About primary keys.
Date: Fri, 15 Aug 2003 11:57:40 -0400
Message-ID: <18736.1060963060@sss.pgh.pa.us> (raw)
In-Reply-To: <20030815143853.64952.qmail@web10009.mail.yahoo.com>
References: <20030815143853.64952.qmail@web10009.mail.yahoo.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, timander37@yahoo.com
Subject: Re: About primary keys.
In-Reply-To: <18736.1060963060@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox