Insert and obtain the pk - Mailing list pgsql-general

From Eliu Montoya
Subject Insert and obtain the pk
Date
Msg-id 200311061816.hA6IGqS22254@cc107.itam.mx
Whole thread Raw
Responses Re: Insert and obtain the pk  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: Insert and obtain the pk  (Peter Eisentraut <peter_e@gmx.net>)
Re: Insert and obtain the pk  (Adam Ruth <aruth@intercation.com>)
List pgsql-general

 

 

 

Hello everybody,

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.

 

I always try insert and then select with the same values that I used for the insert, but I believe this is not a good way to do it.

 

Any suggestions???

pgsql-general by date:

Previous
From: "Simon Stiefel"
Date:
Subject: Re: Question on database structure
Next
From: Oleg Bartunov
Date:
Subject: Re: tsearch2 and gist index bloat