已关闭
[Bug]: B库执行alter table产生core #8413
ywzq1161327784创建于  8月19日关闭于  8月31日
ywzq1161327784
ywzq1161327784成员
8月19日 创建

测试类型

SQL功能

测试版本

7.0.0LTS

问题描述

B库执行下面sql产生core

操作系统和硬件信息

不限

测试环境

企业版单机

被测功能

B库功能

预置条件

无

操作步骤

B库执行下面sql

create table t1(f1 int, f2 text, f3 int, f4 bigint, f5 int generated always as (f1 + f3) stored); 
insert into t1 values(1, 'aaa', 3, 1);
insert into t1 values(11, 'bbb', 33, 2);
insert into t1 values(111, 'ccc', 333, 3);
insert into t1 values(1111, 'ddd', 3333, 4);

create view t1_view1 as select * from t1;
select * from t1_view1;
alter table t1 add f6 int first, add f7 int after f4, modify f1 int after f2, modify f3 int first;
select * from t1_view1;
drop view t1_view1;

推测和这个pr相关
https://gitcode.com/opengauss/Plugin/pull/2347

预期输出

执行成功

实际输出

执行core
image.png

日志信息

(gdb) bt
#0  0x0000aaad9dc06af0 in heap_form_tuple_impl (isnull=0xfffa72af1f70, values=0xfffa72af1ec8,
    tupleDescriptor=0xfffa729dbc50)
    at /usr1/douxin/openGauss-server/src/gausskernel/storage/access/common/heaptuple.cpp:844
#1  heap_form_tuple (tupleDescriptor=0xfffa729dbc50, values=0xfffa72af1ec8, isnull=0xfffa72af1f70)
    at /usr1/douxin/openGauss-server/src/gausskernel/storage/access/common/heaptuple.cpp:916
#2  0x0000fffa72ffacf8 in ATRewriteTableInternal (tab=0xfffa72989ab0, oldrel=0xfffa729e6ac8,
    newrel=0xfffa729d1660) at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:11641
#3  0x0000fffa72ffb78c in ATRewriteTable (tab=0xfffa72989ab0, oldrel=0xfffa729e6ac8, newrel=0xfffa729d1660)
    at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:11794
#4  0x0000fffa7304fb64 in ExecRewriteRowTable (tab=0xfffa72989ab0, NewTableSpace=0, lockmode=8)
    at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:34703
#5  0x0000fffa72ff7848 in ATRewriteTables (parsetree=0xfffa73d770c0, wqueue=0xfffa75cda278, lockmode=8)
    at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:10798
#6  0x0000fffa72ff2ce4 in ATController (parsetree=0xfffa73d770c0, rel=0xfffa729e6ac8, cmds=0xfffa72989a00,
    recurse=true, lockmode=8, fromReplace=false)
    at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:9042
#7  0x0000fffa72ff1e70 in AlterTable (relid=24637, lockmode=8, stmt=0xfffa73d770c0)
    at /usr1/douxin/openGauss-server/contrib/dolphin/tablecmds.cpp:8630
#8  0x0000fffa72fc30cc in ProcessUtilitySlow (parse_tree=0xfffa73d770c0,
    query_string=0xfffa74274060 "alter table t1 add f6 int first, add f7 int after f4, modify f1 int after f2, modify f3 int first;", params=0x0, dest=0xfffa73d771d8, sent_to_remote=false,
    completion_tag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/contrib/dolphin/plugin_utility.cpp:5427
#9  0x0000fffa72fc2bec in standard_ProcessUtility (processutility_cxt=0xfffa75cde368, dest=0xfffa73d771d8,
    sent_to_remote=false, completion_tag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/contrib/dolphin/plugin_utility.cpp:5179
#10 0x0000aaad9d830b18 in standard_ProcessUtility (processutility_cxt=0xfffa75cde368, dest=0xfffa73d771d8,
    sent_to_remote=false, completion_tag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/utility.cpp:2611
#11 0x0000fffbab929e10 in gsaudit_ProcessUtility_hook (processutility_cxt=0xfffa75cde368,
    dest=0xfffa73d771d8, sentToRemote=false, completionTag=0xfffa75cde878 "",
    context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/contrib/security_plugin/gs_policy_plugin.cpp:819
