Re: Insert and obtain the pk - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Insert and obtain the pk
Date
Msg-id Pine.LNX.4.44.0311061951290.29650-100000@peter.localdomain
Whole thread Raw
In response to Insert and obtain the pk  ("Eliu Montoya" <eliu@itam.mx>)
List pgsql-general
Eliu Montoya writes:

> 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.

If you know the name of the sequence then you can use the function
currval() to get the last assigned value in your session.

--
Peter Eisentraut   peter_e@gmx.net


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Install files for version 7.4
Next
From: "Carlos Oliva"
Date:
Subject: Re: Install files for version 7.4