Postgres 从标准输入插入语句

Postgres Insert statements from stdin

我有一个转储文件是:

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

后面是需要添加的行。

我想从 stdin 插入这些行而不是复制,因为复制正在替换我的整个 table(删除 table 中的现有数据)。我只想添加行,而不是删除任何现有行。

我试过了:

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

但这是不正确的语法。执行此操作的正确方法是什么? 有没有办法调整复制命令只添加行而不替换 table?

正如目前在评论中指出的那样,copy 不进行替换。 也就是说,COPY public.applications (id, reference_id, lead_id) FROM stdin; 将模拟与插入相同的行为。