Thread: pg_dump to support "on conflict do update"

pg_dump to support "on conflict do update"

From
Tanin Na Nakorn
Date:
Hi hackers,

I've made a proof of concept for pg_dump to support "on conflict do update" here: https://github.com/tanin47/postgres/pull/1

It can be used with the following options: --on-conflict-target-columns url,payload_checksum --on-conflict-update-clause='last_used_at=EXCLUDED.last_used_at'

I'd love to go through the process of making a patch and merge it into the repo.

Before doing that, I'd like to improve a few things first, so I have a few questions:

1. I'd love an opinion on whether the options' shapes look fine where --on-conflict-target-columns is a list of columns and --on-conflict-update-clause is a string. Would love some input there.
2. I'd like to add a test but couldn't exactly find a good example for a test on pg_dump. I wonder if anyone can point me to an example or in the right direction.
3. Is it possible to patch this into the version 16 as well as the version 17 and latest main branch? Because I use v16.

Thank you,
Tanin

FYI, I've compiled the code and used this in production. Therefore, I'm not blocked.

Re: pg_dump to support "on conflict do update"

From
"David G. Johnston"
Date:
On Sat, May 3, 2025 at 12:08 PM Tanin Na Nakorn <tanin@klutchlabs.ai> wrote:
3. Is it possible to patch this into the version 16 as well as the version 17 and latest main branch? Because I use v16.


New features are never back-ported into prior versions.  Feature freeze for v18 just happened meaning any new features will end up in v19 at the earliest.

David J.

Re: pg_dump to support "on conflict do update"

From
Tanin Na Nakorn
Date:
That's reasonable. Thank you. 

On Sat, May 3, 2025 at 12:31 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Sat, May 3, 2025 at 12:08 PM Tanin Na Nakorn <tanin@klutchlabs.ai> wrote:
3. Is it possible to patch this into the version 16 as well as the version 17 and latest main branch? Because I use v16.


New features are never back-ported into prior versions.  Feature freeze for v18 just happened meaning any new features will end up in v19 at the earliest.

David J.

Re: pg_dump to support "on conflict do update"

From
Álvaro Herrera
Date:
Hello,

On 2025-May-03, Tanin Na Nakorn wrote:

> Hi hackers,
> 
> I've made a proof of concept for pg_dump to support "on conflict do update"
> here: https://github.com/tanin47/postgres/pull/1

Please post as a patch attachment on the list.  We don't take patches
from third party sites.  Thanks.

-- 
Álvaro Herrera