0

I have a dump file which is:

COPY public.applications (id, reference_id, lead_id) FROM stdin;

This is followed by the rows that need to be added.

Instead of copy, I want to insert these rows from stdin because copy is replacing my entire table (removing existing data in the table). I just want to add rows, not remove any existing ones.

I tried:

insert into public.applications (id, reference_id, lead_id) values FROM stdin;

But this is incorrect syntax. Whats the correct way to do this? Is there a way to tweak the copy command to only add rows and not replace the table?

1
  • 1
    copy does not removed existing rows Commented Dec 29, 2019 at 8:36

1 Answer 1

1

As currently pointed out in the comments, copy does not do replacements. Which is to say, COPY public.applications (id, reference_id, lead_id) FROM stdin; will emulate same behaviour as insert.

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

2 Comments

Whats the difference then between insert and copy?

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.