Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
On Mon, 28 Feb 2022 at 01:53, Tom Lane wrote: > Japin Li 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 obje

Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Tom Lane
Japin Li 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

CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
Hi, hackers When I try to use CREATE DATABASE IF NOT EXISTS in PostgreSQL, it complains this syntax is not supported. We can use the following command to achieve this, however, it's not straightforward. SELECT 'CREATE DATABASE mydb' WHERE NOT EXISTS (SELECT FROM pg