0

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.

1 Answer 1

0

For some reason I don't seem to be allowed to change my PostgreSQL data folder to a drive other than the C drive.

This is not the correct way to do that anyway. Creating a tablespace and moving the whole cluster are different things.

I am an admin on that machine and I have made sure that I have 'full control' on the D drive.

It doesn't matter who you are, what matters is who is the service account running PostgreSQL, and what permissions that account has.

1
  • I know they are different things. That's the point, I am not allowed to do either of them. If I try to choose a data folder in the D drive when installing PostgreSQL the installation fails. If later on I try to create a tablaspace in the D drive, I am not allowed. I don't understand the second comment.I don't know what a service account is. Mar 26, 2020 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.