Thread: createdb confusion
man creatdb says -D supposed to be specify the alternative location I try (as postgres user) $ createdb -D /bla bla and it says absolute path are not allowed. Then I read man initlocation. The example I see is $ initlocation /opt/postgres/data $ createdb -D /opt/postgres/data/testdb testdb so I do the same and it fails with the same reason Does anyone have any idea? thanks
I am using 7.1.2 on red hat 7.1 I compiled postgres myself On Wed, Aug 08, 2001 at 08:16:35PM -0400, newsreader@mediaone.net wrote: > man creatdb says -D supposed to be specify the > alternative location > > I try (as postgres user) > > $ createdb -D /bla bla > > and it says > > absolute path are not allowed. > > Then I read man initlocation. The example > I see is > > $ initlocation /opt/postgres/data > $ createdb -D /opt/postgres/data/testdb testdb > > so I do the same and it fails with the same reason > > Does anyone have any idea? > > thanks > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl
newsreader@mediaone.net wrote: > ... > > I try (as postgres user) > > > > $ createdb -D /bla bla > > > > and it says > > > > absolute path are not allowed. > > > > Then I read man initlocation. The example > > I see is > > > > $ initlocation /opt/postgres/data > > $ createdb -D /opt/postgres/data/testdb testdb > > > > so I do the same and it fails with the same reason > > > > Does anyone have any idea? How about: export PGDATA2=/opt/postgres/data initlocation PGDATA2 createdb -D PGDATA2 mydb I haven't created databases in alternate locations, so I'm just going by the manual. ;-) Mike Mascari mascarm@mascari.com
Well. I just did this by hand. I did this: As postgres: export PGDATA2=/opt/postgres initlocation PGDATA2 As root, I stopped the postmaster (which was installed via RPMS): /etc/rc.d/init.d/postgresql stop In X-Term #1 as postgres: export PGDATA2=/opt/postgres postmaster -D /var/lib/pgsql/data In X-Term #2 as postgres: createdb mydb -D PGDATA2 And it worked. Apparently, you must define the environmental variable used in the context of the postmaster session for it to work. Hope that helps, Mike Mascari mascarm@mascari.com newsreader@mediaone.net wrote: > > Did that already. No go. > > On Wed, Aug 08, 2001 at 08:48:52PM -0400, Mike Mascari wrote: > > newsreader@mediaone.net wrote: > > > > > > > export PGDATA2=/opt/postgres/data > > initlocation PGDATA2 > > createdb -D PGDATA2 mydb > > > > I haven't created databases in alternate locations, so I'm just > > going by the manual. ;-)
Mike Mascari <mascarm@mascari.com> writes: > How about: > export PGDATA2=/opt/postgres/data > initlocation PGDATA2 > createdb -D PGDATA2 mydb Note also that the environment variable PGDATA2 must be defined in the *postmaster*'s environment, not only your shell environment. This is a crude (and ugly) way of letting the DBA control which directories may be used as alternate locations --- only what he's listed in the postmaster's environment may be used. regards, tom lane