Re: PGDATA on Windows - Mailing list pgsql-novice

From Thomas Kellerer
Subject Re: PGDATA on Windows
Date
Msg-id mlpk16$8e7$1@ger.gmane.org
Whole thread Raw
In response to PGDATA on Windows  ("Birchall, Austen" <austen.birchall@metoffice.gov.uk>)
List pgsql-novice
Birchall, Austen wrote on 16.06.2015 16:15:
> 1. For 9.4.3 on Windows Server 2008 the installer has installed to:
>
> C:\Program Files (x86)\PostgreSQL\9.4\data
>
> Is this the recommended location

Definitely not.

I thought the Windows installer was long fixed to suggest an more appropriate location.
If it still defaults to "Program Files" I'd call this a bug.

(I personally don't use the installer on Windows, only the ZIP binaries)

> 2. Should PGDATA be set as a system variable and if so to what?

Not necessarily, because you can pass the location when defining the service.

>
> 3. If I try to try pg_ctl manually I get:
>
> C:\Program Files (x86)\PostgreSQL\9.4\bin>pg_ctl -D C:\Program Files (x86)\Post
> greSQL\9.4\data status
> pg_ctl: unrecognized operation mode "Files"
> Try "pg_ctl --help" for more information.
>
> C:\Program Files (x86)\PostgreSQL\9.4\bin>
>
> What is the correct syntax to do this?
>

You need double quotes:

C:\Program Files (x86)\PostgreSQL\9.4\bin>pg_ctl -D "C:\Program Files (x86)\PostgreSQL\9.4\data status"

But again: storing application data in "Program Files" is never a good idea on Windows.

%ProgramData% (usually c:\ProgramData) is a _much_ better choice - or anything else _outside_ "Program Files".

If you run initdb manually you need to make sure that privileges on the directory or set correctly.
This is usually the case for anything outside of "Program Files".

Thomas


pgsql-novice by date:

Previous
From: Daniel Begin
Date:
Subject: Re: PGDATA on Windows
Next
From: Eugene Vilensky
Date:
Subject: postgresql CentOS 7.1 systemd streaming replica startup