On Sat, Mar 8, 2025 at 4:28 PM Joseph Koshakow <kosh...@gmail.com> wrote:
>
> The assert was introduced commit f16241
>
> So if I understand correctly, at the time the assert was added, we in
> fact did not support UPDATE of INSERT ON CONFLICT for a partitioned
> table. However, since then we've added support but nobody removed or
> altered the assert.

I tried to validate this by checking out f16241, and running the following:

    psql (11devel)
    Type "help" for help.

    test=# CREATE TABLE t_int (i int PRIMARY KEY, v int, x int) PARTITION
BY RANGE (i);
      CREATE TABLE t_int_1 PARTITION OF t_int FOR VALUES FROM (1) TO (100);
      CREATE TABLE t_int_2 PARTITION OF t_int FOR VALUES FROM (100) TO
(200);

      INSERT INTO t_int VALUES (1, 10, 100);
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    INSERT 0 1
    test=# INSERT INTO t_int VALUES (1, 11, 111) ON CONFLICT (i) DO UPDATE
SET x = excluded.x;
    INSERT 0 1

So it looks like when that assert was added, we *did* support
INSERT .. ON CONFLICT UPDATE for partitioned tables. So I'm even more
confused about the conversation and assert. You can even update the
partitions directly.

    test=# INSERT INTO t_int_1 VALUES (1, 11, 111) ON CONFLICT (i) DO
UPDATE SET x = excluded.x;
    INSERT 0 1
    test=# INSERT INTO t_int_2 VALUES (150, 11, 111) ON CONFLICT (i) DO
UPDATE SET x = excluded.x;
    INSERT 0 1

Thanks,
Joseph Koshakow

Reply via email to