X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9B35BD1B47A for ; Wed, 3 Dec 2003 23:03:25 +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 19364-05 for ; Wed, 3 Dec 2003 19:02:57 -0400 (AST) Received: from server.adtec.com.au (237.005.dsl.syd.iprimus.net.au [210.50.51.237]) by svr1.postgresql.org (Postfix) with ESMTP id 259E4D1B4A0 for ; Wed, 3 Dec 2003 19:02:53 -0400 (AST) Received: by SERVER with Internet Mail Service (5.5.2653.19) id ; Thu, 4 Dec 2003 09:50:02 +1100 Message-ID: <65ED19764468D411A6AF006094EA0F3B275D61@SERVER> From: Cal McPherson To: "'pgsql-interfaces@postgresql.org'" Subject: Date: Thu, 4 Dec 2003 09:49:56 +1100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/9 X-Sequence-Number: 4618 Regarding libpq: I have a table defined as follows to log instances of a service. CREATE TABLE service_instance( service_instance_id serial PRIMARY KEY, started timestamp, finished timestamp, indial text, pin_in text, FOREIGN KEY(indial, pin_in) REFERENCES service(indial, pin_in) ); I would like to insert a row into the table to log the current service instance. I believe I simply leave out the serial primary key from the insert statement to get the next default value. However, directly after the insert I need to know the default value used for this field. Is this possible with the libpq interface. Can I somehow use object PQoidValue(res) to find the serial id of the inserted row, or is there another way? calsa