Hi,

I think there is

1) a problem with FLOAT recommendations in PROCEDURE ANALYSE
2) a minor problem with CREATE TABLE(f FLOAT(<negative_value>,...))

Please correct me if I'm wrong.

With MySQL 4.0.17, the query

SELECT * FROM my_table PROCEDURE ANALYSE();

gives me the following result for a DOUBLE NOT NULL column xxx:

-- 8<
             Field_name: xxx
              Min_value: 0.002
              Max_value: 2800
             Min_length: 1
             Max_length: 7
       Empties_or_zeros: 45
                  Nulls: 0
Avg_value_or_avg_length: 63.10753644525
                    Std: 81.175363704985
      Optimal_fieldtype: FLOAT(-25,1) NOT NULL
-- 8<

The suggested field type FLOAT(-25,1) seems not to be a valid column type. Also, 1 decimal would be a bad choice when there is a value 0.002.

mysql> create table test.foo (f float(-25,1) not null);
ERROR 1074: Too big column length for column 'f' (max = 255). Use BLOB instead


This happens for many (or all) DOUBLE columns, so PROCEDURE ANALYSE's advice is probably broken here.

The CREATE TABLE statement gives the misleading error message "Too big" while the value is actually "too small". Probably -25 is read into an 'unsigned int' or similar internally and then interpreted as a very large integer like 2^32-25. At sql/sql_yacc.yy:1099, precision is defined as '(' NUM ',' NUM ')' and according to sql_lex.cc:345, NUM can be a negative value. Maybe in one of these locations an error could be reported if NUM is negative, but that's just a guess.

Hans-Peter



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to