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
551961b2
Commit
551961b2
authored
Oct 13, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
select.test, sql_select.cc, sql_lex.cc, item.cc:
Bug #7672 after merge fix
parent
c16410d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
mysql-test/t/select.test
mysql-test/t/select.test
+2
-1
sql/item.cc
sql/item.cc
+8
-3
sql/sql_lex.cc
sql/sql_lex.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+5
-0
No files found.
mysql-test/t/select.test
View file @
551961b2
...
@@ -2165,7 +2165,7 @@ select found_rows();
...
@@ -2165,7 +2165,7 @@ select found_rows();
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
End of 4.1 tests
#
# Bug 7672 Unknown column error in order clause
# Bug 7672 Unknown column error in order clause
#
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
...
@@ -2174,3 +2174,4 @@ CREATE TABLE t1 (a INT, b INT);
...
@@ -2174,3 +2174,4 @@ 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
c
+
1
;
SELECT
a
,
b
AS
c
FROM
t1
ORDER
BY
b
+
1
;
SELECT
a
,
b
AS
c
FROM
t1
ORDER
BY
b
+
1
;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
sql/item.cc
View file @
551961b2
...
@@ -1760,10 +1760,15 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -1760,10 +1760,15 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
tables
,
&
where
,
0
))
==
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
tables
,
&
where
,
0
))
==
not_found_field
)
not_found_field
)
{
{
if
(
thd
->
lex
.
select_lex
.
is_item_list_lookup
)
/* Look up in current select's item_list to find aliased fields */
if
(
thd
->
lex
->
current_select
->
is_item_list_lookup
)
{
{
Item
**
res
=
find_item_in_list
(
this
,
thd
->
lex
.
select_lex
.
item_list
);
uint
counter
;
if
(
res
&&
*
res
&&
(
*
res
)
->
type
()
==
Item
::
FIELD_ITEM
)
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
);
set_field
((
*
((
Item_field
**
)
res
))
->
field
);
return
0
;
return
0
;
...
...
sql/sql_lex.cc
View file @
551961b2
...
@@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length)
...
@@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
duplicates
=
DUP_ERROR
;
lex
->
duplicates
=
DUP_ERROR
;
lex
->
ignore
=
0
;
lex
->
ignore
=
0
;
lex
->
proc_list
.
first
=
0
;
lex
->
proc_list
.
first
=
0
;
lex
->
select_lex
.
is_item_list_lookup
=
0
;
}
}
void
lex_end
(
LEX
*
lex
)
void
lex_end
(
LEX
*
lex
)
...
@@ -1084,6 +1083,7 @@ void st_select_lex::init_query()
...
@@ -1084,6 +1083,7 @@ void st_select_lex::init_query()
prep_where
=
0
;
prep_where
=
0
;
subquery_in_having
=
explicit_limit
=
0
;
subquery_in_having
=
explicit_limit
=
0
;
parsing_place
=
NO_MATTER
;
parsing_place
=
NO_MATTER
;
is_item_list_lookup
=
0
;
}
}
void
st_select_lex
::
init_select
()
void
st_select_lex
::
init_select
()
...
@@ -1110,6 +1110,7 @@ void st_select_lex::init_select()
...
@@ -1110,6 +1110,7 @@ void st_select_lex::init_select()
select_limit
=
HA_POS_ERROR
;
select_limit
=
HA_POS_ERROR
;
offset_limit
=
0
;
offset_limit
=
0
;
with_sum_func
=
0
;
with_sum_func
=
0
;
}
}
/*
/*
...
...
sql/sql_select.cc
View file @
551961b2
...
@@ -8348,11 +8348,16 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
...
@@ -8348,11 +8348,16 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
'it' reassigned in if condition because fix_field can change it.
'it' reassigned in if condition because fix_field can change it.
*/
*/
thd
->
lex
->
current_select
->
is_item_list_lookup
=
1
;
if
(
!
it
->
fixed
&&
if
(
!
it
->
fixed
&&
(
it
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
(
it
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
(
it
=
*
order
->
item
)
->
check_cols
(
1
)
||
(
it
=
*
order
->
item
)
->
check_cols
(
1
)
||
thd
->
is_fatal_error
))
thd
->
is_fatal_error
))
{
thd
->
lex
->
current_select
->
is_item_list_lookup
=
0
;
return
1
;
// Wrong field
return
1
;
// Wrong field
}
thd
->
lex
->
current_select
->
is_item_list_lookup
=
0
;
uint
el
=
all_fields
.
elements
;
uint
el
=
all_fields
.
elements
;
all_fields
.
push_front
(
it
);
// Add new field to field list
all_fields
.
push_front
(
it
);
// Add new field to field list
ref_pointer_array
[
el
]
=
it
;
ref_pointer_array
[
el
]
=
it
;
...
...
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