10.04.2024 12:00, Alexander Lakhin wrote:
Hello Alexander and Dmitry,
10.04.2024 02:03, Alexander Korotkov wrote:
Thank you. I've pushed this fix with minor corrections from me.
Please look at another anomaly with MERGE.
CREATE TEMP TABLE t (i int) PARTITION BY RANGE (i);
CREATE TABLE tp_0_2 PARTITION OF t
FOR VALUES FROM (0) TO (2);
fails with
ERROR: cannot create a permanent relation as partition of temporary relation
"t"
But
CREATE TEMP TABLE t (i int) PARTITION BY RANGE (i);
CREATE TEMP TABLE tp_0_1 PARTITION OF t
FOR VALUES FROM (0) TO (1);
CREATE TEMP TABLE tp_1_2 PARTITION OF t
FOR VALUES FROM (1) TO (2);
ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
succeeds and we get:
regression=# \d+ t*
Partitioned table "pg_temp_1.t"
Column | Type | Collation | Nullable | Default | Storage | Compression |
Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
i | integer | | | | plain | |
|
Partition key: RANGE (i)
Partitions: tp_0_2 FOR VALUES FROM (0) TO (2)
Table "public.tp_0_2"
Column | Type | Collation | Nullable | Default | Storage | Compression |
Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
i | integer | | | | plain | |
|
Partition of: t FOR VALUES FROM (0) TO (2)
Partition constraint: ((i IS NOT NULL) AND (i >= 0) AND (i < 2))
Best regards,
Alexander