diff --git a/src/box/lua/lua_sql.c b/src/box/lua/lua_sql.c index f900c7ca52f63f923059b77c891914fd38d1cecb..67a51a82ce43c73c4a2ac52028160384f1f2376e 100644 --- a/src/box/lua/lua_sql.c +++ b/src/box/lua/lua_sql.c @@ -166,7 +166,7 @@ lbox_sql_create_function(struct lua_State *L) type = FIELD_TYPE_STRING; else if (strcmp(type_arg, "NUMBER") == 0) type = FIELD_TYPE_NUMBER; - else if (strcmp(type_arg, "BLOB") == 0) + else if (strcmp(type_arg, "VARBINARY") == 0) type = FIELD_TYPE_SCALAR; else if (strcmp(type_arg, "BOOL") == 0 || strcmp(type_arg, "BOOLEAN") == 0) diff --git a/src/box/sql/func.c b/src/box/sql/func.c index fcf147c967cd501cac6e3731c43d0ac1c622db91..d9f671917ab73bc95c9a1a5207ad76830c8df001 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -119,7 +119,7 @@ typeofFunc(sql_context * context, int NotUsed, sql_value ** argv) z = "number"; break; case MP_BIN: - z = "scalar"; + z = "varbinary"; break; case MP_BOOL: z = "boolean"; @@ -244,7 +244,7 @@ position_func(struct sql_context *context, int argc, struct Mem **argv) if (haystack_type != MP_STR && haystack_type != MP_BIN) inconsistent_type_arg = haystack; if (inconsistent_type_arg != NULL) { - diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or BLOB", + diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or VARBINARY", mem_type_to_str(inconsistent_type_arg)); context->is_aborted = true; return; @@ -1172,7 +1172,8 @@ zeroblobFunc(sql_context * context, int argc, sql_value ** argv) if (n < 0) n = 0; if (sql_result_zeroblob64(context, n) != 0) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob too big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\ + "is too big"); context->is_aborted = true; } } @@ -1241,7 +1242,7 @@ replaceFunc(sql_context * context, int argc, sql_value ** argv) testcase(nOut - 2 == db->aLimit[SQL_LIMIT_LENGTH]); if (nOut - 1 > db->aLimit[SQL_LIMIT_LENGTH]) { diag_set(ClientError, ER_SQL_EXECUTE, "string "\ - "or blob too big"); + "or binary string is too big"); context->is_aborted = true; sql_free(zOut); return; @@ -1742,8 +1743,8 @@ groupConcatFinalize(sql_context * context) pAccum = sql_aggregate_context(context, 0); if (pAccum) { if (pAccum->accError == STRACCUM_TOOBIG) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob "\ - "too big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary"\ + "string is too big"); context->is_aborted = true; } else if (pAccum->accError == STRACCUM_NOMEM) { context->is_aborted = true; diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 3a8dc04c11ba6a1c6b4fb71f42157b0d5881a23c..a5462266e4a8ad9417ce2048cfc653ea5148be92 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -598,7 +598,7 @@ mem_type_to_str(const struct Mem *p) case MEM_Real: return "REAL"; case MEM_Blob: - return "BLOB"; + return "VARBINARY"; case MEM_Bool: return "BOOLEAN"; default: @@ -1476,7 +1476,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */ char *inconsistent_type = str_type_p1 == 0 ? mem_type_to_str(pIn1) : mem_type_to_str(pIn2); - diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or BLOB", + diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or VARBINARY", inconsistent_type); goto abort_due_to_error; } diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c index ecf1b3601806fac47fc6e79d66224cee7b8a991e..63b46fdbc8d7d720101e9cf78a0411ef4478e32a 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -293,8 +293,8 @@ invokeValueDestructor(const void *p, /* Value to destroy */ xDel((void *)p); } if (pCtx) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob is too "\ - "big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\ + "is too big"); pCtx->is_aborted = true; } return -1; @@ -392,8 +392,8 @@ sql_result_zeroblob64(sql_context * pCtx, u64 n) { Mem *pOut = pCtx->pOut; if (n > (u64) pOut->db->aLimit[SQL_LIMIT_LENGTH]) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob is too "\ - "big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\ + "is too big"); return -1; } sqlVdbeMemSetZeroBlob(pCtx->pOut, (int)n); @@ -941,7 +941,7 @@ sql_bind_blob(sql_stmt * pStmt, struct Mem *var = &p->aVar[i - 1]; if (sqlVdbeMemSetStr(var, zData, nData, 0, xDel) != 0) return -1; - return sql_bind_type(p, i, "BLOB"); + return sql_bind_type(p, i, "VARBINARY"); } int @@ -1025,7 +1025,7 @@ sql_bind_ptr(struct sql_stmt *stmt, int i, void *ptr) struct Vdbe *p = (struct Vdbe *) stmt; int rc = vdbeUnbind(p, i); if (rc == 0) { - rc = sql_bind_type(p, i, "BLOB"); + rc = sql_bind_type(p, i, "VARBINARY"); mem_set_ptr(&p->aVar[i - 1], ptr); } return rc; @@ -1069,8 +1069,8 @@ sql_bind_zeroblob64(sql_stmt * pStmt, int i, sql_uint64 n) { Vdbe *p = (Vdbe *) pStmt; if (n > (u64) p->db->aLimit[SQL_LIMIT_LENGTH]) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob is too "\ - "big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\ + "is too big"); return -1; } assert((n & 0x7FFFFFFF) == n); diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 6c699bdc61672260dd50bceb36d079ce36cfa87a..e2a8c291ce1fd93882e62a32c0054d10e96d3d46 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -1194,7 +1194,7 @@ displayP4(Op * pOp, char *zTemp, int nTemp) zP4 = "NULL"; } else { assert(pMem->flags & MEM_Blob); - zP4 = "(blob)"; + zP4 = "(binary string)"; } break; } diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c index 268b5e9798a91b741e0f8b492065d7f77447d896..51564b2ed8a8ee31995abb665d0f06847991fd87 100644 --- a/src/box/sql/vdbemem.c +++ b/src/box/sql/vdbemem.c @@ -1028,8 +1028,8 @@ sqlVdbeMemSetStr(Mem * pMem, /* Memory cell to set to string value */ nAlloc += 1; //SQL_UTF8 } if (nByte > iLimit) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob "\ - "is too big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary"\ + "string is too big"); return -1; } testcase(nAlloc == 0); @@ -1054,8 +1054,8 @@ sqlVdbeMemSetStr(Mem * pMem, /* Memory cell to set to string value */ pMem->flags = flags; if (nByte > iLimit) { - diag_set(ClientError, ER_SQL_EXECUTE, "string or blob is too "\ - "big"); + diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\ + "is too big"); return -1; } diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua index 667fc0d34f7f3130a160f2c3767e094ea41e53d7..4f9c527bd6b09bc35a614925ffecd08652b4dc20 100755 --- a/test/sql-tap/cast.test.lua +++ b/test/sql-tap/cast.test.lua @@ -40,7 +40,7 @@ test:do_execsql_test( SELECT typeof(x'616263') ]], { -- <cast-1.2> - "scalar" + "varbinary" -- </cast-1.2> }) @@ -90,7 +90,7 @@ test:do_execsql_test( SELECT typeof(CAST(x'616263' AS SCALAR)) ]], { -- <cast-1.8> - "scalar" + "varbinary" -- </cast-1.8> }) diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua index e44b23dc25684ba5141456ec192781f0b87ccfc0..5922622ec1813a0edf447a2b27aa509f283b3c31 100755 --- a/test/sql-tap/func.test.lua +++ b/test/sql-tap/func.test.lua @@ -978,7 +978,7 @@ test:do_execsql_test( SELECT typeof(randomblob(32)); ]], { -- <func-9.4> - "scalar" + "varbinary" -- </func-9.4> }) diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua index 921fc3922721c33207b83bf98291d6835d82d1c0..b0ecccd5276c9cebc672c98b3341db7f9c5c2b23 100755 --- a/test/sql-tap/lua_sql.test.lua +++ b/test/sql-tap/lua_sql.test.lua @@ -108,7 +108,7 @@ local from_lua_to_sql = { local function check_from_lua_to_sql(i) return from_lua_to_sql[i][2] end -box.internal.sql_create_function("check_from_lua_to_sql", "BLOB", check_from_lua_to_sql) +box.internal.sql_create_function("check_from_lua_to_sql", "VARBINARY", check_from_lua_to_sql) -- check for different types for i = 1, #from_lua_to_sql, 1 do @@ -125,7 +125,7 @@ local from_lua_to_sql_bad = { local function check_from_lua_to_sql_bad(i) return from_lua_to_sql_bad[i] end -box.internal.sql_create_function("check_from_lua_to_sql_bad", "BLOB", check_from_lua_to_sql_bad) +box.internal.sql_create_function("check_from_lua_to_sql_bad", "VARBINARY", check_from_lua_to_sql_bad) for i = 1, #from_lua_to_sql_bad, 1 do test:do_catchsql_test( diff --git a/test/sql-tap/position.test.lua b/test/sql-tap/position.test.lua index 40b8a943bf34869bc961f99a0830f3dce47e2832..9539f7bf75604636d6dca0e0aced28aa6a38a3f1 100755 --- a/test/sql-tap/position.test.lua +++ b/test/sql-tap/position.test.lua @@ -228,7 +228,7 @@ test:do_test( return test:catchsql "SELECT position(34, 12345);" end, { -- <position-1.23> - 1, "Inconsistent types: expected TEXT or BLOB got UNSIGNED" + 1, "Inconsistent types: expected TEXT or VARBINARY got UNSIGNED" -- </position-1.23> }) @@ -238,7 +238,7 @@ test:do_test( return test:catchsql "SELECT position(34, 123456.78);" end, { -- <position-1.24> - 1, "Inconsistent types: expected TEXT or BLOB got REAL" + 1, "Inconsistent types: expected TEXT or VARBINARY got REAL" -- </position-1.24> }) @@ -248,7 +248,7 @@ test:do_test( return test:catchsql "SELECT position(x'3334', 123456.78);" end, { -- <position-1.25> - 1, "Inconsistent types: expected TEXT or BLOB got REAL" + 1, "Inconsistent types: expected TEXT or VARBINARY got REAL" -- </position-1.25> }) @@ -554,7 +554,7 @@ test:do_test( return test:catchsql("SELECT position('x', x'78c3a4e282ac79');") end, { -- <position-1.54> - 1, "Inconsistent types: expected TEXT got BLOB" + 1, "Inconsistent types: expected TEXT got VARBINARY" -- </position-1.54> }) @@ -564,7 +564,7 @@ test:do_test( return test:catchsql "SELECT position('y', x'78c3a4e282ac79');" end, { -- <position-1.55> - 1, "Inconsistent types: expected TEXT got BLOB" + 1, "Inconsistent types: expected TEXT got VARBINARY" -- </position-1.55> }) @@ -614,7 +614,7 @@ test:do_test( return test:catchsql "SELECT position(x'79', 'xä€y');" end, { -- <position-1.57.1> - 1, "Inconsistent types: expected BLOB got TEXT" + 1, "Inconsistent types: expected VARBINARY got TEXT" -- </position-1.57.1> }) @@ -624,7 +624,7 @@ test:do_test( return test:catchsql "SELECT position(x'a4', 'xä€y');" end, { -- <position-1.57.2> - 1, "Inconsistent types: expected BLOB got TEXT" + 1, "Inconsistent types: expected VARBINARY got TEXT" -- </position-1.57.2> }) @@ -634,7 +634,7 @@ test:do_test( return test:catchsql "SELECT position('y', x'78c3a4e282ac79');" end, { -- <position-1.57.3> - 1, "Inconsistent types: expected TEXT got BLOB" + 1, "Inconsistent types: expected TEXT got VARBINARY" -- </position-1.57.3> }) diff --git a/test/sql/types.result b/test/sql/types.result index 7044e683467ccb66c3641e1de888d677d469cd75..c89da47487c58001b08cde0a7bc49ac6add42f36 100644 --- a/test/sql/types.result +++ b/test/sql/types.result @@ -152,33 +152,33 @@ sp:drop() -- box.execute("SELECT 'abc' || 1;") --- -- error: 'Inconsistent types: expected TEXT or BLOB got UNSIGNED' +- error: 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED' ... box.execute("SELECT 'abc' || 1.123;") --- -- error: 'Inconsistent types: expected TEXT or BLOB got REAL' +- error: 'Inconsistent types: expected TEXT or VARBINARY got REAL' ... box.execute("SELECT 1 || 'abc';") --- -- error: 'Inconsistent types: expected TEXT or BLOB got UNSIGNED' +- error: 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED' ... box.execute("SELECT 1.123 || 'abc';") --- -- error: 'Inconsistent types: expected TEXT or BLOB got REAL' +- error: 'Inconsistent types: expected TEXT or VARBINARY got REAL' ... box.execute("SELECt 'a' || 'b' || 1;") --- -- error: 'Inconsistent types: expected TEXT or BLOB got UNSIGNED' +- error: 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED' ... -- What is more, they must be of the same type. -- box.execute("SELECT 'abc' || randomblob(5);") --- -- error: 'Inconsistent types: expected TEXT got BLOB' +- error: 'Inconsistent types: expected TEXT got VARBINARY' ... box.execute("SELECT randomblob(5) || 'x';") --- -- error: 'Inconsistent types: expected BLOB got TEXT' +- error: 'Inconsistent types: expected VARBINARY got TEXT' ... -- Result of BLOBs concatenation must be BLOB. -- @@ -188,7 +188,7 @@ box.execute("VALUES (TYPEOF(randomblob(5) || zeroblob(5)));") - name: column1 type: string rows: - - ['scalar'] + - ['varbinary'] ... -- gh-3954: LIKE accepts only arguments of type TEXT and NULLs. -- @@ -202,15 +202,15 @@ box.execute("INSERT INTO t1 VALUES (randomblob(5));") ... box.execute("SELECT * FROM t1 WHERE s LIKE 'blob';") --- -- error: 'Inconsistent types: expected TEXT got BLOB' +- error: 'Inconsistent types: expected TEXT got VARBINARY' ... box.execute("SELECT * FROM t1 WHERE 'blob' LIKE s;") --- -- error: 'Inconsistent types: expected TEXT got BLOB' +- error: 'Inconsistent types: expected TEXT got VARBINARY' ... box.execute("SELECT * FROM t1 WHERE 'blob' LIKE x'0000';") --- -- error: 'Inconsistent types: expected TEXT got BLOB' +- error: 'Inconsistent types: expected TEXT got VARBINARY' ... box.execute("SELECT s LIKE NULL FROM t1;") --- @@ -393,7 +393,7 @@ box.execute("SELECT 1 LIMIT 1 OFFSET true;") ... box.execute("SELECT 'abc' || true;") --- -- error: 'Inconsistent types: expected TEXT or BLOB got BOOLEAN' +- error: 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN' ... -- Boolean can take part in arithmetic operations. -- @@ -1795,7 +1795,7 @@ box.execute("SELECT CASE 1 WHEN 1 THEN 666 WHEN 2 THEN 123 ELSE 'asd' END") --- - metadata: - name: CASE 1 WHEN 1 THEN 666 WHEN 2 THEN 123 ELSE 'asd' END - type: integer + type: scalar rows: - [666] ... @@ -1813,7 +1813,7 @@ box.execute("SELECT CASE 'a' WHEN 'a' THEN 1 WHEN 'b' THEN 2 WHEN 'c' THEN 3 WHE - metadata: - name: CASE 'a' WHEN 'a' THEN 1 WHEN 'b' THEN 2 WHEN 'c' THEN 3 WHEN 'd' THEN 4 WHEN 'e' THEN 5 WHEN 'f' THEN 'asd' END - type: integer + type: scalar rows: - [1] ... @@ -1822,7 +1822,7 @@ box.execute("SELECT CASE 'a' WHEN 'a' THEN 1 WHEN 'b' THEN 2 WHEN 'c' THEN 3 WHE - metadata: - name: CASE 'a' WHEN 'a' THEN 1 WHEN 'b' THEN 2 WHEN 'c' THEN 3 WHEN 'd' THEN 4 WHEN 'e' THEN 5 WHEN 'f' THEN 6 ELSE 'asd' END - type: integer + type: scalar rows: - [1] ...