From f8ca1af762e2e6c4d231aa483b28edc5fd7a9505 Mon Sep 17 00:00:00 2001 From: chenxiaobin19 <1025221611@qq.com> Date: Mon, 1 Jul 2024 11:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Don=20update=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=9C=A8sqlbypass=E4=B8=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runtime/opfusion/opfusion_update.cpp | 2 ++ src/test/regress/expected/single_node_update.out | 14 ++++++++++++++ src/test/regress/sql/single_node_update.sql | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/src/gausskernel/runtime/opfusion/opfusion_update.cpp b/src/gausskernel/runtime/opfusion/opfusion_update.cpp index 70b82de19..2420e7c32 100644 --- a/src/gausskernel/runtime/opfusion/opfusion_update.cpp +++ b/src/gausskernel/runtime/opfusion/opfusion_update.cpp @@ -368,6 +368,7 @@ lreplace: ItemPointer tupleid = NULL; bool *temp_isnull = NULL; Datum *temp_values; + int temp_nvalid = m_local.m_reslot->tts_nvalid; relkind = result_rel_info->ri_RelationDesc->rd_rel->relkind; result_rel_info = result_rel_info + m_c_local.m_estate->result_rel_index; if (relkind == RELKIND_RELATION || RELKIND_IS_SEQUENCE(relkind)) { @@ -392,6 +393,7 @@ lreplace: } m_local.m_reslot->tts_isnull = temp_isnull; m_local.m_reslot->tts_values = temp_values; + m_local.m_reslot->tts_nvalid = temp_nvalid; } if (rel->rd_att->constr) { diff --git a/src/test/regress/expected/single_node_update.out b/src/test/regress/expected/single_node_update.out index 662753fad..032249847 100644 --- a/src/test/regress/expected/single_node_update.out +++ b/src/test/regress/expected/single_node_update.out @@ -784,6 +784,20 @@ select * from bypass_pt_update order by a; 9 | 2 (8 rows) +drop table bypass_pt_update; +create table bypass_pt_update (a int primary key, c text, d timestamp(0) with time zone default current_timestamp(0) on update current_timestamp(0)); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "bypass_pt_update_pkey" for table "bypass_pt_update" +insert into bypass_pt_update select 1, 'sdawa'; +explain (costs off) update bypass_pt_update set c = 'sdawa' where a = 1; + QUERY PLAN +------------------------------------------------------------------ + [Bypass] + Update on bypass_pt_update + -> Index Scan using bypass_pt_update_pkey on bypass_pt_update + Index Cond: (a = 1) +(4 rows) + +update bypass_pt_update set c = 'sdawa' where a = 1; drop table bypass_pt_update; set sql_beta_feature='a_style_coerce'; set enable_partition_opfusion = off; diff --git a/src/test/regress/sql/single_node_update.sql b/src/test/regress/sql/single_node_update.sql index 30dc1409f..2479200eb 100644 --- a/src/test/regress/sql/single_node_update.sql +++ b/src/test/regress/sql/single_node_update.sql @@ -328,6 +328,13 @@ update bypass_pt_update set a = 9 where a = 2; select * from bypass_pt_update order by a; drop table bypass_pt_update; + +create table bypass_pt_update (a int primary key, c text, d timestamp(0) with time zone default current_timestamp(0) on update current_timestamp(0)); +insert into bypass_pt_update select 1, 'sdawa'; +explain (costs off) update bypass_pt_update set c = 'sdawa' where a = 1; +update bypass_pt_update set c = 'sdawa' where a = 1; +drop table bypass_pt_update; + set sql_beta_feature='a_style_coerce'; set enable_partition_opfusion = off; set enable_opfusion = off;