X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE3B552999 for ; Thu, 7 Jul 2005 16:15:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67275-02 for ; Thu, 7 Jul 2005 19:15:16 +0000 (GMT) Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) by svr1.postgresql.org (Postfix) with ESMTP id 11A8952998 for ; Thu, 7 Jul 2005 16:15:13 -0300 (ADT) Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) id 4259ADFA013C675A; Thu, 7 Jul 2005 15:15:02 -0400 Received: from smtp2.surnet.cl (mr2.surnet.cl []) by mr2.surnet.cl ([216.155.73.169]); Thu, 07 Jul 2005 19:15:02 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl (7.0.031.3) id 4259ADE300C118C2; Thu, 7 Jul 2005 15:14:58 -0400 Received: from alvh.no-ip.org (200.85.217.230) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 42B3EF60002BD1DE; Thu, 7 Jul 2005 15:15:09 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 679B1C2DC70; Thu, 7 Jul 2005 15:15:10 -0400 (CLT) Date: Thu, 7 Jul 2005 15:15:10 -0400 From: Alvaro Herrera To: mail TechEvolution Cc: pgsql-sql@postgresql.org Subject: Re: getting back autonumber just inserted Message-ID: <20050707191510.GC11800@alvh.no-ip.org> References: <42CD6B58.6060508@techevolution.be> <20050707180329.GA11332@alvh.no-ip.org> <42CD7298.7040504@techevolution.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42CD7298.7040504@techevolution.be> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.39 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY X-Spam-Level: * X-Archive-Number: 200507/42 X-Sequence-Number: 22020 On Thu, Jul 07, 2005 at 08:21:12PM +0200, mail TechEvolution wrote: > hi Alvaro Herrera > > >>You use the currval() function, using the name of the involved sequence > >>as parameter. There is a pg_get_serial_sequence() function, to which > >>you give the table name and column name > > thx for the information > > and is there a function i can use to get the last added autonumber without > knowing wich table or row? (exactly as select @@ IDENTITY does?) i have > read in the messages that there must be such a function for version 8.0, > but i could not find it in the documentation, any idea on it? There is no such function in 8.0. There will be in 8.1, however. -- Alvaro Herrera () "El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)