{"id":6529,"date":"2018-04-07T10:56:01","date_gmt":"2018-04-07T15:56:01","guid":{"rendered":"http:\/\/www.carnaghan.com\/?post_type=epkb_post_type_1&p=6529"},"modified":"2018-04-07T10:56:01","modified_gmt":"2018-04-07T15:56:01","slug":"how-to-get-the-last-inserted-id-from-a-sequence-in-postgresql","status":"publish","type":"epkb_post_type_1","link":"https:\/\/www.carnaghan.com\/knowledge-base\/how-to-get-the-last-inserted-id-from-a-sequence-in-postgresql\/","title":{"rendered":"How to get the last inserted id from a sequence in postgresql"},"content":{"rendered":"
Use the\u00a0currval()\u00a0<\/strong>sequence function<\/p>\n Replace\u00a0my_sequence\u00a0<\/em><\/strong>with your sequence, remember\u00a0currval<\/strong><\/em>\u00a0returns the latest value that was obtained from your sequence in your session.<\/p>\n","protected":false},"excerpt":{"rendered":" Use the\u00a0currval()\u00a0sequence function SELECT currval(‘my_sequence’); Replace\u00a0my_sequence\u00a0with your sequence, remember\u00a0currval\u00a0returns the latest value that was obtained from your sequence in your session.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"epkb_post_type_1_category":[4427],"epkb_post_type_1_tag":[],"yoast_head":"\nSELECT currval('my_sequence');<\/pre>\n<\/div>\n<\/div>\n