You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something like this (using dblink instead of postgres_fdw) allows to check if a db exists before creating it:
DO
$do$
BEGIN
IF EXISTS (SELECT FROM pg_database WHERE datname = 'mydb') THEN
RAISE NOTICE 'Database already exists'; -- optional
ELSE
PERFORM dblink_exec('dbname=' || current_database() -- current db
, 'CREATE DATABASE mydb');
END IF;
END
$do$;
Something like this (using dblink instead of postgres_fdw) allows to check if a db exists before creating it:
https://www.postgresql.org/docs/current/postgres-fdw.html
postgres-fdw
does not come with postgres. It's in thepostgres-contrib
packageThe text was updated successfully, but these errors were encountered: