pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedObtaining primary key information from pg system tables
3+ messages / 2 participants
[nested] [flat]
* Obtaining primary key information from pg system tables
@ 2002-06-22 10:30 Kris <krisallsop@btinternet.com>
0 siblings, 1 reply; 3+ messages in thread
From: Kris @ 2002-06-22 10:30 UTC (permalink / raw)
To: pgsql-sql
Hi,
I am trying to generate some xml metadata from the pg system tables for my java code generation utility. I have can get most information, but i would like to be able to tell which column is a primary key or which one is a foreign key (i dont need to know which table the foreign key references at this point).
Which tables do i need reference, could anyone provide an example query?
Kris
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Obtaining primary key information from pg system tables
@ 2002-06-22 10:44 Dmitri Colebatch <dim@bigpond.net.au>
parent: Kris <krisallsop@btinternet.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dmitri Colebatch @ 2002-06-22 10:44 UTC (permalink / raw)
To: Kris <krisallsop@btinternet.com>; pgsql-sql
Kris,
I'm assuming you dont want to do this, but just in case you're not aware of the option - the JDBC API exposes this information.
hth
dim
----- Original Message -----
From: Kris
To: pgsql-sql@postgresql.org
Sent: Saturday, June 22, 2002 8:30 PM
Subject: [SQL] Obtaining primary key information from pg system tables
Hi,
I am trying to generate some xml metadata from the pg system tables for my java code generation utility. I have can get most information, but i would like to be able to tell which column is a primary key or which one is a foreign key (i dont need to know which table the foreign key references at this point).
Which tables do i need reference, could anyone provide an example query?
Kris
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Obtaining primary key information from pg system tables
@ 2002-06-22 11:08 Kris <krisallsop@btinternet.com>
parent: Dmitri Colebatch <dim@bigpond.net.au>
0 siblings, 0 replies; 3+ messages in thread
From: Kris @ 2002-06-22 11:08 UTC (permalink / raw)
To: Dmitri Colebatch <dim@bigpond.net.au>; pgsql-sql
Thanx for replying Dmitri,
I am aware of the JDBC API exposing information, it might be an idea to use both the system tables and JDBC information in the this case. The reason why i want to use the system tables is for example , (in MS SQL Server and Oracle) the NVARCHAR and NVARCHAR2 datatypes are not part of the JDBC spec and when using JDBC there is no way of telling these part from a VARCHAR or VARCHAR2. I needed to do this with when writing a java based insert script generator so i could cast the strings with the N. I was thinking the system tables were more reliable but i dont need to use just those i guess.
Kris
----- Original Message -----
From: Dmitri Colebatch
To: Kris ; pgsql-sql@postgresql.org
Sent: Saturday, June 22, 2002 11:44 AM
Subject: Re: [SQL] Obtaining primary key information from pg system tables
Kris,
I'm assuming you dont want to do this, but just in case you're not aware of the option - the JDBC API exposes this information.
hth
dim
----- Original Message -----
From: Kris
To: pgsql-sql@postgresql.org
Sent: Saturday, June 22, 2002 8:30 PM
Subject: [SQL] Obtaining primary key information from pg system tables
Hi,
I am trying to generate some xml metadata from the pg system tables for my java code generation utility. I have can get most information, but i would like to be able to tell which column is a primary key or which one is a foreign key (i dont need to know which table the foreign key references at this point).
Which tables do i need reference, could anyone provide an example query?
Kris
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-06-22 11:08 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-22 10:30 Obtaining primary key information from pg system tables Kris <krisallsop@btinternet.com>
2002-06-22 10:44 ` Dmitri Colebatch <dim@bigpond.net.au>
2002-06-22 11:08 ` Kris <krisallsop@btinternet.com>
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