#12 0x0000aaad9d7f17f0 in pgaudit_ProcessUtility (processutility_cxt=0xfffa75cde368, dest=0xfffa73d771d8,
    sentToRemote=false, completionTag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/auditfuncs.cpp:1474
#13 0x0000aaad9d09a00c in instr_trace_ProcessUtility (processutility_cxt=0xfffa75cde368,
    dest=0xfffa73d771d8, sent_to_remote=false, completion_tag=0xfffa75cde878 "",
    context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/src/gausskernel/cbb/instruments/trace/instr_trace.cpp:934
#14 0x0000aaad9d8a9218 in hypo_utility_hook (processutility_cxt=0xfffa75cde368, dest=0xfffa73d771d8,
    sentToRemote=false, completionTag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCtas=false)
    at /usr1/douxin/openGauss-server/src/gausskernel/dbmind/kernel/hypopg_index.cpp:166
#15 0x0000aaad9d82f42c in ProcessUtility (processutility_cxt=0xfffa75cde368, dest=0xfffa73d771d8,
    sent_to_remote=false, completion_tag=0xfffa75cde878 "", context=PROCESS_UTILITY_TOPLEVEL, isCTAS=false)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/utility.cpp:1600
#16 0x0000aaad9d826d50 in PortalRunUtility (portal=0xfffa74494060, utilityStmt=0xfffa73d770c0,
    isTopLevel=true, dest=0xfffa73d771d8, completionTag=0xfffa75cde878 "")
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/pquery.cpp:1790
#17 0x0000aaad9d827220 in PortalRunMulti (portal=0xfffa74494060, isTopLevel=true, dest=0xfffa73d771d8,
    altdest=0xfffa73d771d8, completionTag=0xfffa75cde878 "")
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/pquery.cpp:1966
#18 0x0000aaad9d825270 in PortalRun (portal=0xfffa74494060, count=9223372036854775807, isTopLevel=true,
    dest=0xfffa73d771d8, altdest=0xfffa73d771d8, completionTag=0xfffa75cde878 "")
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/pquery.cpp:1229
#19 0x0000aaad9d803afc in exec_simple_query (
    query_string=0xfffa74274060 "alter table t1 add f6 int first, add f7 int after f4, modify f1 int after f2, modify f3 int first;", messageType=QUERY_MESSAGE, msg=0xfffa75cde9f8)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/postgres.cpp:3377
#20 0x0000aaad9d814fdc in ProcessCommandUpperQ (input_message=0xfffa75cde9f8,
    send_ready_for_query=@0xfffa75cde968: false, query_started=@0xfffa75cde969: true)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/postgres.cpp:10054
#21 0x0000aaad9d8145c0 in PostgresMain (argc=1, argv=0xfffa749f7ca0, dbname=0xfffa749f6a88 "testb",
    username=0xfffa749f6a40 "douxin")
    at /usr1/douxin/openGauss-server/src/gausskernel/process/tcop/postgres.cpp:9816
#22 0x0000aaad9d79beec in BackendRun (port=0xfffa75cdef18)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/postmaster/postmaster.cpp:10320
#23 0x0000aaad9d7b1a00 in GaussDbThreadMain<(knl_thread_role)1> (arg=0xfffb9bbc67f8)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/postmaster/postmaster.cpp:15180
#24 0x0000aaad9d7abe0c in InternalThreadFunc (args=0xfffb9bbc67f8)
    at /usr1/douxin/openGauss-server/src/gausskernel/process/postmaster/postmaster.cpp:15912
#25 0x0000aaad9e695f88 in ThreadStarterFunc (arg=0xfffb9bbc67e8)
    at /usr1/douxin/openGauss-server/src/common/port/port_srv/gs_thread.cpp:383
#26 0x0000fffbabd1878c in start_thread (arg=0xfffbab97ff40) at pthread_create.c:486
#27 0x0000fffbabc651bc in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:80

提单组织

内部开发

测试代码

