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
4d2a58f8
Commit
4d2a58f8
authored
Oct 13, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge of bug fix #7672
parents
37aa6efd
fb0074a6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
0 deletions
+45
-0
mysql-test/r/select.result
mysql-test/r/select.result
+10
-0
mysql-test/t/select.test
mysql-test/t/select.test
+11
-0
sql/item.cc
sql/item.cc
+16
-0
sql/sql_lex.cc
sql/sql_lex.cc
+2
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+5
-0
No files found.
mysql-test/r/select.result
View file @
4d2a58f8
...
...
@@ -2737,6 +2737,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT);
(SELECT a, b AS c FROM t1) ORDER BY c+1;
a c
(SELECT a, b AS c FROM t1) ORDER BY b+1;
a c
SELECT a, b AS c FROM t1 ORDER BY c+1;
a c
SELECT a, b AS c FROM t1 ORDER BY b+1;
a c
drop table t1;
create table t1 (a int, b int);
create table t2 like t1;
select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
...
...
mysql-test/t/select.test
View file @
4d2a58f8
...
...
@@ -2069,6 +2069,7 @@ AND FK_firma_id = 2;
drop
table
t1
;
#
#
# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
#
...
...
@@ -2181,6 +2182,16 @@ select found_rows();
DROP
TABLE
t1
;
#
# Bug 7672 Unknown column error in order clause
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
(
SELECT
a
,
b
AS
c
FROM
t1
)
ORDER
BY
c
+
1
;
(
SELECT
a
,
b
AS
c
FROM
t1
)
ORDER
BY
b
+
1
;
SELECT
a
,
b
AS
c
FROM
t1
ORDER
BY
c
+
1
;
SELECT
a
,
b
AS
c
FROM
t1
ORDER
BY
b
+
1
;
drop
table
t1
;
#
# Bug #13356 assertion failed in resolve_const_item()
#
...
...
sql/item.cc
View file @
4d2a58f8
...
...
@@ -3213,6 +3213,22 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
TRUE
))
==
not_found_field
)
{
/* Look up in current select's item_list to find aliased fields */
if
(
thd
->
lex
->
current_select
->
is_item_list_lookup
)
{
uint
counter
;
bool
not_used
;
Item
**
res
=
find_item_in_list
(
this
,
thd
->
lex
->
current_select
->
item_list
,
&
counter
,
REPORT_EXCEPT_NOT_FOUND
,
&
not_used
);
if
(
res
!=
not_found_item
&&
(
*
res
)
->
type
()
==
Item
::
FIELD_ITEM
)
{
set_field
((
*
((
Item_field
**
)
res
))
->
field
);
return
0
;
}
}
/*
If there are outer contexts (outer selects, but current select is
not derived table or view) try to resolve this reference in the
...
...
sql/sql_lex.cc
View file @
4d2a58f8
...
...
@@ -1133,6 +1133,7 @@ void st_select_lex::init_query()
ref_pointer_array
=
0
;
select_n_having_items
=
0
;
subquery_in_having
=
explicit_limit
=
0
;
is_item_list_lookup
=
0
;
first_execution
=
1
;
first_cond_optimization
=
1
;
parsing_place
=
NO_MATTER
;
...
...
@@ -1165,6 +1166,7 @@ void st_select_lex::init_select()
select_limit
=
0
;
/* denotes the default limit = HA_POS_ERROR */
offset_limit
=
0
;
/* denotes the default offset = 0 */
with_sum_func
=
0
;
}
/*
...
...
sql/sql_lex.h
View file @
4d2a58f8
...
...
@@ -482,6 +482,7 @@ class st_select_lex: public st_select_lex_node
List
<
Item
>
item_list
;
/* list of fields & expressions */
List
<
String
>
interval_list
,
use_index
,
*
use_index_ptr
,
ignore_index
,
*
ignore_index_ptr
;
bool
is_item_list_lookup
;
/*
Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake
select_lex for calling mysql_select under results of union
...
...
sql/sql_select.cc
View file @
4d2a58f8
...
...
@@ -11950,11 +11950,16 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
We check order_item->fixed because Item_func_group_concat can put
arguments for which fix_fields already was called.
*/
thd
->
lex
->
current_select
->
is_item_list_lookup
=
1
;
if
(
!
order_item
->
fixed
&&
(
order_item
->
fix_fields
(
thd
,
order
->
item
)
||
(
order_item
=
*
order
->
item
)
->
check_cols
(
1
)
||
thd
->
is_fatal_error
))
{
thd
->
lex
->
current_select
->
is_item_list_lookup
=
0
;
return
TRUE
;
/* Wrong field. */
}
thd
->
lex
->
current_select
->
is_item_list_lookup
=
0
;
uint
el
=
all_fields
.
elements
;
all_fields
.
push_front
(
order_item
);
/* Add new field to field list. */
...
...
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