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
38caf865
Commit
38caf865
authored
May 28, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
parents
64a569fd
a02d89de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
13 deletions
+49
-13
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+4
-2
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+44
-10
No files found.
mysql-test/r/subselect.result
View file @
38caf865
...
@@ -606,14 +606,14 @@ x
...
@@ -606,14 +606,14 @@ x
3
3
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
You can't specify target table 't1' for update in FROM clause
You can't specify target table 't1' for update in FROM clause
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(
x
) FROM t2));
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(
a
) FROM t2));
select * from t1;
select * from t1;
x
x
1
1
2
2
3
3
3
3
0
2
drop table t1, t2, t3;
drop table t1, t2, t3;
CREATE TABLE t1 (x int not null, y int, primary key (x));
CREATE TABLE t1 (x int not null, y int, primary key (x));
create table t2 (a int);
create table t2 (a int);
...
@@ -688,6 +688,8 @@ id
...
@@ -688,6 +688,8 @@ id
2
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
INSERT INTO t2 VALUES ((SELECT * FROM t2));
You can't specify target table 't2' for update in FROM clause
You can't specify target table 't2' for update in FROM clause
INSERT INTO t2 VALUES ((SELECT id FROM t2));
You can't specify target table 't2' for update in FROM clause
SELECT * FROM t2;
SELECT * FROM t2;
id
id
1
1
...
...
mysql-test/t/subselect.test
View file @
38caf865
...
@@ -351,7 +351,7 @@ INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
...
@@ -351,7 +351,7 @@ INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select
*
from
t1
;
select
*
from
t1
;
--
error
1093
--
error
1093
INSERT
INTO
t1
(
x
)
select
(
SELECT
SUM
(
x
)
+
2
FROM
t1
)
FROM
t2
;
INSERT
INTO
t1
(
x
)
select
(
SELECT
SUM
(
x
)
+
2
FROM
t1
)
FROM
t2
;
INSERT
DELAYED
INTO
t1
(
x
)
VALUES
((
SELECT
SUM
(
x
)
FROM
t2
));
INSERT
DELAYED
INTO
t1
(
x
)
VALUES
((
SELECT
SUM
(
a
)
FROM
t2
));
--
sleep
1
--
sleep
1
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
...
...
sql/sql_parse.cc
View file @
38caf865
...
@@ -2285,15 +2285,23 @@ mysql_execute_command(THD *thd)
...
@@ -2285,15 +2285,23 @@ mysql_execute_command(THD *thd)
TABLE_LIST
*
table
;
TABLE_LIST
*
table
;
if
(
check_db_used
(
thd
,
tables
))
if
(
check_db_used
(
thd
,
tables
))
goto
error
;
goto
error
;
for
(
table
=
tables
;
table
;
table
=
table
->
next
)
if
(
check_access
(
thd
,
UPDATE_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
goto
error
;
{
{
if
(
table
->
derived
)
// Show only 1 table for check_grant
table
->
grant
.
privilege
=
SELECT_ACL
;
TABLE_LIST
*
subselects_tables
=
tables
->
next
;
else
if
(
check_access
(
thd
,
UPDATE_ACL
,
table
->
db
,
&
table
->
grant
.
privilege
))
tables
->
next
=
0
;
if
(
grant_option
&&
check_grant
(
thd
,
UPDATE_ACL
,
tables
))
goto
error
;
goto
error
;
}
tables
->
next
=
subselects_tables
;
if
(
grant_option
&&
check_grant
(
thd
,
UPDATE_ACL
,
tables
))
// check rights on tables of subselect (if exists)
if
(
subselects_tables
&&
(
res
=
check_table_access
(
thd
,
SELECT_ACL
,
subselects_tables
)))
goto
error
;
goto
error
;
}
if
(
select_lex
->
item_list
.
elements
!=
lex
->
value_list
.
elements
)
if
(
select_lex
->
item_list
.
elements
!=
lex
->
value_list
.
elements
)
{
{
send_error
(
thd
,
ER_WRONG_VALUE_COUNT
);
send_error
(
thd
,
ER_WRONG_VALUE_COUNT
);
...
@@ -2349,8 +2357,21 @@ mysql_execute_command(THD *thd)
...
@@ -2349,8 +2357,21 @@ mysql_execute_command(THD *thd)
INSERT_ACL
|
DELETE_ACL
:
INSERT_ACL
|
update
);
INSERT_ACL
|
DELETE_ACL
:
INSERT_ACL
|
update
);
if
(
check_access
(
thd
,
privilege
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
if
(
check_access
(
thd
,
privilege
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
if
(
grant_option
&&
check_grant
(
thd
,
privilege
,
tables
))
{
// Show only 1 table for check_grant
TABLE_LIST
*
subselects_tables
=
tables
->
next
;
tables
->
next
=
0
;
if
(
grant_option
&&
check_grant
(
thd
,
privilege
,
tables
))
goto
error
;
goto
error
;
tables
->
next
=
subselects_tables
;
// check rights on tables of subselect (if exists)
if
(
subselects_tables
&&
(
res
=
check_table_access
(
thd
,
SELECT_ACL
,
subselects_tables
)))
goto
error
;
}
if
(
select_lex
->
item_list
.
elements
!=
lex
->
value_list
.
elements
)
if
(
select_lex
->
item_list
.
elements
!=
lex
->
value_list
.
elements
)
{
{
send_error
(
thd
,
ER_WRONG_VALUE_COUNT
);
send_error
(
thd
,
ER_WRONG_VALUE_COUNT
);
...
@@ -2434,8 +2455,21 @@ mysql_execute_command(THD *thd)
...
@@ -2434,8 +2455,21 @@ mysql_execute_command(THD *thd)
{
{
if
(
check_access
(
thd
,
DELETE_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
if
(
check_access
(
thd
,
DELETE_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
if
(
grant_option
&&
check_grant
(
thd
,
DELETE_ACL
,
tables
))
{
// Show only 1 table for check_grant
TABLE_LIST
*
subselects_tables
=
tables
->
next
;
tables
->
next
=
0
;
if
(
grant_option
&&
check_grant
(
thd
,
DELETE_ACL
,
tables
))
goto
error
;
tables
->
next
=
subselects_tables
;
// check rights on tables of subselect (if exists)
if
(
subselects_tables
&&
(
res
=
check_table_access
(
thd
,
SELECT_ACL
,
subselects_tables
)))
goto
error
;
goto
error
;
}
// Set privilege for the WHERE clause
// Set privilege for the WHERE clause
tables
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
tables
->
grant
.
privilege
);
tables
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
tables
->
grant
.
privilege
);
res
=
mysql_delete
(
thd
,
tables
,
select_lex
->
where
,
res
=
mysql_delete
(
thd
,
tables
,
select_lex
->
where
,
...
...
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