Commit 76af5717 authored by unknown's avatar unknown

Bug #31440: 'select 1 regex null' asserts debug server

The special case with NULL as a regular expression
was handled at prepare time. But in this special case
the item was not marked as fixed. This caused an assertion
at execution time.
Fixed my marking the item as fixed even when known to 
return NULL at prepare time.


mysql-test/r/func_regexp.result:
  Bug #31440: test case
mysql-test/t/func_regexp.test:
  Bug #31440: test case
sql/item_cmpfunc.cc:
  Bug #31440: mark the item as fixed even when 
  known to return NULL.
parent 6146c0c7
...@@ -98,3 +98,8 @@ R2 ...@@ -98,3 +98,8 @@ R2
R3 R3
deallocate prepare stmt1; deallocate prepare stmt1;
drop table t1; drop table t1;
End of 4.1 tests
SELECT 1 REGEXP NULL;
1 REGEXP NULL
NULL
End of 5.0 tests
...@@ -74,4 +74,13 @@ execute stmt1 using @a; ...@@ -74,4 +74,13 @@ execute stmt1 using @a;
deallocate prepare stmt1; deallocate prepare stmt1;
drop table t1; drop table t1;
# End of 4.1 tests --echo End of 4.1 tests
#
# Bug #31440: 'select 1 regex null' asserts debug server
#
SELECT 1 REGEXP NULL;
--echo End of 5.0 tests
...@@ -4285,6 +4285,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) ...@@ -4285,6 +4285,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
if (args[1]->null_value) if (args[1]->null_value)
{ // Will always return NULL { // Will always return NULL
maybe_null=1; maybe_null=1;
fixed= 1;
return FALSE; return FALSE;
} }
int error; int error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment