I want to import a sql file in PostgreSQL. I am using pgadmin iii. I create an sql file in phpmyadmin and now i want to import same file in pgadmin iii. I am doing following but it didn't work for me. I select schema of the database in pgadmin iii and after that I try to execute following query:
\i C:/Users/umair/Downloads/school_management_system(1).sql
but it generates an error and the error is:
ERROR: syntax error at or near "\"
LINE 1: \i C:/Users/umair/Downloads/school_management_system(1).sql
^
********** Error **********
ERROR: syntax error at or near "\"
SQL state: 42601
Character: 1
Please help me out.
I think that the best way to import an sql file is using the psql
tool like this:
psql -U postgres -h localhost -d my_database -f "C:/Users/umair/Downloads/school_management_system(1).sql"