-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from vlad-lesin/5.6-ps-bug-1354988
5.6 ps bug 1354988
- Loading branch information
Showing
6 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
CREATE USER grantee@localhost IDENTIFIED BY 'grantee1'; | ||
CREATE USER grantee IDENTIFIED BY 'grantee2'; | ||
CREATE DATABASE db2; | ||
CREATE DATABASE db3; | ||
USE db3; | ||
CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); | ||
CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); | ||
INSERT INTO t2 (b) VALUES (1), (2); | ||
CREATE FUNCTION f1() RETURNS INT | ||
BEGIN | ||
RETURN 1; | ||
END | | ||
CREATE PROCEDURE p1() | ||
BEGIN | ||
SELECT 1; | ||
END | | ||
GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION; | ||
GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION; | ||
SELECT user(), current_user(); | ||
user() current_user() | ||
grantee@localhost grantee@localhost | ||
SHOW GRANTS; | ||
Grants for grantee@localhost | ||
GRANT USAGE ON *.* TO 'grantee'@'localhost' IDENTIFIED BY PASSWORD '*9823FF338D44DAF02422CF24DD1F879FB4F6B232' | ||
GRANT ALL PRIVILEGES ON `db2`.* TO 'grantee'@'%' WITH GRANT OPTION | ||
GRANT SELECT (a) ON `db3`.`t2` TO 'grantee'@'%' WITH GRANT OPTION | ||
GRANT ALL PRIVILEGES ON `db3`.`t1` TO 'grantee'@'%' WITH GRANT OPTION | ||
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `db3`.`p1` TO 'grantee'@'%' WITH GRANT OPTION | ||
GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `db3`.`f1` TO 'grantee'@'%' WITH GRANT OPTION | ||
USE db2; | ||
CREATE TABLE t1(f1 int); | ||
USE db3; | ||
SELECT a FROM t2; | ||
a | ||
1 | ||
2 | ||
INSERT INTO t1 (b) VALUES (1), (2); | ||
SELECT f1(); | ||
f1() | ||
1 | ||
CALL p1(); | ||
1 | ||
1 | ||
DROP DATABASE db2; | ||
DROP DATABASE db3; | ||
DROP USER grantee@localhost; | ||
DROP USER grantee; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# The bug #1354988 test. | ||
|
||
CREATE USER grantee@localhost IDENTIFIED BY 'grantee1'; | ||
CREATE USER grantee IDENTIFIED BY 'grantee2'; | ||
|
||
CREATE DATABASE db2; | ||
|
||
|
||
CREATE DATABASE db3; | ||
USE db3; | ||
|
||
CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); | ||
CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); | ||
INSERT INTO t2 (b) VALUES (1), (2); | ||
|
||
-- delimiter | | ||
|
||
CREATE FUNCTION f1() RETURNS INT | ||
BEGIN | ||
RETURN 1; | ||
END | | ||
|
||
CREATE PROCEDURE p1() | ||
BEGIN | ||
SELECT 1; | ||
END | | ||
|
||
-- delimiter ; | ||
|
||
GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION; | ||
GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION; | ||
GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION; | ||
|
||
-- connect (con1, localhost, grantee,grantee1,) | ||
-- connection con1 | ||
SELECT user(), current_user(); | ||
SHOW GRANTS; | ||
USE db2; | ||
CREATE TABLE t1(f1 int); | ||
USE db3; | ||
SELECT a FROM t2; | ||
INSERT INTO t1 (b) VALUES (1), (2); | ||
SELECT f1(); | ||
CALL p1(); | ||
-- disconnect con1 | ||
|
||
-- connection default | ||
DROP DATABASE db2; | ||
DROP DATABASE db3; | ||
DROP USER grantee@localhost; | ||
DROP USER grantee; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters