Re: ON CONFLICT DO NOTHING on pg_dump

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: "Ideriha, Takeshi" <ideriha.takeshi@jp.fujitsu.com>
Cc: Surafel Temesgen <surafel3000@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>
Date: 2018-07-13T02:02:12Z
Lists: pgsql-hackers
On Fri, Jul 13, 2018 at 12:33 PM, Ideriha, Takeshi
<ideriha.takeshi@jp.fujitsu.com> wrote:
>>+        Add ON CONFLICT DO NOTHING clause in the INSERT commands.
>>
>>I think this would be better as: Add <literal>ON CONFLICT DO NOTHING</literal> to
>><command>INSERT</command> commands.
>
> Agreed.
>
>>+    printf(_("  --on-conflict-do-nothing     dump data as INSERT
>>commands with ON CONFLICT DO NOTHING \n"));
>>
>>That's slightly misleading... let's just use the same wording again, eg "add ON
>>CONFLICT DO NOTHING to INSERT commands".
>
> Agreed. But you forgot fixing it at pg_dump.c.
> So could you please fix this and commit it?

Right, thanks.

I noticed one more thing: pg_dumpall.c doesn't really need to prohibit
--on-conflict-do-nothing without --insert.  Its existing validation
rejects illegal combinations of the settings that are *not* passed on
to pg_dump.  It seems OK to just pass those on and let pg_dump
complain.  For example, if you say "pg_dumpall --data-only
--schema-only", it's pg_dump that complains, not pg_dumpall.  I think
we should do the same thing here.

Pushed, with those changes.

Thanks for the patch and the reviews!

-- 
Thomas Munro
http://www.enterprisedb.com


Commits

  1. Add pg_dump --on-conflict-do-nothing option.