0

i am using PostgreSQL database for my application. Now i have to import my all databases in it.

I am using this command for importing,

psql -U postgres Employees < dbimport.pgsql 

but it is not importing. I have already created the database with name Employees in my PostgreSQL. Getting Error like,

42601: syntax error at or near "psql"

Please suggest me if i am going wrong.

2
  • 42601: syntax error at or near "psql" Commented Dec 28, 2017 at 8:14
  • psql is a command line program, not a SQL command (and again: that error message should be part of your question, not a comment) Commented Dec 28, 2017 at 8:14

2 Answers 2

0

if you have postgres client installed, probably you have misconfigured environmental variables ($PATH), to find the psql use instructions here: https://stackoverflow.com/a/44106963/5315974

Basically you need to usemlocate (if you have it installed) or just find...

Unrelated, but also I would avoid using mixed case in database name...

Also 42601: syntax error at or near "psql" error code means you try to run psql as SQL statement, which it is not - look into your dbimport.pgsql if you have not SQL there - maybe it is shell (or some other) script?..

Sign up to request clarification or add additional context in comments.

Comments

0

The error 42601: syntax error at or near "psql" is a syntax_error from the database not from the terminal, so the value of $PATH is not wrong.

It looks like the file 'dbimport.pgsql' which you are trying to import does not contain the importable data.

Can you confirm, how this backup was taken? Or the content of file 'dbimport.pgsql'.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.