Thread: How does one determine which columns are constrained PRIMARY KEY?
Is it possible to determine which column(s), if any, are constrained with PRIMARY KEY? Thanks, Damon
To see the column(s) of a key, use \d key_name At 06:30 PM 2/27/2002 -0800, you wrote: >Is it possible to determine which column(s), if any, are constrained >with PRIMARY KEY? > >Thanks, > Damon > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster
Damon, > Is it possible to determine which column(s), if any, are constrained > with PRIMARY KEY? From psql, use: \d table_name You will get a list of table characteristics, including any constraints. -Josh
On Thu, 28 Feb 2002, Josh Berkus wrote: > Damon, > > > Is it possible to determine which column(s), if any, are constrained > > with PRIMARY KEY? > > From psql, use: > > \d table_name > > You will get a list of table characteristics, including any > constraints. > > -Josh > Thanks...but is there a way to check PRIMARY KEY (and do other useful things like get a listing of databases) from within an SQL query? I can't embed psql '\' commands in my application. Damon --------- May the lights in The Land of Plenty shine on the Truth some day L Cohen
Re: How does one determine which columns are constrained PRIMARY KEY?
From
denis@coralindia.com
Date:
I am a novice for PostGres... but if you start postgres with option "-E" it shows the QUERY which it executes to get result of each "\" command.... Analysing that, you may find something relevant to your prob. Denis ----- Original Message ----- From: "Damon Fasching" <fasching@design.lbl.gov> To: <pgsql-novice@postgresql.org> Sent: Friday, March 01, 2002 1:11 AM Subject: Re: [NOVICE] How does one determine which columns are constrained PRIMARY KEY? > On Thu, 28 Feb 2002, Josh Berkus wrote: > > > Damon, > > > > > Is it possible to determine which column(s), if any, are constrained > > > with PRIMARY KEY? > > > > From psql, use: > > > > \d table_name > > > > You will get a list of table characteristics, including any > > constraints. > > > > -Josh > > > > Thanks...but is there a way to check PRIMARY KEY (and do other useful > things like get a listing of databases) from within an SQL query? I can't > embed psql '\' commands in my application. > > Damon > > --------- > > May the lights in The Land of Plenty > shine on the Truth some day L Cohen > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org