Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DEF4F475775; Fri, 23 Aug 2002 21:01:05 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 7C623475153; Fri, 23 Aug 2002 21:01:05 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 5D68F381910; Fri, 23 Aug 2002 21:01:04 -0400 (EDT) From: "Greg Patnude" X-Newsgroups: comp.databases.postgresql.general, comp.databases.postgresql.hackers, comp.databases.postgresql.questions, comp.databases.postgresql.sql Subject: Retrieving the new "nextval" for primary keys.... Date: Fri, 23 Aug 2002 18:15:28 -0700 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 27 Message-ID: X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-hackers@postgresql.org, pgsql-general@postgresql.org, pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/382 X-Sequence-Number: 9228 I am using postgreSQL with Perl::CGI and Perl::DBI::Pg... I would like to be able to insert a row from my Perl script [$SQL->exec();] and have postgreSQL return the id of the newly inserted record (new.id) directly to the Perl script for further processing... Anyone with a solution / idea ??? Nearly EVERY table I create in postgreSQL (7.2) has the following minimum structure: create table "tblName" ( id int4 primary key nextval ("tblName_id_seq"), ..field... ..field... ..field... create_dt date default 'CURRENT_DATE', change_dt timestamptz default 'now()', active_flag bool default 'TRUE' )