Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL syntax error when working with dump file

I'm new to PostgreSQL and I'm working on pgAdmin 4. I have a dump file which I need to use to load the data from the dump file into the database. I have created a new database and I'm trying to load the data from the dump file into it. What I'm doing is, I'm opening the dump file on pgAdmin, it contains all the code which I just need to execute and the data will be loaded in the database. But when I'm executing the file, its showing me a syntax error at 1 line. The lines of that part of the code are given below.

COPY public.deals (id, startup_id, investor_group_id) FROM stdin;

1   51  2

2   33  7

3   3   5

4   17  9

5   27  10

6   41  12

7   45  3

8   19  13

9   2   11

10  11  10

\.

I'm getting the following error -

ERROR:  syntax error at or near "1"

LINE 89: 1 51 2

        ^

I don't know what to do. If somebody can help me that would be great.

like image 325
user401398 Avatar asked Jul 20 '26 16:07

user401398


1 Answers

You cannot use pgAdmin to restore such a dump.

Use psql:

psql -U postgres -d mydb -f dumpfile
like image 149
Laurenz Albe Avatar answered Jul 24 '26 06:07

Laurenz Albe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!