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
34a643b6
Commit
34a643b6
authored
Mar 07, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug26560
parents
08efa4e0
946745e1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
7 deletions
+61
-7
mysql-test/r/func_in.result
mysql-test/r/func_in.result
+7
-1
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+8
-0
mysql-test/r/update.result
mysql-test/r/update.result
+4
-0
mysql-test/t/func_in.test
mysql-test/t/func_in.test
+5
-1
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+8
-0
mysql-test/t/update.test
mysql-test/t/update.test
+8
-0
sql/sql_base.cc
sql/sql_base.cc
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+12
-5
No files found.
mysql-test/r/func_in.result
View file @
34a643b6
...
...
@@ -463,5 +463,11 @@ CREATE TABLE t3 (a BIGINT UNSIGNED);
INSERT INTO t3 VALUES (9223372036854775551);
SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
HEX(a)
DROP TABLE t1,t2,t3;
CREATE TABLE t4 (a DATE);
INSERT INTO t4 VALUES ('1972-02-06'), ('1972-07-29');
SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29');
a
Warnings:
Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1
DROP TABLE t1,t2,t3,t4;
End of 5.0 tests
mysql-test/r/order_by.result
View file @
34a643b6
...
...
@@ -926,3 +926,11 @@ NULL
2
3
DROP TABLE t1,t2,t3,t4;
create table t1 (a int, b int, c int);
insert into t1 values (1,2,3), (9,8,3), (19,4,3), (1,4,9);
select a,(sum(b)/sum(c)) as ratio from t1 group by a order by sum(b)/sum(c) asc;
a ratio
1 0.5000
19 1.3333
9 2.6667
drop table t1;
mysql-test/r/update.result
View file @
34a643b6
...
...
@@ -377,6 +377,10 @@ create table t1(f1 int, `*f2` int);
insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;
create table t1(f1 int);
update t1 set f2=1 order by f2;
ERROR 42S22: Unknown column 'f2' in 'order clause'
drop table t1;
CREATE TABLE t1 (
request_id int unsigned NOT NULL auto_increment,
user_id varchar(12) default NULL,
...
...
mysql-test/t/func_in.test
View file @
34a643b6
...
...
@@ -354,6 +354,10 @@ INSERT INTO t3 VALUES (9223372036854775551);
SELECT
HEX
(
a
)
FROM
t3
WHERE
a
IN
(
9223372036854775807
,
42
);
DROP
TABLE
t1
,
t2
,
t3
;
CREATE
TABLE
t4
(
a
DATE
);
INSERT
INTO
t4
VALUES
(
'1972-02-06'
),
(
'1972-07-29'
);
SELECT
*
FROM
t4
WHERE
a
IN
(
'1972-02-06'
,
'19772-07-29'
);
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
--
echo
End
of
5.0
tests
mysql-test/t/order_by.test
View file @
34a643b6
...
...
@@ -640,3 +640,11 @@ SELECT t2.b FROM t1 LEFT JOIN (t2, t3 LEFT JOIN t4 ON t3.a=t4.a)
ON
(
t1
.
a
=
t2
.
a
AND
t1
.
b
=
t3
.
b
)
order
by
t2
.
b
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
# Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
#
create
table
t1
(
a
int
,
b
int
,
c
int
);
insert
into
t1
values
(
1
,
2
,
3
),
(
9
,
8
,
3
),
(
19
,
4
,
3
),
(
1
,
4
,
9
);
select
a
,(
sum
(
b
)
/
sum
(
c
))
as
ratio
from
t1
group
by
a
order
by
sum
(
b
)
/
sum
(
c
)
asc
;
drop
table
t1
;
mysql-test/t/update.test
View file @
34a643b6
...
...
@@ -306,6 +306,14 @@ create table t1(f1 int, `*f2` int);
insert
into
t1
values
(
1
,
1
);
update
t1
set
`*f2`
=
1
;
drop
table
t1
;
#
# Bug#25126: Wrongly resolved field leads to a crash
#
create
table
t1
(
f1
int
);
--
error
1054
update
t1
set
f2
=
1
order
by
f2
;
drop
table
t1
;
# End of 4.1 tests
#
...
...
sql/sql_base.cc
View file @
34a643b6
...
...
@@ -4437,12 +4437,15 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
bool
save_set_query_id
=
thd
->
set_query_id
;
nesting_map
save_allow_sum_func
=
thd
->
lex
->
allow_sum_func
;
List_iterator
<
Item
>
it
(
fields
);
bool
save_is_item_list_lookup
;
DBUG_ENTER
(
"setup_fields"
);
thd
->
set_query_id
=
set_query_id
;
if
(
allow_sum_func
)
thd
->
lex
->
allow_sum_func
|=
1
<<
thd
->
lex
->
current_select
->
nest_level
;
thd
->
where
=
THD
::
DEFAULT_WHERE
;
save_is_item_list_lookup
=
thd
->
lex
->
current_select
->
is_item_list_lookup
;
thd
->
lex
->
current_select
->
is_item_list_lookup
=
0
;
/*
To prevent fail on forward lookup we fill it with zerows,
...
...
@@ -4465,6 +4468,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if
(
!
item
->
fixed
&&
item
->
fix_fields
(
thd
,
it
.
ref
())
||
(
item
=
*
(
it
.
ref
()))
->
check_cols
(
1
))
{
thd
->
lex
->
current_select
->
is_item_list_lookup
=
save_is_item_list_lookup
;
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
...
...
@@ -4477,6 +4481,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd
->
used_tables
|=
item
->
used_tables
();
thd
->
lex
->
current_select
->
cur_pos_in_select_list
++
;
}
thd
->
lex
->
current_select
->
is_item_list_lookup
=
save_is_item_list_lookup
;
thd
->
lex
->
current_select
->
cur_pos_in_select_list
=
UNDEF_POS
;
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
...
...
@@ -4973,6 +4978,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
*/
bool
it_is_update
=
(
select_lex
==
&
thd
->
lex
->
select_lex
)
&&
thd
->
lex
->
which_check_option_applicable
();
bool
save_is_item_list_lookup
=
select_lex
->
is_item_list_lookup
;
select_lex
->
is_item_list_lookup
=
0
;
DBUG_ENTER
(
"setup_conds"
);
if
(
select_lex
->
conds_processed_with_permanent_arena
||
...
...
@@ -5047,9 +5054,11 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
select_lex
->
where
=
*
conds
;
select_lex
->
conds_processed_with_permanent_arena
=
1
;
}
thd
->
lex
->
current_select
->
is_item_list_lookup
=
save_is_item_list_lookup
;
DBUG_RETURN
(
test
(
thd
->
net
.
report_error
));
err_no_arena:
select_lex
->
is_item_list_lookup
=
save_is_item_list_lookup
;
DBUG_RETURN
(
1
);
}
...
...
sql/sql_select.cc
View file @
34a643b6
...
...
@@ -396,6 +396,7 @@ JOIN::prepare(Item ***rref_pointer_array,
join_list
=
&
select_lex
->
top_join_list
;
union_part
=
(
unit_arg
->
first_select
()
->
next_select
()
!=
0
);
thd
->
lex
->
current_select
->
is_item_list_lookup
=
1
;
/*
If we have already executed SELECT, then it have not sense to prevent
its table from update (see unique_table())
...
...
@@ -455,6 +456,17 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex
->
fix_prepare_information
(
thd
,
&
conds
,
&
having
);
if
(
order
)
{
ORDER
*
ord
;
for
(
ord
=
order
;
ord
;
ord
=
ord
->
next
)
{
Item
*
item
=
*
ord
->
item
;
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
all_fields
);
}
}
if
(
having
&&
having
->
with_sum_func
)
having
->
split_sum_func2
(
thd
,
ref_pointer_array
,
all_fields
,
&
having
,
TRUE
);
...
...
@@ -13265,16 +13277,11 @@ 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