disable dml at an updatable view based on external table

This commit is contained in:
jingtaoye35
2023-05-26 02:53:03 +00:00
committed by ob-robot
parent 62b9b3b829
commit 309befd099
2 changed files with 6 additions and 3 deletions

View File

@ -4335,7 +4335,7 @@ bool ObDMLStmt::is_set_stmt() const
return is_select_stmt() ? (static_cast<const ObSelectStmt*>(this)->is_set_stmt()) : false; return is_select_stmt() ? (static_cast<const ObSelectStmt*>(this)->is_set_stmt()) : false;
} }
int ObDMLStmt::disable_writing_external_table() int ObDMLStmt::disable_writing_external_table(bool basic_stmt_is_dml /* defualt false */)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
bool disable_write_table = false; bool disable_write_table = false;
@ -4345,7 +4345,8 @@ int ObDMLStmt::disable_writing_external_table()
if (OB_ISNULL(table_item = table_items_.at(i))) { if (OB_ISNULL(table_item = table_items_.at(i))) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected NULL ptr", K(ret)); LOG_WARN("get unexpected NULL ptr", K(ret));
} else if (table_item->for_update_ && schema::EXTERNAL_TABLE == table_item->table_type_) { } else if (schema::EXTERNAL_TABLE == table_item->table_type_ &&
(table_item->for_update_ || basic_stmt_is_dml)) {
disable_write_table = true; disable_write_table = true;
} }
} }
@ -4363,6 +4364,8 @@ int ObDMLStmt::disable_writing_external_table()
LOG_WARN("get unexpected NULL ptr", K(ret)); LOG_WARN("get unexpected NULL ptr", K(ret));
} else if (schema::EXTERNAL_TABLE == table_item->table_type_) { } else if (schema::EXTERNAL_TABLE == table_item->table_type_) {
disable_write_table = true; disable_write_table = true;
} else if (table_item->is_view_table_ && NULL != table_item->ref_query_) {
OZ( table_item->ref_query_->disable_writing_external_table(true) );
} }
} }
} }

View File

@ -1121,7 +1121,7 @@ public:
int check_has_subquery_in_function_table(bool &has_subquery_in_function_table) const; int check_has_subquery_in_function_table(bool &has_subquery_in_function_table) const;
int disable_writing_external_table(); int disable_writing_external_table(bool basic_stmt_is_dml = false);
int formalize_query_ref_exprs(); int formalize_query_ref_exprs();
int formalize_query_ref_exec_params(ObStmtExecParamFormatter &formatter, int formalize_query_ref_exec_params(ObStmtExecParamFormatter &formatter,