mirror of
https://github.com/MariaDB/server.git
synced 2025-11-22 05:29:42 +01:00
The patch for SYS_REFCURSOR (MDEV-20034) overrode these methods:
- Item_func_case_searched::check_arguments()
- Item_func_if::check_arguments()
to validate WHEN-style arguments (e.g. args[0] in case of IF) for being
able to return a boolean result.
However, this unintentionally removed the test for the THEN-style arguments
that they are not expressions of the ROW data type.
This led to a crash inside Type_handler_hybrid_field_type::aggregate_for_result
on a DBUG_ASSERT that arguments are not of the ROW data type.
Fix:
The fix restores blocking ROW expressions in the not supported cases,
to avoid the DBUG_ASSERT and to raise an SQL error instead.
Blocking ROW_RESULT expressions is done per Item_func_case_expression
descendant individually, instead of blocking any ROW_RESULT arguments
at the Item_func_case_expression level.
The fix is done taking into account the upcoming patch for associative arrays
(MDEV-34319). It should be possible to pass associative array expressions into
some hybrid type functions, where ROW type expressions are not possible.
As a side effect, some lecagy ER_OPERAND_COLUMNS changed to
a newer ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
Changes in the top affected class Item_func_case_expression:
- item_func.h:
Overriding Item_func_case_expression::check_arguments() to return false,
without checking any arguments. Descendant validate arguments
in a various different ways. No needs to block all non-scalar data type at
this level, to prevent disallowing associative arrays.
Changes in descendants:
- item_cmpfunc.cc:
Adding a test in Item_func_case_simple::aggregate_switch_and_when_arguments()
preventing passing ROW_RESULT expression in predicant and WHEN in a
simple CASE:
CASE predicant WHEN when1 THEN .. WHEN when2 THEN .. END;
This is not supported yet. Should be preferrably fixed before MDEV-34319.
- item_cmpfunc.cc:
Calling args[0]->type_handler()->Item_hybrid_func_fix_attributes()
from Item_func_nullif::fix_length_and_dec().
This prevents a ROW expression to be passed to args[0] of NULLIF().
But will allow to pass associative arrays.
args[1] is still only checked to be comparable with args[0].
No needs to add additional tests for it.
- item_cmpfunc.h:
Adding a call for Item_hybrid_func_fix_attributes() in
Item_func_case_abbreviation2::cache_type_info().
This prevents calling the descendant functions with
a ROW expression in combination with an explicit NULL
in the THEN-style arguments (but will allow to pass associative arrays):
IFNULL(row_expression, NULL)
IFNULL(NULL, row_expression)
IF(switch, row_expression, NULL)
IF(switch, NULL, row_expression)
NVL2(switch, row_expression, NULL)
NVL2(switch, NULL, row_expression)
Adding a THD* argument into involved methods.
- item_cmpfunc.h:
Overriding Item_func_case_abbreviation2_switch::check_arguments() to
check that the first argument in IF() and NVL2() can return bool.
Removing Item_func_if::check_arguments(), as it become redundant.
- sql_type.cc:
Fixing sql_type.cc not to disallow items[0] with ROW_RESULT.
This makes it call Item_hybrid_func_fix_attributes() at the end,
which block ROW arguments into THEN-style arguments of hybrid functions.
But this will allow to pass Type_handler_assoc_array expressions.
- sql_type.cc:
Changing Type_handler_row::Item_hybrid_func_fix_attributes to raise the
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION error instead of the DBUG_ASSERT.
|
||
|---|---|---|
| .. | ||
| anonymous_derived.test | ||
| binlog_ptr_mysqlbinlog-master.opt | ||
| binlog_ptr_mysqlbinlog.test | ||
| binlog_stm_ps.test | ||
| binlog_stm_sp.test | ||
| binlog_stm_sp_package.test | ||
| column_compression.test | ||
| custom_aggregate_functions.test | ||
| empty_string_literal.test | ||
| events.test | ||
| exception.test | ||
| func_add_months.test | ||
| func_case.test | ||
| func_concat.test | ||
| func_decode.test | ||
| func_length.test | ||
| func_misc.test | ||
| func_pad.test | ||
| func_qualified.test | ||
| func_regexp_replace.test | ||
| func_replace.test | ||
| func_substr.test | ||
| func_time.test | ||
| func_to_char.test | ||
| func_trim.test | ||
| gis-debug.test | ||
| gis.test | ||
| information_schema_parameters.test | ||
| keywords.test | ||
| lower_case_table_names.opt | ||
| lower_case_table_names.test | ||
| minus.test | ||
| misc.test | ||
| mysqldump_restore.test | ||
| mysqldump_restore_func_qualified.test | ||
| parser.test | ||
| plugin.test | ||
| ps.test | ||
| rpl_mariadb_date.test | ||
| rpl_sp_package.test | ||
| rpl_sp_package_variables.test | ||
| sequence.test | ||
| sp-anchor-row-type-table.test | ||
| sp-anchor-type.test | ||
| sp-anonymous.test | ||
| sp-cache-invalidate.inc | ||
| sp-code.test | ||
| sp-cursor-decl.test | ||
| sp-cursor-pkg-01.inc | ||
| sp-cursor-pkg-02.inc | ||
| sp-cursor-pkg-03.inc | ||
| sp-cursor-rowtype.test | ||
| sp-cursor.test | ||
| sp-default-param.test | ||
| sp-expr.test | ||
| sp-goto-debug.test | ||
| sp-goto.test | ||
| sp-inout.test | ||
| sp-memory-leak.test | ||
| sp-package-code.test | ||
| sp-package-concurrent-dml-db.test | ||
| sp-package-concurrent-dml-package.test | ||
| sp-package-concurrent-dml-trigger.test | ||
| sp-package-concurrent-dml-view.test | ||
| sp-package-concurrent-dml.inc | ||
| sp-package-i_s.test | ||
| sp-package-innodb.test | ||
| sp-package-mdl.test | ||
| sp-package-mysqldump.test | ||
| sp-package-security.test | ||
| sp-package.test | ||
| sp-param.inc | ||
| sp-param.test | ||
| sp-record.test | ||
| sp-row-vs-var.inc | ||
| sp-row.test | ||
| sp-security.test | ||
| sp-sys_refcursor-alias.test | ||
| sp-sys_refcursor-func_hybrid.test | ||
| sp-sys_refcursor.test | ||
| sp.test | ||
| statement-expr.test | ||
| table_value_constr.test | ||
| trigger.test | ||
| truncate.test | ||
| type_blob.test | ||
| type_clob.test | ||
| type_date.test | ||
| type_number.test | ||
| type_raw.test | ||
| type_varchar.test | ||
| type_varchar2.test | ||
| update.test | ||
| update_innodb.test | ||
| variables.test | ||
| vcol.test | ||
| vcol_innodb.test | ||
| versioning.test | ||
| win.test | ||