Hi, Alexander!
On Sun, Apr 7, 2024 at 10:00 PM Alexander Lakhin <exclusion@gmail.com> wrote:
> 07.04.2024 01:22, Alexander Korotkov wrote:
> > I've pushed 0001 and 0002. I didn't push 0003 for the following reasons.
>
> Please try the following (erroneous) query:
> CREATE TABLE t1(i int, t text) PARTITION BY LIST (t);
> CREATE TABLE t1pa PARTITION OF t1 FOR VALUES IN ('A');
>
> CREATE TABLE t2 (i int, t text) PARTITION BY RANGE (t);
> ALTER TABLE t2 SPLIT PARTITION t1pa INTO
> (PARTITION t2a FOR VALUES FROM ('A') TO ('B'),
> PARTITION t2b FOR VALUES FROM ('B') TO ('C'));
>
> that triggers an assertion failure:
> TRAP: failed Assert("datums != NIL"), File: "partbounds.c", Line: 3434, PID: 1841459
>
> or a segfault (in a non-assert build):
> Program terminated with signal SIGSEGV, Segmentation fault.
>
> #0 pg_detoast_datum_packed (datum=0x0) at fmgr.c:1866
> 1866 if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
> (gdb) bt
> #0 pg_detoast_datum_packed (datum=0x0) at fmgr.c:1866
> #1 0x000055f38c5d5e3f in bttextcmp (...) at varlena.c:1834
> #2 0x000055f38c6030dd in FunctionCall2Coll (...) at fmgr.c:1161
> #3 0x000055f38c417c83 in partition_rbound_cmp (...) at partbounds.c:3525
> #4 check_partition_bounds_for_split_range (...) at partbounds.c:5221
> #5 check_partitions_for_split (...) at partbounds.c:5688
> #6 0x000055f38c256c49 in transformPartitionCmdForSplit (...) at parse_utilcmd.c:3451
> #7 transformAlterTableStmt (...) at parse_utilcmd.c:3810
> #8 0x000055f38c2bdf9c in ATParseTransformCmd (...) at tablecmds.c:5650
Thank you for spotting this. This seems like a missing check. I'm
going to get a closer look at this tomorrow.
------
Regards,
Alexander Korotkov