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

Getting name of sequence for a table

From: Nicolas Ribot <nicolas(dot)ribot(at)scot(dot)cnes(dot)fr>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Getting name of sequence for a table
Date: 2002-03-15 09:18:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgadmin-hackers

I was wondering if it is possible to get the name of sequences created
for a table by an SQL query ?

Ex: I have a parcel table, with a sequence created on it for the PK
A java program, that doesn't know this sequence name needs  to retrieve
the unique ID of the object recently inserted into the parcel table.
I would like to do something like
select currval( (select seqname from pg_xxx where table_name='parcel')

I looked at the pg_class system table and see both my table and its
sequence, but do not find a way to join them in a query.

Thanx for any help.

Nicolas Ribot

pgadmin-hackers by date

Next:From: frank_lupo@email.itDate: 2002-03-15 10:15:17
Subject: upgrade wizard proxy connection
Previous:From: rose.coilDate: 2002-03-15 06:13:39

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