Re: A Table's Primary Key Listing
- From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
- To: "D'Arcy J.M. Cain" <darcy(at)druid(dot)net>
- Cc: Roger Tannous <roger77_lb(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
- Subject: Re: A Table's Primary Key Listing
- Date: Thu, 18 Aug 2005 16:08:42 -0400
- Message-id: <10279.1124395722@sss.pgh.pa.us> <text/plain>
"D'Arcy J.M. Cain" <darcy(at)druid(dot)net> writes:
> That's a good question. The following query does this in a very
> unsatisfactory way. Anyone know what the general solution would be?
> ...
> (
> pg_index.indkey[0]=pg_attribute.attnum OR
> pg_index.indkey[1]=pg_attribute.attnum OR
> pg_index.indkey[2]=pg_attribute.attnum OR
> pg_index.indkey[3]=pg_attribute.attnum OR
> pg_index.indkey[4]=pg_attribute.attnum OR
> pg_index.indkey[5]=pg_attribute.attnum OR
> pg_index.indkey[6]=pg_attribute.attnum OR
> pg_index.indkey[7]=pg_attribute.attnum OR
> pg_index.indkey[8]=pg_attribute.attnum OR
> pg_index.indkey[9]=pg_attribute.attnum
> )
In CVS tip you could replace this with "attnum = ANY (indkey)".
Unfortunately, most array support doesn't work on int2vector in
pre-8.1 releases, so I think you're kinda stuck with the above
for now.
regards, tom lane
Home |
Main Index |
Thread Index