[tarantool-patches] [PATCH v1 03/12] sql: rework diag_set() in OP_Halt
imeevma at tarantool.org
imeevma at tarantool.org
Sun May 5 15:17:06 MSK 2019
Prior to this patch, the way to set Tarantool error in OP_Halt was
too universal. It was possible to set a description of the error
that does not match its errcode. This change will also make it
easier to work with an error in OP_Halt, since you no longer need
to create a complete error message.
Example of wrong error code:
...
tarantool> box.execute('select 1 limit true')
---
- error: Only positive integers are allowed in the LIMIT clause
...
tarantool> box.error.last().code
---
- 0
...
---
src/box/sql/build.c | 9 ++-------
src/box/sql/select.c | 13 ++++++-------
src/box/sql/trigger.c | 12 ++++--------
src/box/sql/vdbe.c | 9 +++------
test/sql-tap/e_select1.test.lua | 4 ++--
test/sql-tap/limit.test.lua | 26 +++++++++++++-------------
test/sql-tap/select4.test.lua | 8 ++++----
test/sql-tap/subselect.test.lua | 6 +++---
test/sql-tap/tkt1473.test.lua | 36 ++++++++++++++++++------------------
test/sql/iproto.result | 18 ++++++++++++------
test/sql/types.result | 9 ++++++---
11 files changed, 73 insertions(+), 77 deletions(-)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 1151425..28dcbc3 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1004,12 +1004,10 @@ vdbe_emit_fk_constraint_create(struct Parse *parse_context,
* Lets check that constraint with this name hasn't
* been created before.
*/
- const char *error_msg =
- tt_sprintf(tnt_errcode_desc(ER_CONSTRAINT_EXISTS), name_copy);
if (vdbe_emit_halt_with_presence_test(parse_context,
BOX_FK_CONSTRAINT_ID, 0,
constr_tuple_reg, 2,
- ER_CONSTRAINT_EXISTS, error_msg,
+ ER_CONSTRAINT_EXISTS, name_copy,
false, OP_NoConflict) != 0)
return;
sqlVdbeAddOp2(vdbe, OP_Bool, fk->is_deferred, constr_tuple_reg + 3);
@@ -1392,13 +1390,10 @@ vdbe_emit_fk_constraint_drop(struct Parse *parse_context, char *constraint_name,
sqlVdbeAddOp4(vdbe, OP_String8, 0, key_reg, 0, constraint_name,
P4_DYNAMIC);
sqlVdbeAddOp2(vdbe, OP_Integer, child_id, key_reg + 1);
- const char *error_msg =
- tt_sprintf(tnt_errcode_desc(ER_NO_SUCH_CONSTRAINT),
- constraint_name);
if (vdbe_emit_halt_with_presence_test(parse_context,
BOX_FK_CONSTRAINT_ID, 0,
key_reg, 2, ER_NO_SUCH_CONSTRAINT,
- error_msg, false,
+ constraint_name, false,
OP_Found) != 0) {
sqlDbFree(parse_context->db, constraint_name);
return;
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index d3472a9..3f0b540 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -2116,6 +2116,7 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak)
0, 0,
wrong_limit_error,
P4_STATIC);
+ sqlVdbeChangeP5(v, ER_SQL_EXECUTE);
sqlVdbeResolveLabel(v, positive_limit_label);
VdbeCoverage(v);
@@ -2142,9 +2143,8 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak)
sqlVdbeAddOp2(v, OP_Integer, 1, r1);
int no_err = sqlVdbeMakeLabel(v);
sqlVdbeAddOp3(v, OP_Eq, iLimit, no_err, r1);
- const char *error =
- "SQL error: Expression subquery could "
- "be limited only with 1";
+ const char *error = "Expression subquery could "
+ "be limited only with 1";
sqlVdbeAddOp4(v, OP_Halt,
SQL_TARANTOOL_ERROR,
0, 0, error, P4_STATIC);
@@ -2178,6 +2178,7 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak)
0, 0,
wrong_offset_error,
P4_STATIC);
+ sqlVdbeChangeP5(v, ER_SQL_EXECUTE);
sqlVdbeResolveLabel(v, positive_offset_label);
sqlReleaseTempReg(pParse, r1);
@@ -5446,10 +5447,8 @@ vdbe_code_raise_on_multiple_rows(struct Parse *parser, int limit_reg, int end_ma
int r1 = sqlGetTempReg(parser);
sqlVdbeAddOp2(v, OP_Integer, 0, r1);
sqlVdbeAddOp3(v, OP_Ne, r1, end_mark, limit_reg);
- const char *error =
- "SQL error: Expression subquery returned more than 1 row";
- sqlVdbeAddOp4(v, OP_Halt, SQL_TARANTOOL_ERROR, 0, 0, error,
- P4_STATIC);
+ const char *error = "Expression subquery returned more than 1 row";
+ sqlVdbeAddOp4(v, OP_Halt, SQL_TARANTOOL_ERROR, 0, 0, error, P4_STATIC);
sqlVdbeChangeP5(v, ER_SQL_EXECUTE);
sqlReleaseTempReg(parser, r1);
}
diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c
index 4fdbb60..3005362 100644
--- a/src/box/sql/trigger.c
+++ b/src/box/sql/trigger.c
@@ -100,9 +100,6 @@ sql_trigger_begin(struct Parse *parse)
struct Vdbe *v = sqlGetVdbe(parse);
if (v != NULL)
sqlVdbeCountChanges(v);
- const char *error_msg =
- tt_sprintf(tnt_errcode_desc(ER_TRIGGER_EXISTS),
- trigger_name);
char *name_copy = sqlDbStrDup(db, trigger_name);
if (name_copy == NULL)
goto trigger_cleanup;
@@ -113,7 +110,8 @@ sql_trigger_begin(struct Parse *parse)
if (vdbe_emit_halt_with_presence_test(parse, BOX_TRIGGER_ID, 0,
name_reg, 1,
ER_TRIGGER_EXISTS,
- error_msg, (no_err != 0),
+ trigger_name,
+ (no_err != 0),
OP_NoConflict) != 0)
goto trigger_cleanup;
}
@@ -412,9 +410,6 @@ sql_drop_trigger(struct Parse *parser)
assert(name->nSrc == 1);
const char *trigger_name = name->a[0].zName;
- const char *error_msg =
- tt_sprintf(tnt_errcode_desc(ER_NO_SUCH_TRIGGER),
- trigger_name);
char *name_copy = sqlDbStrDup(db, trigger_name);
if (name_copy == NULL)
goto drop_trigger_cleanup;
@@ -422,7 +417,8 @@ sql_drop_trigger(struct Parse *parser)
sqlVdbeAddOp4(v, OP_String8, 0, name_reg, 0, name_copy, P4_DYNAMIC);
if (vdbe_emit_halt_with_presence_test(parser, BOX_TRIGGER_ID, 0,
name_reg, 1, ER_NO_SUCH_TRIGGER,
- error_msg, no_err, OP_Found) != 0)
+ trigger_name,
+ no_err, OP_Found) != 0)
goto drop_trigger_cleanup;
vdbe_code_drop_trigger(parser, trigger_name, true);
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 5222a4e..9f0d760 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -1032,12 +1032,9 @@ case OP_Halt: {
p->pc = pcx;
if (p->rc) {
if (p->rc == SQL_TARANTOOL_ERROR) {
- if (pOp->p4.z == NULL) {
- assert(! diag_is_empty(diag_get()));
- } else {
- box_error_set(__FILE__, __LINE__, pOp->p5,
- pOp->p4.z);
- }
+ if (pOp->p4.z != NULL)
+ diag_set(ClientError, pOp->p5, pOp->p4.z);
+ assert(! diag_is_empty(diag_get()));
} else if (pOp->p5 != 0) {
static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK",
"FOREIGN KEY" };
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index c4724e6..0c626c9 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -2170,7 +2170,7 @@ for _, val in ipairs({
"e_select-9.2."..tn,
select,
{
- 1, "Only positive integers are allowed in the LIMIT clause"})
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"})
end
-- EVIDENCE-OF: R-03014-26414 If the LIMIT expression evaluates to a
@@ -2224,7 +2224,7 @@ for _, val in ipairs({
test:do_catchsql_test(
"e_select-9.7."..tn,
select, {
- 1, "Only positive integers are allowed in the OFFSET clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the OFFSET clause"
})
end
diff --git a/test/sql-tap/limit.test.lua b/test/sql-tap/limit.test.lua
index 9b728d8..40b787b 100755
--- a/test/sql-tap/limit.test.lua
+++ b/test/sql-tap/limit.test.lua
@@ -84,7 +84,7 @@ test:do_catchsql_test(
SELECT x FROM t1 ORDER BY x+1 LIMIT 5 OFFSET -2
]], {
-- <limit-1.2.13>
- 1 ,"Only positive integers are allowed in the OFFSET clause"
+ 1 ,"Failed to execute SQL statement: Only positive integers are allowed in the OFFSET clause"
-- </limit-1.2.13>
})
@@ -94,7 +94,7 @@ test:do_catchsql_test(
SELECT x FROM t1 ORDER BY x+1 LIMIT 2, -5
]], {
-- <limit-1.2.4>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-1.2.4>
})
@@ -115,7 +115,7 @@ test:do_catchsql_test(
SELECT x FROM t1 ORDER BY x+1 LIMIT -2, 5
]], {
-- <limit-1.2.6>
- 1, "Only positive integers are allowed in the OFFSET clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the OFFSET clause"
-- </limit-1.2.6>
})
@@ -135,7 +135,7 @@ test:do_catchsql_test(
SELECT x FROM t1 ORDER BY x+1 LIMIT -2, -5
]], {
-- <limit-1.2.8>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-1.2.8>
})
@@ -384,7 +384,7 @@ test:do_catchsql_test(
SELECT * FROM t6 LIMIT -1 OFFSET -1;
]], {
-- <limit-6.2>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-6.2>
})
@@ -394,7 +394,7 @@ test:do_catchsql_test(
SELECT * FROM t6 LIMIT 2 OFFSET -123;
]], {
-- <limit-6.3>
- 1, "Only positive integers are allowed in the OFFSET clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the OFFSET clause"
-- </limit-6.3>
})
@@ -414,7 +414,7 @@ test:do_catchsql_test(
SELECT * FROM t6 LIMIT -432 OFFSET 2;
]], {
-- <limit-6.4>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-6.4>
})
@@ -434,7 +434,7 @@ test:do_catchsql_test(
SELECT * FROM t6 LIMIT -1
]], {
-- <limit-6.5>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-6.5>
})
@@ -454,7 +454,7 @@ test:do_catchsql_test(
SELECT * FROM t6 LIMIT -1 OFFSET 1
]], {
-- <limit-6.6>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-6.6>
})
@@ -734,7 +734,7 @@ test:do_test(
return test:catchsql("SELECT x FROM t1 WHERE x<10 LIMIT "..limit)
end, {
-- <limit-10.4>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-10.4>
})
@@ -745,7 +745,7 @@ test:do_test(
return test:catchsql("SELECT x FROM t1 WHERE x<10 LIMIT "..limit)
end, {
-- <limit-10.5>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-10.5>
})
@@ -1320,7 +1320,7 @@ test:do_catchsql_test(
SELECT 123 LIMIT -1 OFFSET 0
]], {
-- <limit-14.6.1>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-14.6.1>
})
@@ -1340,7 +1340,7 @@ test:do_catchsql_test(
SELECT 123 LIMIT -1 OFFSET 1
]], {
-- <limit-14.7.1>
- 1, "Only positive integers are allowed in the LIMIT clause"
+ 1, "Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </limit-14.7.1>
})
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index b78091b..1c0804b 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -990,7 +990,7 @@ test:do_catchsql_test(
SELECT DISTINCT log FROM t1 ORDER BY log LIMIT -1
]], {
-- <select4-10.4.1>
- 1,"Only positive integers are allowed in the LIMIT clause"
+ 1,"Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </select4-10.4.1>
})
test:do_execsql_test(
@@ -1009,7 +1009,7 @@ test:do_catchsql_test(
SELECT DISTINCT log FROM t1 ORDER BY log LIMIT -1 OFFSET 2
]], {
-- <select4-10.5.1>
- 1,"Only positive integers are allowed in the LIMIT clause"
+ 1,"Failed to execute SQL statement: Only positive integers are allowed in the LIMIT clause"
-- </select4-10.5.1>
})
test:do_execsql_test(
@@ -1402,7 +1402,7 @@ test:do_catchsql_test(
SELECT (VALUES(1),(2),(3),(4))
]], {
-- <select4-14.10>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </select4-14.10>
})
@@ -1412,7 +1412,7 @@ test:do_catchsql_test(
SELECT (SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4)
]], {
-- <select4-14.11>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </select4-14.11>
})
diff --git a/test/sql-tap/subselect.test.lua b/test/sql-tap/subselect.test.lua
index 5b71390..ebfdf43 100755
--- a/test/sql-tap/subselect.test.lua
+++ b/test/sql-tap/subselect.test.lua
@@ -350,7 +350,7 @@ test:do_catchsql_test(
SELECT (SELECT a FROM t5);
]], {
-- <subselect-5.1>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </subselect-5.1>
})
@@ -360,7 +360,7 @@ test:do_catchsql_test(
SELECT b FROM t5 WHERE a = (SELECT a FROM t5 WHERE b=6);
]], {
-- <subselect-5.2>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </subselect-5.2>
})
@@ -380,7 +380,7 @@ test:do_catchsql_test(
SELECT b FROM t1 WHERE a = (SELECT a FROM t1 WHERE b=6 LIMIT (SELECT b FROM t1 WHERE a =1));
]], {
-- <subselect-5.2>
- 1, "SQL error: Expression subquery could be limited only with 1"
+ 1, "Failed to execute SQL statement: Expression subquery could be limited only with 1"
-- </subselect-5.2>
})
diff --git a/test/sql-tap/tkt1473.test.lua b/test/sql-tap/tkt1473.test.lua
index 3e93203..ada18d0 100755
--- a/test/sql-tap/tkt1473.test.lua
+++ b/test/sql-tap/tkt1473.test.lua
@@ -125,7 +125,7 @@ test:do_catchsql_test(
SELECT (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=0)
]], {
-- <tkt1473-2.2>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-2.2>
})
@@ -145,7 +145,7 @@ test:do_catchsql_test(
SELECT (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-2.4>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-2.4>
})
@@ -155,7 +155,7 @@ test:do_catchsql_test(
SELECT (SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-2.5>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-2.5>
})
@@ -165,7 +165,7 @@ test:do_catchsql_test(
SELECT (SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-2.6>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-2.6>
})
@@ -206,7 +206,7 @@ test:do_catchsql_test(
(SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=0)
]], {
-- <tkt1473-3.2>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-3.2>
})
@@ -228,7 +228,7 @@ test:do_catchsql_test(
(SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-3.4>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-3.4>
})
@@ -239,7 +239,7 @@ test:do_catchsql_test(
(SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-3.5>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-3.5>
})
@@ -250,7 +250,7 @@ test:do_catchsql_test(
(SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=4)
]], {
-- <tkt1473-3.6>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-3.6>
})
@@ -359,7 +359,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-4.3>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-4.3>
})
@@ -389,7 +389,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-4.4>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-4.4>
})
@@ -419,7 +419,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-4.5>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-4.5>
})
@@ -449,7 +449,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-4.6>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-4.6>
})
@@ -509,7 +509,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-5.3>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-5.3>
})
@@ -539,7 +539,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-5.4>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-5.4>
})
@@ -569,7 +569,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-5.5>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-5.5>
})
@@ -599,7 +599,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-5.6>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-5.6>
})
@@ -659,7 +659,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-6.3>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-6.3>
})
@@ -689,7 +689,7 @@ test:do_catchsql_test(
)
]], {
-- <tkt1473-6.4>
- 1, "SQL error: Expression subquery returned more than 1 row"
+ 1, "Failed to execute SQL statement: Expression subquery returned more than 1 row"
-- </tkt1473-6.4>
})
diff --git a/test/sql/iproto.result b/test/sql/iproto.result
index 73497b4..9639ba7 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -164,15 +164,18 @@ cn:execute('select * from test limit ?', {2})
...
cn:execute('select * from test limit ?', {-2})
---
-- error: Only positive integers are allowed in the LIMIT clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ LIMIT clause'
...
cn:execute('select * from test limit ?', {2.7})
---
-- error: Only positive integers are allowed in the LIMIT clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ LIMIT clause'
...
cn:execute('select * from test limit ?', {'Hello'})
---
-- error: Only positive integers are allowed in the LIMIT clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ LIMIT clause'
...
cn:execute('select * from test limit 1 offset ?', {2})
---
@@ -188,15 +191,18 @@ cn:execute('select * from test limit 1 offset ?', {2})
...
cn:execute('select * from test limit 1 offset ?', {-2})
---
-- error: Only positive integers are allowed in the OFFSET clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ OFFSET clause'
...
cn:execute('select * from test limit 1 offset ?', {2.7})
---
-- error: Only positive integers are allowed in the OFFSET clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ OFFSET clause'
...
cn:execute('select * from test limit 1 offset ?', {'Hello'})
---
-- error: Only positive integers are allowed in the OFFSET clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ OFFSET clause'
...
-- gh-2608 SQL iproto DDL
cn:execute('create table test2(id int primary key, a int, b int, c int)')
diff --git a/test/sql/types.result b/test/sql/types.result
index bc4518c..f05b856 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -351,11 +351,13 @@ box.execute("SELECT true IN (1, 'abc', false)")
...
box.execute("SELECT 1 LIMIT true;")
---
-- error: Only positive integers are allowed in the LIMIT clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ LIMIT clause'
...
box.execute("SELECT 1 LIMIT 1 OFFSET true;")
---
-- error: Only positive integers are allowed in the OFFSET clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ OFFSET clause'
...
box.execute("SELECT 'abc' || true;")
---
@@ -519,7 +521,8 @@ box.execute("SELECT b FROM t GROUP BY b LIMIT 1;")
...
box.execute("SELECT b FROM t LIMIT true;")
---
-- error: Only positive integers are allowed in the LIMIT clause
+- error: 'Failed to execute SQL statement: Only positive integers are allowed in the
+ LIMIT clause'
...
-- Most of aggregates don't accept boolean arguments.
--
--
2.7.4
More information about the Tarantool-patches
mailing list