nextval, sequences and sequencenames - Mailing list pgsql-general

From Wieger Uffink
Subject nextval, sequences and sequencenames
Date
Msg-id 3B794D9A.BA8E6EDA@usmedia.nl
Whole thread Raw
In response to help on delete trigger.  ("Sundararajan" <sdn@srasys.co.in>)
Responses Re: nextval, sequences and sequencenames
List pgsql-general
Hi,

I'm pretty new to PostgreSQL so please bear with me if this is a newbie
question that has been answered before on this list.

I have created several tables containing a SERIAL column-type as primary
key.
What I would like to do is get the last value of these columns after Ive
inserted a new row.

I know I can do this either using nextval('sequence_name') or
curval('sequence_name').

My question:
is there anyway of retreiving the sequence_name corresponding to the
respective column,
knowing just the tablename and columnname?

The reason I need to do this, is because the application I write
dynamicly creates new tables, and I have no way of knowing the sequence
name before hand.

thanks in advance
Wieger
--
Wieger Uffink
tel: +31 20 428 6868
fax: +31 20 470 6905
web: http://www.usmedia.nl

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Is the bug system active?
Next
From: Jochem van Dieten
Date:
Subject: Re: PostgresQL equivalent of NOCOUNT