Get value back of serial with postgres sql components lazarus / 16-Databases ---------------------------------------------------------------------- BezNalogov · 2009-08-12 12:13 I use the TPQConnection, TSQLTransaction, TSQLQuery and TDatasource components to make my program communicate with the postgres server. Everything works fine here, updating, inserting, etc no problem at all. Only after inserting a new record I somehow need to get the value of a field called contact_id, this is a serial type of field (autoincrement). Is there an easy way to do this via for example the datasource of sqlquery component? ---------------------------------------------------------------------- Marc · 2009-08-12 18:58 What you can do too is to retrieve the nextval of the serialsequence and use that in a beforeinsert event. Since this sequence is a default, it won't increase if a value is present when posted. We used to do it like this when we were using oracle sequences (and still do sometimes for postgres)