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

From Japin Li
Subject CREATE DATABASE IF NOT EXISTS in PostgreSQL
Date
Msg-id MEYP282MB1669A5EEBC791F927D89063EB6009@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL
List pgsql-hackers
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_database WHERE datname = 'mydb')\gexec

Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL?

I create a patch for this, any suggestions?

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


Attachment

pgsql-hackers by date:

Previous
From: "Gunnar \"Nick\" Bluth"
Date:
Subject: Re: PATCH: add "--config-file=" option to pg_rewind
Next
From: Jille Timmermans
Date:
Subject: Re: Support for grabbing multiple consecutive values with nextval()