pg_dump to support "on conflict do update"

Started by Tanin Na Nakornover 1 year ago4 messageshackers

Thread notes

1 note#feature#moderate#enhancement
hackorum-bot#feature#moderate#enhancement
hackorum-bot
1 day ago

@global #feature #moderate #enhancement

#feature#moderate#enhancement
Jump to latest
#1Tanin Na Nakorn
tanin@klutchlabs.ai

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.

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Tanin Na Nakorn (#1)
Re: pg_dump to support "on conflict do update"

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.

#3Tanin Na Nakorn
tanin@klutchlabs.ai
In reply to: David G. Johnston (#2)
Re: pg_dump to support "on conflict do update"

That's reasonable. Thank you.

On Sat, May 3, 2025 at 12:31 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:

Show quoted text

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.

#4Alvaro Herrera
alvherre@kurilemu.de
In reply to: Tanin Na Nakorn (#1)
Re: pg_dump to support "on conflict do update"

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