Received: from druid.net (root@druid.net [216.126.72.98]) by hub.org (8.9.3/8.9.3) with ESMTP id WAA18680 for ; Mon, 15 Nov 1999 22:19:14 -0500 (EST) (envelope-from darcy@druid.net) Received: from localhost (1826 bytes) by druid.net via sendmail with P:stdio/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) (ident using unix) id for ; Mon, 15 Nov 1999 22:19:13 -0500 (EST) (Smail-3.2.0.104 1998-Nov-20 #4 built 1999-Apr-13) Message-Id: Subject: Re: [SQL] how can tell if a column is a primary key? In-Reply-To: <18416.942679456@sss.pgh.pa.us> from Tom Lane at "Nov 15, 1999 10:24:16 am" To: tgl@sss.pgh.pa.us (Tom Lane) Date: Mon, 15 Nov 1999 22:19:13 -0500 (EST) From: "D'Arcy" "J.M." Cain Cc: pgsql-sql@postgreSQL.org Reply-To: pgsql-sql@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL50 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Thus spake Tom Lane > indkey and indclass are type int28 and oid8 respectively, which are > almost like 8-element arrays, except that for historical reasons they > index from 0 not 1. So instead of pg_index.indkey[0] = pg_attribute.attnum > write pg_index.indkey[1] = pg_attribute.attnum to find attributes that > are secondary index columns, [2] for tertiary, etc. Unused positions > in indkey[] are filled with zeroes. I understand all that. I was just looking for a SQL statement to pull them all out. If we can't manipulate arrays in SQL I'm not sure that they really belong here, especially in system tables. Perhaps indkey should be pulled out to another table instead. > If you have code on the client side it'd probably make most sense just > to pull back the whole value of indkey[] and then issue separate SELECTs > to find out what the referenced attributes are, instead of probing 8 > times to see if you get anything... Seems real klugy. The system should be able to handle it in the backend. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.