pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Cal McPherson <calm@adtec.com.au>
To: 'pgsql-interfaces@postgresql.org' <pgsql-interfaces@postgresql.org>
Date: Thu, 4 Dec 2003 09:49:56 +1100
Message-ID: <65ED19764468D411A6AF006094EA0F3B275D61@SERVER> (raw)

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



Message-ID: <65ED19764468D411A6AF006094EA0F3B275D61@SERVER>
Permalink:  ../65ED19764468D411A6AF006094EA0F3B275D61@SERVER/
Also on:    postgresql.org/message-id/65ED19764468D411A6AF006094EA0F3B275D61@SERVER

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: calm@adtec.com.au
  Subject: Re: 
  In-Reply-To: <65ED19764468D411A6AF006094EA0F3B275D61@SERVER>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox