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-12T10:42:31Z
Lists: pgsql-hackers

Attachments

On Wed, Jul 11, 2018 at 2:20 PM, Ideriha, Takeshi
<ideriha.takeshi@jp.fujitsu.com> wrote:
> I did regression tests (make check-world) and
> checked manually pg_dump --on-conflict-do-nothing works properly.
> Also it seems to me the code has no problem.
> This feature has advantage to some users with small code change.
>
> So I marked it as 'Ready for committer'.
> I'd like to wait and see committers opinions.

Yeah, it's not an earth-shattering feature, but it might occasionally
be useful and isn't complicated.

+        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.

+    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".

                {"no-unlogged-table-data", no_argument,
&no_unlogged_table_data, 1},
+               {"on-conflict-do-nothing", no_argument,
&on_conflict_do_nothing, 1},

I was tempted to say that this should be in alphabetical order, but
then I noticed that these are only *almost* in alphabetical order, not
quite.  Oh well.

Here's the version I'd like to commit, if there are no objections.

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

Commits

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