Re: currval() without specifying the sequence name - Mailing list pgsql-sql

From Richard Huxton
Subject Re: currval() without specifying the sequence name
Date
Msg-id 200403091514.56649.dev@archonet.com
Whole thread Raw
In response to currval() without specifying the sequence name  (ow <oneway_111@yahoo.com>)
List pgsql-sql
On Tuesday 09 March 2004 13:50, ow wrote:
> 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)

Not really - what if two sequences had been used?

--  Richard Huxton Archonet Ltd


pgsql-sql by date:

Previous
From: Achilleus Mantzios
Date:
Subject: Re: currval() without specifying the sequence name
Next
From: Jeff Boes
Date:
Subject: Re: Dramatic slowdown of sql when placed in a function