Re: Creating DB programmatically?

Поиск
Список
Период
Сортировка
От Michael Wood
Тема Re: Creating DB programmatically?
Дата
Msg-id CAP6d-HVAAmsVtJGfCcfobYhOH8yNQBXKjYAaCi7LjqE7csRK4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Creating DB programmatically?  (Michael Wood <esiotrot@gmail.com>)
Список pgsql-novice
On 12 July 2011 10:53, Michael Wood <esiotrot@gmail.com> wrote:
> On 12 July 2011 09:31, Roy's Email <rmw256@hotmail.com> wrote:
>> Now I am particularly confused.  How do I issue "CREATE DATABASE ..." from
>
> Well, I've never tried it myself, but you can do it from "psql" and
> that connects to Postgres in order to do it.

Sorry if the above is not as clear as it could be.

To clarify, I do not mean that you should use psql to create the
database.  Only that psql does exactly the sort of thing you want to
be able to do, so it is possible :)

You only need to connect to one of the existing databases in order to
check for the existence of other databases or create a new one.  And
template0, template1 are predefined databases that should exist unless
something is wrong with the Postgres installation.

>> my program?  I thought that I needed a connection (PGconn) before I could
>> execute a command and I don't believe I have a valid connection if my
>> attempt to connect to a (non-existent) DB fails.  [Does it change anything
>
> That's why I said you should first connect to the "template1"
> database, which will exist.

--
Michael Wood <esiotrot@gmail.com>

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

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: Creating DB programmatically?
Следующее
От: Francisco Leovey
Дата:
Сообщение: Re: Creating DB programmatically?