Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support for last insert id #1

RJ opened this Issue Jul 13, 2010 · 2 comments


None yet
2 participants

RJ commented Jul 13, 2010

Couldn't see how to do this, is it possible?

When inserting into a table with an auto incrementing/SERIAL primary key



wg commented Jul 13, 2010

Did you try using the RETURNING clause? For example if you had a table named "table" with two columns, "id" and "value" where the id column is of type serial:

INSERT INTO "table" (value) VALUES ('foo') RETURNING id;

RJ commented Jul 13, 2010

This does the trick, thanks a lot.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment