Thread: Creating DB

Creating DB

From
"Lorenzo De Vito"
Date:

Is the only way to create DB in a C code to connect to Template1 and then exec the SQL string "CREATE DATABASE databasename" ?
Can I create DB without connecting to template1 ?

Re: Creating DB

From
Tom Lane
Date:
"Lorenzo De Vito" <lorenzodevito@email.it> writes:
> Is the only way to create DB in a C code to connect to Template1 and then e=
> xec the SQL string "CREATE DATABASE databasename" ?
> Can I create DB without connecting to template1 ?

You have to connect to *some* DB.  Doesn't have to be template1, but
that's the most usual choice since it's certain to exist.

            regards, tom lane