Re: returning id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 20, 2011 at 12:31 PM, Marc Fromm <Marc.Fromm@xxxxxxx> wrote:
> Can I use “RETURNING id” in an insert statement with postgresql version
> 8.1.10?
>
> I cannot find a clear example on how to use it to capture the id created by
> the insert statement into a variable in PHP.
>
>
>
> Many examples are like this but don’t state how to access the returned id:
>
> INSERT INTO Addresses (address, city, state, postalcode) VALUES ('123 Main
> St.','Springfield','MA','01109') RETURNING id;
>

Is there a reason why you can't use the currval function:
select currval('id_seq')

-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux