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
111e1cb2
Commit
111e1cb2
authored
Mar 01, 2005
by
jani@ua141d10.elisa.omakaista.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for Bug#5615 and merge from 4.1
parent
62b9fc5d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
12 deletions
+45
-12
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+14
-2
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+1
-3
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+4
-0
sql/item_sum.cc
sql/item_sum.cc
+16
-2
sql/item_sum.h
sql/item_sum.h
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-4
sql/sql_select.h
sql/sql_select.h
+4
-0
No files found.
mysql-test/r/func_group.result
View file @
111e1cb2
...
@@ -669,12 +669,24 @@ select charset(max(a)), coercibility(max(a)),
...
@@ -669,12 +669,24 @@ select charset(max(a)), coercibility(max(a)),
charset(min(a)), coercibility(min(a)) from t1;
charset(min(a)), coercibility(min(a)) from t1;
charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
latin2 2 latin2 2
latin2 2 latin2 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) character set latin2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 select max(a),min(a) from t1;
create table t2 select max(a),min(a) from t1;
show create table t2;
show create table t2;
Table Create Table
Table Create Table
t2 CREATE TABLE `t2` (
t2 CREATE TABLE `t2` (
`max(a)` varchar(1) character set latin2 default NULL,
`max(a)` char(1) character set latin2 default NULL,
`min(a)` varchar(1) character set latin2 default NULL
`min(a)` char(1) character set latin2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
create table t2 select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`concat(a)` varchar(1) character set latin2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2,t1;
drop table t2,t1;
create table t1 (a int);
create table t1 (a int);
...
...
mysql-test/r/show_check.result
View file @
111e1cb2
...
@@ -252,11 +252,9 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
...
@@ -252,11 +252,9 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
drop table t1;
drop table t1;
create table t1 (a int not null);
create table t1 (a int not null);
create table t2 select max(a) from t1;
create table t2 select max(a) from t1;
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'max(a)' at row 1
show columns from t2;
show columns from t2;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
max(a) int(11)
0
max(a) int(11)
YES NULL
drop table t1,t2;
drop table t1,t2;
create table t1 (c decimal, d double, f float, r real);
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
show columns from t1;
...
...
mysql-test/t/func_group.test
View file @
111e1cb2
...
@@ -395,8 +395,12 @@ create table t1 (a char character set latin2);
...
@@ -395,8 +395,12 @@ create table t1 (a char character set latin2);
insert
into
t1
values
(
'a'
),(
'b'
);
insert
into
t1
values
(
'a'
),(
'b'
);
select
charset
(
max
(
a
)),
coercibility
(
max
(
a
)),
select
charset
(
max
(
a
)),
coercibility
(
max
(
a
)),
charset
(
min
(
a
)),
coercibility
(
min
(
a
))
from
t1
;
charset
(
min
(
a
)),
coercibility
(
min
(
a
))
from
t1
;
show
create
table
t1
;
create
table
t2
select
max
(
a
),
min
(
a
)
from
t1
;
create
table
t2
select
max
(
a
),
min
(
a
)
from
t1
;
show
create
table
t2
;
show
create
table
t2
;
drop
table
t2
;
create
table
t2
select
concat
(
a
)
from
t1
;
show
create
table
t2
;
drop
table
t2
,
t1
;
drop
table
t2
,
t1
;
#
#
...
...
sql/item_sum.cc
View file @
111e1cb2
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#endif
#endif
#include "mysql_priv.h"
#include "mysql_priv.h"
#include "sql_select.h"
Item_sum
::
Item_sum
(
List
<
Item
>
&
list
)
Item_sum
::
Item_sum
(
List
<
Item
>
&
list
)
:
arg_count
(
list
.
elements
)
:
arg_count
(
list
.
elements
)
...
@@ -303,6 +304,21 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -303,6 +304,21 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return
FALSE
;
return
FALSE
;
}
}
Field
*
Item_sum_hybrid
::
create_tmp_field
(
bool
group
,
TABLE
*
table
,
uint
convert_blob_length
)
{
if
(
args
[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
{
Field
*
field
=
((
Item_field
*
)
args
[
0
])
->
field
;
if
((
field
=
create_tmp_field_from_field
(
current_thd
,
field
,
this
,
table
,
0
,
convert_blob_length
)))
field
->
flags
&=
~
NOT_NULL_FLAG
;
return
field
;
}
return
Item_sum
::
create_tmp_field
(
group
,
table
,
convert_blob_length
);
}
/***********************************************************************
/***********************************************************************
** reset and add of sum_func
** reset and add of sum_func
...
@@ -2075,8 +2091,6 @@ my_decimal *Item_variance_field::val_decimal(my_decimal *dec_buf)
...
@@ -2075,8 +2091,6 @@ my_decimal *Item_variance_field::val_decimal(my_decimal *dec_buf)
** COUNT(DISTINCT ...)
** COUNT(DISTINCT ...)
****************************************************************************/
****************************************************************************/
#include "sql_select.h"
int
simple_str_key_cmp
(
void
*
arg
,
byte
*
key1
,
byte
*
key2
)
int
simple_str_key_cmp
(
void
*
arg
,
byte
*
key1
,
byte
*
key2
)
{
{
Item_sum_count_distinct
*
item
=
(
Item_sum_count_distinct
*
)
arg
;
Item_sum_count_distinct
*
item
=
(
Item_sum_count_distinct
*
)
arg
;
...
...
sql/item_sum.h
View file @
111e1cb2
...
@@ -94,7 +94,6 @@ public:
...
@@ -94,7 +94,6 @@ public:
Item
*
get_tmp_table_item
(
THD
*
thd
);
Item
*
get_tmp_table_item
(
THD
*
thd
);
virtual
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
,
virtual
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
,
uint
convert_blob_length
);
uint
convert_blob_length
);
bool
walk
(
Item_processor
processor
,
byte
*
argument
);
bool
walk
(
Item_processor
processor
,
byte
*
argument
);
};
};
...
@@ -525,6 +524,8 @@ protected:
...
@@ -525,6 +524,8 @@ protected:
void
cleanup
();
void
cleanup
();
bool
any_value
()
{
return
was_values
;
}
bool
any_value
()
{
return
was_values
;
}
void
no_rows_in_result
();
void
no_rows_in_result
();
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
,
uint
convert_blob_length
);
};
};
...
...
sql/sql_select.cc
View file @
111e1cb2
...
@@ -7593,7 +7593,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
...
@@ -7593,7 +7593,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
new_created field
new_created field
*/
*/
static
Field
*
create_tmp_field_from_field
(
THD
*
thd
,
Field
*
org_field
,
Field
*
create_tmp_field_from_field
(
THD
*
thd
,
Field
*
org_field
,
Item
*
item
,
TABLE
*
table
,
Item
*
item
,
TABLE
*
table
,
bool
modify_item
,
bool
modify_item
,
uint
convert_blob_length
)
uint
convert_blob_length
)
...
...
sql/sql_select.h
View file @
111e1cb2
...
@@ -399,6 +399,10 @@ void copy_funcs(Item **func_ptr);
...
@@ -399,6 +399,10 @@ void copy_funcs(Item **func_ptr);
bool
create_myisam_from_heap
(
THD
*
thd
,
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
bool
create_myisam_from_heap
(
THD
*
thd
,
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
int
error
,
bool
ignore_last_dupp_error
);
int
error
,
bool
ignore_last_dupp_error
);
uint
find_shortest_key
(
TABLE
*
table
,
const
key_map
*
usable_keys
);
uint
find_shortest_key
(
TABLE
*
table
,
const
key_map
*
usable_keys
);
Field
*
create_tmp_field_from_field
(
THD
*
thd
,
Field
*
org_field
,
Item
*
item
,
TABLE
*
table
,
bool
modify_item
,
uint
convert_blob_length
);
/* functions from opt_sum.cc */
/* functions from opt_sum.cc */
bool
simple_pred
(
Item_func
*
func_item
,
Item
**
args
,
bool
*
inv_order
);
bool
simple_pred
(
Item_func
*
func_item
,
Item
**
args
,
bool
*
inv_order
);
...
...
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