Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2024-04-11 12:00:00
Message-ID: fdaa003e-919c-cbc9-4f0c-e4546e96bd65@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Dmitry,

11.04.2024 11:59, Dmitry Koval wrote:
>
>> FWIW, I also proposed a patch earlier that fixes error messages and
>> comments in the split partition code
>
> Sorry, I thought all the fixes you suggested were already included in v1-0002-Fixes-for-english-text.patch (but they
> are not).
> Added missing lines to v2-0002-Fixes-for-english-text.patch.
>

It seems to me that v2-0001-Fix-for-SPLIT-MERGE-partitions-of-temporary-table.patch
is not complete either.
Take a look, please:
CREATE TABLE t (i int) PARTITION BY RANGE (i);
SET search_path = pg_temp, public;
CREATE TABLE tp_0_1 PARTITION OF t
  FOR VALUES FROM (0) TO (1);
-- fails with:
ERROR:  cannot create a temporary relation as partition of permanent relation "t"

But:
CREATE TABLE t (i int) PARTITION BY RANGE (i);
CREATE TABLE tp_0_1 PARTITION OF t
  FOR VALUES FROM (0) TO (1);
CREATE TABLE tp_1_2 PARTITION OF t
  FOR VALUES FROM (1) TO (2);
INSERT INTO t VALUES(0), (1);
SELECT * FROM t;
-- the expected result is:
 i
---
 0
 1
(2 rows)

SET search_path = pg_temp, public;
ALTER TABLE t
MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
-- succeeds, and
\c -
SELECT * FROM t;
-- gives:
 i
---
(0 rows)

Please also ask your tech writers to check contents of src/test/sql/*, if
possible (perhaps, they'll fix "salesmans" and improve grammar).

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2024-04-11 12:03:55 Re: Fix possible dereference null pointer (src/backend/replication/logical/reorderbuffer.c)
Previous Message Kirill Reshke 2024-04-11 11:55:59 Re: Allow non-superuser to cancel superuser tasks.