Search code examples
postgresqlpsql

I'm trying to import a SQL backup file but I keep getting an error


I'm trying to import a SQL backup file but I keep getting the error

todolist-# psql todolist < C:\Users\ojadi\Documents\todolist2.sql
invalid command \Users
Try \? for help.
todolist-#

Solution

  • That is a command you give in UNIX shell, not a command you give in psql. Since it seems you already have psql running, you can run the file using command

    \i C:\Users\ojadi\Documents\todolist2.sql

    Note that your prompt todolist-# indicates you are in the middle of writing a command in psql. See my answer to this earlier question