MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
Find a file
unknown aa32336198 Bug #24791: Union with AVG-groups generates wrong results
The problem in this bug is when we create temporary tables. When
temporary tables are created for unions, there is some 
inferrence being carried out regarding the type of the column.
Whenever this column type is inferred to be REAL (i.e. FLOAT or
DOUBLE), MySQL will always try to maintain exact precision, and
if that is not possible (there are hardware limits, since FLOAT
and DOUBLE are stored as approximate values) will switch to
using approximate values. The problem here is that at this point
the information about number of significant digits is not 
available. Furthermore, the number of significant digits should
be increased for the AVG function, however, this was not properly 
handled. There are 4 parts to the problem:

#1: DOUBLE and FLOAT fields don't display their proper display 
lengths in max_display_length(). This is hard-coded as 53 for 
DOUBLE and 24 for FLOAT. Now changed to instead return the 
field_length.

#2: Type holders for temporary tables do not preserve the 
max_length of the Item's from which they are created, and is 
instead reverted to the 53 and 24 from above. This causes 
*all* fields to get non-fixed significant digits.

#3: AVG function does not update max_length (display length)
when updating number of decimals.

#4: The function that switches to non-fixed number of 
significant digits should use DBL_DIG + 2 or FLT_DIG + 2 as 
cut-off values (Since fixed precision does not use the 'e' 
notation)

Of these points, #1 is the controversial one, but this 
change is preferred and has been cleared with Monty. The 
function causes quite a few unit tests to blow up and they had
to b changed, but each one is annotated and motivated. We 
frequently see the magical 53 and 24 give way to more relevant
numbers.


mysql-test/r/create.result:
  bug#24791
  
  changed test result
  
  With the changes made for FLOAT and DOUBLE, the original display
  lengths are now preserved.
mysql-test/r/temp_table.result:
  bug#24791
  
  changed test resullt
  
  Test case added
mysql-test/r/type_float.result:
  bug#24791
  
  changed test result
  
  delta 1: field was originally declared as DOUBLE with no display
  length, so the hardware maximum is chosen rather than 53.
  
  delta 2: fields exceed the maximum precision and thus switch to
  non-fixed significant digits
  
  delta 3: Same as above, number of decmals and significant digits
  was not specified when t3 was created.
mysql-test/t/temp_table.test:
  bug#24791
  
  Test case
sql/field.h:
  bug#24791
  
  The method max_display_length is reimplemented as
  
  uint32 max_display_length() { return field_length; }
  
  in Field_double and Field_float. Since all subclasses of 
  Field_real now have the same implementation of this method, the
  implementation has been moved up the hierarchy to Field_real.
sql/item.cc:
  bug#24791
  
  We switch to a non-fixed number of significant digits
  (by setting decimals=NOT_FIXED_DECIMAL) if the calculated 
  display length is greater than the display length of a value 
  with the maximum precision. These values differ for double and 
  float, obviously.
sql/item_sum.cc:
  bug#24791
  
  We must increase the display length accordinly whenever we 
  change number of decimal places.
