On Fri, Jan 14, 2005 at 07:44:18PM +0100, Bo Lorentsen wrote:
> Alvaro Herrera wrote:
> 
> >You can create a function to get the sequence name attached to a table.
> >Of course, you should take into account the fact that there could be
> >more than one (two serial fields in a table are rare but not
> >impossible), but if your tables have only one sequence you should be OK.
> >
> Are there a way to find and test if it is a primary key ?

pg_index has an indisprimary column.

> Hmm, need to play more around using the "pg_" system tables.
> 
> Are they all well documentet, or need I some guessing ?

See the "System Catalogs" chapter in the documentation.

If you run "psql -E" you'll see the queries that psql executes for
commands like "\d foo".  Those commands query the system catalogs.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to