SCM

[#1011315] Retrieving ID with RETURNING instead of querying the sequence

View Trackers | Patches | Download .csv | Monitor

Date:
2013-03-06 23:39
Priority:
3
State:
Open
Submitted by:
Damian W (metrix)
Assigned to:
Nobody (None)
Category:
None
Group:
None
Resolution:
None
 
Summary:
Retrieving ID with RETURNING instead of querying the sequence

Detailed description
Hi,

right now when using INSERT to put a new record into the database you do the following:

INSERT INTO "schema"."table" (...) VALUES (...);SELECT currval(pg_get_serial_sequence('"schema"."table"', 'id')) AS "id";

That is totally slow and not recommend by PostgreSQL.

The prefereable way is:

INSERT INTO "schema"."table" (...) VALUES (...) RETURNING id AS "id";

This also helps when the ID column uses some kind of computed values instead of a sequence. Currently using something else then a sequence is not possible.

Please add support for RETURNING statement, thank you!

Followup

No Followups Have Been Posted

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge