returning id

From: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: returning id
Date: 2011-09-20 19:31:10
Message-ID: 93361C67E4EE844A80935863A4FF4B6C05114F81@Exch2010MB-2.univ.dir.wwu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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;

Thanks

Marc

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Lonni J Friedman 2011-09-20 19:44:52 Re: returning id
Previous Message Daniel Vázquez 2011-09-20 18:57:26 Unaccent contrib module for PostgreSQL 8.4