Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 28F9847697B for ; Wed, 11 Sep 2002 13:43:49 -0400 (EDT) Received: from lsh114.siteprotect.com (lsh114.siteprotect.com [66.113.130.247]) by postgresql.org (Postfix) with ESMTP id 5E8FE476911 for ; Wed, 11 Sep 2002 13:43:48 -0400 (EDT) Received: from bethvizx (252.dsl.seattle.telisphere.com [209.191.188.252]) by lsh114.siteprotect.com (8.9.3/8.9.3) with ESMTP id MAA08237; Wed, 11 Sep 2002 12:43:47 -0500 From: "Beth Gatewood" To: , Subject: Re: writing a function to mimic mysql last_insert_id Date: Wed, 11 Sep 2002 10:43:42 -0700 Message-ID: <000901c259ba$c5b7ee70$0c00000a@bethvizx> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <200209111030.46289.josh@agliodbs.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/83 X-Sequence-Number: 9360 Josh and Ross- Thanks...I am well aware of currval and sequence use, and for me too this would be the easiest solution ;-) However, we are in the midst of porting a mysql database to pgsql. The perl application that is tied to this mysql database heavily utilizes last_insert_id. In an effort to save the perl developers the pain of having to go in and modify a bunch of their SQL to call out to seq.currval, I thought I would attempt to mimic this function. Perhaps there is another way to approach this than writing this type of function? Thanks! Beth > -----Original Message----- > From: Josh Berkus [mailto:josh@agliodbs.com] > Sent: Wednesday, September 11, 2002 10:31 AM > To: Beth Gatewood; pgsql-sql@postgresql.org > Subject: Re: [SQL] writing a function to mimic mysql last_insert_id > > > > Beth, > > > I am wondering if I can get some input on the logic that I > would need to > > code a function that would mimic mysql's last_insert_id().. > > Um, what about CURRVAL('sequence-name')? > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco >