summaryrefslogtreecommitdiff
path: root/sql/init.cc
diff options
context:
space:
mode:
authorramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-01-31 09:51:05 +0400
committerramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-01-31 09:51:05 +0400
commiteb415e4920339b834277c507d746eaf0a3296ac7 (patch)
treea5f943c8d9507c74c1eef53b811a4f4a696bf8d7 /sql/init.cc
parentba6e6d07543b458239bb06b0be81e1d62cb0ef68 (diff)
downloadmariadb-git-eb415e4920339b834277c507d746eaf0a3296ac7.tar.gz
fix for bug #19690: ORDER BY eliminates rows from the result
Depending on the queries we use different data processing methods and can lose some data in case of double (and decimal in 4.1) fields. The fix consists of two parts: 1. double comparison changed, now double a is equal to double b if (a-b) is less than 5*0.1^(1 + max(a->decimals, b->decimals)). For example, if a->decimals==1, b->decimals==2, a==b if (a-b)<0.005 2. if we use a temporary table, store double values there as is to avoid any data conversion (rounding).
Diffstat (limited to 'sql/init.cc')
-rw-r--r--sql/init.cc6
1 files changed, 6 insertions, 0 deletions
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;
}