Re: PATCH: pg_dump to support "on conflict do update"

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tanin Na Nakorn <tanin47(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: PATCH: pg_dump to support "on conflict do update"
Date: 2025-05-05 07:31:00
Message-ID: d7fe9dc9f3e020e16f9121074b2ddeb33c350ee8.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 2025-05-03 at 22:47 -0700, Tanin Na Nakorn wrote:
> Here's the patch (against the latest master) that will make pg_dump support "on conflict do update" .
>
> I've used this patch on v16 for our company's CI (on Github Actions), and it works perfectly fine.
>
> Users would be able to use it like this:
>
> ./src/bin/pg_dump/pg_dump $DATABASE_URL \
>             --table=some_random_table \
>             --data-only \
>             --on-conflict-target-columns url,payload_checksum \
>             --on-conflict-update-clause='last_used_at=EXCLUDED.last_used_at' \
>             --inserts \
>             --rows-per-insert=10 \
>             --no-sync \
>             --file=/tmp/test.dump
>
> There are 3 caveats:
>
> 1. The "on conflict do update" would apply to every table. In my opinion, this is fine.

I don't think that is fine. I think it would make the feature unusable for most cases.
At the very least, there would have to be a way to specify which tables are affected.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-05-05 07:52:46 Fix a race condition in ConditionVariableTimedSleep()
Previous Message Yura Sokolov 2025-05-05 07:30:50 SpinLockAcquire and SpinLockRelease is broken on ARM/ARM64? (Re: sinvaladt.c: remove msgnumLock, use atomic operations on maxMsgNum)