From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 5E8572A71B for ; Thu, 28 Mar 2019 13:46:23 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t498t1qlVtmu for ; Thu, 28 Mar 2019 13:46:23 -0400 (EDT) Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 42B0E2A6DF for ; Thu, 28 Mar 2019 13:46:22 -0400 (EDT) Date: Thu, 28 Mar 2019 20:46:18 +0300 From: Mergen Imeev Subject: [tarantool-patches] Re: [PATCH v9 2/7] sql: fix error code for SQL errors in execute.c Message-ID: <20190328174618.GA4864@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org Hi! Thank you for review. My answer, diffs and new patch nelow. There will be two diffs - one is diff for this patch and one for the last one in the patch-set. On Wed, Mar 27, 2019 at 12:48:27AM +0300, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch! > > > diff --git a/src/box/execute.c b/src/box/execute.c > > index 7c77df2..5810086 100644 > > --- a/src/box/execute.c > > +++ b/src/box/execute.c > > @@ -541,7 +546,12 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind, > > return -1; > > } > > if (sql_prepare_v2(db, sql, len, &stmt, NULL) != SQL_OK) { > > - diag_set(ClientError, ER_SQL_EXECUTE, sql_errmsg(db)); > > + if (db->errCode != SQL_TARANTOOL_ERROR) { > > + const char *err = (char *)sql_value_text(db->pErr); > > + if (err == NULL) > > + err = sqlErrStr(db->errCode); > > + diag_set(ClientError, ER_VDBE_EXECUTE, err); > > Prepare has nothing to do with Vdbe except allocation. Error > says "Error during execution of VDBE", but VDBE is not executed > here. Also, not sure if 'VDBE' should be showed to a user. He is > likely not to be aware about what it is. > > In my opinion, ER_VDBE_EXECUTE should be replaced with ER_SQL_EXECUTE, > and the message should be "Error during execution of SQL bytecode: ...". > Fixed. Changed to errcode that was used before - ER_SQL_EXECUTE. Diff from previous version of this patch: diff --git a/src/box/errcode.h b/src/box/errcode.h index e39a89e..7764aa3 100644 --- a/src/box/errcode.h +++ b/src/box/errcode.h @@ -240,7 +240,6 @@ struct errcode_record { /*185 */_(ER_SQL_UNKNOWN_TOKEN, "Syntax error: unrecognized token: '%.*s'") \ /*186 */_(ER_SQL_PARSER_GENERIC, "%s") \ /*187 */_(ER_SQL_ANALYZE_ARGUMENT, "ANALYZE statement argument %s is not a base table") \ - /*188 */_(ER_VDBE_EXECUTE, "Error during execution of VDBE byte-code: %s") \ /* * !IMPORTANT! Please follow instructions at start of the file diff --git a/src/box/execute.c b/src/box/execute.c index 5810086..d45fb12 100644 --- a/src/box/execute.c +++ b/src/box/execute.c @@ -527,7 +527,7 @@ sql_execute(sql *db, struct sql_stmt *stmt, struct port *port, const char *err = (char *)sql_value_text(db->pErr); if (err == NULL) err = sqlErrStr(db->errCode); - diag_set(ClientError, ER_VDBE_EXECUTE, err); + diag_set(ClientError, ER_SQL_EXECUTE, err); } return -1; } @@ -550,7 +550,7 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind, const char *err = (char *)sql_value_text(db->pErr); if (err == NULL) err = sqlErrStr(db->errCode); - diag_set(ClientError, ER_VDBE_EXECUTE, err); + diag_set(ClientError, ER_SQL_EXECUTE, err); } return -1; } diff --git a/test/box/misc.result b/test/box/misc.result index 4f1116e..c350bbd 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -516,7 +516,6 @@ t; 185: box.error.SQL_UNKNOWN_TOKEN 186: box.error.SQL_PARSER_GENERIC 187: box.error.SQL_ANALYZE_ARGUMENT - 188: box.error.VDBE_EXECUTE ... test_run:cmd("setopt delimiter ''"); --- diff --git a/test/sql/iproto.result b/test/sql/iproto.result index 2738ed6..269fbaf 100644 --- a/test/sql/iproto.result +++ b/test/sql/iproto.result @@ -651,8 +651,8 @@ future1:wait_result() future2:wait_result() --- - null -- 'Error during execution of VDBE byte-code: Duplicate key exists in unique index - ''pk_unnamed_TEST_1'' in space ''TEST''' +- 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_TEST_1'' + in space ''TEST''' ... future3:wait_result() --- Diff from last version of the patch "Remove box.sql.execute()": diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua index 2331cd0..97039e2 100755 --- a/test/sql-tap/alter.test.lua +++ b/test/sql-tap/alter.test.lua @@ -359,7 +359,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(2, 1, 3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -369,7 +369,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(2, 2, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -435,7 +435,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(4, 5, 3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -490,7 +490,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(6, 5, 10); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/alter2.test.lua b/test/sql-tap/alter2.test.lua index 612dd74..d714a4b 100755 --- a/test/sql-tap/alter2.test.lua +++ b/test/sql-tap/alter2.test.lua @@ -24,7 +24,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(2, 3, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -45,7 +45,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(2, 3, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -83,7 +83,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(4, 2, 1); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -143,7 +143,7 @@ test:do_catchsql_test( INSERT INTO parent VALUES(1, 2, 3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -154,7 +154,7 @@ test:do_catchsql_test( INSERT INTO child VALUES(2, 1, 1); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -165,7 +165,7 @@ test:do_catchsql_test( INSERT INTO parent VALUES(3, 4, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua index bdc0053..36c243f 100755 --- a/test/sql-tap/autoinc.test.lua +++ b/test/sql-tap/autoinc.test.lua @@ -531,7 +531,7 @@ test:do_catchsql_test( INSERT INTO t6 VALUES(NULL,1); ]], { -- - 1, "Error during execution of VDBE byte-code: Sequence 'T6' has overflowed" + 1, "Failed to execute SQL statement: Sequence 'T6' has overflowed" -- }) @@ -810,7 +810,7 @@ test:do_catchsql_test( INSERT INTO t1 SELECT s2, s2 FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: datatype mismatch" + 1, "Failed to execute SQL statement: datatype mismatch" -- }) diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua index c7ef1a1..d5760b0 100755 --- a/test/sql-tap/check.test.lua +++ b/test/sql-tap/check.test.lua @@ -55,7 +55,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(6,7, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -75,7 +75,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(4,3, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -147,7 +147,7 @@ test:do_catchsql_test( UPDATE t1 SET x=7 WHERE x==2 ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -167,7 +167,7 @@ test:do_catchsql_test( UPDATE t1 SET x=5 WHERE x==2 ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -246,7 +246,7 @@ test:do_catchsql_test( INSERT INTO t2 VALUES(3, 1.1, NULL, NULL); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: ONE" + 1, "Failed to execute SQL statement: CHECK constraint failed: ONE" -- }) @@ -256,7 +256,7 @@ test:do_catchsql_test( INSERT INTO t2 VALUES(4, NULL, 5, NULL); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: TWO" + 1, "Failed to execute SQL statement: CHECK constraint failed: TWO" -- }) @@ -266,7 +266,7 @@ test:do_catchsql_test( INSERT INTO t2 VALUES(5, NULL, NULL, 3.14159); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: THREE" + 1, "Failed to execute SQL statement: CHECK constraint failed: THREE" -- }) @@ -413,7 +413,7 @@ test:do_catchsql_test( INSERT INTO t3 VALUES(111,222,333); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T3" + 1, "Failed to execute SQL statement: CHECK constraint failed: T3" -- }) @@ -484,7 +484,7 @@ test:do_catchsql_test( UPDATE t4 SET x=0, y=1; ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T4" + 1, "Failed to execute SQL statement: CHECK constraint failed: T4" -- }) @@ -504,7 +504,7 @@ test:do_catchsql_test( UPDATE t4 SET x=0, y=2; ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T4" + 1, "Failed to execute SQL statement: CHECK constraint failed: T4" -- }) @@ -581,7 +581,7 @@ test:do_catchsql_test( UPDATE OR FAIL t1 SET x=7-x, y=y+1; ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -603,7 +603,7 @@ test:do_catchsql_test( INSERT OR ROLLBACK INTO t1 VALUES(8,40.0, 10); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -613,7 +613,7 @@ test:do_catchsql_test( COMMIT; ]], { -- - 1, "Error during execution of VDBE byte-code: cannot commit - no transaction is active" + 1, "Failed to execute SQL statement: cannot commit - no transaction is active" -- }) @@ -636,7 +636,7 @@ test:do_catchsql_test( REPLACE INTO t1 VALUES(6,7, 11); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T1" + 1, "Failed to execute SQL statement: CHECK constraint failed: T1" -- }) @@ -700,7 +700,7 @@ test:do_catchsql_test( 7.3, " INSERT INTO t6 VALUES(11) ", { -- <7.3> - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T6" + 1, "Failed to execute SQL statement: CHECK constraint failed: T6" -- }) diff --git a/test/sql-tap/fkey1.test.lua b/test/sql-tap/fkey1.test.lua index f7c473f..7000ec0 100755 --- a/test/sql-tap/fkey1.test.lua +++ b/test/sql-tap/fkey1.test.lua @@ -158,7 +158,7 @@ test:do_catchsql_test( INSERT OR REPLACE INTO t11 VALUES (2, 3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -194,7 +194,7 @@ test:do_catchsql_test( INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 3, 'A-2-3'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/fkey2.test.lua b/test/sql-tap/fkey2.test.lua index 525ef2a..09d55be 100755 --- a/test/sql-tap/fkey2.test.lua +++ b/test/sql-tap/fkey2.test.lua @@ -26,7 +26,7 @@ test:do_catchsql_test( INSERT INTO t2(c,d) VALUES(1, 3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -56,7 +56,7 @@ test:do_catchsql_test( INSERT INTO t2(c,d) VALUES(2, 4); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -77,7 +77,7 @@ test:do_catchsql_test( UPDATE t2 SET c = 2 WHERE d = 4; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -98,7 +98,7 @@ test:do_catchsql_test( DELETE FROM t1 WHERE a = 1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -109,7 +109,7 @@ test:do_catchsql_test( UPDATE t1 SET a = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -131,7 +131,7 @@ test:do_catchsql_test( INSERT INTO t4(c,d) values (1,3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -161,7 +161,7 @@ test:do_catchsql_test( INSERT INTO t8(c,d) values (1,3); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -191,7 +191,7 @@ test:do_catchsql_test( INSERT INTO t8(c,d) values (2,4); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -201,7 +201,7 @@ test:do_catchsql_test( INSERT INTO t8(c,d) values (6,4); ]], { -- - 1,"Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1,"Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -241,7 +241,7 @@ test:do_catchsql_test( DELETE FROM t7 WHERE b = 1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -251,7 +251,7 @@ test:do_catchsql_test( UPDATE t7 SET b = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -271,7 +271,7 @@ test:do_catchsql_test( INSERT INTO t8(c,d) VALUES(666, 54644); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -281,7 +281,7 @@ test:do_catchsql_test( UPDATE t7 SET b = 5; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -333,7 +333,7 @@ test:do_catchsql_test( DELETE FROM i; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -362,7 +362,7 @@ test:do_catchsql_test( UPDATE ab SET a = 5; ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: EF" + 1, "Failed to execute SQL statement: CHECK constraint failed: EF" -- }) @@ -382,7 +382,7 @@ test:do_catchsql_test( UPDATE ab SET a = 5; ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: EF" + 1, "Failed to execute SQL statement: CHECK constraint failed: EF" -- }) @@ -403,7 +403,7 @@ test:do_catchsql_test( DELETE FROM ab; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -540,7 +540,7 @@ test:do_catchsql_test( INSERT INTO t2(c,b) VALUES(1, 'A'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -562,7 +562,7 @@ test:do_catchsql_test( UPDATE t2 SET c = 3; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -572,7 +572,7 @@ test:do_catchsql_test( DELETE FROM t1 WHERE a = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -591,7 +591,7 @@ test:do_catchsql_test( UPDATE t1 SET a = 3; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -656,7 +656,7 @@ test:do_catchsql_test( DELETE FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -808,7 +808,7 @@ test:do_catchsql_test( UPDATE t1 SET b = 'five' WHERE b = 'two'; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -818,7 +818,7 @@ test:do_catchsql_test( DELETE FROM t1 WHERE b = 'two'; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -828,7 +828,7 @@ test:do_catchsql_test( INSERT INTO t2 VALUES('five'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -885,7 +885,7 @@ test:do_catchsql_test( DELETE FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -942,7 +942,7 @@ test:do_catchsql_test( INSERT INTO down(c39, c38) VALUES('yes', 'no'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -954,7 +954,7 @@ test:do_catchsql_test( DELETE FROM up WHERE c34 = 'yes'; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1007,7 +1007,7 @@ test:do_execsql_test( -- INSERT INTO t3 VALUES(1, 2, 3); -- ]], { -- -- --- 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" +-- 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- -- -- }) @@ -1027,7 +1027,7 @@ test:do_execsql_test( -- UPDATE t4 SET b = 5; -- ]], { -- -- --- 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" +-- 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- -- -- }) @@ -1183,7 +1183,7 @@ test:do_catchsql_test( UPDATE self SET b = 15; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1193,7 +1193,7 @@ test:do_catchsql_test( UPDATE self SET a = 15; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1203,7 +1203,7 @@ test:do_catchsql_test( UPDATE self SET a = 15, b = 16; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1231,7 +1231,7 @@ test:do_catchsql_test( INSERT INTO self(a,b) VALUES(20, 21); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1253,7 +1253,7 @@ test:do_catchsql_test( UPDATE self SET b = 15; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1263,7 +1263,7 @@ test:do_catchsql_test( UPDATE self SET a = 15; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1273,7 +1273,7 @@ test:do_catchsql_test( UPDATE self SET a = 15, b = 16; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1301,7 +1301,7 @@ test:do_catchsql_test( INSERT INTO self(a,b) VALUES(20, 21); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1328,7 +1328,7 @@ test:do_catchsql_test( DELETE FROM tdd08; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1348,7 +1348,7 @@ test:do_catchsql_test( INSERT INTO tdd08_b(w,x,y) VALUES(400,500,300); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1358,7 +1358,7 @@ test:do_catchsql_test( UPDATE tdd08_b SET x=x+1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1368,7 +1368,7 @@ test:do_catchsql_test( UPDATE tdd08 SET a=a+1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1394,7 +1394,7 @@ test:do_catchsql_test( UPDATE tce71 set b = 201 where a = 100; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1404,7 +1404,7 @@ test:do_catchsql_test( UPDATE tce71 set a = 101 where a = 100; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1429,7 +1429,7 @@ test:do_catchsql_test( UPDATE tce73 set b = 201 where a = 100; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -1439,7 +1439,7 @@ test:do_catchsql_test( UPDATE tce71 set a = 101 where a = 100; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/fkey3.test.lua b/test/sql-tap/fkey3.test.lua index c66b5e0..900ac32 100755 --- a/test/sql-tap/fkey3.test.lua +++ b/test/sql-tap/fkey3.test.lua @@ -122,7 +122,7 @@ test:do_catchsql_test( INSERT INTO t3 VALUES(2, 2, 5, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -132,7 +132,7 @@ test:do_catchsql_test( INSERT INTO t3 VALUES(2, 3, 5, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -151,7 +151,7 @@ test:do_catchsql_test( INSERT INTO t4 VALUES(2, 1); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -175,7 +175,7 @@ test:do_catchsql_test( INSERT INTO t6(a,b,c,d) VALUES(4, 'a', 65, 'a'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -197,7 +197,7 @@ test:do_catchsql_test( UPDATE t6 SET c = 1, d = 'a' WHERE a = 100; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -219,7 +219,7 @@ test:do_catchsql_test( INSERT INTO t7 VALUES('x', 450, 'x', 4); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -229,7 +229,7 @@ test:do_catchsql_test( INSERT INTO t7 VALUES('x', 450, 'x', 451); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -253,7 +253,7 @@ test:do_catchsql_test( UPDATE t8 SET d = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -282,7 +282,7 @@ test:do_catchsql_test( UPDATE TestTable SET parent_id=1000 WHERE id=2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/fkey4.test.lua b/test/sql-tap/fkey4.test.lua index 3a03cd5..ea77278 100755 --- a/test/sql-tap/fkey4.test.lua +++ b/test/sql-tap/fkey4.test.lua @@ -30,7 +30,7 @@ test:do_catchsql_test( DELETE FROM p1 WHERE a = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: NOT NULL constraint failed: C1.B" + 1, "Failed to execute SQL statement: NOT NULL constraint failed: C1.B" -- }) @@ -83,7 +83,7 @@ test:do_catchsql_test( DELETE FROM p1 WHERE a = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -159,7 +159,7 @@ test:do_catchsql_test( UPDATE OR IGNORE p1 SET a = 4 WHERE a = 2; ]], { -- - 1, "Error during execution of VDBE byte-code: NOT NULL constraint failed: C1.B" + 1, "Failed to execute SQL statement: NOT NULL constraint failed: C1.B" -- }) @@ -203,7 +203,7 @@ test:do_catchsql_test( INSERT OR REPLACE INTO p1 VALUES(2, 'two'); ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) @@ -278,7 +278,7 @@ test:do_catchsql_test( DELETE FROM p3 WHERE a=1; ]], { -- - 1, "Error during execution of VDBE byte-code: FOREIGN KEY constraint failed" + 1, "Failed to execute SQL statement: FOREIGN KEY constraint failed" -- }) diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua index a7fff6e..f6f1eb1 100755 --- a/test/sql-tap/func.test.lua +++ b/test/sql-tap/func.test.lua @@ -1598,7 +1598,7 @@ test:do_catchsql_test( SELECT sum(x) - ((1<<62)*2.0+1) from t6; ]], { -- - 1, "Error during execution of VDBE byte-code: integer overflow" + 1, "Failed to execute SQL statement: integer overflow" -- }) @@ -1653,7 +1653,7 @@ test:do_catchsql_test( SELECT 10 AS x); ]], { -- - 1, "Error during execution of VDBE byte-code: integer overflow" + 1, "Failed to execute SQL statement: integer overflow" -- }) @@ -1665,7 +1665,7 @@ test:do_catchsql_test( SELECT -10 AS x); ]], { -- - 1, "Error during execution of VDBE byte-code: integer overflow" + 1, "Failed to execute SQL statement: integer overflow" -- }) @@ -1730,7 +1730,7 @@ test:do_catchsql_test( SELECT abs(-9223372036854775807-1); ]], { -- - 1, "Error during execution of VDBE byte-code: integer overflow" + 1, "Failed to execute SQL statement: integer overflow" -- }) @@ -1752,7 +1752,7 @@ test:do_catchsql_test( SELECT 'abc' MATCH 'xyz'; ]], { -- - 1, "Error during execution of VDBE byte-code: unable to use function MATCH in the requested context" + 1, "Failed to execute SQL statement: unable to use function MATCH in the requested context" -- }) @@ -1762,7 +1762,7 @@ test:do_catchsql_test( SELECT 'abc' NOT MATCH 'xyz'; ]], { -- - 1, "Error during execution of VDBE byte-code: unable to use function MATCH in the requested context" + 1, "Failed to execute SQL statement: unable to use function MATCH in the requested context" -- }) diff --git a/test/sql-tap/gh-2931-savepoints.test.lua b/test/sql-tap/gh-2931-savepoints.test.lua index 85dc7a1..acb8bd4 100755 --- a/test/sql-tap/gh-2931-savepoints.test.lua +++ b/test/sql-tap/gh-2931-savepoints.test.lua @@ -38,7 +38,7 @@ local testcases = { {0,{1,1}}}, {"5", [[rollback to savepoint s1_2;]], - {1, "Error during execution of VDBE byte-code: no such savepoint: S1_2"}}, + {1, "Failed to execute SQL statement: no such savepoint: S1_2"}}, {"6", [[insert into t1 values(2); select * from t1 union all select * from t2;]], @@ -80,13 +80,13 @@ local testcases = { {0,{1,2,10,11,1,2,4,10,11}}}, {"14", [[insert into t1 values(4);]], - {1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"}}, + {1,"Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"}}, {"15", [[select * from t1 union all select * from t2;]], {0,{1,2,10,11,1,2,4,10,11}}}, {"16", [[insert or rollback into t1 values(4);]], - {1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"}}, + {1,"Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"}}, {"17", -- should work as transaction is rolled back [[insert or rollback into t1 values(4); select * from t1 union all select * from t2;]], diff --git a/test/sql-tap/gh-3251-string-pattern-comparison.test.lua b/test/sql-tap/gh-3251-string-pattern-comparison.test.lua index 0e0a003..dec3cce 100755 --- a/test/sql-tap/gh-3251-string-pattern-comparison.test.lua +++ b/test/sql-tap/gh-3251-string-pattern-comparison.test.lua @@ -142,17 +142,17 @@ for i, tested_string in ipairs(invalid_testcases) do local test_name = prefix .. "2." .. tostring(i) local test_itself = "SELECT 'abc' LIKE 'ab" .. tested_string .. "';" test:do_catchsql_test(test_name, test_itself, - {1, "Error during execution of VDBE byte-code: LIKE pattern can only contain UTF-8 characters"}) + {1, "Failed to execute SQL statement: LIKE pattern can only contain UTF-8 characters"}) test_name = prefix .. "3." .. tostring(i) test_itself = "SELECT 'abc' LIKE 'abc" .. tested_string .. "';" test:do_catchsql_test(test_name, test_itself, - {1, "Error during execution of VDBE byte-code: LIKE pattern can only contain UTF-8 characters"}) + {1, "Failed to execute SQL statement: LIKE pattern can only contain UTF-8 characters"}) test_name = prefix .. "4." .. tostring(i) test_itself = "SELECT 'abc' LIKE 'ab" .. tested_string .. "c';" test:do_catchsql_test(test_name, test_itself, - {1, "Error during execution of VDBE byte-code: LIKE pattern can only contain UTF-8 characters"}) + {1, "Failed to execute SQL statement: LIKE pattern can only contain UTF-8 characters"}) -- Just skipping if row value predicand contains invalid character. diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua index 2369be7..859a6ff 100755 --- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua +++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua @@ -139,7 +139,7 @@ test:do_catchsql_xfer_test( INSERT INTO t2 SELECT * FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" -- }, { exp_xfer_count = 0 @@ -210,7 +210,7 @@ test:do_catchsql_xfer_test( INSERT INTO t2 SELECT * FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" -- }, { exp_xfer_count = 0 @@ -245,7 +245,7 @@ test:do_catchsql_xfer_test( INSERT OR ABORT INTO t2 SELECT * FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" -- }, { exp_xfer_count = 1 @@ -313,7 +313,7 @@ test:do_catchsql_xfer_test( INSERT OR ROLLBACK INTO t2 SELECT * FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" -- }, { exp_xfer_count = 0 @@ -381,7 +381,7 @@ test:do_catchsql_xfer_test( INSERT OR FAIL INTO t2 SELECT * FROM t1; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'" -- }, { exp_xfer_count = 1 diff --git a/test/sql-tap/gh2259-in-stmt-trans.test.lua b/test/sql-tap/gh2259-in-stmt-trans.test.lua index 1ac0d53..36f5e90 100755 --- a/test/sql-tap/gh2259-in-stmt-trans.test.lua +++ b/test/sql-tap/gh2259-in-stmt-trans.test.lua @@ -18,7 +18,7 @@ for _, prefix in pairs({"BEFORE", "AFTER"}) do test:do_catchsql_test(prefix..'_insert1', 'INSERT INTO t1 VALUES(1, 2)', - {1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) + {1,"Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) test:do_execsql_test(prefix..'_insert1_check1', 'SELECT * FROM t1', @@ -34,7 +34,7 @@ for _, prefix in pairs({"BEFORE", "AFTER"}) do test:do_catchsql_test(prefix..'_update1', 'UPDATE t1 SET s1=1', - {1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) + {1,"Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) test:do_execsql_test(prefix..'_update1_check1', 'SELECT * FROM t1', @@ -52,7 +52,7 @@ for _, prefix in pairs({"BEFORE", "AFTER"}) do test:do_catchsql_test(prefix..'delete1', 'DELETE FROM t1;', - {1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) + {1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) -- Nothing should be inserted due to abort test:do_execsql_test('delete1_check1', @@ -69,7 +69,7 @@ end -- Check multi-insert test:do_catchsql_test('insert2', 'INSERT INTO t1 VALUES (5, 6), (6, 7)', - {1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) + {1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_2' in space 'T2'"}) test:do_execsql_test('insert2_check', 'SELECT * FROM t1;', {3, 3}) diff --git a/test/sql-tap/gh2964-abort.test.lua b/test/sql-tap/gh2964-abort.test.lua index 82aa3e4..fce691a 100755 --- a/test/sql-tap/gh2964-abort.test.lua +++ b/test/sql-tap/gh2964-abort.test.lua @@ -12,7 +12,7 @@ test:do_catchsql_test( test_prefix.."1.0.2", "CREATE TABLE t2 (a int primary key);") -local insert_err = {1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"} +local insert_err = {1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T2_1' in space 'T2'"} local data = { --id|TRIG TYPE|INSERT TYPE|insert error|commit error| result {1, "AFTER", "or abort", insert_err, {0}, {1,1,2}}, diff --git a/test/sql-tap/intpkey.test.lua b/test/sql-tap/intpkey.test.lua index 3ec3771..b2e8084 100755 --- a/test/sql-tap/intpkey.test.lua +++ b/test/sql-tap/intpkey.test.lua @@ -96,7 +96,7 @@ test:do_catchsql_test( INSERT INTO t1 VALUES(5,'second','entry'); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" -- }) diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua index 55c0c13..abd2be5 100755 --- a/test/sql-tap/misc1.test.lua +++ b/test/sql-tap/misc1.test.lua @@ -383,7 +383,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(1,2,4); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T5_1' in space 'T5'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T5_1' in space 'T5'" -- }) diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua index 4470bce..5b793c0 100755 --- a/test/sql-tap/table.test.lua +++ b/test/sql-tap/table.test.lua @@ -722,7 +722,7 @@ test:do_catchsql_test( INSERT INTO t6 VALUES(NULL); ]], { -- - 1, "Error during execution of VDBE byte-code: NOT NULL constraint failed: T6.A" + 1, "Failed to execute SQL statement: NOT NULL constraint failed: T6.A" -- }) @@ -1211,7 +1211,7 @@ test:do_catchsql_test( INSERT INTO T21 VALUES(1, 2, 2); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T21_1' in space 'T21'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T21_1' in space 'T21'" -- }) @@ -1221,7 +1221,7 @@ test:do_catchsql_test( INSERT INTO T21 VALUES(1, -1, 1); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T21" + 1, "Failed to execute SQL statement: CHECK constraint failed: T21" -- }) @@ -1231,7 +1231,7 @@ test:do_catchsql_test( INSERT INTO T21 VALUES(1, 1, -1); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: T21" + 1, "Failed to execute SQL statement: CHECK constraint failed: T21" -- }) @@ -1283,7 +1283,7 @@ test:do_catchsql_test( INSERT INTO T22 VALUES(2, 1, 1); ]], { -- - 1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'unique_ONE_2' in space 'T22'" + 1,"Failed to execute SQL statement: Duplicate key exists in unique index 'unique_ONE_2' in space 'T22'" -- }) @@ -1308,7 +1308,7 @@ test:do_catchsql_test( INSERT INTO T24 VALUES(2, 1, 1); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'unique_TWO_2' in space 'T24'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'unique_TWO_2' in space 'T24'" -- }) @@ -1362,7 +1362,7 @@ test:do_catchsql_test( INSERT INTO T28 VALUES(11); ]], { -- - 1,"Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T28_1' in space 'T28'" + 1,"Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T28_1' in space 'T28'" -- }) @@ -1372,7 +1372,7 @@ test:do_catchsql_test( INSERT INTO T28 VALUES(0); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: CHECK1" + 1, "Failed to execute SQL statement: CHECK constraint failed: CHECK1" -- }) @@ -1382,7 +1382,7 @@ test:do_catchsql_test( INSERT INTO T28 VALUES(9); ]], { -- - 1, "Error during execution of VDBE byte-code: CHECK constraint failed: CHECK2" + 1, "Failed to execute SQL statement: CHECK constraint failed: CHECK2" -- }) diff --git a/test/sql-tap/tkt-4a03edc4c8.test.lua b/test/sql-tap/tkt-4a03edc4c8.test.lua index 703bf74..0f44d4f 100755 --- a/test/sql-tap/tkt-4a03edc4c8.test.lua +++ b/test/sql-tap/tkt-4a03edc4c8.test.lua @@ -38,7 +38,7 @@ test:do_test( ]] end, { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" -- }) diff --git a/test/sql-tap/trigger1.test.lua b/test/sql-tap/trigger1.test.lua index bf1857f..a7dafd4 100755 --- a/test/sql-tap/trigger1.test.lua +++ b/test/sql-tap/trigger1.test.lua @@ -251,7 +251,7 @@ test:do_catchsql_test( end; ]], { -- - 1, "Error during execution of VDBE byte-code: SQL error: cannot create INSTEAD OF trigger on space: T1" + 1, "Failed to execute SQL statement: SQL error: cannot create INSTEAD OF trigger on space: T1" -- }) @@ -265,7 +265,7 @@ test:do_catchsql_test( end; ]], { -- - 1, "Error during execution of VDBE byte-code: SQL error: cannot create BEFORE trigger on view: V1" + 1, "Failed to execute SQL statement: SQL error: cannot create BEFORE trigger on view: V1" -- }) @@ -280,7 +280,7 @@ test:do_catchsql_test( end; ]], { -- - 1, "Error during execution of VDBE byte-code: SQL error: cannot create AFTER trigger on view: V1" + 1, "Failed to execute SQL statement: SQL error: cannot create AFTER trigger on view: V1" -- }) @@ -495,7 +495,7 @@ test:do_catchsql_test( DELETE FROM t2 ]], { -- - 1, "Error during execution of VDBE byte-code: deletes are not permitted" + 1, "Failed to execute SQL statement: deletes are not permitted" -- }) @@ -857,7 +857,7 @@ test:do_catchsql_test( INSERT INTO t16 values(1); END; ]], { - 1, [[Error during execution of VDBE byte-code: Space _trigger does not support multi-statement transactions]] + 1, [[Failed to execute SQL statement: Space _trigger does not support multi-statement transactions]] }) test:execsql [[ @@ -870,7 +870,7 @@ test:do_catchsql_test( START TRANSACTION; DROP TRIGGER t16err3; ]], { - 1, [[Error during execution of VDBE byte-code: Space _trigger does not support multi-statement transactions]] + 1, [[Failed to execute SQL statement: Space _trigger does not support multi-statement transactions]] }) -- MUST_WORK_TEST -- #------------------------------------------------------------------------- diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua index 76558f1..c050fb2 100755 --- a/test/sql-tap/triggerC.test.lua +++ b/test/sql-tap/triggerC.test.lua @@ -165,7 +165,7 @@ test:do_test( return test:catchsql " DELETE FROM t4 " end, { -- - 1, "Error during execution of VDBE byte-code: delete is not supported" + 1, "Failed to execute SQL statement: delete is not supported" -- }) @@ -199,7 +199,7 @@ test:do_catchsql_test( UPDATE OR REPLACE t5 SET a = 4 WHERE a = 1 ]], { -- - 1, "Error during execution of VDBE byte-code: too many levels of trigger recursion" + 1, "Failed to execute SQL statement: too many levels of trigger recursion" -- }) @@ -285,7 +285,7 @@ tests = { {[[ CREATE TRIGGER t2_trig AFTER INSERT ON t2 WHEN (new.a>0) BEGIN {[[ CREATE TRIGGER t2_trig BEFORE INSERT ON t2 BEGIN INSERT INTO t2 VALUES(new.a - 1); - END;]], {1, "Error during execution of VDBE byte-code: too many levels of trigger recursion"}}, + END;]], {1, "Failed to execute SQL statement: too many levels of trigger recursion"}}, {[[ CREATE TRIGGER t2_trig AFTER INSERT ON t2 WHEN (new.a>0) BEGIN INSERT OR IGNORE INTO t2 VALUES(new.a); @@ -293,7 +293,7 @@ tests = { {[[ CREATE TRIGGER t2_trig AFTER INSERT ON t2 WHEN (new.a>0) BEGIN {[[ CREATE TRIGGER t2_trig BEFORE INSERT ON t2 WHEN (new.a>0) BEGIN INSERT OR IGNORE INTO t2 VALUES(new.a); - END;]], {1, "Error during execution of VDBE byte-code: too many levels of trigger recursion"}}} + END;]], {1, "Failed to execute SQL statement: too many levels of trigger recursion"}}} for n, v in ipairs(tests) do test:do_test( @@ -382,7 +382,7 @@ test:do_catchsql_test( INSERT INTO t3 VALUES(0,0) ]], { -- - 1, "Error during execution of VDBE byte-code: too many levels of trigger recursion" + 1, "Failed to execute SQL statement: too many levels of trigger recursion" -- }) @@ -411,7 +411,7 @@ test:do_catchsql_test( INSERT INTO t3b VALUES(1); ]], { -- - 1, "Error during execution of VDBE byte-code: too many levels of trigger recursion" + 1, "Failed to execute SQL statement: too many levels of trigger recursion" -- }) @@ -908,7 +908,7 @@ test:do_catchsql_test( UPDATE t12 SET a=a+1, b=b+1; ]], { -- - 1, "Error during execution of VDBE byte-code: too many levels of trigger recursion" + 1, "Failed to execute SQL statement: too many levels of trigger recursion" -- }) diff --git a/test/sql-tap/unique.test.lua b/test/sql-tap/unique.test.lua index 927c419..7ec7651 100755 --- a/test/sql-tap/unique.test.lua +++ b/test/sql-tap/unique.test.lua @@ -70,7 +70,7 @@ test:do_catchsql_test( INSERT INTO t1(a,b,c) VALUES(1,3,4) ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'pk_unnamed_T1_1' in space 'T1'" -- }) @@ -91,7 +91,7 @@ test:do_catchsql_test( INSERT INTO t1(a,b,c) VALUES(3,2,4) ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'unique_unnamed_T1_2' in space 'T1'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'unique_unnamed_T1_2' in space 'T1'" -- }) @@ -167,7 +167,7 @@ test:do_catchsql_test( INSERT INTO t2 VALUES(3, 1,5); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'I2' in space 'T2'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'I2' in space 'T2'" -- }) @@ -287,7 +287,7 @@ test:do_catchsql_test( SELECT a,b,c,d FROM t3 ORDER BY a,b,c,d; ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'unique_unnamed_T3_2' in space 'T3'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'unique_unnamed_T3_2' in space 'T3'" -- }) @@ -444,7 +444,7 @@ test:do_catchsql_test( INSERT INTO t5 VALUES(2, 1,2,3,4,5,6); ]], { -- - 1, "Error during execution of VDBE byte-code: Duplicate key exists in unique index 'unique_unnamed_T5_2' in space 'T5'" + 1, "Failed to execute SQL statement: Duplicate key exists in unique index 'unique_unnamed_T5_2' in space 'T5'" -- }) diff --git a/test/sql/collation.result b/test/sql/collation.result index cc1b1a9..397f653 100644 --- a/test/sql/collation.result +++ b/test/sql/collation.result @@ -426,7 +426,7 @@ box.execute("INSERT INTO t1 VALUES (1,'a');") -- Should fail. box.execute("UPDATE t0 SET s1 = 'A';") --- -- error: 'Error during execution of VDBE byte-code: FOREIGN KEY constraint failed' +- error: 'Failed to execute SQL statement: FOREIGN KEY constraint failed' ... box.execute("SELECT * FROM t1;") --- @@ -676,8 +676,8 @@ box.execute("INSERT INTO t3b VALUES ('A');") ... box.execute("INSERT INTO t3b VALUES ('a');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3B_1'' in space ''T3B''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3B_1'' + in space ''T3B''' ... box.execute("SELECT * FROM t3b;") --- @@ -741,8 +741,8 @@ box.execute("INSERT INTO t3c VALUES ('A');") ... box.execute("INSERT INTO t3c VALUES ('a');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3C_1'' in space ''T3C''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3C_1'' + in space ''T3C''' ... box.execute("SELECT * FROM t3c;") --- @@ -806,8 +806,8 @@ box.execute("INSERT INTO t3d VALUES ('A');") ... box.execute("INSERT INTO t3d VALUES ('a');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3D_1'' in space ''T3D''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3D_1'' + in space ''T3D''' ... box.execute("SELECT * FROM t3d;") --- @@ -837,8 +837,8 @@ box.execute("INSERT INTO t3e VALUES ('a');") ... box.execute("INSERT INTO t3e VALUES ('A');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3E_1'' in space ''T3E''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3E_1'' + in space ''T3E''' ... box.execute("SELECT * FROM t3e;") --- @@ -901,8 +901,8 @@ box.execute("INSERT INTO t3f VALUES ('A');") ... box.execute("INSERT INTO t3f VALUES ('a');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3F_1'' in space ''T3F''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3F_1'' + in space ''T3F''' ... box.execute("SELECT * FROM t3f;") --- @@ -932,8 +932,8 @@ box.execute("INSERT INTO t3g VALUES ('a');") ... box.execute("INSERT INTO t3g VALUES ('A');") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_T3G_1'' in space ''T3G''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_T3G_1'' + in space ''T3G''' ... box.execute("SELECT * FROM t3g;") --- diff --git a/test/sql/errinj.result b/test/sql/errinj.result index 4b26560..63fa9d9 100644 --- a/test/sql/errinj.result +++ b/test/sql/errinj.result @@ -189,7 +189,7 @@ box.error.injection.set("ERRINJ_WAL_IO", true) ... box.execute("CREATE TRIGGER t1t INSERT ON t1 BEGIN INSERT INTO t2 VALUES (1, 1); END;") --- -- error: 'Error during execution of VDBE byte-code: Failed to write to disk' +- error: 'Failed to execute SQL statement: Failed to write to disk' ... box.execute("CREATE INDEX t1a ON t1(a);") --- @@ -257,7 +257,7 @@ box.error.injection.set("ERRINJ_WAL_IO", true) ... box.execute("DROP TRIGGER t1t;") --- -- error: 'Error during execution of VDBE byte-code: Failed to write to disk' +- error: 'Failed to execute SQL statement: Failed to write to disk' ... box.error.injection.set("ERRINJ_WAL_IO", false) --- @@ -334,7 +334,7 @@ errinj.set("ERRINJ_WAL_IO", false) ... box.execute("INSERT INTO t3 VALUES (1, 2, 2);") --- -- error: 'Error during execution of VDBE byte-code: FOREIGN KEY constraint failed' +- error: 'Failed to execute SQL statement: FOREIGN KEY constraint failed' ... errinj.set("ERRINJ_WAL_IO", true) --- @@ -366,7 +366,7 @@ box.execute("ALTER TABLE t3 ADD CONSTRAINT fk1 FOREIGN KEY (b) REFERENCES t3;") ... box.execute("INSERT INTO t3 VALUES(1, 1, 3);") --- -- error: 'Error during execution of VDBE byte-code: FOREIGN KEY constraint failed' +- error: 'Failed to execute SQL statement: FOREIGN KEY constraint failed' ... errinj.set("ERRINJ_WAL_IO", true) --- @@ -374,11 +374,11 @@ errinj.set("ERRINJ_WAL_IO", true) ... box.execute("ALTER TABLE t3 DROP CONSTRAINT fk1;") --- -- error: 'Error during execution of VDBE byte-code: Failed to write to disk' +- error: 'Failed to execute SQL statement: Failed to write to disk' ... box.execute("INSERT INTO t3 VALUES(1, 1, 3);") --- -- error: 'Error during execution of VDBE byte-code: FOREIGN KEY constraint failed' +- error: 'Failed to execute SQL statement: FOREIGN KEY constraint failed' ... errinj.set("ERRINJ_WAL_IO", false) --- diff --git a/test/sql/foreign-keys.result b/test/sql/foreign-keys.result index 293492e..f0ff70d 100644 --- a/test/sql/foreign-keys.result +++ b/test/sql/foreign-keys.result @@ -181,8 +181,8 @@ t = box.space._fk_constraint:insert(t) -- box.execute("DROP INDEX i1 on t1;") --- -- error: 'Error during execution of VDBE byte-code: Can''t modify space ''T1'': can - not drop a referenced index' +- error: 'Failed to execute SQL statement: Can''t modify space ''T1'': can not drop + a referenced index' ... -- Referenced index can't be altered as well, if alter leads to -- rebuild of index (e.g. index still can be renamed). diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result index 00bfe91..ee5ab4c 100644 --- a/test/sql/gh-2981-check-autoinc.result +++ b/test/sql/gh-2981-check-autoinc.result @@ -29,7 +29,7 @@ box.execute("insert into t1 values (18, null);") ... box.execute("insert into t1(s2) values (null);") --- -- error: 'Error during execution of VDBE byte-code: CHECK constraint failed: T1' +- error: 'Failed to execute SQL statement: CHECK constraint failed: T1' ... box.execute("insert into t2 values (18, null);") --- @@ -37,7 +37,7 @@ box.execute("insert into t2 values (18, null);") ... box.execute("insert into t2(s2) values (null);") --- -- error: 'Error during execution of VDBE byte-code: CHECK constraint failed: T2' +- error: 'Failed to execute SQL statement: CHECK constraint failed: T2' ... box.execute("insert into t2 values (24, null);") --- @@ -45,7 +45,7 @@ box.execute("insert into t2 values (24, null);") ... box.execute("insert into t2(s2) values (null);") --- -- error: 'Error during execution of VDBE byte-code: CHECK constraint failed: T2' +- error: 'Failed to execute SQL statement: CHECK constraint failed: T2' ... box.execute("insert into t3 values (9, null)") --- @@ -53,7 +53,7 @@ box.execute("insert into t3 values (9, null)") ... box.execute("insert into t3(s2) values (null)") --- -- error: 'Error during execution of VDBE byte-code: CHECK constraint failed: T3' +- error: 'Failed to execute SQL statement: CHECK constraint failed: T3' ... box.execute("DROP TABLE t1") --- diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result index a18f9ff..75354de 100644 --- a/test/sql/insert-unique.result +++ b/test/sql/insert-unique.result @@ -28,14 +28,14 @@ box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)") -- PK must be unique box.execute("INSERT INTO zoobar VALUES (112, 222, 'c3', 444)") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_ZOOBAR_1'' in space ''ZOOBAR''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_ZOOBAR_1'' + in space ''ZOOBAR''' ... -- Unique index must be respected box.execute("INSERT INTO zoobar VALUES (111, 223, 'c3', 444)") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''ZOOBAR2'' in space ''ZOOBAR''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''ZOOBAR2'' + in space ''ZOOBAR''' ... -- Cleanup box.execute("DROP INDEX zoobar2 ON zoobar") diff --git a/test/sql/persistency.result b/test/sql/persistency.result index 9e5994b..8ba42cb 100644 --- a/test/sql/persistency.result +++ b/test/sql/persistency.result @@ -31,8 +31,8 @@ box.execute("INSERT INTO foobar VALUES (1000, 'foobar')") ... box.execute("INSERT INTO foobar VALUES (1, 'duplicate')") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_FOOBAR_1'' in space ''FOOBAR''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_FOOBAR_1'' + in space ''FOOBAR''' ... -- simple select box.execute("SELECT bar, foo, 42, 'awesome' FROM foobar") @@ -416,8 +416,8 @@ box.execute("SELECT \"name\", \"opts\" FROM \"_trigger\"") -- prove barfoo2 still exists box.execute("INSERT INTO barfoo VALUES ('xfoo', 1)") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_BARFOO_1'' in space ''BARFOO''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_BARFOO_1'' + in space ''BARFOO''' ... box.execute("SELECT * FROM barfoo") --- diff --git a/test/sql/row-count.result b/test/sql/row-count.result index fe48430..657f03a 100644 --- a/test/sql/row-count.result +++ b/test/sql/row-count.result @@ -272,8 +272,7 @@ box.execute("SELECT ROW_COUNT();") ... box.execute("COMMIT;") --- -- error: 'Error during execution of VDBE byte-code: cannot commit - no transaction - is active' +- error: 'Failed to execute SQL statement: cannot commit - no transaction is active' ... box.execute("SELECT ROW_COUNT();") --- diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result index d378172..3cebc65 100644 --- a/test/sql/savepoints.result +++ b/test/sql/savepoints.result @@ -67,7 +67,7 @@ end; ... release_sv_fail(); --- -- error: 'Error during execution of VDBE byte-code: no such savepoint: T1' +- error: 'Failed to execute SQL statement: no such savepoint: T1' ... box.commit(); --- diff --git a/test/sql/transition.result b/test/sql/transition.result index b348730..19212c5 100644 --- a/test/sql/transition.result +++ b/test/sql/transition.result @@ -28,8 +28,8 @@ box.execute("INSERT INTO foobar VALUES (1000, 'foobar')") ... box.execute("INSERT INTO foobar VALUES (1, 'duplicate')") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_FOOBAR_1'' in space ''FOOBAR''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_FOOBAR_1'' + in space ''FOOBAR''' ... -- simple select box.execute("SELECT bar, foo, 42, 'awesome' FROM foobar") @@ -312,8 +312,8 @@ box.execute("INSERT INTO barfoo VALUES ('foobar', 1000)") -- prove barfoo2 was created box.execute("INSERT INTO barfoo VALUES ('xfoo', 1)") --- -- error: 'Error during execution of VDBE byte-code: Duplicate key exists in unique - index ''pk_unnamed_BARFOO_1'' in space ''BARFOO''' +- error: 'Failed to execute SQL statement: Duplicate key exists in unique index ''pk_unnamed_BARFOO_1'' + in space ''BARFOO''' ... box.execute("SELECT foo, bar FROM barfoo") --- diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result index 82e0406..72b19d2 100644 --- a/test/sql/transitive-transactions.result +++ b/test/sql/transitive-transactions.result @@ -100,7 +100,7 @@ end; ... fk_defer(); --- -- error: 'Error during execution of VDBE byte-code: FOREIGN KEY constraint failed' +- error: 'Failed to execute SQL statement: FOREIGN KEY constraint failed' ... box.space.CHILD:select(); --- diff --git a/test/sql/triggers.result b/test/sql/triggers.result index 3f0f388..9ec932f 100644 --- a/test/sql/triggers.result +++ b/test/sql/triggers.result @@ -486,7 +486,7 @@ space_id = box.space.T1.id ... box.execute("CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.a = ? BEGIN SELECT 1; END;") --- -- error: 'Error during execution of VDBE byte-code: bindings are not allowed in DDL' +- error: 'Failed to execute SQL statement: bindings are not allowed in DDL' ... tuple = {"TR1", space_id, {sql = [[CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.a = ? BEGIN SELECT 1; END;]]}} --- New patch: commit 64bd59449df2a45be02670249a69e80cd87ef3b0 Author: Mergen Imeev Date: Sat Mar 16 14:15:22 2019 +0300 sql: fix error code for SQL errors in execute.c Currently, functions sql_execute() and sql_prepare_and_execute() set the ER_SQL_EXECUTE code for all errors that occur during the execution of a SQL command. This is considered incorrect because some of these errors may have their own error code. After this patch, only errors without an error code will have the error code ER_SQL_EXECUTE. Part of #3505 diff --git a/src/box/execute.c b/src/box/execute.c index 7c77df2..d45fb12 100644 --- a/src/box/execute.c +++ b/src/box/execute.c @@ -523,7 +523,12 @@ sql_execute(sql *db, struct sql_stmt *stmt, struct port *port, assert(rc != SQL_ROW && rc != SQL_OK); } if (rc != SQL_DONE) { - diag_set(ClientError, ER_SQL_EXECUTE, sql_errmsg(db)); + if (db->errCode != SQL_TARANTOOL_ERROR) { + const char *err = (char *)sql_value_text(db->pErr); + if (err == NULL) + err = sqlErrStr(db->errCode); + diag_set(ClientError, ER_SQL_EXECUTE, err); + } return -1; } return 0; @@ -541,7 +546,12 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind, return -1; } if (sql_prepare_v2(db, sql, len, &stmt, NULL) != SQL_OK) { - diag_set(ClientError, ER_SQL_EXECUTE, sql_errmsg(db)); + if (db->errCode != SQL_TARANTOOL_ERROR) { + const char *err = (char *)sql_value_text(db->pErr); + if (err == NULL) + err = sqlErrStr(db->errCode); + diag_set(ClientError, ER_SQL_EXECUTE, err); + } return -1; } assert(stmt != NULL); diff --git a/test/sql/collation.result b/test/sql/collation.result index 90a9f72..ac8cff2 100644 --- a/test/sql/collation.result +++ b/test/sql/collation.result @@ -102,7 +102,7 @@ cn = remote.connect(box.cfg.listen) ... cn:execute('select 1 limit ? collate not_exist', {1}) --- -- error: 'Failed to execute SQL statement: Syntax error near ''COLLATE''' +- error: Syntax error near 'COLLATE' ... cn:close() --- diff --git a/test/sql/gh-2362-select-access-rights.result b/test/sql/gh-2362-select-access-rights.result index 0e5b9bf..8f1ecfa 100644 --- a/test/sql/gh-2362-select-access-rights.result +++ b/test/sql/gh-2362-select-access-rights.result @@ -46,8 +46,7 @@ c = nb.connect(box.cfg.listen) ... c:execute("SELECT * FROM t1;") --- -- error: 'Failed to execute SQL statement: Read access to space ''T1'' is denied for - user ''guest''' +- error: Read access to space 'T1' is denied for user 'guest' ... box.schema.user.grant('guest','read', 'space', 'T2') --- @@ -57,8 +56,7 @@ c = nb.connect(box.cfg.listen) ... c:execute('SELECT * FROM t1, t2 WHERE t1.s1 = t2.s1') --- -- error: 'Failed to execute SQL statement: Read access to space ''T1'' is denied for - user ''guest''' +- error: Read access to space 'T1' is denied for user 'guest' ... box.sql.execute("CREATE VIEW v AS SELECT * FROM t1") --- @@ -71,8 +69,7 @@ v = nb.connect(box.cfg.listen) ... c:execute('SELECT * FROM v') --- -- error: 'Failed to execute SQL statement: Read access to space ''T1'' is denied for - user ''guest''' +- error: Read access to space 'T1' is denied for user 'guest' ... box.sql.execute('CREATE TABLE t3 (s1 INT PRIMARY KEY, fk INT, FOREIGN KEY (fk) REFERENCES t1(s2))') --- @@ -85,8 +82,7 @@ v = nb.connect(box.cfg.listen) ... c:execute('INSERT INTO t3 VALUES (1, 1)') --- -- error: 'Failed to execute SQL statement: Read access to space ''T1'' is denied for - user ''guest''' +- error: Read access to space 'T1' is denied for user 'guest' ... -- Cleanup box.schema.user.revoke('guest','read','space', 'V') diff --git a/test/sql/iproto.result b/test/sql/iproto.result index afddf05..33e845c 100644 --- a/test/sql/iproto.result +++ b/test/sql/iproto.result @@ -92,11 +92,11 @@ cn:execute('delete from test where a = 12') -- SQL errors. cn:execute('insert into not_existing_table values ("kek")') --- -- error: 'Failed to execute SQL statement: Space ''NOT_EXISTING_TABLE'' does not exist' +- error: Space 'NOT_EXISTING_TABLE' does not exist ... cn:execute('insert qwerty gjsdjq q qwd qmq;; q;qwd;') --- -- error: 'Failed to execute SQL statement: Syntax error near ''qwerty''' +- error: Syntax error near 'qwerty' ... -- Empty result. cn:execute('select id as identifier from test where a = 5;') @@ -109,7 +109,7 @@ cn:execute('select id as identifier from test where a = 5;') -- netbox API errors. cn:execute(100) --- -- error: 'Failed to execute SQL statement: Syntax error near ''100''' +- error: Syntax error near '100' ... cn:execute('select 1', nil, {dry_run = true}) --- @@ -118,11 +118,11 @@ cn:execute('select 1', nil, {dry_run = true}) -- Empty request. cn:execute('') --- -- error: 'Failed to execute SQL statement: Failed to execute an empty SQL statement' +- error: Failed to execute an empty SQL statement ... cn:execute(' ;') --- -- error: 'Failed to execute SQL statement: Failed to execute an empty SQL statement' +- error: Failed to execute an empty SQL statement ... -- -- gh-3467: allow only positive integers under limit clause. @@ -154,18 +154,15 @@ cn:execute('select * from test limit ?', {2}) ... cn:execute('select * from test limit ?', {-2}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - LIMIT clause' +- error: Only positive integers are allowed in the LIMIT clause ... cn:execute('select * from test limit ?', {2.7}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - LIMIT clause' +- error: Only positive integers are allowed in the LIMIT clause ... cn:execute('select * from test limit ?', {'Hello'}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - LIMIT clause' +- error: Only positive integers are allowed in the LIMIT clause ... cn:execute('select * from test limit 1 offset ?', {2}) --- @@ -181,18 +178,15 @@ cn:execute('select * from test limit 1 offset ?', {2}) ... cn:execute('select * from test limit 1 offset ?', {-2}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - OFFSET clause' +- error: Only positive integers are allowed in the OFFSET clause ... cn:execute('select * from test limit 1 offset ?', {2.7}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - OFFSET clause' +- error: Only positive integers are allowed in the OFFSET clause ... cn:execute('select * from test limit 1 offset ?', {'Hello'}) --- -- error: 'Failed to execute SQL statement: Only positive integers are allowed in the - OFFSET clause' +- error: Only positive integers are allowed in the OFFSET clause ... -- -- Parameters binding. @@ -363,7 +357,7 @@ sql = 'select '..string.rep('?, ', box.schema.SQL_BIND_PARAMETER_MAX)..'?' ... cn:execute(sql) --- -- error: 'Failed to execute SQL statement: SQL bind parameter limit reached: 65000' +- error: 'SQL bind parameter limit reached: 65000' ... -- Try too many parameter values. sql = 'select ?' @@ -567,12 +561,11 @@ cn:execute('drop table if exists test3') -- cn:execute('select ?1, ?2, ?3', {1, 2, 3}) --- -- error: 'Failed to execute SQL statement: Syntax error near ''?1''' +- error: Syntax error near '?1' ... cn:execute('select $name, $name2', {1, 2}) --- -- error: 'Failed to execute SQL statement: Index of binding slots must start from - 1' +- error: Index of binding slots must start from 1 ... parameters = {} ---