On Thu, Mar 30, 2006 at 03:13:12PM +0400, Sergey Karin wrote:
> Are there any abilities to detect primary key of a table?

In psql you could use "\d tablename".  To see the queries that psql
makes, execute "\set ECHO_HIDDEN" and then "\d tablename".  Here's
the documentation for the system catalogs that psql queries:

http://www.postgresql.org/docs/8.1/interactive/catalogs.html

You could also query the Information Schema; table_constraints
joined with key_column_usage or constraint_column_usage should
yield a table's primary key columns.

http://www.postgresql.org/docs/8.1/interactive/information-schema.html

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to