nextval, sequences and sequencenames

From: Wieger Uffink <wieger(at)usmedia(dot)nl>
To: PostgreSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: nextval, sequences and sequencenames
Date: 2001-08-14 16:11:06
Message-ID: 3B794D9A.BA8E6EDA@usmedia.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lee Kindness 2001-08-14 16:13:20 Re: Is the bug system active?
Previous Message Philip Crotwell 2001-08-14 16:02:03 LARGE db dump/restore for upgrade question

Browse pgsql-novice by date

  From Date Subject
Next Message Colin Bussanich 2001-08-14 16:50:58 Problems running configure on Solaris.
Previous Message Josh Berkus 2001-08-14 15:30:00 Re: [SQL] Re: Arithmetic operation on DATE