Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2025-09-19 14:53:35
Message-ID: CACJufxET9Qe-=zJtjGrKPr7-1QbVcP9y-vJU9CMEDfPGt_dbyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi. about v59.

check_partitions_not_overlap_list
overlap = list_intersection(sps1->bound->listdatums,
sps2->bound->listdatums);
if (list_length(overlap) > 0)
{
Const *val = (Const *) lfirst(list_head(overlap));
ereport(ERROR,
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("new partition \"%s\" would overlap
with another new partition \"%s\"",
sps1->name->relname, sps2->name->relname),
parser_errposition(pstate, exprLocation((Node *) val)));
}

list_intersection seems not right, how can we be sure it deals with
collation correctly?

It failed to deal with numeric special value (0.0).
demo:
CREATE TABLE t (a numeric) PARTITION BY LIST (a);
CREATE TABLE t1 PARTITION OF t FOR VALUES in ('0', '1');
ALTER TABLE t SPLIT PARTITION t1 INTO
(PARTITION x FOR VALUES in ('0'),
PARTITION x1 FOR VALUES IN ('0.0', '1'));

I’ll think about the solution later; for now, I just wanted to point
out this problem.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2025-09-19 14:55:30 Re: Having postgresql.org link to cgit instead of gitweb
Previous Message Álvaro Herrera 2025-09-19 14:47:53 Re: Having postgresql.org link to cgit instead of gitweb