Commit 9da8a8f9 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (0000)#

MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
parent a8b8544a
...@@ -994,3 +994,24 @@ GROUP BY t2.col0 ...@@ -994,3 +994,24 @@ GROUP BY t2.col0
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
1 1
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Start of 5.5 tests
#
#
# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
#
SHOW CREATE TABLE t1dec102;
Table Create Table
t1dec102 CREATE TABLE `t1dec102` (
`a` decimal(10,2)/*old*/ DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1dec102;
Field Type Null Key Default Extra
a decimal(10,2)/*old*/ YES NULL
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
COLUMN_NAME DATA_TYPE COLUMN_TYPE
a decimal decimal(10,2)/*old*/
DROP TABLE t1dec102;
#
# End of 5.5 tests
#
123.45 123.46 123.47
\ No newline at end of file
...@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1; ...@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
INSERT INTO t2 SET b=1; INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20; UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2; DROP TABLE t1,t2;
INSERT INTO t1dec102 VALUES (-999.99);
INSERT INTO t1dec102 VALUES (0);
INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
a
-999.99
0.00
123.45
123.46
123.47
999.99
DROP TABLE t1dec102;
flush logs; flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
...@@ -4131,6 +4143,59 @@ SET TIMESTAMP=1000000000/*!*/; ...@@ -4131,6 +4143,59 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1`,`t2` /* generated by server */ DROP TABLE `t1`,`t2` /* generated by server */
/*!*/; /*!*/;
# at # # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1dec102` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4 #010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ; DELIMITER ;
# End of log file # End of log file
......
...@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1; ...@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20; UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2; DROP TABLE t1,t2;
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
INSERT INTO t1dec102 VALUES (-999.99);
INSERT INTO t1dec102 VALUES (0);
INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
DROP TABLE t1dec102;
flush logs; flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
...@@ -583,3 +583,27 @@ JOIN ...@@ -583,3 +583,27 @@ JOIN
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
SHOW CREATE TABLE t1dec102;
SHOW COLUMNS FROM t1dec102;
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
DROP TABLE t1dec102;
--echo #
--echo # End of 5.5 tests
--echo #
...@@ -2483,7 +2483,7 @@ void Field_decimal::sql_type(String &res) const ...@@ -2483,7 +2483,7 @@ void Field_decimal::sql_type(String &res) const
if (dec) if (dec)
tmp--; tmp--;
res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(), res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
"decimal(%d,%d)",tmp,dec)); "decimal(%d,%d)/*old*/",tmp,dec));
add_zerofill_and_unsigned(res); add_zerofill_and_unsigned(res);
} }
......
...@@ -2192,6 +2192,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr, ...@@ -2192,6 +2192,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
my_snprintf(typestr, typestr_length, "STRING(%d)", length); my_snprintf(typestr, typestr_length, "STRING(%d)", length);
return my_b_write_quoted_with_length(file, ptr, length); return my_b_write_quoted_with_length(file, ptr, length);
case MYSQL_TYPE_DECIMAL:
my_b_printf(file,
"!! Old DECIMAL (mysql-4.1 or earlier). "
"Not enough metadata to display the value. ");
break;
default: default:
{ {
char tmp[5]; char tmp[5];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment