6

Hi I am using Postgres 11 and pgadmin 4.1. I have a SQL file i am trying to import in my newly created database in pgadmin 4.

I know its a generalized error but I tried my best to resolve it, but not working for me.

Here is the error:

enter image description here

Here are a few SQL file lines.

enter image description here

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Maha Dev
  • 3,915
  • 2
  • 31
  • 50

1 Answers1

2

There are two things in a plain text dump that may prevent it being restored using the query tool og pgAdmin:

  • backslash commands, like the \connect you get if you use the --create option of pg_dump (only psql understands these)

  • COPY commands to load the data, because pgAdmin does not support mixing SQL and data the way that psql does

So if the dump was created without --create and with either --schema-only or --inserts, it will probably load fine.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Doesn't solve the problem in my case, as automated pgadmin dump does contain backslash command; and strangely pgadmin dump as sql cannot be restored. – Polv May 03 '21 at 07:36
  • 1
    @Polv My answer was incomplete. I have improved it. – Laurenz Albe May 03 '21 at 07:43