Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL - Mailing list pgsql-hackers

From Japin Li
Subject Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL
Date
Msg-id MEYP282MB1669A6D5FD725BE31EAE844AB6019@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 28 Feb 2022 at 01:53, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Japin Li <japinli@hotmail.com> 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.

Thanks for the explanation!  I think it is the database user who should
guarantee the properties and contents of a database.
CREATE IF NOT EXISTS is just a syntax sugar.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Checkpointer sync queue fills up / loops around pg_usleep() are bad
Next
From: Masahiko Sawada
Date:
Subject: Re: Design of pg_stat_subscription_workers vs pgstats