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
1b15a2d4
Commit
1b15a2d4
authored
Oct 09, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.0
into moonbone.local:/work/7672-bug-4.0-mysql
parents
d62b9f4b
6bfc2d4b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
1 deletion
+38
-1
mysql-test/r/select.result
mysql-test/r/select.result
+10
-0
mysql-test/t/select.test
mysql-test/t/select.test
+9
-0
sql/item.cc
sql/item.cc
+11
-0
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+6
-0
No files found.
mysql-test/r/select.result
View file @
1b15a2d4
...
...
@@ -2431,3 +2431,13 @@ AND FK_firma_id = 2;
COUNT(*)
0
drop table t1;
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;
mysql-test/t/select.test
View file @
1b15a2d4
...
...
@@ -1983,3 +1983,12 @@ AND FK_firma_id = 2;
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
;
sql/item.cc
View file @
1b15a2d4
...
...
@@ -348,7 +348,18 @@ bool Item_field::fix_fields(THD *thd,TABLE_LIST *tables)
{
Field
*
tmp
;
if
(
!
(
tmp
=
find_field_in_tables
(
thd
,
this
,
tables
)))
{
if
(
thd
->
lex
.
select_lex
.
is_item_list_lookup
)
{
Item
**
res
=
find_item_in_list
(
this
,
thd
->
lex
.
select_lex
.
item_list
);
if
(
res
&&
*
res
&&
(
*
res
)
->
type
()
==
Item
::
FIELD_ITEM
)
{
set_field
((
*
((
Item_field
**
)
res
))
->
field
);
return
0
;
}
}
return
1
;
}
set_field
(
tmp
);
}
else
if
(
thd
&&
thd
->
set_query_id
&&
field
->
query_id
!=
thd
->
query_id
)
...
...
sql/sql_lex.cc
View file @
1b15a2d4
...
...
@@ -154,6 +154,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex
->
slave_thd_opt
=
0
;
lex
->
sql_command
=
SQLCOM_END
;
bzero
((
char
*
)
&
lex
->
mi
,
sizeof
(
lex
->
mi
));
lex
->
select_lex
.
is_item_list_lookup
=
0
;
return
lex
;
}
...
...
sql/sql_lex.h
View file @
1b15a2d4
...
...
@@ -121,7 +121,7 @@ typedef struct st_select_lex
ignore_index
,
*
ignore_index_ptr
;
List
<
Item_func_match
>
ftfunc_list
;
uint
in_sum_expr
,
sort_default
;
bool
create_refs
,
braces
;
bool
create_refs
,
braces
,
is_item_list_lookup
;
st_select_lex
*
next
;
}
SELECT_LEX
;
...
...
sql/sql_select.cc
View file @
1b15a2d4
...
...
@@ -6845,8 +6845,14 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
return
0
;
}
order
->
in_field_list
=
0
;
/* Allow lookup in select's item_list to find aliased fields */
thd
->
lex
.
select_lex
.
is_item_list_lookup
=
1
;
if
((
*
order
->
item
)
->
fix_fields
(
thd
,
tables
)
||
thd
->
fatal_error
)
{
thd
->
lex
.
select_lex
.
is_item_list_lookup
=
0
;
return
1
;
// Wrong field
}
thd
->
lex
.
select_lex
.
is_item_list_lookup
=
0
;
all_fields
.
push_front
(
*
order
->
item
);
// Add new field to field list
order
->
item
=
(
Item
**
)
all_fields
.
head_ref
();
return
0
;
...
...
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