pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: ow <oneway_111@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: currval() without specifying the sequence name
Date: Tue, 9 Mar 2004 16:10:43 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0403091610190.32587-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <20040309135021.57085.qmail@web60808.mail.yahoo.com>

O kyrios ow egrapse stis Mar 9, 2004 :

> 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)

You could use the same sequence in many tables.

> 
> Thanks
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster
> http://search.yahoo.com
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 

-- 
-Achilleus




view thread (7+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0403091610190.32587-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0403091610190.32587-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0403091610190.32587-100000@matrix.gatewaynet.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: achill@matrix.gatewaynet.com, oneway_111@yahoo.com
  Subject: Re: currval() without specifying the sequence name
  In-Reply-To: <Pine.LNX.4.44.0403091610190.32587-100000@matrix.gatewaynet.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