Skip site navigation (1) Skip section navigation (2)

what's going on? (was: Re: [HACKERS] createdb problem)

From: "Jeff Hoffmann" <jeff(at)remapcorp(dot)com>
To: "Lendvary Gyorgy" <gyurika(at)prolan(dot)hu>, <pgsql-hackers(at)postgreSQL(dot)org>
Subject: what's going on? (was: Re: [HACKERS] createdb problem)
Date: 1998-11-24 14:49:15
Message-ID: 00b501be17b9$9b9b2fe0$c525c4ce@remapcorp.com (view raw or flat)
Thread:
Lists: pgsql-hackers
>I use postgres v6.4. My standard database is in /usr/local/pgsql/data
>directory and the PGDATA environment variable points to this database
>directory. But I'd like to create another database into another
>directory. So I tried this:
>killall postmaster
>initdb --pgdata=/home/postgres/database    --that's OK
>postmaster -i -D /home/postgres/database -S -o -F
>createdb -D /home/postgres/database  gazmuvek   --that's not good
>    the answer is:
>ERROR: Unable to locate path '/home/postgres/database/gazmuvek'
>                 This may be due to a missing environment variable in
>the server
>
>After this I tried to type another command:
>createdb gazmuvek
>It was successfull, but the database 'gazmuvek' was created into
>$PGDATA. But it wasn't my desire. I need the database 'gazmuvek' in the
>directory: /home/postgres/database!
>
>
>What is the solution?

i'm a bit confused; it seems like you have a secondary storage area
(/home/postgres/database) and a primary storage area
(/usr/local/pgsql/data).  i think if you have a PGDATA environment variable,
you'll be stuck running that instance of the postmaster with a primary
storage location given in the evironment variable, even if you try to
override it with an absolute path (at least from my limited testing - i
tried exactly what you did with no success, even though logically it should
result in "a clean slate" running from the secondary location).  and i
haven't been able to create a database in a secondary location by specifying
an absolute path, only with environment variables (as of 6.4, it worked OK
in 6.3.2, though)

so for you hackers out there: what's going on?  it seems that environment
variables are the _one true way_ for 6.4, which is a change from 6.3.2.  if
that's the case, most docs don't reflect it, and if not, then there very
well could be some bugs somewhere.

on to the solution, though.  what you probably want to do is kill the
server, set a PGDATA2 environment variable to /home/postgres/database,
restart the server (without the -D /home/postgres/database, just let it use
the PGDATA location) and then set up the secondary storage area, e.g.:

$ initlocation $PGDATA2
$ createdb -D PGDATA2 gazmuvek

this is really the correct way of doing things anyway, if you think through
it a little bit.


Responses

pgsql-hackers by date

Next:From: pierreDate: 1998-11-24 14:57:56
Subject: Re: [SQL] MINUS and slow 'not in'
Previous:From: Vadim MikheevDate: 1998-11-24 14:00:39
Subject: Re: [HACKERS] Re: [SQL] cursor and update + view

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group