how to check if a sequence exists in postgresql code example
Example 1: create sequence if not exists postgres
CREATE SEQUENCE IF NOT EXISTS tbl_field_seq;
Example 2: how to check if a sequence exists in postgresql
IF EXISTS (SELECT 0 FROM pg_class where relname = '<my sequence name here>' )
THEN
--stuff here
END IF;