Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
Restrictions You can ask the system catalog pg_database – accessible from any database in the same database cluster. The tricky part is that CREATE DATABASE can only be executed as a single statement. The manual: CREATE DATABASE cannot be executed inside a transaction block. So it cannot be run directly inside a function or DO … Read more