Обсуждение:

Поиск
Список
Период
Сортировка

От
Cal McPherson
Дата:
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_intext,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