David Rowley
2018-05-09 22:22:04 UTC
bcaas=> explain analyze select id from log_statement where id = (select currval('log_statement_id_seq'));
I know Tom has answered your question, but you may be interested inINSERT RETURNING as this will save you from having to do this to
lookup the ID of the last inserted sequence value.
https://www.postgresql.org/docs/10/static/sql-insert.html
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services