postgres set max sequence value code example
Example 1: postgres select max value
SELECT * FROM payment
WHERE amount = (
SELECT
MAX(amount)
FROM
payment
);
Example 2: update postgres sequence to max
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)+1);