I created a dump from one local database and attempted to load it on another machine. When I attempt to load the dumped database it runs the first 1000+ lines until it hits this code;
--
-- Data for Name: active_storage_attachments; Type: TABLE DATA; Schema: public; Owner: jmt
--
COPY public.active_storage_attachments (id, name, record_type, record_id, blob_id, created_at) FROM stdin;
7 screenshot Template 1 7 2023-03-08 03:22:18.528923
.
The error message is as follows;
ERROR: syntax error at or near “7”
LINE 1106: 7 screenshot Template 1 7 2023-03-08 03:22:18.528923
Line 1106 is the line with the values, starting with the number 7.
This whole file is just a dump. I tried deleting this particular line and all of the commands involve COPY and experience the same problem. How do I resolve this?
1
You can restore such a plain-format dump only with the psql
command line client. Other PostgreSQL clients will gag on the data mixed with the COPY
statement.
If you want to restore a pg_dump
with a different PostgreSQL client, you have to take the dump with the option --inserts
.