Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL
Дата
Msg-id 2374553.1645984380@sss.pgh.pa.us
обсуждение исходный текст
Ответ на CREATE DATABASE IF NOT EXISTS in PostgreSQL  (Japin Li <japinli@hotmail.com>)
Ответы Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL  (Japin Li <japinli@hotmail.com>)
Список pgsql-hackers
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.  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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: support for MERGE
Следующее
От: "Euler Taveira"
Дата:
Сообщение: Re: Commitfest manager for 2022-03