I can't 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 create a tablespace in the D drive, I am not allowed to do so. Permission error pops up.

   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 gave 'NETWORK SERVICE' full control on the D drive, but that didn't solve the problem.

  • Did you try to initialize the database cluster manually using initdb? I have absolutely no problems putting the data directory to a different drive. See e.g. here or here for an example
    – user1822
    May 11, 2020 at 10:27
  • I'm afraid I don't understand those two links. I have no idea what those instructions do. I have followed the steps anyway, but I still get the same error. May 11, 2020 at 10:48
  • Installer: 12.2 for Windows 64 / D drive is internal / Filesystem: NTFS May 11, 2020 at 13:26
  • It works for me on Windows 10 with NTFS. I don't have Windows 8 myself, nor can I rent Windows 8 (that I can find anyway) on AWS in order to test it. But I think it should work on 8, so maybe something about your installation history or configuration has created a conflict. Can you get a clean Windows 8 box and try it there as a test?
    – jjanes
    May 12, 2020 at 17:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.