已关闭
[Bug]: insert on conflict不支持视图 ,报错信息需要优化 #8254
liuzhen001创建于  7月2日关闭于  8月15日
liuzhen001
liuzhen001成员
7月2日 创建

测试类型

SQL功能

测试版本

7.0.0LTS

问题描述

操作系统和硬件信息

image.png

测试环境

企业版主备

被测功能

预置条件

操作步骤

create table insertconflicttest(key int4, fruit text);

-- These things should work through a view, as well
create view insertconflictview as select * from insertconflicttest;

--
-- Test unique index inference with operator class specifications and
-- named collations
--
create unique index op_index_key on insertconflicttest(key, fruit text_pattern_ops);
create unique index collation_index_key on insertconflicttest(key, fruit collate "C");
create unique index both_index_key on insertconflicttest(key, fruit collate "C" text_pattern_ops);
create unique index both_index_expr_key on insertconflicttest(key, lower(fruit) collate "C" text_pattern_ops);

-- fails
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit) do nothing;
explain (costs off) insert into insertconflictview values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing;

-- succeeds
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit, key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do update set fruit = excluded.fruit
  where exists (select 1 from insertconflicttest ii where ii.key = excluded.key);

预期输出

实际输出

e6b30b16e1593c235f1f9af3ff29b1d8.png

日志信息

e6b30b16e1593c235f1f9af3ff29b1d8.png

提单组织

测试团队

测试代码

likedislike
liuzhen001liuzhen001成员
7月2日 添加了label:bug
opengauss_bot
opengauss_bot成员
7月2日 评论:

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

Welcome To openGauss Community

Hey @liuzhen001 , 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, @ywzq1161327784 ,
and any of the committers: @Igali, @bihua111, @cailei19, @h_ray, @levy53071, @libiao2024, @lihaixiao, @mrzack, @wangfeihuo, @wuyuechuan, @xiong_xjun, @zhangfengzhi123, @zhangxubo, @zjh_hw .

likedislike
liuzhen001liuzhen001成员
7月3日 将 zhangxubo 设为负责人,移除负责人 TestManager
liuzhen001liuzhen001成员
7月3日 关联了看板:openGauss 7.0.0-LTS
lvlintao666lvlintao666成员
7月3日 issue优先级由 无优先级 改变为 次要
liuzhen001liuzhen001成员
7月6日 issue优先级由 次要 改变为 主要
liuzhen001liuzhen001成员
7月27日 issue优先级由 主要 改变为 次要
sunquanchengsunquancheng
8月3日 关联了pull request:fix(sql): #8254 修复insert on conflict操作view的报错信息
ywzq1161327784ywzq1161327784成员
8月10日 issue状态由 待办的 改变为 已完成
chendong76chendong76成员
8月12日 issue状态由 已完成 改变为 待回归
liuzhen001
liuzhen001成员
8月15日 评论:

回归版本:7.0.0- LTS B018
回归结论:回归通过
回归过程:
create table insertconflicttest(key int4, fruit text);

-- These things should work through a view, as well
create view insertconflictview as select * from insertconflicttest;

--
-- Test unique index inference with operator class specifications and
-- named collations

create unique index op_index_key on insertconflicttest(key, fruit text_pattern_ops);
create unique index collation_index_key on insertconflicttest(key, fruit collate "C");
create unique index both_index_key on insertconflicttest(key, fruit collate "C" text_pattern_ops);
create unique index both_index_expr_key on insertconflicttest(key, lower(fruit) collate "C" text_pattern_ops);

-- fails
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit) do nothing;
explain (costs off) insert into insertconflictview values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing;

-- succeeds
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit, key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing;
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do update set fruit = excluded.fruit
where exists (select 1 from insertconflicttest ii where ii.key = excluded.key);
image.png
image.png

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