pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: D'Arcy J.M. Cain <darcy@druid.net>
Cc: Roger Tannous <roger77_lb@yahoo.com>
Cc: pgsql-sql@postgresql.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> (raw)
In-Reply-To: <20050818135524.74852123.darcy@druid.net>
References: <20050818121844.33a09ad2.darcy@druid.net>
	<20050818164057.38362.qmail@web51906.mail.yahoo.com>
	<20050818135524.74852123.darcy@druid.net>

"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



view thread (13+ messages)  latest in thread

Message-ID: <10279.1124395722@sss.pgh.pa.us>
Permalink:  ../10279.1124395722@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10279.1124395722@sss.pgh.pa.us

 · 

reply

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, darcy@druid.net, roger77_lb@yahoo.com
  Subject: Re: A Table's Primary Key Listing
  In-Reply-To: <10279.1124395722@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