Re: Assert when executing query on partitioned table

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Assert when executing query on partitioned table
Date: 2025-03-15 14:57:31
Message-ID: CAAvxfHcN_zqFcY6we158+jMW3ogENAqVBOkYZ1VngvfHUijAcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 8, 2025 at 4:28 PM Joseph Koshakow <koshy44(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-03-15 15:20:23 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Melanie Plageman 2025-03-15 14:43:45 Re: BitmapHeapScan streaming read user and prelim refactoring