currval() without specifying the sequence name

From: ow <oneway_111(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: currval() without specifying the sequence name
Date: 2004-03-09 13:50:21
Message-ID: 20040309135021.57085.qmail@web60808.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Is there a way to retrieve the current value (i.e. the last used value) of the
last used sequence without specifying the sequence name? Something like the
following:

create table ( id serial, value varchar(10));
insert into someOthertest (value) values ('100');
insert into test (value) values ('10');
insert into test (value) values ('20');

select currval() should returns 2 (the last value of the test table sequence)

Thanks

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2004-03-09 14:10:43 Re: currval() without specifying the sequence name
Previous Message terry 2004-03-09 13:37:48 Re: Trying to make efficient "all vendors who can provide all items"