skip to Main Content

I’m using Windows 10, and cmd psql. I’m following a tutorial on PostgreSQL, where I’m trying to import my ai-generated .sql file into previously created database named test. I use i c:UsersAdminDownloadsperson.sql command. But i keep getting C:: Permission denied error.

I tried couple of things to resolve this issue. Firstly, i changed permissions in Security settings of the file and give Everyonefull control, which did not help. Then there were suggestions to simply format the path string in a particular way, which i did (see below) and no luck either.

i c:UsersAdminDownloadsperson.sql
i got:
c:: Permission denied

i c:/Users/Admin/Downloads/person.sql
i got:
c:/Users/Admin/Downloads/person.sql: No such file or directory

i 'C:/Users/Admin/Downloads/person.sql'
i got:
C:/Users/Admin/Downloads/person.sql: No such file or directory

i 'c:\Users\Admin\Downloads\person.sql'
i got:
c:/Users/Admin/Downloads/person.sql: No such file or directory

i C:\Users\Admin\Downloads\person.sql
i got:
C:: Permission denied

I moved it to D drive, changed permissions and still got the same D:: Permission denied message. I run cmd as Admin, didn’t help. I’m not sure what to do next?? I’m completely lost. Does anyone know how to resolve this problem?

2

Answers


  1. Chosen as BEST ANSWER

    Ok, you guys after i uninstalled postgreSQL, and installed again the command with forward slashes in single quotes i 'C:/Users/Admin/Downloads/person.sql' worked!!! So, if you have similar problem try to delete postgresql and then install it again.


  2. You’ve just run into a peculiarity of psql on Windows.

    I just wanted to exclude the possibility that you really didn’t have the necessary permission. Then it turned out that even on Windows, you have to use ‘normal’ slashes instead of backslashes, that is:

    i 'C:/Users/Admin/Downloads/person.sql'
    should work fine regardless which folder you start psql from. Notice that I used single quotes – with double quotes you’d got

    "C:/Users/Admin/Downloads/person.sql": Invalid argument

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search