Re: schema creation during initdb

From: "sharath kumar" <k(dot)sharat(at)gmail(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: schema creation during initdb
Date: 2007-04-18 09:19:19
Message-ID: 63b2ddcd0704180219q37cee50s993f9734282c36be@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry i have put the question wrongly. I wanted to ask if we can create a
schema during createdb time so that i have to hide the following from the
user.
psql -c 'create schema foo' mytemplate
psql -c 'create table foo.bar ...' mytemplate
Whenever a user runs createdb command, the above schema and table should be
created automatically.
Thanks,
Sharat.

On 4/18/07, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> 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
>
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-04-18 10:07:12 Re: schema creation during initdb
Previous Message Richard Huxton 2007-04-18 08:11:57 Re: Can't ri_KeysEqual() consider two nulls as equal?