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