forked from pingcap/dumpling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix unique key null bug (pingcap#119)
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
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,24 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
cur=$(cd `dirname $0`; pwd) | ||
|
||
DB_NAME="null_unique_key" | ||
|
||
# drop database on mysql | ||
run_sql "drop database if exists \`$DB_NAME\`;" | ||
|
||
# build data on mysql | ||
run_sql "create database \`$DB_NAME\`;" | ||
run_sql "create table \`$DB_NAME\`.\`t\` (a int unique key, b int);" | ||
run_sql "insert into \`$DB_NAME\`.\`t\` values (1, 2), (NULL, 1);" | ||
|
||
|
||
# dumping | ||
export DUMPLING_TEST_DATABASE=$DB_NAME | ||
run_dumpling -r 1 | ||
|
||
data="NULL" | ||
cnt=$(sed "s/$data/$data\n/g" $DUMPLING_OUTPUT_DIR/$DB_NAME.t.1.sql | grep -c "$data") || true | ||
[ $cnt = 1 ] | ||
|
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