BUG #19056: ExecInitPartitionExecPruning segfault due to NULL es_part_prune_infos

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #19056: ExecInitPartitionExecPruning segfault due to NULL es_part_prune_infos
Дата
Msg-id 19056-a677cef9b54d76a0@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #19056: ExecInitPartitionExecPruning segfault due to NULL es_part_prune_infos
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19056
Logged by:          Fei Changhong
Email address:      feichanghong@qq.com
PostgreSQL version: 18rc1
Operating system:   Operating system: centos 8,Kernel version: 5.10.13
Description:

Hi all,

I recently encountered a crash when executing a DELETE on PG18. The issue
can be reproduced on the HEAD branch with the following steps:

session1:
```sql
CREATE TABLE test_hash (
    id int,
    data text
) PARTITION BY HASH (id);

CREATE TABLE test_hash_0 PARTITION OF test_hash
    FOR VALUES WITH (MODULUS 2, REMAINDER 0);

CREATE TABLE test_hash_1 PARTITION OF test_hash
    FOR VALUES WITH (MODULUS 2, REMAINDER 1);

insert into test_hash select 1, '1';

begin ;
update test_hash set data = '2';
```

session2:
```sql
set plan_cache_mode to force_generic_plan;
prepare s as delete from test_hash  where id = $1;
execute s(1);
```

session1:
```sql
commit;
```

The following stack trace was observed:
```
(gdb) bt 10
#0  0x000000000079de74 in list_nth (list=0x0, n=0) at
../../../src/include/nodes/pg_list.h:301
#1  0x00000000007a0eeb in ExecInitPartitionExecPruning (planstate=0x1884f40,
n_total_subplans=2, part_prune_index=0,
    relids=0x18720a8, initially_valid_subplans=0x7ffc6d56b198) at
execPartition.c:1891
#2  0x00000000007bc8d0 in ExecInitAppend (node=0x1863bb0, estate=0x1884ca0,
eflags=0) at nodeAppend.c:147
#3  0x00000000007a2300 in ExecInitNode (node=0x1863bb0, estate=0x1884ca0,
eflags=0) at execProcnode.c:182
#4  0x000000000079af67 in EvalPlanQualStart (epqstate=0x186adf8,
planTree=0x1863bb0) at execMain.c:3143
#5  0x000000000079a8ab in EvalPlanQualBegin (epqstate=0x186adf8) at
execMain.c:2930
#6  0x00000000007e18e1 in ExecDelete (context=0x7ffc6d56b480,
resultRelInfo=0x186af20, tupleid=0x7ffc6d56b402,
    oldtuple=0x0, processReturning=true, changingPart=false, canSetTag=true,
tmresult=0x0, tupleDeleted=0x0,
    epqreturnslot=0x0) at nodeModifyTable.c:1709
#7  0x00000000007e61e2 in ExecModifyTable (pstate=0x186ad10) at
nodeModifyTable.c:4518
#8  0x00000000007a29a1 in ExecProcNodeFirst (node=0x186ad10) at
execProcnode.c:469
#9  0x00000000007959cb in ExecProcNode (node=0x186ad10) at
../../../src/include/executor/executor.h:316
```

Likely cause: EvalPlanQualStart creates a new EState without setting
es_part_prune_infos.


В списке pgsql-bugs по дате отправления: