Bruce Cota <bruce(at)vivi(dot)com> writes:
> Is there a way, in SQL, to access the oid of the row created
> by an immediately preceding insert statement?
If you are writing a psql script, recent psql versions maintain
a LASTOID variable:
regression=# insert into int4_tbl default values;
INSERT 3357467 1
regression=# select :LASTOID;
?column?
----------
3357467
(1 row)
regression=#
regards, tom lane