I am using Windows 10

I have a PostgreSQL file when I run inside the PSQL CMD

\i FILENAMEPATH

postgres=# \i C:\Users\Asus\Desktop\Projects\Movies\solution.sqlC:: Permission denied

I get that Permission Denied

C:: Permission denied

Is there a way around this? Or how can I gain permission?

2

Best Answer


As a_horse_with_no_name pointed out, using forward slashes instead of backslashes in the address solves the problem.

This is because windows unlike most OSs, resolves paths with forward slashes.

What solved this issue for me is opening a PowerShell in the folder location of the sql file (in folder: shift + right-click -> open PowerShell here), to avoid having to provide a file path, and then running '\i filename.sql'