patternsqlCritical
Permission denied in file trying to import
Viewed 0 times
filepermissiontryingdeniedimport
Problem
When I try to use
I found a work around here where you copy the .sql file to the same folder as psql.exe is in.
By the way, does \i stand for import?
\i on a file that is not in the psql.exe folder it says C:: permission denied. For example I have a file with SQL command at C:\Users\Work\Desktop\School Work\load_database.sql and when I type \i "C:\Users\Work\Desktop\School Work\load_database.sql" it says C:: permission denied. How can I fix this?I found a work around here where you copy the .sql file to the same folder as psql.exe is in.
By the way, does \i stand for import?
Solution
You've just run into a peculiarity of
In my comment 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:
should work fine regardless which folder you start
psql on Windows. In my comment 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/Work/Desktop/School Work/load_database.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/Work/Desktop/School Work/load_database.sql": Invalid argumentCode Snippets
\i 'C:/Users/Work/Desktop/School Work/load_database.sql'"C:/Users/Work/Desktop/School Work/load_database.sql": Invalid argumentContext
StackExchange Database Administrators Q#29767, answer score: 69
Revisions (0)
No revisions yet.