On Thu, Nov 06, 2003 at 12:26:48PM -0600, Eliu Montoya wrote: > Does anyone know an easy way to insert a record (without a value for the > primary key because it is a sequence) and at the same time obtain the value > of primary key that was assign to this new record.
Given that you are already using a sequence, you can obtain the last value given to you by means of currval(). No, this doesn't have any concurrency problems with multiple backends inserting at the same time; that's exactly the problem it solves. -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "In Europe they call me Niklaus Wirth; in the US they call me Nickel's worth. That's because in Europe they call me by name, and in the US by value!" ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org