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
62002fdc
Commit
62002fdc
authored
Oct 12, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-4.1
into mysql.com:/home/jimw/my/mysql-4.1-clean
parents
ce48949e
d68f16e2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
0 deletions
+44
-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
+15
-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 @
62002fdc
...
@@ -2617,6 +2617,16 @@ select found_rows();
...
@@ -2617,6 +2617,16 @@ select found_rows();
found_rows()
found_rows()
1
1
DROP TABLE t1;
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;
create table t1(f1 int, f2 int);
create table t1(f1 int, f2 int);
create table t2(f3 int);
create table t2(f3 int);
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
...
...
mysql-test/t/select.test
View file @
62002fdc
...
@@ -2052,6 +2052,7 @@ AND FK_firma_id = 2;
...
@@ -2052,6 +2052,7 @@ AND FK_firma_id = 2;
drop
table
t1
;
drop
table
t1
;
#
#
#
# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
#
#
...
@@ -2164,6 +2165,16 @@ select found_rows();
...
@@ -2164,6 +2165,16 @@ select found_rows();
DROP
TABLE
t1
;
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()
# Bug #13356 assertion failed in resolve_const_item()
#
#
...
...
sql/item.cc
View file @
62002fdc
...
@@ -1760,6 +1760,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -1760,6 +1760,21 @@ 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
)
{
{
/* 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
;
}
}
/*
/*
We can't find table field in table list of current select,
We can't find table field in table list of current select,
consequently we have to find it in outer subselect(s).
consequently we have to find it in outer subselect(s).
...
...
sql/sql_lex.cc
View file @
62002fdc
...
@@ -1083,6 +1083,7 @@ void st_select_lex::init_query()
...
@@ -1083,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
()
...
@@ -1109,6 +1110,7 @@ void st_select_lex::init_select()
...
@@ -1109,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_lex.h
View file @
62002fdc
...
@@ -426,6 +426,7 @@ class st_select_lex: public st_select_lex_node
...
@@ -426,6 +426,7 @@ class st_select_lex: public st_select_lex_node
List
<
Item
>
item_list
;
/* list of fields & expressions */
List
<
Item
>
item_list
;
/* list of fields & expressions */
List
<
String
>
interval_list
,
use_index
,
*
use_index_ptr
,
List
<
String
>
interval_list
,
use_index
,
*
use_index_ptr
,
ignore_index
,
*
ignore_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
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
select_lex for calling mysql_select under results of union
...
...
sql/sql_select.cc
View file @
62002fdc
...
@@ -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