For some reason I don't seem to be allowed to set my PostgreSQL data folder to a drive other than the C drive (Windows 8 machine).
1) If I try to do so when installing PostgreSQL, the installation fails. Therefore I need to choose the C drive to make installation work.
2) If I try to move the data folder later on (https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows), PostgreSQL service stops running.
3) Finally, if I try to create a tablespace in the D drive, I am not allowed to do so.
When I run the following query:
CREATE TABLESPACE drive_D OWNER postgres LOCATION 'D:\PostgreSQL\data'
I get the following error:
ERROR: could not set permissions on directory "D:/PostgreSQL/data": Permission denied SQL state: 42501
I am an admin on that machine and I have made sure that I have 'full control' on the D drive.
I also followed advice given on this link "How to create a tablespace on Windows 7 for Postgresql 9.2?". I gave 'NETWORK SERVICE' full control on the D drive, but that didn't solve the problem.