[MDEV-8271] Min_value from PROCEDURE ANALYSE() is wrong Created: 2015-06-05 Updated: 2022-09-12 Resolved: 2022-09-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5, 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Takuya Aoki (Inactive) | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | upstream | ||
| Environment: |
CentOS release 6.5 (X86_64) |
||
| Attachments: |
|
| Description |
|
The Min_value returned from PROCEDURE ANALYSE() is false. For column `T_buy_1y` which has values 0 and 1, I created a test case with CSV data to import.
In addition: It seems to happen when the first data is not 0. Altering the table to change the first value of row `T_buy_2m` effects the results of PROCEDURE ANAYSE().
|
| Comments |
| Comment by Elena Stepanova [ 2015-06-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I think it might be intentional, because zeros are counted separately in the Empties_or_zeros column; but I haven't found anything in either MySQL manual or MariaDB KB to confirm that, so I will go for an expert opinion. serg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Takuya Aoki (Inactive) [ 2015-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I don't think it's intentional, because there are cases when the Min_value is correctly calculated as 0. By the way, this error seems to occur when the column contains 0 with other values (can be more than one value). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is intentional. The code looks like
That is it only updates min/max value and min/max length if the value is not zero. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Takuya Aoki (Inactive) [ 2015-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry I am not a programmer so I don't understand. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Could you show an example where Min_value is 0? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Takuya Aoki (Inactive) [ 2015-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I added a test case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I agree, I don't think there is a good excuse for this.
While not taking into account 0 always looks like a very questionable design decision, here we see that zeros are ignored in some cases but not another. takuya, For a note, another curious inconsistency:
That is, for an empty InnoDB table it returns rows, while for MyISAM it's an empty set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Takuya Aoki (Inactive) [ 2015-06-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I didn't know about the second case where the table is empty. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-06-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Okay, I filed one on your behalf (http://bugs.mysql.com/bug.php?id=77299). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Takuya Aoki (Inactive) [ 2015-06-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you, will it be fixed in MySQL beforehand? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-06-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
As the normal routine goes, we will wait for a while to see if it gets fixed in the upstream version. If it does, we will merge or backport the fix. If it does not, we might consider fixing it directly in MariaDB. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-09-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
10.0 was EOLed in March 2019 |