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