From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v1 1/2] sql: omit quotes for UUID values in errors Date: Mon, 15 Nov 2021 19:06:45 +0300 [thread overview] Message-ID: <b502c3054b738118298c4cbd78f46b3c304c7798.1636992280.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1636992280.git.imeevma@gmail.com> 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
next prev parent reply other threads:[~2021-11-15 16:07 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-15 16:06 [Tarantool-patches] [PATCH v1 0/2] Introduce mem_snprintf() Mergen Imeev via Tarantool-patches 2021-11-15 16:06 ` Mergen Imeev via Tarantool-patches [this message] 2021-11-15 16:06 ` [Tarantool-patches] [PATCH v1 2/2] sql: introduce mem_snprintf() Mergen Imeev via Tarantool-patches 2021-11-17 23:03 ` Vladislav Shpilevoy via Tarantool-patches 2021-11-19 12:02 ` Mergen Imeev via Tarantool-patches 2021-11-21 15:27 ` [Tarantool-patches] [PATCH v1 0/2] Introduce mem_snprintf() Vladislav Shpilevoy via Tarantool-patches 2021-11-22 8:22 Mergen Imeev via Tarantool-patches 2021-11-22 8:22 ` [Tarantool-patches] [PATCH v1 1/2] sql: omit quotes for UUID values in errors Mergen Imeev via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=b502c3054b738118298c4cbd78f46b3c304c7798.1636992280.git.imeevma@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 1/2] sql: omit quotes for UUID values in errors' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox