Re: A Table's Primary Key Listing - Mailing list pgsql-sql

From Tom Lane
Subject Re: A Table's Primary Key Listing
Date
Msg-id 10279.1124395722@sss.pgh.pa.us
Whole thread Raw
In response to Re: A Table's Primary Key Listing  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Responses Re: A Table's Primary Key Listing
List pgsql-sql
"D'Arcy J.M. Cain" <darcy@druid.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


pgsql-sql by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: A Table's Primary Key Listing
Next
From: "Joel Fradkin"
Date:
Subject: dates and selection