Improper precision, scale reported by MockSyncStream::get_result_set_struct for queries with decimal/double/float columns
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Medium
|
Daniel Nichter |
Bug Description
So pt-upgrade has this function MockSyncStream:
SELECT SUM(total) FROM payment_success_log WHERE customers_id = 88430028 AND date >= '2000-01-01 00:00:00'
detects the structure to be:
TABLE `percona`
If I try to emulate what the script is doing, by doing it in MySQL as follows:
CREATE TABLE percona.tmp AS SELECT SUM(total) FROM payment_success_log WHERE customers_id = 88430028 AND date >= '2000-01-01 00:00:00';
then it creates a table with the following definition:
Create Table: CREATE TABLE `tmp` ( `SUM(total)` double DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1
See no precision or scale is specified.
Is it necessary to detect the structure from the query, why not let MySQL do that by issuing CREATE TABLE AS SELECT ...
I tested on DBD::mysql 4.018 and the result is valid: double(31,23). Which version of DBD::mysql are you using? Run perl -MDBD::mysql -e 'print $DBD::mysql: :VERSION, "\n";'