pg_dump to support "on conflict do update"

From: Tanin Na Nakorn <tanin(at)klutchlabs(dot)ai>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: pg_dump to support "on conflict do update"
Date: 2025-05-03 18:30:44
Message-ID: CAPSThKnJdyXt3Zsq5dx3N9EYohXo_eYcnP7GVFfCtWXdOuvHog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2025-05-03 18:44:43 Re: making EXPLAIN extensible
Previous Message Tom Lane 2025-05-03 17:23:51 Re: Fix slot synchronization with two_phase decoding enabled