Re: schema creation during initdb

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: schema creation during initdb
Дата
Msg-id 46252BA2.6040406@dunslane.net
обсуждение исходный текст
Ответ на schema creation during initdb  ("sharath kumar" <k.sharat@gmail.com>)
Ответы Re: schema creation during initdb  ("sharath kumar" <k.sharat@gmail.com>)
Список pgsql-hackers
sharath kumar wrote:
> How can I create a schema during initdb time?
> For example pg_catalog, pg_toast, information_schema are created 
> during initdb time. Likewise I want to create my own schema at initdb 
> time. How can i do it? Also how to create a table into this schema at 
> that time itself?
>
>

This question really does not belong on -hackers, which is about 
postgres development, not usage. Next time use pgsql-general.

You have misunderstood the purpose of initdb, which is to prepare a 
location for running a postmaster against.

After initdb has run there are no user databases yet created (unless you 
count the postgres database).

So you would need to do something like this:
 initdb ... pg_ctl start ... createdb mytemplate psql -c 'create schema foo' mytemplate psql -c 'create table foo.bar
...'mytemplate
 


After that you can do this:
 createdb --template mytemplate newdb

and the newdb will have your schema and table.

HTH

andrew





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

Предыдущее
От: "sharath kumar"
Дата:
Сообщение: schema creation during initdb
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Unhelpful debug tools on OS X :-(