X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6E8C1D1BA2E for ; Tue, 9 Mar 2004 13:50:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28424-07 for ; Tue, 9 Mar 2004 09:50:23 -0400 (AST) Received: from web60808.mail.yahoo.com (web60808.mail.yahoo.com [216.155.196.71]) by svr1.postgresql.org (Postfix) with SMTP id E2582D1D17E for ; Tue, 9 Mar 2004 09:50:17 -0400 (AST) Message-ID: <20040309135021.57085.qmail@web60808.mail.yahoo.com> Received: from [64.81.205.234] by web60808.mail.yahoo.com via HTTP; Tue, 09 Mar 2004 05:50:21 PST Date: Tue, 9 Mar 2004 05:50:21 -0800 (PST) From: ow Subject: currval() without specifying the sequence name To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/80 X-Sequence-Number: 17179 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