createdb confusion

Started by Nonameover 24 years ago5 messagesgeneral
Jump to latest
#1Noname
newsreader@mediaone.net

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

#2Noname
newsreader@mediaone.net
In reply to: Noname (#1)
Re: createdb confusion

I am using 7.1.2 on red hat 7.1

I compiled postgres myself

Show quoted text

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

#3Mike Mascari
mascarm@mascari.com
In reply to: Noname (#1)
Re: createdb confusion

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

#4Mike Mascari
mascarm@mascari.com
In reply to: Noname (#1)
Re: createdb confusion

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:

Show quoted text

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. ;-)

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mike Mascari (#3)
Re: createdb confusion

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