I'd like to use the max value to feed the creation of a sequence. For instance, I am getting the max id value and I'd like to use this value:
DO $$
DECLARE
min_value Integer;
BEGIN
SELECT MAX(tmp.id)+1 into min_value FROM tmp;
-- raise notice 'Value: %', min_value;
CREATE SEQUENCE id_seq_tmp
INCREMENT 1
START :tmp.min_value --Getting error: syntax error at or near ":"
MINVALUE :tmp.min_value;
END $$;
How do I refer to the max value and pass to the sequence creation? I am using psql (PostgreSQL) 13.3.