How to get the last inserted id from a sequence in postgresql

No Comments

Use the currval() sequence function

SELECT currval('my_sequence');

Replace my_sequence with your sequence, remember currval returns the latest value that was obtained from your sequence in your session.

Image Credits: Photo by Isis França on Unsplash.

Last Updated On April 07, 2018

Related Articles

No results found

Leave a Reply

Notify of
Copy link