[Tarantool-patches] [PATCH v1 1/2] sql: omit quotes for UUID values in errors
imeevma at tarantool.org
imeevma at tarantool.org
Mon Nov 15 19:06:45 MSK 2021
This patch removes quotes from the representation of UUID values in the
error description. This is because UUID values are printed without
quotes elsewhere.
---
src/box/sql/mem.c | 2 +-
test/sql-tap/cast.test.lua | 4 +-
test/sql-tap/decimal.test.lua | 6 +-
.../gh-5364-define-bit-wise-rules.test.lua | 8 +--
...-5756-implicit-cast-in-arithmetic.test.lua | 10 ++--
test/sql-tap/sql-errors.test.lua | 2 +-
test/sql-tap/uuid.test.lua | 58 +++++++++----------
7 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 7ea68f868..9ddeea5bb 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -163,7 +163,7 @@ mem_str(const struct Mem *mem)
}
case MEM_TYPE_UUID:
tt_uuid_to_string(&mem->u.uuid, buf);
- return tt_sprintf("%s('%s')", type, buf);
+ return tt_sprintf("%s(%s)", type, buf);
case MEM_TYPE_BOOL:
return tt_sprintf("%s(%s)", type, mem->u.b ? "TRUE" : "FALSE");
default:
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index d5c9cbbc6..5861799b3 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -1067,7 +1067,7 @@ test:do_catchsql_test(
INSERT INTO t3(s) VALUES(]]..uuid..[[);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to string"
+ "uuid(11111111-1111-1111-1111-111111111111) to string"
})
-- Make sure that UUID cannot be implicitly cast to VARBINARY.
@@ -1077,7 +1077,7 @@ test:do_catchsql_test(
INSERT INTO t4(v) VALUES(]]..uuid..[[);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to varbinary"
+ "uuid(11111111-1111-1111-1111-111111111111) to varbinary"
})
-- Make sure that STRING and VARBINARY cannot be implicitly cast to UUID.
diff --git a/test/sql-tap/decimal.test.lua b/test/sql-tap/decimal.test.lua
index a6d66b75b..ab211ba81 100755
--- a/test/sql-tap/decimal.test.lua
+++ b/test/sql-tap/decimal.test.lua
@@ -336,7 +336,7 @@ test:do_catchsql_test(
[[
SELECT u > CAST('11111111-1111-1111-1111-111111111111' AS UUID) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to number"
})
test:do_catchsql_test(
@@ -392,7 +392,7 @@ test:do_catchsql_test(
[[
SELECT u = CAST('11111111-1111-1111-1111-111111111111' AS UUID) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to number"
})
test:do_catchsql_test(
@@ -562,7 +562,7 @@ test:do_catchsql_test(
[[
SELECT cast(cast(x'11111111111111111111111111111111' AS UUID) AS DECIMAL);
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to decimal"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to decimal"
})
test:execsql([[
diff --git a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
index 2a6a60a81..e1ab8abe8 100755
--- a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
+++ b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
@@ -60,7 +60,7 @@ test:do_catchsql_test(
SELECT 9 >> CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ "uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_execsql_test(
@@ -117,7 +117,7 @@ test:do_catchsql_test(
SELECT 9 << CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ "uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_execsql_test(
@@ -174,7 +174,7 @@ test:do_catchsql_test(
SELECT 9 & CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ "uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_execsql_test(
@@ -231,7 +231,7 @@ test:do_catchsql_test(
SELECT 9 | CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ "uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:finish_test()
diff --git a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
index bf636a261..46bac159b 100755
--- a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
+++ b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
@@ -60,7 +60,7 @@ test:do_catchsql_test(
SELECT 9 + CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ "uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_execsql_test(
@@ -117,7 +117,7 @@ test:do_catchsql_test(
SELECT 9 - CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ "uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_execsql_test(
@@ -174,7 +174,7 @@ test:do_catchsql_test(
SELECT 9 * CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ "uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_execsql_test(
@@ -231,7 +231,7 @@ test:do_catchsql_test(
SELECT 9 / CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ "uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_execsql_test(
@@ -288,7 +288,7 @@ test:do_catchsql_test(
SELECT 9 % CAST('11111111-1111-1111-1111-111111111111' AS UUID);
]], {
1, "Type mismatch: can not convert "..
- "uuid('11111111-1111-1111-1111-111111111111') to integer"
+ "uuid(11111111-1111-1111-1111-111111111111) to integer"
})
test:finish_test()
diff --git a/test/sql-tap/sql-errors.test.lua b/test/sql-tap/sql-errors.test.lua
index 08a675101..a9aa5acf7 100755
--- a/test/sql-tap/sql-errors.test.lua
+++ b/test/sql-tap/sql-errors.test.lua
@@ -850,7 +850,7 @@ test:do_catchsql_test(
[[
SELECT CAST(CAST('11111111-1111-1111-1111-111111111111' AS UUID) AS UNSIGNED);
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
local bin = ''
diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua
index 884b1daf9..8421e50c7 100755
--- a/test/sql-tap/uuid.test.lua
+++ b/test/sql-tap/uuid.test.lua
@@ -493,7 +493,7 @@ test:do_catchsql_test(
[[
SELECT u || u from t2;
]], {
- 1, "Inconsistent types: expected string or varbinary got uuid('11111111-1111-1111-1111-111111111111')"
+ 1, "Inconsistent types: expected string or varbinary got uuid(11111111-1111-1111-1111-111111111111)"
})
local func = {language = 'Lua', body = 'function(x) return type(x) end',
@@ -552,7 +552,7 @@ test:do_catchsql_test(
[[
SELECT cast(u AS UNSIGNED) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_execsql_test(
@@ -570,7 +570,7 @@ test:do_catchsql_test(
[[
SELECT cast(u AS NUMBER) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to number"
})
test:do_catchsql_test(
@@ -578,7 +578,7 @@ test:do_catchsql_test(
[[
SELECT cast(u AS DOUBLE) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to double"
})
test:do_catchsql_test(
@@ -586,7 +586,7 @@ test:do_catchsql_test(
[[
SELECT cast(u AS INTEGER) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer"
})
test:do_catchsql_test(
@@ -594,7 +594,7 @@ test:do_catchsql_test(
[[
SELECT cast(u AS BOOLEAN) FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_execsql_test(
@@ -707,7 +707,7 @@ test:do_catchsql_test(
[[
INSERT INTO tu(u) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_catchsql_test(
@@ -715,7 +715,7 @@ test:do_catchsql_test(
[[
INSERT INTO ts(s) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to string"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to string"
})
test:do_catchsql_test(
@@ -723,7 +723,7 @@ test:do_catchsql_test(
[[
INSERT INTO tn(n) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to number"
})
test:do_catchsql_test(
@@ -731,7 +731,7 @@ test:do_catchsql_test(
[[
INSERT INTO td(d) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to double"
})
test:do_catchsql_test(
@@ -739,7 +739,7 @@ test:do_catchsql_test(
[[
INSERT INTO ti(i) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer"
})
test:do_catchsql_test(
@@ -747,7 +747,7 @@ test:do_catchsql_test(
[[
INSERT INTO tb(b) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_catchsql_test(
@@ -755,7 +755,7 @@ test:do_catchsql_test(
[[
INSERT INTO tv(v) SELECT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to varbinary"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to varbinary"
})
test:do_execsql_test(
@@ -945,7 +945,7 @@ test:do_catchsql_test(
[[
SELECT -u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_catchsql_test(
@@ -953,7 +953,7 @@ test:do_catchsql_test(
[[
SELECT u + 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_catchsql_test(
@@ -961,7 +961,7 @@ test:do_catchsql_test(
[[
SELECT u - 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_catchsql_test(
@@ -969,7 +969,7 @@ test:do_catchsql_test(
[[
SELECT u * 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_catchsql_test(
@@ -977,7 +977,7 @@ test:do_catchsql_test(
[[
SELECT u / 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, decimal or double"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer, decimal or double"
})
test:do_catchsql_test(
@@ -985,7 +985,7 @@ test:do_catchsql_test(
[[
SELECT u % 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to integer"
})
-- Check that bitwise operations work with UUIDs as intended.
@@ -994,7 +994,7 @@ test:do_catchsql_test(
[[
SELECT ~u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_catchsql_test(
@@ -1002,7 +1002,7 @@ test:do_catchsql_test(
[[
SELECT u >> 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_catchsql_test(
@@ -1010,7 +1010,7 @@ test:do_catchsql_test(
[[
SELECT u << 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_catchsql_test(
@@ -1018,7 +1018,7 @@ test:do_catchsql_test(
[[
SELECT u | 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
test:do_catchsql_test(
@@ -1026,7 +1026,7 @@ test:do_catchsql_test(
[[
SELECT u & 1 FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to unsigned"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to unsigned"
})
-- Check that logical operations work with UUIDs as intended.
@@ -1035,7 +1035,7 @@ test:do_catchsql_test(
[[
SELECT NOT u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_catchsql_test(
@@ -1043,7 +1043,7 @@ test:do_catchsql_test(
[[
SELECT u AND true FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_catchsql_test(
@@ -1051,7 +1051,7 @@ test:do_catchsql_test(
[[
SELECT u OR true FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_catchsql_test(
@@ -1059,7 +1059,7 @@ test:do_catchsql_test(
[[
SELECT true AND u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
test:do_catchsql_test(
@@ -1067,7 +1067,7 @@ test:do_catchsql_test(
[[
SELECT true OR u FROM t2;
]], {
- 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to boolean"
+ 1, "Type mismatch: can not convert uuid(11111111-1111-1111-1111-111111111111) to boolean"
})
-- Check that comparison with UUID works as intended.
--
2.25.1
More information about the Tarantool-patches
mailing list