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
fcb0b881
Commit
fcb0b881
authored
Nov 28, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
c1527b6f
ec385956
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
199 additions
and
37 deletions
+199
-37
include/mysqld_error.h
include/mysqld_error.h
+2
-1
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+27
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+14
-0
sql/item.cc
sql/item.cc
+25
-23
sql/item_subselect.cc
sql/item_subselect.cc
+59
-7
sql/item_subselect.h
sql/item_subselect.h
+6
-0
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+1
-0
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+1
-0
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+1
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+1
-0
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+1
-0
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+1
-0
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+1
-0
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+1
-0
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+1
-0
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+1
-0
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+1
-0
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+1
-0
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+1
-0
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+1
-0
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+1
-0
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+1
-0
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+1
-0
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+1
-0
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+1
-0
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+1
-0
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+1
-0
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+1
-0
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+1
-0
sql/sql_base.cc
sql/sql_base.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+25
-0
sql/sql_lex.h
sql/sql_lex.h
+3
-0
sql/sql_parse.cc
sql/sql_parse.cc
+9
-3
sql/sql_union.cc
sql/sql_union.cc
+4
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-2
No files found.
include/mysqld_error.h
View file @
fcb0b881
...
@@ -262,4 +262,5 @@
...
@@ -262,4 +262,5 @@
#define ER_CYCLIC_REFERENCE 1243
#define ER_CYCLIC_REFERENCE 1243
#define ER_AUTO_CONVERT 1244
#define ER_AUTO_CONVERT 1244
#define ER_ILLEGAL_REFERENCE 1245
#define ER_ILLEGAL_REFERENCE 1245
#define ER_ERROR_MESSAGES 246
#define ER_SELECT_REDUCED 1246
#define ER_ERROR_MESSAGES 247
mysql-test/r/subselect.result
View file @
fcb0b881
...
@@ -513,3 +513,30 @@ x y
...
@@ -513,3 +513,30 @@ x y
4 2
4 2
2 1
2 1
drop table t1, t2;
drop table t1, t2;
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT *);
No tables used
drop table if exists t;
CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t VALUES (1),(2);
SELECT * FROM t WHERE id IN (SELECT 1);
id
1
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ref id id 5 const 1 Using where; Using index
Warnings:
Note 1246 Select 2 was reduced during optimisation
SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t index NULL id 5 NULL 2 Using where; Using index
2 DEPENDENT SUBSELECT No tables used
3 UNION No tables used
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
drop table if exists t;
mysql-test/t/subselect.test
View file @
fcb0b881
...
@@ -306,3 +306,17 @@ select * from t1;
...
@@ -306,3 +306,17 @@ select * from t1;
replace
LOW_PRIORITY
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
+
1
FROM
t2
),
(
SELECT
a
FROM
t2
));
replace
LOW_PRIORITY
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
+
1
FROM
t2
),
(
SELECT
a
FROM
t2
));
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
--
error
1096
SELECT
*
FROM
(
SELECT
1
)
WHERE
1
IN
(
SELECT
*
);
drop
table
if
exists
t
;
CREATE
TABLE
t
(
id
int
(
11
)
default
NULL
,
KEY
id
(
id
))
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t
VALUES
(
1
),(
2
);
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
1
);
EXPLAIN
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
1
);
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
1
UNION
SELECT
3
);
EXPLAIN
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
1
UNION
SELECT
3
);
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
5
UNION
SELECT
3
);
SELECT
*
FROM
t
WHERE
id
IN
(
SELECT
5
UNION
SELECT
2
);
drop
table
if
exists
t
;
sql/item.cc
View file @
fcb0b881
...
@@ -473,39 +473,41 @@ bool Item_asterisk_remover::fix_fields(THD *thd,
...
@@ -473,39 +473,41 @@ bool Item_asterisk_remover::fix_fields(THD *thd,
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
{
Item_field
*
fitem
=
(
Item_field
*
)
item
;
Item_field
*
fitem
=
(
Item_field
*
)
item
;
if
(
!
list
->
next
||
fitem
->
db_name
||
fitem
->
table_name
)
if
(
list
)
{
if
(
!
list
->
next
||
fitem
->
db_name
||
fitem
->
table_name
)
TABLE_LIST
*
table
=
find_table_in_list
(
list
,
fitem
->
db_name
,
fitem
->
table_name
);
if
(
table
)
{
{
TABLE
*
tb
=
table
->
table
;
TABLE
_LIST
*
table
=
find_table_in_list
(
list
,
if
(
find_table_in_list
(
table
->
next
,
fitem
->
db_name
,
fitem
->
db_name
,
fitem
->
table_name
)
!=
0
||
fitem
->
table_name
);
tb
->
fields
==
1
)
if
(
table
)
{
{
if
((
item
=
new
Item_field
(
tb
->
field
[
0
])))
TABLE
*
tb
=
table
->
table
;
if
(
find_table_in_list
(
table
->
next
,
fitem
->
db_name
,
fitem
->
table_name
)
!=
0
||
tb
->
fields
==
1
)
{
{
res
=
0
;
if
((
item
=
new
Item_field
(
tb
->
field
[
0
])))
tb
->
field
[
0
]
->
query_id
=
thd
->
query_id
;
{
tb
->
used_keys
&=
tb
->
field
[
0
]
->
part_of_key
;
res
=
0
;
tb
->
used_fields
=
tb
->
fields
;
tb
->
field
[
0
]
->
query_id
=
thd
->
query_id
;
tb
->
used_keys
&=
tb
->
field
[
0
]
->
part_of_key
;
tb
->
used_fields
=
tb
->
fields
;
}
else
thd
->
fatal_error
=
1
;
// can't create Item => out of memory
}
}
else
else
thd
->
fatal_error
=
1
;
// can't create Item => out of memory
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
}
}
else
else
my_error
(
ER_
CARDINALITY_COL
,
MYF
(
0
),
1
);
my_error
(
ER_
BAD_TABLE_ERROR
,
MYF
(
0
),
fitem
->
table_name
);
}
}
else
else
if
(
!
fitem
->
table_name
)
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
MYF
(
0
));
else
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
fitem
->
table_name
);
}
else
else
my_error
(
ER_
CARDINALITY_COL
,
MYF
(
0
),
1
);
my_error
(
ER_
NO_TABLES_USED
,
MYF
(
0
)
);
}
}
else
else
res
=
item
->
fix_fields
(
thd
,
list
,
&
item
);
res
=
item
->
fix_fields
(
thd
,
list
,
&
item
);
...
...
sql/item_subselect.cc
View file @
fcb0b881
...
@@ -33,7 +33,7 @@ SUBSELECT TODO:
...
@@ -33,7 +33,7 @@ SUBSELECT TODO:
#include "sql_select.h"
#include "sql_select.h"
Item_subselect
::
Item_subselect
()
:
Item_subselect
::
Item_subselect
()
:
Item_result_field
(),
engine_owner
(
1
),
value_assigned
(
0
)
Item_result_field
(),
engine_owner
(
1
),
value_assigned
(
0
)
,
substitution
(
0
)
{
{
assign_null
();
assign_null
();
/*
/*
...
@@ -89,6 +89,13 @@ void Item_subselect::make_field (Send_field *tmp_field)
...
@@ -89,6 +89,13 @@ void Item_subselect::make_field (Send_field *tmp_field)
bool
Item_subselect
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
)
bool
Item_subselect
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
)
{
{
if
(
substitution
)
{
(
*
ref
)
=
substitution
;
engine
->
exclude
();
return
substitution
->
fix_fields
(
thd
,
tables
,
ref
);
}
char
const
*
save_where
=
thd
->
where
;
char
const
*
save_where
=
thd
->
where
;
int
res
=
engine
->
prepare
();
int
res
=
engine
->
prepare
();
if
(
!
res
)
if
(
!
res
)
...
@@ -291,12 +298,12 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
...
@@ -291,12 +298,12 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
else
else
item
=
(
Item
*
)
sl
->
item_list
.
pop
();
item
=
(
Item
*
)
sl
->
item_list
.
pop
();
left_
expr
=
new
Item_outer_select_context_saver
(
left_expr
);
Item
*
expr
=
new
Item_outer_select_context_saver
(
left_expr
);
if
(
sl
->
having
||
sl
->
with_sum_func
||
sl
->
group_list
.
first
)
if
(
sl
->
having
||
sl
->
with_sum_func
||
sl
->
group_list
.
first
)
{
{
sl
->
item_list
.
push_back
(
item
);
sl
->
item_list
.
push_back
(
item
);
item
=
(
*
func
)(
left_
expr
,
new
Item_ref
(
sl
->
item_list
.
head_ref
(),
item
=
(
*
func
)(
expr
,
new
Item_ref
(
sl
->
item_list
.
head_ref
(),
0
,
(
char
*
)
"<result>"
));
0
,
(
char
*
)
"<result>"
));
if
(
sl
->
having
)
if
(
sl
->
having
)
sl
->
having
=
new
Item_cond_and
(
sl
->
having
,
item
);
sl
->
having
=
new
Item_cond_and
(
sl
->
having
,
item
);
...
@@ -307,11 +314,42 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
...
@@ -307,11 +314,42 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
{
{
sl
->
item_list
.
empty
();
sl
->
item_list
.
empty
();
sl
->
item_list
.
push_back
(
new
Item_int
(
1
));
sl
->
item_list
.
push_back
(
new
Item_int
(
1
));
item
=
(
*
func
)(
left_expr
,
new
Item_asterisk_remover
(
item
));
if
(
sl
->
table_list
.
elements
)
if
(
sl
->
where
)
{
sl
->
where
=
new
Item_cond_and
(
sl
->
where
,
item
);
item
=
(
*
func
)(
expr
,
new
Item_asterisk_remover
(
item
));
if
(
sl
->
where
)
sl
->
where
=
new
Item_cond_and
(
sl
->
where
,
item
);
else
sl
->
where
=
item
;
}
else
else
sl
->
where
=
item
;
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
DBUG_VOID_RETURN
;
}
if
(
select_lex
->
next_select
())
{
// it is in union => we should perform it
sl
->
having
=
(
*
func
)(
expr
,
item
);
}
else
{
// it is single select without tables => possible optimization
item
=
(
*
func
)(
left_expr
,
item
);
substitution
=
item
;
THD
*
thd
=
current_thd
;
if
(
thd
->
lex
.
describe
)
{
char
warn_buff
[
MYSQL_ERRMSG_SIZE
];
sprintf
(
warn_buff
,
ER
(
ER_SELECT_REDUCED
),
sl
->
select_number
);
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_SELECT_REDUCED
,
warn_buff
);
}
}
}
}
}
}
}
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -502,3 +540,17 @@ bool subselect_union_engine::check_loop(uint id)
...
@@ -502,3 +540,17 @@ bool subselect_union_engine::check_loop(uint id)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
void
subselect_single_select_engine
::
exclude
()
{
select_lex
->
master_unit
()
->
exclude_level
();
//if (current_thd->lex->describe)
}
void
subselect_union_engine
::
exclude
()
{
unit
->
exclude_level
();
// for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
// if (sl->join && sl->join->check_loop(id))
// DBUG_RETURN(1);
}
sql/item_subselect.h
View file @
fcb0b881
...
@@ -36,6 +36,8 @@ class Item_subselect :public Item_result_field
...
@@ -36,6 +36,8 @@ class Item_subselect :public Item_result_field
my_bool
engine_owner
;
/* Is this item owner of engine */
my_bool
engine_owner
;
/* Is this item owner of engine */
my_bool
value_assigned
;
/* value already assigned to subselect */
my_bool
value_assigned
;
/* value already assigned to subselect */
protected:
protected:
/* substitution instead of subselect in case of optimization */
Item
*
substitution
;
/* engine that perform execution of subselect (single select or union) */
/* engine that perform execution of subselect (single select or union) */
subselect_engine
*
engine
;
subselect_engine
*
engine
;
/* allowed number of columns (1 for single value subqueries) */
/* allowed number of columns (1 for single value subqueries) */
...
@@ -45,6 +47,7 @@ class Item_subselect :public Item_result_field
...
@@ -45,6 +47,7 @@ class Item_subselect :public Item_result_field
Item_subselect
();
Item_subselect
();
Item_subselect
(
Item_subselect
*
item
)
Item_subselect
(
Item_subselect
*
item
)
{
{
substitution
=
item
->
substitution
;
null_value
=
item
->
null_value
;
null_value
=
item
->
null_value
;
decimals
=
item
->
decimals
;
decimals
=
item
->
decimals
;
max_columns
=
item
->
max_columns
;
max_columns
=
item
->
max_columns
;
...
@@ -213,6 +216,7 @@ class subselect_engine
...
@@ -213,6 +216,7 @@ class subselect_engine
virtual
bool
depended
()
=
0
;
/* depended from outer select */
virtual
bool
depended
()
=
0
;
/* depended from outer select */
enum
Item_result
type
()
{
return
res_type
;
}
enum
Item_result
type
()
{
return
res_type
;
}
virtual
bool
check_loop
(
uint
id
)
=
0
;
virtual
bool
check_loop
(
uint
id
)
=
0
;
virtual
void
exclude
()
=
0
;
};
};
class
subselect_single_select_engine
:
public
subselect_engine
class
subselect_single_select_engine
:
public
subselect_engine
...
@@ -232,6 +236,7 @@ class subselect_single_select_engine: public subselect_engine
...
@@ -232,6 +236,7 @@ class subselect_single_select_engine: public subselect_engine
uint
cols
();
uint
cols
();
bool
depended
();
bool
depended
();
bool
check_loop
(
uint
id
);
bool
check_loop
(
uint
id
);
void
exclude
();
};
};
class
subselect_union_engine
:
public
subselect_engine
class
subselect_union_engine
:
public
subselect_engine
...
@@ -248,4 +253,5 @@ class subselect_union_engine: public subselect_engine
...
@@ -248,4 +253,5 @@ class subselect_union_engine: public subselect_engine
uint
cols
();
uint
cols
();
bool
depended
();
bool
depended
();
bool
check_loop
(
uint
id
);
bool
check_loop
(
uint
id
);
void
exclude
();
};
};
sql/share/czech/errmsg.txt
View file @
fcb0b881
...
@@ -256,3 +256,4 @@ v/*
...
@@ -256,3 +256,4 @@ v/*
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/danish/errmsg.txt
View file @
fcb0b881
...
@@ -250,3 +250,4 @@
...
@@ -250,3 +250,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/dutch/errmsg.txt
View file @
fcb0b881
...
@@ -258,3 +258,4 @@
...
@@ -258,3 +258,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/english/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/estonian/errmsg.txt
View file @
fcb0b881
...
@@ -252,3 +252,4 @@
...
@@ -252,3 +252,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/french/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/german/errmsg.txt
View file @
fcb0b881
...
@@ -250,3 +250,4 @@
...
@@ -250,3 +250,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/greek/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/hungarian/errmsg.txt
View file @
fcb0b881
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/italian/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/japanese/errmsg.txt
View file @
fcb0b881
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/korean/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/norwegian-ny/errmsg.txt
View file @
fcb0b881
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/norwegian/errmsg.txt
View file @
fcb0b881
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/polish/errmsg.txt
View file @
fcb0b881
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/portuguese/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/romanian/errmsg.txt
View file @
fcb0b881
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
"Converting column '%s' from %s to %s"
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/russian/errmsg.txt
View file @
fcb0b881
...
@@ -250,3 +250,4 @@
...
@@ -250,3 +250,4 @@
" ",
" ",
" '%s' %s %s",
" '%s' %s %s",
" '%-.64s' (%s)",
" '%-.64s' (%s)",
"Select %u ",
sql/share/serbian/errmsg.txt
View file @
fcb0b881
...
@@ -243,3 +243,4 @@
...
@@ -243,3 +243,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/slovak/errmsg.txt
View file @
fcb0b881
...
@@ -255,3 +255,4 @@
...
@@ -255,3 +255,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/spanish/errmsg.txt
View file @
fcb0b881
...
@@ -248,3 +248,4 @@
...
@@ -248,3 +248,4 @@
"Cyclic reference on subqueries",
"Cyclic reference on subqueries",
"Converting column '%s' from %s to %s",
"Converting column '%s' from %s to %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/swedish/errmsg.txt
View file @
fcb0b881
...
@@ -247,3 +247,4 @@
...
@@ -247,3 +247,4 @@
"Syklisk referens i subselect",
"Syklisk referens i subselect",
"Konvertar kolumn '%s' från %s till %s",
"Konvertar kolumn '%s' från %s till %s",
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Select %u was reduced during optimisation",
sql/share/ukrainian/errmsg.txt
View file @
fcb0b881
...
@@ -252,3 +252,4 @@
...
@@ -252,3 +252,4 @@
"̦ Ц",
"̦ Ц",
" '%s' %s %s",
" '%s' %s %s",
" '%-.64s' i (%s)",
" '%-.64s' i (%s)",
"Select %u was iii",
sql/sql_base.cc
View file @
fcb0b881
...
@@ -2082,7 +2082,7 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
...
@@ -2082,7 +2082,7 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
while
((
item
=
it
++
))
while
((
item
=
it
++
))
{
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
{
uint
elem
=
fields
.
elements
;
uint
elem
=
fields
.
elements
;
...
...
sql/sql_lex.cc
View file @
fcb0b881
...
@@ -1062,6 +1062,31 @@ void st_select_lex_node::exclude()
...
@@ -1062,6 +1062,31 @@ void st_select_lex_node::exclude()
*/
*/
}
}
void
st_select_lex_unit
::
exclude_level
()
{
SELECT_LEX_UNIT
*
units
=
0
,
**
units_last
=
&
units
;
for
(
SELECT_LEX
*
sl
=
first_select
();
sl
;
sl
=
sl
->
next_select
())
{
if
(
sl
->
link_prev
&&
(
*
sl
->
link_prev
=
sl
->
link_next
))
sl
->
link_next
->
link_prev
=
sl
->
link_prev
;
SELECT_LEX_UNIT
**
last
=
0
;
for
(
SELECT_LEX_UNIT
*
u
=
sl
->
first_inner_unit
();
u
;
u
=
u
->
next_unit
())
last
=
(
SELECT_LEX_UNIT
**
)
&
(
u
->
next
);
if
(
last
)
{
(
*
units_last
)
=
sl
->
first_inner_unit
();
units_last
=
last
;
}
}
if
(
units
)
{
(
*
prev
)
=
units
;
(
*
units_last
)
=
(
SELECT_LEX_UNIT
*
)
next
;
}
else
(
*
prev
)
=
next
;
}
st_select_lex
*
st_select_lex_node
::
select_lex
()
st_select_lex
*
st_select_lex_node
::
select_lex
()
{
{
DBUG_ENTER
(
"st_select_lex_node::select_lex (never should be called)"
);
DBUG_ENTER
(
"st_select_lex_node::select_lex (never should be called)"
);
...
...
sql/sql_lex.h
View file @
fcb0b881
...
@@ -242,6 +242,8 @@ class st_select_lex_node {
...
@@ -242,6 +242,8 @@ class st_select_lex_node {
List
<
String
>
*
ignore_index
=
0
);
List
<
String
>
*
ignore_index
=
0
);
virtual
void
set_lock_for_tables
(
thr_lock_type
lock_type
)
{}
virtual
void
set_lock_for_tables
(
thr_lock_type
lock_type
)
{}
void
mark_as_dependent
(
st_select_lex
*
last
);
void
mark_as_dependent
(
st_select_lex
*
last
);
friend
class
st_select_lex_unit
;
private:
private:
void
fast_exclude
();
void
fast_exclude
();
};
};
...
@@ -288,6 +290,7 @@ class st_select_lex_unit: public st_select_lex_node {
...
@@ -288,6 +290,7 @@ class st_select_lex_unit: public st_select_lex_node {
st_select_lex
*
outer_select
();
st_select_lex
*
outer_select
();
st_select_lex
*
first_select
()
{
return
(
st_select_lex
*
)
slave
;
}
st_select_lex
*
first_select
()
{
return
(
st_select_lex
*
)
slave
;
}
st_select_lex_unit
*
next_unit
()
{
return
(
st_select_lex_unit
*
)
next
;
}
st_select_lex_unit
*
next_unit
()
{
return
(
st_select_lex_unit
*
)
next
;
}
void
st_select_lex_unit
::
exclude_level
();
/* UNION methods */
/* UNION methods */
int
prepare
(
THD
*
thd
,
select_result
*
result
);
int
prepare
(
THD
*
thd
,
select_result
*
result
);
...
...
sql/sql_parse.cc
View file @
fcb0b881
...
@@ -1329,7 +1329,6 @@ mysql_execute_command(THD *thd)
...
@@ -1329,7 +1329,6 @@ mysql_execute_command(THD *thd)
*/
*/
thd
->
old_total_warn_count
=
thd
->
total_warn_count
;
thd
->
old_total_warn_count
=
thd
->
total_warn_count
;
thd
->
net
.
report_error
=
0
;
if
(
thd
->
slave_thread
)
if
(
thd
->
slave_thread
)
{
{
/*
/*
...
@@ -2951,6 +2950,8 @@ mysql_parse(THD *thd, char *inBuf, uint length)
...
@@ -2951,6 +2950,8 @@ mysql_parse(THD *thd, char *inBuf, uint length)
mysql_init_query
(
thd
);
mysql_init_query
(
thd
);
thd
->
query_length
=
length
;
thd
->
query_length
=
length
;
thd
->
net
.
report_error
=
0
;
if
(
query_cache_send_result_to_client
(
thd
,
inBuf
,
length
)
<=
0
)
if
(
query_cache_send_result_to_client
(
thd
,
inBuf
,
length
)
<=
0
)
{
{
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
inBuf
,
length
);
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
inBuf
,
length
);
...
@@ -2963,8 +2964,13 @@ mysql_parse(THD *thd, char *inBuf, uint length)
...
@@ -2963,8 +2964,13 @@ mysql_parse(THD *thd, char *inBuf, uint length)
}
}
else
else
{
{
mysql_execute_command
(
thd
);
if
(
thd
->
net
.
report_error
)
query_cache_end_of_result
(
&
thd
->
net
);
send_error
(
thd
,
0
,
NullS
);
else
{
mysql_execute_command
(
thd
);
query_cache_end_of_result
(
&
thd
->
net
);
}
}
}
}
}
else
else
...
...
sql/sql_union.cc
View file @
fcb0b881
...
@@ -214,7 +214,11 @@ int st_select_lex_unit::exec()
...
@@ -214,7 +214,11 @@ int st_select_lex_unit::exec()
if
(
dependent
||
!
item
||
!
item
->
assigned
())
if
(
dependent
||
!
item
||
!
item
->
assigned
())
{
{
if
(
optimized
&&
item
&&
item
->
assigned
())
if
(
optimized
&&
item
&&
item
->
assigned
())
{
item
->
assigned
(
0
);
// We will reinit & rexecute unit
item
->
assigned
(
0
);
// We will reinit & rexecute unit
item
->
assign_null
();
table
->
file
->
delete_all_rows
();
}
for
(
SELECT_LEX
*
sl
=
first_select
();
sl
;
sl
=
sl
->
next_select
())
for
(
SELECT_LEX
*
sl
=
first_select
();
sl
;
sl
=
sl
->
next_select
())
{
{
thd
->
lex
.
current_select
=
sl
;
thd
->
lex
.
current_select
=
sl
;
...
...
sql/sql_yacc.yy
View file @
fcb0b881
...
@@ -3334,11 +3334,10 @@ describe:
...
@@ -3334,11 +3334,10 @@ describe:
YYABORT;
YYABORT;
}
}
opt_describe_column
opt_describe_column
| describe_command select
| describe_command
{ Lex->describe=1; }
select
{
{
LEX *lex=Lex;
LEX *lex=Lex;
lex->select_lex.options|= SELECT_DESCRIBE;
lex->select_lex.options|= SELECT_DESCRIBE;
lex->describe=1;
};
};
...
...
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