diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-03-03 18:44:10 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-03-05 16:25:29 +0100 |
commit | ff93b77fd62bdb708e2b2b34f4e2202c12e727c4 (patch) | |
tree | 47b0e1bac37b65480da19faabd2fb85e3a947a58 /sql/mysqld.h | |
parent | 5a3a79ce5f20a862abdde505a683df1148e0dc37 (diff) | |
download | mariadb-git-ff93b77fd62bdb708e2b2b34f4e2202c12e727c4.tar.gz |
MDEV-9641 MDEV-9644 NULLIF assertions
* only copy args[0] to args[2] after fix_fields (when all item
substitutions have already happened)
* change QT_ITEM_FUNC_NULLIF_TO_CASE (that allows to print NULLIF
as CASE) to QT_ITEM_ORIGINAL_FUNC_NULLIF (that prohibits it).
So that NULLIF-to-CASE is allowed by default and only disabled
explicitly for SHOW VIEW|FUNCTION|PROCEDURE and mysql_make_view.
By default it is allowed (in particular in error messages and
debug output, that can happen anytime before or after optimizer).
Diffstat (limited to 'sql/mysqld.h')
-rw-r--r-- | sql/mysqld.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/mysqld.h b/sql/mysqld.h index 1c1478f8a63..30120d66113 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -665,15 +665,16 @@ enum enum_query_type /// If NULLIF(a,b) should print itself as /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END /// when "a" was replaced to two different items - /// (e.g. by equal fields propagation in optimize_cond()). - /// The default behaviour is to print as NULLIF(a_for_return, b) - /// which should be Ok for SHOW CREATE {VIEW|PROCEDURE|FUNCTION} - /// as they are not affected by WHERE optimization. - QT_ITEM_FUNC_NULLIF_TO_CASE= (1 <<6), + /// (e.g. by equal fields propagation in optimize_cond()) + /// or always as NULLIF(a, b). + /// The default behaviour is to use CASE syntax when + /// a_for_return_value is not the same as a_for_comparison. + /// SHOW CREATE {VIEW|PROCEDURE|FUNCTION} and other cases where the + /// original representation is required, should set this flag. + QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 <<6), /// This value means focus on readability, not on ability to parse back, etc. QT_EXPLAIN= QT_TO_SYSTEM_CHARSET | - QT_ITEM_FUNC_NULLIF_TO_CASE | QT_ITEM_IDENT_SKIP_CURRENT_DATABASE | QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | QT_ITEM_SUBSELECT_ID_ONLY, @@ -682,7 +683,7 @@ enum enum_query_type /// Be more detailed than QT_EXPLAIN. /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE /// here, as it would give better readable results - QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET | QT_ITEM_FUNC_NULLIF_TO_CASE + QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET }; |