带有插入但没有复制操作的postgres转储

postgres dump with inserts but without copy actions

我正在尝试转储我的数据库。

由于无法在此处详细说明的原因,我无法使用 "Copy" 功能。这意味着插入语句必须是 "pure" 插入。但是,我不确定如何在我的转储中反映这一点。

目前,这是我的转储命令:

 pg_dump -U myUser --column-inserts --data-only  -h localhost my_db> backup

谁能告诉我如何在没有 Copy 函数的情况下获得插入语句?

The documentation of pg_dumps 告诉我们:

--inserts

Dump data as INSERT commands (rather than COPY). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-PostgreSQL databases. However, since this option generates a separate command for each row, an error in reloading a row causes only that row to be lost rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower.