Windows DatabaseebooksStatistical Information

LLE10222 : Howto use \i command in psql for postgres running on windows?


You want to use \i to read a file and execute all the commands in it but you get an invalid argument error




Windows and linux use a different syntax for file locations. The backslash is the main problem. To execute a script, you should double all your backslashes, this can be used to run scripts from an UNC path to.


postgres=# \i y:\server\script.sql
y:: Invalid argument

If you use the following

postgres=# \i 'y:\\server\\script.sql'

Your script will, if the syntax is correct, work.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!
Copyright © 2004-2011 Lubby (V3.0.10 Aug 2011)
Sponsored by Keskon.
Statistical information by Google Analytics