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
47af809c
Commit
47af809c
authored
Dec 02, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper handling of ORDER BY table.column in UNION's
parent
36429430
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
39 additions
and
13 deletions
+39
-13
include/mysqld_error.h
include/mysqld_error.h
+2
-1
mysql-test/r/union.result
mysql-test/r/union.result
+1
-4
mysql-test/t/union.test
mysql-test/t/union.test
+1
-0
sql/item.cc
sql/item.cc
+3
-5
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
+2
-1
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
+8
-2
No files found.
include/mysqld_error.h
View file @
47af809c
...
@@ -264,4 +264,5 @@
...
@@ -264,4 +264,5 @@
#define ER_ILLEGAL_REFERENCE 1245
#define ER_ILLEGAL_REFERENCE 1245
#define ER_DERIVED_MUST_HAVE_ALIAS 1246
#define ER_DERIVED_MUST_HAVE_ALIAS 1246
#define ER_SELECT_REDUCED 1247
#define ER_SELECT_REDUCED 1247
#define ER_ERROR_MESSAGES 248
#define ER_TABLENAME_NOT_ALLOWED_HERE 1248
#define ER_ERROR_MESSAGES 249
mysql-test/r/union.result
View file @
47af809c
...
@@ -85,10 +85,7 @@ a b
...
@@ -85,10 +85,7 @@ a b
2 b
2 b
1 a
1 a
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
a b
Table 't1' from one of SELECT's can not be used in order clause
1 a
2 b
3 c
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
...
...
mysql-test/t/union.test
View file @
47af809c
...
@@ -20,6 +20,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
...
@@ -20,6 +20,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
4
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
4
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
);
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
);
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
--
error
1248
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
t1
.
b
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
t1
.
b
;
explain
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
explain
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
#(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
#(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
...
...
sql/item.cc
View file @
47af809c
...
@@ -535,12 +535,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -535,12 +535,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
SELECT_LEX
*
last
=
0
;
SELECT_LEX
*
last
=
0
;
Item
**
refer
=
(
Item
**
)
not_found_item
;
Item
**
refer
=
(
Item
**
)
not_found_item
;
SELECT_LEX
*
cursel
=
(
SELECT_LEX
*
)
thd
->
lex
.
current_select
;
// Prevent using outer fields in subselects, that is not supported now
// Prevent using outer fields in subselects, that is not supported now
SELECT_LEX
*
cursel
=
(
SELECT_LEX
*
)
thd
->
lex
.
current_select
;
if
(
cursel
->
linkage
!=
DERIVED_TABLE_TYPE
)
if
(
cursel
->
linkage
!=
DERIVED_TABLE_TYPE
)
for
(
SELECT_LEX
*
sl
=
(
cursel
->
get_master
()
->
order_list
.
elements
)
?
for
(
SELECT_LEX
*
sl
=
cursel
->
outer_select
();
cursel
->
select_lex
()
:
cursel
->
outer_select
();
sl
;
sl
;
sl
=
sl
->
outer_select
())
sl
=
sl
->
outer_select
())
{
{
...
@@ -576,7 +574,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -576,7 +574,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
(
r
->
check_cols
(
1
)
||
r
->
fix_fields
(
thd
,
tables
,
ref
))
if
(
r
->
check_cols
(
1
)
||
r
->
fix_fields
(
thd
,
tables
,
ref
))
return
1
;
return
1
;
r
->
depended_from
=
last
;
r
->
depended_from
=
last
;
thd
->
lex
.
current_select
->
mark_as_dependent
(
last
);
cursel
->
mark_as_dependent
(
last
);
thd
->
add_possible_loop
(
r
);
thd
->
add_possible_loop
(
r
);
return
0
;
return
0
;
}
}
...
...
sql/share/czech/errmsg.txt
View file @
47af809c
...
@@ -258,3 +258,4 @@ v/*
...
@@ -258,3 +258,4 @@ v/*
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/danish/errmsg.txt
View file @
47af809c
...
@@ -252,3 +252,4 @@
...
@@ -252,3 +252,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/dutch/errmsg.txt
View file @
47af809c
...
@@ -260,3 +260,4 @@
...
@@ -260,3 +260,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/english/errmsg.txt
View file @
47af809c
...
@@ -247,5 +247,6 @@
...
@@ -247,5 +247,6 @@
"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)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
,
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/estonian/errmsg.txt
View file @
47af809c
...
@@ -254,3 +254,4 @@
...
@@ -254,3 +254,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/french/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/german/errmsg.txt
View file @
47af809c
...
@@ -252,3 +252,4 @@
...
@@ -252,3 +252,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/greek/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/hungarian/errmsg.txt
View file @
47af809c
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/italian/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/japanese/errmsg.txt
View file @
47af809c
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/korean/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/norwegian-ny/errmsg.txt
View file @
47af809c
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/norwegian/errmsg.txt
View file @
47af809c
...
@@ -251,3 +251,4 @@
...
@@ -251,3 +251,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/polish/errmsg.txt
View file @
47af809c
...
@@ -253,3 +253,4 @@
...
@@ -253,3 +253,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/portuguese/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/romanian/errmsg.txt
View file @
47af809c
...
@@ -253,3 +253,4 @@
...
@@ -253,3 +253,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/russian/errmsg.txt
View file @
47af809c
...
@@ -252,3 +252,4 @@
...
@@ -252,3 +252,4 @@
" '%-.64s' (%s)",
" '%-.64s' (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u ",
"Select %u ",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/serbian/errmsg.txt
View file @
47af809c
...
@@ -245,3 +245,4 @@
...
@@ -245,3 +245,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/slovak/errmsg.txt
View file @
47af809c
...
@@ -257,3 +257,4 @@
...
@@ -257,3 +257,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/spanish/errmsg.txt
View file @
47af809c
...
@@ -250,3 +250,4 @@
...
@@ -250,3 +250,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/swedish/errmsg.txt
View file @
47af809c
...
@@ -249,3 +249,4 @@
...
@@ -249,3 +249,4 @@
"Reference '%-.64s' not supported (%s)",
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/share/ukrainian/errmsg.txt
View file @
47af809c
...
@@ -254,3 +254,4 @@
...
@@ -254,3 +254,4 @@
" '%-.64s' i (%s)",
" '%-.64s' i (%s)",
"Every derived table must have it's own alias"
"Every derived table must have it's own alias"
"Select %u was iii",
"Select %u was iii",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
sql/sql_base.cc
View file @
47af809c
...
@@ -1957,8 +1957,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
...
@@ -1957,8 +1957,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
table_name
=
buff
;
table_name
=
buff
;
}
}
if
(
report_error
)
if
(
report_error
)
{
if
(
thd
->
lex
.
current_select
->
get_master
()
->
order_list
.
elements
)
my_printf_error
(
ER_TABLENAME_NOT_ALLOWED_HERE
,
ER
(
ER_TABLENAME_NOT_ALLOWED_HERE
),
MYF
(
0
),
table_name
,
thd
->
where
);
else
my_printf_error
(
ER_UNKNOWN_TABLE
,
ER
(
ER_UNKNOWN_TABLE
),
MYF
(
0
),
my_printf_error
(
ER_UNKNOWN_TABLE
,
ER
(
ER_UNKNOWN_TABLE
),
MYF
(
0
),
table_name
,
thd
->
where
);
table_name
,
thd
->
where
);
}
else
else
return
(
Field
*
)
not_found_field
;
return
(
Field
*
)
not_found_field
;
}
}
...
...
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