Commit e64b8795 authored by gshchepa/uchum@host.loc's avatar gshchepa/uchum@host.loc

Merge host.loc:/home/uchum/work/5.0-opt-gca

into  host.loc:/home/uchum/work/5.1-opt-gca
parents bc702deb 18770a0d
...@@ -138,3 +138,20 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by ...@@ -138,3 +138,20 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by
user host db select_priv user host db select_priv
DROP USER CUser2@localhost; DROP USER CUser2@localhost;
DROP USER CUser2@LOCALHOST; DROP USER CUser2@LOCALHOST;
CREATE DATABASE mysqltest_1;
CREATE TABLE mysqltest_1.t1 (a INT);
CREATE USER 'mysqltest1'@'%';
GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
FLUSH PRIVILEGES;
SHOW GRANTS;
Grants for mysqltest1@%
GRANT USAGE ON *.* TO 'mysqltest1'@'%'
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'
GRANT UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'
SELECT * FROM mysqltest_1.t1;
a
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
End of 5.0 tests
...@@ -4313,6 +4313,12 @@ SELECT * FROM t1 WHERE c1 > NULL + 1; ...@@ -4313,6 +4313,12 @@ SELECT * FROM t1 WHERE c1 > NULL + 1;
c1 c1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
a
foo0
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
create table t1(a INT, KEY (a)); create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5); INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
......
...@@ -134,3 +134,29 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by ...@@ -134,3 +134,29 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by
DROP USER CUser2@localhost; DROP USER CUser2@localhost;
DROP USER CUser2@LOCALHOST; DROP USER CUser2@LOCALHOST;
#
# Bug#31194: Privilege ordering does not order properly for wildcard values
#
CREATE DATABASE mysqltest_1;
CREATE TABLE mysqltest_1.t1 (a INT);
CREATE USER 'mysqltest1'@'%';
GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
FLUSH PRIVILEGES;
connect (conn1,localhost,mysqltest1,,);
connection conn1;
SHOW GRANTS;
SELECT * FROM mysqltest_1.t1;
disconnect conn1;
connection default;
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
--echo End of 5.0 tests
...@@ -3661,6 +3661,17 @@ DROP TABLE t1; ...@@ -3661,6 +3661,17 @@ DROP TABLE t1;
--echo --echo
###########################################################################
#
# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
#
CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -3053,7 +3053,10 @@ void in_string::set(uint pos,Item *item) ...@@ -3053,7 +3053,10 @@ void in_string::set(uint pos,Item *item)
{ {
if (res->uses_buffer_owned_by(str)) if (res->uses_buffer_owned_by(str))
res->copy(); res->copy();
*str= *res; if (item->type() == Item::FUNC_ITEM)
str->copy(*res);
else
*str= *res;
} }
if (!str->charset()) if (!str->charset())
{ {
......
...@@ -801,7 +801,9 @@ static ulong get_sort(uint count,...) ...@@ -801,7 +801,9 @@ static ulong get_sort(uint count,...)
{ {
for (; *str ; str++) for (; *str ; str++)
{ {
if (*str == wild_many || *str == wild_one || *str == wild_prefix) if (*str == wild_prefix && str[1])
str++;
else if (*str == wild_many || *str == wild_one)
{ {
wild_pos= (uint) (str - start) + 1; wild_pos= (uint) (str - start) + 1;
break; break;
......
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