mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-33344 REGEXP empty string inconsistent
This commit is contained in:
@ -110,7 +110,7 @@ R2
|
|||||||
R3
|
R3
|
||||||
deallocate prepare stmt1;
|
deallocate prepare stmt1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
End of 4.1 tests
|
# End of 4.1 tests
|
||||||
SELECT 1 REGEXP NULL;
|
SELECT 1 REGEXP NULL;
|
||||||
1 REGEXP NULL
|
1 REGEXP NULL
|
||||||
NULL
|
NULL
|
||||||
@ -126,7 +126,7 @@ NULL
|
|||||||
SELECT "ABC" REGEXP BINARY NULL;
|
SELECT "ABC" REGEXP BINARY NULL;
|
||||||
"ABC" REGEXP BINARY NULL
|
"ABC" REGEXP BINARY NULL
|
||||||
NULL
|
NULL
|
||||||
End of 5.0 tests
|
# End of 5.0 tests
|
||||||
CREATE TABLE t1(a INT, b CHAR(4));
|
CREATE TABLE t1(a INT, b CHAR(4));
|
||||||
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
||||||
PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
|
PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
|
||||||
@ -144,7 +144,7 @@ a
|
|||||||
1
|
1
|
||||||
DEALLOCATE PREPARE stmt1;
|
DEALLOCATE PREPARE stmt1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
# End of 5.1 tests
|
||||||
SELECT ' ' REGEXP '[[:blank:]]';
|
SELECT ' ' REGEXP '[[:blank:]]';
|
||||||
' ' REGEXP '[[:blank:]]'
|
' ' REGEXP '[[:blank:]]'
|
||||||
1
|
1
|
||||||
@ -163,3 +163,19 @@ SELECT '\t' REGEXP '[[:space:]]';
|
|||||||
SELECT REGEXP_INSTR('111222333',2);
|
SELECT REGEXP_INSTR('111222333',2);
|
||||||
REGEXP_INSTR('111222333',2)
|
REGEXP_INSTR('111222333',2)
|
||||||
4
|
4
|
||||||
|
# End of 10.3 tests
|
||||||
|
#
|
||||||
|
# MDEV-33344 REGEXP empty string inconsistent
|
||||||
|
#
|
||||||
|
create table t1 (x char(5));
|
||||||
|
insert t1 values (''), ('x');
|
||||||
|
select 'foo' regexp x from t1 order by x asc;
|
||||||
|
'foo' regexp x
|
||||||
|
1
|
||||||
|
0
|
||||||
|
select 'foo' regexp x from t1 order by x desc;
|
||||||
|
'foo' regexp x
|
||||||
|
0
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
# End of 10.5 tests
|
||||||
|
@ -55,7 +55,7 @@ execute stmt1 using @a;
|
|||||||
deallocate prepare stmt1;
|
deallocate prepare stmt1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 4.1 tests
|
--echo # End of 4.1 tests
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -74,7 +74,7 @@ SELECT NULL REGEXP BINARY NULL;
|
|||||||
SELECT 'A' REGEXP BINARY NULL;
|
SELECT 'A' REGEXP BINARY NULL;
|
||||||
SELECT "ABC" REGEXP BINARY NULL;
|
SELECT "ABC" REGEXP BINARY NULL;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo # End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -91,7 +91,7 @@ DEALLOCATE PREPARE stmt1;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo # End of 5.1 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
# MDEV-5820 MySQL Bug #54805 definitions in regex/my_regex.h conflict with /usr/include/regex.h
|
# MDEV-5820 MySQL Bug #54805 definitions in regex/my_regex.h conflict with /usr/include/regex.h
|
||||||
@ -110,3 +110,15 @@ SELECT '\t' REGEXP '[[:space:]]';
|
|||||||
--echo #
|
--echo #
|
||||||
SELECT REGEXP_INSTR('111222333',2);
|
SELECT REGEXP_INSTR('111222333',2);
|
||||||
|
|
||||||
|
--echo # End of 10.3 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-33344 REGEXP empty string inconsistent
|
||||||
|
--echo #
|
||||||
|
create table t1 (x char(5));
|
||||||
|
insert t1 values (''), ('x');
|
||||||
|
select 'foo' regexp x from t1 order by x asc;
|
||||||
|
select 'foo' regexp x from t1 order by x desc;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo # End of 10.5 tests
|
||||||
|
@ -6062,8 +6062,8 @@ bool Regexp_processor_pcre::compile(String *pattern, bool send_error)
|
|||||||
if (!stringcmp(pattern, &m_prev_pattern))
|
if (!stringcmp(pattern, &m_prev_pattern))
|
||||||
return false;
|
return false;
|
||||||
cleanup();
|
cleanup();
|
||||||
m_prev_pattern.copy(*pattern);
|
|
||||||
}
|
}
|
||||||
|
m_prev_pattern.copy(*pattern);
|
||||||
|
|
||||||
if (!(pattern= convert_if_needed(pattern, &pattern_converter)))
|
if (!(pattern= convert_if_needed(pattern, &pattern_converter)))
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user