Re: A Table's Primary Key Listing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "D'Arcy J(dot)M(dot) 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: 2005-08-18 20:08:42
Message-ID: 10279.1124395722@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Fradkin 2005-08-18 20:36:28 dates and selection
Previous Message D'Arcy J.M. Cain 2005-08-18 17:55:24 Re: A Table's Primary Key Listing