diff --git a/src/frontend/sql/query.pest b/src/frontend/sql/query.pest index 6eb4c9b0d9ab8b6720236b568015277af42cf027..cd74e2ed33699a0bcf013f8a0e0e0b7df4aaba4a 100644 --- a/src/frontend/sql/query.pest +++ b/src/frontend/sql/query.pest @@ -72,7 +72,7 @@ Expr = _{ Or | And | Unary | Between | Cmp | Primary | Parentheses } NameString = @{ !(WHITESPACE* ~ Keyword ~ WHITESPACE) ~ ('Ð' .. 'Я' | 'а' .. 'Ñ' | 'A' .. 'Z' | 'a'..'z' | "-" | "_" | ASCII_DIGIT)+ } -String = @{ !(WHITESPACE* ~ Keyword ~ WHITESPACE) ~ (Character | ("'" ~ "'") | "\"")+ } +String = @{ !(WHITESPACE* ~ Keyword ~ WHITESPACE) ~ (Character | ("'" ~ "'") | "\"")* } Keyword = { ^"except" | ^"union" | ^"where" } Character = _{ ASCII_ALPHANUMERIC | 'Ð' .. 'Я' | 'а' .. 'Ñ' | Other | Punctuation | SYMBOL } Punctuation = _{ diff --git a/test_app/test/integration/api_test.lua b/test_app/test/integration/api_test.lua index 4278b23d4b6abd7e3012788da9f61de75965f5fd..a93b6d33a485bf042d2b202a8ed423407d6a7fb5 100644 --- a/test_app/test/integration/api_test.lua +++ b/test_app/test/integration/api_test.lua @@ -694,6 +694,34 @@ g.test_insert_6 = function() }) end +-- check empty string +g.test_insert_7 = function() + local api = cluster:server("api-1").net_box + + local r, err = api:call("sbroad.execute", { [[INSERT INTO "space_simple_shard_key" + ("sysOp", "id", "name") VALUES (8, 8, '')]], {} }) + + t.assert_equals(err, nil) + t.assert_equals(r, {row_count = 1}) + + r, err = api:call("sbroad.execute", { [[SELECT *, "bucket_id" FROM "space_simple_shard_key"]], {} }) + + t.assert_equals(err, nil) + t.assert_equals(r, { + metadata = { + {name = "id", type = "integer"}, + {name = "name", type = "string"}, + {name = "sysOp", type = "integer"}, + {name = "bucket_id", type = "unsigned"}, + }, + rows = { + {1, "ok", 1, 3940}, + {8, "", 8, 12104}, + {10, box.NULL, 0, 11520} + }, + }) +end + g.test_decimal_double = function() local api = cluster:server("api-1").net_box