Skip to content

Commit 2358991

Browse files
committed
Remove CSV import simulation test - will be replaced with proper dolt bats test
The 'charset validation CSV import simulation' test was just using INSERT statements with UNHEX - not actually testing CSV import functionality. A proper CSV import test should: - Create real CSV files with invalid UTF-8 data - Use dolt's actual CSV import commands - Live in the dolt repo as a bats test This will be implemented in a separate PR branch in the dolt repo.
1 parent 6cbecfc commit 2358991

File tree

2 files changed

+4
-72
lines changed

2 files changed

+4
-72
lines changed

enginetest/queries/script_queries.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7232,74 +7232,6 @@ where
72327232
},
72337233
},
72347234
},
7235-
{
7236-
Name: "charset validation CSV import simulation",
7237-
SetUpScript: []string{
7238-
"create table csv_import_test (id int, name text character set utf8mb4);",
7239-
},
7240-
Assertions: []ScriptTestAssertion{
7241-
{
7242-
Query: "set sql_mode = 'STRICT_TRANS_TABLES';",
7243-
Expected: []sql.Row{{types.OkResult{RowsAffected: 0}}},
7244-
},
7245-
{
7246-
Query: "insert into csv_import_test values (1, UNHEX('56616C6964205554463820C2AE'));",
7247-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
7248-
},
7249-
{
7250-
Query: "insert into csv_import_test values (2, UNHEX('496E76616C6964205554463820AE'));",
7251-
ExpectedErrStr: "Incorrect string value: '\\xAE' for column 'name' at row 1",
7252-
},
7253-
{
7254-
Query: "insert into csv_import_test values (3, UNHEX('416E6F7468657220496E76616C696420FFFE'));",
7255-
ExpectedErrStr: "Incorrect string value: '\\xFF\\xFE' for column 'name' at row 1",
7256-
},
7257-
{
7258-
Query: "set sql_mode = '';",
7259-
Expected: []sql.Row{{types.OkResult{RowsAffected: 0}}},
7260-
},
7261-
{
7262-
Query: "insert into csv_import_test values (2, UNHEX('496E76616C6964205554463820AE'));",
7263-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
7264-
},
7265-
{
7266-
Query: "insert into csv_import_test values (3, UNHEX('416E6F7468657220496E76616C696420FFFE'));",
7267-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
7268-
},
7269-
{
7270-
Query: "insert into csv_import_test values (4, UNHEX('4E6F726D616C2054657874'));",
7271-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
7272-
},
7273-
{
7274-
Query: "select id, name, HEX(name), LENGTH(name) from csv_import_test order by id;",
7275-
Expected: []sql.Row{
7276-
{1, "Valid UTF8 ®", "56616C6964205554463820C2AE", 13},
7277-
{2, "Invalid UTF8 ", "496E76616C6964205554463820", 13},
7278-
{3, "Another Invalid ", "416E6F7468657220496E76616C696420", 16},
7279-
{4, "Normal Text", "4E6F726D616C2054657874", 11},
7280-
},
7281-
},
7282-
{
7283-
Query: "select id, name from csv_import_test where name like '%®%';",
7284-
Expected: []sql.Row{
7285-
{1, "Valid UTF8 ®"},
7286-
},
7287-
},
7288-
{
7289-
Query: "select id, name from csv_import_test where name like '%UTF8%';",
7290-
Expected: []sql.Row{
7291-
{1, "Valid UTF8 ®"},
7292-
{2, "Invalid UTF8 "},
7293-
},
7294-
},
7295-
{
7296-
Query: "select count(*) as total_queryable from csv_import_test;",
7297-
Expected: []sql.Row{
7298-
{4},
7299-
},
7300-
},
7301-
},
7302-
},
73037235
{
73047236
Name: "charset validation issue #8893 - customer scenario",
73057237
SetUpScript: []string{

sql/types/strings.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ const (
5959

6060
var (
6161
// ErrLengthTooLarge is thrown when a string's length is too large given the other parameters.
62-
ErrLengthTooLarge = errors.NewKind("length is %v but max allowed is %v")
63-
ErrLengthBeyondLimit = errors.NewKind("string '%v' is too large for column '%v'")
64-
ErrBinaryCollation = errors.NewKind("binary types must have the binary collation: %v")
65-
ErrBadCharsetString = errors.NewKind("Incorrect string value: '%v' for column '%s' at row %d")
62+
ErrLengthTooLarge = errors.NewKind("length is %v but max allowed is %v")
63+
ErrLengthBeyondLimit = errors.NewKind("string '%v' is too large for column '%v'")
64+
ErrBinaryCollation = errors.NewKind("binary types must have the binary collation: %v")
65+
ErrBadCharsetString = errors.NewKind("Incorrect string value: '%v' for column '%s' at row %d")
6666

6767
TinyText = MustCreateStringWithDefaults(sqltypes.Text, TinyTextBlobMax)
6868
Text = MustCreateStringWithDefaults(sqltypes.Text, TextBlobMax)

0 commit comments

Comments
 (0)