likedislike
ywzq1161327784ywzq1161327784成员
8月19日 添加了label:bug
opengauss_bot
opengauss_bot成员
8月19日 评论:

This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.

likedislike
opengauss_botopengauss_bot成员
8月19日 将 TestManager 设为负责人
opengauss_botopengauss_bot成员
8月19日 添加了label:sig/StorageEngine,sig/AI,sig/CM,sig/CloudNative,sig/SecurityTechnology,sig/SQLEngine
opengauss_bot
opengauss_bot成员
8月19日 评论:

Welcome To openGauss Community

Hey @ywzq1161327784 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: StorageEngine, AI, CM, CloudNative, SecurityTechnology, SQLEngine ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @Igali, @bihua111, @cailei19, @h_ray, @levy53071, @libiao2024, @lihaixiao, @mrzack, @wangfeihuo, @wuyuechuan, @xiong_xjun, @zhangfengzhi123, @zhangxubo, @zhangzq131, @zjh_hw .

likedislike
ywzq1161327784ywzq1161327784成员
8月19日 issue优先级由 无优先级 改变为 次要
ywzq1161327784ywzq1161327784成员
8月19日 关联了看板:openGauss 7.0.0-LTS
ywzq1161327784ywzq1161327784成员
8月19日 修改标题为 “[Bug]: B库执行alter table产生core”,原标题为“[Bug]: B库执行下面sql产生core”
ywzq1161327784ywzq1161327784成员
8月19日 修改了issue 的描述
ywzq1161327784ywzq1161327784成员
8月20日 将 ywzq1161327784 设为负责人
ywzq1161327784ywzq1161327784成员
8月20日 移除了负责人 TestManager
ywzq1161327784ywzq1161327784成员
8月24日 issue状态由 待办的 改变为 已完成
ywzq1161327784
ywzq1161327784成员
8月26日 评论:

20260826转测包自验ok

testb=# select version();

 version

-------------------------------------------------------------------------
-------------------------------------------------------------------------
----------
 (openGauss 7.0.0 build 93bfec54) compiled at 2026-08-26 10:13:12 commit
0 last mr 9389  on aarch64-unknown-linux-gnu, compiled by g++ (GCC) 10.3.
1, 64-bit
(1 row)

testb=# create table t1(f1 int, f2 text, f3 int, f4 bigint, f5 int generated always as (f1 + f3) stored);
CREATE TABLE
testb=# insert into t1 values(1, 'aaa', 3, 1);
INSERT 0 1
testb=# insert into t1 values(11, 'bbb', 33, 2);
INSERT 0 1
testb=# insert into t1 values(111, 'ccc', 333, 3);
INSERT 0 1
testb=# insert into t1 values(1111, 'ddd', 3333, 4);
INSERT 0 1
testb=#
testb=# create view t1_view1 as select * from t1;
CREATE VIEW
testb=# select * from t1_view1;
  f1  | f2  |  f3  | f4 |  f5
------+-----+------+----+------
    1 | aaa |    3 |  1 |    4
   11 | bbb |   33 |  2 |   44
  111 | ccc |  333 |  3 |  444
 1111 | ddd | 3333 |  4 | 4444
(4 rows)

testb=# alter table t1 add f6 int first, add f7 int after f4, modify f1 int after f2, modify f3 int first;
ALTER TABLE
testb=# select * from t1_view1;
  f1  | f2  |  f3  | f4 |  f5
------+-----+------+----+------
    1 | aaa |    3 |  1 |    4
   11 | bbb |   33 |  2 |   44
  111 | ccc |  333 |  3 |  444
 1111 | ddd | 3333 |  4 | 4444
(4 rows)

testb=# drop view t1_view1;
DROP VIEW
likedislike
ywzq1161327784ywzq1161327784成员
8月26日 issue状态由 已完成 改变为 待回归
yangl_
yangl_成员
8月29日 评论:

回归版本:7.0.0 LTS B020
回归结论:通过
回归过程:
image.png

likedislike
liuzhen001liuzhen001成员
8月31日 关闭了 issue
liuzhen001liuzhen001成员
8月31日 issue状态由 待回归 改变为 已验收