summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <tsmith@siva.hindu.god>2007-02-08 16:01:13 -0700
committerunknown <tsmith@siva.hindu.god>2007-02-08 16:01:13 -0700
commit43ada21fe1961da0b0c6a0fcfe2040b13acd1320 (patch)
treebf975ad89f04386e0a36ff1163782902a85ed0cf /sql
parent75d614e053301595a350c7ee610fd3e121ad4399 (diff)
parent0554802f3cd52fc0241ca245d6e7d3cfc173a371 (diff)
downloadmariadb-git-43ada21fe1961da0b0c6a0fcfe2040b13acd1320.tar.gz
Merge siva.hindu.god:/home/tsmith/m/bk/41
into siva.hindu.god:/home/tsmith/m/bk/maint/41 sql/sql_prepare.cc: Manual merge
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc2
-rw-r--r--sql/field.h16
-rw-r--r--sql/init.cc6
-rw-r--r--sql/item.cc25
-rw-r--r--sql/item_cmpfunc.cc49
-rw-r--r--sql/item_cmpfunc.h3
-rw-r--r--sql/item_timefunc.cc3
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/mysqld.cc11
-rw-r--r--sql/net_serv.cc27
-rw-r--r--sql/repl_failsafe.cc9
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sql_parse.cc37
-rw-r--r--sql/sql_prepare.cc8
-rw-r--r--sql/sql_repl.cc6
-rw-r--r--sql/sql_select.cc14
17 files changed, 180 insertions, 51 deletions
diff --git a/sql/field.cc b/sql/field.cc
index e88b8b313e2..acc837c1d37 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3318,7 +3318,7 @@ int Field_double::store(double nr)
else
{
double max_value;
- if (dec >= NOT_FIXED_DEC)
+ if (not_fixed)
{
max_value= DBL_MAX;
}
diff --git a/sql/field.h b/sql/field.h
index e4991ba1961..d3e38db83d1 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -616,6 +616,7 @@ public:
class Field_double :public Field_num {
public:
+ my_bool not_fixed;
Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
@@ -623,12 +624,20 @@ public:
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg,
- dec_arg, zero_arg,unsigned_arg)
+ dec_arg, zero_arg, unsigned_arg),
+ not_fixed(dec_arg >= NOT_FIXED_DEC)
{}
Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
struct st_table *table_arg, uint8 dec_arg)
- :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
- NONE, field_name_arg, table_arg,dec_arg,0,0)
+ :Field_num((char *) 0, len_arg, maybe_null_arg ? (uchar *) "" : 0, (uint) 0,
+ NONE, field_name_arg, table_arg,dec_arg, 0, 0),
+ not_fixed(dec_arg >= NOT_FIXED_DEC)
+ {}
+ Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_arg, uint8 dec_arg, my_bool not_fixed_srg)
+ :Field_num((char *) 0, len_arg, maybe_null_arg ? (uchar *) "" : 0, (uint) 0,
+ NONE, field_name_arg, table_arg, dec_arg, 0, 0),
+ not_fixed(not_fixed_srg)
{}
enum_field_types type() const { return FIELD_TYPE_DOUBLE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
@@ -645,6 +654,7 @@ public:
uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const;
uint32 max_length() { return 53; }
+ uint size_of() const { return sizeof(*this); }
};
diff --git a/sql/init.cc b/sql/init.cc
index 4beb8db0c6f..5e1b6532c75 100644
--- a/sql/init.cc
+++ b/sql/init.cc
@@ -45,6 +45,12 @@ void unireg_init(ulong options)
{ /* It's used by filesort... */
log_10[i]= nr ; nr*= 10.0;
}
+ /* Make a tab of powers of 0.1 */
+ for (i= 0, nr= 0.1; i < array_elements(log_01); i++)
+ {
+ log_01[i]= nr;
+ nr*= 0.1;
+ }
specialflag|=options; /* Set options from argv */
DBUG_VOID_RETURN;
}
diff --git a/sql/item.cc b/sql/item.cc
index 1e8c70c6616..87dfdaeef66 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2369,18 +2369,31 @@ longlong Item_varbinary::val_int()
int Item_varbinary::save_in_field(Field *field, bool no_conversions)
{
- int error;
field->set_notnull();
if (field->result_type() == STRING_RESULT)
+ return field->store(str_value.ptr(), str_value.length(),
+ collation.collation);
+
+ ulonglong nr;
+ uint32 length= str_value.length();
+ if (length > 8)
{
- error=field->store(str_value.ptr(),str_value.length(),collation.collation);
+ nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
+ goto warn;
}
- else
+ nr= (ulonglong) val_int();
+ if ((length == 8) && !(field->flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
{
- longlong nr=val_int();
- error=field->store(nr);
+ nr= LONGLONG_MAX;
+ goto warn;
}
- return error;
+ return field->store((longlong) nr);
+
+warn:
+ if (!field->store((longlong) nr))
+ field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
+ 1);
+ return 1;
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 859b4e0ecc1..65f9b279a18 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -352,6 +352,17 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
func= &Arg_comparator::compare_e_int_diff_signedness;
}
}
+ else if (type == REAL_RESULT)
+ {
+ if ((*a)->decimals < NOT_FIXED_DEC && (*b)->decimals < NOT_FIXED_DEC)
+ {
+ precision= 5 * log_01[max((*a)->decimals, (*b)->decimals)];
+ if (func == &Arg_comparator::compare_real)
+ func= &Arg_comparator::compare_real_fixed;
+ else if (func == &Arg_comparator::compare_e_real)
+ func= &Arg_comparator::compare_e_real_fixed;
+ }
+ }
return 0;
}
@@ -459,6 +470,44 @@ int Arg_comparator::compare_e_real()
return test(val1 == val2);
}
+
+int Arg_comparator::compare_real_fixed()
+{
+ /*
+ Fix yet another manifestation of Bug#2338. 'Volatile' will instruct
+ gcc to flush double values out of 80-bit Intel FPU registers before
+ performing the comparison.
+ */
+ volatile double val1, val2;
+ val1= (*a)->val();
+ if (!(*a)->null_value)
+ {
+ val2= (*b)->val();
+ if (!(*b)->null_value)
+ {
+ owner->null_value= 0;
+ if (val1 == val2 || fabs(val1 - val2) < precision)
+ return 0;
+ if (val1 < val2)
+ return -1;
+ return 1;
+ }
+ }
+ owner->null_value= 1;
+ return -1;
+}
+
+
+int Arg_comparator::compare_e_real_fixed()
+{
+ double val1= (*a)->val();
+ double val2= (*b)->val();
+ if ((*a)->null_value || (*b)->null_value)
+ return test((*a)->null_value && (*b)->null_value);
+ return test(val1 == val2 || fabs(val1 - val2) < precision);
+}
+
+
int Arg_comparator::compare_int_signed()
{
longlong val1= (*a)->val_int();
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 0e157fd412c..3dc09f0789a 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -33,6 +33,7 @@ class Arg_comparator: public Sql_alloc
arg_cmp_func func;
Item_bool_func2 *owner;
Arg_comparator *comparators; // used only for compare_row()
+ double precision;
public:
DTCollation cmp_collation;
@@ -77,6 +78,8 @@ public:
int compare_e_int(); // compare args[0] & args[1]
int compare_e_int_diff_signedness();
int compare_e_row(); // compare args[0] & args[1]
+ int compare_real_fixed();
+ int compare_e_real_fixed();
static arg_cmp_func comparator_matrix [4][2];
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 6c002918479..4bd3d68b9c1 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2491,7 +2491,10 @@ longlong Item_date_typecast::val_int()
DBUG_ASSERT(fixed == 1);
TIME ltime;
if (args[0]->get_date(&ltime, TIME_FUZZY_DATE))
+ {
+ null_value= 1;
return 0;
+ }
return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 3a240612cfa..e5ac91e1814 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -59,6 +59,8 @@ void kill_one_thread(THD *thd, ulong id);
bool net_request_file(NET* net, const char* fname);
char* query_table_status(THD *thd,const char *db,const char *table_name);
+void net_set_write_timeout(NET *net, uint timeout);
+void net_set_read_timeout(NET *net, uint timeout);
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
@@ -907,6 +909,7 @@ extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN];
extern double log_10[32];
+extern double log_01[32];
extern ulonglong log_10_int[20];
extern ulonglong keybuff_size;
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 2c84ca94c3c..460bf2e7308 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -355,6 +355,7 @@ ulong my_bind_addr; /* the address we bind to */
volatile ulong cached_thread_count= 0;
double log_10[32]; /* 10 potences */
+double log_01[32];
time_t start_time;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
@@ -3608,10 +3609,9 @@ static bool read_init_file(char *file_name)
#ifndef EMBEDDED_LIBRARY
static void create_new_thread(THD *thd)
{
+ NET *net=&thd->net;
DBUG_ENTER("create_new_thread");
- NET *net=&thd->net; // For easy ref
- net->read_timeout = (uint) connect_timeout;
if (protocol_version > 9)
net->return_errno=1;
@@ -3906,12 +3906,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
}
if (sock == unix_sock)
thd->host=(char*) my_localhost;
-#ifdef __WIN__
- /* Set default wait_timeout */
- ulong wait_timeout= global_system_variables.net_wait_timeout * 1000;
- (void) setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&wait_timeout,
- sizeof(wait_timeout));
-#endif
+
create_new_thread(thd);
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 08184537896..a5a05d381cd 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -491,7 +491,7 @@ net_real_write(NET *net,const char *packet,ulong len)
thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff);
#else
alarmed=0;
- vio_timeout(net->vio, 1, net->write_timeout);
+ /* Write timeout is set in net_set_write_timeout */
#endif /* NO_ALARM */
pos=(char*) packet; end=pos+len;
@@ -684,7 +684,7 @@ my_real_read(NET *net, ulong *complen)
if (net_blocking)
thr_alarm(&alarmed,net->read_timeout,&alarm_buff);
#else
- vio_timeout(net->vio, 0, net->read_timeout);
+ /* Read timeout is set in net_set_read_timeout */
#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
@@ -995,3 +995,26 @@ my_net_read(NET *net)
return len;
}
+
+void net_set_read_timeout(NET *net, uint timeout)
+{
+ DBUG_ENTER("net_set_read_timeout");
+ DBUG_PRINT("enter", ("timeout: %d", timeout));
+ net->read_timeout= timeout;
+#ifdef NO_ALARM
+ vio_timeout(net->vio, 0, timeout);
+#endif
+ DBUG_VOID_RETURN;
+}
+
+
+void net_set_write_timeout(NET *net, uint timeout)
+{
+ DBUG_ENTER("net_set_write_timeout");
+ DBUG_PRINT("enter", ("timeout: %d", timeout));
+ net->write_timeout= timeout;
+#ifdef NO_ALARM
+ vio_timeout(net->vio, 1, timeout);
+#endif
+ DBUG_VOID_RETURN;
+}
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 61fd5d9bce4..4c8703226a6 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -57,6 +57,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
functions like register_slave()) are working.
*/
+#if NOT_USED
static int init_failsafe_rpl_thread(THD* thd)
{
DBUG_ENTER("init_failsafe_rpl_thread");
@@ -99,7 +100,7 @@ static int init_failsafe_rpl_thread(THD* thd)
thd->set_time();
DBUG_RETURN(0);
}
-
+#endif
void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status)
{
@@ -573,12 +574,14 @@ err:
}
+#if NOT_USED
int find_recovery_captain(THD* thd, MYSQL* mysql)
{
return 0;
}
+#endif
-
+#if NOT_USED
pthread_handler_decl(handle_failsafe_rpl,arg)
{
DBUG_ENTER("handle_failsafe_rpl");
@@ -626,7 +629,7 @@ err:
pthread_exit(0);
DBUG_RETURN(0);
}
-
+#endif
int show_slave_hosts(THD* thd)
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 30724c78a62..57bb93ef4b1 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1128,14 +1128,14 @@ static void fix_tx_isolation(THD *thd, enum_var_type type)
static void fix_net_read_timeout(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
- thd->net.read_timeout=thd->variables.net_read_timeout;
+ net_set_read_timeout(&thd->net, thd->variables.net_read_timeout);
}
static void fix_net_write_timeout(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
- thd->net.write_timeout=thd->variables.net_write_timeout;
+ net_set_write_timeout(&thd->net, thd->variables.net_write_timeout);
}
static void fix_net_retry_count(THD *thd, enum_var_type type)
diff --git a/sql/slave.cc b/sql/slave.cc
index 6785e92b9f9..75b18f6f307 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2625,7 +2625,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
- thd->net.read_timeout = slave_net_timeout;
thd->master_access= ~(ulong)0;
thd->priv_user = 0;
thd->slave_thread = 1;
@@ -4284,6 +4283,13 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
hot_log=0; // Using old binary log
}
}
+ /*
+ As there is no guarantee that the relay is open (for example, an I/O
+ error during a write by the slave I/O thread may have closed it), we
+ have to test it.
+ */
+ if (!my_b_inited(cur_log))
+ goto err;
#ifndef DBUG_OFF
{
char llbuf1[22], llbuf2[22];
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c39b438c838..cf9fc5e1e9d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -867,7 +867,7 @@ static int check_connection(THD *thd)
return(ER_HANDSHAKE_ERROR);
}
DBUG_PRINT("info", ("IO layer change in progress..."));
- if (sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout))
+ if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout))
{
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
pkt_len));
@@ -897,7 +897,6 @@ static int check_connection(THD *thd)
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
opt_using_transactions)
net->return_status= &thd->server_status;
- net->read_timeout=(uint) thd->variables.net_read_timeout;
char *user= end;
char *passwd= strend(user)+1;
@@ -1029,6 +1028,10 @@ pthread_handler_decl(handle_one_connection,arg)
NET *net= &thd->net;
thd->thread_stack= (char*) &thd;
+ /* Use "connect_timeout" value during connection phase */
+ net_set_read_timeout(net, connect_timeout);
+ net_set_write_timeout(net, connect_timeout);
+
if ((error=check_connection(thd)))
{ // Wrong permissions
if (error > 0)
@@ -1058,6 +1061,11 @@ pthread_handler_decl(handle_one_connection,arg)
if (thd->query_error)
thd->killed= 1;
}
+
+ /* Connect completed, set read/write timeouts back to tdefault */
+ net_set_read_timeout(net, thd->variables.net_read_timeout);
+ net_set_write_timeout(net, thd->variables.net_write_timeout);
+
while (!net->error && net->vio != 0 && !thd->killed)
{
if (do_command(thd))
@@ -1261,7 +1269,7 @@ err:
#ifndef EMBEDDED_LIBRARY
/*
- Read one command from socket and execute it (query or simple command).
+ Read one command from connection and execute it (query or simple command).
This function is called in loop from thread function.
SYNOPSIS
do_command()
@@ -1272,24 +1280,26 @@ err:
bool do_command(THD *thd)
{
- char *packet;
- uint old_timeout;
+ char *packet= 0;
ulong packet_length;
- NET *net;
+ NET *net= &thd->net;
enum enum_server_command command;
DBUG_ENTER("do_command");
- net= &thd->net;
/*
indicator of uninitialized lex => normal flow of errors handling
(see my_message_sql)
*/
thd->lex->current_select= 0;
- packet=0;
- old_timeout=net->read_timeout;
- // Wait max for 8 hours
- net->read_timeout=(uint) thd->variables.net_wait_timeout;
+ /*
+ This thread will do a blocking read from the client which
+ will be interrupted when the next command is received from
+ the client, the connection is closed or "net_wait_timeout"
+ number of seconds has passed
+ */
+ net_set_read_timeout(net, thd->variables.net_wait_timeout);
+
thd->clear_error(); // Clear error message
net_new_transaction(net);
@@ -1318,7 +1328,10 @@ bool do_command(THD *thd)
vio_description(net->vio), command,
command_name[command]));
}
- net->read_timeout=old_timeout; // restore it
+
+ /* Restore read timeout value */
+ net_set_read_timeout(net, thd->variables.net_read_timeout);
+
/*
packet_length contains length of data, as it was stored in packet
header. In case of malformed header, packet_length can be zero.
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index feab4d08c32..b5aed0bbc4e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1791,7 +1791,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
*/
String expanded_query;
#ifndef EMBEDDED_LIBRARY
- uchar *packet_end= (uchar *) packet + packet_length - 1;
+ uchar *packet_end= packet + packet_length - 1;
#endif
Prepared_statement *stmt;
DBUG_ENTER("mysql_stmt_execute");
@@ -1817,9 +1817,9 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
#ifndef EMBEDDED_LIBRARY
if (stmt->param_count)
{
- uchar *null_array= (uchar *) packet;
- if (setup_conversion_functions(stmt, (uchar **) &packet, packet_end) ||
- stmt->set_params(stmt, null_array, (uchar *) packet, packet_end,
+ uchar *null_array= packet;
+ if (setup_conversion_functions(stmt, &packet, packet_end) ||
+ stmt->set_params(stmt, null_array, packet, packet_end,
&expanded_query))
goto set_params_data_err;
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a20f2a6506c..f83313a8fd8 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -89,8 +89,8 @@ static int send_file(THD *thd)
The client might be slow loading the data, give him wait_timeout to do
the job
*/
- old_timeout = thd->net.read_timeout;
- thd->net.read_timeout = thd->variables.net_wait_timeout;
+ old_timeout= net->read_timeout;
+ net_set_read_timeout(net, thd->variables.net_wait_timeout);
/*
We need net_flush here because the client will not know it needs to send
@@ -134,7 +134,7 @@ static int send_file(THD *thd)
error = 0;
err:
- thd->net.read_timeout = old_timeout;
+ net_set_read_timeout(net, old_timeout);
if (fd >= 0)
(void) my_close(fd, MYF(0));
if (errmsg)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 0254e8f56dc..a6881337d83 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5006,6 +5006,8 @@ static Field* create_tmp_field_from_field(THD *thd, Field* org_field,
new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join
if (org_field->type() == FIELD_TYPE_VAR_STRING)
table->db_create_options|= HA_OPTION_PACK_RECORD;
+ else if (org_field->type() == FIELD_TYPE_DOUBLE)
+ ((Field_double *) new_field)->not_fixed= TRUE;
}
return new_field;
}
@@ -5045,7 +5047,7 @@ static Field* create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
switch (item->result_type()) {
case REAL_RESULT:
new_field=new Field_double(item->max_length, maybe_null,
- item->name, table, item->decimals);
+ item->name, table, item->decimals, TRUE);
break;
case INT_RESULT:
new_field=new Field_longlong(item->max_length, maybe_null,
@@ -5136,8 +5138,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
return new Field_string(sizeof(double)+sizeof(longlong),
0, item->name,table,&my_charset_bin);
else
- return new Field_double(item_sum->max_length,maybe_null,
- item->name, table, item_sum->decimals);
+ return new Field_double(item_sum->max_length, maybe_null,
+ item->name, table, item_sum->decimals, TRUE);
case Item_sum::VARIANCE_FUNC: /* Place for sum & count */
case Item_sum::STD_FUNC:
if (group)
@@ -5145,7 +5147,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
0, item->name,table,&my_charset_bin);
else
return new Field_double(item_sum->max_length, maybe_null,
- item->name,table,item_sum->decimals);
+ item->name, table, item_sum->decimals, TRUE);
case Item_sum::UNIQUE_USERS_FUNC:
return new Field_long(9,maybe_null,item->name,table,1);
case Item_sum::MIN_FUNC:
@@ -5160,8 +5162,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
default:
switch (item_sum->result_type()) {
case REAL_RESULT:
- return new Field_double(item_sum->max_length,maybe_null,
- item->name,table,item_sum->decimals);
+ return new Field_double(item_sum->max_length, maybe_null,
+ item->name, table, item_sum->decimals, TRUE);
case INT_RESULT:
return new Field_longlong(item_sum->max_length,maybe_null,
item->name,table,item->unsigned_flag);