public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Japin Li <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL
Date: Sun, 27 Feb 2022 12:53:00 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <MEYP282MB1669A5EEBC791F927D89063EB6009@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <MEYP282MB1669A5EEBC791F927D89063EB6009@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
Japin Li <[email protected]> writes:
> Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL?
FWIW, I'm generally hostile to CREATE IF NOT EXISTS semantics across
the board, because of its exceedingly squishy semantics: it ensures
that an object by that name exists, but you have exactly no guarantees
about its properties or contents. The more complex the object, the
bigger that problem becomes ... and a whole database is the most
complex sort of object we have. So IMV, the fact that we don't have
this "feature" is a good thing.
We do have DROP DATABASE IF EXISTS, and I think using that followed
by CREATE is a much better-defined approach.
regards, tom lane
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox