-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu): default value of the field take unaffect in load #1865
Cause: in the function ParsingStrategy::ParseResult ParsingStrategy::GetOneRow field->val_str(str) cannot distinguish 0 and NULL value. Solution: Check whether field's default value is NULL.
- Loading branch information
1 parent
c990b5f
commit d096d0f
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DROP DATABASE IF EXISTS issue1865_test_db; | ||
CREATE DATABASE issue1865_test_db; | ||
create table t1 (a int default 100, b int, c varchar(60))engine=tianmu; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
a b c | ||
NULL NULL 10 | ||
NULL NULL 15 | ||
alter table t1 alter column b drop default; | ||
alter table t1 alter column b set default 10; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
a b c | ||
NULL NULL 10 | ||
NULL NULL 15 | ||
NULL 10 10 | ||
NULL 10 15 | ||
alter table t1 modify c text; | ||
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
a b c | ||
NULL NULL 10 | ||
NULL NULL 15 | ||
NULL 10 10 | ||
NULL 10 15 | ||
NULL 10 10 | ||
NULL 10 15 | ||
DROP DATABASE issue1865_test_db; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
\N 10 | ||
\N 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS issue1865_test_db; | ||
--enable_warnings | ||
|
||
CREATE DATABASE issue1865_test_db; | ||
|
||
create table t1 (a int default 100, b int, c varchar(60))engine=tianmu; | ||
|
||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval load data infile '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
|
||
alter table t1 alter column b drop default; | ||
alter table t1 alter column b set default 10; | ||
|
||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval load data infile '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
|
||
alter table t1 modify c text; | ||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval load data infile '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue1865.dat' into table t1 (a, c); | ||
select * from t1; | ||
|
||
DROP DATABASE issue1865_test_db; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters