Re: Relative path specified for data_directory is not working as expected

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Eduard-Cristian Stefan <alexandrul(dot)ct(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Relative path specified for data_directory is not working as expected
Date: 2011-06-24 06:42:42
Message-ID: 4E0431E2.6060606@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eduard-Cristian Stefan wrote:
> I have PostgreSQL 9.0.4-1 running as a service on Windows XP Home
> Edition,
> with the command line of the service being:
>
> D:\me\usr\PostgreSQL\bin/pg_ctl.exe runservice -N "pgsql" -D
> "d:/me/etc/PostgreSQL"
>
> In the postgresql.conf file I have the following settings:
>
> data_directory = '../../data/PostgreSQL'
> external_pid_file = '../../var/run/PostgreSQL.pid'
> log_directory = '../../var/log/PostgreSQL'
>
> In this configuration the PostgreSQL service fails to start with the
> message:
>
> FATAL: data directory "C:/WINDOWS/system32/../../data/PostgreSQL"
> does not exist
>
> If using an absolute path for data_directory like this:
>
> data_directory = 'd:/me/data/PostgreSQL'
>
> then the service starts ok, with the curent directory of pg_ctl.exe
> being C:\WINDOWS\system32\, while the pid file and the logs
> are set to the desired location.
>
> I can confirm this behavior by running postgres.exe from the console,
> and for relative paths the data_directory is relative to the current
> folder
> from where postgres.exe is launched, and both external_pid_file and
> log_directory
> are relative to the directory specified with the -D option of the
> command line.
>
> For the record, there is no PGDATA environment variable defined.
>
> Have a nice day,
> Eduard
>
Can't the service script be something like
cd d:/me/data/PostgreSQL; ./pg_ctl.exe runservice -N "pgsql" -D
"d:/me/etc/PostgreSQL"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2011-06-24 07:22:34 Re: Oracle / PostgreSQL comparison...
Previous Message John R Pierce 2011-06-24 06:42:36 Re: Help making tablespaces work for my application