From: Alex Verstak <averstak@vt.edu>
To: pgsql-interfaces@postgreSQL.org
Subject: JDBC primary keys
Date: Wed, 09 Feb 2000 18:50:37 -0500
Message-ID: <200002092350.SAA92912@averstak.campus.vt.edu> (raw)
Is there a way to determine all primary key columns in
a given table? Example:
CREATE TABLE foo (
bar1 int4,
bar2 text,
bar3 float8,
CONSTRAINT foo_pk PRIMARY KEY ( bar1, bar2 )
)
I want to obtain `bar1' and `bar2' given table name `foo'.
DatabaseMetaData.getPrimaryKeys looks like the right
function to use, but it returns `foo_pk' in COLUMN_NAME
for all rows.
Am I misinterpreting the JDBC specs? What SELECT query
should I use to get the primary key columns?
--
Drive^H^Hnk safely!
Alex Verstak averstak@vt.edu
1078 Ambler Johnston East Virginia Tech
Blacksburg, VA 24060-0022 Tel. (540) 232-1389
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-interfaces@postgresql.org
Cc: averstak@vt.edu
Subject: Re: JDBC primary keys
In-Reply-To: <200002092350.SAA92912@averstak.campus.vt.edu>
References: <200002092350.SAA92912@averstak.campus.vt.edu>
* 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