Create Sequence If Not Exists Postgres

[Solved] Create Sequence If Not Exists Postgres | Sql - Code Explorer | yomemimo.com
Question : create sequence if not exists postgres

Answered by : awful-angelfish-vg95g3t8onw2

CREATE SEQUENCE IF NOT EXISTS tbl_field_seq;

Source : | Last Update : Tue, 02 Feb 21

Question : how to check if a sequence exists in postgresql

Answered by : emmanuel-mahuni

IF EXISTS (SELECT 0 FROM pg_class where relname = '<my sequence name here>' )
THEN --stuff here
END IF;

Source : https://stackoverflow.com/questions/11905868/check-if-sequence-exists-in-postgres-plpgsql | Last Update : Sun, 16 May 21

Answers related to create sequence if not exists postgres

Code Explorer Popular Question For Sql