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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5988ae5c
Commit
5988ae5c
authored
Dec 24, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Many fixes.
I still have to make a test case for : UPDATE from sub-select with derived table
parent
4158538d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
20 deletions
+53
-20
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+15
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+3
-3
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+6
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+3
-3
sql/sql_cache.cc
sql/sql_cache.cc
+2
-0
sql/sql_derived.cc
sql/sql_derived.cc
+2
-7
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
sql/sql_show.cc
sql/sql_show.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+20
-6
No files found.
mysql-test/r/multi_update.result
View file @
5988ae5c
...
...
@@ -235,4 +235,19 @@ select * from t2;
n d
1 30
1 30
UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
select * from t1;
n d
1 30
3 2
select * from t2;
n d
1 30
1 30
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
select * from t1;
n d
3 2
select * from t2;
n d
drop table t1,t2;
mysql-test/r/subselect.result
View file @
5988ae5c
...
...
@@ -86,20 +86,20 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
a b
1 7
2 7
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 order by a limit 2) limit 3;
a b
1 7
2 7
3 8
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1
)
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
)
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
a b
1 7
2 7
3 8
4 8
explain
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
explain
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
...
...
mysql-test/t/multi_update.test
View file @
5988ae5c
...
...
@@ -213,4 +213,10 @@ insert into t2 values(1,10),(1,20);
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
,
t2
.
d
=
30
WHERE
t1
.
n
=
t2
.
n
;
select
*
from
t1
;
select
*
from
t2
;
UPDATE
t1
a
,
t2
b
SET
t1
.
d
=
t2
.
d
,
t2
.
d
=
30
WHERE
a
.
n
=
b
.
n
;
select
*
from
t1
;
select
*
from
t2
;
DELETE
t1
,
t2
FROM
t1
a
,
t2
b
where
a
.
n
=
b
.
n
;
select
*
from
t1
;
select
*
from
t2
;
drop
table
t1
,
t2
;
mysql-test/t/subselect.test
View file @
5988ae5c
...
...
@@ -44,11 +44,11 @@ select (select a from t3), a from t2;
select
*
from
t2
where
t2
.
a
=
(
select
a
from
t1
);
insert
into
t3
values
(
6
),(
7
),(
3
);
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
);
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
)
(
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
))
union
(
select
*
from
t4
order
by
a
limit
2
)
limit
3
;
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
)
(
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
)
)
union
(
select
*
from
t4
where
t4
.
b
=
(
select
max
(
t2
.
a
)
*
4
from
t2
)
order
by
a
);
explain
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
)
explain
(
select
*
from
t2
where
t2
.
b
=
(
select
a
from
t3
order
by
1
desc
limit
1
))
union
(
select
*
from
t4
where
t4
.
b
=
(
select
max
(
t2
.
a
)
*
4
from
t2
)
order
by
a
);
select
(
select
a
from
t3
where
a
<
t2
.
a
*
4
order
by
1
desc
limit
1
),
a
from
t2
;
select
(
select
t3
.
a
from
t3
where
a
<
8
order
by
1
desc
limit
1
),
a
from
...
...
sql/sql_cache.cc
View file @
5988ae5c
...
...
@@ -1062,6 +1062,8 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used,
for
(;
tables_used
;
tables_used
=
tables_used
->
next
)
{
DBUG_ASSERT
(
!
using_transactions
||
tables_used
->
table
!=
0
);
if
(
tables_used
->
derived
)
continue
;
if
(
using_transactions
&&
tables_used
->
table
->
file
->
has_transactions
())
/*
...
...
sql/sql_derived.cc
View file @
5988ae5c
...
...
@@ -168,14 +168,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
tables
->
table_list
->
table
=
tables
->
table
;
// to fix a problem in EXPLAIN
}
else
{
if
(
is_union
)
unit
->
exclude
();
else
sl
->
exclude
();
}
unit
->
exclude
();
t
->
db
=
(
char
*
)
""
;
t
->
derived
=
(
SELECT_LEX
*
)
0
;
// just in case ...
t
->
derived
=
(
SELECT_LEX
*
)
1
;
// just in case ...
table
->
file
->
info
(
HA_STATUS_VARIABLE
);
}
}
...
...
sql/sql_parse.cc
View file @
5988ae5c
...
...
@@ -3001,6 +3001,7 @@ mysql_init_query(THD *thd)
lex
->
select_lex
.
link_prev
=
(
st_select_lex_node
**
)
&
(
lex
->
all_selects_list
);
lex
->
olap
=
lex
->
describe
=
0
;
lex
->
derived_tables
=
false
;
lex
->
lock_option
=
TL_UNLOCK
;
thd
->
check_loops_counter
=
thd
->
select_number
=
lex
->
select_lex
.
select_number
=
1
;
thd
->
free_list
=
0
;
...
...
sql/sql_show.cc
View file @
5988ae5c
...
...
@@ -1469,7 +1469,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
end
=
int10_to_str
((
long
)
thd
->
query_id
,
buff
,
10
);
break
;
case
SHOW_RPL_STATUS
:
end
=
int10_to_str
((
long
)
rpl_status_type
[(
int
)
rpl_status
],
buff
,
10
);
end
=
strmov
(
buff
,
rpl_status_type
[(
int
)
rpl_status
]
);
break
;
case
SHOW_SLAVE_RUNNING
:
{
...
...
sql/sql_yacc.yy
View file @
5988ae5c
...
...
@@ -1668,12 +1668,17 @@ select_init:
'(' SELECT_SYM select_part2 ')'
{
LEX *lex= Lex;
SELECT_LEX
_NODE * sel= lex->current_select
;
SELECT_LEX
* sel= lex->current_select->select_lex()
;
if (sel->set_braces(1))
{
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
if (sel->linkage == UNION_TYPE && !sel->master_unit()->first_select()->braces)
{
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
/* select in braces, can't contain global parameters */
sel->master_unit()->global_parameters=
sel->master_unit();
...
...
@@ -1683,11 +1688,17 @@ select_init2:
select_part2
{
LEX *lex= Lex;
SELECT_LEX * sel= lex->current_select->select_lex();
if (lex->current_select->set_braces(0))
{
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
if (sel->linkage == UNION_TYPE && sel->master_unit()->first_select()->braces)
{
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
}
union_clause
;
...
...
@@ -1695,6 +1706,7 @@ select_init2:
select_part2:
{
LEX *lex=Lex;
SELECT_LEX * sel= lex->current_select->select_lex();
if (lex->current_select == &lex->select_lex)
lex->lock_option= TL_READ; /* Only for global SELECT */
mysql_init_select(lex);
...
...
@@ -2509,7 +2521,9 @@ join_table:
lex->current_select= unit->outer_select();
if (!($$= lex->current_select->
add_table_to_list(lex->thd, new Table_ident(unit), $5, 0,
lex->lock_option)))
lex->lock_option,(List<String> *)0,
(List<String> *)0)))
YYABORT;
};
...
...
@@ -3187,16 +3201,16 @@ table_wild_list:
| table_wild_list ',' table_wild_one {};
table_wild_one:
ident opt_wild
ident opt_wild
opt_table_alias
{
if (!Select->add_table_to_list(YYTHD, new Table_ident($1),
NULL
, 1,
if (!Select->add_table_to_list(YYTHD, new Table_ident($1),
$3
, 1,
Lex->lock_option))
YYABORT;
}
| ident '.' ident opt_wild
| ident '.' ident opt_wild
opt_table_alias
{
if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0),
NULL
, 1, Lex->lock_option))
$5
, 1, Lex->lock_option))
YYABORT;
}
;
...
...
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