pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ow <oneway_111@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: currval() without specifying the sequence name
Date: Tue, 9 Mar 2004 05:50:21 -0800 (PST)
Message-ID: <20040309135021.57085.qmail@web60808.mail.yahoo.com> (raw)

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 you’re looking for faster
http://search.yahoo.com



view thread (7+ messages)  latest in thread

Message-ID: <20040309135021.57085.qmail@web60808.mail.yahoo.com>
Permalink:  ../20040309135021.57085.qmail@web60808.mail.yahoo.com/
Also on:    postgresql.org/message-id/20040309135021.57085.qmail@web60808.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oneway_111@yahoo.com
  Subject: Re: currval() without specifying the sequence name
  In-Reply-To: <20040309135021.57085.qmail@web60808.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox