fixed Bug #3361 "mysqldump quotes DECIMAL values"

parent 23a5fc55
......@@ -1116,9 +1116,9 @@ static void dumpTable(uint numFields, char *table)
if (field->type == FIELD_TYPE_DECIMAL)
{
/* add " signs around */
dynstr_append(&extended_row, "\"");
dynstr_append(&extended_row, "\'");
dynstr_append(&extended_row, ptr);
dynstr_append(&extended_row, "\"");
dynstr_append(&extended_row, "\'");
}
else
dynstr_append(&extended_row, ptr);
......@@ -1162,9 +1162,9 @@ static void dumpTable(uint numFields, char *table)
if (field->type == FIELD_TYPE_DECIMAL)
{
/* add " signs around */
fputs("\"", md_result_file);
fputs("\'", md_result_file);
fputs(ptr, md_result_file);
fputs("\"", md_result_file);
fputs("\'", md_result_file);
}
else
fputs(ptr, md_result_file);
......
......@@ -22,8 +22,8 @@ CREATE TABLE t1 (
a decimal(240,20) default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000");
INSERT INTO t1 VALUES ("0987654321098765432109876543210987654321.00000000000000000000");
INSERT INTO t1 VALUES ('1234567890123456789012345678901234567890.00000000000000000000');
INSERT INTO t1 VALUES ('0987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
CREATE TABLE t1 (a double);
......@@ -35,3 +35,17 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (RES);
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
CREATE TABLE t1 (
a decimal(10,5) default NULL,
b float default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('1.23450',2.3456);
INSERT INTO t1 VALUES ('1.23450',2.3456);
INSERT INTO t1 VALUES ('1.23450',2.3456);
DROP TABLE t1;
......@@ -30,3 +30,31 @@ INSERT INTO t1 VALUES (-9e999999);
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
#
# Bug #3361 mysqldum quotes DECIMAL values
#
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
# check at first how mysql work with quoted decimal
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
# The code below should be uncommented in mysql-4.1 to fix
# behaviour of quoting DECIMAL fields with different
# values of sql_mode
########
#SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
#INSERT INTO t1 VALUES (1.2345, 2.3456);
#INSERT INTO t1 VALUES ('1.2345', 2.3456);
#--error 1054
#INSERT INTO t1 VALUES ("1.2345", 2.3456);
#SET SQL_MODE=@OLD_SQL_MODE;
########
# check how mysqldump make quoting
--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
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