Skip site navigation (1) Skip section navigation (2)

JDBC primary keys

From: "Alex Verstak" <averstak(at)vt(dot)edu>
To: pgsql-interfaces(at)postgreSQL(dot)org
Subject: JDBC primary keys
Date: 2000-02-09 23:50:37
Message-ID: 200002092350.SAA92912@averstak.campus.vt.edu (view raw or flat)
Thread:
Lists: pgsql-interfaces
  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(at)vt(dot)edu
1078 Ambler Johnston East             Virginia Tech
Blacksburg, VA 24060-0022       Tel. (540) 232-1389



pgsql-interfaces by date

Next:From: Rini DuttaDate: 2000-02-10 00:02:10
Subject: how to make libpq on winnt using the 'win32.mak's
Previous:From: Bryan WhiteDate: 2000-02-09 23:45:37
Subject: How to get remote ip address is stored proceedure

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group