From: Cal McPherson <calm(at)adtec(dot)com(dot)au>
To: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject:
Date: 2003-12-03 22:49:56
Message-ID: 65ED19764468D411A6AF006094EA0F3B275D61@SERVER
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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

Browse pgsql-interfaces by date

  From Date Subject
Next Message Arthur Ward 2003-12-04 01:15:57 7.4 and Pygresql
Previous Message Tom Lane 2003-12-02 18:06:25 Re: Inserting timestamp values from windowz application