diff --git a/src/common/backend/parser/analyze.cpp b/src/common/backend/parser/analyze.cpp index 77e9df43b7a2b98a8a8fc5026f6efdbbf63bd88f..f68081acb1077741aff277f30d8690acba96cfb8 100644 --- a/src/common/backend/parser/analyze.cpp +++ b/src/common/backend/parser/analyze.cpp @@ -1466,6 +1466,14 @@ static Query* transformInsertStmt(ParseState* pstate, InsertStmt* stmt) } } + /* non-supported IGNORE cases */ + if (pstate->p_has_ignore && pstate->p_target_relation != NULL) { + if (RelationIsColumnFormat(pstate->p_target_relation)) { + ereport(ERROR, ((errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("IGNORE is not supported on INSERT column orientated table.")))); + } + } + /* data redistribution for DFS table. * check if the target relation is being redistributed(insert mode). * For example, when table A is redistributing in session 1, operating table @@ -3354,6 +3362,14 @@ static Query* transformUpdateStmt(ParseState* pstate, UpdateStmt* stmt) errdetail("replicated columnar table doesn't allow UPDATE"))); } + /* non-supported IGNORE cases */ + if (pstate->p_has_ignore && pstate->p_target_relation != NULL) { + if (RelationIsColumnFormat(pstate->p_target_relation)) { + ereport(ERROR, ((errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("IGNORE is not supported on UPDATE column orientated table.")))); + } + } + #ifdef ENABLE_MULTIPLE_NODES if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) { #endif diff --git a/src/test/regress/expected/ignore/ignore_unique_constraints.out b/src/test/regress/expected/ignore/ignore_unique_constraints.out index 108834456706e390cd19c1f41ef9badd2fa44b7b..5c015ed885d629f884f47ba3eaadcb5303ae7c87 100644 --- a/src/test/regress/expected/ignore/ignore_unique_constraints.out +++ b/src/test/regress/expected/ignore/ignore_unique_constraints.out @@ -365,5 +365,19 @@ select * from t_ignore; 2 (2 rows) +-- test for column orientation table: not supported +drop table if exists t_column_orien cascade; +NOTICE: table "t_column_orien" does not exist, skipping +create table t_column_orien(c1 int primary key) with (orientation=column); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t_column_orien_pkey" for table "t_column_orien" +insert into t_column_orien values(1), (2); +insert /*+ ignore_error */ into t_column_orien values(1); +ERROR: IGNORE is not supported on INSERT column orientated table. +insert /*+ ignore_error */ into t_column_orien values(null); +ERROR: IGNORE is not supported on INSERT column orientated table. +update /*+ ignore_error */ t_column_orien set c1 = null where c1 = 2; +ERROR: IGNORE is not supported on UPDATE column orientated table. +update /*+ ignore_error */ t_column_orien set c1 = 1 where c1 = 2; +ERROR: IGNORE is not supported on UPDATE column orientated table. \c postgres drop database if exists sql_ignore_unique_test; diff --git a/src/test/regress/sql/ignore/ignore_unique_constraints.sql b/src/test/regress/sql/ignore/ignore_unique_constraints.sql index e2e929f60b786e88ffe593f672a3116879282c0a..e11dc7b1c387a040ae485fe438445c96d5de35ac 100644 --- a/src/test/regress/sql/ignore/ignore_unique_constraints.sql +++ b/src/test/regress/sql/ignore/ignore_unique_constraints.sql @@ -177,5 +177,14 @@ insert into t_ignore values(2); update /*+ ignore_error */ t_ignore set num = 1 where num = 2; select * from t_ignore; +-- test for column orientation table: not supported +drop table if exists t_column_orien cascade; +create table t_column_orien(c1 int primary key) with (orientation=column); +insert into t_column_orien values(1), (2); +insert /*+ ignore_error */ into t_column_orien values(1); +insert /*+ ignore_error */ into t_column_orien values(null); +update /*+ ignore_error */ t_column_orien set c1 = null where c1 = 2; +update /*+ ignore_error */ t_column_orien set c1 = 1 where c1 = 2; + \c postgres drop database if exists sql_ignore_unique_test; \ No newline at end of file