Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
5dd505b7
Commit
5dd505b7
authored
Nov 20, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-14428 main.cte_nonrecursive failed in --embedded
move the privilege related test to main.cte_grant
parent
7f190070
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
110 deletions
+110
-110
mysql-test/r/cte_grant.result
mysql-test/r/cte_grant.result
+58
-0
mysql-test/r/cte_nonrecursive.result
mysql-test/r/cte_nonrecursive.result
+0
-58
mysql-test/t/cte_grant.test
mysql-test/t/cte_grant.test
+52
-1
mysql-test/t/cte_nonrecursive.test
mysql-test/t/cte_nonrecursive.test
+0
-51
No files found.
mysql-test/r/cte_grant.result
View file @
5dd505b7
...
@@ -63,3 +63,61 @@ connection root;
...
@@ -63,3 +63,61 @@ connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
drop database mysqltest;
#
# MDEV-13453: privileges checking for CTE
#
create database db;
use db;
create table t1 (i int);
insert into t1
values (3), (7), (1), (4), (2), (3), (1);
create table t2 (a int, b int);
insert into t2
values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
create user foo@localhost;
grant SELECT on db.t1 to foo@localhost;
grant SELECT(a) on db.t2 to foo@localhost;
connect con1,localhost,foo,,;
use db;
with cte as (select * from t1 where i < 4)
select * from cte;
i
3
1
2
3
1
with cte as (select * from t1 where i < 4 group by i)
select * from cte;
i
1
2
3
with cte as (select * from t1 where i < 4)
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
i
1
3
with cte as (select * from t1 where i < 4 group by i)
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
i
1
3
with cte as (select b from t2 where a < 4)
select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2'
with cte as (select a from t2 where a < 4)
select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
a
1
3
connection default;
revoke SELECT on db.t1 from foo@localhost;
connection con1;
with cte as (select * from t1 where i < 4)
select * from cte;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
disconnect con1;
connection default;
drop database db;
drop user foo@localhost;
mysql-test/r/cte_nonrecursive.result
View file @
5dd505b7
...
@@ -1147,61 +1147,3 @@ SELECT * FROM cte_test;
...
@@ -1147,61 +1147,3 @@ SELECT * FROM cte_test;
a
a
1
1
DROP VIEW cte_test;
DROP VIEW cte_test;
#
# MDEV-13453: privileges checking for CTE
#
create database db;
use db;
create table t1 (i int);
insert into t1
values (3), (7), (1), (4), (2), (3), (1);
create table t2 (a int, b int);
insert into t2
values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
create user foo@localhost;
grant SELECT on db.t1 to foo@localhost;
grant SELECT(a) on db.t2 to foo@localhost;
connect con1,localhost,foo,,;
use db;
with cte as (select * from t1 where i < 4)
select * from cte;
i
3
1
2
3
1
with cte as (select * from t1 where i < 4 group by i)
select * from cte;
i
1
2
3
with cte as (select * from t1 where i < 4)
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
i
1
3
with cte as (select * from t1 where i < 4 group by i)
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
i
1
3
with cte as (select b from t2 where a < 4)
select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2'
with cte as (select a from t2 where a < 4)
select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
a
1
3
connection default;
revoke SELECT on db.t1 from foo@localhost;
connection con1;
with cte as (select * from t1 where i < 4)
select * from cte;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
disconnect con1;
connection default;
drop database db;
drop user foo@localhost;
mysql-test/t/cte_grant.test
View file @
5dd505b7
...
@@ -76,4 +76,55 @@ select * from mysqltest.v3;
...
@@ -76,4 +76,55 @@ select * from mysqltest.v3;
connection
root
;
connection
root
;
revoke
all
privileges
on
mysqltest
.
v1
from
mysqltest_1
@
localhost
;
revoke
all
privileges
on
mysqltest
.
v1
from
mysqltest_1
@
localhost
;
drop
user
mysqltest_1
@
localhost
;
drop
user
mysqltest_1
@
localhost
;
drop
database
mysqltest
;
drop
database
mysqltest
;
\ No newline at end of file
--
echo
#
--
echo
# MDEV-13453: privileges checking for CTE
--
echo
#
create
database
db
;
use
db
;
create
table
t1
(
i
int
);
insert
into
t1
values
(
3
),
(
7
),
(
1
),
(
4
),
(
2
),
(
3
),
(
1
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t2
values
(
3
,
10
),
(
7
,
11
),
(
1
,
17
),
(
4
,
15
),
(
2
,
11
),
(
3
,
10
),
(
1
,
15
);
create
user
foo
@
localhost
;
grant
SELECT
on
db
.
t1
to
foo
@
localhost
;
grant
SELECT
(
a
)
on
db
.
t2
to
foo
@
localhost
;
--
connect
(
con1
,
localhost
,
foo
,,)
use
db
;
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
;
with
cte
as
(
select
*
from
t1
where
i
<
4
group
by
i
)
select
*
from
cte
;
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
cte1
where
i
<
2
union
select
*
from
cte
cte2
where
i
>
2
;
with
cte
as
(
select
*
from
t1
where
i
<
4
group
by
i
)
select
*
from
cte
cte1
where
i
<
2
union
select
*
from
cte
cte2
where
i
>
2
;
--
error
ER_COLUMNACCESS_DENIED_ERROR
with
cte
as
(
select
b
from
t2
where
a
<
4
)
select
*
from
cte
cte1
where
b
<
15
union
select
*
from
cte
cte2
where
b
>
15
;
with
cte
as
(
select
a
from
t2
where
a
<
4
)
select
*
from
cte
cte1
where
a
<
2
union
select
*
from
cte
cte2
where
a
>
2
;
--
connection
default
revoke
SELECT
on
db
.
t1
from
foo
@
localhost
;
--
connection
con1
--
error
ER_TABLEACCESS_DENIED_ERROR
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
;
# Cleanup
--
disconnect
con1
--
connection
default
drop
database
db
;
drop
user
foo
@
localhost
;
mysql-test/t/cte_nonrecursive.test
View file @
5dd505b7
...
@@ -790,54 +790,3 @@ SHOW CREATE VIEW cte_test;
...
@@ -790,54 +790,3 @@ SHOW CREATE VIEW cte_test;
SELECT
*
FROM
cte_test
;
SELECT
*
FROM
cte_test
;
DROP
VIEW
cte_test
;
DROP
VIEW
cte_test
;
--
echo
#
--
echo
# MDEV-13453: privileges checking for CTE
--
echo
#
create
database
db
;
use
db
;
create
table
t1
(
i
int
);
insert
into
t1
values
(
3
),
(
7
),
(
1
),
(
4
),
(
2
),
(
3
),
(
1
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t2
values
(
3
,
10
),
(
7
,
11
),
(
1
,
17
),
(
4
,
15
),
(
2
,
11
),
(
3
,
10
),
(
1
,
15
);
create
user
foo
@
localhost
;
grant
SELECT
on
db
.
t1
to
foo
@
localhost
;
grant
SELECT
(
a
)
on
db
.
t2
to
foo
@
localhost
;
--
connect
(
con1
,
localhost
,
foo
,,)
use
db
;
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
;
with
cte
as
(
select
*
from
t1
where
i
<
4
group
by
i
)
select
*
from
cte
;
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
cte1
where
i
<
2
union
select
*
from
cte
cte2
where
i
>
2
;
with
cte
as
(
select
*
from
t1
where
i
<
4
group
by
i
)
select
*
from
cte
cte1
where
i
<
2
union
select
*
from
cte
cte2
where
i
>
2
;
--
error
ER_COLUMNACCESS_DENIED_ERROR
with
cte
as
(
select
b
from
t2
where
a
<
4
)
select
*
from
cte
cte1
where
b
<
15
union
select
*
from
cte
cte2
where
b
>
15
;
with
cte
as
(
select
a
from
t2
where
a
<
4
)
select
*
from
cte
cte1
where
a
<
2
union
select
*
from
cte
cte2
where
a
>
2
;
--
connection
default
revoke
SELECT
on
db
.
t1
from
foo
@
localhost
;
--
connection
con1
--
error
ER_TABLEACCESS_DENIED_ERROR
with
cte
as
(
select
*
from
t1
where
i
<
4
)
select
*
from
cte
;
# Cleanup
--
disconnect
con1
--
connection
default
drop
database
db
;
drop
user
foo
@
localhost
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment