summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-11-05 16:27:08 +0400
committerAlexander Barkov <bar@mariadb.com>2021-11-08 08:16:48 +0400
commit9dc05f1f11bfd9a066d9154e5c6022af5a9538ac (patch)
tree54e09944737cf09c143736c1668bde2c209646fc /sql
parent322fc4f4b3afab6c7607e36e2958146fdc2f4ea4 (diff)
downloadmariadb-git-9dc05f1f11bfd9a066d9154e5c6022af5a9538ac.tar.gz
MDEV-25610 Assertion `escape != -1' failed in Item_func_like::val_intbb-10.2-bar-MDEV-25610
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h13
-rw-r--r--sql/item_cmpfunc.cc4
2 files changed, 15 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h
index 35700129243..2a904c1691a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6237,6 +6237,19 @@ public:
/*
+ fix_escape_item() sets the out "escape" parameter to:
+ - native code in case of an 8bit character set
+ - Unicode code point in case of a multi-byte character set
+
+ The value meaning a not-initialized ESCAPE character must not be equal to
+ any valid value, so must be outside of these ranges:
+ - -128..+127, not to conflict with a valid 8bit charcter
+ - 0..0x10FFFF, not to conflict with a valid Unicode code point
+ The exact value does not matter.
+*/
+#define ESCAPE_NOT_INITIALIZED -1000
+
+/*
It's used in ::fix_fields() methods of LIKE and JSON_SEARCH
functions to handle the ESCAPE parameter.
This parameter is quite non-standard so the specific function.
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 8a2c532f621..3a76982d80e 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5266,7 +5266,7 @@ void Item_func_like::print(String *str, enum_query_type query_type)
longlong Item_func_like::val_int()
{
DBUG_ASSERT(fixed == 1);
- DBUG_ASSERT(escape != -1);
+ DBUG_ASSERT(escape != ESCAPE_NOT_INITIALIZED);
String* res= args[0]->val_str(&cmp_value1);
if (args[0]->null_value)
{
@@ -5370,7 +5370,7 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str,
return TRUE;
}
- IF_DBUG(*escape= -1,);
+ IF_DBUG(*escape= ESCAPE_NOT_INITIALIZED,);
if (escape_item->const_item())
{