createdb -- alternate locations

Started by J.R. Beldingalmost 26 years ago11 messagesgeneral
Jump to latest
#1J.R. Belding
jrbelding@yahoo.com

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

I also tried createdb -D 'PGDATA2' testdb, same result.

Any ideas what I'm doing wrong?

Thanks,
J.R. Belding
jrbelding@yahoo.com

#2Charles Tassell
ctassell@isn.net
In reply to: J.R. Belding (#1)
Re: createdb -- alternate locations

Try createdb -D $PGDATA2 testdb

At 11:26 PM 5/25/00, J.R. wrote:

Show quoted text

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

I also tried createdb -D 'PGDATA2' testdb, same result.

Any ideas what I'm doing wrong?

Thanks,
J.R. Belding
jrbelding@yahoo.com

#3Bruce Momjian
bruce@momjian.us
In reply to: Charles Tassell (#2)
Re: createdb -- alternate locations

Try createdb -D $PGDATA2 testdb

I will be surprised if that works. The initlocation manual says -D can
be a path or an environment variable which will be referenced. Not sure
what that means.

At 11:26 PM 5/25/00, J.R. wrote:

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

I also tried createdb -D 'PGDATA2' testdb, same result.

Any ideas what I'm doing wrong?

Thanks,
J.R. Belding
jrbelding@yahoo.com

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#4Bruce Momjian
bruce@momjian.us
In reply to: Charles Tassell (#2)
Re: createdb -- alternate locations

Try createdb -D $PGDATA2 testdb

At 11:26 PM 5/25/00, J.R. wrote:

Hello:

OK, I see this in the code, so it seems $PGDATA2 and 'PGDATA2' are the
same:

if [ "$?" -ne 0 -a ! -d "$Location" ]; then
PGALTDATA=`printenv $Location 2> /dev/null`
if [ -z "$PGALTDATA" ]; then
echo "$CMDNAME: environment variable $Location not set"
exit 1
fi

Does everyone have printenv? I sure hope so.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#5Giles Lean
giles@nemeton.com.au
In reply to: Bruce Momjian (#4)
Re: createdb -- alternate locations

On Thu, 25 May 2000 23:10:49 -0400 (EDT) Bruce Momjian wrote:

Does everyone have printenv? I sure hope so.

Possibly not, since it's not part of UNIX98 (the "Single Unix
Specification, version 2"). I don't have a POSIX standard handy right
now but I don't think it is specified there either.

On the other hand, my NetBSD manual page says printenv was introduced
in BSD 3.0, so perhaps it's everywhere even if non-standard, which
would be typically Unix!

If someone does find a platform that is missing printenv it's easy
enough to change that code to use env and grep instead.

Regards,

Giles

#6Peter Eisentraut
peter_e@gmx.net
In reply to: J.R. Belding (#1)
Re: createdb -- alternate locations

On Thu, 25 May 2000, J.R. wrote:

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

You need to set the PGDATA2 environment variable in the environment of the
postmaster. That is, shut it down, export xxx, restart. Not ideal, I know,
but we're working on it.

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

--
Peter Eisentraut Sernanders v�g 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden

#7Jeff Hoffmann
jeff@propertykey.com
In reply to: J.R. Belding (#1)
Re: createdb -- alternate locations

"J.R." wrote:

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

does anybody actually read the mailing lists? i think this was covered
last week. it's almost certainly that the postmaster was started before
the environment variable was declared. the postmaster needs to be
restarted with the environment variable set in order for this to work.
this should probably be put in bold print in the docs or in a faq (if i
recall correctly, i think it's mentioned there). it'd even be a good
use of annotable documentation, too. it seems like there are a lot of
novice mistakes like that that are common & very frustrating to new
users & that annotated docs or expanded faqs would be really helpful.

jeff

#8Richard J Kuhns
rjk@grauel.com
In reply to: J.R. Belding (#1)

J.R. writes:

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

I also tried createdb -D 'PGDATA2' testdb, same result.

Any ideas what I'm doing wrong?

What a coincidence; I just asked about this last week. What you've got is
right, but before you can createdb, you've got to stop and restart the
postmaster with "PGDATA2=/home/postgres/testdata" in its environment.

Good luck...

--
Richard Kuhns rjk@grauel.com
PO Box 6249 Tel: (765)477-6000 \
100 Sawmill Road x319
Lafayette, IN 47903 (800)489-4891 /

#9Bruce Momjian
bruce@momjian.us
In reply to: Richard J Kuhns (#8)
Re: createdb -- alternate locations

J.R. writes:

Hello:

Novice, just installed PGSQL 7.0 on Redhat 6.1.

Everything went smoothly with initial installation and db setup.
However, I've run into some problems subsequently.

To keep it simple, here is a specific problem. Attempting to create a
database in an alternate location, I went through the following steps as
the superuser (postgres):

mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"

I also tried createdb -D 'PGDATA2' testdb, same result.

Any ideas what I'm doing wrong?

What a coincidence; I just asked about this last week. What you've got is
right, but before you can createdb, you've got to stop and restart the
postmaster with "PGDATA2=/home/postgres/testdata" in its environment.

OK, I have udpated initlocation manual pages to mention stop/restart of
postmaster and that this must be defined everytime the postmaster
starts. Do we allow absolute paths in initlocation anymore? I am not
sure.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#10Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#9)
Re: createdb -- alternate locations

[ Charset ISO-8859-1 unsupported, converting... ]

On Fri, 26 May 2000, Bruce Momjian wrote:

OK, I have udpated initlocation manual pages to mention stop/restart of
postmaster and that this must be defined everytime the postmaster
starts. Do we allow absolute paths in initlocation anymore? I am not
sure.

Only if you compile with ALLOW_ABSOLUTE_PATHS.

So should we remove any mention of that from initlocation?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#11Felix Morley Finch
felix@crowfix.com
In reply to: Bruce Momjian (#10)
Re: createdb -- alternate locations

Sorry for the funky quoting, I read the digest and my mailer won't
burst it.

J.R. writes:

...
mkdir /home/postgres/testdata
export PGDATA2=/home/postgres/testdata
initlocation PGDATA2
createdb testdb -D 'PGDATA2'

the last command failed with this error:
"The database path 'PGDATA2' in invalid. This may be due to a character
that is not allowed or because the chosen path isn't permitted for
databases"
...
Any ideas what I'm doing wrong?

Yes, you need $PGDATA2 when referencing the env var for starters.

--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o