2007-03-22 10:56:47 +01:00
bdb my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
BitKeeper Bug#25807: LOAD DATA INFILE does not work with Pipes 2007-02-13 16:35:29 -05:00
BUILD Merge bk@192.168.21.1:mysql-5.0 2007-03-08 21:42:41 +04:00
client Merge 192.168.0.10:mysql/my50-m-bug18431 2007-03-03 12:14:36 +01:00
cmd-line-utils Fixed compiler warnings. 2007-02-28 22:23:35 +02:00
config/ac-macros Fixed the make distcheck problem. We only really need to create libndb.ver if we are building Ndb. 2007-01-19 16:54:01 -08:00
dbug Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2007-01-22 14:04:40 +02:00
Docs Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build 2007-02-28 22:33:29 +01:00
extra comp_err.c: return ha_checksum from checksum_format_specifier() - more correct, avoid a compiler warning 2007-03-08 08:15:30 +01:00
heap Fixed compiler warnings 2007-01-22 15:52:15 +02:00
include Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0 2007-03-01 18:12:56 +01:00
innobase Fixed compiler warnings (for linux and win32 and win64) 2007-02-22 16:59:57 +02:00
libmysql Merge siva.hindu.god:/home/tsmith/m/bk/maint/mar05/50 2007-03-06 15:36:07 -07:00
libmysql_r my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
libmysqld bug #25492 (Invalid deallocation in mysql_stmt_fetch) 2007-02-13 00:55:45 +04:00
man my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
myisam Fixed compiler warnings (for linux and win32 and win64) 2007-02-22 16:59:57 +02:00
myisammrg my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
mysql-test Bug #24791: Union with AVG-groups generates wrong results 2007-03-22 10:56:47 +01:00
mysys Bug#25222 Win32 HANDLE leak in my_sopen() 2007-03-07 10:46:38 -05:00
ndb Merge poseidon.mysql.com:/home/tomas/mysql-5.0-telco-gca 2007-03-07 08:14:54 +07:00
netware Many files: 2006-12-23 20:17:15 +01:00
os2 my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
pstack my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
regex my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
scripts Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build 2007-03-08 01:00:49 +01:00
server-tools Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base 2007-03-01 14:06:57 -07:00
sql Bug #24791: Union with AVG-groups generates wrong results 2007-03-22 10:56:47 +01:00
sql-bench my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
sql-common Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint 2007-03-05 12:04:37 +04:00
SSL my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
strings Fixed compiler warnings (for linux and win32 and win64) 2007-02-22 16:59:57 +02:00
support-files Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0 2007-03-07 23:05:46 +01:00
tests Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2007-01-22 14:04:40 +02:00
tools Fixed compiler warnings (for linux and win32 and win64) 2007-02-22 16:59:57 +02:00
VC++Files mysql.sln: 2007-03-02 00:54:02 +01:00
vio Merge 192.168.0.5:mysql/bug25203/my50-bug25203 2007-02-06 21:55:39 +01:00
win Merge mjorgensen@bk-internal.mysql.com:/home/bk/mysql-5.0-sage 2007-01-11 09:19:32 +01:00
zlib my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
.bzrignore Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint 2007-02-28 16:39:26 +01:00
.cvsignore Import changeset 2000-07-31 21:29:14 +02:00
CMakeLists.txt my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
configure.in Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2007-02-21 14:07:08 +02:00
configure.in.rej Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-4.0 2007-01-22 03:33:59 +02:00
COPYING - manual.texi will be replaced with a manual written in DocBook/XML. This ChangeSet removes all 2005-04-13 11:51:38 +02:00
EXCEPTIONS-CLIENT Makefile.am: 2007-02-28 22:09:09 +01:00
Makefile.am Bug#25844: "make test" does not find mysql-test-run.pl 2007-02-01 15:59:51 +01:00
README make_binary_distribution.sh: 2006-11-07 22:26:37 +01:00

This is a release of MySQL, a dual-license SQL database server.
MySQL is brought to you by the MySQL team at MySQL AB.

License information can be found in these files:
- For GPL (free) distributions, see the COPYING file and
  the EXCEPTIONS-CLIENT file.
- For commercial distributions, see the LICENSE.mysql file.


For further information about MySQL or additional documentation, see:
- The latest information about MySQL: http://www.mysql.com
- The current MySQL documentation: http://dev.mysql.com/doc

Some manual sections of special interest:

- If you are migrating from an older version of MySQL, please read the
  "Upgrading from..." section first!
- To see what MySQL can do, take a look at the features section.
- For installation instructions, see the Installing and Upgrading chapter.
- For the new features/bugfix history, see the Change History appendix.
- For the currently known bugs/misfeatures (known errors) see the Problems
  and Common Errors appendix.
- For a list of developers and other contributors, see the Credits
  appendix.

A local copy of the MySQL Reference Manual can be found in the Docs
directory in GNU Info format.  You can also browse the manual online or
download it in any of several formats at the URL given earlier in this
file.

************************************************************

IMPORTANT:

Bug or error reports should be sent to http://bugs.mysql.com.