[ACCEPTED]-PHP Postgres: Get Last Insert ID-last-insert-id
Accepted answer
INSERT, UPDATE and DELETE in PostgreSQL 4 have a RETURNING clause which means you 3 can do:
INSERT INTO ....
RETURNING id;
Then the query will return the value 2 it inserted for id for each row inserted. Saves 1 a roundtrip to the server.
Yes, the sequence functions provide multiuser-safe methods for obtaining successive 1 sequence values from sequence objects.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.