已关闭
[Bug]: shark用例identity相关问题 #8397
liyangx创建于  8月13日关闭于  8月24日
liyangx成员
8月13日 创建

测试类型

SQL功能

测试版本

7.0.0LTS

问题描述

① shark 用例执行结果与预期不符:identity用例(修复后请放开 contrib/shark/parallel_schedule 中 identity 用例 )

shark 的 identity 回归用例执行失败。用例中多处 D 兼容 identity 相关 SQL 与预期不一致,主要表现为 CREATE TABLE ... LIKE ... INCLUDING IDENTITY 在复制 D identity 列时失败,报错 Identity column contains invalid INCREMENT.。

失败后目标表未创建成功,导致后续 \d+、insert、select、drop 等语句继续报 relation does not exist,形成连锁错误。

该问题不是 dump/restore 问题,也不是简单 expected 更新问题。失败发生在 identity 用例普通 SQL 执行阶段,属于 D identity 在 LIKE ... INCLUDING IDENTITY 场景下复制 identity 属性/序列参数失败的问题。

相关提交PR:
https://gitcode.com/opengauss/openGauss-server/pull/9137

② shark 用例执行结果与预期不符:pg_identity_dump_restore用例

该用例由PR https://gitcode.com/opengauss/openGauss-server/pull/9137 新建,麻烦分析解决相关问题,
且用例存在dump问题,可同 issue https://gitcode.com/opengauss/openGauss-server/issues/8401 同步推进


如下描述为 identity用例 diffs 分析,仅做参考。
修复测试时请查看shark模块下 parallel_schedule 是否正常打开相关用例

操作系统和硬件信息

不限

测试环境

企业版单机

被测功能

shark用例

预置条件

  1. 已编译安装带 shark 插件的 openGauss。
  2. 测试环境为企业版单机。
  3. shark 回归测试环境可正常启动。

操作步骤

执行 shark 的 identity 回归用例:

cd shark目录
make check p=38000

或在 shark 回归测试中单独执行 identity 用例。
用例中触发失败的典型 SQL 包括:

create table t_identity_numeric_t4(id numeric(38, 0) identity, name varchar(10));
create table t_identity_numeric_t4_1 (like t_identity_numeric_t4 including identity);

create table t_identity_numeric_t5(id numeric(38, 0) identity(987654321098765432100000, 2), id1 serial, name varchar(10));
create table t_identity_numeric_t5_1 (like t_identity_numeric_t5 including identity);

create table t_identity_numeric_t6(id numeric(38, 0) identity(2, 987654321098765432100000), id1 serial, name varchar(10));
create table t_identity_numeric_t6_1 (like t_identity_numeric_t6 including identity);

create sequence identity_t2_id_seq_identity;
create table identity_t2(id numeric(38, 0) identity(10, 2), b int);
create table identity_t2_1 (like identity_t2 including identity);

预期输出

identity 用例应执行通过。
CREATE TABLE ... LIKE ... INCLUDING IDENTITY 应成功复制原表 D identity 属性,新表创建成功,后续 \d+、insert、select、drop 等语句正常执行。

例如:

create table t_identity_numeric_t4_1 (like t_identity_numeric_t4 including identity);
CREATE TABLE

\d+ t_identity_numeric_t4_1;
id | numeric(38,0) | not null identity

后续插入和查询结果符合 expected 输出。

实际输出

identity 用例执行失败,CREATE TABLE ... LIKE ... INCLUDING IDENTITY 报错:

ERROR: Identity column contains invalid INCREMENT.

随后因为目标表未创建成功,后续语句继续失败:

ERROR: relation "t_identity_numeric_t4_1" does not exist
ERROR: relation "t_identity_numeric_t5_1" does not exist
ERROR: relation "t_identity_numeric_t6_1" does not exist
ERROR: relation "identity_t2_1" does not exist
ERROR: table "xxx" does not exist

日志信息

①identity用例执行diffs:

