sosms=# SELECT * FROM sms; smsid | inserttime | updatetime | customerid | msisdnto | msisdnfrom | content | status | callbackid -------+----------------------------+----------------------------+------------+----------+------------+---------+--------+------------ 24 | 2009-06-08 11:49:29.517415 | 2009-06-08 11:49:29.517415 | 10 | foo | bar | foobar | 0 | hest (1 row) sosms=# SELECT CURRVAL(pg_get_serial_sequence('sms','smsid')); currval --------- (1 row) sosms=#