postgres if not exists code example
Example 1: how to check table exists or not in postgresql
SELECT 1 FROM information_schema.tables
WHERE table_schema = 'schema_name' AND table_name = 'table_name';
Example 2: postgres create extension if not exists
CREATE EXTENSION [ IF NOT EXISTS ] extension_name
[ WITH ] [ SCHEMA schema_name ]
[ VERSION version ]
[ FROM old_version ]