mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge
This commit is contained in:
@ -1691,3 +1691,15 @@ FROM t1;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET @@sql_mode='ONLY_FULL_GROUP_BY';
|
||||
CREATE TABLE t1(i INT);
|
||||
INSERT INTO t1 VALUES (1), (10);
|
||||
SELECT COUNT(i) FROM t1;
|
||||
COUNT(i)
|
||||
2
|
||||
SELECT COUNT(i) FROM t1 WHERE i > 1;
|
||||
COUNT(i)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
@ -921,6 +921,32 @@ c4
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
|
||||
GRANT SELECT (f1) ON t1 TO foo;
|
||||
GRANT SELECT (f1) ON v1 TO foo;
|
||||
USE db1;
|
||||
SELECT f1 FROM t1;
|
||||
f1
|
||||
SELECT f2 FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1'
|
||||
SELECT * FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
|
||||
SELECT f1 FROM v1;
|
||||
f1
|
||||
SELECT f2 FROM v1;
|
||||
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1'
|
||||
SELECT * FROM v1;
|
||||
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1'
|
||||
USE test;
|
||||
REVOKE SELECT (f1) ON db1.t1 FROM foo;
|
||||
REVOKE SELECT (f1) ON db1.v1 FROM foo;
|
||||
DROP USER foo;
|
||||
DROP VIEW db1.v1;
|
||||
DROP TABLE db1.t1;
|
||||
DROP DATABASE db1;
|
||||
End of 5.0 tests.
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@ -18,6 +18,8 @@ insert into t1 values (3,5,"C");
|
||||
insert into t1 values (3,6,"D");
|
||||
|
||||
# Test of MySQL field extension with and without matching records.
|
||||
#### Note: The two following statements may fail if the execution plan
|
||||
#### or optimizer is changed. The result for column c is undefined.
|
||||
select a,c,sum(a) from t1 group by a;
|
||||
select a,c,sum(a) from t1 where a > 10 group by a;
|
||||
select sum(a) from t1 where a > 10;
|
||||
|
@ -1139,4 +1139,22 @@ DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
||||
|
||||
#
|
||||
# Bug#42567 Invalid GROUP BY error
|
||||
#
|
||||
|
||||
# Setup of the subtest
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET @@sql_mode='ONLY_FULL_GROUP_BY';
|
||||
|
||||
CREATE TABLE t1(i INT);
|
||||
INSERT INTO t1 VALUES (1), (10);
|
||||
|
||||
# The actual test
|
||||
SELECT COUNT(i) FROM t1;
|
||||
SELECT COUNT(i) FROM t1 WHERE i > 1;
|
||||
|
||||
# Cleanup of subtest
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
||||
|
@ -946,8 +946,13 @@ set global max_prepared_stmt_count=3;
|
||||
select @@max_prepared_stmt_count;
|
||||
show status like 'prepared_stmt_count';
|
||||
prepare stmt from "select 1";
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
||||
# Switch to connection con1
|
||||
connection con1;
|
||||
let $con1_id=`SELECT CONNECTION_ID()`;
|
||||
|
||||
prepare stmt from "select 2";
|
||||
prepare stmt1 from "select 3";
|
||||
--error ER_MAX_PREPARED_STMT_COUNT_REACHED
|
||||
@ -957,18 +962,17 @@ connection default;
|
||||
prepare stmt2 from "select 4";
|
||||
select @@max_prepared_stmt_count;
|
||||
show status like 'prepared_stmt_count';
|
||||
|
||||
# Disconnect connection con1 and switch to default connection
|
||||
disconnect con1;
|
||||
connection default;
|
||||
# Wait for the connection to die: deal with a possible race
|
||||
|
||||
# Wait for the connection con1 to die
|
||||
let $wait_condition=SELECT COUNT(*)=0 FROM information_schema.processlist WHERE id=$con1_id;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
deallocate prepare stmt;
|
||||
let $query= select variable_value from information_schema.global_status
|
||||
where variable_name = 'prepared_stmt_count';
|
||||
let $count= `$query`;
|
||||
if ($count)
|
||||
{
|
||||
--sleep 1
|
||||
let $count= `$query`;
|
||||
}
|
||||
|
||||
select @@max_prepared_stmt_count;
|
||||
show status like 'prepared_stmt_count';
|
||||
#
|
||||
|
@ -1191,6 +1191,46 @@ DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
|
||||
#
|
||||
# Bug #41354: Access control is bypassed when all columns of a view are
|
||||
# selected by * wildcard
|
||||
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
|
||||
|
||||
GRANT SELECT (f1) ON t1 TO foo;
|
||||
GRANT SELECT (f1) ON v1 TO foo;
|
||||
|
||||
connect (addconfoo, localhost, foo,,);
|
||||
connection addconfoo;
|
||||
USE db1;
|
||||
|
||||
|
||||
SELECT f1 FROM t1;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT f2 FROM t1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT * FROM t1;
|
||||
|
||||
SELECT f1 FROM v1;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT f2 FROM v1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT * FROM v1;
|
||||
|
||||
connection default;
|
||||
USE test;
|
||||
disconnect addconfoo;
|
||||
REVOKE SELECT (f1) ON db1.t1 FROM foo;
|
||||
REVOKE SELECT (f1) ON db1.v1 FROM foo;
|
||||
DROP USER foo;
|
||||
DROP VIEW db1.v1;
|
||||
DROP TABLE db1.t1;
|
||||
DROP DATABASE db1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user