*** /home/tester2/sda/openGauss-server-ob-ai/contrib/shark/expected/identity.out	2026-08-14 14:07:15.145218215 +0800
--- /home/tester2/sda/openGauss-server-ob-ai/contrib/shark/results/identity.out	2026-08-14 15:45:27.104591588 +0800
***************
*** 1097,1124 ****
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t4_id_seq_identity" for serial column "t_identity_numeric_t4.id"
  create table t_identity_numeric_t4_1 (like t_identity_numeric_t4 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t4_1_id_seq_identity" for serial column "t_identity_numeric_t4_1.id"
  \d+ t_identity_numeric_t4_1;
-                                     Table "identity_schema.t_identity_numeric_t4_1"
-  Column |         Type          |                   Modifiers                   | Storage  | Stats target | Description 
- --------+-----------------------+-----------------------------------------------+----------+--------------+-------------
-  id     | numeric(38,0)         | not null identity                             | main     |              | 
-  name   | character varying(10) | character set UTF8 collate utf8mb4_general_ci | extended |              | 
- Has OIDs: no
- Options: orientation=row, compression=no, collate=1537
- Character Set: UTF8
- Collate: utf8mb4_general_ci
- 
  set identity_insert = on;
  insert into t_identity_numeric_t4_1(id, name) values(987654321098765432109876543210, 'xxx'); -- over int64
  set identity_insert = off;
  select * from t_identity_numeric_t4_1 order by id;
!                id               | name 
! --------------------------------+------
!  987654321098765432109876543210 | xxx
! (1 row)
! 
  drop table t_identity_numeric_t4;
  drop table t_identity_numeric_t4_1;
  -- start
  create table t_identity_numeric_t5(id numeric(38, 0) identity(987654321098765432100000, 2), id1 serial, name varchar(10));
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_id_seq_identity" for serial column "t_identity_numeric_t5.id"
--- 1097,1117 ----
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t4_id_seq_identity" for serial column "t_identity_numeric_t4.id"
  create table t_identity_numeric_t4_1 (like t_identity_numeric_t4 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t4_1_id_seq_identity" for serial column "t_identity_numeric_t4_1.id"
+ ERROR:  Identity column contains invalid INCREMENT.
  \d+ t_identity_numeric_t4_1;
  set identity_insert = on;
  insert into t_identity_numeric_t4_1(id, name) values(987654321098765432109876543210, 'xxx'); -- over int64
+ ERROR:  relation "t_identity_numeric_t4_1" does not exist on datanode1
+ LINE 1: insert into t_identity_numeric_t4_1(id, name) values(9876543...
+                     ^
  set identity_insert = off;
  select * from t_identity_numeric_t4_1 order by id;
! ERROR:  relation "t_identity_numeric_t4_1" does not exist on datanode1
! LINE 1: select * from t_identity_numeric_t4_1 order by id;
!                       ^
  drop table t_identity_numeric_t4;
  drop table t_identity_numeric_t4_1;
+ ERROR:  table "t_identity_numeric_t4_1" does not exist
  -- start
  create table t_identity_numeric_t5(id numeric(38, 0) identity(987654321098765432100000, 2), id1 serial, name varchar(10));
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_id_seq_identity" for serial column "t_identity_numeric_t5.id"
***************
*** 1126,1140 ****
  create table t_identity_numeric_t5_1 (like t_identity_numeric_t5 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_1_id_seq_identity" for serial column "t_identity_numeric_t5_1.id"
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_1_id1_seq" for serial column "t_identity_numeric_t5_1.id1"
  insert into t_identity_numeric_t5_1(name) values('xxx'); -- over int64
  select * from t_identity_numeric_t5_1 order by id;
!             id            | id1 | name 
! --------------------------+-----+------
!  987654321098765432100000 |   1 | xxx
! (1 row)
! 
  drop table t_identity_numeric_t5;
  drop table t_identity_numeric_t5_1;
  -- increment
  create table t_identity_numeric_t6(id numeric(38, 0) identity(2, 987654321098765432100000), id1 serial, name varchar(10));
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_id_seq_identity" for serial column "t_identity_numeric_t6.id"
--- 1119,1136 ----
  create table t_identity_numeric_t5_1 (like t_identity_numeric_t5 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_1_id_seq_identity" for serial column "t_identity_numeric_t5_1.id"
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t5_1_id1_seq" for serial column "t_identity_numeric_t5_1.id1"
+ ERROR:  Identity column contains invalid INCREMENT.
  insert into t_identity_numeric_t5_1(name) values('xxx'); -- over int64
+ ERROR:  relation "t_identity_numeric_t5_1" does not exist on datanode1
+ LINE 1: insert into t_identity_numeric_t5_1(name) values('xxx');
+                     ^
  select * from t_identity_numeric_t5_1 order by id;
! ERROR:  relation "t_identity_numeric_t5_1" does not exist on datanode1
! LINE 1: select * from t_identity_numeric_t5_1 order by id;
!                       ^
  drop table t_identity_numeric_t5;
  drop table t_identity_numeric_t5_1;
+ ERROR:  table "t_identity_numeric_t5_1" does not exist
  -- increment
  create table t_identity_numeric_t6(id numeric(38, 0) identity(2, 987654321098765432100000), id1 serial, name varchar(10));
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_id_seq_identity" for serial column "t_identity_numeric_t6.id"
***************
*** 1142,1170 ****
  create table t_identity_numeric_t6_1 (like t_identity_numeric_t6 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_1_id_seq_identity" for serial column "t_identity_numeric_t6_1.id"
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_1_id1_seq" for serial column "t_identity_numeric_t6_1.id1"
  \d+ t_identity_numeric_t6_1
-                                                 Table "identity_schema.t_identity_numeric_t6_1"
-  Column |         Type          |                               Modifiers                               | Storage  | Stats target | Description 
- --------+-----------------------+-----------------------------------------------------------------------+----------+--------------+-------------
-  id     | numeric(38,0)         | not null identity                                                     | main     |              | 
-  id1    | integer               | not null default nextval('t_identity_numeric_t6_1_id1_seq'::regclass) | plain    |              | 
-  name   | character varying(10) | character set UTF8 collate utf8mb4_general_ci                         | extended |              | 
- Has OIDs: no
- Options: orientation=row, compression=no, collate=1537
- Character Set: UTF8
- Collate: utf8mb4_general_ci
- 
  insert into t_identity_numeric_t6_1(name) values('xxx'); -- over int64
  insert into t_identity_numeric_t6_1(name) values('xxx1');
  select * from t_identity_numeric_t6_1 order by id;
!             id            | id1 | name 
! --------------------------+-----+------
!                         2 |   1 | xxx
!  987654321098765432100002 |   2 | xxx1
! (2 rows)
! 
  drop table t_identity_numeric_t6;
  drop table t_identity_numeric_t6_1;
  -- column storage
  create table t_ident (id int identity, col text) with (orientation=column);
  NOTICE:  CREATE TABLE will create implicit sequence "t_ident_id_seq_identity" for serial column "t_ident.id"
--- 1138,1160 ----
  create table t_identity_numeric_t6_1 (like t_identity_numeric_t6 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_1_id_seq_identity" for serial column "t_identity_numeric_t6_1.id"
  NOTICE:  CREATE TABLE will create implicit sequence "t_identity_numeric_t6_1_id1_seq" for serial column "t_identity_numeric_t6_1.id1"
+ ERROR:  Identity column contains invalid INCREMENT.
  \d+ t_identity_numeric_t6_1
  insert into t_identity_numeric_t6_1(name) values('xxx'); -- over int64
+ ERROR:  relation "t_identity_numeric_t6_1" does not exist on datanode1
+ LINE 1: insert into t_identity_numeric_t6_1(name) values('xxx');
+                     ^
  insert into t_identity_numeric_t6_1(name) values('xxx1');
+ ERROR:  relation "t_identity_numeric_t6_1" does not exist on datanode1
+ LINE 1: insert into t_identity_numeric_t6_1(name) values('xxx1');
+                     ^
  select * from t_identity_numeric_t6_1 order by id;
! ERROR:  relation "t_identity_numeric_t6_1" does not exist on datanode1
! LINE 1: select * from t_identity_numeric_t6_1 order by id;
!                       ^
  drop table t_identity_numeric_t6;
  drop table t_identity_numeric_t6_1;
+ ERROR:  table "t_identity_numeric_t6_1" does not exist
  -- column storage
  create table t_ident (id int identity, col text) with (orientation=column);
  NOTICE:  CREATE TABLE will create implicit sequence "t_ident_id_seq_identity" for serial column "t_ident.id"
***************
*** 1201,1218 ****
  NOTICE:  CREATE TABLE will create implicit sequence "identity_t2_id_seq_identity1" for serial column "identity_t2.id"
  create table identity_t2_1 (like identity_t2 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "identity_t2_1_id_seq_identity" for serial column "identity_t2_1.id"
  insert into identity_t2_1(b) values (10);
  insert into identity_t2_1(b) values (10);
  select id, b from identity_t2_1;
!  id | b  
! ----+----
!  10 | 10
!  12 | 10
! (2 rows)
! 
  drop sequence identity_t2_id_seq_identity;
  drop table identity_t2;
  drop table identity_t2_1;
  -- select into
  create sequence identity_t3_id_seq_identity;
  create table identity_t3(id numeric(38, 0) identity(10, 3), b int);
--- 1191,1213 ----
  NOTICE:  CREATE TABLE will create implicit sequence "identity_t2_id_seq_identity1" for serial column "identity_t2.id"
  create table identity_t2_1 (like identity_t2 including identity);
  NOTICE:  CREATE TABLE will create implicit sequence "identity_t2_1_id_seq_identity" for serial column "identity_t2_1.id"
+ ERROR:  Identity column contains invalid INCREMENT.
  insert into identity_t2_1(b) values (10);
+ ERROR:  relation "identity_t2_1" does not exist on datanode1
+ LINE 1: insert into identity_t2_1(b) values (10);
+                     ^
  insert into identity_t2_1(b) values (10);
+ ERROR:  relation "identity_t2_1" does not exist on datanode1
+ LINE 1: insert into identity_t2_1(b) values (10);
+                     ^
  select id, b from identity_t2_1;
! ERROR:  relation "identity_t2_1" does not exist on datanode1
! LINE 1: select id, b from identity_t2_1;
!                           ^
  drop sequence identity_t2_id_seq_identity;
  drop table identity_t2;
  drop table identity_t2_1;
+ ERROR:  table "identity_t2_1" does not exist
  -- select into
  create sequence identity_t3_id_seq_identity;
  create table identity_t3(id numeric(38, 0) identity(10, 3), b int);

======================================================================

② pg_identity_dump_restore 用例执行diffs

======================================================================

*** /home/tester2/sda/openGauss-server-ob-ai/contrib/shark/expected/pg_identity_dump_restore.out.smartmatch	2026-08-14 15:49:23.691307965 +0800
--- /home/tester2/sda/openGauss-server-ob-ai/contrib/shark/results/pg_identity_dump_restore.out	2026-08-14 15:49:21.947287941 +0800
***************
*** 43,50 ****
  SET
  CREATE TABLE
  ALTER TABLE
! ALTER TABLE
! ALTER SEQUENCE
  CREATE TABLE
  ALTER TABLE
  ALTER TABLE
--- 43,52 ----
  SET
  CREATE TABLE
  ALTER TABLE
! gsql:/home/tester2/sda/openGauss-server-ob-ai/contrib/shark/tmp_check/install/home/tester2/sda/openGauss-server-ob-ai/mppdb_temp_install/bin/s_test_pg_identity_dump_restore.sql:72: ERROR:  syntax error at or near "CACHE"
! LINE 2:     CACHE 1
!             ^
! gsql:/home/tester2/sda/openGauss-server-ob-ai/contrib/shark/tmp_check/install/home/tester2/sda/openGauss-server-ob-ai/mppdb_temp_install/bin/s_test_pg_identity_dump_restore.sql:79: ERROR:  relation "book_bookid_seq_identity" does not exist
  CREATE TABLE
  ALTER TABLE
  ALTER TABLE
***************
*** 52,62 ****
  ALTER TABLE
  ALTER TABLE
  ALTER TABLE
!  setval 
! --------
!       4
! (1 row)
! 
   setval 
  --------
       22
--- 54,63 ----
  ALTER TABLE
  ALTER TABLE
  ALTER TABLE
! gsql:/home/tester2/sda/openGauss-server-ob-ai/contrib/shark/tmp_check/install/home/tester2/sda/openGauss-server-ob-ai/mppdb_temp_install/bin/s_test_pg_identity_dump_restore.sql:170: ERROR:  relation "book_bookid_seq_identity" does not exist
! LINE 1: SELECT pg_catalog.setval('book_bookid_seq_identity', 4, true...
!                                  ^
! CONTEXT:  referenced column: setval
   setval 
  --------
       22
***************
*** 72,78 ****
      102
  (1 row)
  
! 
  \c s_test_pg_identity_dump_restore_1
  set current_schema = s_test_pg_identity_dump_restore;
  \d+ test_t1
--- 73,79 ----
      102
  (1 row)
  
! total time: 265  ms
  \c s_test_pg_identity_dump_restore_1
  set current_schema = s_test_pg_identity_dump_restore;
  \d+ test_t1
***************
*** 102,108 ****
                                     Table "s_test_pg_identity_dump_restore.book"
    Column  |     Type      |                   Modifiers                   | Storage  | Stats target | Description 
  ----------+---------------+-----------------------------------------------+----------+--------------+-------------
!  bookid   | integer       | not null identity                             | plain    |              | 
   bookname | nvarchar2(50) | character set UTF8 collate utf8mb4_general_ci | extended |              | 
   author   | nvarchar2(50) | character set UTF8 collate utf8mb4_general_ci | extended |              | 
  Has OIDs: no
--- 103,109 ----
                                     Table "s_test_pg_identity_dump_restore.book"
    Column  |     Type      |                   Modifiers                   | Storage  | Stats target | Description 
  ----------+---------------+-----------------------------------------------+----------+--------------+-------------
!  bookid   | integer       | not null                                      | plain    |              | 
   bookname | nvarchar2(50) | character set UTF8 collate utf8mb4_general_ci | extended |              | 
   author   | nvarchar2(50) | character set UTF8 collate utf8mb4_general_ci | extended |              | 
  Has OIDs: no
***************
*** 118,124 ****
--- 119,131 ----
  INSERT INTO test_t2 DEFAULT VALUES;
  INSERT INTO test_t2 DEFAULT VALUES;
  INSERT INTO book VALUES('book1','author1'),('book2','author2');
+ ERROR:  invalid input syntax for integer: "book1"
+ LINE 1: INSERT INTO book VALUES('book1','author1'),('book2','author2...
+                                 ^
+ CONTEXT:  referenced column: bookid
  INSERT INTO book(bookname,author) VALUES('book3','author3'),('book4','author4');
+ ERROR:  null value in column "bookid" violates not-null constraint
+ DETAIL:  Failing row contains (null, book3, author3).
  select * from test_t1 order by 1, 2;
   a  | b 
  ----+---
***************
*** 134,147 ****
  (2 rows)
  
  select * from book order by 1, 2;
!  bookid | bookname | author  
! --------+----------+---------
!       1 | book1    | author1
!       2 | book2    | author2
!       3 | book3    | author3
!       4 | book4    | author4
! (4 rows)
  
  \c postgres
  drop database s_test_pg_identity_dump_restore;
! drop database s_test_pg_identity_dump_restore_1;
\ No newline at end of file
--- 141,150 ----
  (2 rows)
  
  select * from book order by 1, 2;
!  bookid | bookname | author 
! --------+----------+--------
! (0 rows)
  
  \c postgres
  drop database s_test_pg_identity_dump_restore;
! drop database s_test_pg_identity_dump_restore_1;

======================================================================

提单组织

内部开发

测试代码

shark 用例: identity、pg_identity_dump_restore

likedislike
Lliyangx成员
8月13日 添加了label:bug
opengauss_bot
opengauss_bot成员
8月13日 评论:

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月13日 将 TestManager 设为负责人
opengauss_botopengauss_bot成员
8月13日 添加了label:sig/StorageEngine,sig/AI,sig/CM,sig/CloudNative,sig/SecurityTechnology,sig/SQLEngine
opengauss_bot
opengauss_bot成员
8月13日 评论:

Welcome To openGauss Community

Hey @liyangx , 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
Lliyangx成员
8月13日 修改了issue 的描述
此处折叠了17条事件消息 查看更多
Lliyangx成员
8月24日 修改了issue 的描述
sungang14
sungang14成员
8月24日 评论:

【回归人员】sungang14
【回归日期】20260824
【回归版本】openGauss7.0.0master
【回归结论】通过
【回归步骤】
shark 用例中identity用例执行通过
shark 用例中pg_identity_dump_restore用例执行通过
image.png

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