* [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement
@ 2019-11-27 10:13 imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 1/5] sql: remove PRAGMA "count_changes" imeevma
` (4 more replies)
0 siblings, 5 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
The main goal of this set of patches is to replace control pragmas
with the SET operator. Control pragmas are those that change SQL
settings.
https://github.com/tarantool/tarantool/issues/4511
https://github.com/tarantool/tarantool/tree/imeevma/gh-4511-pragma-replaced-by-set
Mergen Imeev (5):
sql: remove PRAGMA "count_changes"
sql: remove PRAGMA "short_column_names"
temporary: disable boolean.test.sql
sql: replace control pragmas by SET
sql: refactor PRAGMA-related code
src/box/sql.c | 3 +-
src/box/sql/build.c | 120 ++++++
src/box/sql/delete.c | 26 --
src/box/sql/insert.c | 35 +-
src/box/sql/parse.y | 39 +-
src/box/sql/pragma.c | 451 ++++++---------------
src/box/sql/pragma.h | 251 ++----------
src/box/sql/select.c | 16 +-
src/box/sql/sqlInt.h | 77 +++-
src/box/sql/update.c | 27 --
src/box/sql/vdbe.c | 54 ++-
test/sql-tap/analyze4.test.lua | 4 +-
test/sql-tap/autoinc.test.lua | 2 +-
test/sql-tap/colname.test.lua | 51 +--
test/sql-tap/fkey2.test.lua | 4 +-
test/sql-tap/gh2548-select-compound-limit.test.lua | 18 +-
test/sql-tap/index-info.test.lua | 2 +-
test/sql-tap/lua/sqltester.lua | 2 +-
test/sql-tap/misc1.test.lua | 2 +-
test/sql-tap/pragma.test.lua | 135 +-----
test/sql-tap/select1.test.lua | 35 +-
test/sql-tap/tkt3731.test.lua | 2 +-
test/sql-tap/trigger2.test.lua | 2 +-
test/sql-tap/triggerC.test.lua | 51 +--
test/sql-tap/update.test.lua | 50 ++-
test/sql-tap/whereA.test.lua | 24 +-
test/sql/check-clear-ephemeral.result | 4 +-
test/sql/check-clear-ephemeral.test.lua | 4 +-
test/sql/checks.result | 4 +-
test/sql/checks.test.lua | 4 +-
test/sql/clear.result | 4 +-
test/sql/clear.test.lua | 4 +-
test/sql/collation.result | 2 +-
test/sql/collation.test.lua | 2 +-
test/sql/ddl.result | 2 +-
test/sql/ddl.test.lua | 2 +-
test/sql/delete-multiple-idx.result | 4 +-
test/sql/delete-multiple-idx.test.lua | 4 +-
test/sql/delete.result | 4 +-
test/sql/delete.test.lua | 4 +-
test/sql/drop-index.result | 4 +-
test/sql/drop-index.test.lua | 4 +-
test/sql/drop-table.result | 4 +-
test/sql/drop-table.test.lua | 4 +-
test/sql/engine.result | 6 +-
test/sql/engine.test.lua | 6 +-
test/sql/errinj.result | 2 +-
test/sql/errinj.test.lua | 2 +-
test/sql/func-recreate.result | 2 +-
test/sql/func-recreate.test.lua | 2 +-
test/sql/gh-2362-select-access-rights.result | 2 +-
test/sql/gh-2362-select-access-rights.test.lua | 2 +-
test/sql/gh-2929-primary-key.result | 2 +-
test/sql/gh-2929-primary-key.test.lua | 2 +-
test/sql/gh-2981-check-autoinc.result | 2 +-
test/sql/gh-2981-check-autoinc.test.lua | 2 +-
test/sql/gh-3199-no-mem-leaks.result | 2 +-
test/sql/gh-3199-no-mem-leaks.test.lua | 2 +-
test/sql/gh-3613-idx-alter-update-2.result | 2 +-
test/sql/gh-3613-idx-alter-update-2.test.lua | 2 +-
test/sql/gh-3613-idx-alter-update.result | 2 +-
test/sql/gh-3613-idx-alter-update.test.lua | 2 +-
test/sql/gh-3888-values-blob-assert.result | 2 +-
test/sql/gh-3888-values-blob-assert.test.lua | 2 +-
test/sql/gh2141-delete-trigger-drop-table.result | 2 +-
test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 +-
test/sql/gh2251-multiple-update.result | 2 +-
test/sql/gh2251-multiple-update.test.lua | 2 +-
test/sql/gh2483-remote-persistency-check.result | 2 +-
test/sql/gh2483-remote-persistency-check.test.lua | 2 +-
.../gh2808-inline-unique-persistency-check.result | 2 +-
...gh2808-inline-unique-persistency-check.test.lua | 2 +-
test/sql/icu-upper-lower.result | 2 +-
test/sql/icu-upper-lower.test.lua | 2 +-
test/sql/insert-unique.result | 4 +-
test/sql/insert-unique.test.lua | 4 +-
test/sql/integer-overflow.result | 2 +-
test/sql/integer-overflow.test.lua | 2 +-
test/sql/iproto.result | 33 +-
test/sql/iproto.test.lua | 10 +-
test/sql/max-on-index.result | 4 +-
test/sql/max-on-index.test.lua | 4 +-
test/sql/message-func-indexes.result | 2 +-
test/sql/message-func-indexes.test.lua | 2 +-
test/sql/misc.result | 2 +-
test/sql/misc.test.lua | 2 +-
test/sql/no-pk-space.result | 2 +-
test/sql/no-pk-space.test.lua | 2 +-
test/sql/on-conflict.result | 2 +-
test/sql/on-conflict.test.lua | 2 +-
test/sql/persistency.result | 2 +-
test/sql/persistency.test.lua | 2 +-
test/sql/row-count.result | 10 +-
test/sql/row-count.test.lua | 4 +-
test/sql/savepoints.result | 2 +-
test/sql/savepoints.test.lua | 2 +-
test/sql/select-null.result | 4 +-
test/sql/select-null.test.lua | 4 +-
test/sql/sql-debug.result | 144 +++++--
test/sql/sql-debug.test.lua | 33 +-
test/sql/sql-statN-index-drop.result | 2 +-
test/sql/sql-statN-index-drop.test.lua | 2 +-
test/sql/suite.ini | 2 +-
test/sql/tokenizer.result | 2 +-
test/sql/tokenizer.test.lua | 2 +-
test/sql/transition.result | 2 +-
test/sql/transition.test.lua | 2 +-
test/sql/transitive-transactions.result | 8 +-
test/sql/transitive-transactions.test.lua | 8 +-
test/sql/triggers.result | 14 +-
test/sql/triggers.test.lua | 14 +-
test/sql/update-with-nested-select.result | 4 +-
test/sql/update-with-nested-select.test.lua | 4 +-
test/sql/upgrade.result | 2 +-
test/sql/upgrade.test.lua | 2 +-
test/sql/view.result | 2 +-
test/sql/view.test.lua | 2 +-
test/sql/view_delayed_wal.result | 2 +-
test/sql/view_delayed_wal.test.lua | 2 +-
test/sql/vinyl-opts.result | 2 +-
test/sql/vinyl-opts.test.lua | 2 +-
121 files changed, 748 insertions(+), 1235 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Tarantool-patches] [PATCH 1/5] sql: remove PRAGMA "count_changes"
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
@ 2019-11-27 10:13 ` imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 2/5] sql: remove PRAGMA "short_column_names" imeevma
` (3 subsequent siblings)
4 siblings, 0 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
Pragma "count_changes" forces the INSERT, REPLACE, DELETE, and
UPDATE statements to return the number of changed rows as a
result set. This is not necessary, as these statements return the
number of changed rows as metadata.
Part of #4511
---
src/box/sql/delete.c | 26 -----------
src/box/sql/insert.c | 35 +--------------
src/box/sql/pragma.h | 104 ++++++++++++++++++++-----------------------
src/box/sql/sqlInt.h | 3 --
src/box/sql/update.c | 27 -----------
src/box/sql/vdbe.c | 29 +-----------
test/sql-tap/update.test.lua | 49 ++++++++++----------
test/sql/iproto.result | 31 -------------
test/sql/iproto.test.lua | 8 ----
test/sql/sql-debug.result | 1 -
10 files changed, 74 insertions(+), 239 deletions(-)
diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c
index 91c2157..8d9ae4f 100644
--- a/src/box/sql/delete.c
+++ b/src/box/sql/delete.c
@@ -191,15 +191,6 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
tab_cursor);
}
- /* Initialize the counter of the number of rows deleted,
- * if we are counting rows.
- */
- int reg_count = -1;
- uint32_t sql_flags = parse->sql_flags;
- if ((sql_flags & SQL_CountRows) != 0) {
- reg_count = ++parse->nMem;
- sqlVdbeAddOp2(v, OP_Integer, 0, reg_count);
- }
/* Special case: A DELETE without a WHERE clause deletes
* everything. It is easier just to erase the whole table.
*/
@@ -284,12 +275,6 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
*/
/* assert(is_complex || one_pass != ONEPASS_OFF); */
- /* Keep track of the number of rows to be
- * deleted.
- */
- if ((sql_flags & SQL_CountRows) != 0)
- sqlVdbeAddOp2(v, OP_AddImm, reg_count, 1);
-
/* Extract the primary key for the current row */
if (!is_view) {
struct key_part_def *part = pk_info->parts;
@@ -413,17 +398,6 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
}
}
- /* Return the number of rows that were deleted. */
- if ((sql_flags & SQL_CountRows) != 0 &&
- parse->triggered_space != NULL) {
- sqlVdbeAddOp2(v, OP_ResultRow, reg_count, 1);
- sqlVdbeSetNumCols(v, 1);
- sqlVdbeSetColName(v, 0, COLNAME_NAME, "rows deleted",
- SQL_STATIC);
- sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
- SQL_STATIC);
- }
-
delete_from_cleanup:
sqlSrcListDelete(db, tab_list);
sql_expr_delete(db, where, false);
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 70504c8..43a0de5 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -251,7 +251,6 @@ sqlInsert(Parse * pParse, /* Parser context */
/* Register allocations */
int regFromSelect = 0; /* Base register for data coming from SELECT */
- int regRowCount = 0; /* Memory cell used for the row counter */
int regIns; /* Block of regs holding data being inserted */
int regTupleid; /* registers holding insert tupleid */
int regData; /* register holding first column to insert */
@@ -334,7 +333,7 @@ sqlInsert(Parse * pParse, /* Parser context */
xferOptimization(pParse, space, pSelect, on_error)) {
assert(trigger == NULL);
assert(pList == 0);
- goto insert_end;
+ goto insert_cleanup;
}
/*
@@ -512,12 +511,6 @@ sqlInsert(Parse * pParse, /* Parser context */
goto insert_cleanup;
}
- /* Initialize the count of rows to be inserted
- */
- if ((pParse->sql_flags & SQL_CountRows) != 0) {
- regRowCount = ++pParse->nMem;
- sqlVdbeAddOp2(v, OP_Integer, 0, regRowCount);
- }
/* This is the top of the main insertion loop */
if (useTempTable) {
/* This block codes the top of loop only. The complete loop is the
@@ -745,12 +738,6 @@ sqlInsert(Parse * pParse, /* Parser context */
on_error, autoinc_reg);
}
- /* Update the count of rows that are inserted
- */
- if ((pParse->sql_flags & SQL_CountRows) != 0) {
- sqlVdbeAddOp2(v, OP_AddImm, regRowCount, 1);
- }
-
if (trigger != NULL) {
/* Code AFTER triggers */
vdbe_code_row_trigger(pParse, trigger, TK_INSERT, 0,
@@ -773,23 +760,6 @@ sqlInsert(Parse * pParse, /* Parser context */
sqlVdbeJumpHere(v, addrInsTop);
}
- insert_end:
-
- /* Return the number of rows inserted. */
- if ((pParse->sql_flags & SQL_CountRows) != 0 &&
- pParse->triggered_space == NULL) {
- sqlVdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
- sqlVdbeSetNumCols(v, 1);
- const char *column_name;
- if (on_error == ON_CONFLICT_ACTION_REPLACE)
- column_name = "rows replaced";
- else
- column_name = "rows inserted";
- sqlVdbeSetColName(v, 0, COLNAME_NAME, column_name, SQL_STATIC);
- sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
- SQL_STATIC);
- }
-
insert_cleanup:
sqlSrcListDelete(db, pTabList);
sql_expr_list_delete(db, pList);
@@ -1182,9 +1152,6 @@ xferOptimization(Parse * pParse, /* Parser context */
*/
if (!rlist_empty(&dest->child_fk_constraint))
return 0;
- if ((pParse->sql_flags & SQL_CountRows) != 0) {
- return 0; /* xfer opt does not play well with PRAGMA count_changes */
- }
/* If we get this far, it means that the xfer optimization is at
* least a possibility, though it might only work if the destination
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index 30a1fc4..511de23 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -93,57 +93,54 @@ static const char *const pragCName[] = {
/* 55 */ "text",
/* 56 */ "match",
/* 57 */ "text",
- /* Used by: count_changes */
- /* 58 */ "count_changes",
- /* 59 */ "integer",
/* Used by: defer_foreign_keys */
- /* 60 */ "defer_foreign_keys",
- /* 61 */ "integer",
+ /* 58 */ "defer_foreign_keys",
+ /* 59 */ "integer",
/* Used by: full_column_names */
- /* 62 */ "full_column_names",
- /* 63 */ "integer",
+ /* 60 */ "full_column_names",
+ /* 61 */ "integer",
/* Used by: parser_trace */
- /* 64 */ "parser_trace",
- /* 65 */ "integer",
+ /* 62 */ "parser_trace",
+ /* 63 */ "integer",
/* Used by: recursive_triggers */
- /* 66 */ "recursive_triggers",
- /* 67 */ "integer",
+ /* 64 */ "recursive_triggers",
+ /* 65 */ "integer",
/* Used by: reverse_unordered_selects */
- /* 68 */ "reverse_unordered_selects",
- /* 69 */ "integer",
+ /* 66 */ "reverse_unordered_selects",
+ /* 67 */ "integer",
/* Used by: select_trace */
- /* 70 */ "select_trace",
- /* 71 */ "integer",
+ /* 68 */ "select_trace",
+ /* 69 */ "integer",
/* Used by: short_column_names */
- /* 72 */ "short_column_names",
- /* 73 */ "integer",
+ /* 70 */ "short_column_names",
+ /* 71 */ "integer",
/* Used by: sql_compound_select_limit */
- /* 74 */ "sql_compound_select_limit",
- /* 75 */ "integer",
+ /* 72 */ "sql_compound_select_limit",
+ /* 73 */ "integer",
/* Used by: sql_default_engine */
- /* 76 */ "sql_default_engine",
- /* 77 */ "text",
+ /* 74 */ "sql_default_engine",
+ /* 75 */ "text",
/* Used by: sql_trace */
- /* 78 */ "sql_trace",
- /* 79 */ "integer",
+ /* 76 */ "sql_trace",
+ /* 77 */ "integer",
/* Used by: vdbe_addoptrace */
- /* 80 */ "vdbe_addoptrace",
- /* 81 */ "integer",
+ /* 78 */ "vdbe_addoptrace",
+ /* 79 */ "integer",
/* Used by: vdbe_debug */
- /* 82 */ "vdbe_debug",
- /* 83 */ "integer",
+ /* 80 */ "vdbe_debug",
+ /* 81 */ "integer",
/* Used by: vdbe_eqp */
- /* 84 */ "vdbe_eqp",
- /* 85 */ "integer",
+ /* 82 */ "vdbe_eqp",
+ /* 83 */ "integer",
/* Used by: vdbe_listing */
- /* 86 */ "vdbe_listing",
- /* 87 */ "integer",
+ /* 84 */ "vdbe_listing",
+ /* 85 */ "integer",
/* Used by: vdbe_trace */
- /* 88 */ "vdbe_trace",
- /* 89 */ "integer",
+ /* 86 */ "vdbe_trace",
+ /* 87 */ "integer",
/* Used by: where_trace */
- /* 90 */ "where_trace",
- /* 91 */ "integer",
+ /* 88 */ "where_trace",
+ /* 89 */ "integer",
};
/* Definitions of all built-in pragmas */
@@ -165,15 +162,10 @@ static const PragmaName aPragmaName[] = {
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 38, 2,
/* iArg: */ 0},
- { /* zName: */ "count_changes",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 60, 1,
- /* iArg: */ SQL_CountRows},
{ /* zName: */ "defer_foreign_keys",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 62, 1,
+ /* ColNames: */ 58, 1,
/* iArg: */ SQL_DeferFKs},
{ /* zName: */ "foreign_key_list",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
@@ -184,7 +176,7 @@ static const PragmaName aPragmaName[] = {
{ /* zName: */ "full_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 64, 1,
+ /* ColNames: */ 60, 1,
/* iArg: */ SQL_FullColNames},
{ /* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
@@ -202,46 +194,46 @@ static const PragmaName aPragmaName[] = {
{ /* zName: */ "parser_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 64, 1,
+ /* ColNames: */ 62, 1,
/* iArg: */ PARSER_TRACE_FLAG},
#endif
{ /* zName: */ "recursive_triggers",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 66, 1,
+ /* ColNames: */ 64, 1,
/* iArg: */ SQL_RecTriggers},
{ /* zName: */ "reverse_unordered_selects",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 68, 1,
+ /* ColNames: */ 66, 1,
/* iArg: */ SQL_ReverseOrder},
#if defined(SQL_DEBUG)
{ /* zName: */ "select_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 70, 1,
+ /* ColNames: */ 68, 1,
/* iArg: */ SQL_SelectTrace},
#endif
{ /* zName: */ "short_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 72, 1,
+ /* ColNames: */ 70, 1,
/* iArg: */ SQL_ShortColNames},
{ /* zName: */ "sql_compound_select_limit",
/* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 74, 1,
+ /* ColNames: */ 72, 1,
/* iArg: */ 0},
{ /* zName: */ "sql_default_engine",
/* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 76, 1,
+ /* ColNames: */ 74, 1,
/* iArg: */ 0},
#if defined(SQL_DEBUG)
{ /* zName: */ "sql_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 78, 1,
+ /* ColNames: */ 76, 1,
/* iArg: */ SQL_SqlTrace},
#endif
{ /* zName: */ "stats",
@@ -260,33 +252,33 @@ static const PragmaName aPragmaName[] = {
{ /* zName: */ "vdbe_addoptrace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 80, 1,
+ /* ColNames: */ 78, 1,
/* iArg: */ SQL_VdbeAddopTrace},
{ /* zName: */ "vdbe_debug",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 82, 1,
+ /* ColNames: */ 80, 1,
/* iArg: */
SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
{ /* zName: */ "vdbe_eqp",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 84, 1,
+ /* ColNames: */ 82, 1,
/* iArg: */ SQL_VdbeEQP},
{ /* zName: */ "vdbe_listing",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 86, 1,
+ /* ColNames: */ 84, 1,
/* iArg: */ SQL_VdbeListing},
{ /* zName: */ "vdbe_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 88, 1,
+ /* ColNames: */ 86, 1,
/* iArg: */ SQL_VdbeTrace},
{ /* zName: */ "where_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 90, 1,
+ /* ColNames: */ 88, 1,
/* iArg: */ SQL_WhereTrace},
#endif
};
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 2594b73..b4f1d4c 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -1167,9 +1167,6 @@ struct sql {
#define PARSER_TRACE_FLAG 0x00000002
#define SQL_FullColNames 0x00000004 /* Show full column names on SELECT */
#define SQL_ShortColNames 0x00000040 /* Show short columns names */
-#define SQL_CountRows 0x00000080 /* Count rows changed by INSERT, */
- /* DELETE, or UPDATE and return */
- /* the count using a callback. */
#define SQL_SqlTrace 0x00000200 /* Debug print SQL as it executes */
#define SQL_SelectTrace 0x00000800 /* Debug info about select statement */
#define SQL_WhereTrace 0x00008000 /* Debug info about optimizer's work */
diff --git a/src/box/sql/update.c b/src/box/sql/update.c
index 6d69b72..d25262c 100644
--- a/src/box/sql/update.c
+++ b/src/box/sql/update.c
@@ -76,7 +76,6 @@ sqlUpdate(Parse * pParse, /* The parser context */
int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */
/* Register Allocations */
- int regRowCount = 0; /* A count of rows changed */
int regOldPk = 0;
int regNewPk = 0;
int regNew = 0; /* Content of the NEW.* table in triggers */
@@ -268,14 +267,6 @@ sqlUpdate(Parse * pParse, /* The parser context */
*/
sqlWhereEnd(pWInfo);
-
- /* Initialize the count of updated rows
- */
- if ((pParse->sql_flags & SQL_CountRows) != 0 &&
- pParse->triggered_space == NULL) {
- regRowCount = ++pParse->nMem;
- sqlVdbeAddOp2(v, OP_Integer, 0, regRowCount);
- }
labelBreak = sqlVdbeMakeLabel(v);
/* Top of the update loop */
if (okOnePass) {
@@ -470,13 +461,6 @@ sqlUpdate(Parse * pParse, /* The parser context */
fk_constraint_emit_actions(pParse, space, regOldPk, aXRef);
}
- /* Increment the row counter
- */
- if ((pParse->sql_flags & SQL_CountRows) != 0 &&
- pParse->triggered_space == NULL) {
- sqlVdbeAddOp2(v, OP_AddImm, regRowCount, 1);
- }
-
vdbe_code_row_trigger(pParse, trigger, TK_UPDATE, pChanges,
TRIGGER_AFTER, space, regOldPk, on_error,
labelContinue);
@@ -493,17 +477,6 @@ sqlUpdate(Parse * pParse, /* The parser context */
}
sqlVdbeResolveLabel(v, labelBreak);
- /* Return the number of rows that were changed. */
- if ((pParse->sql_flags & SQL_CountRows) != 0 &&
- pParse->triggered_space == NULL) {
- sqlVdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
- sqlVdbeSetNumCols(v, 1);
- sqlVdbeSetColName(v, 0, COLNAME_NAME, "rows updated",
- SQL_STATIC);
- sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
- SQL_STATIC);
- }
-
update_cleanup:
sqlSrcListDelete(db, pTabList);
sql_expr_list_delete(db, pChanges);
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index ab86be9..2e51a0d 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -1411,34 +1411,7 @@ case OP_ResultRow: {
assert(p->nResColumn==pOp->p2);
assert(pOp->p1>0);
assert(pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1);
-
- /* If this statement has violated immediate foreign key constraints, do
- * not return the number of rows modified. And do not RELEASE the statement
- * transaction. It needs to be rolled back.
- */
- if (sqlVdbeCheckFk(p, 0) != 0) {
- assert((p->sql_flags & SQL_CountRows) != 0);
- goto abort_due_to_error;
- }
-
- /* If the SQL_CountRows flag is set in sql.flags mask, then
- * DML statements invoke this opcode to return the number of rows
- * modified to the user. This is the only way that a VM that
- * opens a statement transaction may invoke this opcode.
- *
- * In case this is such a statement, close any statement transaction
- * opened by this VM before returning control to the user. This is to
- * ensure that statement-transactions are always nested, not overlapping.
- * If the open statement-transaction is not closed here, then the user
- * may step another VM that opens its own statement transaction. This
- * may lead to overlapping statement transactions.
- *
- * The statement transaction is never a top-level transaction. Hence
- * the RELEASE call below can never fail.
- */
- assert(p->iStatement == 0 || (p->sql_flags & SQL_CountRows) != 0);
- rc = sqlVdbeCloseStatement(p, SAVEPOINT_RELEASE);
- assert(rc==0);
+ assert(p->iStatement == 0 && p->anonymous_savepoint == NULL);
/* Invalidate all ephemeral cursor row caches */
p->cacheCtr = (p->cacheCtr + 2)|1;
diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
index 07e4e43..ac0389a 100755
--- a/test/sql-tap/update.test.lua
+++ b/test/sql-tap/update.test.lua
@@ -21,6 +21,11 @@ test:plan(111)
-- ["source",[["testdir"],"\/tester.tcl"]]
-- Try to update an non-existent table
--
+
+local function update_row_count(sql)
+ return box.execute(sql).row_count
+end
+
test:do_catchsql_test("update-1.1", [[
UPDATE test1 SET f2=5 WHERE f1<1
]], {
@@ -124,13 +129,12 @@ test:do_execsql_test("update-3.6", [[
})
test:do_test("update-3.7", function()
- test:execsql "PRAGMA count_changes=on"
- return test:execsql "UPDATE test1 SET f2=f2/3 WHERE f1<=5"
-end, {
+ return update_row_count("UPDATE test1 SET f2 = f2 / 3 WHERE f1 <= 5")
+ end,
-- <update-3.7>
5
-- </update-3.7>
-})
+)
test:do_execsql_test("update-3.8", [[
SELECT f1,f2 FROM test1 ORDER BY f1
@@ -140,13 +144,13 @@ test:do_execsql_test("update-3.8", [[
-- </update-3.8>
})
-test:do_execsql_test("update-3.9", [[
- UPDATE test1 SET f2=f2/3 WHERE f1>5
-]], {
+test:do_test("update-3.9", function()
+ return update_row_count("UPDATE test1 SET f2 = f2 / 3 WHERE f1 > 5")
+ end,
-- <update-3.9>
5
-- </update-3.9>
-})
+)
test:do_execsql_test("update-3.10", [[
SELECT f1,f2 FROM test1 ORDER BY f1
@@ -158,13 +162,13 @@ test:do_execsql_test("update-3.10", [[
-- Swap the values of f1 and f2 for all elements
--
-test:do_execsql_test("update-3.11", [[
- UPDATE test1 SET F2=f1, F1=f2
-]], {
+test:do_test("update-3.11", function()
+ return update_row_count("UPDATE test1 SET F2 = f1, F1 = f2")
+ end,
-- <update-3.11>
10
-- </update-3.11>
-})
+)
test:do_execsql_test("update-3.12", [[
SELECT f1,f2 FROM test1 ORDER BY F1
@@ -175,7 +179,6 @@ test:do_execsql_test("update-3.12", [[
})
test:do_test("update-3.13", function()
- test:execsql "PRAGMA count_changes=off"
return test:execsql "UPDATE test1 SET F2=f1, F1=f2"
end, {
-- <update-3.13>
@@ -254,17 +257,15 @@ end, {
-- </update-4.5>
})
-test:do_execsql_test("update-4.6", [[
- PRAGMA count_changes=on;
- UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128;
-]], {
+test:do_test("update-4.6", function()
+ return update_row_count("UPDATE test1 SET f1 = f1 - 1 WHERE f1 <= 100 and f2 == 128;")
+ end,
-- <update-4.6>
2
-- </update-4.6>
-})
+)
test:do_execsql_test("update-4.7", [[
- PRAGMA count_changes=off;
SELECT f1,f2 FROM test1 ORDER BY f1,f2
]], {
-- <update-4.7>
@@ -391,17 +392,15 @@ test:do_execsql_test("update-5.5.5", [[
-- </update-5.5.5>
})
-test:do_execsql_test("update-5.6", [[
- PRAGMA count_changes=on;
- UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128;
-]], {
+test:do_test("update-5.6", function()
+ return update_row_count("UPDATE test1 SET f1 = f1 - 1 WHERE f1 <= 100 and f2 == 128;")
+ end,
-- <update-5.6>
2
-- </update-5.6>
-})
+)
test:do_execsql_test("update-5.6.1", [[
- PRAGMA count_changes=off;
SELECT f1,f2 FROM test1 ORDER BY f1,f2
]], {
-- <update-5.6.1>
diff --git a/test/sql/iproto.result b/test/sql/iproto.result
index 67acd0a..ffc7cd9 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -732,37 +732,6 @@ res.metadata
- name: detail
type: text
...
--- When pragma count_changes is on, statements INSERT, REPLACE and
--- UPDATE returns number of changed columns. Make sure that this
--- result has a column type.
-cn:execute("PRAGMA count_changes = 1;")
----
-- row_count: 0
-...
-cn:execute("INSERT INTO t1 VALUES (1), (2), (3);")
----
-- metadata:
- - name: rows inserted
- type: integer
- rows:
- - [3]
-...
-cn:execute("REPLACE INTO t1 VALUES (2), (3), (4), (5);")
----
-- metadata:
- - name: rows replaced
- type: integer
- rows:
- - [4]
-...
-cn:execute("UPDATE t1 SET id = id + 100 WHERE id > 10;")
----
-- metadata:
- - name: rows updated
- type: integer
- rows:
- - [0]
-...
-- Make sure that built-in functions have a right returning type.
--
cn:execute("SELECT zeroblob(1);")
diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
index 5dfe95c..b5ec2c0 100644
--- a/test/sql/iproto.test.lua
+++ b/test/sql/iproto.test.lua
@@ -220,14 +220,6 @@ res.metadata
res = cn:execute("EXPLAIN QUERY PLAN SELECT COUNT(*) FROM t1")
res.metadata
--- When pragma count_changes is on, statements INSERT, REPLACE and
--- UPDATE returns number of changed columns. Make sure that this
--- result has a column type.
-cn:execute("PRAGMA count_changes = 1;")
-cn:execute("INSERT INTO t1 VALUES (1), (2), (3);")
-cn:execute("REPLACE INTO t1 VALUES (2), (3), (4), (5);")
-cn:execute("UPDATE t1 SET id = id + 100 WHERE id > 10;")
-
-- Make sure that built-in functions have a right returning type.
--
cn:execute("SELECT zeroblob(1);")
diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
index b190753..e52a13a 100644
--- a/test/sql/sql-debug.result
+++ b/test/sql/sql-debug.result
@@ -38,7 +38,6 @@ box.execute('PRAGMA')
- name: pragma_value
type: integer
rows:
- - ['count_changes', 0]
- ['defer_foreign_keys', 0]
- ['full_column_names', 0]
- ['parser_trace', 0]
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Tarantool-patches] [PATCH 2/5] sql: remove PRAGMA "short_column_names"
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 1/5] sql: remove PRAGMA "count_changes" imeevma
@ 2019-11-27 10:13 ` imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 3/5] temporary: disable boolean.test.sql imeevma
` (2 subsequent siblings)
4 siblings, 0 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
The pragmas "short_column_names" and "full_column_names" allow us
to use three ways to display the column name in metadata:
1) If both are turned off, then the column name was shown as it
was written by the user.
2) If "short_column_names" = OFF and "full_column_names" = ON,
then the column name is displayed as <table name>.<column name>.
3) If "short_column_names" = ON, then the column name is displayed
as <column name>. This is the default option.
But we need only two ways to show the column name:
1) Show the column name as <column name>. This should be the
default option.
2) Show the column name as <table name>.<column name>.
In this regard, we need only one of these pragmas.
Part of #4511
---
src/box/sql.c | 3 +--
src/box/sql/pragma.h | 62 +++++++++++++++++++------------------------
src/box/sql/select.c | 16 +++--------
src/box/sql/sqlInt.h | 1 -
test/sql-tap/colname.test.lua | 37 +++++++-------------------
test/sql-tap/select1.test.lua | 13 +++------
test/sql/sql-debug.result | 1 -
7 files changed, 44 insertions(+), 89 deletions(-)
diff --git a/src/box/sql.c b/src/box/sql.c
index f1df555..7c1035c 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -59,8 +59,7 @@ static sql *db = NULL;
static const char nil_key[] = { 0x90 }; /* Empty MsgPack array. */
-static const uint32_t default_sql_flags = SQL_ShortColNames
- | SQL_EnableTrigger
+static const uint32_t default_sql_flags = SQL_EnableTrigger
| SQL_AutoIndex
| SQL_RecTriggers;
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index 511de23..f337f0b 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -111,36 +111,33 @@ static const char *const pragCName[] = {
/* Used by: select_trace */
/* 68 */ "select_trace",
/* 69 */ "integer",
- /* Used by: short_column_names */
- /* 70 */ "short_column_names",
- /* 71 */ "integer",
/* Used by: sql_compound_select_limit */
- /* 72 */ "sql_compound_select_limit",
- /* 73 */ "integer",
+ /* 70 */ "sql_compound_select_limit",
+ /* 71 */ "integer",
/* Used by: sql_default_engine */
- /* 74 */ "sql_default_engine",
- /* 75 */ "text",
+ /* 72 */ "sql_default_engine",
+ /* 73 */ "text",
/* Used by: sql_trace */
- /* 76 */ "sql_trace",
- /* 77 */ "integer",
+ /* 74 */ "sql_trace",
+ /* 75 */ "integer",
/* Used by: vdbe_addoptrace */
- /* 78 */ "vdbe_addoptrace",
- /* 79 */ "integer",
+ /* 76 */ "vdbe_addoptrace",
+ /* 77 */ "integer",
/* Used by: vdbe_debug */
- /* 80 */ "vdbe_debug",
- /* 81 */ "integer",
+ /* 78 */ "vdbe_debug",
+ /* 79 */ "integer",
/* Used by: vdbe_eqp */
- /* 82 */ "vdbe_eqp",
- /* 83 */ "integer",
+ /* 80 */ "vdbe_eqp",
+ /* 81 */ "integer",
/* Used by: vdbe_listing */
- /* 84 */ "vdbe_listing",
- /* 85 */ "integer",
+ /* 82 */ "vdbe_listing",
+ /* 83 */ "integer",
/* Used by: vdbe_trace */
- /* 86 */ "vdbe_trace",
- /* 87 */ "integer",
+ /* 84 */ "vdbe_trace",
+ /* 85 */ "integer",
/* Used by: where_trace */
- /* 88 */ "where_trace",
- /* 89 */ "integer",
+ /* 86 */ "where_trace",
+ /* 87 */ "integer",
};
/* Definitions of all built-in pragmas */
@@ -214,26 +211,21 @@ static const PragmaName aPragmaName[] = {
/* ColNames: */ 68, 1,
/* iArg: */ SQL_SelectTrace},
#endif
- { /* zName: */ "short_column_names",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 70, 1,
- /* iArg: */ SQL_ShortColNames},
{ /* zName: */ "sql_compound_select_limit",
/* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 72, 1,
+ /* ColNames: */ 70, 1,
/* iArg: */ 0},
{ /* zName: */ "sql_default_engine",
/* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 74, 1,
+ /* ColNames: */ 72, 1,
/* iArg: */ 0},
#if defined(SQL_DEBUG)
{ /* zName: */ "sql_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 76, 1,
+ /* ColNames: */ 74, 1,
/* iArg: */ SQL_SqlTrace},
#endif
{ /* zName: */ "stats",
@@ -252,33 +244,33 @@ static const PragmaName aPragmaName[] = {
{ /* zName: */ "vdbe_addoptrace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 78, 1,
+ /* ColNames: */ 76, 1,
/* iArg: */ SQL_VdbeAddopTrace},
{ /* zName: */ "vdbe_debug",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 80, 1,
+ /* ColNames: */ 78, 1,
/* iArg: */
SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
{ /* zName: */ "vdbe_eqp",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 82, 1,
+ /* ColNames: */ 80, 1,
/* iArg: */ SQL_VdbeEQP},
{ /* zName: */ "vdbe_listing",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 84, 1,
+ /* ColNames: */ 82, 1,
/* iArg: */ SQL_VdbeListing},
{ /* zName: */ "vdbe_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 86, 1,
+ /* ColNames: */ 84, 1,
/* iArg: */ SQL_VdbeTrace},
{ /* zName: */ "where_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 88, 1,
+ /* ColNames: */ 86, 1,
/* iArg: */ SQL_WhereTrace},
#endif
};
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 8f93edd..b81c7af 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -1760,7 +1760,6 @@ generateColumnNames(Parse * pParse, /* Parser context */
Vdbe *v = pParse->pVdbe;
int i, j;
sql *db = pParse->db;
- int fullNames, shortNames;
/* If this is an EXPLAIN, skip this step */
if (pParse->explain) {
return;
@@ -1778,8 +1777,6 @@ generateColumnNames(Parse * pParse, /* Parser context */
}
assert(pTabList != 0);
pParse->colNamesSet = 1;
- fullNames = (pParse->sql_flags & SQL_FullColNames) != 0;
- shortNames = (pParse->sql_flags & SQL_ShortColNames) != 0;
sqlVdbeSetNumCols(v, pEList->nExpr);
uint32_t var_count = 0;
for (i = 0; i < pEList->nExpr; i++) {
@@ -1806,12 +1803,7 @@ generateColumnNames(Parse * pParse, /* Parser context */
struct space_def *space_def = pTabList->a[j].space->def;
assert(iCol >= 0 && iCol < (int)space_def->field_count);
zCol = space_def->fields[iCol].name;
- if (!shortNames && !fullNames) {
- sqlVdbeSetColName(v, i, COLNAME_NAME,
- sqlDbStrDup(db,
- pEList->a[i].zSpan),
- SQL_DYNAMIC);
- } else if (fullNames) {
+ if ((pParse->sql_flags & SQL_FullColNames) != 0) {
char *zName = 0;
zName = sqlMPrintf(db, "%s.%s",
space_def->name, zCol);
@@ -2022,8 +2014,7 @@ sqlResultSetOfSelect(Parse * pParse, Select * pSelect)
sql *db = pParse->db;
uint32_t saved_flags = pParse->sql_flags;
- pParse->sql_flags |= ~SQL_FullColNames;
- pParse->sql_flags &= SQL_ShortColNames;
+ pParse->sql_flags = 0;
sqlSelectPrep(pParse, pSelect, 0);
if (pParse->is_aborted)
return NULL;
@@ -4926,8 +4917,7 @@ selectExpander(Walker * pWalker, Select * p)
struct ExprList_item *a = pEList->a;
ExprList *pNew = 0;
uint32_t flags = pParse->sql_flags;
- int longNames = (flags & SQL_FullColNames) != 0
- && (flags & SQL_ShortColNames) == 0;
+ int longNames = (flags & SQL_FullColNames) != 0;
for (k = 0; k < pEList->nExpr; k++) {
pE = a[k].pExpr;
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index b4f1d4c..27a4c41 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -1166,7 +1166,6 @@ struct sql {
/* Debug print info about SQL query as it parsed */
#define PARSER_TRACE_FLAG 0x00000002
#define SQL_FullColNames 0x00000004 /* Show full column names on SELECT */
-#define SQL_ShortColNames 0x00000040 /* Show short columns names */
#define SQL_SqlTrace 0x00000200 /* Debug print SQL as it executes */
#define SQL_SelectTrace 0x00000800 /* Debug info about select statement */
#define SQL_WhereTrace 0x00008000 /* Debug info about optimizer's work */
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index 253497c..de03d7c 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(63)
+test:plan(62)
--!./tcltestrunner.lua
-- 2008 July 15
@@ -28,16 +28,12 @@ test:plan(63)
-- (2) A non-trival expression (not a table column name) then the name is
-- a copy of the expression text.
--
--- (3) If short_column_names=ON, then just the abbreviated column name without
+-- (3) If full_column_names=OFF, then just the abbreviated column name without
-- the table name.
--
--- (4) When short_column_names=OFF and full_column_names=OFF then
--- use case (2) for simple queries and case (5) for joins.
+-- (4) When full_column_names=ON then use the form: TABLE.COLUMN
--
--- (5) When short_column_names=OFF and full_column_names=ON then
--- use the form: TABLE.COLUMN
---
--- Verify the default settings for short_column_name and full_column_name
+-- Verify the default settings for full_column_name
--
local function lreplace(arr, pos, len, val)
for i = pos + 1, pos + len + 1, 1 do
@@ -49,16 +45,6 @@ end
test:do_test(
"colname-1.1",
function()
- return test:execsql "PRAGMA short_column_names"
- end, {
- -- <colname-1.1>
- 1
- -- </colname-1.1>
- })
-
-test:do_test(
- "colname-1.2",
- function()
return test:execsql "PRAGMA full_column_names"
end, {
-- <colname-1.2>
@@ -172,12 +158,11 @@ test:do_execsql2_test(
-- </colname-2.9>
})
--- Tests for short=OFF and full=OFF
+-- Tests for full=OFF
test:do_test(
"colname-3.1",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='OFF';
CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
FROM tabc, txyz ORDER BY 1 LIMIT 1;
@@ -199,7 +184,7 @@ test:do_execsql2_test(
SELECT Tabc.a, tAbc.b, taBc.c FROM tabc
]], {
-- <colname-3.2>
- "Tabc.a", 1, "tAbc.b", 2, "taBc.c", 3
+ "A", 1, "B", 2, "C", 3
-- </colname-3.2>
})
@@ -209,7 +194,7 @@ test:do_execsql2_test(
SELECT +tabc.a, -tabc.b, tabc.c FROM tabc
]], {
-- <colname-3.3>
- "+tabc.a", 1, "-tabc.b", -2, "tabc.c", 3
+ "+tabc.a", 1, "-tabc.b", -2, "C", 3
-- </colname-3.3>
})
@@ -229,7 +214,7 @@ test:do_execsql2_test(
SELECT Tabc.a, Txyz.x, * FROM tabc, txyz;
]], {
-- <colname-3.5>
- "Tabc.a", 1, "Txyz.x", 4, "A", 1, "B", 2, "C", 3, "X", 4, "Y", 5, "Z", 6
+ "A", 1, "X", 4, "A", 1, "B", 2, "C", 3, "X", 4, "Y", 5, "Z", 6
-- </colname-3.5>
})
@@ -259,7 +244,7 @@ test:do_execsql2_test(
SELECT v1.a, * FROM v1 ORDER BY 2;
]], {
-- <colname-3.8>
- "v1.a",1,"A",1,"X",4,"A_1",1,"B",2,"C",3,"X_1",4,"Y",5,"Z",6
+ "A",1,"A",1,"X",4,"A_1",1,"B",2,"C",3,"X_1",4,"Y",5,"Z",6
-- </colname-3.8>
})
@@ -293,12 +278,11 @@ test:do_execsql2_test(
-- </colname-3.11>
})
--- Test for short=OFF and full=ON
+-- Test for full=ON
test:do_test(
"colname-4.1",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='ON';
CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
FROM tabc, txyz ORDER BY 1 LIMIT 1;
@@ -456,7 +440,6 @@ test:do_test(
-- instead of reconnect to database
-- we are just turning settings to default state
test:execsql([[
- PRAGMA short_column_names='ON';
PRAGMA full_column_names='OFF';
]])
test:execsql [=[
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 4bbfbd6..d8fe7a9 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -940,7 +940,7 @@ test:do_catchsql2_test(
SELECT * FROM test1 WHERE f1==11
]], {
-- <select1-6.1.3>
- 0, {"F1", 11, "F2", 22}
+ 0, {"TEST1.F1", 11, "TEST1.F2", 22}
-- </select1-6.1.3>
})
@@ -956,7 +956,7 @@ test:do_test(
return table.insert(v,msg) or v
end, {
-- <select1-6.1.4>
- 0, {"F1", 11, "F2", 22}
+ 0, {"TEST1.F1", 11, "TEST1.F2", 22}
-- </select1-6.1.4>
})
@@ -1124,7 +1124,6 @@ test:do_test(
"select1-6.9.3",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='OFF';
]]
return test:execsql2 [[
@@ -1132,7 +1131,7 @@ test:do_test(
]]
end, {
-- <select1-6.9.3>
- "test1 . f1", 11, "test1 . f2", 22
+ "F1", 11, "F2", 22
-- </select1-6.9.3>
})
@@ -1140,7 +1139,6 @@ test:do_test(
"select1-6.9.4",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='ON';
]]
return test:execsql2 [[
@@ -1156,7 +1154,6 @@ test:do_test(
"select1-6.9.5",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='ON';
]]
return test:execsql2 [[
@@ -1238,7 +1235,6 @@ test:do_test(
"select1-6.9.11",
function()
test:execsql [[
- PRAGMA short_column_names='ON';
PRAGMA full_column_names='ON';
]]
return test:execsql2 [[
@@ -1264,7 +1260,6 @@ test:do_test(
"select1-6.9.13",
function()
test:execsql [[
- PRAGMA short_column_names='ON';
PRAGMA full_column_names='OFF';
]]
return test:execsql2 [[
@@ -1290,7 +1285,6 @@ test:do_test(
"select1-6.9.15",
function()
test:execsql [[
- PRAGMA short_column_names='OFF';
PRAGMA full_column_names='ON';
]]
return test:execsql2 [[
@@ -1313,7 +1307,6 @@ test:do_execsql2_test(
})
test:execsql [[
- PRAGMA short_column_names='ON';
PRAGMA full_column_names='OFF';
]]
test:do_catchsql2_test(
diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
index e52a13a..4102b1a 100644
--- a/test/sql/sql-debug.result
+++ b/test/sql/sql-debug.result
@@ -44,7 +44,6 @@ box.execute('PRAGMA')
- ['recursive_triggers', 1]
- ['reverse_unordered_selects', 0]
- ['select_trace', 0]
- - ['short_column_names', 1]
- ['sql_trace', 0]
- ['vdbe_addoptrace', 0]
- ['vdbe_debug', 0]
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Tarantool-patches] [PATCH 3/5] temporary: disable boolean.test.sql
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 1/5] sql: remove PRAGMA "count_changes" imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 2/5] sql: remove PRAGMA "short_column_names" imeevma
@ 2019-11-27 10:13 ` imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 5/5] sql: refactor PRAGMA-related code imeevma
4 siblings, 0 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
Since PRAGMA 'sql_default_engine' will be removed in the next
patch, this test will fail until test-run is fixed.
This patch should be removed before patch-set will be pushed.
---
test/sql/suite.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/sql/suite.ini b/test/sql/suite.ini
index a8664c5..a2573be 100644
--- a/test/sql/suite.ini
+++ b/test/sql/suite.ini
@@ -8,7 +8,7 @@ config = engine.cfg
is_parallel = True
lua_libs = lua/sql_tokenizer.lua
release_disabled = errinj.test.lua view_delayed_wal.test.lua sql-debug.test.lua
-disabled = sql-statN-index-drop.test.lua
+disabled = sql-statN-index-drop.test.lua boolean.test.sql
pretest_clean = True
fragile = dll.test.lua ; gh-4427
func-recreate.test.lua ; gh-4384
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
` (2 preceding siblings ...)
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 3/5] temporary: disable boolean.test.sql imeevma
@ 2019-11-27 10:13 ` imeevma
2019-11-27 10:45 ` Mergen Imeev
2019-11-27 10:51 ` Konstantin Osipov
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 5/5] sql: refactor PRAGMA-related code imeevma
4 siblings, 2 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
This patch replaces the control pragmas with SET. List of replaced
control pragmas and their SET settings:
Control pragmas SET parameters
defer_foreign_keys sql_defer_foreign_keys
full_column_names sql_full_column_names
recursive_triggers sql_recursive_triggers
reverse_unordered_selects sql_reverse_unordered_selects
sql_compound_select_limit sql_compound_select_limit
sql_default_engine sql_default_engine
Also, in debug build, these control pragmas are replaced by SET
settings:
Control pragmas SET parameters
parser_trace sql_parser_trace
select_trace sql_select_trace
sql_trace sql_trace
vdbe_addoptrace sql_vdbe_addoptrace
vdbe_debug sql_vdbe_debug
vdbe_eqp sql_vdbe_eqp
vdbe_listing sql_vdbe_listing
vdbe_trace sql_vdbe_trace
where_trace sql_where_trace
Difference between SET and control pragma:
1) SET have more definite syntax:
SET <setting name> = <setting value>;
In PRAGMA, we could set the settings using these methods:
PRAGMA <setting name> = <setting value>;
PRAGMA <setting name>(<setting value>);
2) SET allows only a specific type of value for each setting. In
PRAGMA, we could use almost everything to set up any setting.
Although the rules by which the settings were set in PRAGMA were
pretty easy to understand.
3) SET cannot display setting values. PRAGMA showed the setting
values using the syntax "PRAGMA <setting name>;". With SET, we
must use other means to get the current setting values. For
session settings, we could use the sysview "_vsession_settings"
to get these values. It is worth noting that all current SQL
settings are session settings, with the exception of
'sql_reverse_unordered_selects'.
After this patch there will be no control pragmas.
Closes #4511
Closes #4621
@TarantoolBot document
Title: SQL SET statement
SQL SET statement is used to change SQL settings. To change the
value of an SQL setting, use the following syntax:
SET <setting name> = <setting value>;
Currently available SQL settings:
'sql_defer_foreign_keys'
'sql_full_column_names'
'sql_recursive_triggers'
'sql_reverse_unordered_selects'
'sql_compound_select_limit'
'sql_default_engine'
In addition, SQL debugging settings can also be changed using this
statement in debug build:
'sql_parser_trace'
'sql_select_trace'
'sql_trace'
'sql_vdbe_addoptrace'
'sql_vdbe_debug'
'sql_vdbe_eqp'
'sql_vdbe_listing'
'sql_vdbe_trace'
'sql_where_trace'
Example of usage:
SET sql_full_column_names = true;
SET sql_compound_select_limit = 10;
SET sql_default_engine = 'memtx';
---
src/box/sql/build.c | 120 ++++++++++++
src/box/sql/parse.y | 8 +-
src/box/sql/pragma.c | 203 +--------------------
src/box/sql/pragma.h | 134 --------------
src/box/sql/sqlInt.h | 57 +++++-
src/box/sql/vdbe.c | 25 +++
test/sql-tap/analyze4.test.lua | 4 +-
test/sql-tap/autoinc.test.lua | 2 +-
test/sql-tap/colname.test.lua | 16 +-
test/sql-tap/fkey2.test.lua | 4 +-
test/sql-tap/gh2548-select-compound-limit.test.lua | 18 +-
test/sql-tap/lua/sqltester.lua | 2 +-
test/sql-tap/misc1.test.lua | 2 +-
test/sql-tap/pragma.test.lua | 135 +-------------
test/sql-tap/select1.test.lua | 22 +--
test/sql-tap/tkt3731.test.lua | 2 +-
test/sql-tap/trigger2.test.lua | 2 +-
test/sql-tap/triggerC.test.lua | 51 +-----
test/sql-tap/update.test.lua | 1 -
test/sql-tap/whereA.test.lua | 24 +--
test/sql/check-clear-ephemeral.result | 4 +-
test/sql/check-clear-ephemeral.test.lua | 4 +-
test/sql/checks.result | 4 +-
test/sql/checks.test.lua | 4 +-
test/sql/clear.result | 4 +-
test/sql/clear.test.lua | 4 +-
test/sql/collation.result | 2 +-
test/sql/collation.test.lua | 2 +-
test/sql/ddl.result | 2 +-
test/sql/ddl.test.lua | 2 +-
test/sql/delete-multiple-idx.result | 4 +-
test/sql/delete-multiple-idx.test.lua | 4 +-
test/sql/delete.result | 4 +-
test/sql/delete.test.lua | 4 +-
test/sql/drop-index.result | 4 +-
test/sql/drop-index.test.lua | 4 +-
test/sql/drop-table.result | 4 +-
test/sql/drop-table.test.lua | 4 +-
test/sql/engine.result | 6 +-
test/sql/engine.test.lua | 6 +-
test/sql/errinj.result | 2 +-
test/sql/errinj.test.lua | 2 +-
test/sql/func-recreate.result | 2 +-
test/sql/func-recreate.test.lua | 2 +-
test/sql/gh-2362-select-access-rights.result | 2 +-
test/sql/gh-2362-select-access-rights.test.lua | 2 +-
test/sql/gh-2929-primary-key.result | 2 +-
test/sql/gh-2929-primary-key.test.lua | 2 +-
test/sql/gh-2981-check-autoinc.result | 2 +-
test/sql/gh-2981-check-autoinc.test.lua | 2 +-
test/sql/gh-3199-no-mem-leaks.result | 2 +-
test/sql/gh-3199-no-mem-leaks.test.lua | 2 +-
test/sql/gh-3613-idx-alter-update-2.result | 2 +-
test/sql/gh-3613-idx-alter-update-2.test.lua | 2 +-
test/sql/gh-3613-idx-alter-update.result | 2 +-
test/sql/gh-3613-idx-alter-update.test.lua | 2 +-
test/sql/gh-3888-values-blob-assert.result | 2 +-
test/sql/gh-3888-values-blob-assert.test.lua | 2 +-
test/sql/gh2141-delete-trigger-drop-table.result | 2 +-
test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 +-
test/sql/gh2251-multiple-update.result | 2 +-
test/sql/gh2251-multiple-update.test.lua | 2 +-
test/sql/gh2483-remote-persistency-check.result | 2 +-
test/sql/gh2483-remote-persistency-check.test.lua | 2 +-
.../gh2808-inline-unique-persistency-check.result | 2 +-
...gh2808-inline-unique-persistency-check.test.lua | 2 +-
test/sql/icu-upper-lower.result | 2 +-
test/sql/icu-upper-lower.test.lua | 2 +-
test/sql/insert-unique.result | 4 +-
test/sql/insert-unique.test.lua | 4 +-
test/sql/integer-overflow.result | 2 +-
test/sql/integer-overflow.test.lua | 2 +-
test/sql/iproto.result | 2 +-
test/sql/iproto.test.lua | 2 +-
test/sql/max-on-index.result | 4 +-
test/sql/max-on-index.test.lua | 4 +-
test/sql/message-func-indexes.result | 2 +-
test/sql/message-func-indexes.test.lua | 2 +-
test/sql/misc.result | 2 +-
test/sql/misc.test.lua | 2 +-
test/sql/no-pk-space.result | 2 +-
test/sql/no-pk-space.test.lua | 2 +-
test/sql/on-conflict.result | 2 +-
test/sql/on-conflict.test.lua | 2 +-
test/sql/persistency.result | 2 +-
test/sql/persistency.test.lua | 2 +-
test/sql/row-count.result | 10 +-
test/sql/row-count.test.lua | 4 +-
test/sql/savepoints.result | 2 +-
test/sql/savepoints.test.lua | 2 +-
test/sql/select-null.result | 4 +-
test/sql/select-null.test.lua | 4 +-
test/sql/sql-debug.result | 142 ++++++++++----
test/sql/sql-debug.test.lua | 33 ++--
test/sql/sql-statN-index-drop.result | 2 +-
test/sql/sql-statN-index-drop.test.lua | 2 +-
test/sql/tokenizer.result | 2 +-
test/sql/tokenizer.test.lua | 2 +-
test/sql/transition.result | 2 +-
test/sql/transition.test.lua | 2 +-
test/sql/transitive-transactions.result | 8 +-
test/sql/transitive-transactions.test.lua | 8 +-
test/sql/triggers.result | 14 +-
test/sql/triggers.test.lua | 14 +-
test/sql/update-with-nested-select.result | 4 +-
test/sql/update-with-nested-select.test.lua | 4 +-
test/sql/upgrade.result | 2 +-
test/sql/upgrade.test.lua | 2 +-
test/sql/view.result | 2 +-
test/sql/view.test.lua | 2 +-
test/sql/view_delayed_wal.result | 2 +-
test/sql/view_delayed_wal.test.lua | 2 +-
test/sql/vinyl-opts.result | 2 +-
test/sql/vinyl-opts.test.lua | 2 +-
114 files changed, 531 insertions(+), 758 deletions(-)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index ce87b88..210d392 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -3275,6 +3275,12 @@ enum {
SQL_SESSION_OPTION_max,
};
+/** Identifiers of all SQL global options that can be set. */
+enum {
+ SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT = 0,
+ SQL_GLOBAL_OPTION_max,
+};
+
/**
* A local structure that allows to establish a connection between
* the name of the parameter, its field type and mask, if it have
@@ -3329,6 +3335,15 @@ static struct sql_option_metadata sql_session_opts[] = {
#endif
};
+/**
+ * Variable that contains names of the SQL global options, their
+ * field types and mask if they have one or 0 if don't have.
+ */
+static struct sql_option_metadata sql_global_opts[] = {
+ /** SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT */
+ {"sql_compound_select_limit", FIELD_TYPE_INTEGER, 0},
+};
+
uint32_t
sql_session_opt_id_max()
{
@@ -3382,3 +3397,108 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
*result = tuple;
return 0;
}
+
+int
+sql_set_boolean_option(int id, enum sql_setting_type type, bool value)
+{
+ assert(type == SQL_SESSION_SETTING);
+ (void)type;
+ struct session *session = current_session();
+ struct sql_option_metadata *option = &sql_session_opts[id];
+ assert(option->field_type == FIELD_TYPE_BOOLEAN);
+ if (value)
+ session->sql_flags |= option->mask;
+ else
+ session->sql_flags &= ~option->mask;
+#ifndef NDEBUG
+ if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
+ if (value)
+ sqlParserTrace(stdout, "parser: ");
+ else
+ sqlParserTrace(NULL, NULL);
+ }
+#endif
+ return 0;
+}
+
+int
+sql_set_string_option(int id, enum sql_setting_type type, const char *value)
+{
+ assert(type == SQL_SESSION_SETTING);
+ (void)type;
+ assert(sql_session_opts[id].field_type = FIELD_TYPE_STRING);
+ assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
+ (void)id;
+ enum sql_storage_engine engine = STR2ENUM(sql_storage_engine, value);
+ if (engine == sql_storage_engine_MAX) {
+ diag_set(ClientError, ER_NO_SUCH_ENGINE, value);
+ return -1;
+ }
+ current_session()->sql_default_engine = engine;
+ return 0;
+}
+
+int
+sql_set_integer_option(int id, enum sql_setting_type type, int value)
+{
+ assert(type == SQL_GLOBAL_SETTING);
+ (void)type;
+ assert(sql_global_opts[id].field_type = FIELD_TYPE_INTEGER);
+ assert(id == SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT);
+ (void)id;
+ int rc = sql_limit(sql_get(), SQL_LIMIT_COMPOUND_SELECT, value);
+ assert(rc >= 0);
+ return rc < 0 ? -1 : 0;
+}
+
+void
+sql_set_settings(struct Parse *parse_context, struct Token *name,
+ struct Expr *value)
+{
+ int opt_id;
+ struct Vdbe *vdbe = sqlGetVdbe(parse_context);
+ char *name_str = sql_name_from_token(sql_get(), name);
+ if (name_str == NULL) {
+ parse_context->is_aborted = true;
+ return;
+ }
+ int value_reg = ++parse_context->nMem;
+ sqlExprCode(parse_context, value, value_reg);
+ /* Try to find the option among the session options. */
+ for (opt_id = 0; opt_id < SQL_SESSION_OPTION_max; ++opt_id) {
+ if (strcasecmp(sql_session_opts[opt_id].name, name_str) == 0) {
+ struct sql_option_metadata *opt =
+ &sql_session_opts[opt_id];
+ if (value->type != opt->field_type) {
+ diag_set(ClientError, ER_INCONSISTENT_TYPES,
+ field_type_strs[opt->field_type],
+ field_type_strs[value->type]);
+ parse_context->is_aborted = true;
+ return;
+ }
+ sqlVdbeAddOp3(vdbe, OP_Set, SQL_SESSION_SETTING, opt_id,
+ value_reg);
+ return;
+ }
+ }
+ /* Try to find the option among the global options. */
+ for (opt_id = 0; opt_id < SQL_GLOBAL_OPTION_max; ++opt_id) {
+ if (strcasecmp(sql_global_opts[opt_id].name, name_str) == 0) {
+ struct sql_option_metadata *opt =
+ &sql_global_opts[opt_id];
+ if (value->type != opt->field_type) {
+ diag_set(ClientError, ER_INCONSISTENT_TYPES,
+ field_type_strs[opt->field_type],
+ field_type_strs[value->type]);
+ parse_context->is_aborted = true;
+ return;
+ }
+ sqlVdbeAddOp3(vdbe, OP_Set, SQL_GLOBAL_SETTING, opt_id,
+ value_reg);
+ return;
+ }
+ }
+ diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Setting is not found");
+ parse_context->is_aborted = true;
+ return;
+}
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 1d0c95f..9f8118e 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -1539,6 +1539,11 @@ cmd ::= DROP INDEX ifexists(E) nm(X) ON fullname(Y). {
sql_drop_index(pParse);
}
+///////////////////////////// The SET command ////////////////////////////////
+cmd ::= SET nm(X) EQ term(Y). {
+ sql_set_settings(pParse,&X,Y.pExpr);
+}
+
///////////////////////////// The PRAGMA command /////////////////////////////
//
cmd ::= PRAGMA nm(X). {
@@ -1559,9 +1564,6 @@ cmd ::= PRAGMA nm(X) LP minus_num(Y) RP. {
cmd ::= PRAGMA nm(X) LP nm(Z) DOT nm(Y) RP. {
sqlPragma(pParse,&X,&Y,&Z,0);
}
-cmd ::= PRAGMA . {
- sqlPragma(pParse, 0,0,0,0);
-}
nmnum(A) ::= plus_num(A).
nmnum(A) ::= STRING(A).
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 92bcf4e..0eaa2ca 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -62,56 +62,6 @@
#include "pragma.h"
#include "tarantoolInt.h"
-/*
- * Interpret the given string as a safety level. Return 0 for OFF,
- * 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
- * unrecognized string argument. The FULL and EXTRA option is disallowed
- * if the omitFull parameter it 1.
- *
- * Note that the values returned are one less that the values that
- * should be passed into sqlBtreeSetSafetyLevel(). The is done
- * to support legacy SQL code. The safety level used to be boolean
- * and older scripts may have used numbers 0 for OFF and 1 for ON.
- */
-static u8
-getSafetyLevel(const char *z, int omitFull, u8 dflt)
-{
- /* 123456789 123456789 123 */
- static const char zText[] = "onoffalseyestruextrafull";
- static const u8 iOffset[] = { 0, 1, 2, 4, 9, 12, 15, 20 };
- static const u8 iLength[] = { 2, 2, 3, 5, 3, 4, 5, 4 };
- static const u8 iValue[] = { 1, 0, 0, 0, 1, 1, 3, 2 };
- /* on no off false yes true extra full */
- int i, n;
- if (sqlIsdigit(*z)) {
- return (u8) sqlAtoi(z);
- }
- n = sqlStrlen30(z);
- for (i = 0; i < ArraySize(iLength); i++) {
- if (iLength[i] == n
- && sqlStrNICmp(&zText[iOffset[i]], z, n) == 0
- && (!omitFull || iValue[i] <= 1)
- ) {
- return iValue[i];
- }
- }
- return dflt;
-}
-
-/*
- * Interpret the given string as a boolean value.
- */
-u8
-sqlGetBoolean(const char *z, u8 dflt)
-{
- return getSafetyLevel(z, 1, dflt) != 0;
-}
-
-/* The sqlGetBoolean() function is used by other modules but the
- * remainder of this file is specific to PRAGMA processing. So omit
- * the rest of the file if PRAGMAs are omitted from the build.
- */
-
/** Set result column names and types for a pragma. */
static void
vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
@@ -128,17 +78,6 @@ vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
}
/*
- * Generate code to return a single integer value.
- */
-static void
-returnSingleInt(Vdbe * v, i64 value)
-{
- sqlVdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8 *)&value,
- value < 0 ? P4_INT64 : P4_UINT64);
- sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
-}
-
-/*
* Locate a pragma in the aPragmaName[] array.
*/
static const PragmaName *
@@ -161,53 +100,6 @@ pragmaLocate(const char *zName)
return lwr > upr ? 0 : &aPragmaName[mid];
}
-static void
-vdbe_emit_pragma_status(struct Parse *parse)
-{
- struct Vdbe *v = sqlGetVdbe(parse);
- struct session *user_session = current_session();
-
- sqlVdbeSetNumCols(v, 2);
- sqlVdbeSetColName(v, 0, COLNAME_NAME, "pragma_name", SQL_STATIC);
- sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "text", SQL_STATIC);
- sqlVdbeSetColName(v, 1, COLNAME_NAME, "pragma_value", SQL_STATIC);
- sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "integer", SQL_STATIC);
-
- parse->nMem = 2;
- for (int i = 0; i < ArraySize(aPragmaName); ++i) {
- if (aPragmaName[i].ePragTyp != PragTyp_FLAG)
- continue;
- sqlVdbeAddOp4(v, OP_String8, 0, 1, 0, aPragmaName[i].zName, 0);
- int val = (user_session->sql_flags & aPragmaName[i].iArg) != 0;
- sqlVdbeAddOp2(v, OP_Integer, val, 2);
- sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
- }
-}
-
-/**
- * Set tarantool backend default engine for SQL interface.
- * @param engine_name to set default.
- * @retval -1 on error.
- * @retval 0 on success.
- */
-static int
-sql_default_engine_set(const char *engine_name)
-{
- if (engine_name == NULL) {
- diag_set(ClientError, ER_ILLEGAL_PARAMS,
- "'sql_default_engine' was not specified");
- return -1;
- }
- enum sql_storage_engine engine =
- STR2ENUM(sql_storage_engine, engine_name);
- if (engine == sql_storage_engine_MAX) {
- diag_set(ClientError, ER_NO_SUCH_ENGINE, engine_name);
- return -1;
- }
- current_session()->sql_default_engine = engine;
- return 0;
-}
-
/**
* This function handles PRAGMA TABLE_INFO(<table>).
*
@@ -373,22 +265,6 @@ sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
}
/*
- * @brief Check whether the specified token is a string or ID.
- * @param token - token to be examined
- * @return true - if the token value is enclosed into quotes (')
- * @return false in other cases
- * The empty value is considered to be a string.
- */
-static bool
-token_is_string(const struct Token* token)
-{
- if (!token || token->n == 0)
- return true;
- return token->n >= 2 && token->z[0] == '\'' &&
- token->z[token->n - 1] == '\'';
-}
-
-/*
* Process a pragma statement.
*
* Pragmas are of this form:
@@ -416,17 +292,12 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
sql *db = pParse->db; /* The database connection */
Vdbe *v = sqlGetVdbe(pParse); /* Prepared statement */
const PragmaName *pPragma; /* The pragma */
- struct session *user_session = current_session();
if (v == 0)
return;
sqlVdbeRunOnlyOnce(v);
pParse->nMem = 2;
- if (pId == NULL) {
- vdbe_emit_pragma_status(pParse);
- return;
- }
zLeft = sql_name_from_token(db, pId);
if (zLeft == NULL) {
pParse->is_aborted = true;
@@ -456,38 +327,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
goto pragma_out;
}
/* Register the result column names for pragmas that return results */
- if ((pPragma->mPragFlg & PragFlg_NoColumns) == 0 &&
- ((pPragma->mPragFlg & PragFlg_NoColumns1) == 0 || zRight == NULL))
- vdbe_set_pragma_result_columns(v, pPragma);
+ vdbe_set_pragma_result_columns(v, pPragma);
/* Jump to the appropriate pragma handler */
switch (pPragma->ePragTyp) {
- case PragTyp_FLAG:{
- if (zRight == NULL) {
- vdbe_set_pragma_result_columns(v, pPragma);
- returnSingleInt(v, (user_session->sql_flags &
- pPragma->iArg) != 0);
- } else {
- /* Mask of bits to set or clear. */
- int mask = pPragma->iArg;
- bool is_pragma_set = sqlGetBoolean(zRight, 0);
-
- if (is_pragma_set)
- user_session->sql_flags |= mask;
- else
- user_session->sql_flags &= ~mask;
-#if defined(SQL_DEBUG)
- if (mask == PARSER_TRACE_FLAG) {
- if (is_pragma_set)
- sqlParserTrace(stdout, "parser: ");
- else
- sqlParserTrace(0, 0);
- }
-#endif
- }
- break;
- }
-
case PragTyp_TABLE_INFO:
sql_pragma_table_info(pParse, zRight);
break;
@@ -565,54 +408,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
break;
}
- case PragTyp_DEFAULT_ENGINE: {
- if (!token_is_string(pValue)) {
- diag_set(ClientError, ER_ILLEGAL_PARAMS,
- "string value is expected");
- pParse->is_aborted = true;
- goto pragma_out;
- }
- if (zRight == NULL) {
- const char *engine_name =
- sql_storage_engine_strs[current_session()->
- sql_default_engine];
- sqlVdbeLoadString(v, 1, engine_name);
- sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
- } else {
- if (sql_default_engine_set(zRight) != 0) {
- pParse->is_aborted = true;
- goto pragma_out;
- }
- sqlVdbeAddOp0(v, OP_Expire);
- }
- break;
- }
-
- case PragTyp_COMPOUND_SELECT_LIMIT: {
- if (zRight != NULL) {
- sql_limit(db, SQL_LIMIT_COMPOUND_SELECT,
- sqlAtoi(zRight));
- }
- int retval =
- sql_limit(db, SQL_LIMIT_COMPOUND_SELECT, -1);
- returnSingleInt(v, retval);
- break;
- }
-
default:
unreachable();
} /* End of the PRAGMA switch */
- /* The following block is a no-op unless SQL_DEBUG is
- * defined. Its only * purpose is to execute assert()
- * statements to verify that if the * PragFlg_NoColumns1 flag
- * is set and the caller specified an argument * to the PRAGMA,
- * the implementation has not added any OP_ResultRow *
- * instructions to the VM.
- */
- if ((pPragma->mPragFlg & PragFlg_NoColumns1) && zRight) {
- sqlVdbeVerifyNoResultRow(v);
- }
pragma_out:
sqlDbFree(db, zLeft);
sqlDbFree(db, zRight);
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index f337f0b..6c66d97 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -6,19 +6,14 @@
/* The various pragma types */
#define PragTyp_COLLATION_LIST 3
-#define PragTyp_FLAG 5
#define PragTyp_FOREIGN_KEY_LIST 9
#define PragTyp_INDEX_INFO 10
#define PragTyp_INDEX_LIST 11
#define PragTyp_STATS 15
#define PragTyp_TABLE_INFO 17
-#define PragTyp_DEFAULT_ENGINE 25
-#define PragTyp_COMPOUND_SELECT_LIMIT 26
/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
-#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
-#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
#define PragFlg_Result0 0x10 /* Acts as query when no argument */
#define PragFlg_Result1 0x20 /* Acts as query when has one argument */
#define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
@@ -93,51 +88,6 @@ static const char *const pragCName[] = {
/* 55 */ "text",
/* 56 */ "match",
/* 57 */ "text",
- /* Used by: defer_foreign_keys */
- /* 58 */ "defer_foreign_keys",
- /* 59 */ "integer",
- /* Used by: full_column_names */
- /* 60 */ "full_column_names",
- /* 61 */ "integer",
- /* Used by: parser_trace */
- /* 62 */ "parser_trace",
- /* 63 */ "integer",
- /* Used by: recursive_triggers */
- /* 64 */ "recursive_triggers",
- /* 65 */ "integer",
- /* Used by: reverse_unordered_selects */
- /* 66 */ "reverse_unordered_selects",
- /* 67 */ "integer",
- /* Used by: select_trace */
- /* 68 */ "select_trace",
- /* 69 */ "integer",
- /* Used by: sql_compound_select_limit */
- /* 70 */ "sql_compound_select_limit",
- /* 71 */ "integer",
- /* Used by: sql_default_engine */
- /* 72 */ "sql_default_engine",
- /* 73 */ "text",
- /* Used by: sql_trace */
- /* 74 */ "sql_trace",
- /* 75 */ "integer",
- /* Used by: vdbe_addoptrace */
- /* 76 */ "vdbe_addoptrace",
- /* 77 */ "integer",
- /* Used by: vdbe_debug */
- /* 78 */ "vdbe_debug",
- /* 79 */ "integer",
- /* Used by: vdbe_eqp */
- /* 80 */ "vdbe_eqp",
- /* 81 */ "integer",
- /* Used by: vdbe_listing */
- /* 82 */ "vdbe_listing",
- /* 83 */ "integer",
- /* Used by: vdbe_trace */
- /* 84 */ "vdbe_trace",
- /* 85 */ "integer",
- /* Used by: where_trace */
- /* 86 */ "where_trace",
- /* 87 */ "integer",
};
/* Definitions of all built-in pragmas */
@@ -159,22 +109,12 @@ static const PragmaName aPragmaName[] = {
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 38, 2,
/* iArg: */ 0},
- { /* zName: */ "defer_foreign_keys",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 58, 1,
- /* iArg: */ SQL_DeferFKs},
{ /* zName: */ "foreign_key_list",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
/* ePragFlg: */
PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
/* ColNames: */ 42, 8,
/* iArg: */ 0},
- { /* zName: */ "full_column_names",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 60, 1,
- /* iArg: */ SQL_FullColNames},
{ /* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */
@@ -187,47 +127,6 @@ static const PragmaName aPragmaName[] = {
PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
/* ColNames: */ 32, 3,
/* iArg: */ 0},
-#if defined(SQL_DEBUG)
- { /* zName: */ "parser_trace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 62, 1,
- /* iArg: */ PARSER_TRACE_FLAG},
-#endif
- { /* zName: */ "recursive_triggers",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 64, 1,
- /* iArg: */ SQL_RecTriggers},
- { /* zName: */ "reverse_unordered_selects",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 66, 1,
- /* iArg: */ SQL_ReverseOrder},
-#if defined(SQL_DEBUG)
- { /* zName: */ "select_trace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 68, 1,
- /* iArg: */ SQL_SelectTrace},
-#endif
- { /* zName: */ "sql_compound_select_limit",
- /* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
- /* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 70, 1,
- /* iArg: */ 0},
- { /* zName: */ "sql_default_engine",
- /* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 72, 1,
- /* iArg: */ 0},
-#if defined(SQL_DEBUG)
- { /* zName: */ "sql_trace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 74, 1,
- /* iArg: */ SQL_SqlTrace},
-#endif
{ /* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS,
/* ePragFlg: */
@@ -240,38 +139,5 @@ static const PragmaName aPragmaName[] = {
PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
/* ColNames: */ 0, 6,
/* iArg: */ 0},
-#if defined(SQL_DEBUG)
- { /* zName: */ "vdbe_addoptrace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 76, 1,
- /* iArg: */ SQL_VdbeAddopTrace},
- { /* zName: */ "vdbe_debug",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 78, 1,
- /* iArg: */
- SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
- { /* zName: */ "vdbe_eqp",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 80, 1,
- /* iArg: */ SQL_VdbeEQP},
- { /* zName: */ "vdbe_listing",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 82, 1,
- /* iArg: */ SQL_VdbeListing},
- { /* zName: */ "vdbe_trace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 84, 1,
- /* iArg: */ SQL_VdbeTrace},
- { /* zName: */ "where_trace",
- /* ePragTyp: */ PragTyp_FLAG,
- /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
- /* ColNames: */ 86, 1,
- /* iArg: */ SQL_WhereTrace},
-#endif
};
/* Number of pragmas: 36 on by default, 47 total. */
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 27a4c41..927c674 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -333,6 +333,11 @@ enum sql_ret_code {
SQL_DONE = 2,
};
+enum sql_setting_type {
+ SQL_SESSION_SETTING = 0,
+ SQL_GLOBAL_SETTING = 1,
+};
+
void *
sql_malloc(int);
@@ -3946,8 +3951,6 @@ int
sql_rem_int(int64_t lhs, bool is_lhs_neg, int64_t rhs, bool is_rhs_neg,
int64_t *res, bool *is_res_neg);
-u8 sqlGetBoolean(const char *z, u8);
-
const void *sqlValueText(sql_value *);
int sqlValueBytes(sql_value *);
void sqlValueSetStr(sql_value *, int, const void *,
@@ -4463,4 +4466,54 @@ int
sql_fieldno_by_name(struct Parse *parse_context, struct Expr *field_name,
uint32_t *fieldno);
+/**
+ * Create VDBE instructions to set new value of SQL setting.
+ *
+ * @param parse_context Parsing context.
+ * @param name Name of the SQL setting.
+ * @param value New value of the SQL setting.
+ */
+void
+sql_set_settings(struct Parse *parse_context, struct Token *name,
+ struct Expr *value);
+
+/**
+ * Set a new value for boolean SQL setting.
+ *
+ * @param id ID of the SQL setting.
+ * @param type type of the SQL setting.
+ * @param value New value of the SQL setting.
+ *
+ * @retval 0 on success.
+ * @retval -1 on error.
+ */
+int
+sql_set_boolean_option(int id, enum sql_setting_type type, bool value);
+
+/**
+ * Set a new value for string SQL setting.
+ *
+ * @param id ID of the SQL setting.
+ * @param type type of the SQL setting.
+ * @param value New value of the SQL setting.
+ *
+ * @retval 0 on success.
+ * @retval -1 on error.
+ */
+int
+sql_set_string_option(int id, enum sql_setting_type type, const char *value);
+
+/**
+ * Set a new value for integer SQL setting.
+ *
+ * @param id ID of the SQL setting.
+ * @param type type of the SQL setting.
+ * @param value New value of the SQL setting.
+ *
+ * @retval 0 on success.
+ * @retval -1 on error.
+ */
+int
+sql_set_integer_option(int id, enum sql_setting_type type, int value);
+
#endif /* sqlINT_H */
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 2e51a0d..788696f 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -5254,6 +5254,31 @@ case OP_IncMaxid: {
break;
}
+/* Opcode: Set P1 P2 P3 * *
+ *
+ * Set new value to SQL setting. P1 is either SQL_SESSION_SETTING
+ * or SQL_GLOBAL_SETTING. P2 is ID of the setting. P3 is an ID of
+ * register that contains value of the setting.
+ */
+case OP_Set: {
+ assert(pOp->p1 == SQL_SESSION_SETTING || pOp->p1 == SQL_GLOBAL_SETTING);
+ pIn3 = &aMem[pOp->p3];
+
+ if ((pIn3->flags & MEM_Bool) != 0) {
+ if (sql_set_boolean_option(pOp->p2, pOp->p1, pIn3->u.b) != 0)
+ goto abort_due_to_error;
+ } else if ((pIn3->flags & MEM_Str) != 0) {
+ if (sql_set_string_option(pOp->p2, pOp->p1, pIn3->z) != 0)
+ goto abort_due_to_error;
+ } else {
+ assert((pIn3->flags & MEM_Int) != 0 ||
+ (pIn3->flags & MEM_UInt) != 0);
+ if (sql_set_integer_option(pOp->p2, pOp->p1, pIn3->u.i) != 0)
+ goto abort_due_to_error;
+ }
+ break;
+}
+
/* Opcode: Noop * * * * *
*
* Do nothing. This instruction is often useful as a jump
diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
index 7d7498f..cc530ce 100755
--- a/test/sql-tap/analyze4.test.lua
+++ b/test/sql-tap/analyze4.test.lua
@@ -70,9 +70,9 @@ test:do_test(
function()
return test:execsql([[
UPDATE t1 SET b='x' WHERE a%2;
--- pragma vdbe_debug=1;
+-- set vdbe_debug=true;
ANALYZE;
--- pragma vdbe_debug=0;
+-- set vdbe_debug=false;
SELECT "idx", "stat" FROM "_sql_stat1" WHERE "tbl"='T1' ORDER BY "idx";
]])
end, {
diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
index 39e4796..7b36379 100755
--- a/test/sql-tap/autoinc.test.lua
+++ b/test/sql-tap/autoinc.test.lua
@@ -640,7 +640,7 @@ test:do_test(
-- </autoinc-10.3>
})
-test:catchsql(" pragma recursive_triggers = off ")
+test:catchsql("SET sql_recursive_triggers = false")
-- Ticket #3928. Make sure that triggers to not make extra slots in
-- the sql_SEQUENCE table.
--
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index de03d7c..1037bed 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -43,14 +43,14 @@ local function lreplace(arr, pos, len, val)
end
test:do_test(
- "colname-1.1",
+ "colname-1.2",
function()
- return test:execsql "PRAGMA full_column_names"
- end, {
+ return box.space._vsession_settings:get("sql_full_column_names").value
+ end,
-- <colname-1.2>
- 0
+ false
-- </colname-1.2>
- })
+ )
-- Tests for then short=ON and full=any
--
@@ -163,7 +163,7 @@ test:do_test(
"colname-3.1",
function()
test:execsql [[
- PRAGMA full_column_names='OFF';
+ SET sql_full_column_names = false;
CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
FROM tabc, txyz ORDER BY 1 LIMIT 1;
CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
@@ -283,7 +283,7 @@ test:do_test(
"colname-4.1",
function()
test:execsql [[
- PRAGMA full_column_names='ON';
+ SET sql_full_column_names = true;
CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
FROM tabc, txyz ORDER BY 1 LIMIT 1;
CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
@@ -440,7 +440,7 @@ test:do_test(
-- instead of reconnect to database
-- we are just turning settings to default state
test:execsql([[
- PRAGMA full_column_names='OFF';
+ SET sql_full_column_names = false;
]])
test:execsql [=[
CREATE TABLE t6(a INT primary key, "'a'" INT, """a""" INT, "[a]" INT, "`a`" INT);
diff --git a/test/sql-tap/fkey2.test.lua b/test/sql-tap/fkey2.test.lua
index 264616d..de89790 100755
--- a/test/sql-tap/fkey2.test.lua
+++ b/test/sql-tap/fkey2.test.lua
@@ -450,7 +450,7 @@ test:do_execsql_test(
test:do_execsql_test(
"fkey2-4.2",
[[
- PRAGMA recursive_triggers = off;
+ SET sql_recursive_triggers = false;
DELETE FROM t1 WHERE node = 1;
SELECT node FROM t1;
]], {
@@ -473,7 +473,7 @@ test:do_execsql_test(
test:do_execsql_test(
"fkey2-4.4",
[[
- PRAGMA recursive_triggers = on;
+ SET sql_recursive_triggers = true;
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1(
diff --git a/test/sql-tap/gh2548-select-compound-limit.test.lua b/test/sql-tap/gh2548-select-compound-limit.test.lua
index f578870..c802003 100755
--- a/test/sql-tap/gh2548-select-compound-limit.test.lua
+++ b/test/sql-tap/gh2548-select-compound-limit.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(14)
+test:plan(13)
-- box.cfg{wal_mode='none'}
@@ -53,7 +53,6 @@ for _, term in ipairs({'UNION', 'UNION ALL', 'INTERSECT', 'EXCEPT'}) do
-- end
end
-
test:do_catchsql_test(
"gh2548-select-compound-limit-2",
select_string_last, {
@@ -63,20 +62,10 @@ test:do_catchsql_test(
})
test:do_execsql_test(
- "gh2548-select-compound-limit-3.1", [[
- pragma sql_compound_select_limit
- ]], {
- -- <gh2548-select-compound-limit-3.1>
- 30
- -- </gh2548-select-compound-limit-3.1>
- })
-
-test:do_execsql_test(
"gh2548-select-compound-limit-3.2", [[
- pragma sql_compound_select_limit=31
+ SET sql_compound_select_limit = 31;
]], {
-- <gh2548-select-compound-limit-3.2>
- 31
-- </gh2548-select-compound-limit-3.2>
})
@@ -90,10 +79,9 @@ test:do_execsql_test(
test:do_execsql_test(
"gh2548-select-compound-limit-3.4", [[
- pragma sql_compound_select_limit=0
+ SET sql_compound_select_limit = 0;
]], {
-- <gh2548-select-compound-limit-3.4>
- 0
-- </gh2548-select-compound-limit-3.4>
})
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 0f34114..c50e3fd 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -413,7 +413,7 @@ box.cfg{
}
local engine = test_run and test_run:get_cfg('engine') or 'memtx'
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
function test.engine(self)
return engine
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index b84093e..339c9d7 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -219,7 +219,7 @@ test:do_test(
local r = test:execsql([[
CREATE TABLE t1(a TEXT primary KEY);
INSERT INTO t1 VALUES('hi');
- PRAGMA full_column_names=on;
+ SET sql_full_column_names = true;
--SELECT rowid, * FROM t1;
SELECT * FROM t1;
]])
diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua
index b3821dc..d6f8b54 100755
--- a/test/sql-tap/pragma.test.lua
+++ b/test/sql-tap/pragma.test.lua
@@ -1,7 +1,7 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(23)
+test:plan(10)
test:do_catchsql_test(
"pragma-1.3",
@@ -19,66 +19,7 @@ test:do_catchsql_test(
[[
pragma sql_default_engine='creepy';
]], {
- 1, "Space engine 'creepy' does not exist"
-})
-
-test:do_catchsql_test(
- "pragma-2.2",
- [[
- pragma sql_default_engine='vinyl';
- ]], {
- 0
-})
-
-test:do_catchsql_test(
- "pragma-2.3",
- [[
- pragma sql_default_engine='memtx';
- ]], {
- 0
-})
-
-test:do_catchsql_test(
- "pragma-2.4",
- [[
- pragma sql_default_engine 'memtx';
- ]], {
- 1, "Syntax error near ''memtx''"
-})
-
-test:do_catchsql_test(
- "pragma-2.5",
- [[
- pragma sql_default_engine 1;
- ]], {
- 1, "Syntax error near '1'"
-})
-
---
--- gh-3832: Some statements do not return column type
---
--- Check that "PRAGMA sql_default_engine" called without arguments
--- returns currently set sql_default_engine.
-test:do_execsql_test(
- "pragma-3.1",
- [[
- pragma sql_default_engine='vinyl';
- pragma sql_default_engine;
- ]], {
- -- <pragma-3.1>
- 'vinyl'
- -- </pragma-3.1>
-})
-
-test:do_execsql_test(
- "pragma-3.2",
- [[
- pragma sql_default_engine='memtx';
- pragma sql_default_engine;
- ]], {
- -- <pragma-3.2>
- 'memtx'
- -- </pragma-3.2>
+ 1, "Pragma 'SQL_DEFAULT_ENGINE' does not exist"
})
--
@@ -187,76 +128,4 @@ test:do_execsql_test(
-- </pragma-8.4>
})
----
---- pragma sql_default_engine accepts string values and rejects IDs
----
-test:do_catchsql_test(
- "pragma-9.1",
- [[
- pragma sql_default_engine(the_engine);
- ]], {
- -- <pragma-9.1>
- 1, "Illegal parameters, string value is expected"
- -- </pragma-9.1>
-})
-
-test:do_catchsql_test(
- "pragma-9.2",
- [[
- pragma sql_default_engine(THE_ENGINE);
- ]], {
- -- <pragma-9.2>
- 1, "Illegal parameters, string value is expected"
- -- </pragma-9.2>
-})
-
-test:do_catchsql_test(
- "pragma-9.3",
- [[
- pragma sql_default_engine("THE_ENGINE");
- ]], {
- -- <pragma-9.3>
- 1, "Illegal parameters, string value is expected"
- -- </pragma-9.3>
-})
-
-test:do_catchsql_test(
- "pragma-9.4",
- [[
- pragma sql_default_engine('THE_ENGINE');
- ]], {
- -- <pragma-9.4>
- 1, "Space engine 'THE_ENGINE' does not exist"
- -- </pragma-9.4>
-})
-
-test:do_catchsql_test(
- "pragma-9.5",
- [[
- pragma sql_default_engine(memtx);
- ]], {
- -- <pragma-9.5>
- 1, "Illegal parameters, string value is expected"
- -- </pragma-9.5>
-})
-
-test:do_catchsql_test(
- "pragma-9.6",
- [[
- pragma sql_default_engine("memtx");
- ]], {
- -- <pragma-9.6>
- 1, "Illegal parameters, string value is expected"
- -- </pragma-9.6>
-})
-
-test:do_execsql_test(
- "pragma-9.7",
- [[
- pragma sql_default_engine('memtx');
- ]], {
- -- <pragma-9.7>
- -- </pragma-9.7>
-})
-
test:finish_test()
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index d8fe7a9..2caa612 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -916,7 +916,7 @@ test:do_catchsql2_test(
test:do_test(
"select1-6.1.1",
function()
- test:execsql "PRAGMA full_column_names=on"
+ test:execsql "SET sql_full_column_names = true"
return test:catchsql2 "SELECT f1 FROM test1 ORDER BY f2"
end, {
-- <select1-6.1.1>
@@ -952,7 +952,7 @@ test:do_test(
msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
end)
v = v == true and {0} or {1}
- test:execsql "PRAGMA full_column_names=off"
+ test:execsql "SET sql_full_column_names = false"
return table.insert(v,msg) or v
end, {
-- <select1-6.1.4>
@@ -1043,13 +1043,13 @@ test:do_catchsql2_test(
test:do_test(
"select1-6.5.1",
function()
- test:execsql2 "PRAGMA full_column_names=on"
+ test:execsql2 "SET sql_full_column_names = true"
local msg
v = pcall( function ()
msg = test:execsql2 "SELECT test1.f1+F2 FROM test1 ORDER BY f2"
end)
v = v == true and {0} or {1}
- test:execsql2 "PRAGMA full_column_names=off"
+ test:execsql2 "SET sql_full_column_names = false"
return table.insert(v,msg) or v
end, {
-- <select1-6.5.1>
@@ -1124,7 +1124,7 @@ test:do_test(
"select1-6.9.3",
function()
test:execsql [[
- PRAGMA full_column_names='OFF';
+ SET sql_full_column_names = false;
]]
return test:execsql2 [[
SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
@@ -1139,7 +1139,7 @@ test:do_test(
"select1-6.9.4",
function()
test:execsql [[
- PRAGMA full_column_names='ON';
+ SET sql_full_column_names = true;
]]
return test:execsql2 [[
SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
@@ -1154,7 +1154,7 @@ test:do_test(
"select1-6.9.5",
function()
test:execsql [[
- PRAGMA full_column_names='ON';
+ SET sql_full_column_names = true;
]]
return test:execsql2 [[
SELECT 123.45;
@@ -1235,7 +1235,7 @@ test:do_test(
"select1-6.9.11",
function()
test:execsql [[
- PRAGMA full_column_names='ON';
+ SET sql_full_column_names = true;
]]
return test:execsql2 [[
SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
@@ -1260,7 +1260,7 @@ test:do_test(
"select1-6.9.13",
function()
test:execsql [[
- PRAGMA full_column_names='OFF';
+ SET sql_full_column_names = false;
]]
return test:execsql2 [[
SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
@@ -1285,7 +1285,7 @@ test:do_test(
"select1-6.9.15",
function()
test:execsql [[
- PRAGMA full_column_names='ON';
+ SET sql_full_column_names = true;
]]
return test:execsql2 [[
SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
@@ -1307,7 +1307,7 @@ test:do_execsql2_test(
})
test:execsql [[
- PRAGMA full_column_names='OFF';
+ SET sql_full_column_names = false;
]]
test:do_catchsql2_test(
"select1-6.10",
diff --git a/test/sql-tap/tkt3731.test.lua b/test/sql-tap/tkt3731.test.lua
index 454cf67..57e7f3f 100755
--- a/test/sql-tap/tkt3731.test.lua
+++ b/test/sql-tap/tkt3731.test.lua
@@ -22,7 +22,7 @@ test:plan(3)
-- The tests in this file were written before sql supported recursive
-- trigger invocation, and some tests depend on that to pass. So disable
-- recursive triggers for this file.
-test:catchsql " pragma recursive_triggers = off "
+test:catchsql("SET sql_recursive_triggers = false")
test:do_execsql_test(
"tkt3731-1.1",
[[
diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
index 6e60050..dbe54db 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -58,7 +58,7 @@ test:plan(26)
-- The tests in this file were written before sql supported recursive
-- trigger invocation, and some tests depend on that to pass. So disable
-- recursive triggers for this file.
-test:catchsql " pragma recursive_triggers = off "
+test:catchsql("SET sql_recursive_triggers = false")
-- 1.
ii = 0
tbl_definitions = { "CREATE TABLE tbl (id INT PRIMARY KEY AUTOINCREMENT, a INTEGER UNIQUE, b INT );",
diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
index cf7dd7b..f9b7034 100755
--- a/test/sql-tap/triggerC.test.lua
+++ b/test/sql-tap/triggerC.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(48)
+test:plan(45)
--!./tcltestrunner.lua
-- 2009 August 24
@@ -36,12 +36,9 @@ testprefix = "triggerC"
-- REPLACE conflict resolution. And that they are not fired
-- if recursive triggers are not enabled.
--
--- triggerC-6.*: Test that the recursive_triggers pragma returns correct
--- results when invoked without an argument.
---
-- Enable recursive triggers for this file.
--
-test:execsql " PRAGMA recursive_triggers = on "
+test:execsql("SET sql_recursive_triggers = true;")
---------------------------------------------------------------------------
-- This block of tests, triggerC-1.*, are not aimed at any specific
-- property of the triggers sub-system. They were created to debug
@@ -504,7 +501,7 @@ test:do_execsql_test(
test:do_execsql_test(
"triggerC-5.3.0",
[[
- PRAGMA recursive_triggers = off
+ SET sql_recursive_triggers = false
]], {
-- <triggerC-5.3.0>
@@ -534,49 +531,13 @@ test:do_execsql_test(
test:do_execsql_test(
"triggerC-5.3.8",
[[
- PRAGMA recursive_triggers = on
+ SET sql_recursive_triggers = true
]], {
-- <triggerC-5.3.8>
-- </triggerC-5.3.8>
})
----------------------------------------------------------------------------
--- This block of tests, triggerC-6.*, tests that "PRAGMA recursive_triggers"
--- statements return the current value of the recursive triggers flag.
---
-test:do_execsql_test(
- "triggerC-6.1",
- [[
- PRAGMA recursive_triggers
- ]], {
- -- <triggerC-6.1>
- 1
- -- </triggerC-6.1>
- })
-
-test:do_execsql_test(
- "triggerC-6.2",
- [[
- PRAGMA recursive_triggers = off;
- PRAGMA recursive_triggers;
- ]], {
- -- <triggerC-6.2>
- 0
- -- </triggerC-6.2>
- })
-
-test:do_execsql_test(
- "triggerC-6.3",
- [[
- PRAGMA recursive_triggers = on;
- PRAGMA recursive_triggers;
- ]], {
- -- <triggerC-6.3>
- 1
- -- </triggerC-6.3>
- })
-
-- MUST_WORK_TEST
-- #-------------------------------------------------------------------------
-- # Test some of the "undefined behaviour" associated with triggers. The
@@ -890,7 +851,7 @@ test:execsql(
test:do_execsql_test(
"triggerC-13.1",
[[
- PRAGMA recursive_triggers = 'ON';
+ SET sql_recursive_triggers = true;
CREATE TABLE t12(id INTEGER PRIMARY KEY, a INT, b INT);
INSERT INTO t12 VALUES(1, 1, 2);
CREATE TRIGGER tr12 AFTER UPDATE ON t12 FOR EACH ROW BEGIN
@@ -974,7 +935,7 @@ test:do_execsql_test(
test:do_execsql_test(
"triggerC-15.1.1",
[[
- PRAGMA recursive_triggers = 1;
+ SET sql_recursive_triggers = true;
CREATE TABLE node(
id int not null primary key,
pid int not null default 0,
diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
index ac0389a..992a3c7 100755
--- a/test/sql-tap/update.test.lua
+++ b/test/sql-tap/update.test.lua
@@ -442,7 +442,6 @@ test:do_execsql_test("update-5.6.5", [[
-- Repeat the previous sequence of tests with a different index.
--
---test:execsql "PRAGMA synchronous='FULL'"
test:do_test("update-6.0", function()
test:execsql "DROP INDEX idx1 ON test1"
test:execsql "CREATE INDEX idx1 ON test1(f2)"
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index b82575f..21675d5 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -14,7 +14,7 @@ test:plan(17)
--
-------------------------------------------------------------------------
-- This file implements regression tests for sql library. The
--- focus of this file is testing the reverse_select_order pragma.
+-- focus of this file is testing the reverse_select_order option.
--
-- $Id: whereA.test,v 1.3 2009/06/10 19:33:29 drh Exp $
-- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -39,7 +39,7 @@ test:do_test(
"whereA-1.2",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=1;
+ SET sql_reverse_unordered_selects = true;
SELECT * FROM t1;
]]
end, {
@@ -55,7 +55,7 @@ test:do_test(
--db close
--sql db test.db
return test:execsql [[
- PRAGMA reverse_unordered_selects=1;
+ SET sql_reverse_unordered_selects = true;
SELECT * FROM t1;
]]
end, {
@@ -68,7 +68,7 @@ test:do_test(
-- db close
-- sql db test.db
-- db eval {
--- PRAGMA reverse_unordered_selects=1;
+-- SET sql_reverse_unordered_selects = true;
-- SELECT * FROM t1 ORDER BY rowid;
-- }
-- } {1 2 3 2 hello world 3 4.53 {}}
@@ -76,11 +76,11 @@ test:do_test(
"whereA-1.6",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects;
+ SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_reverse_unordered_selects';
]]
end, {
-- <whereA-1.6>
- 1
+ true
-- </whereA-1.6>
})
@@ -108,7 +108,7 @@ test:do_test(
"whereA-2.1",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=0;
+ SET sql_reverse_unordered_selects = false;
SELECT * FROM t1 WHERE a>0;
]]
end, {
@@ -121,7 +121,7 @@ test:do_test(
"whereA-2.2",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=1;
+ SET sql_reverse_unordered_selects = true;
SELECT * FROM t1 WHERE a>0;
]]
end, {
@@ -132,7 +132,7 @@ test:do_test(
-- do_test whereA-2.3 {
-- db eval {
--- PRAGMA reverse_unordered_selects=1;
+-- SET sql_reverse_unordered_selects = true;
-- SELECT * FROM t1 WHERE a>0 ORDER BY rowid;
-- }
-- } {1 2 3 2 hello world 3 4.53 {}}
@@ -140,7 +140,7 @@ test:do_test(
"whe:reA-3.1",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=0;
+ SET sql_reverse_unordered_selects = false;
SELECT * FROM t1 WHERE b>0;
]]
end, {
@@ -153,7 +153,7 @@ test:do_test(
"whereA-3.2",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=1;
+ SET sql_reverse_unordered_selects = true;
SELECT * FROM t1 WHERE b>0;
]]
end, {
@@ -166,7 +166,7 @@ test:do_test(
"whereA-3.3",
function()
return test:execsql [[
- PRAGMA reverse_unordered_selects=1;
+ SET sql_reverse_unordered_selects = true;
SELECT * FROM t1 WHERE b>0 ORDER BY b;
]]
end, {
diff --git a/test/sql/check-clear-ephemeral.result b/test/sql/check-clear-ephemeral.result
index 7d0be5f..3b12457 100644
--- a/test/sql/check-clear-ephemeral.result
+++ b/test/sql/check-clear-ephemeral.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
---
diff --git a/test/sql/check-clear-ephemeral.test.lua b/test/sql/check-clear-ephemeral.test.lua
index 929a6c9..2ecf11c 100644
--- a/test/sql/check-clear-ephemeral.test.lua
+++ b/test/sql/check-clear-ephemeral.test.lua
@@ -1,13 +1,13 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
-- create space
box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
diff --git a/test/sql/checks.result b/test/sql/checks.result
index a952b2b..f9a6772 100644
--- a/test/sql/checks.result
+++ b/test/sql/checks.result
@@ -11,7 +11,7 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -736,7 +736,7 @@ physics_ck:drop()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
index 4d33823..ffcbd26 100644
--- a/test/sql/checks.test.lua
+++ b/test/sql/checks.test.lua
@@ -2,7 +2,7 @@ env = require('test_run')
test_run = env.new()
test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
--
-- gh-3272: Move SQL CHECK into server
@@ -240,7 +240,7 @@ physics_ck:drop()
-- :enable configurator.
--
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.execute("CREATE TABLE test(a INT PRIMARY KEY);");
box.execute('ALTER TABLE test ADD CONSTRAINT CK CHECK(a < 5);')
box.space.TEST:insert({10})
diff --git a/test/sql/clear.result b/test/sql/clear.result
index afa6520..baeb15e 100644
--- a/test/sql/clear.result
+++ b/test/sql/clear.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON;")
+-- box.execute("SET vdbe_debug=ON;")
-- Seed entry
for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
---
diff --git a/test/sql/clear.test.lua b/test/sql/clear.test.lua
index 4c58767..8d5e8fb 100644
--- a/test/sql/clear.test.lua
+++ b/test/sql/clear.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON;")
+-- box.execute("SET vdbe_debug=ON;")
-- Seed entry
for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
diff --git a/test/sql/collation.result b/test/sql/collation.result
index 11962ef..dc11d28 100644
--- a/test/sql/collation.result
+++ b/test/sql/collation.result
@@ -7,7 +7,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
index 1be28b3..5e33562 100644
--- a/test/sql/collation.test.lua
+++ b/test/sql/collation.test.lua
@@ -1,7 +1,7 @@
remote = require('net.box')
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- gh-3010: COLLATE after LIMIT should throw an error
diff --git a/test/sql/ddl.result b/test/sql/ddl.result
index 28acf37..af833d0 100644
--- a/test/sql/ddl.result
+++ b/test/sql/ddl.result
@@ -8,7 +8,7 @@ json = require('json')
engine = test_run:get_cfg('engine')
| ---
| ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
| ---
| - row_count: 0
| ...
diff --git a/test/sql/ddl.test.lua b/test/sql/ddl.test.lua
index 6067b61..b6f0c81 100644
--- a/test/sql/ddl.test.lua
+++ b/test/sql/ddl.test.lua
@@ -1,7 +1,7 @@
test_run = require('test_run').new()
json = require('json')
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
--
-- gh-4086: SQL transactional DDL.
diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
index ca58feb..3d58daf 100644
--- a/test/sql/delete-multiple-idx.result
+++ b/test/sql/delete-multiple-idx.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
- row_count: 1
...
-- Debug.
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries.
box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
---
diff --git a/test/sql/delete-multiple-idx.test.lua b/test/sql/delete-multiple-idx.test.lua
index a81cccc..2715d2f 100644
--- a/test/sql/delete-multiple-idx.test.lua
+++ b/test/sql/delete-multiple-idx.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -9,7 +9,7 @@ box.execute("CREATE TABLE t3(id INT primary key,x INT,y INT);");
box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
-- Debug.
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries.
box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
diff --git a/test/sql/delete.result b/test/sql/delete.result
index e27c79d..9aa074f 100644
--- a/test/sql/delete.result
+++ b/test/sql/delete.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t1 VALUES(1, 2);");
---
diff --git a/test/sql/delete.test.lua b/test/sql/delete.test.lua
index 75448d4..ff1e622 100644
--- a/test/sql/delete.test.lua
+++ b/test/sql/delete.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t1 VALUES(1, 2);");
diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
index e8eb642..551e56f 100644
--- a/test/sql/drop-index.result
+++ b/test/sql/drop-index.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -23,7 +23,7 @@ box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
-- Dummy entry
box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
---
diff --git a/test/sql/drop-index.test.lua b/test/sql/drop-index.test.lua
index 8cd86ee..fd420b6 100644
--- a/test/sql/drop-index.test.lua
+++ b/test/sql/drop-index.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -11,7 +11,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zzoobar(c1, c4)")
box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
-- Dummy entry
box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
diff --git a/test/sql/drop-table.result b/test/sql/drop-table.result
index 7bc073d..ef4c5cf 100644
--- a/test/sql/drop-table.result
+++ b/test/sql/drop-table.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -15,7 +15,7 @@ box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
---
- row_count: 1
diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua
index a310db1..f0b1645 100644
--- a/test/sql/drop-table.test.lua
+++ b/test/sql/drop-table.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
diff --git a/test/sql/engine.result b/test/sql/engine.result
index 3ee93ad..b392566 100644
--- a/test/sql/engine.result
+++ b/test/sql/engine.result
@@ -4,7 +4,7 @@ env = require('test_run')
test_run = env.new()
---
...
-box.execute("pragma sql_default_engine='vinyl'")
+box.execute("set sql_default_engine='vinyl'")
---
- row_count: 0
...
@@ -16,7 +16,7 @@ box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
---
- row_count: 1
...
-box.execute("pragma sql_default_engine='memtx'")
+box.execute("set sql_default_engine='memtx'")
---
- row_count: 0
...
@@ -66,7 +66,7 @@ assert(box.space.T1_MEMTX.engine == 'memtx')
---
- true
...
-box.execute("pragma sql_default_engine='vinyl'")
+box.execute("set sql_default_engine='vinyl'")
---
- row_count: 0
...
diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
index 112d3d3..bc16cc0 100644
--- a/test/sql/engine.test.lua
+++ b/test/sql/engine.test.lua
@@ -1,11 +1,11 @@
env = require('test_run')
test_run = env.new()
-box.execute("pragma sql_default_engine='vinyl'")
+box.execute("set sql_default_engine='vinyl'")
box.execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
-box.execute("pragma sql_default_engine='memtx'")
+box.execute("set sql_default_engine='memtx'")
box.execute("CREATE TABLE t3_memtx(a INT PRIMARY KEY, b INT, c INT);")
assert(box.space.T1_VINYL.engine == 'vinyl')
@@ -22,7 +22,7 @@ box.execute("CREATE TABLE t1_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
assert(box.space.T1_VINYL.engine == 'vinyl')
box.execute("CREATE TABLE t1_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
assert(box.space.T1_MEMTX.engine == 'memtx')
-box.execute("pragma sql_default_engine='vinyl'")
+box.execute("set sql_default_engine='vinyl'")
box.execute("CREATE TABLE t2_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
assert(box.space.T2_VINYL.engine == 'vinyl')
box.execute("CREATE TABLE t2_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
diff --git a/test/sql/errinj.result b/test/sql/errinj.result
index 7ab522f..c94afae 100644
--- a/test/sql/errinj.result
+++ b/test/sql/errinj.result
@@ -7,7 +7,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
index b978767..d21629d 100644
--- a/test/sql/errinj.test.lua
+++ b/test/sql/errinj.test.lua
@@ -1,7 +1,7 @@
remote = require('net.box')
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
errinj = box.error.injection
fiber = require('fiber')
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index a0a67a1..6083d19 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index 0b32ea9..a819587 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Check errors during function create process
fiber = require('fiber')
diff --git a/test/sql/gh-2362-select-access-rights.result b/test/sql/gh-2362-select-access-rights.result
index b15b0da..f929914 100644
--- a/test/sql/gh-2362-select-access-rights.result
+++ b/test/sql/gh-2362-select-access-rights.result
@@ -7,7 +7,7 @@ engine = test_run:get_cfg('engine')
nb = require('net.box')
---
...
-box.execute("PRAGMA sql_default_engine='"..engine.."'")
+box.execute("SET sql_default_engine='"..engine.."'")
---
- row_count: 0
...
diff --git a/test/sql/gh-2362-select-access-rights.test.lua b/test/sql/gh-2362-select-access-rights.test.lua
index f2b66b6..5666b68 100644
--- a/test/sql/gh-2362-select-access-rights.test.lua
+++ b/test/sql/gh-2362-select-access-rights.test.lua
@@ -2,7 +2,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
nb = require('net.box')
-box.execute("PRAGMA sql_default_engine='"..engine.."'")
+box.execute("SET sql_default_engine='"..engine.."'")
box.execute("CREATE TABLE t1 (s1 INT PRIMARY KEY, s2 INT UNIQUE);")
box.execute("CREATE TABLE t2 (s1 INT PRIMARY KEY);")
box.execute("INSERT INTO t1 VALUES (1, 1);")
diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result
index 021d037..35daaf2 100644
--- a/test/sql/gh-2929-primary-key.result
+++ b/test/sql/gh-2929-primary-key.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
index 9cc6cd5..f419668 100644
--- a/test/sql/gh-2929-primary-key.test.lua
+++ b/test/sql/gh-2929-primary-key.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- All tables in SQL are now WITHOUT ROW ID, so if user
-- tries to create table without a primary key, an appropriate error message
diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result
index d2938cd..11fed1e 100644
--- a/test/sql/gh-2981-check-autoinc.result
+++ b/test/sql/gh-2981-check-autoinc.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
index 0eb8f73..afbefa0 100644
--- a/test/sql/gh-2981-check-autoinc.test.lua
+++ b/test/sql/gh-2981-check-autoinc.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.cfg{}
diff --git a/test/sql/gh-3199-no-mem-leaks.result b/test/sql/gh-3199-no-mem-leaks.result
index e7ba1d2..00211ce 100644
--- a/test/sql/gh-3199-no-mem-leaks.result
+++ b/test/sql/gh-3199-no-mem-leaks.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
index 54a6ce5..f63bedf 100644
--- a/test/sql/gh-3199-no-mem-leaks.test.lua
+++ b/test/sql/gh-3199-no-mem-leaks.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
fiber = require('fiber')
-- This test checks that no leaks of region memory happens during
diff --git a/test/sql/gh-3613-idx-alter-update-2.result b/test/sql/gh-3613-idx-alter-update-2.result
index ff63eb2..270f961 100644
--- a/test/sql/gh-3613-idx-alter-update-2.result
+++ b/test/sql/gh-3613-idx-alter-update-2.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-3613-idx-alter-update-2.test.lua b/test/sql/gh-3613-idx-alter-update-2.test.lua
index ff5b651..33730ff 100644
--- a/test/sql/gh-3613-idx-alter-update-2.test.lua
+++ b/test/sql/gh-3613-idx-alter-update-2.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
box.execute('CREATE INDEX i ON t (s1)')
diff --git a/test/sql/gh-3613-idx-alter-update.result b/test/sql/gh-3613-idx-alter-update.result
index ba323a6..34b4a1f 100644
--- a/test/sql/gh-3613-idx-alter-update.result
+++ b/test/sql/gh-3613-idx-alter-update.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-3613-idx-alter-update.test.lua b/test/sql/gh-3613-idx-alter-update.test.lua
index 3027182..389a99d 100644
--- a/test/sql/gh-3613-idx-alter-update.test.lua
+++ b/test/sql/gh-3613-idx-alter-update.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
box.execute('CREATE INDEX i ON t (s1)')
diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
index 4b8e7ed..5691e70 100644
--- a/test/sql/gh-3888-values-blob-assert.result
+++ b/test/sql/gh-3888-values-blob-assert.result
@@ -10,7 +10,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh-3888-values-blob-assert.test.lua b/test/sql/gh-3888-values-blob-assert.test.lua
index 0b7c385..9680aa5 100644
--- a/test/sql/gh-3888-values-blob-assert.test.lua
+++ b/test/sql/gh-3888-values-blob-assert.test.lua
@@ -6,7 +6,7 @@
--
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- check 'VALUES' against typedef keywords (should fail)
box.execute('VALUES(scalar)')
diff --git a/test/sql/gh2141-delete-trigger-drop-table.result b/test/sql/gh2141-delete-trigger-drop-table.result
index 1d373f5..a218328 100644
--- a/test/sql/gh2141-delete-trigger-drop-table.result
+++ b/test/sql/gh2141-delete-trigger-drop-table.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
index 4d21fd7..2d5b987 100644
--- a/test/sql/gh2141-delete-trigger-drop-table.test.lua
+++ b/test/sql/gh2141-delete-trigger-drop-table.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- create space
box.execute("CREATE TABLE t(id INT PRIMARY KEY)")
diff --git a/test/sql/gh2251-multiple-update.result b/test/sql/gh2251-multiple-update.result
index 42ebf7f..7a21cea 100644
--- a/test/sql/gh2251-multiple-update.result
+++ b/test/sql/gh2251-multiple-update.result
@@ -5,7 +5,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
index 4d55096..eeff047 100644
--- a/test/sql/gh2251-multiple-update.test.lua
+++ b/test/sql/gh2251-multiple-update.test.lua
@@ -1,7 +1,7 @@
-- Regression test for #2251
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
index d69fcbd..a7dd7d2 100644
--- a/test/sql/gh2483-remote-persistency-check.result
+++ b/test/sql/gh2483-remote-persistency-check.result
@@ -8,7 +8,7 @@ test_run = env.new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
index 7db1602..bf2fc6b 100644
--- a/test/sql/gh2483-remote-persistency-check.test.lua
+++ b/test/sql/gh2483-remote-persistency-check.test.lua
@@ -2,7 +2,7 @@
env = require('test_run')
test_run = env.new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.schema.user.grant('guest', 'read,write,execute', 'universe')
diff --git a/test/sql/gh2808-inline-unique-persistency-check.result b/test/sql/gh2808-inline-unique-persistency-check.result
index a277b3f..db03feb 100644
--- a/test/sql/gh2808-inline-unique-persistency-check.result
+++ b/test/sql/gh2808-inline-unique-persistency-check.result
@@ -8,7 +8,7 @@ test_run = env.new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
index 26b646a..ef38ae3 100644
--- a/test/sql/gh2808-inline-unique-persistency-check.test.lua
+++ b/test/sql/gh2808-inline-unique-persistency-check.test.lua
@@ -2,7 +2,7 @@
env = require('test_run')
test_run = env.new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Create a table and insert a datum
box.execute([[CREATE TABLE t1(a INT PRIMARY KEY, b INT, UNIQUE(b));]])
diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result
index 8ff7528..cb687a1 100644
--- a/test/sql/icu-upper-lower.result
+++ b/test/sql/icu-upper-lower.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
index 00e9699..bbd4f00 100644
--- a/test/sql/icu-upper-lower.test.lua
+++ b/test/sql/icu-upper-lower.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
test_run:cmd("setopt delimiter ';'")
diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
index 1cf44c9..ec57681 100644
--- a/test/sql/insert-unique.result
+++ b/test/sql/insert-unique.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entry
box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
---
diff --git a/test/sql/insert-unique.test.lua b/test/sql/insert-unique.test.lua
index 026bc9d..243333e 100644
--- a/test/sql/insert-unique.test.lua
+++ b/test/sql/insert-unique.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entry
box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
index 223ba02..c886f8c 100644
--- a/test/sql/integer-overflow.result
+++ b/test/sql/integer-overflow.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
index 1b3e8ce..57929e2 100644
--- a/test/sql/integer-overflow.test.lua
+++ b/test/sql/integer-overflow.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- gh-3735: make sure that integer overflows errors are
-- handled during VDBE execution.
diff --git a/test/sql/iproto.result b/test/sql/iproto.result
index ffc7cd9..38f9789 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -7,7 +7,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
index b5ec2c0..d31fb7f 100644
--- a/test/sql/iproto.test.lua
+++ b/test/sql/iproto.test.lua
@@ -1,7 +1,7 @@
remote = require('net.box')
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
box.execute('create table test (id int primary key, a NUMBER, b text)')
space = box.space.TEST
diff --git a/test/sql/max-on-index.result b/test/sql/max-on-index.result
index 57ce95b..45f29fd 100644
--- a/test/sql/max-on-index.result
+++ b/test/sql/max-on-index.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -25,7 +25,7 @@ box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO test1 VALUES(1, 2)");
---
diff --git a/test/sql/max-on-index.test.lua b/test/sql/max-on-index.test.lua
index 4cceaa7..73e4199 100644
--- a/test/sql/max-on-index.test.lua
+++ b/test/sql/max-on-index.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -13,7 +13,7 @@ box.execute("CREATE INDEX test1_index ON test1 (f2)")
box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO test1 VALUES(1, 2)");
diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
index 69e3ee0..d198e14 100644
--- a/test/sql/message-func-indexes.result
+++ b/test/sql/message-func-indexes.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
index 9ac5f47..dc67606 100644
--- a/test/sql/message-func-indexes.test.lua
+++ b/test/sql/message-func-indexes.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Creating tables.
box.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
diff --git a/test/sql/misc.result b/test/sql/misc.result
index a157ddb..b06ac57 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 541660c..e581b73 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Forbid multistatement queries.
box.execute('select 1;')
diff --git a/test/sql/no-pk-space.result b/test/sql/no-pk-space.result
index 025f363..d0274ea 100644
--- a/test/sql/no-pk-space.result
+++ b/test/sql/no-pk-space.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/no-pk-space.test.lua b/test/sql/no-pk-space.test.lua
index 318c2ac..f451b57 100644
--- a/test/sql/no-pk-space.test.lua
+++ b/test/sql/no-pk-space.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
format = {}
format[1] = {'id', 'integer'}
diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
index 6851e21..c0bb802 100644
--- a/test/sql/on-conflict.result
+++ b/test/sql/on-conflict.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
index 1aa4d1b..958303e 100644
--- a/test/sql/on-conflict.test.lua
+++ b/test/sql/on-conflict.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
--
-- Check that original sql ON CONFLICT clause is really
-- disabled.
diff --git a/test/sql/persistency.result b/test/sql/persistency.result
index f8f992c..88778ec 100644
--- a/test/sql/persistency.result
+++ b/test/sql/persistency.result
@@ -7,7 +7,7 @@ test_run = env.new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
index 1964453..72d1992 100644
--- a/test/sql/persistency.test.lua
+++ b/test/sql/persistency.test.lua
@@ -1,7 +1,7 @@
env = require('test_run')
test_run = env.new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- create space
box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
diff --git a/test/sql/row-count.result b/test/sql/row-count.result
index 6bf74ed..dd898aa 100644
--- a/test/sql/row-count.result
+++ b/test/sql/row-count.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -314,13 +314,13 @@ box.execute("SELECT ROW_COUNT();")
rows:
- [0]
...
-box.execute('PRAGMA recursive_triggers')
+box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
---
- metadata:
- - name: recursive_triggers
- type: integer
+ - name: value
+ type: any
rows:
- - [1]
+ - [true]
...
-- Clean-up.
--
diff --git a/test/sql/row-count.test.lua b/test/sql/row-count.test.lua
index 369e7fa..f5a9820 100644
--- a/test/sql/row-count.test.lua
+++ b/test/sql/row-count.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Test cases concerning row count calculations.
--
@@ -65,7 +65,7 @@ box.execute("SELECT ROW_COUNT();")
box.execute("SELECT ROW_COUNT();")
box.execute("EXPLAIN QUERY PLAN INSERT INTO t1 VALUES ('b'), ('c'), ('d');")
box.execute("SELECT ROW_COUNT();")
-box.execute('PRAGMA recursive_triggers')
+box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
-- Clean-up.
--
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index e48db30..a111e26 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index 99622a4..0af67a9 100644
--- a/test/sql/savepoints.test.lua
+++ b/test/sql/savepoints.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- These tests check that SQL savepoints properly work outside
-- transactions as well as inside transactions started in Lua.
diff --git a/test/sql/select-null.result b/test/sql/select-null.result
index 83d9776..bd25f03 100644
--- a/test/sql/select-null.result
+++ b/test/sql/select-null.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -15,7 +15,7 @@ box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
---
diff --git a/test/sql/select-null.test.lua b/test/sql/select-null.test.lua
index a49eb43..9f54048 100644
--- a/test/sql/select-null.test.lua
+++ b/test/sql/select-null.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
index 4102b1a..e2d60a9 100644
--- a/test/sql/sql-debug.result
+++ b/test/sql/sql-debug.result
@@ -5,50 +5,130 @@ test_run = require('test_run').new()
---
...
--
--- gh-3832: Some statements do not return column type
--- Check that "PRAGMA parser_trace" returns 0 or 1 if called
--- without parameter.
-result = box.execute('PRAGMA parser_trace').rows
+-- gh-4511: make sure that SET works.
+--
+box.execute('SELECT "name" FROM "_vsession_settings";')
+---
+- metadata:
+ - name: name
+ type: string
+ rows:
+ - ['sql_default_engine']
+ - ['sql_defer_foreign_keys']
+ - ['sql_full_column_names']
+ - ['sql_parser_trace']
+ - ['sql_recursive_triggers']
+ - ['sql_reverse_unordered_selects']
+ - ['sql_select_trace']
+ - ['sql_trace']
+ - ['sql_vdbe_addoptrace']
+ - ['sql_vdbe_debug']
+ - ['sql_vdbe_eqp']
+ - ['sql_vdbe_listing']
+ - ['sql_vdbe_trace']
+ - ['sql_where_trace']
+...
+engine = box.space._vsession_settings:get{'sql_default_engine'}.value
+---
+...
+order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
+---
+...
+box.execute('SET sql_default_engine = 1;')
+---
+- null
+- 'Inconsistent types: expected string got integer'
+...
+box.execute("SET sql_default_engine = 'some_engine';")
+---
+- null
+- Space engine 'some_engine' does not exist
+...
+box.execute("SET engine = 'vinyl';")
+---
+- null
+- Setting is not found
+...
+box.execute("SET sql_defer_foreign_keys = 'vinyl';")
+---
+- null
+- 'Inconsistent types: expected boolean got string'
+...
+engine == box.space._vsession_settings:get{'sql_default_engine'}.value
---
+- true
...
-box.execute('PRAGMA parser_trace = 1')
+order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
+---
+- true
+...
+box.execute("SET sql_default_engine = 'vinyl';")
+---
+- row_count: 0
+...
+box.execute("SET sql_reverse_unordered_selects = true;")
---
- row_count: 0
...
-box.execute('PRAGMA parser_trace')
+box.execute('SELECT * FROM "_vsession_settings";')
---
- metadata:
- - name: parser_trace
- type: integer
+ - name: name
+ type: string
+ - name: value
+ type: any
rows:
- - [1]
+ - ['sql_where_trace', false]
+ - ['sql_vdbe_trace', false]
+ - ['sql_vdbe_listing', false]
+ - ['sql_vdbe_eqp', false]
+ - ['sql_vdbe_debug', false]
+ - ['sql_vdbe_addoptrace', false]
+ - ['sql_trace', false]
+ - ['sql_select_trace', false]
+ - ['sql_reverse_unordered_selects', true]
+ - ['sql_recursive_triggers', true]
+ - ['sql_parser_trace', false]
+ - ['sql_full_column_names', false]
+ - ['sql_defer_foreign_keys', false]
+ - ['sql_default_engine', 'vinyl']
...
-box.execute('PRAGMA parser_trace = '.. result[1][1])
+box.execute("SET sql_default_engine = 'memtx';")
---
- row_count: 0
...
---
--- Make PRAGMA command return the result as a result set.
---
-box.execute('PRAGMA')
+box.execute("SET sql_reverse_unordered_selects = false;")
+---
+- row_count: 0
+...
+box.execute('SELECT * FROM "_vsession_settings";')
---
- metadata:
- - name: pragma_name
- type: text
- - name: pragma_value
- type: integer
+ - name: name
+ type: string
+ - name: value
+ type: any
rows:
- - ['defer_foreign_keys', 0]
- - ['full_column_names', 0]
- - ['parser_trace', 0]
- - ['recursive_triggers', 1]
- - ['reverse_unordered_selects', 0]
- - ['select_trace', 0]
- - ['sql_trace', 0]
- - ['vdbe_addoptrace', 0]
- - ['vdbe_debug', 0]
- - ['vdbe_eqp', 0]
- - ['vdbe_listing', 0]
- - ['vdbe_trace', 0]
- - ['where_trace', 0]
+ - ['sql_default_engine', 'memtx']
+ - ['sql_defer_foreign_keys', false]
+ - ['sql_full_column_names', false]
+ - ['sql_parser_trace', false]
+ - ['sql_recursive_triggers', true]
+ - ['sql_reverse_unordered_selects', false]
+ - ['sql_select_trace', false]
+ - ['sql_trace', false]
+ - ['sql_vdbe_addoptrace', false]
+ - ['sql_vdbe_debug', false]
+ - ['sql_vdbe_eqp', false]
+ - ['sql_vdbe_listing', false]
+ - ['sql_vdbe_trace', false]
+ - ['sql_where_trace', false]
+...
+box.execute("SET sql_default_engine = '"..engine.."';")
+---
+- row_count: 0
+...
+box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
+---
+- row_count: 0
...
diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua
index edd0ef4..b15deee 100644
--- a/test/sql/sql-debug.test.lua
+++ b/test/sql/sql-debug.test.lua
@@ -2,16 +2,27 @@ remote = require('net.box')
test_run = require('test_run').new()
--
--- gh-3832: Some statements do not return column type
+-- gh-4511: make sure that SET works.
+--
+box.execute('SELECT "name" FROM "_vsession_settings";')
--- Check that "PRAGMA parser_trace" returns 0 or 1 if called
--- without parameter.
-result = box.execute('PRAGMA parser_trace').rows
-box.execute('PRAGMA parser_trace = 1')
-box.execute('PRAGMA parser_trace')
-box.execute('PRAGMA parser_trace = '.. result[1][1])
+engine = box.space._vsession_settings:get{'sql_default_engine'}.value
+order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
---
--- Make PRAGMA command return the result as a result set.
---
-box.execute('PRAGMA')
+box.execute('SET sql_default_engine = 1;')
+box.execute("SET sql_default_engine = 'some_engine';")
+box.execute("SET engine = 'vinyl';")
+box.execute("SET sql_defer_foreign_keys = 'vinyl';")
+engine == box.space._vsession_settings:get{'sql_default_engine'}.value
+order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
+
+box.execute("SET sql_default_engine = 'vinyl';")
+box.execute("SET sql_reverse_unordered_selects = true;")
+box.execute('SELECT * FROM "_vsession_settings";')
+
+box.execute("SET sql_default_engine = 'memtx';")
+box.execute("SET sql_reverse_unordered_selects = false;")
+box.execute('SELECT * FROM "_vsession_settings";')
+
+box.execute("SET sql_default_engine = '"..engine.."';")
+box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
diff --git a/test/sql/sql-statN-index-drop.result b/test/sql/sql-statN-index-drop.result
index b2a4458..cf0f6f4 100644
--- a/test/sql/sql-statN-index-drop.result
+++ b/test/sql/sql-statN-index-drop.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
index 5477a2a..5f9cc68 100644
--- a/test/sql/sql-statN-index-drop.test.lua
+++ b/test/sql/sql-statN-index-drop.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Initializing some things.
box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT);")
diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
index 1ae9ef2..07a7c41 100644
--- a/test/sql/tokenizer.result
+++ b/test/sql/tokenizer.result
@@ -7,7 +7,7 @@ test_run = env.new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
index 3f5dd12..15cf658 100644
--- a/test/sql/tokenizer.test.lua
+++ b/test/sql/tokenizer.test.lua
@@ -1,7 +1,7 @@
env = require('test_run')
test_run = env.new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
sql_tokenizer = require('sql_tokenizer')
diff --git a/test/sql/transition.result b/test/sql/transition.result
index 9738092..35e7af6 100644
--- a/test/sql/transition.result
+++ b/test/sql/transition.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
index a05c26a..9b8b868 100644
--- a/test/sql/transition.test.lua
+++ b/test/sql/transition.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- create space
box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result
index 29c7316..17311ee 100644
--- a/test/sql/transitive-transactions.result
+++ b/test/sql/transitive-transactions.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute("pragma sql_default_engine=\'"..engine.."\'")
+box.execute("set sql_default_engine=\'"..engine.."\'")
---
- row_count: 0
...
@@ -88,7 +88,7 @@ box.space.PARENT:select();
---
- - [1, 1]
...
--- Make sure that 'PRAGMA defer_foreign_keys' works.
+-- Make sure that SQL option 'sql_defer_foreign_keys' works.
--
box.execute('DROP TABLE child;')
box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
@@ -116,7 +116,7 @@ box.space.PARENT:select();
---
- - [1, 1]
...
-box.execute('PRAGMA defer_foreign_keys = 1;')
+box.execute('SET sql_defer_foreign_keys = true;')
box.rollback()
fk_defer();
---
@@ -131,7 +131,7 @@ box.space.PARENT:select();
- [2, 2]
...
-- Cleanup
-box.execute('PRAGMA defer_foreign_keys = 0;')
+box.execute('SET sql_defer_foreign_keys = false;')
box.execute('DROP TABLE child;');
---
diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
index 4633f07..3c5fecb 100644
--- a/test/sql/transitive-transactions.test.lua
+++ b/test/sql/transitive-transactions.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute("pragma sql_default_engine=\'"..engine.."\'")
+box.execute("set sql_default_engine=\'"..engine.."\'")
test_run:cmd("setopt delimiter ';'")
-- These tests are aimed at checking transitive transactions
@@ -45,7 +45,7 @@ fk_violation_3();
box.space.CHILD:select();
box.space.PARENT:select();
--- Make sure that 'PRAGMA defer_foreign_keys' works.
+-- Make sure that SQL option 'sql_defer_foreign_keys' works.
--
box.execute('DROP TABLE child;')
box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
@@ -62,13 +62,13 @@ end;
fk_defer();
box.space.CHILD:select();
box.space.PARENT:select();
-box.execute('PRAGMA defer_foreign_keys = 1;')
+box.execute('SET sql_defer_foreign_keys = true;')
box.rollback()
fk_defer();
box.space.CHILD:select();
box.space.PARENT:select();
-box.execute('PRAGMA defer_foreign_keys = 0;')
+box.execute('SET sql_defer_foreign_keys = false;')
-- Cleanup
box.execute('DROP TABLE child;');
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index 9dfe981..de1f074 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -7,7 +7,7 @@ test_run = env.new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -292,7 +292,7 @@ box.execute("DROP TABLE T1;")
-- gh-3531: Assertion with trigger and two storage engines
--
-- Case 1: Src 'vinyl' table; Dst 'memtx' table
-box.execute("PRAGMA sql_default_engine ('vinyl');")
+box.execute("SET sql_default_engine = 'vinyl';")
---
- row_count: 0
...
@@ -304,7 +304,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
---
- row_count: 1
...
-box.execute("PRAGMA sql_default_engine('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
---
- row_count: 0
...
@@ -336,7 +336,7 @@ box.execute("DROP TABLE n;")
- row_count: 1
...
-- Case 2: Src 'memtx' table; Dst 'vinyl' table
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
---
- row_count: 0
...
@@ -348,7 +348,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
---
- row_count: 1
...
-box.execute("PRAGMA sql_default_engine('vinyl');")
+box.execute("SET sql_default_engine = 'vinyl';")
---
- row_count: 0
...
@@ -380,7 +380,7 @@ box.execute("DROP TABLE n;")
- row_count: 1
...
-- Test SQL Transaction with LUA
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
---
- row_count: 0
...
@@ -388,7 +388,7 @@ box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
---
- row_count: 1
...
-box.execute("PRAGMA sql_default_engine='vinyl'")
+box.execute("SET sql_default_engine='vinyl'")
---
- row_count: 0
...
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index f0397dc..138d1c0 100644
--- a/test/sql/triggers.test.lua
+++ b/test/sql/triggers.test.lua
@@ -1,7 +1,7 @@
env = require('test_run')
test_run = env.new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Get invariant part of the tuple; name and opts don't change.
function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
@@ -100,10 +100,10 @@ box.execute("DROP TABLE T1;")
-- gh-3531: Assertion with trigger and two storage engines
--
-- Case 1: Src 'vinyl' table; Dst 'memtx' table
-box.execute("PRAGMA sql_default_engine ('vinyl');")
+box.execute("SET sql_default_engine = 'vinyl';")
box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
-box.execute("PRAGMA sql_default_engine('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
box.execute("INSERT INTO m VALUES (0, '0');")
box.execute("INSERT INTO n VALUES (0, '',null);")
@@ -116,10 +116,10 @@ box.execute("DROP TABLE n;")
-- Case 2: Src 'memtx' table; Dst 'vinyl' table
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
-box.execute("PRAGMA sql_default_engine('vinyl');")
+box.execute("SET sql_default_engine = 'vinyl';")
box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
box.execute("INSERT INTO m VALUES (0, '0');")
box.execute("INSERT INTO n VALUES (0, '',null);")
@@ -131,9 +131,9 @@ box.execute("DROP TABLE m;")
box.execute("DROP TABLE n;")
-- Test SQL Transaction with LUA
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.execute("SET sql_default_engine = 'memtx';")
box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
-box.execute("PRAGMA sql_default_engine='vinyl'")
+box.execute("SET sql_default_engine='vinyl'")
box.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
box.execute("INSERT INTO test2 VALUES (2)")
box.execute("START TRANSACTION")
diff --git a/test/sql/update-with-nested-select.result b/test/sql/update-with-nested-select.result
index 3172430..b6ccda2 100644
--- a/test/sql/update-with-nested-select.result
+++ b/test/sql/update-with-nested-select.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
@@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
- row_count: 1
...
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t1 VALUES(1,4,6);");
---
diff --git a/test/sql/update-with-nested-select.test.lua b/test/sql/update-with-nested-select.test.lua
index 88424fc..07587ff 100644
--- a/test/sql/update-with-nested-select.test.lua
+++ b/test/sql/update-with-nested-select.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- box.cfg()
@@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
-- Debug
--- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
+-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
-- Seed entries
box.execute("INSERT INTO t1 VALUES(1,4,6);");
diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
index f0997e1..6627777 100644
--- a/test/sql/upgrade.result
+++ b/test/sql/upgrade.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
index 37425ae..0c882ba 100644
--- a/test/sql/upgrade.test.lua
+++ b/test/sql/upgrade.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
work_dir = 'sql/upgrade/1.10/'
test_run:cmd('create server upgrade with script="sql/upgrade/upgrade.lua", workdir="' .. work_dir .. '"')
diff --git a/test/sql/view.result b/test/sql/view.result
index d845df8..3df08fc 100644
--- a/test/sql/view.result
+++ b/test/sql/view.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
index 0008056..6a1fae2 100644
--- a/test/sql/view.test.lua
+++ b/test/sql/view.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
-- Verify that constraints on 'view' option are working.
diff --git a/test/sql/view_delayed_wal.result b/test/sql/view_delayed_wal.result
index d518e7d..a5f64f2 100644
--- a/test/sql/view_delayed_wal.result
+++ b/test/sql/view_delayed_wal.result
@@ -4,7 +4,7 @@ test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
---
...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
---
- row_count: 0
...
diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
index 7e6fce6..ec93e72 100644
--- a/test/sql/view_delayed_wal.test.lua
+++ b/test/sql/view_delayed_wal.test.lua
@@ -1,6 +1,6 @@
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+box.execute('set sql_default_engine=\''..engine..'\'')
fiber = require('fiber')
-- View reference counters are incremented before firing
diff --git a/test/sql/vinyl-opts.result b/test/sql/vinyl-opts.result
index 10a649a..b9e07c1 100644
--- a/test/sql/vinyl-opts.result
+++ b/test/sql/vinyl-opts.result
@@ -13,7 +13,7 @@ test_run:cmd("switch test")
---
- true
...
-box.execute('pragma sql_default_engine= \'vinyl\'')
+box.execute('set sql_default_engine= \'vinyl\'')
---
- row_count: 0
...
diff --git a/test/sql/vinyl-opts.test.lua b/test/sql/vinyl-opts.test.lua
index 4460724..05864d0 100644
--- a/test/sql/vinyl-opts.test.lua
+++ b/test/sql/vinyl-opts.test.lua
@@ -3,7 +3,7 @@ test_run:cmd("create server test with script='sql/vinyl-opts-cfg.lua'")
test_run:cmd("start server test")
test_run:cmd("switch test")
-box.execute('pragma sql_default_engine= \'vinyl\'')
+box.execute('set sql_default_engine= \'vinyl\'')
box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
box.space.V1.index[0].options
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Tarantool-patches] [PATCH 5/5] sql: refactor PRAGMA-related code
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
` (3 preceding siblings ...)
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET imeevma
@ 2019-11-27 10:13 ` imeevma
4 siblings, 0 replies; 22+ messages in thread
From: imeevma @ 2019-11-27 10:13 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
---
src/box/sql/parse.y | 33 +----
src/box/sql/pragma.c | 252 +++++++++++++++++++--------------------
src/box/sql/pragma.h | 101 ++++++----------
src/box/sql/sqlInt.h | 16 ++-
test/sql-tap/index-info.test.lua | 2 +-
5 files changed, 177 insertions(+), 227 deletions(-)
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 9f8118e..40cec53 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -1547,37 +1547,14 @@ cmd ::= SET nm(X) EQ term(Y). {
///////////////////////////// The PRAGMA command /////////////////////////////
//
cmd ::= PRAGMA nm(X). {
- sqlPragma(pParse,&X,0,0,0);
+ sqlPragma(pParse,&X,0,0);
}
-cmd ::= PRAGMA nm(X) EQ nmnum(Y). {
- sqlPragma(pParse,&X,&Y,0,0);
-}
-cmd ::= PRAGMA nm(X) LP nmnum(Y) RP. {
- sqlPragma(pParse,&X,&Y,0,0);
-}
-cmd ::= PRAGMA nm(X) EQ minus_num(Y). {
- sqlPragma(pParse,&X,&Y,0,1);
-}
-cmd ::= PRAGMA nm(X) LP minus_num(Y) RP. {
- sqlPragma(pParse,&X,&Y,0,1);
+cmd ::= PRAGMA nm(X) LP nm(Y) RP. {
+ sqlPragma(pParse,&X,&Y,0);
}
cmd ::= PRAGMA nm(X) LP nm(Z) DOT nm(Y) RP. {
- sqlPragma(pParse,&X,&Y,&Z,0);
-}
-
-nmnum(A) ::= plus_num(A).
-nmnum(A) ::= STRING(A).
-nmnum(A) ::= TRUE(A).
-nmnum(A) ::= FALSE(A).
-nmnum(A) ::= nm(A).
-nmnum(A) ::= ON(A).
-nmnum(A) ::= DELETE(A).
-nmnum(A) ::= DEFAULT(A).
-
-%token_class number INTEGER|FLOAT.
-plus_num(A) ::= PLUS number(X). {A = X;}
-plus_num(A) ::= number(A).
-minus_num(A) ::= MINUS number(X). {A = X;}
+ sqlPragma(pParse,&X,&Y,&Z);
+}
//////////////////////////// The CREATE TRIGGER command /////////////////////
cmd ::= createkw trigger_decl(A) BEGIN trigger_cmd_list(S) END(Z). {
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 0eaa2ca..a12612b 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -43,22 +43,6 @@
#include "vdbeInt.h"
#include "box/schema.h"
#include "box/session.h"
-
-/*
- ************************************************************************
- * pragma.h contains several pragmas, including utf's pragmas.
- * All that is not utf-8 should be omitted
- ************************************************************************
- */
-
-/***************************************************************************
- * The "pragma.h" include file is an automatically generated file that
- * that includes the PragType_XXXX macro definitions and the aPragmaName[]
- * object. This ensures that the aPragmaName[] table is arranged in
- * lexicographical order to facility a binary search of the pragma name.
- * Do not edit pragma.h directly. Edit and rerun the script in at
- * ../tool/mkpragmatab.tcl.
- */
#include "pragma.h"
#include "tarantoolInt.h"
@@ -80,7 +64,7 @@ vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
/*
* Locate a pragma in the aPragmaName[] array.
*/
-static const PragmaName *
+static const struct PragmaName *
pragmaLocate(const char *zName)
{
int upr, lwr, mid, rc;
@@ -202,7 +186,7 @@ sql_pragma_table_stats(struct space *space, void *data)
*/
static void
sql_pragma_index_info(struct Parse *parse,
- MAYBE_UNUSED const PragmaName *pragma,
+ MAYBE_UNUSED const struct PragmaName *pragma,
const char *tbl_name, const char *idx_name)
{
if (idx_name == NULL || tbl_name == NULL)
@@ -241,12 +225,54 @@ sql_pragma_index_info(struct Parse *parse,
}
/**
+ * This function handles PRAGMA collation_list.
+ *
+ * Return a list of available collations.
+ *
+ * - seqno: Zero-based column id within the index.
+ * - name: Collation name.
+ *
+ * @param parse_context Current parsing content.
+ */
+static void
+sql_pragma_collation_list(struct Parse *parse_context)
+{
+ struct Vdbe *v = sqlGetVdbe(parse_context);
+ assert(v != NULL);
+ int i = 0;
+ struct space *space = space_by_name("_collation");
+ /* 16 is enough to encode 0 len array */
+ char key_buf[16];
+ char *key_end = key_buf;
+ key_end = mp_encode_array(key_end, 0);
+ box_tuple_t *tuple;
+ box_iterator_t* it;
+ it = box_index_iterator(space->def->id, 0, ITER_ALL, key_buf, key_end);
+ if (it == NULL) {
+ parse_context->is_aborted = true;
+ return;
+ }
+ int rc = box_iterator_next(it, &tuple);
+ assert(rc == 0);
+ (void) rc;
+ for (i = 0; tuple != NULL; i++, box_iterator_next(it, &tuple)) {
+ /* 1 is name field number */
+ const char *str = tuple_field_cstr(tuple, 1);
+ assert(str != NULL);
+ /* this procedure should reallocate and copy str */
+ sqlVdbeMultiLoad(v, 1, "is", i, str);
+ sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
+ }
+ box_iterator_free(it);
+}
+
+/**
* This function handles PRAGMA INDEX_LIST statement.
*
* @param parse Current parsing content.
* @param table_name Name of table to display list of indexes.
*/
-void
+static void
sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
{
if (tbl_name == NULL)
@@ -264,156 +290,120 @@ sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
}
}
-/*
- * Process a pragma statement.
- *
- * Pragmas are of this form:
- *
- * PRAGMA [schema.]id [= value]
- *
- * The identifier might also be a string. The value is a string, and
- * identifier, or a number. If minusFlag is true, then the value is
- * a number that was preceded by a minus sign.
+/**
+ * This function handles PRAGMA foreign_key_list(<table>).
*
- * If the left side is "database.id" then pId1 is the database name
- * and pId2 is the id. If the left side is just "id" then pId1 is the
- * id and pId2 is any empty string.
+ * @param parse_context Current parsing content.
+ * @param table_name Name of table to display list of FK.
*/
+static void
+sql_pragma_foreign_key_list(struct Parse *parse_context, const char *table_name)
+{
+ if (table_name == NULL)
+ return;
+ struct space *space = space_by_name(table_name);
+ if (space == NULL)
+ return;
+ struct Vdbe *v = sqlGetVdbe(parse_context);
+ assert(v != NULL);
+ int i = 0;
+ parse_context->nMem = 8;
+ struct fk_constraint *fk_c;
+ rlist_foreach_entry(fk_c, &space->child_fk_constraint, in_child_space) {
+ struct fk_constraint_def *fk_def = fk_c->def;
+ for (uint32_t j = 0; j < fk_def->field_count; j++) {
+ struct space *parent = space_by_id(fk_def->parent_id);
+ assert(parent != NULL);
+ uint32_t ch_fl = fk_def->links[j].child_field;
+ const char *child_col = space->def->fields[ch_fl].name;
+ uint32_t pr_fl = fk_def->links[j].parent_field;
+ const char *parent_col =
+ parent->def->fields[pr_fl].name;
+ const char *on_delete_action =
+ fk_constraint_action_strs[fk_def->on_delete];
+ const char *on_update_action =
+ fk_constraint_action_strs[fk_def->on_update];
+ sqlVdbeMultiLoad(v, 1, "iissssss", i, j,
+ parent->def->name, child_col,
+ parent_col, on_delete_action,
+ on_update_action, "NONE");
+ sqlVdbeAddOp2(v, OP_ResultRow, 1, 8);
+ }
+ ++i;
+ }
+}
+
void
-sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
- Token * pValue, /* Token for <value>, or NULL */
- Token * pValue2, /* Token for <value2>, or NULL */
- int minusFlag /* True if a '-' sign preceded <value> */
- )
+sqlPragma(Parse *pParse, Token *pragma, Token *table, Token *index)
{
- char *zLeft = 0; /* Nul-terminated UTF-8 string <id> */
- char *zRight = 0; /* Nul-terminated UTF-8 string <value>, or NULL */
- char *zTable = 0; /* Nul-terminated UTF-8 string <value2> or NULL */
- sql *db = pParse->db; /* The database connection */
- Vdbe *v = sqlGetVdbe(pParse); /* Prepared statement */
- const PragmaName *pPragma; /* The pragma */
+ char *pragma_name = NULL;
+ char *table_name = NULL;
+ char *index_name = NULL;
+ sql *db = pParse->db;
+ Vdbe *v = sqlGetVdbe(pParse);
+ const struct PragmaName *pPragma;
- if (v == 0)
+ if (v == NULL)
return;
sqlVdbeRunOnlyOnce(v);
pParse->nMem = 2;
- zLeft = sql_name_from_token(db, pId);
- if (zLeft == NULL) {
+ pragma_name = sql_name_from_token(db, pragma);
+ if (pragma_name == NULL) {
pParse->is_aborted = true;
goto pragma_out;
}
- if (minusFlag) {
- zRight = sqlMPrintf(db, "-%T", pValue);
- } else if (pValue != NULL) {
- zRight = sql_name_from_token(db, pValue);
- if (zRight == NULL) {
+ if (table != NULL) {
+ table_name = sql_name_from_token(db, table);
+ if (table_name == NULL) {
pParse->is_aborted = true;
goto pragma_out;
}
}
- if (pValue2 != NULL) {
- zTable = sql_name_from_token(db, pValue2);
- if (zTable == NULL) {
+ if (index != NULL) {
+ index_name = sql_name_from_token(db, index);
+ if (index_name == NULL) {
pParse->is_aborted = true;
goto pragma_out;
}
}
+
/* Locate the pragma in the lookup table */
- pPragma = pragmaLocate(zLeft);
+ pPragma = pragmaLocate(pragma_name);
if (pPragma == 0) {
- diag_set(ClientError, ER_SQL_NO_SUCH_PRAGMA, zLeft);
+ diag_set(ClientError, ER_SQL_NO_SUCH_PRAGMA, pragma_name);
pParse->is_aborted = true;
goto pragma_out;
}
/* Register the result column names for pragmas that return results */
vdbe_set_pragma_result_columns(v, pPragma);
+
/* Jump to the appropriate pragma handler */
switch (pPragma->ePragTyp) {
-
- case PragTyp_TABLE_INFO:
- sql_pragma_table_info(pParse, zRight);
+ case PRAGMA_TABLE_INFO:
+ sql_pragma_table_info(pParse, table_name);
break;
- case PragTyp_STATS:
+ case PRAGMA_STATS:
space_foreach(sql_pragma_table_stats, (void *) pParse);
break;
- case PragTyp_INDEX_INFO:
- sql_pragma_index_info(pParse, pPragma, zTable, zRight);
+ case PRAGMA_INDEX_INFO:
+ sql_pragma_index_info(pParse, pPragma, index_name, table_name);
break;
- case PragTyp_INDEX_LIST:
- sql_pragma_index_list(pParse, zRight);
+ case PRAGMA_INDEX_LIST:
+ sql_pragma_index_list(pParse, table_name);
break;
-
- case PragTyp_COLLATION_LIST:{
- int i = 0;
- struct space *space = space_by_name("_collation");
- char key_buf[16]; /* 16 is enough to encode 0 len array */
- char *key_end = key_buf;
- key_end = mp_encode_array(key_end, 0);
- box_tuple_t *tuple;
- box_iterator_t* iter;
- iter = box_index_iterator(space->def->id, 0,ITER_ALL, key_buf, key_end);
- if (iter == NULL) {
- pParse->is_aborted = true;
- goto pragma_out;
- }
- int rc = box_iterator_next(iter, &tuple);
- (void) rc;
- assert(rc == 0);
- for (i = 0; tuple!=NULL; i++, box_iterator_next(iter, &tuple)){
- /* 1 is name field number */
- const char *str = tuple_field_cstr(tuple, 1);
- assert(str != NULL);
- /* this procedure should reallocate and copy str */
- sqlVdbeMultiLoad(v, 1, "is", i, str);
- sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
- }
- box_iterator_free(iter);
+ case PRAGMA_COLLATION_LIST:
+ sql_pragma_collation_list(pParse);
break;
- }
-
- case PragTyp_FOREIGN_KEY_LIST:{
- if (zRight == NULL)
- break;
- struct space *space = space_by_name(zRight);
- if (space == NULL)
- break;
- int i = 0;
- pParse->nMem = 8;
- struct fk_constraint *fk_c;
- rlist_foreach_entry(fk_c, &space->child_fk_constraint,
- in_child_space) {
-
- struct fk_constraint_def *fk_def = fk_c->def;
- for (uint32_t j = 0; j < fk_def->field_count; j++) {
- struct space *parent =
- space_by_id(fk_def->parent_id);
- assert(parent != NULL);
- uint32_t ch_fl = fk_def->links[j].child_field;
- const char *child_col =
- space->def->fields[ch_fl].name;
- uint32_t pr_fl = fk_def->links[j].parent_field;
- const char *parent_col =
- parent->def->fields[pr_fl].name;
- sqlVdbeMultiLoad(v, 1, "iissssss", i, j,
- parent->def->name,
- child_col, parent_col,
- fk_constraint_action_strs[fk_def->on_delete],
- fk_constraint_action_strs[fk_def->on_update],
- "NONE");
- sqlVdbeAddOp2(v, OP_ResultRow, 1, 8);
- }
- ++i;
- }
+ case PRAGMA_FOREIGN_KEY_LIST:
+ sql_pragma_foreign_key_list(pParse, table_name);
break;
- }
-
default:
unreachable();
- } /* End of the PRAGMA switch */
+ }
pragma_out:
- sqlDbFree(db, zLeft);
- sqlDbFree(db, zRight);
- sqlDbFree(db, zTable);
+ sqlDbFree(db, pragma_name);
+ sqlDbFree(db, table_name);
+ sqlDbFree(db, index_name);
}
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index 6c66d97..178746b 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -1,23 +1,19 @@
-/* DO NOT EDIT!
- * This file is automatically generated by the script at
- * ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
- * that script and rerun it.
- */
-
-/* The various pragma types */
-#define PragTyp_COLLATION_LIST 3
-#define PragTyp_FOREIGN_KEY_LIST 9
-#define PragTyp_INDEX_INFO 10
-#define PragTyp_INDEX_LIST 11
-#define PragTyp_STATS 15
-#define PragTyp_TABLE_INFO 17
-
-/* Property flags associated with various pragma. */
-#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
-#define PragFlg_Result0 0x10 /* Acts as query when no argument */
-#define PragFlg_Result1 0x20 /* Acts as query when has one argument */
-#define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
-#define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */
+/** List of ID of pragmas. */
+enum
+{
+ /** Pragma collation_list. */
+ PRAGMA_COLLATION_LIST = 0,
+ /** Pragma foreign_key_list. */
+ PRAGMA_FOREIGN_KEY_LIST,
+ /** Pragma index_info. */
+ PRAGMA_INDEX_INFO,
+ /** Pragma index_list. */
+ PRAGMA_INDEX_LIST,
+ /** Pragma stats. */
+ PRAGMA_STATS,
+ /** Pragma table_info. */
+ PRAGMA_TABLE_INFO,
+};
/**
* Column names and types for pragmas. The type of the column is
@@ -90,54 +86,27 @@ static const char *const pragCName[] = {
/* 57 */ "text",
};
-/* Definitions of all built-in pragmas */
-typedef struct PragmaName {
- const char *const zName; /* Name of pragma */
- u8 ePragTyp; /* PragTyp_XXX value */
- u8 mPragFlg; /* Zero or more PragFlg_XXX values */
- u8 iPragCName; /* Start of column names in pragCName[] */
- u8 nPragCName; /* Num of col names. */
- u32 iArg; /* Extra argument */
-} PragmaName;
+/** Definitions of all built-in pragmas */
+struct PragmaName {
+ /** Name of pragma. */
+ const char *const zName;
+ /** Id of pragma. */
+ u8 ePragTyp;
+ /** Start of column names in pragCName[] */
+ u8 iPragCName;
+ /** Number of column names. */
+ u8 nPragCName;
+};
+
/**
* The order of pragmas in this array is important: it has
* to be sorted. For more info see pragma_locate function.
*/
-static const PragmaName aPragmaName[] = {
- { /* zName: */ "collation_list",
- /* ePragTyp: */ PragTyp_COLLATION_LIST,
- /* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 38, 2,
- /* iArg: */ 0},
- { /* zName: */ "foreign_key_list",
- /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
- /* ePragFlg: */
- PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
- /* ColNames: */ 42, 8,
- /* iArg: */ 0},
- { /* zName: */ "index_info",
- /* ePragTyp: */ PragTyp_INDEX_INFO,
- /* ePragFlg: */
- PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
- /* ColNames: */ 20, 6,
- /* iArg: */ 1},
- { /* zName: */ "index_list",
- /* ePragTyp: */ PragTyp_INDEX_LIST,
- /* ePragFlg: */
- PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
- /* ColNames: */ 32, 3,
- /* iArg: */ 0},
- { /* zName: */ "stats",
- /* ePragTyp: */ PragTyp_STATS,
- /* ePragFlg: */
- PragFlg_NeedSchema | PragFlg_Result0 | PragFlg_SchemaReq,
- /* ColNames: */ 12, 4,
- /* iArg: */ 0},
- { /* zName: */ "table_info",
- /* ePragTyp: */ PragTyp_TABLE_INFO,
- /* ePragFlg: */
- PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
- /* ColNames: */ 0, 6,
- /* iArg: */ 0},
+static const struct PragmaName aPragmaName[] = {
+ {"collation_list", PRAGMA_COLLATION_LIST, 38, 2},
+ {"foreign_key_list", PRAGMA_FOREIGN_KEY_LIST, 42, 8},
+ {"index_info", PRAGMA_INDEX_INFO, 20, 6},
+ {"index_list", PRAGMA_INDEX_LIST, 32, 3},
+ {"stats", PRAGMA_STATS, 12, 4},
+ {"table_info", PRAGMA_TABLE_INFO, 0, 6},
};
-/* Number of pragmas: 36 on by default, 47 total. */
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 927c674..850127c 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -2759,7 +2759,21 @@ void sqlExprListSetSpan(Parse *, ExprList *, ExprSpan *);
u32 sqlExprListFlags(const ExprList *);
int sqlInit(sql *);
-void sqlPragma(Parse *, Token *, Token *, Token *, int);
+/*
+ * Process a pragma statement.
+ *
+ * Pragmas are of this form:
+ * PRAGMA <pragma_name>;
+ * PRAGMA <pragma_name>(<table_name>);
+ * PRAGMA <pragma_name>(<table_name>.<index_name>);
+ *
+ * @param pParse Parse context.
+ * @param pragma Name of the pragma.
+ * @param table Name of the table.
+ * @param index Name of the index.
+ */
+void
+sqlPragma(Parse *pParse, Token *pragma, Token *table, Token *index);
/**
* Return true if given column is part of primary key.
diff --git a/test/sql-tap/index-info.test.lua b/test/sql-tap/index-info.test.lua
index a5ed9a9..69eac39 100755
--- a/test/sql-tap/index-info.test.lua
+++ b/test/sql-tap/index-info.test.lua
@@ -26,7 +26,7 @@ test:do_catchsql_test(
"index-info-1.2",
"PRAGMA index_info = t1.a;",
{
- 1, "Syntax error near '.'",
+ 1, "Syntax error near '='",
})
-- Case: single column index with an integer column.
--
2.7.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET imeevma
@ 2019-11-27 10:45 ` Mergen Imeev
2019-11-27 10:51 ` Konstantin Osipov
1 sibling, 0 replies; 22+ messages in thread
From: Mergen Imeev @ 2019-11-27 10:45 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
Hi! Thank you for review. Sorry, I forgot to answer you in
original letter, so I am going to answer here.
On 11/17/19 8:26 PM, Vladislav Shpilevoy wrote:
> Hi! Thanks for the fixes!
>
> See 4 comments below.
>
>>>>>> @@ -3382,3 +3408,82 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
>>>>>> *result = tuple;
>>>>>> return 0;
>>>>>> }
>>>>>> +
>>>>>> +static void
>>>>>> +sql_set_session_option(struct Parse *parse_context, int id, struct Expr *value)
>>>>>> +{
>>>>>> + struct session *session = current_session();
>>>>>> + struct sql_option_metadata *option = &sql_session_opts[id];
>>>>>> + if (value->type != option->field_type) {
>>>>>> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
>>>>>> + field_type_strs[option->field_type],
>>>>>> + field_type_strs[value->type]);
>>>>>> + parse_context->is_aborted = true;
>>>>>> + return;
>>>>>> + }
>>>>>> + if (value->type == FIELD_TYPE_BOOLEAN) {
>>>>>> + bool is_set = value->op == TK_TRUE;
>>>>>> + if (is_set)
>>>>>> + session->sql_flags |= option->mask;
>>>>>> + else
>>>>>> + session->sql_flags &= ~option->mask;
>>>>>> +#ifndef NDEBUG
>>>>>> + if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
>>>>>> + if (is_set)
>>>>>> + sqlParserTrace(stdout, "parser: ");
>>>>>> + else
>>>>>> + sqlParserTrace(NULL, NULL);
>>>>>> + }
>>>>>> +#endif
>>>>>> + } else {
>>>>>> + assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
>>>>>> + enum sql_storage_engine engine =
>>>>>> + STR2ENUM(sql_storage_engine, value->u.zToken);
>>>>>> + if (engine == sql_storage_engine_MAX) {
>>>>>> + parse_context->is_aborted = true;
>>>>>> + diag_set(ClientError, ER_NO_SUCH_ENGINE,
>>>>>> + value->u.zToken);
>>>>>> + return;
>>>>>> + }
>>>>>> + current_session()->sql_default_engine = engine;
>>>>>> + }
>>>>>> +}
>>>>>
>>>>> 5. Wait. So the settings are set during parsing? Isn't it wrong?
>>>>> 'Parser only parses' and everything? PRAGMA works in runtime.
>>>> No, PRAGMA also set during parsing. I once suggested to
>>>> change it, so parser would only parse, but my suggestion
>>>> was declined.
>>>
>>> 3. This is bad and should be fixed.
>>> https://github.com/tarantool/tarantool/issues/4621
>> Fixed. Since control pragmas will be deleted, SET is now
>> using VDBE I closed the issue in this commit. Still, it
>> may be better to close it in the last commit of the
>> patch-set. Should I move it to the last commit?
>
> 1. You can try to fix it now, it is ok.
>
> Talking of control pragmas, PRAGMA still exists after your
> patch. And still works during parsing. I don't know what to
> do with it, because I don't know what are we going to do
> with PRAGMA. And seems like nobody knows.
>
I squashed patches that create SET and delete control pragmas.
Now after this patch there will be no control pragmas. Since only
control pragmas worked without VDBE, the problem seems to be
resolved.
>> This patch creates an SQL SET statement. This statement replaces
>> pragmas that can modify SQL settings. List of pragmas that will
>> have the corresponding option in SET:
>> 'defer_foreign_keys'
>> 'full_column_names'
>> 'recursive_triggers'
>> 'reverse_unordered_selects'
>> 'sql_compound_select_limit'
>> 'sql_default_engine'
>>
>> 'parser_trace'
>> 'select_trace'
>> 'sql_trace'
>> 'vdbe_addoptrace'
>> 'vdbe_debug'
>> 'vdbe_eqp'
>> 'vdbe_listing'
>> 'vdbe_trace'
>> 'where_trace'
>>
>> All these pragmas along with the pragmas 'short_column_names' and
>> 'count_changes' will be removed in the next patch.
>>
>> Part of #4511
>> Closes #4621
>
> 2. This commit message is getting worse and worse.
> I think it needs to be totally rewritten. Still existing
> problems with the current message:
>
> - I don't understand, which pragmas are totally deleted,
> which moved to SET, which of the moved have a new name;
>
> - From the message it still is not clear when a user needs
> to use PRAGMA and when SET. Yes, you said PRAGMA is purely
> informative, but I don't see it in the message. And the
> technical writer, who will see this message out of all
> the discussion, will be very confused with what has
> happened, and will ask for more details, I can guarantee
> that;
>
> - Parts of the message before '@Tarantoolbot document' and
> after are in some ideas different, in some they are totally
> the same. I propose you to remove the part before doc
> request, and write the doc request more accurate. And check
> again that all deleted PRAGMAs really don't work (in the last
> patch), all new SETs really work, with exactly the same names
> as in the commit message;
>
> - I think you need to explain what is a result of SET - metadata
> like DQL? Sql_info like DML/DDL?
>
I rewrote the commit message. Hope it got better:
sql: replace control pragmas by SET
This patch replaces the control pragmas with SET. List of replaced
control pragmas and their SET settings:
Control pragmas SET parameters
defer_foreign_keys sql_defer_foreign_keys
full_column_names sql_full_column_names
recursive_triggers sql_recursive_triggers
reverse_unordered_selects sql_reverse_unordered_selects
sql_compound_select_limit sql_compound_select_limit
sql_default_engine sql_default_engine
Also, in debug build, these control pragmas are replaced by SET
settings:
Control pragmas SET parameters
parser_trace sql_parser_trace
select_trace sql_select_trace
sql_trace sql_trace
vdbe_addoptrace sql_vdbe_addoptrace
vdbe_debug sql_vdbe_debug
vdbe_eqp sql_vdbe_eqp
vdbe_listing sql_vdbe_listing
vdbe_trace sql_vdbe_trace
where_trace sql_where_trace
Difference between SET and control pragma:
1) SET have more definite syntax:
SET <setting name> = <setting value>;
In PRAGMA, we could set the settings using these methods:
PRAGMA <setting name> = <setting value>;
PRAGMA <setting name>(<setting value>);
2) SET allows only a specific type of value for each setting. In
PRAGMA, we could use almost everything to set up any setting.
Although the rules by which the settings were set in PRAGMA were
pretty easy to understand.
3) SET cannot display setting values. PRAGMA showed the setting
values using the syntax "PRAGMA <setting name>;". With SET, we
must use other means to get the current setting values. For
session settings, we could use the sysview "_vsession_settings"
to get these values. It is worth noting that all current SQL
settings are session settings, with the exception of
'sql_reverse_unordered_selects'.
After this patch there will be no control pragmas.
Closes #4511
Closes #4621
@TarantoolBot document
Title: SQL SET statement
SQL SET statement is used to change SQL settings. To change the
value of an SQL setting, use the following syntax:
SET <setting name> = <setting value>;
Currently available SQL settings:
'sql_defer_foreign_keys'
'sql_full_column_names'
'sql_recursive_triggers'
'sql_reverse_unordered_selects'
'sql_compound_select_limit'
'sql_default_engine'
In addition, SQL debugging settings can also be changed using this
statement in debug build:
'sql_parser_trace'
'sql_select_trace'
'sql_trace'
'sql_vdbe_addoptrace'
'sql_vdbe_debug'
'sql_vdbe_eqp'
'sql_vdbe_listing'
'sql_vdbe_trace'
'sql_where_trace'
Example of usage:
SET sql_full_column_names = true;
SET sql_compound_select_limit = 10;
SET sql_default_engine = 'memtx';
>>
>> @TarantoolBot document
>> Title: SQL SET statement
>> SQL SET statement is used to change SQL settings. To change the
>> value of an SQL parameter, use the following syntax:
>>
>> SET <name of the setting> = <value of the setting>;
>>
>> Currently available SQL settings:
>> 'sql_defer_foreign_keys'
>> 'sql_full_column_names'
>> 'sql_recursive_triggers'
>> 'sql_reverse_unordered_selects'
>> 'sql_compound_select_limit'
>> 'sql_default_engine'
>>
>> In addition, SQL debugging settings can also be changed using this
>> statement in the debug build:
>> 'sql_parser_trace'
>> 'sql_select_trace'
>> 'sql_trace'
>> 'sql_vdbe_addoptrace'
>> 'sql_vdbe_debug'
>> 'sql_vdbe_eqp'
>> 'sql_vdbe_listing'
>> 'sql_vdbe_trace'
>> 'sql_where_trace'
>>
>> All of these setting with exception of 'sql_compound_select_limit'
>> are session-local settings. Their value can be viewed in
>> _vsession_settings sysview.
>>
>> Example of usage:
>> SET sql_full_column_names = true;
>> SET sql_compound_select_limit = 10;
>> SET sql_default_engine = 'memtx';
>>
>> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
>> index ce87b88..8e3ba6a 100644
>> --- a/src/box/sql/build.c
>> +++ b/src/box/sql/build.c
>> @@ -3382,3 +3397,86 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
>> *result = tuple;
>> return 0;
>> }
>> +
>> +int
>> +sql_set_session_option(int id, void *opt_value)
>> +{
>> + struct Expr *value = (struct Expr *)opt_value;
>> + struct session *session = current_session();
>> + struct sql_option_metadata *option = &sql_session_opts[id];
>> + if (value->type != option->field_type) {
>> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
>> + field_type_strs[option->field_type],
>> + field_type_strs[value->type]);
>> + return -1;
>> + }
>> + if (value->type == FIELD_TYPE_BOOLEAN) {
>> + bool is_set = value->op == TK_TRUE;
>> + if (is_set)
>> + session->sql_flags |= option->mask;
>> + else
>> + session->sql_flags &= ~option->mask;
>> +#ifndef NDEBUG
>> + if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
>> + if (is_set)
>> + sqlParserTrace(stdout, "parser: ");
>> + else
>> + sqlParserTrace(NULL, NULL);
>> + }
>> +#endif
>> + } else {
>> + assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
>> + enum sql_storage_engine engine =
>> + STR2ENUM(sql_storage_engine, value->u.zToken);
>> + if (engine == sql_storage_engine_MAX) {
>> + diag_set(ClientError, ER_NO_SUCH_ENGINE,
>> + value->u.zToken);
>> + return -1;
>> + }
>> + current_session()->sql_default_engine = engine;
>> + }
>> + return 0;
>> +}
>> +
>> +int
>> +sql_set_global_option(int id, void *opt_value)
>> +{
>> + struct Expr *value = (struct Expr *)opt_value;
>> + (void)id;
>> + assert(id == SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT);
>> + int limit = value->u.iValue;
>> + int rc = sql_limit(sql_get(), SQL_LIMIT_COMPOUND_SELECT, limit);
>> + assert(rc >= 0);
>> + return rc < 0 ? -1 : 0;
>> +}
>> +
>> +void
>> +sql_set_settings(struct Parse *parse_context, struct Token *name,
>> + struct Expr *value)
>> +{
>> + int opt_id;
>> + const char *val = (const char*) value;
>> + struct Vdbe *vdbe = sqlGetVdbe(parse_context);
>> + char *name_str = sql_name_from_token(sql_get(), name);
>> + if (name_str == NULL) {
>> + parse_context->is_aborted = true;
>> + return;
>> + }
>> + /* Try to find the option among the session options. */
>> + for (opt_id = 0; opt_id < SQL_SESSION_OPTION_max; ++opt_id) {
>> + if (strcasecmp(sql_session_opts[opt_id].name, name_str) == 0) {
>> + sqlVdbeAddOp4(vdbe, OP_Set, 0, opt_id, 0, val, P4_PTR);
>> + return;
>
> 3. Expr is a parser time structure. You can't use it at runtime.
>
> 4. There is a leak. 'val' is not freed.
>
Fixed both by using the VDBE tools to work with a given value.
>> + }
>> + }
>> + /* Try to find the option among the global options. */
>> + for (opt_id = 0; opt_id < SQL_GLOBAL_OPTION_max; ++opt_id) {
>> + if (strcasecmp(sql_global_opts[opt_id].name, name_str) == 0) {
>> + sqlVdbeAddOp4(vdbe, OP_Set, 1, opt_id, 0, val, P4_PTR);
>> + return;
>> + }
>> + }
>> + diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Setting is not found");
>> + parse_context->is_aborted = true;
>> + return;
>> +}
On Wed, Nov 27, 2019 at 01:13:33PM +0300, imeevma@tarantool.org wrote:
> This patch replaces the control pragmas with SET. List of replaced
> control pragmas and their SET settings:
> Control pragmas SET parameters
> defer_foreign_keys sql_defer_foreign_keys
> full_column_names sql_full_column_names
> recursive_triggers sql_recursive_triggers
> reverse_unordered_selects sql_reverse_unordered_selects
> sql_compound_select_limit sql_compound_select_limit
> sql_default_engine sql_default_engine
>
> Also, in debug build, these control pragmas are replaced by SET
> settings:
> Control pragmas SET parameters
> parser_trace sql_parser_trace
> select_trace sql_select_trace
> sql_trace sql_trace
> vdbe_addoptrace sql_vdbe_addoptrace
> vdbe_debug sql_vdbe_debug
> vdbe_eqp sql_vdbe_eqp
> vdbe_listing sql_vdbe_listing
> vdbe_trace sql_vdbe_trace
> where_trace sql_where_trace
>
> Difference between SET and control pragma:
> 1) SET have more definite syntax:
> SET <setting name> = <setting value>;
> In PRAGMA, we could set the settings using these methods:
> PRAGMA <setting name> = <setting value>;
> PRAGMA <setting name>(<setting value>);
>
> 2) SET allows only a specific type of value for each setting. In
> PRAGMA, we could use almost everything to set up any setting.
> Although the rules by which the settings were set in PRAGMA were
> pretty easy to understand.
>
> 3) SET cannot display setting values. PRAGMA showed the setting
> values using the syntax "PRAGMA <setting name>;". With SET, we
> must use other means to get the current setting values. For
> session settings, we could use the sysview "_vsession_settings"
> to get these values. It is worth noting that all current SQL
> settings are session settings, with the exception of
> 'sql_reverse_unordered_selects'.
>
> After this patch there will be no control pragmas.
>
> Closes #4511
> Closes #4621
>
> @TarantoolBot document
> Title: SQL SET statement
>
> SQL SET statement is used to change SQL settings. To change the
> value of an SQL setting, use the following syntax:
>
> SET <setting name> = <setting value>;
>
> Currently available SQL settings:
> 'sql_defer_foreign_keys'
> 'sql_full_column_names'
> 'sql_recursive_triggers'
> 'sql_reverse_unordered_selects'
> 'sql_compound_select_limit'
> 'sql_default_engine'
>
> In addition, SQL debugging settings can also be changed using this
> statement in debug build:
> 'sql_parser_trace'
> 'sql_select_trace'
> 'sql_trace'
> 'sql_vdbe_addoptrace'
> 'sql_vdbe_debug'
> 'sql_vdbe_eqp'
> 'sql_vdbe_listing'
> 'sql_vdbe_trace'
> 'sql_where_trace'
>
> Example of usage:
> SET sql_full_column_names = true;
> SET sql_compound_select_limit = 10;
> SET sql_default_engine = 'memtx';
> ---
> src/box/sql/build.c | 120 ++++++++++++
> src/box/sql/parse.y | 8 +-
> src/box/sql/pragma.c | 203 +--------------------
> src/box/sql/pragma.h | 134 --------------
> src/box/sql/sqlInt.h | 57 +++++-
> src/box/sql/vdbe.c | 25 +++
> test/sql-tap/analyze4.test.lua | 4 +-
> test/sql-tap/autoinc.test.lua | 2 +-
> test/sql-tap/colname.test.lua | 16 +-
> test/sql-tap/fkey2.test.lua | 4 +-
> test/sql-tap/gh2548-select-compound-limit.test.lua | 18 +-
> test/sql-tap/lua/sqltester.lua | 2 +-
> test/sql-tap/misc1.test.lua | 2 +-
> test/sql-tap/pragma.test.lua | 135 +-------------
> test/sql-tap/select1.test.lua | 22 +--
> test/sql-tap/tkt3731.test.lua | 2 +-
> test/sql-tap/trigger2.test.lua | 2 +-
> test/sql-tap/triggerC.test.lua | 51 +-----
> test/sql-tap/update.test.lua | 1 -
> test/sql-tap/whereA.test.lua | 24 +--
> test/sql/check-clear-ephemeral.result | 4 +-
> test/sql/check-clear-ephemeral.test.lua | 4 +-
> test/sql/checks.result | 4 +-
> test/sql/checks.test.lua | 4 +-
> test/sql/clear.result | 4 +-
> test/sql/clear.test.lua | 4 +-
> test/sql/collation.result | 2 +-
> test/sql/collation.test.lua | 2 +-
> test/sql/ddl.result | 2 +-
> test/sql/ddl.test.lua | 2 +-
> test/sql/delete-multiple-idx.result | 4 +-
> test/sql/delete-multiple-idx.test.lua | 4 +-
> test/sql/delete.result | 4 +-
> test/sql/delete.test.lua | 4 +-
> test/sql/drop-index.result | 4 +-
> test/sql/drop-index.test.lua | 4 +-
> test/sql/drop-table.result | 4 +-
> test/sql/drop-table.test.lua | 4 +-
> test/sql/engine.result | 6 +-
> test/sql/engine.test.lua | 6 +-
> test/sql/errinj.result | 2 +-
> test/sql/errinj.test.lua | 2 +-
> test/sql/func-recreate.result | 2 +-
> test/sql/func-recreate.test.lua | 2 +-
> test/sql/gh-2362-select-access-rights.result | 2 +-
> test/sql/gh-2362-select-access-rights.test.lua | 2 +-
> test/sql/gh-2929-primary-key.result | 2 +-
> test/sql/gh-2929-primary-key.test.lua | 2 +-
> test/sql/gh-2981-check-autoinc.result | 2 +-
> test/sql/gh-2981-check-autoinc.test.lua | 2 +-
> test/sql/gh-3199-no-mem-leaks.result | 2 +-
> test/sql/gh-3199-no-mem-leaks.test.lua | 2 +-
> test/sql/gh-3613-idx-alter-update-2.result | 2 +-
> test/sql/gh-3613-idx-alter-update-2.test.lua | 2 +-
> test/sql/gh-3613-idx-alter-update.result | 2 +-
> test/sql/gh-3613-idx-alter-update.test.lua | 2 +-
> test/sql/gh-3888-values-blob-assert.result | 2 +-
> test/sql/gh-3888-values-blob-assert.test.lua | 2 +-
> test/sql/gh2141-delete-trigger-drop-table.result | 2 +-
> test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 +-
> test/sql/gh2251-multiple-update.result | 2 +-
> test/sql/gh2251-multiple-update.test.lua | 2 +-
> test/sql/gh2483-remote-persistency-check.result | 2 +-
> test/sql/gh2483-remote-persistency-check.test.lua | 2 +-
> .../gh2808-inline-unique-persistency-check.result | 2 +-
> ...gh2808-inline-unique-persistency-check.test.lua | 2 +-
> test/sql/icu-upper-lower.result | 2 +-
> test/sql/icu-upper-lower.test.lua | 2 +-
> test/sql/insert-unique.result | 4 +-
> test/sql/insert-unique.test.lua | 4 +-
> test/sql/integer-overflow.result | 2 +-
> test/sql/integer-overflow.test.lua | 2 +-
> test/sql/iproto.result | 2 +-
> test/sql/iproto.test.lua | 2 +-
> test/sql/max-on-index.result | 4 +-
> test/sql/max-on-index.test.lua | 4 +-
> test/sql/message-func-indexes.result | 2 +-
> test/sql/message-func-indexes.test.lua | 2 +-
> test/sql/misc.result | 2 +-
> test/sql/misc.test.lua | 2 +-
> test/sql/no-pk-space.result | 2 +-
> test/sql/no-pk-space.test.lua | 2 +-
> test/sql/on-conflict.result | 2 +-
> test/sql/on-conflict.test.lua | 2 +-
> test/sql/persistency.result | 2 +-
> test/sql/persistency.test.lua | 2 +-
> test/sql/row-count.result | 10 +-
> test/sql/row-count.test.lua | 4 +-
> test/sql/savepoints.result | 2 +-
> test/sql/savepoints.test.lua | 2 +-
> test/sql/select-null.result | 4 +-
> test/sql/select-null.test.lua | 4 +-
> test/sql/sql-debug.result | 142 ++++++++++----
> test/sql/sql-debug.test.lua | 33 ++--
> test/sql/sql-statN-index-drop.result | 2 +-
> test/sql/sql-statN-index-drop.test.lua | 2 +-
> test/sql/tokenizer.result | 2 +-
> test/sql/tokenizer.test.lua | 2 +-
> test/sql/transition.result | 2 +-
> test/sql/transition.test.lua | 2 +-
> test/sql/transitive-transactions.result | 8 +-
> test/sql/transitive-transactions.test.lua | 8 +-
> test/sql/triggers.result | 14 +-
> test/sql/triggers.test.lua | 14 +-
> test/sql/update-with-nested-select.result | 4 +-
> test/sql/update-with-nested-select.test.lua | 4 +-
> test/sql/upgrade.result | 2 +-
> test/sql/upgrade.test.lua | 2 +-
> test/sql/view.result | 2 +-
> test/sql/view.test.lua | 2 +-
> test/sql/view_delayed_wal.result | 2 +-
> test/sql/view_delayed_wal.test.lua | 2 +-
> test/sql/vinyl-opts.result | 2 +-
> test/sql/vinyl-opts.test.lua | 2 +-
> 114 files changed, 531 insertions(+), 758 deletions(-)
>
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index ce87b88..210d392 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -3275,6 +3275,12 @@ enum {
> SQL_SESSION_OPTION_max,
> };
>
> +/** Identifiers of all SQL global options that can be set. */
> +enum {
> + SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT = 0,
> + SQL_GLOBAL_OPTION_max,
> +};
> +
> /**
> * A local structure that allows to establish a connection between
> * the name of the parameter, its field type and mask, if it have
> @@ -3329,6 +3335,15 @@ static struct sql_option_metadata sql_session_opts[] = {
> #endif
> };
>
> +/**
> + * Variable that contains names of the SQL global options, their
> + * field types and mask if they have one or 0 if don't have.
> + */
> +static struct sql_option_metadata sql_global_opts[] = {
> + /** SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT */
> + {"sql_compound_select_limit", FIELD_TYPE_INTEGER, 0},
> +};
> +
> uint32_t
> sql_session_opt_id_max()
> {
> @@ -3382,3 +3397,108 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
> *result = tuple;
> return 0;
> }
> +
> +int
> +sql_set_boolean_option(int id, enum sql_setting_type type, bool value)
> +{
> + assert(type == SQL_SESSION_SETTING);
> + (void)type;
> + struct session *session = current_session();
> + struct sql_option_metadata *option = &sql_session_opts[id];
> + assert(option->field_type == FIELD_TYPE_BOOLEAN);
> + if (value)
> + session->sql_flags |= option->mask;
> + else
> + session->sql_flags &= ~option->mask;
> +#ifndef NDEBUG
> + if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
> + if (value)
> + sqlParserTrace(stdout, "parser: ");
> + else
> + sqlParserTrace(NULL, NULL);
> + }
> +#endif
> + return 0;
> +}
> +
> +int
> +sql_set_string_option(int id, enum sql_setting_type type, const char *value)
> +{
> + assert(type == SQL_SESSION_SETTING);
> + (void)type;
> + assert(sql_session_opts[id].field_type = FIELD_TYPE_STRING);
> + assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
> + (void)id;
> + enum sql_storage_engine engine = STR2ENUM(sql_storage_engine, value);
> + if (engine == sql_storage_engine_MAX) {
> + diag_set(ClientError, ER_NO_SUCH_ENGINE, value);
> + return -1;
> + }
> + current_session()->sql_default_engine = engine;
> + return 0;
> +}
> +
> +int
> +sql_set_integer_option(int id, enum sql_setting_type type, int value)
> +{
> + assert(type == SQL_GLOBAL_SETTING);
> + (void)type;
> + assert(sql_global_opts[id].field_type = FIELD_TYPE_INTEGER);
> + assert(id == SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT);
> + (void)id;
> + int rc = sql_limit(sql_get(), SQL_LIMIT_COMPOUND_SELECT, value);
> + assert(rc >= 0);
> + return rc < 0 ? -1 : 0;
> +}
> +
> +void
> +sql_set_settings(struct Parse *parse_context, struct Token *name,
> + struct Expr *value)
> +{
> + int opt_id;
> + struct Vdbe *vdbe = sqlGetVdbe(parse_context);
> + char *name_str = sql_name_from_token(sql_get(), name);
> + if (name_str == NULL) {
> + parse_context->is_aborted = true;
> + return;
> + }
> + int value_reg = ++parse_context->nMem;
> + sqlExprCode(parse_context, value, value_reg);
> + /* Try to find the option among the session options. */
> + for (opt_id = 0; opt_id < SQL_SESSION_OPTION_max; ++opt_id) {
> + if (strcasecmp(sql_session_opts[opt_id].name, name_str) == 0) {
> + struct sql_option_metadata *opt =
> + &sql_session_opts[opt_id];
> + if (value->type != opt->field_type) {
> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> + field_type_strs[opt->field_type],
> + field_type_strs[value->type]);
> + parse_context->is_aborted = true;
> + return;
> + }
> + sqlVdbeAddOp3(vdbe, OP_Set, SQL_SESSION_SETTING, opt_id,
> + value_reg);
> + return;
> + }
> + }
> + /* Try to find the option among the global options. */
> + for (opt_id = 0; opt_id < SQL_GLOBAL_OPTION_max; ++opt_id) {
> + if (strcasecmp(sql_global_opts[opt_id].name, name_str) == 0) {
> + struct sql_option_metadata *opt =
> + &sql_global_opts[opt_id];
> + if (value->type != opt->field_type) {
> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> + field_type_strs[opt->field_type],
> + field_type_strs[value->type]);
> + parse_context->is_aborted = true;
> + return;
> + }
> + sqlVdbeAddOp3(vdbe, OP_Set, SQL_GLOBAL_SETTING, opt_id,
> + value_reg);
> + return;
> + }
> + }
> + diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Setting is not found");
> + parse_context->is_aborted = true;
> + return;
> +}
> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> index 1d0c95f..9f8118e 100644
> --- a/src/box/sql/parse.y
> +++ b/src/box/sql/parse.y
> @@ -1539,6 +1539,11 @@ cmd ::= DROP INDEX ifexists(E) nm(X) ON fullname(Y). {
> sql_drop_index(pParse);
> }
>
> +///////////////////////////// The SET command ////////////////////////////////
> +cmd ::= SET nm(X) EQ term(Y). {
> + sql_set_settings(pParse,&X,Y.pExpr);
> +}
> +
> ///////////////////////////// The PRAGMA command /////////////////////////////
> //
> cmd ::= PRAGMA nm(X). {
> @@ -1559,9 +1564,6 @@ cmd ::= PRAGMA nm(X) LP minus_num(Y) RP. {
> cmd ::= PRAGMA nm(X) LP nm(Z) DOT nm(Y) RP. {
> sqlPragma(pParse,&X,&Y,&Z,0);
> }
> -cmd ::= PRAGMA . {
> - sqlPragma(pParse, 0,0,0,0);
> -}
>
> nmnum(A) ::= plus_num(A).
> nmnum(A) ::= STRING(A).
> diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
> index 92bcf4e..0eaa2ca 100644
> --- a/src/box/sql/pragma.c
> +++ b/src/box/sql/pragma.c
> @@ -62,56 +62,6 @@
> #include "pragma.h"
> #include "tarantoolInt.h"
>
> -/*
> - * Interpret the given string as a safety level. Return 0 for OFF,
> - * 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
> - * unrecognized string argument. The FULL and EXTRA option is disallowed
> - * if the omitFull parameter it 1.
> - *
> - * Note that the values returned are one less that the values that
> - * should be passed into sqlBtreeSetSafetyLevel(). The is done
> - * to support legacy SQL code. The safety level used to be boolean
> - * and older scripts may have used numbers 0 for OFF and 1 for ON.
> - */
> -static u8
> -getSafetyLevel(const char *z, int omitFull, u8 dflt)
> -{
> - /* 123456789 123456789 123 */
> - static const char zText[] = "onoffalseyestruextrafull";
> - static const u8 iOffset[] = { 0, 1, 2, 4, 9, 12, 15, 20 };
> - static const u8 iLength[] = { 2, 2, 3, 5, 3, 4, 5, 4 };
> - static const u8 iValue[] = { 1, 0, 0, 0, 1, 1, 3, 2 };
> - /* on no off false yes true extra full */
> - int i, n;
> - if (sqlIsdigit(*z)) {
> - return (u8) sqlAtoi(z);
> - }
> - n = sqlStrlen30(z);
> - for (i = 0; i < ArraySize(iLength); i++) {
> - if (iLength[i] == n
> - && sqlStrNICmp(&zText[iOffset[i]], z, n) == 0
> - && (!omitFull || iValue[i] <= 1)
> - ) {
> - return iValue[i];
> - }
> - }
> - return dflt;
> -}
> -
> -/*
> - * Interpret the given string as a boolean value.
> - */
> -u8
> -sqlGetBoolean(const char *z, u8 dflt)
> -{
> - return getSafetyLevel(z, 1, dflt) != 0;
> -}
> -
> -/* The sqlGetBoolean() function is used by other modules but the
> - * remainder of this file is specific to PRAGMA processing. So omit
> - * the rest of the file if PRAGMAs are omitted from the build.
> - */
> -
> /** Set result column names and types for a pragma. */
> static void
> vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> @@ -128,17 +78,6 @@ vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> }
>
> /*
> - * Generate code to return a single integer value.
> - */
> -static void
> -returnSingleInt(Vdbe * v, i64 value)
> -{
> - sqlVdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8 *)&value,
> - value < 0 ? P4_INT64 : P4_UINT64);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> -}
> -
> -/*
> * Locate a pragma in the aPragmaName[] array.
> */
> static const PragmaName *
> @@ -161,53 +100,6 @@ pragmaLocate(const char *zName)
> return lwr > upr ? 0 : &aPragmaName[mid];
> }
>
> -static void
> -vdbe_emit_pragma_status(struct Parse *parse)
> -{
> - struct Vdbe *v = sqlGetVdbe(parse);
> - struct session *user_session = current_session();
> -
> - sqlVdbeSetNumCols(v, 2);
> - sqlVdbeSetColName(v, 0, COLNAME_NAME, "pragma_name", SQL_STATIC);
> - sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "text", SQL_STATIC);
> - sqlVdbeSetColName(v, 1, COLNAME_NAME, "pragma_value", SQL_STATIC);
> - sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "integer", SQL_STATIC);
> -
> - parse->nMem = 2;
> - for (int i = 0; i < ArraySize(aPragmaName); ++i) {
> - if (aPragmaName[i].ePragTyp != PragTyp_FLAG)
> - continue;
> - sqlVdbeAddOp4(v, OP_String8, 0, 1, 0, aPragmaName[i].zName, 0);
> - int val = (user_session->sql_flags & aPragmaName[i].iArg) != 0;
> - sqlVdbeAddOp2(v, OP_Integer, val, 2);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
> - }
> -}
> -
> -/**
> - * Set tarantool backend default engine for SQL interface.
> - * @param engine_name to set default.
> - * @retval -1 on error.
> - * @retval 0 on success.
> - */
> -static int
> -sql_default_engine_set(const char *engine_name)
> -{
> - if (engine_name == NULL) {
> - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> - "'sql_default_engine' was not specified");
> - return -1;
> - }
> - enum sql_storage_engine engine =
> - STR2ENUM(sql_storage_engine, engine_name);
> - if (engine == sql_storage_engine_MAX) {
> - diag_set(ClientError, ER_NO_SUCH_ENGINE, engine_name);
> - return -1;
> - }
> - current_session()->sql_default_engine = engine;
> - return 0;
> -}
> -
> /**
> * This function handles PRAGMA TABLE_INFO(<table>).
> *
> @@ -373,22 +265,6 @@ sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
> }
>
> /*
> - * @brief Check whether the specified token is a string or ID.
> - * @param token - token to be examined
> - * @return true - if the token value is enclosed into quotes (')
> - * @return false in other cases
> - * The empty value is considered to be a string.
> - */
> -static bool
> -token_is_string(const struct Token* token)
> -{
> - if (!token || token->n == 0)
> - return true;
> - return token->n >= 2 && token->z[0] == '\'' &&
> - token->z[token->n - 1] == '\'';
> -}
> -
> -/*
> * Process a pragma statement.
> *
> * Pragmas are of this form:
> @@ -416,17 +292,12 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> sql *db = pParse->db; /* The database connection */
> Vdbe *v = sqlGetVdbe(pParse); /* Prepared statement */
> const PragmaName *pPragma; /* The pragma */
> - struct session *user_session = current_session();
>
> if (v == 0)
> return;
> sqlVdbeRunOnlyOnce(v);
> pParse->nMem = 2;
>
> - if (pId == NULL) {
> - vdbe_emit_pragma_status(pParse);
> - return;
> - }
> zLeft = sql_name_from_token(db, pId);
> if (zLeft == NULL) {
> pParse->is_aborted = true;
> @@ -456,38 +327,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> goto pragma_out;
> }
> /* Register the result column names for pragmas that return results */
> - if ((pPragma->mPragFlg & PragFlg_NoColumns) == 0 &&
> - ((pPragma->mPragFlg & PragFlg_NoColumns1) == 0 || zRight == NULL))
> - vdbe_set_pragma_result_columns(v, pPragma);
> + vdbe_set_pragma_result_columns(v, pPragma);
> /* Jump to the appropriate pragma handler */
> switch (pPragma->ePragTyp) {
>
> - case PragTyp_FLAG:{
> - if (zRight == NULL) {
> - vdbe_set_pragma_result_columns(v, pPragma);
> - returnSingleInt(v, (user_session->sql_flags &
> - pPragma->iArg) != 0);
> - } else {
> - /* Mask of bits to set or clear. */
> - int mask = pPragma->iArg;
> - bool is_pragma_set = sqlGetBoolean(zRight, 0);
> -
> - if (is_pragma_set)
> - user_session->sql_flags |= mask;
> - else
> - user_session->sql_flags &= ~mask;
> -#if defined(SQL_DEBUG)
> - if (mask == PARSER_TRACE_FLAG) {
> - if (is_pragma_set)
> - sqlParserTrace(stdout, "parser: ");
> - else
> - sqlParserTrace(0, 0);
> - }
> -#endif
> - }
> - break;
> - }
> -
> case PragTyp_TABLE_INFO:
> sql_pragma_table_info(pParse, zRight);
> break;
> @@ -565,54 +408,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> break;
> }
>
> - case PragTyp_DEFAULT_ENGINE: {
> - if (!token_is_string(pValue)) {
> - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> - "string value is expected");
> - pParse->is_aborted = true;
> - goto pragma_out;
> - }
> - if (zRight == NULL) {
> - const char *engine_name =
> - sql_storage_engine_strs[current_session()->
> - sql_default_engine];
> - sqlVdbeLoadString(v, 1, engine_name);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> - } else {
> - if (sql_default_engine_set(zRight) != 0) {
> - pParse->is_aborted = true;
> - goto pragma_out;
> - }
> - sqlVdbeAddOp0(v, OP_Expire);
> - }
> - break;
> - }
> -
> - case PragTyp_COMPOUND_SELECT_LIMIT: {
> - if (zRight != NULL) {
> - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT,
> - sqlAtoi(zRight));
> - }
> - int retval =
> - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT, -1);
> - returnSingleInt(v, retval);
> - break;
> - }
> -
> default:
> unreachable();
> } /* End of the PRAGMA switch */
>
> - /* The following block is a no-op unless SQL_DEBUG is
> - * defined. Its only * purpose is to execute assert()
> - * statements to verify that if the * PragFlg_NoColumns1 flag
> - * is set and the caller specified an argument * to the PRAGMA,
> - * the implementation has not added any OP_ResultRow *
> - * instructions to the VM.
> - */
> - if ((pPragma->mPragFlg & PragFlg_NoColumns1) && zRight) {
> - sqlVdbeVerifyNoResultRow(v);
> - }
> pragma_out:
> sqlDbFree(db, zLeft);
> sqlDbFree(db, zRight);
> diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
> index f337f0b..6c66d97 100644
> --- a/src/box/sql/pragma.h
> +++ b/src/box/sql/pragma.h
> @@ -6,19 +6,14 @@
>
> /* The various pragma types */
> #define PragTyp_COLLATION_LIST 3
> -#define PragTyp_FLAG 5
> #define PragTyp_FOREIGN_KEY_LIST 9
> #define PragTyp_INDEX_INFO 10
> #define PragTyp_INDEX_LIST 11
> #define PragTyp_STATS 15
> #define PragTyp_TABLE_INFO 17
> -#define PragTyp_DEFAULT_ENGINE 25
> -#define PragTyp_COMPOUND_SELECT_LIMIT 26
>
> /* Property flags associated with various pragma. */
> #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
> -#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
> -#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
> #define PragFlg_Result0 0x10 /* Acts as query when no argument */
> #define PragFlg_Result1 0x20 /* Acts as query when has one argument */
> #define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
> @@ -93,51 +88,6 @@ static const char *const pragCName[] = {
> /* 55 */ "text",
> /* 56 */ "match",
> /* 57 */ "text",
> - /* Used by: defer_foreign_keys */
> - /* 58 */ "defer_foreign_keys",
> - /* 59 */ "integer",
> - /* Used by: full_column_names */
> - /* 60 */ "full_column_names",
> - /* 61 */ "integer",
> - /* Used by: parser_trace */
> - /* 62 */ "parser_trace",
> - /* 63 */ "integer",
> - /* Used by: recursive_triggers */
> - /* 64 */ "recursive_triggers",
> - /* 65 */ "integer",
> - /* Used by: reverse_unordered_selects */
> - /* 66 */ "reverse_unordered_selects",
> - /* 67 */ "integer",
> - /* Used by: select_trace */
> - /* 68 */ "select_trace",
> - /* 69 */ "integer",
> - /* Used by: sql_compound_select_limit */
> - /* 70 */ "sql_compound_select_limit",
> - /* 71 */ "integer",
> - /* Used by: sql_default_engine */
> - /* 72 */ "sql_default_engine",
> - /* 73 */ "text",
> - /* Used by: sql_trace */
> - /* 74 */ "sql_trace",
> - /* 75 */ "integer",
> - /* Used by: vdbe_addoptrace */
> - /* 76 */ "vdbe_addoptrace",
> - /* 77 */ "integer",
> - /* Used by: vdbe_debug */
> - /* 78 */ "vdbe_debug",
> - /* 79 */ "integer",
> - /* Used by: vdbe_eqp */
> - /* 80 */ "vdbe_eqp",
> - /* 81 */ "integer",
> - /* Used by: vdbe_listing */
> - /* 82 */ "vdbe_listing",
> - /* 83 */ "integer",
> - /* Used by: vdbe_trace */
> - /* 84 */ "vdbe_trace",
> - /* 85 */ "integer",
> - /* Used by: where_trace */
> - /* 86 */ "where_trace",
> - /* 87 */ "integer",
> };
>
> /* Definitions of all built-in pragmas */
> @@ -159,22 +109,12 @@ static const PragmaName aPragmaName[] = {
> /* ePragFlg: */ PragFlg_Result0,
> /* ColNames: */ 38, 2,
> /* iArg: */ 0},
> - { /* zName: */ "defer_foreign_keys",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 58, 1,
> - /* iArg: */ SQL_DeferFKs},
> { /* zName: */ "foreign_key_list",
> /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
> /* ePragFlg: */
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 42, 8,
> /* iArg: */ 0},
> - { /* zName: */ "full_column_names",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 60, 1,
> - /* iArg: */ SQL_FullColNames},
> { /* zName: */ "index_info",
> /* ePragTyp: */ PragTyp_INDEX_INFO,
> /* ePragFlg: */
> @@ -187,47 +127,6 @@ static const PragmaName aPragmaName[] = {
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 32, 3,
> /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "parser_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 62, 1,
> - /* iArg: */ PARSER_TRACE_FLAG},
> -#endif
> - { /* zName: */ "recursive_triggers",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 64, 1,
> - /* iArg: */ SQL_RecTriggers},
> - { /* zName: */ "reverse_unordered_selects",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 66, 1,
> - /* iArg: */ SQL_ReverseOrder},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "select_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 68, 1,
> - /* iArg: */ SQL_SelectTrace},
> -#endif
> - { /* zName: */ "sql_compound_select_limit",
> - /* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
> - /* ePragFlg: */ PragFlg_Result0,
> - /* ColNames: */ 70, 1,
> - /* iArg: */ 0},
> - { /* zName: */ "sql_default_engine",
> - /* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 72, 1,
> - /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "sql_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 74, 1,
> - /* iArg: */ SQL_SqlTrace},
> -#endif
> { /* zName: */ "stats",
> /* ePragTyp: */ PragTyp_STATS,
> /* ePragFlg: */
> @@ -240,38 +139,5 @@ static const PragmaName aPragmaName[] = {
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 0, 6,
> /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "vdbe_addoptrace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 76, 1,
> - /* iArg: */ SQL_VdbeAddopTrace},
> - { /* zName: */ "vdbe_debug",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 78, 1,
> - /* iArg: */
> - SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
> - { /* zName: */ "vdbe_eqp",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 80, 1,
> - /* iArg: */ SQL_VdbeEQP},
> - { /* zName: */ "vdbe_listing",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 82, 1,
> - /* iArg: */ SQL_VdbeListing},
> - { /* zName: */ "vdbe_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 84, 1,
> - /* iArg: */ SQL_VdbeTrace},
> - { /* zName: */ "where_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 86, 1,
> - /* iArg: */ SQL_WhereTrace},
> -#endif
> };
> /* Number of pragmas: 36 on by default, 47 total. */
> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> index 27a4c41..927c674 100644
> --- a/src/box/sql/sqlInt.h
> +++ b/src/box/sql/sqlInt.h
> @@ -333,6 +333,11 @@ enum sql_ret_code {
> SQL_DONE = 2,
> };
>
> +enum sql_setting_type {
> + SQL_SESSION_SETTING = 0,
> + SQL_GLOBAL_SETTING = 1,
> +};
> +
> void *
> sql_malloc(int);
>
> @@ -3946,8 +3951,6 @@ int
> sql_rem_int(int64_t lhs, bool is_lhs_neg, int64_t rhs, bool is_rhs_neg,
> int64_t *res, bool *is_res_neg);
>
> -u8 sqlGetBoolean(const char *z, u8);
> -
> const void *sqlValueText(sql_value *);
> int sqlValueBytes(sql_value *);
> void sqlValueSetStr(sql_value *, int, const void *,
> @@ -4463,4 +4466,54 @@ int
> sql_fieldno_by_name(struct Parse *parse_context, struct Expr *field_name,
> uint32_t *fieldno);
>
> +/**
> + * Create VDBE instructions to set new value of SQL setting.
> + *
> + * @param parse_context Parsing context.
> + * @param name Name of the SQL setting.
> + * @param value New value of the SQL setting.
> + */
> +void
> +sql_set_settings(struct Parse *parse_context, struct Token *name,
> + struct Expr *value);
> +
> +/**
> + * Set a new value for boolean SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_boolean_option(int id, enum sql_setting_type type, bool value);
> +
> +/**
> + * Set a new value for string SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_string_option(int id, enum sql_setting_type type, const char *value);
> +
> +/**
> + * Set a new value for integer SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_integer_option(int id, enum sql_setting_type type, int value);
> +
> #endif /* sqlINT_H */
> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 2e51a0d..788696f 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -5254,6 +5254,31 @@ case OP_IncMaxid: {
> break;
> }
>
> +/* Opcode: Set P1 P2 P3 * *
> + *
> + * Set new value to SQL setting. P1 is either SQL_SESSION_SETTING
> + * or SQL_GLOBAL_SETTING. P2 is ID of the setting. P3 is an ID of
> + * register that contains value of the setting.
> + */
> +case OP_Set: {
> + assert(pOp->p1 == SQL_SESSION_SETTING || pOp->p1 == SQL_GLOBAL_SETTING);
> + pIn3 = &aMem[pOp->p3];
> +
> + if ((pIn3->flags & MEM_Bool) != 0) {
> + if (sql_set_boolean_option(pOp->p2, pOp->p1, pIn3->u.b) != 0)
> + goto abort_due_to_error;
> + } else if ((pIn3->flags & MEM_Str) != 0) {
> + if (sql_set_string_option(pOp->p2, pOp->p1, pIn3->z) != 0)
> + goto abort_due_to_error;
> + } else {
> + assert((pIn3->flags & MEM_Int) != 0 ||
> + (pIn3->flags & MEM_UInt) != 0);
> + if (sql_set_integer_option(pOp->p2, pOp->p1, pIn3->u.i) != 0)
> + goto abort_due_to_error;
> + }
> + break;
> +}
> +
> /* Opcode: Noop * * * * *
> *
> * Do nothing. This instruction is often useful as a jump
> diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
> index 7d7498f..cc530ce 100755
> --- a/test/sql-tap/analyze4.test.lua
> +++ b/test/sql-tap/analyze4.test.lua
> @@ -70,9 +70,9 @@ test:do_test(
> function()
> return test:execsql([[
> UPDATE t1 SET b='x' WHERE a%2;
> --- pragma vdbe_debug=1;
> +-- set vdbe_debug=true;
> ANALYZE;
> --- pragma vdbe_debug=0;
> +-- set vdbe_debug=false;
> SELECT "idx", "stat" FROM "_sql_stat1" WHERE "tbl"='T1' ORDER BY "idx";
> ]])
> end, {
> diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
> index 39e4796..7b36379 100755
> --- a/test/sql-tap/autoinc.test.lua
> +++ b/test/sql-tap/autoinc.test.lua
> @@ -640,7 +640,7 @@ test:do_test(
> -- </autoinc-10.3>
> })
>
> -test:catchsql(" pragma recursive_triggers = off ")
> +test:catchsql("SET sql_recursive_triggers = false")
> -- Ticket #3928. Make sure that triggers to not make extra slots in
> -- the sql_SEQUENCE table.
> --
> diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
> index de03d7c..1037bed 100755
> --- a/test/sql-tap/colname.test.lua
> +++ b/test/sql-tap/colname.test.lua
> @@ -43,14 +43,14 @@ local function lreplace(arr, pos, len, val)
> end
>
> test:do_test(
> - "colname-1.1",
> + "colname-1.2",
> function()
> - return test:execsql "PRAGMA full_column_names"
> - end, {
> + return box.space._vsession_settings:get("sql_full_column_names").value
> + end,
> -- <colname-1.2>
> - 0
> + false
> -- </colname-1.2>
> - })
> + )
>
> -- Tests for then short=ON and full=any
> --
> @@ -163,7 +163,7 @@ test:do_test(
> "colname-3.1",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
> FROM tabc, txyz ORDER BY 1 LIMIT 1;
> CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> @@ -283,7 +283,7 @@ test:do_test(
> "colname-4.1",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
> FROM tabc, txyz ORDER BY 1 LIMIT 1;
> CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> @@ -440,7 +440,7 @@ test:do_test(
> -- instead of reconnect to database
> -- we are just turning settings to default state
> test:execsql([[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]])
> test:execsql [=[
> CREATE TABLE t6(a INT primary key, "'a'" INT, """a""" INT, "[a]" INT, "`a`" INT);
> diff --git a/test/sql-tap/fkey2.test.lua b/test/sql-tap/fkey2.test.lua
> index 264616d..de89790 100755
> --- a/test/sql-tap/fkey2.test.lua
> +++ b/test/sql-tap/fkey2.test.lua
> @@ -450,7 +450,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "fkey2-4.2",
> [[
> - PRAGMA recursive_triggers = off;
> + SET sql_recursive_triggers = false;
> DELETE FROM t1 WHERE node = 1;
> SELECT node FROM t1;
> ]], {
> @@ -473,7 +473,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "fkey2-4.4",
> [[
> - PRAGMA recursive_triggers = on;
> + SET sql_recursive_triggers = true;
> DROP TABLE t2;
> DROP TABLE t1;
> CREATE TABLE t1(
> diff --git a/test/sql-tap/gh2548-select-compound-limit.test.lua b/test/sql-tap/gh2548-select-compound-limit.test.lua
> index f578870..c802003 100755
> --- a/test/sql-tap/gh2548-select-compound-limit.test.lua
> +++ b/test/sql-tap/gh2548-select-compound-limit.test.lua
> @@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
> -test:plan(14)
> +test:plan(13)
>
> -- box.cfg{wal_mode='none'}
>
> @@ -53,7 +53,6 @@ for _, term in ipairs({'UNION', 'UNION ALL', 'INTERSECT', 'EXCEPT'}) do
> -- end
> end
>
> -
> test:do_catchsql_test(
> "gh2548-select-compound-limit-2",
> select_string_last, {
> @@ -63,20 +62,10 @@ test:do_catchsql_test(
> })
>
> test:do_execsql_test(
> - "gh2548-select-compound-limit-3.1", [[
> - pragma sql_compound_select_limit
> - ]], {
> - -- <gh2548-select-compound-limit-3.1>
> - 30
> - -- </gh2548-select-compound-limit-3.1>
> - })
> -
> -test:do_execsql_test(
> "gh2548-select-compound-limit-3.2", [[
> - pragma sql_compound_select_limit=31
> + SET sql_compound_select_limit = 31;
> ]], {
> -- <gh2548-select-compound-limit-3.2>
> - 31
> -- </gh2548-select-compound-limit-3.2>
> })
>
> @@ -90,10 +79,9 @@ test:do_execsql_test(
>
> test:do_execsql_test(
> "gh2548-select-compound-limit-3.4", [[
> - pragma sql_compound_select_limit=0
> + SET sql_compound_select_limit = 0;
> ]], {
> -- <gh2548-select-compound-limit-3.4>
> - 0
> -- </gh2548-select-compound-limit-3.4>
> })
>
> diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
> index 0f34114..c50e3fd 100644
> --- a/test/sql-tap/lua/sqltester.lua
> +++ b/test/sql-tap/lua/sqltester.lua
> @@ -413,7 +413,7 @@ box.cfg{
> }
>
> local engine = test_run and test_run:get_cfg('engine') or 'memtx'
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> function test.engine(self)
> return engine
> diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
> index b84093e..339c9d7 100755
> --- a/test/sql-tap/misc1.test.lua
> +++ b/test/sql-tap/misc1.test.lua
> @@ -219,7 +219,7 @@ test:do_test(
> local r = test:execsql([[
> CREATE TABLE t1(a TEXT primary KEY);
> INSERT INTO t1 VALUES('hi');
> - PRAGMA full_column_names=on;
> + SET sql_full_column_names = true;
> --SELECT rowid, * FROM t1;
> SELECT * FROM t1;
> ]])
> diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua
> index b3821dc..d6f8b54 100755
> --- a/test/sql-tap/pragma.test.lua
> +++ b/test/sql-tap/pragma.test.lua
> @@ -1,7 +1,7 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
>
> -test:plan(23)
> +test:plan(10)
>
> test:do_catchsql_test(
> "pragma-1.3",
> @@ -19,66 +19,7 @@ test:do_catchsql_test(
> [[
> pragma sql_default_engine='creepy';
> ]], {
> - 1, "Space engine 'creepy' does not exist"
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.2",
> - [[
> - pragma sql_default_engine='vinyl';
> - ]], {
> - 0
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.3",
> - [[
> - pragma sql_default_engine='memtx';
> - ]], {
> - 0
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.4",
> - [[
> - pragma sql_default_engine 'memtx';
> - ]], {
> - 1, "Syntax error near ''memtx''"
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.5",
> - [[
> - pragma sql_default_engine 1;
> - ]], {
> - 1, "Syntax error near '1'"
> -})
> -
> ---
> --- gh-3832: Some statements do not return column type
> ---
> --- Check that "PRAGMA sql_default_engine" called without arguments
> --- returns currently set sql_default_engine.
> -test:do_execsql_test(
> - "pragma-3.1",
> - [[
> - pragma sql_default_engine='vinyl';
> - pragma sql_default_engine;
> - ]], {
> - -- <pragma-3.1>
> - 'vinyl'
> - -- </pragma-3.1>
> -})
> -
> -test:do_execsql_test(
> - "pragma-3.2",
> - [[
> - pragma sql_default_engine='memtx';
> - pragma sql_default_engine;
> - ]], {
> - -- <pragma-3.2>
> - 'memtx'
> - -- </pragma-3.2>
> + 1, "Pragma 'SQL_DEFAULT_ENGINE' does not exist"
> })
>
> --
> @@ -187,76 +128,4 @@ test:do_execsql_test(
> -- </pragma-8.4>
> })
>
> ----
> ---- pragma sql_default_engine accepts string values and rejects IDs
> ----
> -test:do_catchsql_test(
> - "pragma-9.1",
> - [[
> - pragma sql_default_engine(the_engine);
> - ]], {
> - -- <pragma-9.1>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.1>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.2",
> - [[
> - pragma sql_default_engine(THE_ENGINE);
> - ]], {
> - -- <pragma-9.2>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.2>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.3",
> - [[
> - pragma sql_default_engine("THE_ENGINE");
> - ]], {
> - -- <pragma-9.3>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.3>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.4",
> - [[
> - pragma sql_default_engine('THE_ENGINE');
> - ]], {
> - -- <pragma-9.4>
> - 1, "Space engine 'THE_ENGINE' does not exist"
> - -- </pragma-9.4>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.5",
> - [[
> - pragma sql_default_engine(memtx);
> - ]], {
> - -- <pragma-9.5>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.5>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.6",
> - [[
> - pragma sql_default_engine("memtx");
> - ]], {
> - -- <pragma-9.6>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.6>
> -})
> -
> -test:do_execsql_test(
> - "pragma-9.7",
> - [[
> - pragma sql_default_engine('memtx');
> - ]], {
> - -- <pragma-9.7>
> - -- </pragma-9.7>
> -})
> -
> test:finish_test()
> diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
> index d8fe7a9..2caa612 100755
> --- a/test/sql-tap/select1.test.lua
> +++ b/test/sql-tap/select1.test.lua
> @@ -916,7 +916,7 @@ test:do_catchsql2_test(
> test:do_test(
> "select1-6.1.1",
> function()
> - test:execsql "PRAGMA full_column_names=on"
> + test:execsql "SET sql_full_column_names = true"
> return test:catchsql2 "SELECT f1 FROM test1 ORDER BY f2"
> end, {
> -- <select1-6.1.1>
> @@ -952,7 +952,7 @@ test:do_test(
> msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
> end)
> v = v == true and {0} or {1}
> - test:execsql "PRAGMA full_column_names=off"
> + test:execsql "SET sql_full_column_names = false"
> return table.insert(v,msg) or v
> end, {
> -- <select1-6.1.4>
> @@ -1043,13 +1043,13 @@ test:do_catchsql2_test(
> test:do_test(
> "select1-6.5.1",
> function()
> - test:execsql2 "PRAGMA full_column_names=on"
> + test:execsql2 "SET sql_full_column_names = true"
> local msg
> v = pcall( function ()
> msg = test:execsql2 "SELECT test1.f1+F2 FROM test1 ORDER BY f2"
> end)
> v = v == true and {0} or {1}
> - test:execsql2 "PRAGMA full_column_names=off"
> + test:execsql2 "SET sql_full_column_names = false"
> return table.insert(v,msg) or v
> end, {
> -- <select1-6.5.1>
> @@ -1124,7 +1124,7 @@ test:do_test(
> "select1-6.9.3",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> return test:execsql2 [[
> SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> @@ -1139,7 +1139,7 @@ test:do_test(
> "select1-6.9.4",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> @@ -1154,7 +1154,7 @@ test:do_test(
> "select1-6.9.5",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT 123.45;
> @@ -1235,7 +1235,7 @@ test:do_test(
> "select1-6.9.11",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
> @@ -1260,7 +1260,7 @@ test:do_test(
> "select1-6.9.13",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> @@ -1285,7 +1285,7 @@ test:do_test(
> "select1-6.9.15",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> @@ -1307,7 +1307,7 @@ test:do_execsql2_test(
> })
>
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> test:do_catchsql2_test(
> "select1-6.10",
> diff --git a/test/sql-tap/tkt3731.test.lua b/test/sql-tap/tkt3731.test.lua
> index 454cf67..57e7f3f 100755
> --- a/test/sql-tap/tkt3731.test.lua
> +++ b/test/sql-tap/tkt3731.test.lua
> @@ -22,7 +22,7 @@ test:plan(3)
> -- The tests in this file were written before sql supported recursive
> -- trigger invocation, and some tests depend on that to pass. So disable
> -- recursive triggers for this file.
> -test:catchsql " pragma recursive_triggers = off "
> +test:catchsql("SET sql_recursive_triggers = false")
> test:do_execsql_test(
> "tkt3731-1.1",
> [[
> diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
> index 6e60050..dbe54db 100755
> --- a/test/sql-tap/trigger2.test.lua
> +++ b/test/sql-tap/trigger2.test.lua
> @@ -58,7 +58,7 @@ test:plan(26)
> -- The tests in this file were written before sql supported recursive
> -- trigger invocation, and some tests depend on that to pass. So disable
> -- recursive triggers for this file.
> -test:catchsql " pragma recursive_triggers = off "
> +test:catchsql("SET sql_recursive_triggers = false")
> -- 1.
> ii = 0
> tbl_definitions = { "CREATE TABLE tbl (id INT PRIMARY KEY AUTOINCREMENT, a INTEGER UNIQUE, b INT );",
> diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
> index cf7dd7b..f9b7034 100755
> --- a/test/sql-tap/triggerC.test.lua
> +++ b/test/sql-tap/triggerC.test.lua
> @@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
> -test:plan(48)
> +test:plan(45)
>
> --!./tcltestrunner.lua
> -- 2009 August 24
> @@ -36,12 +36,9 @@ testprefix = "triggerC"
> -- REPLACE conflict resolution. And that they are not fired
> -- if recursive triggers are not enabled.
> --
> --- triggerC-6.*: Test that the recursive_triggers pragma returns correct
> --- results when invoked without an argument.
> ---
> -- Enable recursive triggers for this file.
> --
> -test:execsql " PRAGMA recursive_triggers = on "
> +test:execsql("SET sql_recursive_triggers = true;")
> ---------------------------------------------------------------------------
> -- This block of tests, triggerC-1.*, are not aimed at any specific
> -- property of the triggers sub-system. They were created to debug
> @@ -504,7 +501,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-5.3.0",
> [[
> - PRAGMA recursive_triggers = off
> + SET sql_recursive_triggers = false
> ]], {
> -- <triggerC-5.3.0>
>
> @@ -534,49 +531,13 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-5.3.8",
> [[
> - PRAGMA recursive_triggers = on
> + SET sql_recursive_triggers = true
> ]], {
> -- <triggerC-5.3.8>
>
> -- </triggerC-5.3.8>
> })
>
> ----------------------------------------------------------------------------
> --- This block of tests, triggerC-6.*, tests that "PRAGMA recursive_triggers"
> --- statements return the current value of the recursive triggers flag.
> ---
> -test:do_execsql_test(
> - "triggerC-6.1",
> - [[
> - PRAGMA recursive_triggers
> - ]], {
> - -- <triggerC-6.1>
> - 1
> - -- </triggerC-6.1>
> - })
> -
> -test:do_execsql_test(
> - "triggerC-6.2",
> - [[
> - PRAGMA recursive_triggers = off;
> - PRAGMA recursive_triggers;
> - ]], {
> - -- <triggerC-6.2>
> - 0
> - -- </triggerC-6.2>
> - })
> -
> -test:do_execsql_test(
> - "triggerC-6.3",
> - [[
> - PRAGMA recursive_triggers = on;
> - PRAGMA recursive_triggers;
> - ]], {
> - -- <triggerC-6.3>
> - 1
> - -- </triggerC-6.3>
> - })
> -
> -- MUST_WORK_TEST
> -- #-------------------------------------------------------------------------
> -- # Test some of the "undefined behaviour" associated with triggers. The
> @@ -890,7 +851,7 @@ test:execsql(
> test:do_execsql_test(
> "triggerC-13.1",
> [[
> - PRAGMA recursive_triggers = 'ON';
> + SET sql_recursive_triggers = true;
> CREATE TABLE t12(id INTEGER PRIMARY KEY, a INT, b INT);
> INSERT INTO t12 VALUES(1, 1, 2);
> CREATE TRIGGER tr12 AFTER UPDATE ON t12 FOR EACH ROW BEGIN
> @@ -974,7 +935,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-15.1.1",
> [[
> - PRAGMA recursive_triggers = 1;
> + SET sql_recursive_triggers = true;
> CREATE TABLE node(
> id int not null primary key,
> pid int not null default 0,
> diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
> index ac0389a..992a3c7 100755
> --- a/test/sql-tap/update.test.lua
> +++ b/test/sql-tap/update.test.lua
> @@ -442,7 +442,6 @@ test:do_execsql_test("update-5.6.5", [[
>
> -- Repeat the previous sequence of tests with a different index.
> --
> ---test:execsql "PRAGMA synchronous='FULL'"
> test:do_test("update-6.0", function()
> test:execsql "DROP INDEX idx1 ON test1"
> test:execsql "CREATE INDEX idx1 ON test1(f2)"
> diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
> index b82575f..21675d5 100755
> --- a/test/sql-tap/whereA.test.lua
> +++ b/test/sql-tap/whereA.test.lua
> @@ -14,7 +14,7 @@ test:plan(17)
> --
> -------------------------------------------------------------------------
> -- This file implements regression tests for sql library. The
> --- focus of this file is testing the reverse_select_order pragma.
> +-- focus of this file is testing the reverse_select_order option.
> --
> -- $Id: whereA.test,v 1.3 2009/06/10 19:33:29 drh Exp $
> -- ["set","testdir",[["file","dirname",["argv0"]]]]
> @@ -39,7 +39,7 @@ test:do_test(
> "whereA-1.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1;
> ]]
> end, {
> @@ -55,7 +55,7 @@ test:do_test(
> --db close
> --sql db test.db
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1;
> ]]
> end, {
> @@ -68,7 +68,7 @@ test:do_test(
> -- db close
> -- sql db test.db
> -- db eval {
> --- PRAGMA reverse_unordered_selects=1;
> +-- SET sql_reverse_unordered_selects = true;
> -- SELECT * FROM t1 ORDER BY rowid;
> -- }
> -- } {1 2 3 2 hello world 3 4.53 {}}
> @@ -76,11 +76,11 @@ test:do_test(
> "whereA-1.6",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects;
> + SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_reverse_unordered_selects';
> ]]
> end, {
> -- <whereA-1.6>
> - 1
> + true
> -- </whereA-1.6>
> })
>
> @@ -108,7 +108,7 @@ test:do_test(
> "whereA-2.1",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=0;
> + SET sql_reverse_unordered_selects = false;
> SELECT * FROM t1 WHERE a>0;
> ]]
> end, {
> @@ -121,7 +121,7 @@ test:do_test(
> "whereA-2.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE a>0;
> ]]
> end, {
> @@ -132,7 +132,7 @@ test:do_test(
>
> -- do_test whereA-2.3 {
> -- db eval {
> --- PRAGMA reverse_unordered_selects=1;
> +-- SET sql_reverse_unordered_selects = true;
> -- SELECT * FROM t1 WHERE a>0 ORDER BY rowid;
> -- }
> -- } {1 2 3 2 hello world 3 4.53 {}}
> @@ -140,7 +140,7 @@ test:do_test(
> "whe:reA-3.1",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=0;
> + SET sql_reverse_unordered_selects = false;
> SELECT * FROM t1 WHERE b>0;
> ]]
> end, {
> @@ -153,7 +153,7 @@ test:do_test(
> "whereA-3.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE b>0;
> ]]
> end, {
> @@ -166,7 +166,7 @@ test:do_test(
> "whereA-3.3",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE b>0 ORDER BY b;
> ]]
> end, {
> diff --git a/test/sql/check-clear-ephemeral.result b/test/sql/check-clear-ephemeral.result
> index 7d0be5f..3b12457 100644
> --- a/test/sql/check-clear-ephemeral.result
> +++ b/test/sql/check-clear-ephemeral.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> ---
> diff --git a/test/sql/check-clear-ephemeral.test.lua b/test/sql/check-clear-ephemeral.test.lua
> index 929a6c9..2ecf11c 100644
> --- a/test/sql/check-clear-ephemeral.test.lua
> +++ b/test/sql/check-clear-ephemeral.test.lua
> @@ -1,13 +1,13 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> -- box.cfg()
>
> -- create space
> box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> diff --git a/test/sql/checks.result b/test/sql/checks.result
> index a952b2b..f9a6772 100644
> --- a/test/sql/checks.result
> +++ b/test/sql/checks.result
> @@ -11,7 +11,7 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -736,7 +736,7 @@ physics_ck:drop()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
> index 4d33823..ffcbd26 100644
> --- a/test/sql/checks.test.lua
> +++ b/test/sql/checks.test.lua
> @@ -2,7 +2,7 @@ env = require('test_run')
> test_run = env.new()
> test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> --
> -- gh-3272: Move SQL CHECK into server
> @@ -240,7 +240,7 @@ physics_ck:drop()
> -- :enable configurator.
> --
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE test(a INT PRIMARY KEY);");
> box.execute('ALTER TABLE test ADD CONSTRAINT CK CHECK(a < 5);')
> box.space.TEST:insert({10})
> diff --git a/test/sql/clear.result b/test/sql/clear.result
> index afa6520..baeb15e 100644
> --- a/test/sql/clear.result
> +++ b/test/sql/clear.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON;")
> +-- box.execute("SET vdbe_debug=ON;")
> -- Seed entry
> for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> ---
> diff --git a/test/sql/clear.test.lua b/test/sql/clear.test.lua
> index 4c58767..8d5e8fb 100644
> --- a/test/sql/clear.test.lua
> +++ b/test/sql/clear.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON;")
> +-- box.execute("SET vdbe_debug=ON;")
>
> -- Seed entry
> for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> diff --git a/test/sql/collation.result b/test/sql/collation.result
> index 11962ef..dc11d28 100644
> --- a/test/sql/collation.result
> +++ b/test/sql/collation.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
> index 1be28b3..5e33562 100644
> --- a/test/sql/collation.test.lua
> +++ b/test/sql/collation.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- gh-3010: COLLATE after LIMIT should throw an error
>
> diff --git a/test/sql/ddl.result b/test/sql/ddl.result
> index 28acf37..af833d0 100644
> --- a/test/sql/ddl.result
> +++ b/test/sql/ddl.result
> @@ -8,7 +8,7 @@ json = require('json')
> engine = test_run:get_cfg('engine')
> | ---
> | ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> | ---
> | - row_count: 0
> | ...
> diff --git a/test/sql/ddl.test.lua b/test/sql/ddl.test.lua
> index 6067b61..b6f0c81 100644
> --- a/test/sql/ddl.test.lua
> +++ b/test/sql/ddl.test.lua
> @@ -1,7 +1,7 @@
> test_run = require('test_run').new()
> json = require('json')
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> --
> -- gh-4086: SQL transactional DDL.
> diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
> index ca58feb..3d58daf 100644
> --- a/test/sql/delete-multiple-idx.result
> +++ b/test/sql/delete-multiple-idx.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
> - row_count: 1
> ...
> -- Debug.
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries.
> box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> ---
> diff --git a/test/sql/delete-multiple-idx.test.lua b/test/sql/delete-multiple-idx.test.lua
> index a81cccc..2715d2f 100644
> --- a/test/sql/delete-multiple-idx.test.lua
> +++ b/test/sql/delete-multiple-idx.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE t3(id INT primary key,x INT,y INT);");
> box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
>
> -- Debug.
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries.
> box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> diff --git a/test/sql/delete.result b/test/sql/delete.result
> index e27c79d..9aa074f 100644
> --- a/test/sql/delete.result
> +++ b/test/sql/delete.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1, 2);");
> ---
> diff --git a/test/sql/delete.test.lua b/test/sql/delete.test.lua
> index 75448d4..ff1e622 100644
> --- a/test/sql/delete.test.lua
> +++ b/test/sql/delete.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1, 2);");
> diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
> index e8eb642..551e56f 100644
> --- a/test/sql/drop-index.result
> +++ b/test/sql/drop-index.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -23,7 +23,7 @@ box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> -- Dummy entry
> box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> ---
> diff --git a/test/sql/drop-index.test.lua b/test/sql/drop-index.test.lua
> index 8cd86ee..fd420b6 100644
> --- a/test/sql/drop-index.test.lua
> +++ b/test/sql/drop-index.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -11,7 +11,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zzoobar(c1, c4)")
> box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
>
> -- Dummy entry
> box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> diff --git a/test/sql/drop-table.result b/test/sql/drop-table.result
> index 7bc073d..ef4c5cf 100644
> --- a/test/sql/drop-table.result
> +++ b/test/sql/drop-table.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
> ---
> - row_count: 1
> diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua
> index a310db1..f0b1645 100644
> --- a/test/sql/drop-table.test.lua
> +++ b/test/sql/drop-table.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
>
> box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
>
> diff --git a/test/sql/engine.result b/test/sql/engine.result
> index 3ee93ad..b392566 100644
> --- a/test/sql/engine.result
> +++ b/test/sql/engine.result
> @@ -4,7 +4,7 @@ env = require('test_run')
> test_run = env.new()
> ---
> ...
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> @@ -16,7 +16,7 @@ box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> ---
> - row_count: 1
> ...
> -box.execute("pragma sql_default_engine='memtx'")
> +box.execute("set sql_default_engine='memtx'")
> ---
> - row_count: 0
> ...
> @@ -66,7 +66,7 @@ assert(box.space.T1_MEMTX.engine == 'memtx')
> ---
> - true
> ...
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
> index 112d3d3..bc16cc0 100644
> --- a/test/sql/engine.test.lua
> +++ b/test/sql/engine.test.lua
> @@ -1,11 +1,11 @@
> env = require('test_run')
> test_run = env.new()
>
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> box.execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
>
> -box.execute("pragma sql_default_engine='memtx'")
> +box.execute("set sql_default_engine='memtx'")
> box.execute("CREATE TABLE t3_memtx(a INT PRIMARY KEY, b INT, c INT);")
>
> assert(box.space.T1_VINYL.engine == 'vinyl')
> @@ -22,7 +22,7 @@ box.execute("CREATE TABLE t1_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> assert(box.space.T1_VINYL.engine == 'vinyl')
> box.execute("CREATE TABLE t1_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> assert(box.space.T1_MEMTX.engine == 'memtx')
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> box.execute("CREATE TABLE t2_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> assert(box.space.T2_VINYL.engine == 'vinyl')
> box.execute("CREATE TABLE t2_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> diff --git a/test/sql/errinj.result b/test/sql/errinj.result
> index 7ab522f..c94afae 100644
> --- a/test/sql/errinj.result
> +++ b/test/sql/errinj.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
> index b978767..d21629d 100644
> --- a/test/sql/errinj.test.lua
> +++ b/test/sql/errinj.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> errinj = box.error.injection
> fiber = require('fiber')
>
> diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
> index a0a67a1..6083d19 100644
> --- a/test/sql/func-recreate.result
> +++ b/test/sql/func-recreate.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
> index 0b32ea9..a819587 100644
> --- a/test/sql/func-recreate.test.lua
> +++ b/test/sql/func-recreate.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Check errors during function create process
> fiber = require('fiber')
> diff --git a/test/sql/gh-2362-select-access-rights.result b/test/sql/gh-2362-select-access-rights.result
> index b15b0da..f929914 100644
> --- a/test/sql/gh-2362-select-access-rights.result
> +++ b/test/sql/gh-2362-select-access-rights.result
> @@ -7,7 +7,7 @@ engine = test_run:get_cfg('engine')
> nb = require('net.box')
> ---
> ...
> -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> +box.execute("SET sql_default_engine='"..engine.."'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2362-select-access-rights.test.lua b/test/sql/gh-2362-select-access-rights.test.lua
> index f2b66b6..5666b68 100644
> --- a/test/sql/gh-2362-select-access-rights.test.lua
> +++ b/test/sql/gh-2362-select-access-rights.test.lua
> @@ -2,7 +2,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> nb = require('net.box')
>
> -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> +box.execute("SET sql_default_engine='"..engine.."'")
> box.execute("CREATE TABLE t1 (s1 INT PRIMARY KEY, s2 INT UNIQUE);")
> box.execute("CREATE TABLE t2 (s1 INT PRIMARY KEY);")
> box.execute("INSERT INTO t1 VALUES (1, 1);")
> diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result
> index 021d037..35daaf2 100644
> --- a/test/sql/gh-2929-primary-key.result
> +++ b/test/sql/gh-2929-primary-key.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
> index 9cc6cd5..f419668 100644
> --- a/test/sql/gh-2929-primary-key.test.lua
> +++ b/test/sql/gh-2929-primary-key.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- All tables in SQL are now WITHOUT ROW ID, so if user
> -- tries to create table without a primary key, an appropriate error message
> diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result
> index d2938cd..11fed1e 100644
> --- a/test/sql/gh-2981-check-autoinc.result
> +++ b/test/sql/gh-2981-check-autoinc.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
> index 0eb8f73..afbefa0 100644
> --- a/test/sql/gh-2981-check-autoinc.test.lua
> +++ b/test/sql/gh-2981-check-autoinc.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.cfg{}
>
> diff --git a/test/sql/gh-3199-no-mem-leaks.result b/test/sql/gh-3199-no-mem-leaks.result
> index e7ba1d2..00211ce 100644
> --- a/test/sql/gh-3199-no-mem-leaks.result
> +++ b/test/sql/gh-3199-no-mem-leaks.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
> index 54a6ce5..f63bedf 100644
> --- a/test/sql/gh-3199-no-mem-leaks.test.lua
> +++ b/test/sql/gh-3199-no-mem-leaks.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> fiber = require('fiber')
>
> -- This test checks that no leaks of region memory happens during
> diff --git a/test/sql/gh-3613-idx-alter-update-2.result b/test/sql/gh-3613-idx-alter-update-2.result
> index ff63eb2..270f961 100644
> --- a/test/sql/gh-3613-idx-alter-update-2.result
> +++ b/test/sql/gh-3613-idx-alter-update-2.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3613-idx-alter-update-2.test.lua b/test/sql/gh-3613-idx-alter-update-2.test.lua
> index ff5b651..33730ff 100644
> --- a/test/sql/gh-3613-idx-alter-update-2.test.lua
> +++ b/test/sql/gh-3613-idx-alter-update-2.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> box.execute('CREATE INDEX i ON t (s1)')
> diff --git a/test/sql/gh-3613-idx-alter-update.result b/test/sql/gh-3613-idx-alter-update.result
> index ba323a6..34b4a1f 100644
> --- a/test/sql/gh-3613-idx-alter-update.result
> +++ b/test/sql/gh-3613-idx-alter-update.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3613-idx-alter-update.test.lua b/test/sql/gh-3613-idx-alter-update.test.lua
> index 3027182..389a99d 100644
> --- a/test/sql/gh-3613-idx-alter-update.test.lua
> +++ b/test/sql/gh-3613-idx-alter-update.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> box.execute('CREATE INDEX i ON t (s1)')
> diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
> index 4b8e7ed..5691e70 100644
> --- a/test/sql/gh-3888-values-blob-assert.result
> +++ b/test/sql/gh-3888-values-blob-assert.result
> @@ -10,7 +10,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3888-values-blob-assert.test.lua b/test/sql/gh-3888-values-blob-assert.test.lua
> index 0b7c385..9680aa5 100644
> --- a/test/sql/gh-3888-values-blob-assert.test.lua
> +++ b/test/sql/gh-3888-values-blob-assert.test.lua
> @@ -6,7 +6,7 @@
> --
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- check 'VALUES' against typedef keywords (should fail)
> box.execute('VALUES(scalar)')
> diff --git a/test/sql/gh2141-delete-trigger-drop-table.result b/test/sql/gh2141-delete-trigger-drop-table.result
> index 1d373f5..a218328 100644
> --- a/test/sql/gh2141-delete-trigger-drop-table.result
> +++ b/test/sql/gh2141-delete-trigger-drop-table.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> index 4d21fd7..2d5b987 100644
> --- a/test/sql/gh2141-delete-trigger-drop-table.test.lua
> +++ b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE t(id INT PRIMARY KEY)")
> diff --git a/test/sql/gh2251-multiple-update.result b/test/sql/gh2251-multiple-update.result
> index 42ebf7f..7a21cea 100644
> --- a/test/sql/gh2251-multiple-update.result
> +++ b/test/sql/gh2251-multiple-update.result
> @@ -5,7 +5,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
> index 4d55096..eeff047 100644
> --- a/test/sql/gh2251-multiple-update.test.lua
> +++ b/test/sql/gh2251-multiple-update.test.lua
> @@ -1,7 +1,7 @@
> -- Regression test for #2251
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
> index d69fcbd..a7dd7d2 100644
> --- a/test/sql/gh2483-remote-persistency-check.result
> +++ b/test/sql/gh2483-remote-persistency-check.result
> @@ -8,7 +8,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
> index 7db1602..bf2fc6b 100644
> --- a/test/sql/gh2483-remote-persistency-check.test.lua
> +++ b/test/sql/gh2483-remote-persistency-check.test.lua
> @@ -2,7 +2,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.schema.user.grant('guest', 'read,write,execute', 'universe')
>
> diff --git a/test/sql/gh2808-inline-unique-persistency-check.result b/test/sql/gh2808-inline-unique-persistency-check.result
> index a277b3f..db03feb 100644
> --- a/test/sql/gh2808-inline-unique-persistency-check.result
> +++ b/test/sql/gh2808-inline-unique-persistency-check.result
> @@ -8,7 +8,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> index 26b646a..ef38ae3 100644
> --- a/test/sql/gh2808-inline-unique-persistency-check.test.lua
> +++ b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> @@ -2,7 +2,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Create a table and insert a datum
> box.execute([[CREATE TABLE t1(a INT PRIMARY KEY, b INT, UNIQUE(b));]])
> diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result
> index 8ff7528..cb687a1 100644
> --- a/test/sql/icu-upper-lower.result
> +++ b/test/sql/icu-upper-lower.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
> index 00e9699..bbd4f00 100644
> --- a/test/sql/icu-upper-lower.test.lua
> +++ b/test/sql/icu-upper-lower.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> test_run:cmd("setopt delimiter ';'")
>
> diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
> index 1cf44c9..ec57681 100644
> --- a/test/sql/insert-unique.result
> +++ b/test/sql/insert-unique.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entry
> box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> ---
> diff --git a/test/sql/insert-unique.test.lua b/test/sql/insert-unique.test.lua
> index 026bc9d..243333e 100644
> --- a/test/sql/insert-unique.test.lua
> +++ b/test/sql/insert-unique.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entry
> box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
> index 223ba02..c886f8c 100644
> --- a/test/sql/integer-overflow.result
> +++ b/test/sql/integer-overflow.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
> index 1b3e8ce..57929e2 100644
> --- a/test/sql/integer-overflow.test.lua
> +++ b/test/sql/integer-overflow.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- gh-3735: make sure that integer overflows errors are
> -- handled during VDBE execution.
> diff --git a/test/sql/iproto.result b/test/sql/iproto.result
> index ffc7cd9..38f9789 100644
> --- a/test/sql/iproto.result
> +++ b/test/sql/iproto.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
> index b5ec2c0..d31fb7f 100644
> --- a/test/sql/iproto.test.lua
> +++ b/test/sql/iproto.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('create table test (id int primary key, a NUMBER, b text)')
> space = box.space.TEST
> diff --git a/test/sql/max-on-index.result b/test/sql/max-on-index.result
> index 57ce95b..45f29fd 100644
> --- a/test/sql/max-on-index.result
> +++ b/test/sql/max-on-index.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -25,7 +25,7 @@ box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO test1 VALUES(1, 2)");
> ---
> diff --git a/test/sql/max-on-index.test.lua b/test/sql/max-on-index.test.lua
> index 4cceaa7..73e4199 100644
> --- a/test/sql/max-on-index.test.lua
> +++ b/test/sql/max-on-index.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -13,7 +13,7 @@ box.execute("CREATE INDEX test1_index ON test1 (f2)")
> box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO test1 VALUES(1, 2)");
> diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
> index 69e3ee0..d198e14 100644
> --- a/test/sql/message-func-indexes.result
> +++ b/test/sql/message-func-indexes.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
> index 9ac5f47..dc67606 100644
> --- a/test/sql/message-func-indexes.test.lua
> +++ b/test/sql/message-func-indexes.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Creating tables.
> box.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
> diff --git a/test/sql/misc.result b/test/sql/misc.result
> index a157ddb..b06ac57 100644
> --- a/test/sql/misc.result
> +++ b/test/sql/misc.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
> index 541660c..e581b73 100644
> --- a/test/sql/misc.test.lua
> +++ b/test/sql/misc.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Forbid multistatement queries.
> box.execute('select 1;')
> diff --git a/test/sql/no-pk-space.result b/test/sql/no-pk-space.result
> index 025f363..d0274ea 100644
> --- a/test/sql/no-pk-space.result
> +++ b/test/sql/no-pk-space.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/no-pk-space.test.lua b/test/sql/no-pk-space.test.lua
> index 318c2ac..f451b57 100644
> --- a/test/sql/no-pk-space.test.lua
> +++ b/test/sql/no-pk-space.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> format = {}
> format[1] = {'id', 'integer'}
> diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
> index 6851e21..c0bb802 100644
> --- a/test/sql/on-conflict.result
> +++ b/test/sql/on-conflict.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
> index 1aa4d1b..958303e 100644
> --- a/test/sql/on-conflict.test.lua
> +++ b/test/sql/on-conflict.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> --
> -- Check that original sql ON CONFLICT clause is really
> -- disabled.
> diff --git a/test/sql/persistency.result b/test/sql/persistency.result
> index f8f992c..88778ec 100644
> --- a/test/sql/persistency.result
> +++ b/test/sql/persistency.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
> index 1964453..72d1992 100644
> --- a/test/sql/persistency.test.lua
> +++ b/test/sql/persistency.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> diff --git a/test/sql/row-count.result b/test/sql/row-count.result
> index 6bf74ed..dd898aa 100644
> --- a/test/sql/row-count.result
> +++ b/test/sql/row-count.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -314,13 +314,13 @@ box.execute("SELECT ROW_COUNT();")
> rows:
> - [0]
> ...
> -box.execute('PRAGMA recursive_triggers')
> +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
> ---
> - metadata:
> - - name: recursive_triggers
> - type: integer
> + - name: value
> + type: any
> rows:
> - - [1]
> + - [true]
> ...
> -- Clean-up.
> --
> diff --git a/test/sql/row-count.test.lua b/test/sql/row-count.test.lua
> index 369e7fa..f5a9820 100644
> --- a/test/sql/row-count.test.lua
> +++ b/test/sql/row-count.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Test cases concerning row count calculations.
> --
> @@ -65,7 +65,7 @@ box.execute("SELECT ROW_COUNT();")
> box.execute("SELECT ROW_COUNT();")
> box.execute("EXPLAIN QUERY PLAN INSERT INTO t1 VALUES ('b'), ('c'), ('d');")
> box.execute("SELECT ROW_COUNT();")
> -box.execute('PRAGMA recursive_triggers')
> +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
>
> -- Clean-up.
> --
> diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
> index e48db30..a111e26 100644
> --- a/test/sql/savepoints.result
> +++ b/test/sql/savepoints.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
> index 99622a4..0af67a9 100644
> --- a/test/sql/savepoints.test.lua
> +++ b/test/sql/savepoints.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- These tests check that SQL savepoints properly work outside
> -- transactions as well as inside transactions started in Lua.
> diff --git a/test/sql/select-null.result b/test/sql/select-null.result
> index 83d9776..bd25f03 100644
> --- a/test/sql/select-null.result
> +++ b/test/sql/select-null.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> ---
> diff --git a/test/sql/select-null.test.lua b/test/sql/select-null.test.lua
> index a49eb43..9f54048 100644
> --- a/test/sql/select-null.test.lua
> +++ b/test/sql/select-null.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
> index 4102b1a..e2d60a9 100644
> --- a/test/sql/sql-debug.result
> +++ b/test/sql/sql-debug.result
> @@ -5,50 +5,130 @@ test_run = require('test_run').new()
> ---
> ...
> --
> --- gh-3832: Some statements do not return column type
> --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> --- without parameter.
> -result = box.execute('PRAGMA parser_trace').rows
> +-- gh-4511: make sure that SET works.
> +--
> +box.execute('SELECT "name" FROM "_vsession_settings";')
> +---
> +- metadata:
> + - name: name
> + type: string
> + rows:
> + - ['sql_default_engine']
> + - ['sql_defer_foreign_keys']
> + - ['sql_full_column_names']
> + - ['sql_parser_trace']
> + - ['sql_recursive_triggers']
> + - ['sql_reverse_unordered_selects']
> + - ['sql_select_trace']
> + - ['sql_trace']
> + - ['sql_vdbe_addoptrace']
> + - ['sql_vdbe_debug']
> + - ['sql_vdbe_eqp']
> + - ['sql_vdbe_listing']
> + - ['sql_vdbe_trace']
> + - ['sql_where_trace']
> +...
> +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> +---
> +...
> +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +---
> +...
> +box.execute('SET sql_default_engine = 1;')
> +---
> +- null
> +- 'Inconsistent types: expected string got integer'
> +...
> +box.execute("SET sql_default_engine = 'some_engine';")
> +---
> +- null
> +- Space engine 'some_engine' does not exist
> +...
> +box.execute("SET engine = 'vinyl';")
> +---
> +- null
> +- Setting is not found
> +...
> +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> +---
> +- null
> +- 'Inconsistent types: expected boolean got string'
> +...
> +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> ---
> +- true
> ...
> -box.execute('PRAGMA parser_trace = 1')
> +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +---
> +- true
> +...
> +box.execute("SET sql_default_engine = 'vinyl';")
> +---
> +- row_count: 0
> +...
> +box.execute("SET sql_reverse_unordered_selects = true;")
> ---
> - row_count: 0
> ...
> -box.execute('PRAGMA parser_trace')
> +box.execute('SELECT * FROM "_vsession_settings";')
> ---
> - metadata:
> - - name: parser_trace
> - type: integer
> + - name: name
> + type: string
> + - name: value
> + type: any
> rows:
> - - [1]
> + - ['sql_where_trace', false]
> + - ['sql_vdbe_trace', false]
> + - ['sql_vdbe_listing', false]
> + - ['sql_vdbe_eqp', false]
> + - ['sql_vdbe_debug', false]
> + - ['sql_vdbe_addoptrace', false]
> + - ['sql_trace', false]
> + - ['sql_select_trace', false]
> + - ['sql_reverse_unordered_selects', true]
> + - ['sql_recursive_triggers', true]
> + - ['sql_parser_trace', false]
> + - ['sql_full_column_names', false]
> + - ['sql_defer_foreign_keys', false]
> + - ['sql_default_engine', 'vinyl']
> ...
> -box.execute('PRAGMA parser_trace = '.. result[1][1])
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> ---
> --- Make PRAGMA command return the result as a result set.
> ---
> -box.execute('PRAGMA')
> +box.execute("SET sql_reverse_unordered_selects = false;")
> +---
> +- row_count: 0
> +...
> +box.execute('SELECT * FROM "_vsession_settings";')
> ---
> - metadata:
> - - name: pragma_name
> - type: text
> - - name: pragma_value
> - type: integer
> + - name: name
> + type: string
> + - name: value
> + type: any
> rows:
> - - ['defer_foreign_keys', 0]
> - - ['full_column_names', 0]
> - - ['parser_trace', 0]
> - - ['recursive_triggers', 1]
> - - ['reverse_unordered_selects', 0]
> - - ['select_trace', 0]
> - - ['sql_trace', 0]
> - - ['vdbe_addoptrace', 0]
> - - ['vdbe_debug', 0]
> - - ['vdbe_eqp', 0]
> - - ['vdbe_listing', 0]
> - - ['vdbe_trace', 0]
> - - ['where_trace', 0]
> + - ['sql_default_engine', 'memtx']
> + - ['sql_defer_foreign_keys', false]
> + - ['sql_full_column_names', false]
> + - ['sql_parser_trace', false]
> + - ['sql_recursive_triggers', true]
> + - ['sql_reverse_unordered_selects', false]
> + - ['sql_select_trace', false]
> + - ['sql_trace', false]
> + - ['sql_vdbe_addoptrace', false]
> + - ['sql_vdbe_debug', false]
> + - ['sql_vdbe_eqp', false]
> + - ['sql_vdbe_listing', false]
> + - ['sql_vdbe_trace', false]
> + - ['sql_where_trace', false]
> +...
> +box.execute("SET sql_default_engine = '"..engine.."';")
> +---
> +- row_count: 0
> +...
> +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> +---
> +- row_count: 0
> ...
> diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua
> index edd0ef4..b15deee 100644
> --- a/test/sql/sql-debug.test.lua
> +++ b/test/sql/sql-debug.test.lua
> @@ -2,16 +2,27 @@ remote = require('net.box')
> test_run = require('test_run').new()
>
> --
> --- gh-3832: Some statements do not return column type
> +-- gh-4511: make sure that SET works.
> +--
> +box.execute('SELECT "name" FROM "_vsession_settings";')
>
> --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> --- without parameter.
> -result = box.execute('PRAGMA parser_trace').rows
> -box.execute('PRAGMA parser_trace = 1')
> -box.execute('PRAGMA parser_trace')
> -box.execute('PRAGMA parser_trace = '.. result[1][1])
> +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
>
> ---
> --- Make PRAGMA command return the result as a result set.
> ---
> -box.execute('PRAGMA')
> +box.execute('SET sql_default_engine = 1;')
> +box.execute("SET sql_default_engine = 'some_engine';")
> +box.execute("SET engine = 'vinyl';")
> +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +
> +box.execute("SET sql_default_engine = 'vinyl';")
> +box.execute("SET sql_reverse_unordered_selects = true;")
> +box.execute('SELECT * FROM "_vsession_settings";')
> +
> +box.execute("SET sql_default_engine = 'memtx';")
> +box.execute("SET sql_reverse_unordered_selects = false;")
> +box.execute('SELECT * FROM "_vsession_settings";')
> +
> +box.execute("SET sql_default_engine = '"..engine.."';")
> +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> diff --git a/test/sql/sql-statN-index-drop.result b/test/sql/sql-statN-index-drop.result
> index b2a4458..cf0f6f4 100644
> --- a/test/sql/sql-statN-index-drop.result
> +++ b/test/sql/sql-statN-index-drop.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
> index 5477a2a..5f9cc68 100644
> --- a/test/sql/sql-statN-index-drop.test.lua
> +++ b/test/sql/sql-statN-index-drop.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Initializing some things.
> box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT);")
> diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
> index 1ae9ef2..07a7c41 100644
> --- a/test/sql/tokenizer.result
> +++ b/test/sql/tokenizer.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
> index 3f5dd12..15cf658 100644
> --- a/test/sql/tokenizer.test.lua
> +++ b/test/sql/tokenizer.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> sql_tokenizer = require('sql_tokenizer')
>
> diff --git a/test/sql/transition.result b/test/sql/transition.result
> index 9738092..35e7af6 100644
> --- a/test/sql/transition.result
> +++ b/test/sql/transition.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
> index a05c26a..9b8b868 100644
> --- a/test/sql/transition.test.lua
> +++ b/test/sql/transition.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result
> index 29c7316..17311ee 100644
> --- a/test/sql/transitive-transactions.result
> +++ b/test/sql/transitive-transactions.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> +box.execute("set sql_default_engine=\'"..engine.."\'")
> ---
> - row_count: 0
> ...
> @@ -88,7 +88,7 @@ box.space.PARENT:select();
> ---
> - - [1, 1]
> ...
> --- Make sure that 'PRAGMA defer_foreign_keys' works.
> +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> --
> box.execute('DROP TABLE child;')
> box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> @@ -116,7 +116,7 @@ box.space.PARENT:select();
> ---
> - - [1, 1]
> ...
> -box.execute('PRAGMA defer_foreign_keys = 1;')
> +box.execute('SET sql_defer_foreign_keys = true;')
> box.rollback()
> fk_defer();
> ---
> @@ -131,7 +131,7 @@ box.space.PARENT:select();
> - [2, 2]
> ...
> -- Cleanup
> -box.execute('PRAGMA defer_foreign_keys = 0;')
> +box.execute('SET sql_defer_foreign_keys = false;')
>
> box.execute('DROP TABLE child;');
> ---
> diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
> index 4633f07..3c5fecb 100644
> --- a/test/sql/transitive-transactions.test.lua
> +++ b/test/sql/transitive-transactions.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> +box.execute("set sql_default_engine=\'"..engine.."\'")
> test_run:cmd("setopt delimiter ';'")
>
> -- These tests are aimed at checking transitive transactions
> @@ -45,7 +45,7 @@ fk_violation_3();
> box.space.CHILD:select();
> box.space.PARENT:select();
>
> --- Make sure that 'PRAGMA defer_foreign_keys' works.
> +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> --
> box.execute('DROP TABLE child;')
> box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> @@ -62,13 +62,13 @@ end;
> fk_defer();
> box.space.CHILD:select();
> box.space.PARENT:select();
> -box.execute('PRAGMA defer_foreign_keys = 1;')
> +box.execute('SET sql_defer_foreign_keys = true;')
> box.rollback()
> fk_defer();
> box.space.CHILD:select();
> box.space.PARENT:select();
>
> -box.execute('PRAGMA defer_foreign_keys = 0;')
> +box.execute('SET sql_defer_foreign_keys = false;')
>
> -- Cleanup
> box.execute('DROP TABLE child;');
> diff --git a/test/sql/triggers.result b/test/sql/triggers.result
> index 9dfe981..de1f074 100644
> --- a/test/sql/triggers.result
> +++ b/test/sql/triggers.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -292,7 +292,7 @@ box.execute("DROP TABLE T1;")
> -- gh-3531: Assertion with trigger and two storage engines
> --
> -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> -box.execute("PRAGMA sql_default_engine ('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> ---
> - row_count: 0
> ...
> @@ -304,7 +304,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -336,7 +336,7 @@ box.execute("DROP TABLE n;")
> - row_count: 1
> ...
> -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -348,7 +348,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> ---
> - row_count: 0
> ...
> @@ -380,7 +380,7 @@ box.execute("DROP TABLE n;")
> - row_count: 1
> ...
> -- Test SQL Transaction with LUA
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -388,7 +388,7 @@ box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine='vinyl'")
> +box.execute("SET sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
> index f0397dc..138d1c0 100644
> --- a/test/sql/triggers.test.lua
> +++ b/test/sql/triggers.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Get invariant part of the tuple; name and opts don't change.
> function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
> @@ -100,10 +100,10 @@ box.execute("DROP TABLE T1;")
> -- gh-3531: Assertion with trigger and two storage engines
> --
> -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> -box.execute("PRAGMA sql_default_engine ('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> -box.execute("PRAGMA sql_default_engine('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> box.execute("INSERT INTO m VALUES (0, '0');")
> box.execute("INSERT INTO n VALUES (0, '',null);")
> @@ -116,10 +116,10 @@ box.execute("DROP TABLE n;")
>
>
> -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> -box.execute("PRAGMA sql_default_engine('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> box.execute("INSERT INTO m VALUES (0, '0');")
> box.execute("INSERT INTO n VALUES (0, '',null);")
> @@ -131,9 +131,9 @@ box.execute("DROP TABLE m;")
> box.execute("DROP TABLE n;")
>
> -- Test SQL Transaction with LUA
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> -box.execute("PRAGMA sql_default_engine='vinyl'")
> +box.execute("SET sql_default_engine='vinyl'")
> box.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
> box.execute("INSERT INTO test2 VALUES (2)")
> box.execute("START TRANSACTION")
> diff --git a/test/sql/update-with-nested-select.result b/test/sql/update-with-nested-select.result
> index 3172430..b6ccda2 100644
> --- a/test/sql/update-with-nested-select.result
> +++ b/test/sql/update-with-nested-select.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1,4,6);");
> ---
> diff --git a/test/sql/update-with-nested-select.test.lua b/test/sql/update-with-nested-select.test.lua
> index 88424fc..07587ff 100644
> --- a/test/sql/update-with-nested-select.test.lua
> +++ b/test/sql/update-with-nested-select.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1,4,6);");
> diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
> index f0997e1..6627777 100644
> --- a/test/sql/upgrade.result
> +++ b/test/sql/upgrade.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
> index 37425ae..0c882ba 100644
> --- a/test/sql/upgrade.test.lua
> +++ b/test/sql/upgrade.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> work_dir = 'sql/upgrade/1.10/'
> test_run:cmd('create server upgrade with script="sql/upgrade/upgrade.lua", workdir="' .. work_dir .. '"')
> diff --git a/test/sql/view.result b/test/sql/view.result
> index d845df8..3df08fc 100644
> --- a/test/sql/view.result
> +++ b/test/sql/view.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
> index 0008056..6a1fae2 100644
> --- a/test/sql/view.test.lua
> +++ b/test/sql/view.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Verify that constraints on 'view' option are working.
>
> diff --git a/test/sql/view_delayed_wal.result b/test/sql/view_delayed_wal.result
> index d518e7d..a5f64f2 100644
> --- a/test/sql/view_delayed_wal.result
> +++ b/test/sql/view_delayed_wal.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
> index 7e6fce6..ec93e72 100644
> --- a/test/sql/view_delayed_wal.test.lua
> +++ b/test/sql/view_delayed_wal.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> fiber = require('fiber')
>
> -- View reference counters are incremented before firing
> diff --git a/test/sql/vinyl-opts.result b/test/sql/vinyl-opts.result
> index 10a649a..b9e07c1 100644
> --- a/test/sql/vinyl-opts.result
> +++ b/test/sql/vinyl-opts.result
> @@ -13,7 +13,7 @@ test_run:cmd("switch test")
> ---
> - true
> ...
> -box.execute('pragma sql_default_engine= \'vinyl\'')
> +box.execute('set sql_default_engine= \'vinyl\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/vinyl-opts.test.lua b/test/sql/vinyl-opts.test.lua
> index 4460724..05864d0 100644
> --- a/test/sql/vinyl-opts.test.lua
> +++ b/test/sql/vinyl-opts.test.lua
> @@ -3,7 +3,7 @@ test_run:cmd("create server test with script='sql/vinyl-opts-cfg.lua'")
> test_run:cmd("start server test")
> test_run:cmd("switch test")
>
> -box.execute('pragma sql_default_engine= \'vinyl\'')
> +box.execute('set sql_default_engine= \'vinyl\'')
> box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
> box.space.V1.index[0].options
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET imeevma
2019-11-27 10:45 ` Mergen Imeev
@ 2019-11-27 10:51 ` Konstantin Osipov
2019-11-27 11:05 ` Mergen Imeev
1 sibling, 1 reply; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-27 10:51 UTC (permalink / raw)
To: imeevma; +Cc: tarantool-patches, v.shpilevoy
Why is it not possible to make the settings system view updatable,
if you decided to go with adding such a view anyway?
Usually, if one allows SET statement, SET option_name (without
"= new_value") prints the current setting. This does the job and
makes the "_vsettings" system view unnecessary.
Don't you think that having to use one piece of syntax to query a
value and entirely different piece to assign it is, ehm,
inconsistent, hard to learn & remember, and eventually hard to
use?
* imeevma@tarantool.org <imeevma@tarantool.org> [19/11/27 13:16]:
> This patch replaces the control pragmas with SET. List of replaced
> control pragmas and their SET settings:
> Control pragmas SET parameters
> defer_foreign_keys sql_defer_foreign_keys
> full_column_names sql_full_column_names
> recursive_triggers sql_recursive_triggers
> reverse_unordered_selects sql_reverse_unordered_selects
> sql_compound_select_limit sql_compound_select_limit
> sql_default_engine sql_default_engine
>
> Also, in debug build, these control pragmas are replaced by SET
> settings:
> Control pragmas SET parameters
> parser_trace sql_parser_trace
> select_trace sql_select_trace
> sql_trace sql_trace
> vdbe_addoptrace sql_vdbe_addoptrace
> vdbe_debug sql_vdbe_debug
> vdbe_eqp sql_vdbe_eqp
> vdbe_listing sql_vdbe_listing
> vdbe_trace sql_vdbe_trace
> where_trace sql_where_trace
>
> Difference between SET and control pragma:
> 1) SET have more definite syntax:
> SET <setting name> = <setting value>;
> In PRAGMA, we could set the settings using these methods:
> PRAGMA <setting name> = <setting value>;
> PRAGMA <setting name>(<setting value>);
>
> 2) SET allows only a specific type of value for each setting. In
> PRAGMA, we could use almost everything to set up any setting.
> Although the rules by which the settings were set in PRAGMA were
> pretty easy to understand.
>
> 3) SET cannot display setting values. PRAGMA showed the setting
> values using the syntax "PRAGMA <setting name>;". With SET, we
> must use other means to get the current setting values. For
> session settings, we could use the sysview "_vsession_settings"
> to get these values. It is worth noting that all current SQL
> settings are session settings, with the exception of
> 'sql_reverse_unordered_selects'.
>
> After this patch there will be no control pragmas.
>
> Closes #4511
> Closes #4621
>
> @TarantoolBot document
> Title: SQL SET statement
>
> SQL SET statement is used to change SQL settings. To change the
> value of an SQL setting, use the following syntax:
>
> SET <setting name> = <setting value>;
>
> Currently available SQL settings:
> 'sql_defer_foreign_keys'
> 'sql_full_column_names'
> 'sql_recursive_triggers'
> 'sql_reverse_unordered_selects'
> 'sql_compound_select_limit'
> 'sql_default_engine'
>
> In addition, SQL debugging settings can also be changed using this
> statement in debug build:
> 'sql_parser_trace'
> 'sql_select_trace'
> 'sql_trace'
> 'sql_vdbe_addoptrace'
> 'sql_vdbe_debug'
> 'sql_vdbe_eqp'
> 'sql_vdbe_listing'
> 'sql_vdbe_trace'
> 'sql_where_trace'
>
> Example of usage:
> SET sql_full_column_names = true;
> SET sql_compound_select_limit = 10;
> SET sql_default_engine = 'memtx';
> ---
> src/box/sql/build.c | 120 ++++++++++++
> src/box/sql/parse.y | 8 +-
> src/box/sql/pragma.c | 203 +--------------------
> src/box/sql/pragma.h | 134 --------------
> src/box/sql/sqlInt.h | 57 +++++-
> src/box/sql/vdbe.c | 25 +++
> test/sql-tap/analyze4.test.lua | 4 +-
> test/sql-tap/autoinc.test.lua | 2 +-
> test/sql-tap/colname.test.lua | 16 +-
> test/sql-tap/fkey2.test.lua | 4 +-
> test/sql-tap/gh2548-select-compound-limit.test.lua | 18 +-
> test/sql-tap/lua/sqltester.lua | 2 +-
> test/sql-tap/misc1.test.lua | 2 +-
> test/sql-tap/pragma.test.lua | 135 +-------------
> test/sql-tap/select1.test.lua | 22 +--
> test/sql-tap/tkt3731.test.lua | 2 +-
> test/sql-tap/trigger2.test.lua | 2 +-
> test/sql-tap/triggerC.test.lua | 51 +-----
> test/sql-tap/update.test.lua | 1 -
> test/sql-tap/whereA.test.lua | 24 +--
> test/sql/check-clear-ephemeral.result | 4 +-
> test/sql/check-clear-ephemeral.test.lua | 4 +-
> test/sql/checks.result | 4 +-
> test/sql/checks.test.lua | 4 +-
> test/sql/clear.result | 4 +-
> test/sql/clear.test.lua | 4 +-
> test/sql/collation.result | 2 +-
> test/sql/collation.test.lua | 2 +-
> test/sql/ddl.result | 2 +-
> test/sql/ddl.test.lua | 2 +-
> test/sql/delete-multiple-idx.result | 4 +-
> test/sql/delete-multiple-idx.test.lua | 4 +-
> test/sql/delete.result | 4 +-
> test/sql/delete.test.lua | 4 +-
> test/sql/drop-index.result | 4 +-
> test/sql/drop-index.test.lua | 4 +-
> test/sql/drop-table.result | 4 +-
> test/sql/drop-table.test.lua | 4 +-
> test/sql/engine.result | 6 +-
> test/sql/engine.test.lua | 6 +-
> test/sql/errinj.result | 2 +-
> test/sql/errinj.test.lua | 2 +-
> test/sql/func-recreate.result | 2 +-
> test/sql/func-recreate.test.lua | 2 +-
> test/sql/gh-2362-select-access-rights.result | 2 +-
> test/sql/gh-2362-select-access-rights.test.lua | 2 +-
> test/sql/gh-2929-primary-key.result | 2 +-
> test/sql/gh-2929-primary-key.test.lua | 2 +-
> test/sql/gh-2981-check-autoinc.result | 2 +-
> test/sql/gh-2981-check-autoinc.test.lua | 2 +-
> test/sql/gh-3199-no-mem-leaks.result | 2 +-
> test/sql/gh-3199-no-mem-leaks.test.lua | 2 +-
> test/sql/gh-3613-idx-alter-update-2.result | 2 +-
> test/sql/gh-3613-idx-alter-update-2.test.lua | 2 +-
> test/sql/gh-3613-idx-alter-update.result | 2 +-
> test/sql/gh-3613-idx-alter-update.test.lua | 2 +-
> test/sql/gh-3888-values-blob-assert.result | 2 +-
> test/sql/gh-3888-values-blob-assert.test.lua | 2 +-
> test/sql/gh2141-delete-trigger-drop-table.result | 2 +-
> test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 +-
> test/sql/gh2251-multiple-update.result | 2 +-
> test/sql/gh2251-multiple-update.test.lua | 2 +-
> test/sql/gh2483-remote-persistency-check.result | 2 +-
> test/sql/gh2483-remote-persistency-check.test.lua | 2 +-
> .../gh2808-inline-unique-persistency-check.result | 2 +-
> ...gh2808-inline-unique-persistency-check.test.lua | 2 +-
> test/sql/icu-upper-lower.result | 2 +-
> test/sql/icu-upper-lower.test.lua | 2 +-
> test/sql/insert-unique.result | 4 +-
> test/sql/insert-unique.test.lua | 4 +-
> test/sql/integer-overflow.result | 2 +-
> test/sql/integer-overflow.test.lua | 2 +-
> test/sql/iproto.result | 2 +-
> test/sql/iproto.test.lua | 2 +-
> test/sql/max-on-index.result | 4 +-
> test/sql/max-on-index.test.lua | 4 +-
> test/sql/message-func-indexes.result | 2 +-
> test/sql/message-func-indexes.test.lua | 2 +-
> test/sql/misc.result | 2 +-
> test/sql/misc.test.lua | 2 +-
> test/sql/no-pk-space.result | 2 +-
> test/sql/no-pk-space.test.lua | 2 +-
> test/sql/on-conflict.result | 2 +-
> test/sql/on-conflict.test.lua | 2 +-
> test/sql/persistency.result | 2 +-
> test/sql/persistency.test.lua | 2 +-
> test/sql/row-count.result | 10 +-
> test/sql/row-count.test.lua | 4 +-
> test/sql/savepoints.result | 2 +-
> test/sql/savepoints.test.lua | 2 +-
> test/sql/select-null.result | 4 +-
> test/sql/select-null.test.lua | 4 +-
> test/sql/sql-debug.result | 142 ++++++++++----
> test/sql/sql-debug.test.lua | 33 ++--
> test/sql/sql-statN-index-drop.result | 2 +-
> test/sql/sql-statN-index-drop.test.lua | 2 +-
> test/sql/tokenizer.result | 2 +-
> test/sql/tokenizer.test.lua | 2 +-
> test/sql/transition.result | 2 +-
> test/sql/transition.test.lua | 2 +-
> test/sql/transitive-transactions.result | 8 +-
> test/sql/transitive-transactions.test.lua | 8 +-
> test/sql/triggers.result | 14 +-
> test/sql/triggers.test.lua | 14 +-
> test/sql/update-with-nested-select.result | 4 +-
> test/sql/update-with-nested-select.test.lua | 4 +-
> test/sql/upgrade.result | 2 +-
> test/sql/upgrade.test.lua | 2 +-
> test/sql/view.result | 2 +-
> test/sql/view.test.lua | 2 +-
> test/sql/view_delayed_wal.result | 2 +-
> test/sql/view_delayed_wal.test.lua | 2 +-
> test/sql/vinyl-opts.result | 2 +-
> test/sql/vinyl-opts.test.lua | 2 +-
> 114 files changed, 531 insertions(+), 758 deletions(-)
>
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index ce87b88..210d392 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -3275,6 +3275,12 @@ enum {
> SQL_SESSION_OPTION_max,
> };
>
> +/** Identifiers of all SQL global options that can be set. */
> +enum {
> + SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT = 0,
> + SQL_GLOBAL_OPTION_max,
> +};
> +
> /**
> * A local structure that allows to establish a connection between
> * the name of the parameter, its field type and mask, if it have
> @@ -3329,6 +3335,15 @@ static struct sql_option_metadata sql_session_opts[] = {
> #endif
> };
>
> +/**
> + * Variable that contains names of the SQL global options, their
> + * field types and mask if they have one or 0 if don't have.
> + */
> +static struct sql_option_metadata sql_global_opts[] = {
> + /** SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT */
> + {"sql_compound_select_limit", FIELD_TYPE_INTEGER, 0},
> +};
> +
> uint32_t
> sql_session_opt_id_max()
> {
> @@ -3382,3 +3397,108 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
> *result = tuple;
> return 0;
> }
> +
> +int
> +sql_set_boolean_option(int id, enum sql_setting_type type, bool value)
> +{
> + assert(type == SQL_SESSION_SETTING);
> + (void)type;
> + struct session *session = current_session();
> + struct sql_option_metadata *option = &sql_session_opts[id];
> + assert(option->field_type == FIELD_TYPE_BOOLEAN);
> + if (value)
> + session->sql_flags |= option->mask;
> + else
> + session->sql_flags &= ~option->mask;
> +#ifndef NDEBUG
> + if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
> + if (value)
> + sqlParserTrace(stdout, "parser: ");
> + else
> + sqlParserTrace(NULL, NULL);
> + }
> +#endif
> + return 0;
> +}
> +
> +int
> +sql_set_string_option(int id, enum sql_setting_type type, const char *value)
> +{
> + assert(type == SQL_SESSION_SETTING);
> + (void)type;
> + assert(sql_session_opts[id].field_type = FIELD_TYPE_STRING);
> + assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
> + (void)id;
> + enum sql_storage_engine engine = STR2ENUM(sql_storage_engine, value);
> + if (engine == sql_storage_engine_MAX) {
> + diag_set(ClientError, ER_NO_SUCH_ENGINE, value);
> + return -1;
> + }
> + current_session()->sql_default_engine = engine;
> + return 0;
> +}
> +
> +int
> +sql_set_integer_option(int id, enum sql_setting_type type, int value)
> +{
> + assert(type == SQL_GLOBAL_SETTING);
> + (void)type;
> + assert(sql_global_opts[id].field_type = FIELD_TYPE_INTEGER);
> + assert(id == SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT);
> + (void)id;
> + int rc = sql_limit(sql_get(), SQL_LIMIT_COMPOUND_SELECT, value);
> + assert(rc >= 0);
> + return rc < 0 ? -1 : 0;
> +}
> +
> +void
> +sql_set_settings(struct Parse *parse_context, struct Token *name,
> + struct Expr *value)
> +{
> + int opt_id;
> + struct Vdbe *vdbe = sqlGetVdbe(parse_context);
> + char *name_str = sql_name_from_token(sql_get(), name);
> + if (name_str == NULL) {
> + parse_context->is_aborted = true;
> + return;
> + }
> + int value_reg = ++parse_context->nMem;
> + sqlExprCode(parse_context, value, value_reg);
> + /* Try to find the option among the session options. */
> + for (opt_id = 0; opt_id < SQL_SESSION_OPTION_max; ++opt_id) {
> + if (strcasecmp(sql_session_opts[opt_id].name, name_str) == 0) {
> + struct sql_option_metadata *opt =
> + &sql_session_opts[opt_id];
> + if (value->type != opt->field_type) {
> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> + field_type_strs[opt->field_type],
> + field_type_strs[value->type]);
> + parse_context->is_aborted = true;
> + return;
> + }
> + sqlVdbeAddOp3(vdbe, OP_Set, SQL_SESSION_SETTING, opt_id,
> + value_reg);
> + return;
> + }
> + }
> + /* Try to find the option among the global options. */
> + for (opt_id = 0; opt_id < SQL_GLOBAL_OPTION_max; ++opt_id) {
> + if (strcasecmp(sql_global_opts[opt_id].name, name_str) == 0) {
> + struct sql_option_metadata *opt =
> + &sql_global_opts[opt_id];
> + if (value->type != opt->field_type) {
> + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> + field_type_strs[opt->field_type],
> + field_type_strs[value->type]);
> + parse_context->is_aborted = true;
> + return;
> + }
> + sqlVdbeAddOp3(vdbe, OP_Set, SQL_GLOBAL_SETTING, opt_id,
> + value_reg);
> + return;
> + }
> + }
> + diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Setting is not found");
> + parse_context->is_aborted = true;
> + return;
> +}
> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> index 1d0c95f..9f8118e 100644
> --- a/src/box/sql/parse.y
> +++ b/src/box/sql/parse.y
> @@ -1539,6 +1539,11 @@ cmd ::= DROP INDEX ifexists(E) nm(X) ON fullname(Y). {
> sql_drop_index(pParse);
> }
>
> +///////////////////////////// The SET command ////////////////////////////////
> +cmd ::= SET nm(X) EQ term(Y). {
> + sql_set_settings(pParse,&X,Y.pExpr);
> +}
> +
> ///////////////////////////// The PRAGMA command /////////////////////////////
> //
> cmd ::= PRAGMA nm(X). {
> @@ -1559,9 +1564,6 @@ cmd ::= PRAGMA nm(X) LP minus_num(Y) RP. {
> cmd ::= PRAGMA nm(X) LP nm(Z) DOT nm(Y) RP. {
> sqlPragma(pParse,&X,&Y,&Z,0);
> }
> -cmd ::= PRAGMA . {
> - sqlPragma(pParse, 0,0,0,0);
> -}
>
> nmnum(A) ::= plus_num(A).
> nmnum(A) ::= STRING(A).
> diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
> index 92bcf4e..0eaa2ca 100644
> --- a/src/box/sql/pragma.c
> +++ b/src/box/sql/pragma.c
> @@ -62,56 +62,6 @@
> #include "pragma.h"
> #include "tarantoolInt.h"
>
> -/*
> - * Interpret the given string as a safety level. Return 0 for OFF,
> - * 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
> - * unrecognized string argument. The FULL and EXTRA option is disallowed
> - * if the omitFull parameter it 1.
> - *
> - * Note that the values returned are one less that the values that
> - * should be passed into sqlBtreeSetSafetyLevel(). The is done
> - * to support legacy SQL code. The safety level used to be boolean
> - * and older scripts may have used numbers 0 for OFF and 1 for ON.
> - */
> -static u8
> -getSafetyLevel(const char *z, int omitFull, u8 dflt)
> -{
> - /* 123456789 123456789 123 */
> - static const char zText[] = "onoffalseyestruextrafull";
> - static const u8 iOffset[] = { 0, 1, 2, 4, 9, 12, 15, 20 };
> - static const u8 iLength[] = { 2, 2, 3, 5, 3, 4, 5, 4 };
> - static const u8 iValue[] = { 1, 0, 0, 0, 1, 1, 3, 2 };
> - /* on no off false yes true extra full */
> - int i, n;
> - if (sqlIsdigit(*z)) {
> - return (u8) sqlAtoi(z);
> - }
> - n = sqlStrlen30(z);
> - for (i = 0; i < ArraySize(iLength); i++) {
> - if (iLength[i] == n
> - && sqlStrNICmp(&zText[iOffset[i]], z, n) == 0
> - && (!omitFull || iValue[i] <= 1)
> - ) {
> - return iValue[i];
> - }
> - }
> - return dflt;
> -}
> -
> -/*
> - * Interpret the given string as a boolean value.
> - */
> -u8
> -sqlGetBoolean(const char *z, u8 dflt)
> -{
> - return getSafetyLevel(z, 1, dflt) != 0;
> -}
> -
> -/* The sqlGetBoolean() function is used by other modules but the
> - * remainder of this file is specific to PRAGMA processing. So omit
> - * the rest of the file if PRAGMAs are omitted from the build.
> - */
> -
> /** Set result column names and types for a pragma. */
> static void
> vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> @@ -128,17 +78,6 @@ vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> }
>
> /*
> - * Generate code to return a single integer value.
> - */
> -static void
> -returnSingleInt(Vdbe * v, i64 value)
> -{
> - sqlVdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8 *)&value,
> - value < 0 ? P4_INT64 : P4_UINT64);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> -}
> -
> -/*
> * Locate a pragma in the aPragmaName[] array.
> */
> static const PragmaName *
> @@ -161,53 +100,6 @@ pragmaLocate(const char *zName)
> return lwr > upr ? 0 : &aPragmaName[mid];
> }
>
> -static void
> -vdbe_emit_pragma_status(struct Parse *parse)
> -{
> - struct Vdbe *v = sqlGetVdbe(parse);
> - struct session *user_session = current_session();
> -
> - sqlVdbeSetNumCols(v, 2);
> - sqlVdbeSetColName(v, 0, COLNAME_NAME, "pragma_name", SQL_STATIC);
> - sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "text", SQL_STATIC);
> - sqlVdbeSetColName(v, 1, COLNAME_NAME, "pragma_value", SQL_STATIC);
> - sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "integer", SQL_STATIC);
> -
> - parse->nMem = 2;
> - for (int i = 0; i < ArraySize(aPragmaName); ++i) {
> - if (aPragmaName[i].ePragTyp != PragTyp_FLAG)
> - continue;
> - sqlVdbeAddOp4(v, OP_String8, 0, 1, 0, aPragmaName[i].zName, 0);
> - int val = (user_session->sql_flags & aPragmaName[i].iArg) != 0;
> - sqlVdbeAddOp2(v, OP_Integer, val, 2);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
> - }
> -}
> -
> -/**
> - * Set tarantool backend default engine for SQL interface.
> - * @param engine_name to set default.
> - * @retval -1 on error.
> - * @retval 0 on success.
> - */
> -static int
> -sql_default_engine_set(const char *engine_name)
> -{
> - if (engine_name == NULL) {
> - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> - "'sql_default_engine' was not specified");
> - return -1;
> - }
> - enum sql_storage_engine engine =
> - STR2ENUM(sql_storage_engine, engine_name);
> - if (engine == sql_storage_engine_MAX) {
> - diag_set(ClientError, ER_NO_SUCH_ENGINE, engine_name);
> - return -1;
> - }
> - current_session()->sql_default_engine = engine;
> - return 0;
> -}
> -
> /**
> * This function handles PRAGMA TABLE_INFO(<table>).
> *
> @@ -373,22 +265,6 @@ sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
> }
>
> /*
> - * @brief Check whether the specified token is a string or ID.
> - * @param token - token to be examined
> - * @return true - if the token value is enclosed into quotes (')
> - * @return false in other cases
> - * The empty value is considered to be a string.
> - */
> -static bool
> -token_is_string(const struct Token* token)
> -{
> - if (!token || token->n == 0)
> - return true;
> - return token->n >= 2 && token->z[0] == '\'' &&
> - token->z[token->n - 1] == '\'';
> -}
> -
> -/*
> * Process a pragma statement.
> *
> * Pragmas are of this form:
> @@ -416,17 +292,12 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> sql *db = pParse->db; /* The database connection */
> Vdbe *v = sqlGetVdbe(pParse); /* Prepared statement */
> const PragmaName *pPragma; /* The pragma */
> - struct session *user_session = current_session();
>
> if (v == 0)
> return;
> sqlVdbeRunOnlyOnce(v);
> pParse->nMem = 2;
>
> - if (pId == NULL) {
> - vdbe_emit_pragma_status(pParse);
> - return;
> - }
> zLeft = sql_name_from_token(db, pId);
> if (zLeft == NULL) {
> pParse->is_aborted = true;
> @@ -456,38 +327,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> goto pragma_out;
> }
> /* Register the result column names for pragmas that return results */
> - if ((pPragma->mPragFlg & PragFlg_NoColumns) == 0 &&
> - ((pPragma->mPragFlg & PragFlg_NoColumns1) == 0 || zRight == NULL))
> - vdbe_set_pragma_result_columns(v, pPragma);
> + vdbe_set_pragma_result_columns(v, pPragma);
> /* Jump to the appropriate pragma handler */
> switch (pPragma->ePragTyp) {
>
> - case PragTyp_FLAG:{
> - if (zRight == NULL) {
> - vdbe_set_pragma_result_columns(v, pPragma);
> - returnSingleInt(v, (user_session->sql_flags &
> - pPragma->iArg) != 0);
> - } else {
> - /* Mask of bits to set or clear. */
> - int mask = pPragma->iArg;
> - bool is_pragma_set = sqlGetBoolean(zRight, 0);
> -
> - if (is_pragma_set)
> - user_session->sql_flags |= mask;
> - else
> - user_session->sql_flags &= ~mask;
> -#if defined(SQL_DEBUG)
> - if (mask == PARSER_TRACE_FLAG) {
> - if (is_pragma_set)
> - sqlParserTrace(stdout, "parser: ");
> - else
> - sqlParserTrace(0, 0);
> - }
> -#endif
> - }
> - break;
> - }
> -
> case PragTyp_TABLE_INFO:
> sql_pragma_table_info(pParse, zRight);
> break;
> @@ -565,54 +408,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> break;
> }
>
> - case PragTyp_DEFAULT_ENGINE: {
> - if (!token_is_string(pValue)) {
> - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> - "string value is expected");
> - pParse->is_aborted = true;
> - goto pragma_out;
> - }
> - if (zRight == NULL) {
> - const char *engine_name =
> - sql_storage_engine_strs[current_session()->
> - sql_default_engine];
> - sqlVdbeLoadString(v, 1, engine_name);
> - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> - } else {
> - if (sql_default_engine_set(zRight) != 0) {
> - pParse->is_aborted = true;
> - goto pragma_out;
> - }
> - sqlVdbeAddOp0(v, OP_Expire);
> - }
> - break;
> - }
> -
> - case PragTyp_COMPOUND_SELECT_LIMIT: {
> - if (zRight != NULL) {
> - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT,
> - sqlAtoi(zRight));
> - }
> - int retval =
> - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT, -1);
> - returnSingleInt(v, retval);
> - break;
> - }
> -
> default:
> unreachable();
> } /* End of the PRAGMA switch */
>
> - /* The following block is a no-op unless SQL_DEBUG is
> - * defined. Its only * purpose is to execute assert()
> - * statements to verify that if the * PragFlg_NoColumns1 flag
> - * is set and the caller specified an argument * to the PRAGMA,
> - * the implementation has not added any OP_ResultRow *
> - * instructions to the VM.
> - */
> - if ((pPragma->mPragFlg & PragFlg_NoColumns1) && zRight) {
> - sqlVdbeVerifyNoResultRow(v);
> - }
> pragma_out:
> sqlDbFree(db, zLeft);
> sqlDbFree(db, zRight);
> diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
> index f337f0b..6c66d97 100644
> --- a/src/box/sql/pragma.h
> +++ b/src/box/sql/pragma.h
> @@ -6,19 +6,14 @@
>
> /* The various pragma types */
> #define PragTyp_COLLATION_LIST 3
> -#define PragTyp_FLAG 5
> #define PragTyp_FOREIGN_KEY_LIST 9
> #define PragTyp_INDEX_INFO 10
> #define PragTyp_INDEX_LIST 11
> #define PragTyp_STATS 15
> #define PragTyp_TABLE_INFO 17
> -#define PragTyp_DEFAULT_ENGINE 25
> -#define PragTyp_COMPOUND_SELECT_LIMIT 26
>
> /* Property flags associated with various pragma. */
> #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
> -#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
> -#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
> #define PragFlg_Result0 0x10 /* Acts as query when no argument */
> #define PragFlg_Result1 0x20 /* Acts as query when has one argument */
> #define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
> @@ -93,51 +88,6 @@ static const char *const pragCName[] = {
> /* 55 */ "text",
> /* 56 */ "match",
> /* 57 */ "text",
> - /* Used by: defer_foreign_keys */
> - /* 58 */ "defer_foreign_keys",
> - /* 59 */ "integer",
> - /* Used by: full_column_names */
> - /* 60 */ "full_column_names",
> - /* 61 */ "integer",
> - /* Used by: parser_trace */
> - /* 62 */ "parser_trace",
> - /* 63 */ "integer",
> - /* Used by: recursive_triggers */
> - /* 64 */ "recursive_triggers",
> - /* 65 */ "integer",
> - /* Used by: reverse_unordered_selects */
> - /* 66 */ "reverse_unordered_selects",
> - /* 67 */ "integer",
> - /* Used by: select_trace */
> - /* 68 */ "select_trace",
> - /* 69 */ "integer",
> - /* Used by: sql_compound_select_limit */
> - /* 70 */ "sql_compound_select_limit",
> - /* 71 */ "integer",
> - /* Used by: sql_default_engine */
> - /* 72 */ "sql_default_engine",
> - /* 73 */ "text",
> - /* Used by: sql_trace */
> - /* 74 */ "sql_trace",
> - /* 75 */ "integer",
> - /* Used by: vdbe_addoptrace */
> - /* 76 */ "vdbe_addoptrace",
> - /* 77 */ "integer",
> - /* Used by: vdbe_debug */
> - /* 78 */ "vdbe_debug",
> - /* 79 */ "integer",
> - /* Used by: vdbe_eqp */
> - /* 80 */ "vdbe_eqp",
> - /* 81 */ "integer",
> - /* Used by: vdbe_listing */
> - /* 82 */ "vdbe_listing",
> - /* 83 */ "integer",
> - /* Used by: vdbe_trace */
> - /* 84 */ "vdbe_trace",
> - /* 85 */ "integer",
> - /* Used by: where_trace */
> - /* 86 */ "where_trace",
> - /* 87 */ "integer",
> };
>
> /* Definitions of all built-in pragmas */
> @@ -159,22 +109,12 @@ static const PragmaName aPragmaName[] = {
> /* ePragFlg: */ PragFlg_Result0,
> /* ColNames: */ 38, 2,
> /* iArg: */ 0},
> - { /* zName: */ "defer_foreign_keys",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 58, 1,
> - /* iArg: */ SQL_DeferFKs},
> { /* zName: */ "foreign_key_list",
> /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
> /* ePragFlg: */
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 42, 8,
> /* iArg: */ 0},
> - { /* zName: */ "full_column_names",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 60, 1,
> - /* iArg: */ SQL_FullColNames},
> { /* zName: */ "index_info",
> /* ePragTyp: */ PragTyp_INDEX_INFO,
> /* ePragFlg: */
> @@ -187,47 +127,6 @@ static const PragmaName aPragmaName[] = {
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 32, 3,
> /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "parser_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 62, 1,
> - /* iArg: */ PARSER_TRACE_FLAG},
> -#endif
> - { /* zName: */ "recursive_triggers",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 64, 1,
> - /* iArg: */ SQL_RecTriggers},
> - { /* zName: */ "reverse_unordered_selects",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 66, 1,
> - /* iArg: */ SQL_ReverseOrder},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "select_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 68, 1,
> - /* iArg: */ SQL_SelectTrace},
> -#endif
> - { /* zName: */ "sql_compound_select_limit",
> - /* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
> - /* ePragFlg: */ PragFlg_Result0,
> - /* ColNames: */ 70, 1,
> - /* iArg: */ 0},
> - { /* zName: */ "sql_default_engine",
> - /* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 72, 1,
> - /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "sql_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 74, 1,
> - /* iArg: */ SQL_SqlTrace},
> -#endif
> { /* zName: */ "stats",
> /* ePragTyp: */ PragTyp_STATS,
> /* ePragFlg: */
> @@ -240,38 +139,5 @@ static const PragmaName aPragmaName[] = {
> PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> /* ColNames: */ 0, 6,
> /* iArg: */ 0},
> -#if defined(SQL_DEBUG)
> - { /* zName: */ "vdbe_addoptrace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 76, 1,
> - /* iArg: */ SQL_VdbeAddopTrace},
> - { /* zName: */ "vdbe_debug",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 78, 1,
> - /* iArg: */
> - SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
> - { /* zName: */ "vdbe_eqp",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 80, 1,
> - /* iArg: */ SQL_VdbeEQP},
> - { /* zName: */ "vdbe_listing",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 82, 1,
> - /* iArg: */ SQL_VdbeListing},
> - { /* zName: */ "vdbe_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 84, 1,
> - /* iArg: */ SQL_VdbeTrace},
> - { /* zName: */ "where_trace",
> - /* ePragTyp: */ PragTyp_FLAG,
> - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> - /* ColNames: */ 86, 1,
> - /* iArg: */ SQL_WhereTrace},
> -#endif
> };
> /* Number of pragmas: 36 on by default, 47 total. */
> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> index 27a4c41..927c674 100644
> --- a/src/box/sql/sqlInt.h
> +++ b/src/box/sql/sqlInt.h
> @@ -333,6 +333,11 @@ enum sql_ret_code {
> SQL_DONE = 2,
> };
>
> +enum sql_setting_type {
> + SQL_SESSION_SETTING = 0,
> + SQL_GLOBAL_SETTING = 1,
> +};
> +
> void *
> sql_malloc(int);
>
> @@ -3946,8 +3951,6 @@ int
> sql_rem_int(int64_t lhs, bool is_lhs_neg, int64_t rhs, bool is_rhs_neg,
> int64_t *res, bool *is_res_neg);
>
> -u8 sqlGetBoolean(const char *z, u8);
> -
> const void *sqlValueText(sql_value *);
> int sqlValueBytes(sql_value *);
> void sqlValueSetStr(sql_value *, int, const void *,
> @@ -4463,4 +4466,54 @@ int
> sql_fieldno_by_name(struct Parse *parse_context, struct Expr *field_name,
> uint32_t *fieldno);
>
> +/**
> + * Create VDBE instructions to set new value of SQL setting.
> + *
> + * @param parse_context Parsing context.
> + * @param name Name of the SQL setting.
> + * @param value New value of the SQL setting.
> + */
> +void
> +sql_set_settings(struct Parse *parse_context, struct Token *name,
> + struct Expr *value);
> +
> +/**
> + * Set a new value for boolean SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_boolean_option(int id, enum sql_setting_type type, bool value);
> +
> +/**
> + * Set a new value for string SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_string_option(int id, enum sql_setting_type type, const char *value);
> +
> +/**
> + * Set a new value for integer SQL setting.
> + *
> + * @param id ID of the SQL setting.
> + * @param type type of the SQL setting.
> + * @param value New value of the SQL setting.
> + *
> + * @retval 0 on success.
> + * @retval -1 on error.
> + */
> +int
> +sql_set_integer_option(int id, enum sql_setting_type type, int value);
> +
> #endif /* sqlINT_H */
> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 2e51a0d..788696f 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -5254,6 +5254,31 @@ case OP_IncMaxid: {
> break;
> }
>
> +/* Opcode: Set P1 P2 P3 * *
> + *
> + * Set new value to SQL setting. P1 is either SQL_SESSION_SETTING
> + * or SQL_GLOBAL_SETTING. P2 is ID of the setting. P3 is an ID of
> + * register that contains value of the setting.
> + */
> +case OP_Set: {
> + assert(pOp->p1 == SQL_SESSION_SETTING || pOp->p1 == SQL_GLOBAL_SETTING);
> + pIn3 = &aMem[pOp->p3];
> +
> + if ((pIn3->flags & MEM_Bool) != 0) {
> + if (sql_set_boolean_option(pOp->p2, pOp->p1, pIn3->u.b) != 0)
> + goto abort_due_to_error;
> + } else if ((pIn3->flags & MEM_Str) != 0) {
> + if (sql_set_string_option(pOp->p2, pOp->p1, pIn3->z) != 0)
> + goto abort_due_to_error;
> + } else {
> + assert((pIn3->flags & MEM_Int) != 0 ||
> + (pIn3->flags & MEM_UInt) != 0);
> + if (sql_set_integer_option(pOp->p2, pOp->p1, pIn3->u.i) != 0)
> + goto abort_due_to_error;
> + }
> + break;
> +}
> +
> /* Opcode: Noop * * * * *
> *
> * Do nothing. This instruction is often useful as a jump
> diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
> index 7d7498f..cc530ce 100755
> --- a/test/sql-tap/analyze4.test.lua
> +++ b/test/sql-tap/analyze4.test.lua
> @@ -70,9 +70,9 @@ test:do_test(
> function()
> return test:execsql([[
> UPDATE t1 SET b='x' WHERE a%2;
> --- pragma vdbe_debug=1;
> +-- set vdbe_debug=true;
> ANALYZE;
> --- pragma vdbe_debug=0;
> +-- set vdbe_debug=false;
> SELECT "idx", "stat" FROM "_sql_stat1" WHERE "tbl"='T1' ORDER BY "idx";
> ]])
> end, {
> diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
> index 39e4796..7b36379 100755
> --- a/test/sql-tap/autoinc.test.lua
> +++ b/test/sql-tap/autoinc.test.lua
> @@ -640,7 +640,7 @@ test:do_test(
> -- </autoinc-10.3>
> })
>
> -test:catchsql(" pragma recursive_triggers = off ")
> +test:catchsql("SET sql_recursive_triggers = false")
> -- Ticket #3928. Make sure that triggers to not make extra slots in
> -- the sql_SEQUENCE table.
> --
> diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
> index de03d7c..1037bed 100755
> --- a/test/sql-tap/colname.test.lua
> +++ b/test/sql-tap/colname.test.lua
> @@ -43,14 +43,14 @@ local function lreplace(arr, pos, len, val)
> end
>
> test:do_test(
> - "colname-1.1",
> + "colname-1.2",
> function()
> - return test:execsql "PRAGMA full_column_names"
> - end, {
> + return box.space._vsession_settings:get("sql_full_column_names").value
> + end,
> -- <colname-1.2>
> - 0
> + false
> -- </colname-1.2>
> - })
> + )
>
> -- Tests for then short=ON and full=any
> --
> @@ -163,7 +163,7 @@ test:do_test(
> "colname-3.1",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
> FROM tabc, txyz ORDER BY 1 LIMIT 1;
> CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> @@ -283,7 +283,7 @@ test:do_test(
> "colname-4.1",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
> FROM tabc, txyz ORDER BY 1 LIMIT 1;
> CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> @@ -440,7 +440,7 @@ test:do_test(
> -- instead of reconnect to database
> -- we are just turning settings to default state
> test:execsql([[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]])
> test:execsql [=[
> CREATE TABLE t6(a INT primary key, "'a'" INT, """a""" INT, "[a]" INT, "`a`" INT);
> diff --git a/test/sql-tap/fkey2.test.lua b/test/sql-tap/fkey2.test.lua
> index 264616d..de89790 100755
> --- a/test/sql-tap/fkey2.test.lua
> +++ b/test/sql-tap/fkey2.test.lua
> @@ -450,7 +450,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "fkey2-4.2",
> [[
> - PRAGMA recursive_triggers = off;
> + SET sql_recursive_triggers = false;
> DELETE FROM t1 WHERE node = 1;
> SELECT node FROM t1;
> ]], {
> @@ -473,7 +473,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "fkey2-4.4",
> [[
> - PRAGMA recursive_triggers = on;
> + SET sql_recursive_triggers = true;
> DROP TABLE t2;
> DROP TABLE t1;
> CREATE TABLE t1(
> diff --git a/test/sql-tap/gh2548-select-compound-limit.test.lua b/test/sql-tap/gh2548-select-compound-limit.test.lua
> index f578870..c802003 100755
> --- a/test/sql-tap/gh2548-select-compound-limit.test.lua
> +++ b/test/sql-tap/gh2548-select-compound-limit.test.lua
> @@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
> -test:plan(14)
> +test:plan(13)
>
> -- box.cfg{wal_mode='none'}
>
> @@ -53,7 +53,6 @@ for _, term in ipairs({'UNION', 'UNION ALL', 'INTERSECT', 'EXCEPT'}) do
> -- end
> end
>
> -
> test:do_catchsql_test(
> "gh2548-select-compound-limit-2",
> select_string_last, {
> @@ -63,20 +62,10 @@ test:do_catchsql_test(
> })
>
> test:do_execsql_test(
> - "gh2548-select-compound-limit-3.1", [[
> - pragma sql_compound_select_limit
> - ]], {
> - -- <gh2548-select-compound-limit-3.1>
> - 30
> - -- </gh2548-select-compound-limit-3.1>
> - })
> -
> -test:do_execsql_test(
> "gh2548-select-compound-limit-3.2", [[
> - pragma sql_compound_select_limit=31
> + SET sql_compound_select_limit = 31;
> ]], {
> -- <gh2548-select-compound-limit-3.2>
> - 31
> -- </gh2548-select-compound-limit-3.2>
> })
>
> @@ -90,10 +79,9 @@ test:do_execsql_test(
>
> test:do_execsql_test(
> "gh2548-select-compound-limit-3.4", [[
> - pragma sql_compound_select_limit=0
> + SET sql_compound_select_limit = 0;
> ]], {
> -- <gh2548-select-compound-limit-3.4>
> - 0
> -- </gh2548-select-compound-limit-3.4>
> })
>
> diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
> index 0f34114..c50e3fd 100644
> --- a/test/sql-tap/lua/sqltester.lua
> +++ b/test/sql-tap/lua/sqltester.lua
> @@ -413,7 +413,7 @@ box.cfg{
> }
>
> local engine = test_run and test_run:get_cfg('engine') or 'memtx'
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> function test.engine(self)
> return engine
> diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
> index b84093e..339c9d7 100755
> --- a/test/sql-tap/misc1.test.lua
> +++ b/test/sql-tap/misc1.test.lua
> @@ -219,7 +219,7 @@ test:do_test(
> local r = test:execsql([[
> CREATE TABLE t1(a TEXT primary KEY);
> INSERT INTO t1 VALUES('hi');
> - PRAGMA full_column_names=on;
> + SET sql_full_column_names = true;
> --SELECT rowid, * FROM t1;
> SELECT * FROM t1;
> ]])
> diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua
> index b3821dc..d6f8b54 100755
> --- a/test/sql-tap/pragma.test.lua
> +++ b/test/sql-tap/pragma.test.lua
> @@ -1,7 +1,7 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
>
> -test:plan(23)
> +test:plan(10)
>
> test:do_catchsql_test(
> "pragma-1.3",
> @@ -19,66 +19,7 @@ test:do_catchsql_test(
> [[
> pragma sql_default_engine='creepy';
> ]], {
> - 1, "Space engine 'creepy' does not exist"
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.2",
> - [[
> - pragma sql_default_engine='vinyl';
> - ]], {
> - 0
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.3",
> - [[
> - pragma sql_default_engine='memtx';
> - ]], {
> - 0
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.4",
> - [[
> - pragma sql_default_engine 'memtx';
> - ]], {
> - 1, "Syntax error near ''memtx''"
> -})
> -
> -test:do_catchsql_test(
> - "pragma-2.5",
> - [[
> - pragma sql_default_engine 1;
> - ]], {
> - 1, "Syntax error near '1'"
> -})
> -
> ---
> --- gh-3832: Some statements do not return column type
> ---
> --- Check that "PRAGMA sql_default_engine" called without arguments
> --- returns currently set sql_default_engine.
> -test:do_execsql_test(
> - "pragma-3.1",
> - [[
> - pragma sql_default_engine='vinyl';
> - pragma sql_default_engine;
> - ]], {
> - -- <pragma-3.1>
> - 'vinyl'
> - -- </pragma-3.1>
> -})
> -
> -test:do_execsql_test(
> - "pragma-3.2",
> - [[
> - pragma sql_default_engine='memtx';
> - pragma sql_default_engine;
> - ]], {
> - -- <pragma-3.2>
> - 'memtx'
> - -- </pragma-3.2>
> + 1, "Pragma 'SQL_DEFAULT_ENGINE' does not exist"
> })
>
> --
> @@ -187,76 +128,4 @@ test:do_execsql_test(
> -- </pragma-8.4>
> })
>
> ----
> ---- pragma sql_default_engine accepts string values and rejects IDs
> ----
> -test:do_catchsql_test(
> - "pragma-9.1",
> - [[
> - pragma sql_default_engine(the_engine);
> - ]], {
> - -- <pragma-9.1>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.1>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.2",
> - [[
> - pragma sql_default_engine(THE_ENGINE);
> - ]], {
> - -- <pragma-9.2>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.2>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.3",
> - [[
> - pragma sql_default_engine("THE_ENGINE");
> - ]], {
> - -- <pragma-9.3>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.3>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.4",
> - [[
> - pragma sql_default_engine('THE_ENGINE');
> - ]], {
> - -- <pragma-9.4>
> - 1, "Space engine 'THE_ENGINE' does not exist"
> - -- </pragma-9.4>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.5",
> - [[
> - pragma sql_default_engine(memtx);
> - ]], {
> - -- <pragma-9.5>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.5>
> -})
> -
> -test:do_catchsql_test(
> - "pragma-9.6",
> - [[
> - pragma sql_default_engine("memtx");
> - ]], {
> - -- <pragma-9.6>
> - 1, "Illegal parameters, string value is expected"
> - -- </pragma-9.6>
> -})
> -
> -test:do_execsql_test(
> - "pragma-9.7",
> - [[
> - pragma sql_default_engine('memtx');
> - ]], {
> - -- <pragma-9.7>
> - -- </pragma-9.7>
> -})
> -
> test:finish_test()
> diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
> index d8fe7a9..2caa612 100755
> --- a/test/sql-tap/select1.test.lua
> +++ b/test/sql-tap/select1.test.lua
> @@ -916,7 +916,7 @@ test:do_catchsql2_test(
> test:do_test(
> "select1-6.1.1",
> function()
> - test:execsql "PRAGMA full_column_names=on"
> + test:execsql "SET sql_full_column_names = true"
> return test:catchsql2 "SELECT f1 FROM test1 ORDER BY f2"
> end, {
> -- <select1-6.1.1>
> @@ -952,7 +952,7 @@ test:do_test(
> msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
> end)
> v = v == true and {0} or {1}
> - test:execsql "PRAGMA full_column_names=off"
> + test:execsql "SET sql_full_column_names = false"
> return table.insert(v,msg) or v
> end, {
> -- <select1-6.1.4>
> @@ -1043,13 +1043,13 @@ test:do_catchsql2_test(
> test:do_test(
> "select1-6.5.1",
> function()
> - test:execsql2 "PRAGMA full_column_names=on"
> + test:execsql2 "SET sql_full_column_names = true"
> local msg
> v = pcall( function ()
> msg = test:execsql2 "SELECT test1.f1+F2 FROM test1 ORDER BY f2"
> end)
> v = v == true and {0} or {1}
> - test:execsql2 "PRAGMA full_column_names=off"
> + test:execsql2 "SET sql_full_column_names = false"
> return table.insert(v,msg) or v
> end, {
> -- <select1-6.5.1>
> @@ -1124,7 +1124,7 @@ test:do_test(
> "select1-6.9.3",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> return test:execsql2 [[
> SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> @@ -1139,7 +1139,7 @@ test:do_test(
> "select1-6.9.4",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> @@ -1154,7 +1154,7 @@ test:do_test(
> "select1-6.9.5",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT 123.45;
> @@ -1235,7 +1235,7 @@ test:do_test(
> "select1-6.9.11",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
> @@ -1260,7 +1260,7 @@ test:do_test(
> "select1-6.9.13",
> function()
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> @@ -1285,7 +1285,7 @@ test:do_test(
> "select1-6.9.15",
> function()
> test:execsql [[
> - PRAGMA full_column_names='ON';
> + SET sql_full_column_names = true;
> ]]
> return test:execsql2 [[
> SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> @@ -1307,7 +1307,7 @@ test:do_execsql2_test(
> })
>
> test:execsql [[
> - PRAGMA full_column_names='OFF';
> + SET sql_full_column_names = false;
> ]]
> test:do_catchsql2_test(
> "select1-6.10",
> diff --git a/test/sql-tap/tkt3731.test.lua b/test/sql-tap/tkt3731.test.lua
> index 454cf67..57e7f3f 100755
> --- a/test/sql-tap/tkt3731.test.lua
> +++ b/test/sql-tap/tkt3731.test.lua
> @@ -22,7 +22,7 @@ test:plan(3)
> -- The tests in this file were written before sql supported recursive
> -- trigger invocation, and some tests depend on that to pass. So disable
> -- recursive triggers for this file.
> -test:catchsql " pragma recursive_triggers = off "
> +test:catchsql("SET sql_recursive_triggers = false")
> test:do_execsql_test(
> "tkt3731-1.1",
> [[
> diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
> index 6e60050..dbe54db 100755
> --- a/test/sql-tap/trigger2.test.lua
> +++ b/test/sql-tap/trigger2.test.lua
> @@ -58,7 +58,7 @@ test:plan(26)
> -- The tests in this file were written before sql supported recursive
> -- trigger invocation, and some tests depend on that to pass. So disable
> -- recursive triggers for this file.
> -test:catchsql " pragma recursive_triggers = off "
> +test:catchsql("SET sql_recursive_triggers = false")
> -- 1.
> ii = 0
> tbl_definitions = { "CREATE TABLE tbl (id INT PRIMARY KEY AUTOINCREMENT, a INTEGER UNIQUE, b INT );",
> diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
> index cf7dd7b..f9b7034 100755
> --- a/test/sql-tap/triggerC.test.lua
> +++ b/test/sql-tap/triggerC.test.lua
> @@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
> -test:plan(48)
> +test:plan(45)
>
> --!./tcltestrunner.lua
> -- 2009 August 24
> @@ -36,12 +36,9 @@ testprefix = "triggerC"
> -- REPLACE conflict resolution. And that they are not fired
> -- if recursive triggers are not enabled.
> --
> --- triggerC-6.*: Test that the recursive_triggers pragma returns correct
> --- results when invoked without an argument.
> ---
> -- Enable recursive triggers for this file.
> --
> -test:execsql " PRAGMA recursive_triggers = on "
> +test:execsql("SET sql_recursive_triggers = true;")
> ---------------------------------------------------------------------------
> -- This block of tests, triggerC-1.*, are not aimed at any specific
> -- property of the triggers sub-system. They were created to debug
> @@ -504,7 +501,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-5.3.0",
> [[
> - PRAGMA recursive_triggers = off
> + SET sql_recursive_triggers = false
> ]], {
> -- <triggerC-5.3.0>
>
> @@ -534,49 +531,13 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-5.3.8",
> [[
> - PRAGMA recursive_triggers = on
> + SET sql_recursive_triggers = true
> ]], {
> -- <triggerC-5.3.8>
>
> -- </triggerC-5.3.8>
> })
>
> ----------------------------------------------------------------------------
> --- This block of tests, triggerC-6.*, tests that "PRAGMA recursive_triggers"
> --- statements return the current value of the recursive triggers flag.
> ---
> -test:do_execsql_test(
> - "triggerC-6.1",
> - [[
> - PRAGMA recursive_triggers
> - ]], {
> - -- <triggerC-6.1>
> - 1
> - -- </triggerC-6.1>
> - })
> -
> -test:do_execsql_test(
> - "triggerC-6.2",
> - [[
> - PRAGMA recursive_triggers = off;
> - PRAGMA recursive_triggers;
> - ]], {
> - -- <triggerC-6.2>
> - 0
> - -- </triggerC-6.2>
> - })
> -
> -test:do_execsql_test(
> - "triggerC-6.3",
> - [[
> - PRAGMA recursive_triggers = on;
> - PRAGMA recursive_triggers;
> - ]], {
> - -- <triggerC-6.3>
> - 1
> - -- </triggerC-6.3>
> - })
> -
> -- MUST_WORK_TEST
> -- #-------------------------------------------------------------------------
> -- # Test some of the "undefined behaviour" associated with triggers. The
> @@ -890,7 +851,7 @@ test:execsql(
> test:do_execsql_test(
> "triggerC-13.1",
> [[
> - PRAGMA recursive_triggers = 'ON';
> + SET sql_recursive_triggers = true;
> CREATE TABLE t12(id INTEGER PRIMARY KEY, a INT, b INT);
> INSERT INTO t12 VALUES(1, 1, 2);
> CREATE TRIGGER tr12 AFTER UPDATE ON t12 FOR EACH ROW BEGIN
> @@ -974,7 +935,7 @@ test:do_execsql_test(
> test:do_execsql_test(
> "triggerC-15.1.1",
> [[
> - PRAGMA recursive_triggers = 1;
> + SET sql_recursive_triggers = true;
> CREATE TABLE node(
> id int not null primary key,
> pid int not null default 0,
> diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
> index ac0389a..992a3c7 100755
> --- a/test/sql-tap/update.test.lua
> +++ b/test/sql-tap/update.test.lua
> @@ -442,7 +442,6 @@ test:do_execsql_test("update-5.6.5", [[
>
> -- Repeat the previous sequence of tests with a different index.
> --
> ---test:execsql "PRAGMA synchronous='FULL'"
> test:do_test("update-6.0", function()
> test:execsql "DROP INDEX idx1 ON test1"
> test:execsql "CREATE INDEX idx1 ON test1(f2)"
> diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
> index b82575f..21675d5 100755
> --- a/test/sql-tap/whereA.test.lua
> +++ b/test/sql-tap/whereA.test.lua
> @@ -14,7 +14,7 @@ test:plan(17)
> --
> -------------------------------------------------------------------------
> -- This file implements regression tests for sql library. The
> --- focus of this file is testing the reverse_select_order pragma.
> +-- focus of this file is testing the reverse_select_order option.
> --
> -- $Id: whereA.test,v 1.3 2009/06/10 19:33:29 drh Exp $
> -- ["set","testdir",[["file","dirname",["argv0"]]]]
> @@ -39,7 +39,7 @@ test:do_test(
> "whereA-1.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1;
> ]]
> end, {
> @@ -55,7 +55,7 @@ test:do_test(
> --db close
> --sql db test.db
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1;
> ]]
> end, {
> @@ -68,7 +68,7 @@ test:do_test(
> -- db close
> -- sql db test.db
> -- db eval {
> --- PRAGMA reverse_unordered_selects=1;
> +-- SET sql_reverse_unordered_selects = true;
> -- SELECT * FROM t1 ORDER BY rowid;
> -- }
> -- } {1 2 3 2 hello world 3 4.53 {}}
> @@ -76,11 +76,11 @@ test:do_test(
> "whereA-1.6",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects;
> + SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_reverse_unordered_selects';
> ]]
> end, {
> -- <whereA-1.6>
> - 1
> + true
> -- </whereA-1.6>
> })
>
> @@ -108,7 +108,7 @@ test:do_test(
> "whereA-2.1",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=0;
> + SET sql_reverse_unordered_selects = false;
> SELECT * FROM t1 WHERE a>0;
> ]]
> end, {
> @@ -121,7 +121,7 @@ test:do_test(
> "whereA-2.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE a>0;
> ]]
> end, {
> @@ -132,7 +132,7 @@ test:do_test(
>
> -- do_test whereA-2.3 {
> -- db eval {
> --- PRAGMA reverse_unordered_selects=1;
> +-- SET sql_reverse_unordered_selects = true;
> -- SELECT * FROM t1 WHERE a>0 ORDER BY rowid;
> -- }
> -- } {1 2 3 2 hello world 3 4.53 {}}
> @@ -140,7 +140,7 @@ test:do_test(
> "whe:reA-3.1",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=0;
> + SET sql_reverse_unordered_selects = false;
> SELECT * FROM t1 WHERE b>0;
> ]]
> end, {
> @@ -153,7 +153,7 @@ test:do_test(
> "whereA-3.2",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE b>0;
> ]]
> end, {
> @@ -166,7 +166,7 @@ test:do_test(
> "whereA-3.3",
> function()
> return test:execsql [[
> - PRAGMA reverse_unordered_selects=1;
> + SET sql_reverse_unordered_selects = true;
> SELECT * FROM t1 WHERE b>0 ORDER BY b;
> ]]
> end, {
> diff --git a/test/sql/check-clear-ephemeral.result b/test/sql/check-clear-ephemeral.result
> index 7d0be5f..3b12457 100644
> --- a/test/sql/check-clear-ephemeral.result
> +++ b/test/sql/check-clear-ephemeral.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> ---
> diff --git a/test/sql/check-clear-ephemeral.test.lua b/test/sql/check-clear-ephemeral.test.lua
> index 929a6c9..2ecf11c 100644
> --- a/test/sql/check-clear-ephemeral.test.lua
> +++ b/test/sql/check-clear-ephemeral.test.lua
> @@ -1,13 +1,13 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> -- box.cfg()
>
> -- create space
> box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> diff --git a/test/sql/checks.result b/test/sql/checks.result
> index a952b2b..f9a6772 100644
> --- a/test/sql/checks.result
> +++ b/test/sql/checks.result
> @@ -11,7 +11,7 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -736,7 +736,7 @@ physics_ck:drop()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
> index 4d33823..ffcbd26 100644
> --- a/test/sql/checks.test.lua
> +++ b/test/sql/checks.test.lua
> @@ -2,7 +2,7 @@ env = require('test_run')
> test_run = env.new()
> test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> --
> -- gh-3272: Move SQL CHECK into server
> @@ -240,7 +240,7 @@ physics_ck:drop()
> -- :enable configurator.
> --
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE test(a INT PRIMARY KEY);");
> box.execute('ALTER TABLE test ADD CONSTRAINT CK CHECK(a < 5);')
> box.space.TEST:insert({10})
> diff --git a/test/sql/clear.result b/test/sql/clear.result
> index afa6520..baeb15e 100644
> --- a/test/sql/clear.result
> +++ b/test/sql/clear.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON;")
> +-- box.execute("SET vdbe_debug=ON;")
> -- Seed entry
> for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> ---
> diff --git a/test/sql/clear.test.lua b/test/sql/clear.test.lua
> index 4c58767..8d5e8fb 100644
> --- a/test/sql/clear.test.lua
> +++ b/test/sql/clear.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON;")
> +-- box.execute("SET vdbe_debug=ON;")
>
> -- Seed entry
> for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> diff --git a/test/sql/collation.result b/test/sql/collation.result
> index 11962ef..dc11d28 100644
> --- a/test/sql/collation.result
> +++ b/test/sql/collation.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
> index 1be28b3..5e33562 100644
> --- a/test/sql/collation.test.lua
> +++ b/test/sql/collation.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- gh-3010: COLLATE after LIMIT should throw an error
>
> diff --git a/test/sql/ddl.result b/test/sql/ddl.result
> index 28acf37..af833d0 100644
> --- a/test/sql/ddl.result
> +++ b/test/sql/ddl.result
> @@ -8,7 +8,7 @@ json = require('json')
> engine = test_run:get_cfg('engine')
> | ---
> | ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> | ---
> | - row_count: 0
> | ...
> diff --git a/test/sql/ddl.test.lua b/test/sql/ddl.test.lua
> index 6067b61..b6f0c81 100644
> --- a/test/sql/ddl.test.lua
> +++ b/test/sql/ddl.test.lua
> @@ -1,7 +1,7 @@
> test_run = require('test_run').new()
> json = require('json')
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> --
> -- gh-4086: SQL transactional DDL.
> diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
> index ca58feb..3d58daf 100644
> --- a/test/sql/delete-multiple-idx.result
> +++ b/test/sql/delete-multiple-idx.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
> - row_count: 1
> ...
> -- Debug.
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries.
> box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> ---
> diff --git a/test/sql/delete-multiple-idx.test.lua b/test/sql/delete-multiple-idx.test.lua
> index a81cccc..2715d2f 100644
> --- a/test/sql/delete-multiple-idx.test.lua
> +++ b/test/sql/delete-multiple-idx.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE t3(id INT primary key,x INT,y INT);");
> box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
>
> -- Debug.
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries.
> box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> diff --git a/test/sql/delete.result b/test/sql/delete.result
> index e27c79d..9aa074f 100644
> --- a/test/sql/delete.result
> +++ b/test/sql/delete.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1, 2);");
> ---
> diff --git a/test/sql/delete.test.lua b/test/sql/delete.test.lua
> index 75448d4..ff1e622 100644
> --- a/test/sql/delete.test.lua
> +++ b/test/sql/delete.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1, 2);");
> diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
> index e8eb642..551e56f 100644
> --- a/test/sql/drop-index.result
> +++ b/test/sql/drop-index.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -23,7 +23,7 @@ box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> -- Dummy entry
> box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> ---
> diff --git a/test/sql/drop-index.test.lua b/test/sql/drop-index.test.lua
> index 8cd86ee..fd420b6 100644
> --- a/test/sql/drop-index.test.lua
> +++ b/test/sql/drop-index.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -11,7 +11,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zzoobar(c1, c4)")
> box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
>
> -- Dummy entry
> box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> diff --git a/test/sql/drop-table.result b/test/sql/drop-table.result
> index 7bc073d..ef4c5cf 100644
> --- a/test/sql/drop-table.result
> +++ b/test/sql/drop-table.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
> ---
> - row_count: 1
> diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua
> index a310db1..f0b1645 100644
> --- a/test/sql/drop-table.test.lua
> +++ b/test/sql/drop-table.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
>
> box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
>
> diff --git a/test/sql/engine.result b/test/sql/engine.result
> index 3ee93ad..b392566 100644
> --- a/test/sql/engine.result
> +++ b/test/sql/engine.result
> @@ -4,7 +4,7 @@ env = require('test_run')
> test_run = env.new()
> ---
> ...
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> @@ -16,7 +16,7 @@ box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> ---
> - row_count: 1
> ...
> -box.execute("pragma sql_default_engine='memtx'")
> +box.execute("set sql_default_engine='memtx'")
> ---
> - row_count: 0
> ...
> @@ -66,7 +66,7 @@ assert(box.space.T1_MEMTX.engine == 'memtx')
> ---
> - true
> ...
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
> index 112d3d3..bc16cc0 100644
> --- a/test/sql/engine.test.lua
> +++ b/test/sql/engine.test.lua
> @@ -1,11 +1,11 @@
> env = require('test_run')
> test_run = env.new()
>
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> box.execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
>
> -box.execute("pragma sql_default_engine='memtx'")
> +box.execute("set sql_default_engine='memtx'")
> box.execute("CREATE TABLE t3_memtx(a INT PRIMARY KEY, b INT, c INT);")
>
> assert(box.space.T1_VINYL.engine == 'vinyl')
> @@ -22,7 +22,7 @@ box.execute("CREATE TABLE t1_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> assert(box.space.T1_VINYL.engine == 'vinyl')
> box.execute("CREATE TABLE t1_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> assert(box.space.T1_MEMTX.engine == 'memtx')
> -box.execute("pragma sql_default_engine='vinyl'")
> +box.execute("set sql_default_engine='vinyl'")
> box.execute("CREATE TABLE t2_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> assert(box.space.T2_VINYL.engine == 'vinyl')
> box.execute("CREATE TABLE t2_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> diff --git a/test/sql/errinj.result b/test/sql/errinj.result
> index 7ab522f..c94afae 100644
> --- a/test/sql/errinj.result
> +++ b/test/sql/errinj.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
> index b978767..d21629d 100644
> --- a/test/sql/errinj.test.lua
> +++ b/test/sql/errinj.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> errinj = box.error.injection
> fiber = require('fiber')
>
> diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
> index a0a67a1..6083d19 100644
> --- a/test/sql/func-recreate.result
> +++ b/test/sql/func-recreate.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
> index 0b32ea9..a819587 100644
> --- a/test/sql/func-recreate.test.lua
> +++ b/test/sql/func-recreate.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Check errors during function create process
> fiber = require('fiber')
> diff --git a/test/sql/gh-2362-select-access-rights.result b/test/sql/gh-2362-select-access-rights.result
> index b15b0da..f929914 100644
> --- a/test/sql/gh-2362-select-access-rights.result
> +++ b/test/sql/gh-2362-select-access-rights.result
> @@ -7,7 +7,7 @@ engine = test_run:get_cfg('engine')
> nb = require('net.box')
> ---
> ...
> -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> +box.execute("SET sql_default_engine='"..engine.."'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2362-select-access-rights.test.lua b/test/sql/gh-2362-select-access-rights.test.lua
> index f2b66b6..5666b68 100644
> --- a/test/sql/gh-2362-select-access-rights.test.lua
> +++ b/test/sql/gh-2362-select-access-rights.test.lua
> @@ -2,7 +2,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> nb = require('net.box')
>
> -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> +box.execute("SET sql_default_engine='"..engine.."'")
> box.execute("CREATE TABLE t1 (s1 INT PRIMARY KEY, s2 INT UNIQUE);")
> box.execute("CREATE TABLE t2 (s1 INT PRIMARY KEY);")
> box.execute("INSERT INTO t1 VALUES (1, 1);")
> diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result
> index 021d037..35daaf2 100644
> --- a/test/sql/gh-2929-primary-key.result
> +++ b/test/sql/gh-2929-primary-key.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
> index 9cc6cd5..f419668 100644
> --- a/test/sql/gh-2929-primary-key.test.lua
> +++ b/test/sql/gh-2929-primary-key.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- All tables in SQL are now WITHOUT ROW ID, so if user
> -- tries to create table without a primary key, an appropriate error message
> diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result
> index d2938cd..11fed1e 100644
> --- a/test/sql/gh-2981-check-autoinc.result
> +++ b/test/sql/gh-2981-check-autoinc.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
> index 0eb8f73..afbefa0 100644
> --- a/test/sql/gh-2981-check-autoinc.test.lua
> +++ b/test/sql/gh-2981-check-autoinc.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.cfg{}
>
> diff --git a/test/sql/gh-3199-no-mem-leaks.result b/test/sql/gh-3199-no-mem-leaks.result
> index e7ba1d2..00211ce 100644
> --- a/test/sql/gh-3199-no-mem-leaks.result
> +++ b/test/sql/gh-3199-no-mem-leaks.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
> index 54a6ce5..f63bedf 100644
> --- a/test/sql/gh-3199-no-mem-leaks.test.lua
> +++ b/test/sql/gh-3199-no-mem-leaks.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> fiber = require('fiber')
>
> -- This test checks that no leaks of region memory happens during
> diff --git a/test/sql/gh-3613-idx-alter-update-2.result b/test/sql/gh-3613-idx-alter-update-2.result
> index ff63eb2..270f961 100644
> --- a/test/sql/gh-3613-idx-alter-update-2.result
> +++ b/test/sql/gh-3613-idx-alter-update-2.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3613-idx-alter-update-2.test.lua b/test/sql/gh-3613-idx-alter-update-2.test.lua
> index ff5b651..33730ff 100644
> --- a/test/sql/gh-3613-idx-alter-update-2.test.lua
> +++ b/test/sql/gh-3613-idx-alter-update-2.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> box.execute('CREATE INDEX i ON t (s1)')
> diff --git a/test/sql/gh-3613-idx-alter-update.result b/test/sql/gh-3613-idx-alter-update.result
> index ba323a6..34b4a1f 100644
> --- a/test/sql/gh-3613-idx-alter-update.result
> +++ b/test/sql/gh-3613-idx-alter-update.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3613-idx-alter-update.test.lua b/test/sql/gh-3613-idx-alter-update.test.lua
> index 3027182..389a99d 100644
> --- a/test/sql/gh-3613-idx-alter-update.test.lua
> +++ b/test/sql/gh-3613-idx-alter-update.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> box.execute('CREATE INDEX i ON t (s1)')
> diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
> index 4b8e7ed..5691e70 100644
> --- a/test/sql/gh-3888-values-blob-assert.result
> +++ b/test/sql/gh-3888-values-blob-assert.result
> @@ -10,7 +10,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh-3888-values-blob-assert.test.lua b/test/sql/gh-3888-values-blob-assert.test.lua
> index 0b7c385..9680aa5 100644
> --- a/test/sql/gh-3888-values-blob-assert.test.lua
> +++ b/test/sql/gh-3888-values-blob-assert.test.lua
> @@ -6,7 +6,7 @@
> --
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- check 'VALUES' against typedef keywords (should fail)
> box.execute('VALUES(scalar)')
> diff --git a/test/sql/gh2141-delete-trigger-drop-table.result b/test/sql/gh2141-delete-trigger-drop-table.result
> index 1d373f5..a218328 100644
> --- a/test/sql/gh2141-delete-trigger-drop-table.result
> +++ b/test/sql/gh2141-delete-trigger-drop-table.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> index 4d21fd7..2d5b987 100644
> --- a/test/sql/gh2141-delete-trigger-drop-table.test.lua
> +++ b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE t(id INT PRIMARY KEY)")
> diff --git a/test/sql/gh2251-multiple-update.result b/test/sql/gh2251-multiple-update.result
> index 42ebf7f..7a21cea 100644
> --- a/test/sql/gh2251-multiple-update.result
> +++ b/test/sql/gh2251-multiple-update.result
> @@ -5,7 +5,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
> index 4d55096..eeff047 100644
> --- a/test/sql/gh2251-multiple-update.test.lua
> +++ b/test/sql/gh2251-multiple-update.test.lua
> @@ -1,7 +1,7 @@
> -- Regression test for #2251
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
> index d69fcbd..a7dd7d2 100644
> --- a/test/sql/gh2483-remote-persistency-check.result
> +++ b/test/sql/gh2483-remote-persistency-check.result
> @@ -8,7 +8,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
> index 7db1602..bf2fc6b 100644
> --- a/test/sql/gh2483-remote-persistency-check.test.lua
> +++ b/test/sql/gh2483-remote-persistency-check.test.lua
> @@ -2,7 +2,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.schema.user.grant('guest', 'read,write,execute', 'universe')
>
> diff --git a/test/sql/gh2808-inline-unique-persistency-check.result b/test/sql/gh2808-inline-unique-persistency-check.result
> index a277b3f..db03feb 100644
> --- a/test/sql/gh2808-inline-unique-persistency-check.result
> +++ b/test/sql/gh2808-inline-unique-persistency-check.result
> @@ -8,7 +8,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> index 26b646a..ef38ae3 100644
> --- a/test/sql/gh2808-inline-unique-persistency-check.test.lua
> +++ b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> @@ -2,7 +2,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Create a table and insert a datum
> box.execute([[CREATE TABLE t1(a INT PRIMARY KEY, b INT, UNIQUE(b));]])
> diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result
> index 8ff7528..cb687a1 100644
> --- a/test/sql/icu-upper-lower.result
> +++ b/test/sql/icu-upper-lower.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
> index 00e9699..bbd4f00 100644
> --- a/test/sql/icu-upper-lower.test.lua
> +++ b/test/sql/icu-upper-lower.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> test_run:cmd("setopt delimiter ';'")
>
> diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
> index 1cf44c9..ec57681 100644
> --- a/test/sql/insert-unique.result
> +++ b/test/sql/insert-unique.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entry
> box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> ---
> diff --git a/test/sql/insert-unique.test.lua b/test/sql/insert-unique.test.lua
> index 026bc9d..243333e 100644
> --- a/test/sql/insert-unique.test.lua
> +++ b/test/sql/insert-unique.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entry
> box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
> index 223ba02..c886f8c 100644
> --- a/test/sql/integer-overflow.result
> +++ b/test/sql/integer-overflow.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
> index 1b3e8ce..57929e2 100644
> --- a/test/sql/integer-overflow.test.lua
> +++ b/test/sql/integer-overflow.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- gh-3735: make sure that integer overflows errors are
> -- handled during VDBE execution.
> diff --git a/test/sql/iproto.result b/test/sql/iproto.result
> index ffc7cd9..38f9789 100644
> --- a/test/sql/iproto.result
> +++ b/test/sql/iproto.result
> @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
> index b5ec2c0..d31fb7f 100644
> --- a/test/sql/iproto.test.lua
> +++ b/test/sql/iproto.test.lua
> @@ -1,7 +1,7 @@
> remote = require('net.box')
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> box.execute('create table test (id int primary key, a NUMBER, b text)')
> space = box.space.TEST
> diff --git a/test/sql/max-on-index.result b/test/sql/max-on-index.result
> index 57ce95b..45f29fd 100644
> --- a/test/sql/max-on-index.result
> +++ b/test/sql/max-on-index.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -25,7 +25,7 @@ box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO test1 VALUES(1, 2)");
> ---
> diff --git a/test/sql/max-on-index.test.lua b/test/sql/max-on-index.test.lua
> index 4cceaa7..73e4199 100644
> --- a/test/sql/max-on-index.test.lua
> +++ b/test/sql/max-on-index.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -13,7 +13,7 @@ box.execute("CREATE INDEX test1_index ON test1 (f2)")
> box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO test1 VALUES(1, 2)");
> diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
> index 69e3ee0..d198e14 100644
> --- a/test/sql/message-func-indexes.result
> +++ b/test/sql/message-func-indexes.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
> index 9ac5f47..dc67606 100644
> --- a/test/sql/message-func-indexes.test.lua
> +++ b/test/sql/message-func-indexes.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Creating tables.
> box.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
> diff --git a/test/sql/misc.result b/test/sql/misc.result
> index a157ddb..b06ac57 100644
> --- a/test/sql/misc.result
> +++ b/test/sql/misc.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
> index 541660c..e581b73 100644
> --- a/test/sql/misc.test.lua
> +++ b/test/sql/misc.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Forbid multistatement queries.
> box.execute('select 1;')
> diff --git a/test/sql/no-pk-space.result b/test/sql/no-pk-space.result
> index 025f363..d0274ea 100644
> --- a/test/sql/no-pk-space.result
> +++ b/test/sql/no-pk-space.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/no-pk-space.test.lua b/test/sql/no-pk-space.test.lua
> index 318c2ac..f451b57 100644
> --- a/test/sql/no-pk-space.test.lua
> +++ b/test/sql/no-pk-space.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> format = {}
> format[1] = {'id', 'integer'}
> diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
> index 6851e21..c0bb802 100644
> --- a/test/sql/on-conflict.result
> +++ b/test/sql/on-conflict.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
> index 1aa4d1b..958303e 100644
> --- a/test/sql/on-conflict.test.lua
> +++ b/test/sql/on-conflict.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> --
> -- Check that original sql ON CONFLICT clause is really
> -- disabled.
> diff --git a/test/sql/persistency.result b/test/sql/persistency.result
> index f8f992c..88778ec 100644
> --- a/test/sql/persistency.result
> +++ b/test/sql/persistency.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
> index 1964453..72d1992 100644
> --- a/test/sql/persistency.test.lua
> +++ b/test/sql/persistency.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> diff --git a/test/sql/row-count.result b/test/sql/row-count.result
> index 6bf74ed..dd898aa 100644
> --- a/test/sql/row-count.result
> +++ b/test/sql/row-count.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -314,13 +314,13 @@ box.execute("SELECT ROW_COUNT();")
> rows:
> - [0]
> ...
> -box.execute('PRAGMA recursive_triggers')
> +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
> ---
> - metadata:
> - - name: recursive_triggers
> - type: integer
> + - name: value
> + type: any
> rows:
> - - [1]
> + - [true]
> ...
> -- Clean-up.
> --
> diff --git a/test/sql/row-count.test.lua b/test/sql/row-count.test.lua
> index 369e7fa..f5a9820 100644
> --- a/test/sql/row-count.test.lua
> +++ b/test/sql/row-count.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Test cases concerning row count calculations.
> --
> @@ -65,7 +65,7 @@ box.execute("SELECT ROW_COUNT();")
> box.execute("SELECT ROW_COUNT();")
> box.execute("EXPLAIN QUERY PLAN INSERT INTO t1 VALUES ('b'), ('c'), ('d');")
> box.execute("SELECT ROW_COUNT();")
> -box.execute('PRAGMA recursive_triggers')
> +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
>
> -- Clean-up.
> --
> diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
> index e48db30..a111e26 100644
> --- a/test/sql/savepoints.result
> +++ b/test/sql/savepoints.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
> index 99622a4..0af67a9 100644
> --- a/test/sql/savepoints.test.lua
> +++ b/test/sql/savepoints.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- These tests check that SQL savepoints properly work outside
> -- transactions as well as inside transactions started in Lua.
> diff --git a/test/sql/select-null.result b/test/sql/select-null.result
> index 83d9776..bd25f03 100644
> --- a/test/sql/select-null.result
> +++ b/test/sql/select-null.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> ---
> diff --git a/test/sql/select-null.test.lua b/test/sql/select-null.test.lua
> index a49eb43..9f54048 100644
> --- a/test/sql/select-null.test.lua
> +++ b/test/sql/select-null.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
> index 4102b1a..e2d60a9 100644
> --- a/test/sql/sql-debug.result
> +++ b/test/sql/sql-debug.result
> @@ -5,50 +5,130 @@ test_run = require('test_run').new()
> ---
> ...
> --
> --- gh-3832: Some statements do not return column type
> --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> --- without parameter.
> -result = box.execute('PRAGMA parser_trace').rows
> +-- gh-4511: make sure that SET works.
> +--
> +box.execute('SELECT "name" FROM "_vsession_settings";')
> +---
> +- metadata:
> + - name: name
> + type: string
> + rows:
> + - ['sql_default_engine']
> + - ['sql_defer_foreign_keys']
> + - ['sql_full_column_names']
> + - ['sql_parser_trace']
> + - ['sql_recursive_triggers']
> + - ['sql_reverse_unordered_selects']
> + - ['sql_select_trace']
> + - ['sql_trace']
> + - ['sql_vdbe_addoptrace']
> + - ['sql_vdbe_debug']
> + - ['sql_vdbe_eqp']
> + - ['sql_vdbe_listing']
> + - ['sql_vdbe_trace']
> + - ['sql_where_trace']
> +...
> +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> +---
> +...
> +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +---
> +...
> +box.execute('SET sql_default_engine = 1;')
> +---
> +- null
> +- 'Inconsistent types: expected string got integer'
> +...
> +box.execute("SET sql_default_engine = 'some_engine';")
> +---
> +- null
> +- Space engine 'some_engine' does not exist
> +...
> +box.execute("SET engine = 'vinyl';")
> +---
> +- null
> +- Setting is not found
> +...
> +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> +---
> +- null
> +- 'Inconsistent types: expected boolean got string'
> +...
> +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> ---
> +- true
> ...
> -box.execute('PRAGMA parser_trace = 1')
> +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +---
> +- true
> +...
> +box.execute("SET sql_default_engine = 'vinyl';")
> +---
> +- row_count: 0
> +...
> +box.execute("SET sql_reverse_unordered_selects = true;")
> ---
> - row_count: 0
> ...
> -box.execute('PRAGMA parser_trace')
> +box.execute('SELECT * FROM "_vsession_settings";')
> ---
> - metadata:
> - - name: parser_trace
> - type: integer
> + - name: name
> + type: string
> + - name: value
> + type: any
> rows:
> - - [1]
> + - ['sql_where_trace', false]
> + - ['sql_vdbe_trace', false]
> + - ['sql_vdbe_listing', false]
> + - ['sql_vdbe_eqp', false]
> + - ['sql_vdbe_debug', false]
> + - ['sql_vdbe_addoptrace', false]
> + - ['sql_trace', false]
> + - ['sql_select_trace', false]
> + - ['sql_reverse_unordered_selects', true]
> + - ['sql_recursive_triggers', true]
> + - ['sql_parser_trace', false]
> + - ['sql_full_column_names', false]
> + - ['sql_defer_foreign_keys', false]
> + - ['sql_default_engine', 'vinyl']
> ...
> -box.execute('PRAGMA parser_trace = '.. result[1][1])
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> ---
> --- Make PRAGMA command return the result as a result set.
> ---
> -box.execute('PRAGMA')
> +box.execute("SET sql_reverse_unordered_selects = false;")
> +---
> +- row_count: 0
> +...
> +box.execute('SELECT * FROM "_vsession_settings";')
> ---
> - metadata:
> - - name: pragma_name
> - type: text
> - - name: pragma_value
> - type: integer
> + - name: name
> + type: string
> + - name: value
> + type: any
> rows:
> - - ['defer_foreign_keys', 0]
> - - ['full_column_names', 0]
> - - ['parser_trace', 0]
> - - ['recursive_triggers', 1]
> - - ['reverse_unordered_selects', 0]
> - - ['select_trace', 0]
> - - ['sql_trace', 0]
> - - ['vdbe_addoptrace', 0]
> - - ['vdbe_debug', 0]
> - - ['vdbe_eqp', 0]
> - - ['vdbe_listing', 0]
> - - ['vdbe_trace', 0]
> - - ['where_trace', 0]
> + - ['sql_default_engine', 'memtx']
> + - ['sql_defer_foreign_keys', false]
> + - ['sql_full_column_names', false]
> + - ['sql_parser_trace', false]
> + - ['sql_recursive_triggers', true]
> + - ['sql_reverse_unordered_selects', false]
> + - ['sql_select_trace', false]
> + - ['sql_trace', false]
> + - ['sql_vdbe_addoptrace', false]
> + - ['sql_vdbe_debug', false]
> + - ['sql_vdbe_eqp', false]
> + - ['sql_vdbe_listing', false]
> + - ['sql_vdbe_trace', false]
> + - ['sql_where_trace', false]
> +...
> +box.execute("SET sql_default_engine = '"..engine.."';")
> +---
> +- row_count: 0
> +...
> +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> +---
> +- row_count: 0
> ...
> diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua
> index edd0ef4..b15deee 100644
> --- a/test/sql/sql-debug.test.lua
> +++ b/test/sql/sql-debug.test.lua
> @@ -2,16 +2,27 @@ remote = require('net.box')
> test_run = require('test_run').new()
>
> --
> --- gh-3832: Some statements do not return column type
> +-- gh-4511: make sure that SET works.
> +--
> +box.execute('SELECT "name" FROM "_vsession_settings";')
>
> --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> --- without parameter.
> -result = box.execute('PRAGMA parser_trace').rows
> -box.execute('PRAGMA parser_trace = 1')
> -box.execute('PRAGMA parser_trace')
> -box.execute('PRAGMA parser_trace = '.. result[1][1])
> +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
>
> ---
> --- Make PRAGMA command return the result as a result set.
> ---
> -box.execute('PRAGMA')
> +box.execute('SET sql_default_engine = 1;')
> +box.execute("SET sql_default_engine = 'some_engine';")
> +box.execute("SET engine = 'vinyl';")
> +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> +
> +box.execute("SET sql_default_engine = 'vinyl';")
> +box.execute("SET sql_reverse_unordered_selects = true;")
> +box.execute('SELECT * FROM "_vsession_settings";')
> +
> +box.execute("SET sql_default_engine = 'memtx';")
> +box.execute("SET sql_reverse_unordered_selects = false;")
> +box.execute('SELECT * FROM "_vsession_settings";')
> +
> +box.execute("SET sql_default_engine = '"..engine.."';")
> +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> diff --git a/test/sql/sql-statN-index-drop.result b/test/sql/sql-statN-index-drop.result
> index b2a4458..cf0f6f4 100644
> --- a/test/sql/sql-statN-index-drop.result
> +++ b/test/sql/sql-statN-index-drop.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
> index 5477a2a..5f9cc68 100644
> --- a/test/sql/sql-statN-index-drop.test.lua
> +++ b/test/sql/sql-statN-index-drop.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Initializing some things.
> box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT);")
> diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
> index 1ae9ef2..07a7c41 100644
> --- a/test/sql/tokenizer.result
> +++ b/test/sql/tokenizer.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
> index 3f5dd12..15cf658 100644
> --- a/test/sql/tokenizer.test.lua
> +++ b/test/sql/tokenizer.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> sql_tokenizer = require('sql_tokenizer')
>
> diff --git a/test/sql/transition.result b/test/sql/transition.result
> index 9738092..35e7af6 100644
> --- a/test/sql/transition.result
> +++ b/test/sql/transition.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
> index a05c26a..9b8b868 100644
> --- a/test/sql/transition.test.lua
> +++ b/test/sql/transition.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- create space
> box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result
> index 29c7316..17311ee 100644
> --- a/test/sql/transitive-transactions.result
> +++ b/test/sql/transitive-transactions.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> +box.execute("set sql_default_engine=\'"..engine.."\'")
> ---
> - row_count: 0
> ...
> @@ -88,7 +88,7 @@ box.space.PARENT:select();
> ---
> - - [1, 1]
> ...
> --- Make sure that 'PRAGMA defer_foreign_keys' works.
> +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> --
> box.execute('DROP TABLE child;')
> box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> @@ -116,7 +116,7 @@ box.space.PARENT:select();
> ---
> - - [1, 1]
> ...
> -box.execute('PRAGMA defer_foreign_keys = 1;')
> +box.execute('SET sql_defer_foreign_keys = true;')
> box.rollback()
> fk_defer();
> ---
> @@ -131,7 +131,7 @@ box.space.PARENT:select();
> - [2, 2]
> ...
> -- Cleanup
> -box.execute('PRAGMA defer_foreign_keys = 0;')
> +box.execute('SET sql_defer_foreign_keys = false;')
>
> box.execute('DROP TABLE child;');
> ---
> diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
> index 4633f07..3c5fecb 100644
> --- a/test/sql/transitive-transactions.test.lua
> +++ b/test/sql/transitive-transactions.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> +box.execute("set sql_default_engine=\'"..engine.."\'")
> test_run:cmd("setopt delimiter ';'")
>
> -- These tests are aimed at checking transitive transactions
> @@ -45,7 +45,7 @@ fk_violation_3();
> box.space.CHILD:select();
> box.space.PARENT:select();
>
> --- Make sure that 'PRAGMA defer_foreign_keys' works.
> +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> --
> box.execute('DROP TABLE child;')
> box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> @@ -62,13 +62,13 @@ end;
> fk_defer();
> box.space.CHILD:select();
> box.space.PARENT:select();
> -box.execute('PRAGMA defer_foreign_keys = 1;')
> +box.execute('SET sql_defer_foreign_keys = true;')
> box.rollback()
> fk_defer();
> box.space.CHILD:select();
> box.space.PARENT:select();
>
> -box.execute('PRAGMA defer_foreign_keys = 0;')
> +box.execute('SET sql_defer_foreign_keys = false;')
>
> -- Cleanup
> box.execute('DROP TABLE child;');
> diff --git a/test/sql/triggers.result b/test/sql/triggers.result
> index 9dfe981..de1f074 100644
> --- a/test/sql/triggers.result
> +++ b/test/sql/triggers.result
> @@ -7,7 +7,7 @@ test_run = env.new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -292,7 +292,7 @@ box.execute("DROP TABLE T1;")
> -- gh-3531: Assertion with trigger and two storage engines
> --
> -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> -box.execute("PRAGMA sql_default_engine ('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> ---
> - row_count: 0
> ...
> @@ -304,7 +304,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -336,7 +336,7 @@ box.execute("DROP TABLE n;")
> - row_count: 1
> ...
> -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -348,7 +348,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> ---
> - row_count: 0
> ...
> @@ -380,7 +380,7 @@ box.execute("DROP TABLE n;")
> - row_count: 1
> ...
> -- Test SQL Transaction with LUA
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> ---
> - row_count: 0
> ...
> @@ -388,7 +388,7 @@ box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> ---
> - row_count: 1
> ...
> -box.execute("PRAGMA sql_default_engine='vinyl'")
> +box.execute("SET sql_default_engine='vinyl'")
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
> index f0397dc..138d1c0 100644
> --- a/test/sql/triggers.test.lua
> +++ b/test/sql/triggers.test.lua
> @@ -1,7 +1,7 @@
> env = require('test_run')
> test_run = env.new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Get invariant part of the tuple; name and opts don't change.
> function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
> @@ -100,10 +100,10 @@ box.execute("DROP TABLE T1;")
> -- gh-3531: Assertion with trigger and two storage engines
> --
> -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> -box.execute("PRAGMA sql_default_engine ('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> -box.execute("PRAGMA sql_default_engine('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> box.execute("INSERT INTO m VALUES (0, '0');")
> box.execute("INSERT INTO n VALUES (0, '',null);")
> @@ -116,10 +116,10 @@ box.execute("DROP TABLE n;")
>
>
> -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> -box.execute("PRAGMA sql_default_engine('vinyl');")
> +box.execute("SET sql_default_engine = 'vinyl';")
> box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> box.execute("INSERT INTO m VALUES (0, '0');")
> box.execute("INSERT INTO n VALUES (0, '',null);")
> @@ -131,9 +131,9 @@ box.execute("DROP TABLE m;")
> box.execute("DROP TABLE n;")
>
> -- Test SQL Transaction with LUA
> -box.execute("PRAGMA sql_default_engine ('memtx');")
> +box.execute("SET sql_default_engine = 'memtx';")
> box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> -box.execute("PRAGMA sql_default_engine='vinyl'")
> +box.execute("SET sql_default_engine='vinyl'")
> box.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
> box.execute("INSERT INTO test2 VALUES (2)")
> box.execute("START TRANSACTION")
> diff --git a/test/sql/update-with-nested-select.result b/test/sql/update-with-nested-select.result
> index 3172430..b6ccda2 100644
> --- a/test/sql/update-with-nested-select.result
> +++ b/test/sql/update-with-nested-select.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
> - row_count: 1
> ...
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1,4,6);");
> ---
> diff --git a/test/sql/update-with-nested-select.test.lua b/test/sql/update-with-nested-select.test.lua
> index 88424fc..07587ff 100644
> --- a/test/sql/update-with-nested-select.test.lua
> +++ b/test/sql/update-with-nested-select.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- box.cfg()
>
> @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
>
> -- Debug
> --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
>
> -- Seed entries
> box.execute("INSERT INTO t1 VALUES(1,4,6);");
> diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
> index f0997e1..6627777 100644
> --- a/test/sql/upgrade.result
> +++ b/test/sql/upgrade.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
> index 37425ae..0c882ba 100644
> --- a/test/sql/upgrade.test.lua
> +++ b/test/sql/upgrade.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> work_dir = 'sql/upgrade/1.10/'
> test_run:cmd('create server upgrade with script="sql/upgrade/upgrade.lua", workdir="' .. work_dir .. '"')
> diff --git a/test/sql/view.result b/test/sql/view.result
> index d845df8..3df08fc 100644
> --- a/test/sql/view.result
> +++ b/test/sql/view.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
> index 0008056..6a1fae2 100644
> --- a/test/sql/view.test.lua
> +++ b/test/sql/view.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
>
> -- Verify that constraints on 'view' option are working.
>
> diff --git a/test/sql/view_delayed_wal.result b/test/sql/view_delayed_wal.result
> index d518e7d..a5f64f2 100644
> --- a/test/sql/view_delayed_wal.result
> +++ b/test/sql/view_delayed_wal.result
> @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> ---
> ...
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
> index 7e6fce6..ec93e72 100644
> --- a/test/sql/view_delayed_wal.test.lua
> +++ b/test/sql/view_delayed_wal.test.lua
> @@ -1,6 +1,6 @@
> test_run = require('test_run').new()
> engine = test_run:get_cfg('engine')
> -box.execute('pragma sql_default_engine=\''..engine..'\'')
> +box.execute('set sql_default_engine=\''..engine..'\'')
> fiber = require('fiber')
>
> -- View reference counters are incremented before firing
> diff --git a/test/sql/vinyl-opts.result b/test/sql/vinyl-opts.result
> index 10a649a..b9e07c1 100644
> --- a/test/sql/vinyl-opts.result
> +++ b/test/sql/vinyl-opts.result
> @@ -13,7 +13,7 @@ test_run:cmd("switch test")
> ---
> - true
> ...
> -box.execute('pragma sql_default_engine= \'vinyl\'')
> +box.execute('set sql_default_engine= \'vinyl\'')
> ---
> - row_count: 0
> ...
> diff --git a/test/sql/vinyl-opts.test.lua b/test/sql/vinyl-opts.test.lua
> index 4460724..05864d0 100644
> --- a/test/sql/vinyl-opts.test.lua
> +++ b/test/sql/vinyl-opts.test.lua
> @@ -3,7 +3,7 @@ test_run:cmd("create server test with script='sql/vinyl-opts-cfg.lua'")
> test_run:cmd("start server test")
> test_run:cmd("switch test")
>
> -box.execute('pragma sql_default_engine= \'vinyl\'')
> +box.execute('set sql_default_engine= \'vinyl\'')
> box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
> box.space.V1.index[0].options
>
> --
> 2.7.4
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 10:51 ` Konstantin Osipov
@ 2019-11-27 11:05 ` Mergen Imeev
2019-11-27 11:10 ` Konstantin Osipov
2019-11-27 23:18 ` Vladislav Shpilevoy
0 siblings, 2 replies; 22+ messages in thread
From: Mergen Imeev @ 2019-11-27 11:05 UTC (permalink / raw)
To: Konstantin Osipov; +Cc: tarantool-patches, v.shpilevoy
On Wed, Nov 27, 2019 at 01:51:50PM +0300, Konstantin Osipov wrote:
> Why is it not possible to make the settings system view updatable,
> if you decided to go with adding such a view anyway?
>
The sysview is empty. Not sure we need to make this
updatable.
> Usually, if one allows SET statement, SET option_name (without
> "= new_value") prints the current setting. This does the job and
> makes the "_vsettings" system view unnecessary.
>
> Don't you think that having to use one piece of syntax to query a
> value and entirely different piece to assign it is, ehm,
> inconsistent, hard to learn & remember, and eventually hard to
> use?
>
You are right. This was also pointed by Vlad in previous
review:
"2. Ok, but now it looks really unusable when a user want's to
learn an option value. I will create a ticket, if this patchset
will be pushed and nobody will care about usability beforehand."
Personally, I think this is easy to fix, and your
suggestion is good. In fact, I can fix this in this
patch-set if Vlad and Nikita agree with this solution.
> * imeevma@tarantool.org <imeevma@tarantool.org> [19/11/27 13:16]:
>
>
> > This patch replaces the control pragmas with SET. List of replaced
> > control pragmas and their SET settings:
> > Control pragmas SET parameters
> > defer_foreign_keys sql_defer_foreign_keys
> > full_column_names sql_full_column_names
> > recursive_triggers sql_recursive_triggers
> > reverse_unordered_selects sql_reverse_unordered_selects
> > sql_compound_select_limit sql_compound_select_limit
> > sql_default_engine sql_default_engine
> >
> > Also, in debug build, these control pragmas are replaced by SET
> > settings:
> > Control pragmas SET parameters
> > parser_trace sql_parser_trace
> > select_trace sql_select_trace
> > sql_trace sql_trace
> > vdbe_addoptrace sql_vdbe_addoptrace
> > vdbe_debug sql_vdbe_debug
> > vdbe_eqp sql_vdbe_eqp
> > vdbe_listing sql_vdbe_listing
> > vdbe_trace sql_vdbe_trace
> > where_trace sql_where_trace
> >
> > Difference between SET and control pragma:
> > 1) SET have more definite syntax:
> > SET <setting name> = <setting value>;
> > In PRAGMA, we could set the settings using these methods:
> > PRAGMA <setting name> = <setting value>;
> > PRAGMA <setting name>(<setting value>);
> >
> > 2) SET allows only a specific type of value for each setting. In
> > PRAGMA, we could use almost everything to set up any setting.
> > Although the rules by which the settings were set in PRAGMA were
> > pretty easy to understand.
> >
> > 3) SET cannot display setting values. PRAGMA showed the setting
> > values using the syntax "PRAGMA <setting name>;". With SET, we
> > must use other means to get the current setting values. For
> > session settings, we could use the sysview "_vsession_settings"
> > to get these values. It is worth noting that all current SQL
> > settings are session settings, with the exception of
> > 'sql_reverse_unordered_selects'.
> >
> > After this patch there will be no control pragmas.
> >
> > Closes #4511
> > Closes #4621
> >
> > @TarantoolBot document
> > Title: SQL SET statement
> >
> > SQL SET statement is used to change SQL settings. To change the
> > value of an SQL setting, use the following syntax:
> >
> > SET <setting name> = <setting value>;
> >
> > Currently available SQL settings:
> > 'sql_defer_foreign_keys'
> > 'sql_full_column_names'
> > 'sql_recursive_triggers'
> > 'sql_reverse_unordered_selects'
> > 'sql_compound_select_limit'
> > 'sql_default_engine'
> >
> > In addition, SQL debugging settings can also be changed using this
> > statement in debug build:
> > 'sql_parser_trace'
> > 'sql_select_trace'
> > 'sql_trace'
> > 'sql_vdbe_addoptrace'
> > 'sql_vdbe_debug'
> > 'sql_vdbe_eqp'
> > 'sql_vdbe_listing'
> > 'sql_vdbe_trace'
> > 'sql_where_trace'
> >
> > Example of usage:
> > SET sql_full_column_names = true;
> > SET sql_compound_select_limit = 10;
> > SET sql_default_engine = 'memtx';
> > ---
> > src/box/sql/build.c | 120 ++++++++++++
> > src/box/sql/parse.y | 8 +-
> > src/box/sql/pragma.c | 203 +--------------------
> > src/box/sql/pragma.h | 134 --------------
> > src/box/sql/sqlInt.h | 57 +++++-
> > src/box/sql/vdbe.c | 25 +++
> > test/sql-tap/analyze4.test.lua | 4 +-
> > test/sql-tap/autoinc.test.lua | 2 +-
> > test/sql-tap/colname.test.lua | 16 +-
> > test/sql-tap/fkey2.test.lua | 4 +-
> > test/sql-tap/gh2548-select-compound-limit.test.lua | 18 +-
> > test/sql-tap/lua/sqltester.lua | 2 +-
> > test/sql-tap/misc1.test.lua | 2 +-
> > test/sql-tap/pragma.test.lua | 135 +-------------
> > test/sql-tap/select1.test.lua | 22 +--
> > test/sql-tap/tkt3731.test.lua | 2 +-
> > test/sql-tap/trigger2.test.lua | 2 +-
> > test/sql-tap/triggerC.test.lua | 51 +-----
> > test/sql-tap/update.test.lua | 1 -
> > test/sql-tap/whereA.test.lua | 24 +--
> > test/sql/check-clear-ephemeral.result | 4 +-
> > test/sql/check-clear-ephemeral.test.lua | 4 +-
> > test/sql/checks.result | 4 +-
> > test/sql/checks.test.lua | 4 +-
> > test/sql/clear.result | 4 +-
> > test/sql/clear.test.lua | 4 +-
> > test/sql/collation.result | 2 +-
> > test/sql/collation.test.lua | 2 +-
> > test/sql/ddl.result | 2 +-
> > test/sql/ddl.test.lua | 2 +-
> > test/sql/delete-multiple-idx.result | 4 +-
> > test/sql/delete-multiple-idx.test.lua | 4 +-
> > test/sql/delete.result | 4 +-
> > test/sql/delete.test.lua | 4 +-
> > test/sql/drop-index.result | 4 +-
> > test/sql/drop-index.test.lua | 4 +-
> > test/sql/drop-table.result | 4 +-
> > test/sql/drop-table.test.lua | 4 +-
> > test/sql/engine.result | 6 +-
> > test/sql/engine.test.lua | 6 +-
> > test/sql/errinj.result | 2 +-
> > test/sql/errinj.test.lua | 2 +-
> > test/sql/func-recreate.result | 2 +-
> > test/sql/func-recreate.test.lua | 2 +-
> > test/sql/gh-2362-select-access-rights.result | 2 +-
> > test/sql/gh-2362-select-access-rights.test.lua | 2 +-
> > test/sql/gh-2929-primary-key.result | 2 +-
> > test/sql/gh-2929-primary-key.test.lua | 2 +-
> > test/sql/gh-2981-check-autoinc.result | 2 +-
> > test/sql/gh-2981-check-autoinc.test.lua | 2 +-
> > test/sql/gh-3199-no-mem-leaks.result | 2 +-
> > test/sql/gh-3199-no-mem-leaks.test.lua | 2 +-
> > test/sql/gh-3613-idx-alter-update-2.result | 2 +-
> > test/sql/gh-3613-idx-alter-update-2.test.lua | 2 +-
> > test/sql/gh-3613-idx-alter-update.result | 2 +-
> > test/sql/gh-3613-idx-alter-update.test.lua | 2 +-
> > test/sql/gh-3888-values-blob-assert.result | 2 +-
> > test/sql/gh-3888-values-blob-assert.test.lua | 2 +-
> > test/sql/gh2141-delete-trigger-drop-table.result | 2 +-
> > test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 +-
> > test/sql/gh2251-multiple-update.result | 2 +-
> > test/sql/gh2251-multiple-update.test.lua | 2 +-
> > test/sql/gh2483-remote-persistency-check.result | 2 +-
> > test/sql/gh2483-remote-persistency-check.test.lua | 2 +-
> > .../gh2808-inline-unique-persistency-check.result | 2 +-
> > ...gh2808-inline-unique-persistency-check.test.lua | 2 +-
> > test/sql/icu-upper-lower.result | 2 +-
> > test/sql/icu-upper-lower.test.lua | 2 +-
> > test/sql/insert-unique.result | 4 +-
> > test/sql/insert-unique.test.lua | 4 +-
> > test/sql/integer-overflow.result | 2 +-
> > test/sql/integer-overflow.test.lua | 2 +-
> > test/sql/iproto.result | 2 +-
> > test/sql/iproto.test.lua | 2 +-
> > test/sql/max-on-index.result | 4 +-
> > test/sql/max-on-index.test.lua | 4 +-
> > test/sql/message-func-indexes.result | 2 +-
> > test/sql/message-func-indexes.test.lua | 2 +-
> > test/sql/misc.result | 2 +-
> > test/sql/misc.test.lua | 2 +-
> > test/sql/no-pk-space.result | 2 +-
> > test/sql/no-pk-space.test.lua | 2 +-
> > test/sql/on-conflict.result | 2 +-
> > test/sql/on-conflict.test.lua | 2 +-
> > test/sql/persistency.result | 2 +-
> > test/sql/persistency.test.lua | 2 +-
> > test/sql/row-count.result | 10 +-
> > test/sql/row-count.test.lua | 4 +-
> > test/sql/savepoints.result | 2 +-
> > test/sql/savepoints.test.lua | 2 +-
> > test/sql/select-null.result | 4 +-
> > test/sql/select-null.test.lua | 4 +-
> > test/sql/sql-debug.result | 142 ++++++++++----
> > test/sql/sql-debug.test.lua | 33 ++--
> > test/sql/sql-statN-index-drop.result | 2 +-
> > test/sql/sql-statN-index-drop.test.lua | 2 +-
> > test/sql/tokenizer.result | 2 +-
> > test/sql/tokenizer.test.lua | 2 +-
> > test/sql/transition.result | 2 +-
> > test/sql/transition.test.lua | 2 +-
> > test/sql/transitive-transactions.result | 8 +-
> > test/sql/transitive-transactions.test.lua | 8 +-
> > test/sql/triggers.result | 14 +-
> > test/sql/triggers.test.lua | 14 +-
> > test/sql/update-with-nested-select.result | 4 +-
> > test/sql/update-with-nested-select.test.lua | 4 +-
> > test/sql/upgrade.result | 2 +-
> > test/sql/upgrade.test.lua | 2 +-
> > test/sql/view.result | 2 +-
> > test/sql/view.test.lua | 2 +-
> > test/sql/view_delayed_wal.result | 2 +-
> > test/sql/view_delayed_wal.test.lua | 2 +-
> > test/sql/vinyl-opts.result | 2 +-
> > test/sql/vinyl-opts.test.lua | 2 +-
> > 114 files changed, 531 insertions(+), 758 deletions(-)
> >
> > diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> > index ce87b88..210d392 100644
> > --- a/src/box/sql/build.c
> > +++ b/src/box/sql/build.c
> > @@ -3275,6 +3275,12 @@ enum {
> > SQL_SESSION_OPTION_max,
> > };
> >
> > +/** Identifiers of all SQL global options that can be set. */
> > +enum {
> > + SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT = 0,
> > + SQL_GLOBAL_OPTION_max,
> > +};
> > +
> > /**
> > * A local structure that allows to establish a connection between
> > * the name of the parameter, its field type and mask, if it have
> > @@ -3329,6 +3335,15 @@ static struct sql_option_metadata sql_session_opts[] = {
> > #endif
> > };
> >
> > +/**
> > + * Variable that contains names of the SQL global options, their
> > + * field types and mask if they have one or 0 if don't have.
> > + */
> > +static struct sql_option_metadata sql_global_opts[] = {
> > + /** SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT */
> > + {"sql_compound_select_limit", FIELD_TYPE_INTEGER, 0},
> > +};
> > +
> > uint32_t
> > sql_session_opt_id_max()
> > {
> > @@ -3382,3 +3397,108 @@ sql_session_opt_tuple(struct tuple_format *format, int option_id,
> > *result = tuple;
> > return 0;
> > }
> > +
> > +int
> > +sql_set_boolean_option(int id, enum sql_setting_type type, bool value)
> > +{
> > + assert(type == SQL_SESSION_SETTING);
> > + (void)type;
> > + struct session *session = current_session();
> > + struct sql_option_metadata *option = &sql_session_opts[id];
> > + assert(option->field_type == FIELD_TYPE_BOOLEAN);
> > + if (value)
> > + session->sql_flags |= option->mask;
> > + else
> > + session->sql_flags &= ~option->mask;
> > +#ifndef NDEBUG
> > + if (id == SQL_SESSION_OPTION_PARSER_TRACE) {
> > + if (value)
> > + sqlParserTrace(stdout, "parser: ");
> > + else
> > + sqlParserTrace(NULL, NULL);
> > + }
> > +#endif
> > + return 0;
> > +}
> > +
> > +int
> > +sql_set_string_option(int id, enum sql_setting_type type, const char *value)
> > +{
> > + assert(type == SQL_SESSION_SETTING);
> > + (void)type;
> > + assert(sql_session_opts[id].field_type = FIELD_TYPE_STRING);
> > + assert(id == SQL_SESSION_OPTION_DEFAULT_ENGINE);
> > + (void)id;
> > + enum sql_storage_engine engine = STR2ENUM(sql_storage_engine, value);
> > + if (engine == sql_storage_engine_MAX) {
> > + diag_set(ClientError, ER_NO_SUCH_ENGINE, value);
> > + return -1;
> > + }
> > + current_session()->sql_default_engine = engine;
> > + return 0;
> > +}
> > +
> > +int
> > +sql_set_integer_option(int id, enum sql_setting_type type, int value)
> > +{
> > + assert(type == SQL_GLOBAL_SETTING);
> > + (void)type;
> > + assert(sql_global_opts[id].field_type = FIELD_TYPE_INTEGER);
> > + assert(id == SQL_GLOBAL_OPTION_COMPOUND_SELECT_LIMIT);
> > + (void)id;
> > + int rc = sql_limit(sql_get(), SQL_LIMIT_COMPOUND_SELECT, value);
> > + assert(rc >= 0);
> > + return rc < 0 ? -1 : 0;
> > +}
> > +
> > +void
> > +sql_set_settings(struct Parse *parse_context, struct Token *name,
> > + struct Expr *value)
> > +{
> > + int opt_id;
> > + struct Vdbe *vdbe = sqlGetVdbe(parse_context);
> > + char *name_str = sql_name_from_token(sql_get(), name);
> > + if (name_str == NULL) {
> > + parse_context->is_aborted = true;
> > + return;
> > + }
> > + int value_reg = ++parse_context->nMem;
> > + sqlExprCode(parse_context, value, value_reg);
> > + /* Try to find the option among the session options. */
> > + for (opt_id = 0; opt_id < SQL_SESSION_OPTION_max; ++opt_id) {
> > + if (strcasecmp(sql_session_opts[opt_id].name, name_str) == 0) {
> > + struct sql_option_metadata *opt =
> > + &sql_session_opts[opt_id];
> > + if (value->type != opt->field_type) {
> > + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> > + field_type_strs[opt->field_type],
> > + field_type_strs[value->type]);
> > + parse_context->is_aborted = true;
> > + return;
> > + }
> > + sqlVdbeAddOp3(vdbe, OP_Set, SQL_SESSION_SETTING, opt_id,
> > + value_reg);
> > + return;
> > + }
> > + }
> > + /* Try to find the option among the global options. */
> > + for (opt_id = 0; opt_id < SQL_GLOBAL_OPTION_max; ++opt_id) {
> > + if (strcasecmp(sql_global_opts[opt_id].name, name_str) == 0) {
> > + struct sql_option_metadata *opt =
> > + &sql_global_opts[opt_id];
> > + if (value->type != opt->field_type) {
> > + diag_set(ClientError, ER_INCONSISTENT_TYPES,
> > + field_type_strs[opt->field_type],
> > + field_type_strs[value->type]);
> > + parse_context->is_aborted = true;
> > + return;
> > + }
> > + sqlVdbeAddOp3(vdbe, OP_Set, SQL_GLOBAL_SETTING, opt_id,
> > + value_reg);
> > + return;
> > + }
> > + }
> > + diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Setting is not found");
> > + parse_context->is_aborted = true;
> > + return;
> > +}
> > diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> > index 1d0c95f..9f8118e 100644
> > --- a/src/box/sql/parse.y
> > +++ b/src/box/sql/parse.y
> > @@ -1539,6 +1539,11 @@ cmd ::= DROP INDEX ifexists(E) nm(X) ON fullname(Y). {
> > sql_drop_index(pParse);
> > }
> >
> > +///////////////////////////// The SET command ////////////////////////////////
> > +cmd ::= SET nm(X) EQ term(Y). {
> > + sql_set_settings(pParse,&X,Y.pExpr);
> > +}
> > +
> > ///////////////////////////// The PRAGMA command /////////////////////////////
> > //
> > cmd ::= PRAGMA nm(X). {
> > @@ -1559,9 +1564,6 @@ cmd ::= PRAGMA nm(X) LP minus_num(Y) RP. {
> > cmd ::= PRAGMA nm(X) LP nm(Z) DOT nm(Y) RP. {
> > sqlPragma(pParse,&X,&Y,&Z,0);
> > }
> > -cmd ::= PRAGMA . {
> > - sqlPragma(pParse, 0,0,0,0);
> > -}
> >
> > nmnum(A) ::= plus_num(A).
> > nmnum(A) ::= STRING(A).
> > diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
> > index 92bcf4e..0eaa2ca 100644
> > --- a/src/box/sql/pragma.c
> > +++ b/src/box/sql/pragma.c
> > @@ -62,56 +62,6 @@
> > #include "pragma.h"
> > #include "tarantoolInt.h"
> >
> > -/*
> > - * Interpret the given string as a safety level. Return 0 for OFF,
> > - * 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
> > - * unrecognized string argument. The FULL and EXTRA option is disallowed
> > - * if the omitFull parameter it 1.
> > - *
> > - * Note that the values returned are one less that the values that
> > - * should be passed into sqlBtreeSetSafetyLevel(). The is done
> > - * to support legacy SQL code. The safety level used to be boolean
> > - * and older scripts may have used numbers 0 for OFF and 1 for ON.
> > - */
> > -static u8
> > -getSafetyLevel(const char *z, int omitFull, u8 dflt)
> > -{
> > - /* 123456789 123456789 123 */
> > - static const char zText[] = "onoffalseyestruextrafull";
> > - static const u8 iOffset[] = { 0, 1, 2, 4, 9, 12, 15, 20 };
> > - static const u8 iLength[] = { 2, 2, 3, 5, 3, 4, 5, 4 };
> > - static const u8 iValue[] = { 1, 0, 0, 0, 1, 1, 3, 2 };
> > - /* on no off false yes true extra full */
> > - int i, n;
> > - if (sqlIsdigit(*z)) {
> > - return (u8) sqlAtoi(z);
> > - }
> > - n = sqlStrlen30(z);
> > - for (i = 0; i < ArraySize(iLength); i++) {
> > - if (iLength[i] == n
> > - && sqlStrNICmp(&zText[iOffset[i]], z, n) == 0
> > - && (!omitFull || iValue[i] <= 1)
> > - ) {
> > - return iValue[i];
> > - }
> > - }
> > - return dflt;
> > -}
> > -
> > -/*
> > - * Interpret the given string as a boolean value.
> > - */
> > -u8
> > -sqlGetBoolean(const char *z, u8 dflt)
> > -{
> > - return getSafetyLevel(z, 1, dflt) != 0;
> > -}
> > -
> > -/* The sqlGetBoolean() function is used by other modules but the
> > - * remainder of this file is specific to PRAGMA processing. So omit
> > - * the rest of the file if PRAGMAs are omitted from the build.
> > - */
> > -
> > /** Set result column names and types for a pragma. */
> > static void
> > vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> > @@ -128,17 +78,6 @@ vdbe_set_pragma_result_columns(struct Vdbe *v, const struct PragmaName *pragma)
> > }
> >
> > /*
> > - * Generate code to return a single integer value.
> > - */
> > -static void
> > -returnSingleInt(Vdbe * v, i64 value)
> > -{
> > - sqlVdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8 *)&value,
> > - value < 0 ? P4_INT64 : P4_UINT64);
> > - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> > -}
> > -
> > -/*
> > * Locate a pragma in the aPragmaName[] array.
> > */
> > static const PragmaName *
> > @@ -161,53 +100,6 @@ pragmaLocate(const char *zName)
> > return lwr > upr ? 0 : &aPragmaName[mid];
> > }
> >
> > -static void
> > -vdbe_emit_pragma_status(struct Parse *parse)
> > -{
> > - struct Vdbe *v = sqlGetVdbe(parse);
> > - struct session *user_session = current_session();
> > -
> > - sqlVdbeSetNumCols(v, 2);
> > - sqlVdbeSetColName(v, 0, COLNAME_NAME, "pragma_name", SQL_STATIC);
> > - sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "text", SQL_STATIC);
> > - sqlVdbeSetColName(v, 1, COLNAME_NAME, "pragma_value", SQL_STATIC);
> > - sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "integer", SQL_STATIC);
> > -
> > - parse->nMem = 2;
> > - for (int i = 0; i < ArraySize(aPragmaName); ++i) {
> > - if (aPragmaName[i].ePragTyp != PragTyp_FLAG)
> > - continue;
> > - sqlVdbeAddOp4(v, OP_String8, 0, 1, 0, aPragmaName[i].zName, 0);
> > - int val = (user_session->sql_flags & aPragmaName[i].iArg) != 0;
> > - sqlVdbeAddOp2(v, OP_Integer, val, 2);
> > - sqlVdbeAddOp2(v, OP_ResultRow, 1, 2);
> > - }
> > -}
> > -
> > -/**
> > - * Set tarantool backend default engine for SQL interface.
> > - * @param engine_name to set default.
> > - * @retval -1 on error.
> > - * @retval 0 on success.
> > - */
> > -static int
> > -sql_default_engine_set(const char *engine_name)
> > -{
> > - if (engine_name == NULL) {
> > - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> > - "'sql_default_engine' was not specified");
> > - return -1;
> > - }
> > - enum sql_storage_engine engine =
> > - STR2ENUM(sql_storage_engine, engine_name);
> > - if (engine == sql_storage_engine_MAX) {
> > - diag_set(ClientError, ER_NO_SUCH_ENGINE, engine_name);
> > - return -1;
> > - }
> > - current_session()->sql_default_engine = engine;
> > - return 0;
> > -}
> > -
> > /**
> > * This function handles PRAGMA TABLE_INFO(<table>).
> > *
> > @@ -373,22 +265,6 @@ sql_pragma_index_list(struct Parse *parse, const char *tbl_name)
> > }
> >
> > /*
> > - * @brief Check whether the specified token is a string or ID.
> > - * @param token - token to be examined
> > - * @return true - if the token value is enclosed into quotes (')
> > - * @return false in other cases
> > - * The empty value is considered to be a string.
> > - */
> > -static bool
> > -token_is_string(const struct Token* token)
> > -{
> > - if (!token || token->n == 0)
> > - return true;
> > - return token->n >= 2 && token->z[0] == '\'' &&
> > - token->z[token->n - 1] == '\'';
> > -}
> > -
> > -/*
> > * Process a pragma statement.
> > *
> > * Pragmas are of this form:
> > @@ -416,17 +292,12 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> > sql *db = pParse->db; /* The database connection */
> > Vdbe *v = sqlGetVdbe(pParse); /* Prepared statement */
> > const PragmaName *pPragma; /* The pragma */
> > - struct session *user_session = current_session();
> >
> > if (v == 0)
> > return;
> > sqlVdbeRunOnlyOnce(v);
> > pParse->nMem = 2;
> >
> > - if (pId == NULL) {
> > - vdbe_emit_pragma_status(pParse);
> > - return;
> > - }
> > zLeft = sql_name_from_token(db, pId);
> > if (zLeft == NULL) {
> > pParse->is_aborted = true;
> > @@ -456,38 +327,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> > goto pragma_out;
> > }
> > /* Register the result column names for pragmas that return results */
> > - if ((pPragma->mPragFlg & PragFlg_NoColumns) == 0 &&
> > - ((pPragma->mPragFlg & PragFlg_NoColumns1) == 0 || zRight == NULL))
> > - vdbe_set_pragma_result_columns(v, pPragma);
> > + vdbe_set_pragma_result_columns(v, pPragma);
> > /* Jump to the appropriate pragma handler */
> > switch (pPragma->ePragTyp) {
> >
> > - case PragTyp_FLAG:{
> > - if (zRight == NULL) {
> > - vdbe_set_pragma_result_columns(v, pPragma);
> > - returnSingleInt(v, (user_session->sql_flags &
> > - pPragma->iArg) != 0);
> > - } else {
> > - /* Mask of bits to set or clear. */
> > - int mask = pPragma->iArg;
> > - bool is_pragma_set = sqlGetBoolean(zRight, 0);
> > -
> > - if (is_pragma_set)
> > - user_session->sql_flags |= mask;
> > - else
> > - user_session->sql_flags &= ~mask;
> > -#if defined(SQL_DEBUG)
> > - if (mask == PARSER_TRACE_FLAG) {
> > - if (is_pragma_set)
> > - sqlParserTrace(stdout, "parser: ");
> > - else
> > - sqlParserTrace(0, 0);
> > - }
> > -#endif
> > - }
> > - break;
> > - }
> > -
> > case PragTyp_TABLE_INFO:
> > sql_pragma_table_info(pParse, zRight);
> > break;
> > @@ -565,54 +408,10 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
> > break;
> > }
> >
> > - case PragTyp_DEFAULT_ENGINE: {
> > - if (!token_is_string(pValue)) {
> > - diag_set(ClientError, ER_ILLEGAL_PARAMS,
> > - "string value is expected");
> > - pParse->is_aborted = true;
> > - goto pragma_out;
> > - }
> > - if (zRight == NULL) {
> > - const char *engine_name =
> > - sql_storage_engine_strs[current_session()->
> > - sql_default_engine];
> > - sqlVdbeLoadString(v, 1, engine_name);
> > - sqlVdbeAddOp2(v, OP_ResultRow, 1, 1);
> > - } else {
> > - if (sql_default_engine_set(zRight) != 0) {
> > - pParse->is_aborted = true;
> > - goto pragma_out;
> > - }
> > - sqlVdbeAddOp0(v, OP_Expire);
> > - }
> > - break;
> > - }
> > -
> > - case PragTyp_COMPOUND_SELECT_LIMIT: {
> > - if (zRight != NULL) {
> > - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT,
> > - sqlAtoi(zRight));
> > - }
> > - int retval =
> > - sql_limit(db, SQL_LIMIT_COMPOUND_SELECT, -1);
> > - returnSingleInt(v, retval);
> > - break;
> > - }
> > -
> > default:
> > unreachable();
> > } /* End of the PRAGMA switch */
> >
> > - /* The following block is a no-op unless SQL_DEBUG is
> > - * defined. Its only * purpose is to execute assert()
> > - * statements to verify that if the * PragFlg_NoColumns1 flag
> > - * is set and the caller specified an argument * to the PRAGMA,
> > - * the implementation has not added any OP_ResultRow *
> > - * instructions to the VM.
> > - */
> > - if ((pPragma->mPragFlg & PragFlg_NoColumns1) && zRight) {
> > - sqlVdbeVerifyNoResultRow(v);
> > - }
> > pragma_out:
> > sqlDbFree(db, zLeft);
> > sqlDbFree(db, zRight);
> > diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
> > index f337f0b..6c66d97 100644
> > --- a/src/box/sql/pragma.h
> > +++ b/src/box/sql/pragma.h
> > @@ -6,19 +6,14 @@
> >
> > /* The various pragma types */
> > #define PragTyp_COLLATION_LIST 3
> > -#define PragTyp_FLAG 5
> > #define PragTyp_FOREIGN_KEY_LIST 9
> > #define PragTyp_INDEX_INFO 10
> > #define PragTyp_INDEX_LIST 11
> > #define PragTyp_STATS 15
> > #define PragTyp_TABLE_INFO 17
> > -#define PragTyp_DEFAULT_ENGINE 25
> > -#define PragTyp_COMPOUND_SELECT_LIMIT 26
> >
> > /* Property flags associated with various pragma. */
> > #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
> > -#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
> > -#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
> > #define PragFlg_Result0 0x10 /* Acts as query when no argument */
> > #define PragFlg_Result1 0x20 /* Acts as query when has one argument */
> > #define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
> > @@ -93,51 +88,6 @@ static const char *const pragCName[] = {
> > /* 55 */ "text",
> > /* 56 */ "match",
> > /* 57 */ "text",
> > - /* Used by: defer_foreign_keys */
> > - /* 58 */ "defer_foreign_keys",
> > - /* 59 */ "integer",
> > - /* Used by: full_column_names */
> > - /* 60 */ "full_column_names",
> > - /* 61 */ "integer",
> > - /* Used by: parser_trace */
> > - /* 62 */ "parser_trace",
> > - /* 63 */ "integer",
> > - /* Used by: recursive_triggers */
> > - /* 64 */ "recursive_triggers",
> > - /* 65 */ "integer",
> > - /* Used by: reverse_unordered_selects */
> > - /* 66 */ "reverse_unordered_selects",
> > - /* 67 */ "integer",
> > - /* Used by: select_trace */
> > - /* 68 */ "select_trace",
> > - /* 69 */ "integer",
> > - /* Used by: sql_compound_select_limit */
> > - /* 70 */ "sql_compound_select_limit",
> > - /* 71 */ "integer",
> > - /* Used by: sql_default_engine */
> > - /* 72 */ "sql_default_engine",
> > - /* 73 */ "text",
> > - /* Used by: sql_trace */
> > - /* 74 */ "sql_trace",
> > - /* 75 */ "integer",
> > - /* Used by: vdbe_addoptrace */
> > - /* 76 */ "vdbe_addoptrace",
> > - /* 77 */ "integer",
> > - /* Used by: vdbe_debug */
> > - /* 78 */ "vdbe_debug",
> > - /* 79 */ "integer",
> > - /* Used by: vdbe_eqp */
> > - /* 80 */ "vdbe_eqp",
> > - /* 81 */ "integer",
> > - /* Used by: vdbe_listing */
> > - /* 82 */ "vdbe_listing",
> > - /* 83 */ "integer",
> > - /* Used by: vdbe_trace */
> > - /* 84 */ "vdbe_trace",
> > - /* 85 */ "integer",
> > - /* Used by: where_trace */
> > - /* 86 */ "where_trace",
> > - /* 87 */ "integer",
> > };
> >
> > /* Definitions of all built-in pragmas */
> > @@ -159,22 +109,12 @@ static const PragmaName aPragmaName[] = {
> > /* ePragFlg: */ PragFlg_Result0,
> > /* ColNames: */ 38, 2,
> > /* iArg: */ 0},
> > - { /* zName: */ "defer_foreign_keys",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 58, 1,
> > - /* iArg: */ SQL_DeferFKs},
> > { /* zName: */ "foreign_key_list",
> > /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
> > /* ePragFlg: */
> > PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> > /* ColNames: */ 42, 8,
> > /* iArg: */ 0},
> > - { /* zName: */ "full_column_names",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 60, 1,
> > - /* iArg: */ SQL_FullColNames},
> > { /* zName: */ "index_info",
> > /* ePragTyp: */ PragTyp_INDEX_INFO,
> > /* ePragFlg: */
> > @@ -187,47 +127,6 @@ static const PragmaName aPragmaName[] = {
> > PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> > /* ColNames: */ 32, 3,
> > /* iArg: */ 0},
> > -#if defined(SQL_DEBUG)
> > - { /* zName: */ "parser_trace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 62, 1,
> > - /* iArg: */ PARSER_TRACE_FLAG},
> > -#endif
> > - { /* zName: */ "recursive_triggers",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 64, 1,
> > - /* iArg: */ SQL_RecTriggers},
> > - { /* zName: */ "reverse_unordered_selects",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 66, 1,
> > - /* iArg: */ SQL_ReverseOrder},
> > -#if defined(SQL_DEBUG)
> > - { /* zName: */ "select_trace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 68, 1,
> > - /* iArg: */ SQL_SelectTrace},
> > -#endif
> > - { /* zName: */ "sql_compound_select_limit",
> > - /* ePragTyp: */ PragTyp_COMPOUND_SELECT_LIMIT,
> > - /* ePragFlg: */ PragFlg_Result0,
> > - /* ColNames: */ 70, 1,
> > - /* iArg: */ 0},
> > - { /* zName: */ "sql_default_engine",
> > - /* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 72, 1,
> > - /* iArg: */ 0},
> > -#if defined(SQL_DEBUG)
> > - { /* zName: */ "sql_trace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 74, 1,
> > - /* iArg: */ SQL_SqlTrace},
> > -#endif
> > { /* zName: */ "stats",
> > /* ePragTyp: */ PragTyp_STATS,
> > /* ePragFlg: */
> > @@ -240,38 +139,5 @@ static const PragmaName aPragmaName[] = {
> > PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
> > /* ColNames: */ 0, 6,
> > /* iArg: */ 0},
> > -#if defined(SQL_DEBUG)
> > - { /* zName: */ "vdbe_addoptrace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 76, 1,
> > - /* iArg: */ SQL_VdbeAddopTrace},
> > - { /* zName: */ "vdbe_debug",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 78, 1,
> > - /* iArg: */
> > - SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
> > - { /* zName: */ "vdbe_eqp",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 80, 1,
> > - /* iArg: */ SQL_VdbeEQP},
> > - { /* zName: */ "vdbe_listing",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 82, 1,
> > - /* iArg: */ SQL_VdbeListing},
> > - { /* zName: */ "vdbe_trace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 84, 1,
> > - /* iArg: */ SQL_VdbeTrace},
> > - { /* zName: */ "where_trace",
> > - /* ePragTyp: */ PragTyp_FLAG,
> > - /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
> > - /* ColNames: */ 86, 1,
> > - /* iArg: */ SQL_WhereTrace},
> > -#endif
> > };
> > /* Number of pragmas: 36 on by default, 47 total. */
> > diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> > index 27a4c41..927c674 100644
> > --- a/src/box/sql/sqlInt.h
> > +++ b/src/box/sql/sqlInt.h
> > @@ -333,6 +333,11 @@ enum sql_ret_code {
> > SQL_DONE = 2,
> > };
> >
> > +enum sql_setting_type {
> > + SQL_SESSION_SETTING = 0,
> > + SQL_GLOBAL_SETTING = 1,
> > +};
> > +
> > void *
> > sql_malloc(int);
> >
> > @@ -3946,8 +3951,6 @@ int
> > sql_rem_int(int64_t lhs, bool is_lhs_neg, int64_t rhs, bool is_rhs_neg,
> > int64_t *res, bool *is_res_neg);
> >
> > -u8 sqlGetBoolean(const char *z, u8);
> > -
> > const void *sqlValueText(sql_value *);
> > int sqlValueBytes(sql_value *);
> > void sqlValueSetStr(sql_value *, int, const void *,
> > @@ -4463,4 +4466,54 @@ int
> > sql_fieldno_by_name(struct Parse *parse_context, struct Expr *field_name,
> > uint32_t *fieldno);
> >
> > +/**
> > + * Create VDBE instructions to set new value of SQL setting.
> > + *
> > + * @param parse_context Parsing context.
> > + * @param name Name of the SQL setting.
> > + * @param value New value of the SQL setting.
> > + */
> > +void
> > +sql_set_settings(struct Parse *parse_context, struct Token *name,
> > + struct Expr *value);
> > +
> > +/**
> > + * Set a new value for boolean SQL setting.
> > + *
> > + * @param id ID of the SQL setting.
> > + * @param type type of the SQL setting.
> > + * @param value New value of the SQL setting.
> > + *
> > + * @retval 0 on success.
> > + * @retval -1 on error.
> > + */
> > +int
> > +sql_set_boolean_option(int id, enum sql_setting_type type, bool value);
> > +
> > +/**
> > + * Set a new value for string SQL setting.
> > + *
> > + * @param id ID of the SQL setting.
> > + * @param type type of the SQL setting.
> > + * @param value New value of the SQL setting.
> > + *
> > + * @retval 0 on success.
> > + * @retval -1 on error.
> > + */
> > +int
> > +sql_set_string_option(int id, enum sql_setting_type type, const char *value);
> > +
> > +/**
> > + * Set a new value for integer SQL setting.
> > + *
> > + * @param id ID of the SQL setting.
> > + * @param type type of the SQL setting.
> > + * @param value New value of the SQL setting.
> > + *
> > + * @retval 0 on success.
> > + * @retval -1 on error.
> > + */
> > +int
> > +sql_set_integer_option(int id, enum sql_setting_type type, int value);
> > +
> > #endif /* sqlINT_H */
> > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> > index 2e51a0d..788696f 100644
> > --- a/src/box/sql/vdbe.c
> > +++ b/src/box/sql/vdbe.c
> > @@ -5254,6 +5254,31 @@ case OP_IncMaxid: {
> > break;
> > }
> >
> > +/* Opcode: Set P1 P2 P3 * *
> > + *
> > + * Set new value to SQL setting. P1 is either SQL_SESSION_SETTING
> > + * or SQL_GLOBAL_SETTING. P2 is ID of the setting. P3 is an ID of
> > + * register that contains value of the setting.
> > + */
> > +case OP_Set: {
> > + assert(pOp->p1 == SQL_SESSION_SETTING || pOp->p1 == SQL_GLOBAL_SETTING);
> > + pIn3 = &aMem[pOp->p3];
> > +
> > + if ((pIn3->flags & MEM_Bool) != 0) {
> > + if (sql_set_boolean_option(pOp->p2, pOp->p1, pIn3->u.b) != 0)
> > + goto abort_due_to_error;
> > + } else if ((pIn3->flags & MEM_Str) != 0) {
> > + if (sql_set_string_option(pOp->p2, pOp->p1, pIn3->z) != 0)
> > + goto abort_due_to_error;
> > + } else {
> > + assert((pIn3->flags & MEM_Int) != 0 ||
> > + (pIn3->flags & MEM_UInt) != 0);
> > + if (sql_set_integer_option(pOp->p2, pOp->p1, pIn3->u.i) != 0)
> > + goto abort_due_to_error;
> > + }
> > + break;
> > +}
> > +
> > /* Opcode: Noop * * * * *
> > *
> > * Do nothing. This instruction is often useful as a jump
> > diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
> > index 7d7498f..cc530ce 100755
> > --- a/test/sql-tap/analyze4.test.lua
> > +++ b/test/sql-tap/analyze4.test.lua
> > @@ -70,9 +70,9 @@ test:do_test(
> > function()
> > return test:execsql([[
> > UPDATE t1 SET b='x' WHERE a%2;
> > --- pragma vdbe_debug=1;
> > +-- set vdbe_debug=true;
> > ANALYZE;
> > --- pragma vdbe_debug=0;
> > +-- set vdbe_debug=false;
> > SELECT "idx", "stat" FROM "_sql_stat1" WHERE "tbl"='T1' ORDER BY "idx";
> > ]])
> > end, {
> > diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
> > index 39e4796..7b36379 100755
> > --- a/test/sql-tap/autoinc.test.lua
> > +++ b/test/sql-tap/autoinc.test.lua
> > @@ -640,7 +640,7 @@ test:do_test(
> > -- </autoinc-10.3>
> > })
> >
> > -test:catchsql(" pragma recursive_triggers = off ")
> > +test:catchsql("SET sql_recursive_triggers = false")
> > -- Ticket #3928. Make sure that triggers to not make extra slots in
> > -- the sql_SEQUENCE table.
> > --
> > diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
> > index de03d7c..1037bed 100755
> > --- a/test/sql-tap/colname.test.lua
> > +++ b/test/sql-tap/colname.test.lua
> > @@ -43,14 +43,14 @@ local function lreplace(arr, pos, len, val)
> > end
> >
> > test:do_test(
> > - "colname-1.1",
> > + "colname-1.2",
> > function()
> > - return test:execsql "PRAGMA full_column_names"
> > - end, {
> > + return box.space._vsession_settings:get("sql_full_column_names").value
> > + end,
> > -- <colname-1.2>
> > - 0
> > + false
> > -- </colname-1.2>
> > - })
> > + )
> >
> > -- Tests for then short=ON and full=any
> > --
> > @@ -163,7 +163,7 @@ test:do_test(
> > "colname-3.1",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='OFF';
> > + SET sql_full_column_names = false;
> > CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
> > FROM tabc, txyz ORDER BY 1 LIMIT 1;
> > CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> > @@ -283,7 +283,7 @@ test:do_test(
> > "colname-4.1",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='ON';
> > + SET sql_full_column_names = true;
> > CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
> > FROM tabc, txyz ORDER BY 1 LIMIT 1;
> > CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
> > @@ -440,7 +440,7 @@ test:do_test(
> > -- instead of reconnect to database
> > -- we are just turning settings to default state
> > test:execsql([[
> > - PRAGMA full_column_names='OFF';
> > + SET sql_full_column_names = false;
> > ]])
> > test:execsql [=[
> > CREATE TABLE t6(a INT primary key, "'a'" INT, """a""" INT, "[a]" INT, "`a`" INT);
> > diff --git a/test/sql-tap/fkey2.test.lua b/test/sql-tap/fkey2.test.lua
> > index 264616d..de89790 100755
> > --- a/test/sql-tap/fkey2.test.lua
> > +++ b/test/sql-tap/fkey2.test.lua
> > @@ -450,7 +450,7 @@ test:do_execsql_test(
> > test:do_execsql_test(
> > "fkey2-4.2",
> > [[
> > - PRAGMA recursive_triggers = off;
> > + SET sql_recursive_triggers = false;
> > DELETE FROM t1 WHERE node = 1;
> > SELECT node FROM t1;
> > ]], {
> > @@ -473,7 +473,7 @@ test:do_execsql_test(
> > test:do_execsql_test(
> > "fkey2-4.4",
> > [[
> > - PRAGMA recursive_triggers = on;
> > + SET sql_recursive_triggers = true;
> > DROP TABLE t2;
> > DROP TABLE t1;
> > CREATE TABLE t1(
> > diff --git a/test/sql-tap/gh2548-select-compound-limit.test.lua b/test/sql-tap/gh2548-select-compound-limit.test.lua
> > index f578870..c802003 100755
> > --- a/test/sql-tap/gh2548-select-compound-limit.test.lua
> > +++ b/test/sql-tap/gh2548-select-compound-limit.test.lua
> > @@ -1,6 +1,6 @@
> > #!/usr/bin/env tarantool
> > test = require("sqltester")
> > -test:plan(14)
> > +test:plan(13)
> >
> > -- box.cfg{wal_mode='none'}
> >
> > @@ -53,7 +53,6 @@ for _, term in ipairs({'UNION', 'UNION ALL', 'INTERSECT', 'EXCEPT'}) do
> > -- end
> > end
> >
> > -
> > test:do_catchsql_test(
> > "gh2548-select-compound-limit-2",
> > select_string_last, {
> > @@ -63,20 +62,10 @@ test:do_catchsql_test(
> > })
> >
> > test:do_execsql_test(
> > - "gh2548-select-compound-limit-3.1", [[
> > - pragma sql_compound_select_limit
> > - ]], {
> > - -- <gh2548-select-compound-limit-3.1>
> > - 30
> > - -- </gh2548-select-compound-limit-3.1>
> > - })
> > -
> > -test:do_execsql_test(
> > "gh2548-select-compound-limit-3.2", [[
> > - pragma sql_compound_select_limit=31
> > + SET sql_compound_select_limit = 31;
> > ]], {
> > -- <gh2548-select-compound-limit-3.2>
> > - 31
> > -- </gh2548-select-compound-limit-3.2>
> > })
> >
> > @@ -90,10 +79,9 @@ test:do_execsql_test(
> >
> > test:do_execsql_test(
> > "gh2548-select-compound-limit-3.4", [[
> > - pragma sql_compound_select_limit=0
> > + SET sql_compound_select_limit = 0;
> > ]], {
> > -- <gh2548-select-compound-limit-3.4>
> > - 0
> > -- </gh2548-select-compound-limit-3.4>
> > })
> >
> > diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
> > index 0f34114..c50e3fd 100644
> > --- a/test/sql-tap/lua/sqltester.lua
> > +++ b/test/sql-tap/lua/sqltester.lua
> > @@ -413,7 +413,7 @@ box.cfg{
> > }
> >
> > local engine = test_run and test_run:get_cfg('engine') or 'memtx'
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > function test.engine(self)
> > return engine
> > diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
> > index b84093e..339c9d7 100755
> > --- a/test/sql-tap/misc1.test.lua
> > +++ b/test/sql-tap/misc1.test.lua
> > @@ -219,7 +219,7 @@ test:do_test(
> > local r = test:execsql([[
> > CREATE TABLE t1(a TEXT primary KEY);
> > INSERT INTO t1 VALUES('hi');
> > - PRAGMA full_column_names=on;
> > + SET sql_full_column_names = true;
> > --SELECT rowid, * FROM t1;
> > SELECT * FROM t1;
> > ]])
> > diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua
> > index b3821dc..d6f8b54 100755
> > --- a/test/sql-tap/pragma.test.lua
> > +++ b/test/sql-tap/pragma.test.lua
> > @@ -1,7 +1,7 @@
> > #!/usr/bin/env tarantool
> > test = require("sqltester")
> >
> > -test:plan(23)
> > +test:plan(10)
> >
> > test:do_catchsql_test(
> > "pragma-1.3",
> > @@ -19,66 +19,7 @@ test:do_catchsql_test(
> > [[
> > pragma sql_default_engine='creepy';
> > ]], {
> > - 1, "Space engine 'creepy' does not exist"
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-2.2",
> > - [[
> > - pragma sql_default_engine='vinyl';
> > - ]], {
> > - 0
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-2.3",
> > - [[
> > - pragma sql_default_engine='memtx';
> > - ]], {
> > - 0
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-2.4",
> > - [[
> > - pragma sql_default_engine 'memtx';
> > - ]], {
> > - 1, "Syntax error near ''memtx''"
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-2.5",
> > - [[
> > - pragma sql_default_engine 1;
> > - ]], {
> > - 1, "Syntax error near '1'"
> > -})
> > -
> > ---
> > --- gh-3832: Some statements do not return column type
> > ---
> > --- Check that "PRAGMA sql_default_engine" called without arguments
> > --- returns currently set sql_default_engine.
> > -test:do_execsql_test(
> > - "pragma-3.1",
> > - [[
> > - pragma sql_default_engine='vinyl';
> > - pragma sql_default_engine;
> > - ]], {
> > - -- <pragma-3.1>
> > - 'vinyl'
> > - -- </pragma-3.1>
> > -})
> > -
> > -test:do_execsql_test(
> > - "pragma-3.2",
> > - [[
> > - pragma sql_default_engine='memtx';
> > - pragma sql_default_engine;
> > - ]], {
> > - -- <pragma-3.2>
> > - 'memtx'
> > - -- </pragma-3.2>
> > + 1, "Pragma 'SQL_DEFAULT_ENGINE' does not exist"
> > })
> >
> > --
> > @@ -187,76 +128,4 @@ test:do_execsql_test(
> > -- </pragma-8.4>
> > })
> >
> > ----
> > ---- pragma sql_default_engine accepts string values and rejects IDs
> > ----
> > -test:do_catchsql_test(
> > - "pragma-9.1",
> > - [[
> > - pragma sql_default_engine(the_engine);
> > - ]], {
> > - -- <pragma-9.1>
> > - 1, "Illegal parameters, string value is expected"
> > - -- </pragma-9.1>
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-9.2",
> > - [[
> > - pragma sql_default_engine(THE_ENGINE);
> > - ]], {
> > - -- <pragma-9.2>
> > - 1, "Illegal parameters, string value is expected"
> > - -- </pragma-9.2>
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-9.3",
> > - [[
> > - pragma sql_default_engine("THE_ENGINE");
> > - ]], {
> > - -- <pragma-9.3>
> > - 1, "Illegal parameters, string value is expected"
> > - -- </pragma-9.3>
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-9.4",
> > - [[
> > - pragma sql_default_engine('THE_ENGINE');
> > - ]], {
> > - -- <pragma-9.4>
> > - 1, "Space engine 'THE_ENGINE' does not exist"
> > - -- </pragma-9.4>
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-9.5",
> > - [[
> > - pragma sql_default_engine(memtx);
> > - ]], {
> > - -- <pragma-9.5>
> > - 1, "Illegal parameters, string value is expected"
> > - -- </pragma-9.5>
> > -})
> > -
> > -test:do_catchsql_test(
> > - "pragma-9.6",
> > - [[
> > - pragma sql_default_engine("memtx");
> > - ]], {
> > - -- <pragma-9.6>
> > - 1, "Illegal parameters, string value is expected"
> > - -- </pragma-9.6>
> > -})
> > -
> > -test:do_execsql_test(
> > - "pragma-9.7",
> > - [[
> > - pragma sql_default_engine('memtx');
> > - ]], {
> > - -- <pragma-9.7>
> > - -- </pragma-9.7>
> > -})
> > -
> > test:finish_test()
> > diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
> > index d8fe7a9..2caa612 100755
> > --- a/test/sql-tap/select1.test.lua
> > +++ b/test/sql-tap/select1.test.lua
> > @@ -916,7 +916,7 @@ test:do_catchsql2_test(
> > test:do_test(
> > "select1-6.1.1",
> > function()
> > - test:execsql "PRAGMA full_column_names=on"
> > + test:execsql "SET sql_full_column_names = true"
> > return test:catchsql2 "SELECT f1 FROM test1 ORDER BY f2"
> > end, {
> > -- <select1-6.1.1>
> > @@ -952,7 +952,7 @@ test:do_test(
> > msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
> > end)
> > v = v == true and {0} or {1}
> > - test:execsql "PRAGMA full_column_names=off"
> > + test:execsql "SET sql_full_column_names = false"
> > return table.insert(v,msg) or v
> > end, {
> > -- <select1-6.1.4>
> > @@ -1043,13 +1043,13 @@ test:do_catchsql2_test(
> > test:do_test(
> > "select1-6.5.1",
> > function()
> > - test:execsql2 "PRAGMA full_column_names=on"
> > + test:execsql2 "SET sql_full_column_names = true"
> > local msg
> > v = pcall( function ()
> > msg = test:execsql2 "SELECT test1.f1+F2 FROM test1 ORDER BY f2"
> > end)
> > v = v == true and {0} or {1}
> > - test:execsql2 "PRAGMA full_column_names=off"
> > + test:execsql2 "SET sql_full_column_names = false"
> > return table.insert(v,msg) or v
> > end, {
> > -- <select1-6.5.1>
> > @@ -1124,7 +1124,7 @@ test:do_test(
> > "select1-6.9.3",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='OFF';
> > + SET sql_full_column_names = false;
> > ]]
> > return test:execsql2 [[
> > SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> > @@ -1139,7 +1139,7 @@ test:do_test(
> > "select1-6.9.4",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='ON';
> > + SET sql_full_column_names = true;
> > ]]
> > return test:execsql2 [[
> > SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
> > @@ -1154,7 +1154,7 @@ test:do_test(
> > "select1-6.9.5",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='ON';
> > + SET sql_full_column_names = true;
> > ]]
> > return test:execsql2 [[
> > SELECT 123.45;
> > @@ -1235,7 +1235,7 @@ test:do_test(
> > "select1-6.9.11",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='ON';
> > + SET sql_full_column_names = true;
> > ]]
> > return test:execsql2 [[
> > SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
> > @@ -1260,7 +1260,7 @@ test:do_test(
> > "select1-6.9.13",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='OFF';
> > + SET sql_full_column_names = false;
> > ]]
> > return test:execsql2 [[
> > SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> > @@ -1285,7 +1285,7 @@ test:do_test(
> > "select1-6.9.15",
> > function()
> > test:execsql [[
> > - PRAGMA full_column_names='ON';
> > + SET sql_full_column_names = true;
> > ]]
> > return test:execsql2 [[
> > SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
> > @@ -1307,7 +1307,7 @@ test:do_execsql2_test(
> > })
> >
> > test:execsql [[
> > - PRAGMA full_column_names='OFF';
> > + SET sql_full_column_names = false;
> > ]]
> > test:do_catchsql2_test(
> > "select1-6.10",
> > diff --git a/test/sql-tap/tkt3731.test.lua b/test/sql-tap/tkt3731.test.lua
> > index 454cf67..57e7f3f 100755
> > --- a/test/sql-tap/tkt3731.test.lua
> > +++ b/test/sql-tap/tkt3731.test.lua
> > @@ -22,7 +22,7 @@ test:plan(3)
> > -- The tests in this file were written before sql supported recursive
> > -- trigger invocation, and some tests depend on that to pass. So disable
> > -- recursive triggers for this file.
> > -test:catchsql " pragma recursive_triggers = off "
> > +test:catchsql("SET sql_recursive_triggers = false")
> > test:do_execsql_test(
> > "tkt3731-1.1",
> > [[
> > diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
> > index 6e60050..dbe54db 100755
> > --- a/test/sql-tap/trigger2.test.lua
> > +++ b/test/sql-tap/trigger2.test.lua
> > @@ -58,7 +58,7 @@ test:plan(26)
> > -- The tests in this file were written before sql supported recursive
> > -- trigger invocation, and some tests depend on that to pass. So disable
> > -- recursive triggers for this file.
> > -test:catchsql " pragma recursive_triggers = off "
> > +test:catchsql("SET sql_recursive_triggers = false")
> > -- 1.
> > ii = 0
> > tbl_definitions = { "CREATE TABLE tbl (id INT PRIMARY KEY AUTOINCREMENT, a INTEGER UNIQUE, b INT );",
> > diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
> > index cf7dd7b..f9b7034 100755
> > --- a/test/sql-tap/triggerC.test.lua
> > +++ b/test/sql-tap/triggerC.test.lua
> > @@ -1,6 +1,6 @@
> > #!/usr/bin/env tarantool
> > test = require("sqltester")
> > -test:plan(48)
> > +test:plan(45)
> >
> > --!./tcltestrunner.lua
> > -- 2009 August 24
> > @@ -36,12 +36,9 @@ testprefix = "triggerC"
> > -- REPLACE conflict resolution. And that they are not fired
> > -- if recursive triggers are not enabled.
> > --
> > --- triggerC-6.*: Test that the recursive_triggers pragma returns correct
> > --- results when invoked without an argument.
> > ---
> > -- Enable recursive triggers for this file.
> > --
> > -test:execsql " PRAGMA recursive_triggers = on "
> > +test:execsql("SET sql_recursive_triggers = true;")
> > ---------------------------------------------------------------------------
> > -- This block of tests, triggerC-1.*, are not aimed at any specific
> > -- property of the triggers sub-system. They were created to debug
> > @@ -504,7 +501,7 @@ test:do_execsql_test(
> > test:do_execsql_test(
> > "triggerC-5.3.0",
> > [[
> > - PRAGMA recursive_triggers = off
> > + SET sql_recursive_triggers = false
> > ]], {
> > -- <triggerC-5.3.0>
> >
> > @@ -534,49 +531,13 @@ test:do_execsql_test(
> > test:do_execsql_test(
> > "triggerC-5.3.8",
> > [[
> > - PRAGMA recursive_triggers = on
> > + SET sql_recursive_triggers = true
> > ]], {
> > -- <triggerC-5.3.8>
> >
> > -- </triggerC-5.3.8>
> > })
> >
> > ----------------------------------------------------------------------------
> > --- This block of tests, triggerC-6.*, tests that "PRAGMA recursive_triggers"
> > --- statements return the current value of the recursive triggers flag.
> > ---
> > -test:do_execsql_test(
> > - "triggerC-6.1",
> > - [[
> > - PRAGMA recursive_triggers
> > - ]], {
> > - -- <triggerC-6.1>
> > - 1
> > - -- </triggerC-6.1>
> > - })
> > -
> > -test:do_execsql_test(
> > - "triggerC-6.2",
> > - [[
> > - PRAGMA recursive_triggers = off;
> > - PRAGMA recursive_triggers;
> > - ]], {
> > - -- <triggerC-6.2>
> > - 0
> > - -- </triggerC-6.2>
> > - })
> > -
> > -test:do_execsql_test(
> > - "triggerC-6.3",
> > - [[
> > - PRAGMA recursive_triggers = on;
> > - PRAGMA recursive_triggers;
> > - ]], {
> > - -- <triggerC-6.3>
> > - 1
> > - -- </triggerC-6.3>
> > - })
> > -
> > -- MUST_WORK_TEST
> > -- #-------------------------------------------------------------------------
> > -- # Test some of the "undefined behaviour" associated with triggers. The
> > @@ -890,7 +851,7 @@ test:execsql(
> > test:do_execsql_test(
> > "triggerC-13.1",
> > [[
> > - PRAGMA recursive_triggers = 'ON';
> > + SET sql_recursive_triggers = true;
> > CREATE TABLE t12(id INTEGER PRIMARY KEY, a INT, b INT);
> > INSERT INTO t12 VALUES(1, 1, 2);
> > CREATE TRIGGER tr12 AFTER UPDATE ON t12 FOR EACH ROW BEGIN
> > @@ -974,7 +935,7 @@ test:do_execsql_test(
> > test:do_execsql_test(
> > "triggerC-15.1.1",
> > [[
> > - PRAGMA recursive_triggers = 1;
> > + SET sql_recursive_triggers = true;
> > CREATE TABLE node(
> > id int not null primary key,
> > pid int not null default 0,
> > diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
> > index ac0389a..992a3c7 100755
> > --- a/test/sql-tap/update.test.lua
> > +++ b/test/sql-tap/update.test.lua
> > @@ -442,7 +442,6 @@ test:do_execsql_test("update-5.6.5", [[
> >
> > -- Repeat the previous sequence of tests with a different index.
> > --
> > ---test:execsql "PRAGMA synchronous='FULL'"
> > test:do_test("update-6.0", function()
> > test:execsql "DROP INDEX idx1 ON test1"
> > test:execsql "CREATE INDEX idx1 ON test1(f2)"
> > diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
> > index b82575f..21675d5 100755
> > --- a/test/sql-tap/whereA.test.lua
> > +++ b/test/sql-tap/whereA.test.lua
> > @@ -14,7 +14,7 @@ test:plan(17)
> > --
> > -------------------------------------------------------------------------
> > -- This file implements regression tests for sql library. The
> > --- focus of this file is testing the reverse_select_order pragma.
> > +-- focus of this file is testing the reverse_select_order option.
> > --
> > -- $Id: whereA.test,v 1.3 2009/06/10 19:33:29 drh Exp $
> > -- ["set","testdir",[["file","dirname",["argv0"]]]]
> > @@ -39,7 +39,7 @@ test:do_test(
> > "whereA-1.2",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=1;
> > + SET sql_reverse_unordered_selects = true;
> > SELECT * FROM t1;
> > ]]
> > end, {
> > @@ -55,7 +55,7 @@ test:do_test(
> > --db close
> > --sql db test.db
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=1;
> > + SET sql_reverse_unordered_selects = true;
> > SELECT * FROM t1;
> > ]]
> > end, {
> > @@ -68,7 +68,7 @@ test:do_test(
> > -- db close
> > -- sql db test.db
> > -- db eval {
> > --- PRAGMA reverse_unordered_selects=1;
> > +-- SET sql_reverse_unordered_selects = true;
> > -- SELECT * FROM t1 ORDER BY rowid;
> > -- }
> > -- } {1 2 3 2 hello world 3 4.53 {}}
> > @@ -76,11 +76,11 @@ test:do_test(
> > "whereA-1.6",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects;
> > + SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_reverse_unordered_selects';
> > ]]
> > end, {
> > -- <whereA-1.6>
> > - 1
> > + true
> > -- </whereA-1.6>
> > })
> >
> > @@ -108,7 +108,7 @@ test:do_test(
> > "whereA-2.1",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=0;
> > + SET sql_reverse_unordered_selects = false;
> > SELECT * FROM t1 WHERE a>0;
> > ]]
> > end, {
> > @@ -121,7 +121,7 @@ test:do_test(
> > "whereA-2.2",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=1;
> > + SET sql_reverse_unordered_selects = true;
> > SELECT * FROM t1 WHERE a>0;
> > ]]
> > end, {
> > @@ -132,7 +132,7 @@ test:do_test(
> >
> > -- do_test whereA-2.3 {
> > -- db eval {
> > --- PRAGMA reverse_unordered_selects=1;
> > +-- SET sql_reverse_unordered_selects = true;
> > -- SELECT * FROM t1 WHERE a>0 ORDER BY rowid;
> > -- }
> > -- } {1 2 3 2 hello world 3 4.53 {}}
> > @@ -140,7 +140,7 @@ test:do_test(
> > "whe:reA-3.1",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=0;
> > + SET sql_reverse_unordered_selects = false;
> > SELECT * FROM t1 WHERE b>0;
> > ]]
> > end, {
> > @@ -153,7 +153,7 @@ test:do_test(
> > "whereA-3.2",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=1;
> > + SET sql_reverse_unordered_selects = true;
> > SELECT * FROM t1 WHERE b>0;
> > ]]
> > end, {
> > @@ -166,7 +166,7 @@ test:do_test(
> > "whereA-3.3",
> > function()
> > return test:execsql [[
> > - PRAGMA reverse_unordered_selects=1;
> > + SET sql_reverse_unordered_selects = true;
> > SELECT * FROM t1 WHERE b>0 ORDER BY b;
> > ]]
> > end, {
> > diff --git a/test/sql/check-clear-ephemeral.result b/test/sql/check-clear-ephemeral.result
> > index 7d0be5f..3b12457 100644
> > --- a/test/sql/check-clear-ephemeral.result
> > +++ b/test/sql/check-clear-ephemeral.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries
> > box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> > ---
> > diff --git a/test/sql/check-clear-ephemeral.test.lua b/test/sql/check-clear-ephemeral.test.lua
> > index 929a6c9..2ecf11c 100644
> > --- a/test/sql/check-clear-ephemeral.test.lua
> > +++ b/test/sql/check-clear-ephemeral.test.lua
> > @@ -1,13 +1,13 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > -- box.cfg()
> >
> > -- create space
> > box.execute("CREATE TABLE t1(a INT,b INT,c INT,PRIMARY KEY(b,c));")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries
> > box.execute("WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000) INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;")
> > diff --git a/test/sql/checks.result b/test/sql/checks.result
> > index a952b2b..f9a6772 100644
> > --- a/test/sql/checks.result
> > +++ b/test/sql/checks.result
> > @@ -11,7 +11,7 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -736,7 +736,7 @@ physics_ck:drop()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
> > index 4d33823..ffcbd26 100644
> > --- a/test/sql/checks.test.lua
> > +++ b/test/sql/checks.test.lua
> > @@ -2,7 +2,7 @@ env = require('test_run')
> > test_run = env.new()
> > test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > --
> > -- gh-3272: Move SQL CHECK into server
> > @@ -240,7 +240,7 @@ physics_ck:drop()
> > -- :enable configurator.
> > --
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > box.execute("CREATE TABLE test(a INT PRIMARY KEY);");
> > box.execute('ALTER TABLE test ADD CONSTRAINT CK CHECK(a < 5);')
> > box.space.TEST:insert({10})
> > diff --git a/test/sql/clear.result b/test/sql/clear.result
> > index afa6520..baeb15e 100644
> > --- a/test/sql/clear.result
> > +++ b/test/sql/clear.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON;")
> > +-- box.execute("SET vdbe_debug=ON;")
> > -- Seed entry
> > for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> > ---
> > diff --git a/test/sql/clear.test.lua b/test/sql/clear.test.lua
> > index 4c58767..8d5e8fb 100644
> > --- a/test/sql/clear.test.lua
> > +++ b/test/sql/clear.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> > box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON;")
> > +-- box.execute("SET vdbe_debug=ON;")
> >
> > -- Seed entry
> > for i=1, 100 do box.execute(string.format("INSERT INTO zoobar VALUES (%d, %d, 'c3', 444)", i+i, i)) end
> > diff --git a/test/sql/collation.result b/test/sql/collation.result
> > index 11962ef..dc11d28 100644
> > --- a/test/sql/collation.result
> > +++ b/test/sql/collation.result
> > @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
> > index 1be28b3..5e33562 100644
> > --- a/test/sql/collation.test.lua
> > +++ b/test/sql/collation.test.lua
> > @@ -1,7 +1,7 @@
> > remote = require('net.box')
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- gh-3010: COLLATE after LIMIT should throw an error
> >
> > diff --git a/test/sql/ddl.result b/test/sql/ddl.result
> > index 28acf37..af833d0 100644
> > --- a/test/sql/ddl.result
> > +++ b/test/sql/ddl.result
> > @@ -8,7 +8,7 @@ json = require('json')
> > engine = test_run:get_cfg('engine')
> > | ---
> > | ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > | ---
> > | - row_count: 0
> > | ...
> > diff --git a/test/sql/ddl.test.lua b/test/sql/ddl.test.lua
> > index 6067b61..b6f0c81 100644
> > --- a/test/sql/ddl.test.lua
> > +++ b/test/sql/ddl.test.lua
> > @@ -1,7 +1,7 @@
> > test_run = require('test_run').new()
> > json = require('json')
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > --
> > -- gh-4086: SQL transactional DDL.
> > diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
> > index ca58feb..3d58daf 100644
> > --- a/test/sql/delete-multiple-idx.result
> > +++ b/test/sql/delete-multiple-idx.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
> > - row_count: 1
> > ...
> > -- Debug.
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries.
> > box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> > ---
> > diff --git a/test/sql/delete-multiple-idx.test.lua b/test/sql/delete-multiple-idx.test.lua
> > index a81cccc..2715d2f 100644
> > --- a/test/sql/delete-multiple-idx.test.lua
> > +++ b/test/sql/delete-multiple-idx.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -9,7 +9,7 @@ box.execute("CREATE TABLE t3(id INT primary key,x INT,y INT);");
> > box.execute("CREATE UNIQUE INDEX t3y ON t3(y);");
> >
> > -- Debug.
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries.
> > box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
> > diff --git a/test/sql/delete.result b/test/sql/delete.result
> > index e27c79d..9aa074f 100644
> > --- a/test/sql/delete.result
> > +++ b/test/sql/delete.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries
> > box.execute("INSERT INTO t1 VALUES(1, 2);");
> > ---
> > diff --git a/test/sql/delete.test.lua b/test/sql/delete.test.lua
> > index 75448d4..ff1e622 100644
> > --- a/test/sql/delete.test.lua
> > +++ b/test/sql/delete.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> > box.execute("CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a, b));");
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries
> > box.execute("INSERT INTO t1 VALUES(1, 2);");
> > diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
> > index e8eb642..551e56f 100644
> > --- a/test/sql/drop-index.result
> > +++ b/test/sql/drop-index.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -23,7 +23,7 @@ box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> > -- Dummy entry
> > box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> > ---
> > diff --git a/test/sql/drop-index.test.lua b/test/sql/drop-index.test.lua
> > index 8cd86ee..fd420b6 100644
> > --- a/test/sql/drop-index.test.lua
> > +++ b/test/sql/drop-index.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -11,7 +11,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zzoobar(c1, c4)")
> > box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Dummy entry
> > box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)")
> > diff --git a/test/sql/drop-table.result b/test/sql/drop-table.result
> > index 7bc073d..ef4c5cf 100644
> > --- a/test/sql/drop-table.result
> > +++ b/test/sql/drop-table.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -15,7 +15,7 @@ box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> > box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
> > ---
> > - row_count: 1
> > diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua
> > index a310db1..f0b1645 100644
> > --- a/test/sql/drop-table.test.lua
> > +++ b/test/sql/drop-table.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> > box.execute("CREATE TABLE zzzoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zzzoobar VALUES (111, 222, 'c3', 444)")
> >
> > box.execute("CREATE INDEX zb ON zzzoobar(c1, c3)")
> >
> > diff --git a/test/sql/engine.result b/test/sql/engine.result
> > index 3ee93ad..b392566 100644
> > --- a/test/sql/engine.result
> > +++ b/test/sql/engine.result
> > @@ -4,7 +4,7 @@ env = require('test_run')
> > test_run = env.new()
> > ---
> > ...
> > -box.execute("pragma sql_default_engine='vinyl'")
> > +box.execute("set sql_default_engine='vinyl'")
> > ---
> > - row_count: 0
> > ...
> > @@ -16,7 +16,7 @@ box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> > ---
> > - row_count: 1
> > ...
> > -box.execute("pragma sql_default_engine='memtx'")
> > +box.execute("set sql_default_engine='memtx'")
> > ---
> > - row_count: 0
> > ...
> > @@ -66,7 +66,7 @@ assert(box.space.T1_MEMTX.engine == 'memtx')
> > ---
> > - true
> > ...
> > -box.execute("pragma sql_default_engine='vinyl'")
> > +box.execute("set sql_default_engine='vinyl'")
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
> > index 112d3d3..bc16cc0 100644
> > --- a/test/sql/engine.test.lua
> > +++ b/test/sql/engine.test.lua
> > @@ -1,11 +1,11 @@
> > env = require('test_run')
> > test_run = env.new()
> >
> > -box.execute("pragma sql_default_engine='vinyl'")
> > +box.execute("set sql_default_engine='vinyl'")
> > box.execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> > box.execute("CREATE TABLE t2_vinyl(a INT PRIMARY KEY, b INT, c INT);")
> >
> > -box.execute("pragma sql_default_engine='memtx'")
> > +box.execute("set sql_default_engine='memtx'")
> > box.execute("CREATE TABLE t3_memtx(a INT PRIMARY KEY, b INT, c INT);")
> >
> > assert(box.space.T1_VINYL.engine == 'vinyl')
> > @@ -22,7 +22,7 @@ box.execute("CREATE TABLE t1_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> > assert(box.space.T1_VINYL.engine == 'vinyl')
> > box.execute("CREATE TABLE t1_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> > assert(box.space.T1_MEMTX.engine == 'memtx')
> > -box.execute("pragma sql_default_engine='vinyl'")
> > +box.execute("set sql_default_engine='vinyl'")
> > box.execute("CREATE TABLE t2_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
> > assert(box.space.T2_VINYL.engine == 'vinyl')
> > box.execute("CREATE TABLE t2_memtx (id INT PRIMARY KEY) WITH ENGINE = 'memtx'")
> > diff --git a/test/sql/errinj.result b/test/sql/errinj.result
> > index 7ab522f..c94afae 100644
> > --- a/test/sql/errinj.result
> > +++ b/test/sql/errinj.result
> > @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
> > index b978767..d21629d 100644
> > --- a/test/sql/errinj.test.lua
> > +++ b/test/sql/errinj.test.lua
> > @@ -1,7 +1,7 @@
> > remote = require('net.box')
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > errinj = box.error.injection
> > fiber = require('fiber')
> >
> > diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
> > index a0a67a1..6083d19 100644
> > --- a/test/sql/func-recreate.result
> > +++ b/test/sql/func-recreate.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
> > index 0b32ea9..a819587 100644
> > --- a/test/sql/func-recreate.test.lua
> > +++ b/test/sql/func-recreate.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Check errors during function create process
> > fiber = require('fiber')
> > diff --git a/test/sql/gh-2362-select-access-rights.result b/test/sql/gh-2362-select-access-rights.result
> > index b15b0da..f929914 100644
> > --- a/test/sql/gh-2362-select-access-rights.result
> > +++ b/test/sql/gh-2362-select-access-rights.result
> > @@ -7,7 +7,7 @@ engine = test_run:get_cfg('engine')
> > nb = require('net.box')
> > ---
> > ...
> > -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> > +box.execute("SET sql_default_engine='"..engine.."'")
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-2362-select-access-rights.test.lua b/test/sql/gh-2362-select-access-rights.test.lua
> > index f2b66b6..5666b68 100644
> > --- a/test/sql/gh-2362-select-access-rights.test.lua
> > +++ b/test/sql/gh-2362-select-access-rights.test.lua
> > @@ -2,7 +2,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > nb = require('net.box')
> >
> > -box.execute("PRAGMA sql_default_engine='"..engine.."'")
> > +box.execute("SET sql_default_engine='"..engine.."'")
> > box.execute("CREATE TABLE t1 (s1 INT PRIMARY KEY, s2 INT UNIQUE);")
> > box.execute("CREATE TABLE t2 (s1 INT PRIMARY KEY);")
> > box.execute("INSERT INTO t1 VALUES (1, 1);")
> > diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result
> > index 021d037..35daaf2 100644
> > --- a/test/sql/gh-2929-primary-key.result
> > +++ b/test/sql/gh-2929-primary-key.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
> > index 9cc6cd5..f419668 100644
> > --- a/test/sql/gh-2929-primary-key.test.lua
> > +++ b/test/sql/gh-2929-primary-key.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- All tables in SQL are now WITHOUT ROW ID, so if user
> > -- tries to create table without a primary key, an appropriate error message
> > diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result
> > index d2938cd..11fed1e 100644
> > --- a/test/sql/gh-2981-check-autoinc.result
> > +++ b/test/sql/gh-2981-check-autoinc.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
> > index 0eb8f73..afbefa0 100644
> > --- a/test/sql/gh-2981-check-autoinc.test.lua
> > +++ b/test/sql/gh-2981-check-autoinc.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > box.cfg{}
> >
> > diff --git a/test/sql/gh-3199-no-mem-leaks.result b/test/sql/gh-3199-no-mem-leaks.result
> > index e7ba1d2..00211ce 100644
> > --- a/test/sql/gh-3199-no-mem-leaks.result
> > +++ b/test/sql/gh-3199-no-mem-leaks.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
> > index 54a6ce5..f63bedf 100644
> > --- a/test/sql/gh-3199-no-mem-leaks.test.lua
> > +++ b/test/sql/gh-3199-no-mem-leaks.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > fiber = require('fiber')
> >
> > -- This test checks that no leaks of region memory happens during
> > diff --git a/test/sql/gh-3613-idx-alter-update-2.result b/test/sql/gh-3613-idx-alter-update-2.result
> > index ff63eb2..270f961 100644
> > --- a/test/sql/gh-3613-idx-alter-update-2.result
> > +++ b/test/sql/gh-3613-idx-alter-update-2.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-3613-idx-alter-update-2.test.lua b/test/sql/gh-3613-idx-alter-update-2.test.lua
> > index ff5b651..33730ff 100644
> > --- a/test/sql/gh-3613-idx-alter-update-2.test.lua
> > +++ b/test/sql/gh-3613-idx-alter-update-2.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> > box.execute('CREATE INDEX i ON t (s1)')
> > diff --git a/test/sql/gh-3613-idx-alter-update.result b/test/sql/gh-3613-idx-alter-update.result
> > index ba323a6..34b4a1f 100644
> > --- a/test/sql/gh-3613-idx-alter-update.result
> > +++ b/test/sql/gh-3613-idx-alter-update.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-3613-idx-alter-update.test.lua b/test/sql/gh-3613-idx-alter-update.test.lua
> > index 3027182..389a99d 100644
> > --- a/test/sql/gh-3613-idx-alter-update.test.lua
> > +++ b/test/sql/gh-3613-idx-alter-update.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
> > box.execute('CREATE INDEX i ON t (s1)')
> > diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
> > index 4b8e7ed..5691e70 100644
> > --- a/test/sql/gh-3888-values-blob-assert.result
> > +++ b/test/sql/gh-3888-values-blob-assert.result
> > @@ -10,7 +10,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh-3888-values-blob-assert.test.lua b/test/sql/gh-3888-values-blob-assert.test.lua
> > index 0b7c385..9680aa5 100644
> > --- a/test/sql/gh-3888-values-blob-assert.test.lua
> > +++ b/test/sql/gh-3888-values-blob-assert.test.lua
> > @@ -6,7 +6,7 @@
> > --
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- check 'VALUES' against typedef keywords (should fail)
> > box.execute('VALUES(scalar)')
> > diff --git a/test/sql/gh2141-delete-trigger-drop-table.result b/test/sql/gh2141-delete-trigger-drop-table.result
> > index 1d373f5..a218328 100644
> > --- a/test/sql/gh2141-delete-trigger-drop-table.result
> > +++ b/test/sql/gh2141-delete-trigger-drop-table.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> > index 4d21fd7..2d5b987 100644
> > --- a/test/sql/gh2141-delete-trigger-drop-table.test.lua
> > +++ b/test/sql/gh2141-delete-trigger-drop-table.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- create space
> > box.execute("CREATE TABLE t(id INT PRIMARY KEY)")
> > diff --git a/test/sql/gh2251-multiple-update.result b/test/sql/gh2251-multiple-update.result
> > index 42ebf7f..7a21cea 100644
> > --- a/test/sql/gh2251-multiple-update.result
> > +++ b/test/sql/gh2251-multiple-update.result
> > @@ -5,7 +5,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
> > index 4d55096..eeff047 100644
> > --- a/test/sql/gh2251-multiple-update.test.lua
> > +++ b/test/sql/gh2251-multiple-update.test.lua
> > @@ -1,7 +1,7 @@
> > -- Regression test for #2251
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
> > index d69fcbd..a7dd7d2 100644
> > --- a/test/sql/gh2483-remote-persistency-check.result
> > +++ b/test/sql/gh2483-remote-persistency-check.result
> > @@ -8,7 +8,7 @@ test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
> > index 7db1602..bf2fc6b 100644
> > --- a/test/sql/gh2483-remote-persistency-check.test.lua
> > +++ b/test/sql/gh2483-remote-persistency-check.test.lua
> > @@ -2,7 +2,7 @@
> > env = require('test_run')
> > test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > box.schema.user.grant('guest', 'read,write,execute', 'universe')
> >
> > diff --git a/test/sql/gh2808-inline-unique-persistency-check.result b/test/sql/gh2808-inline-unique-persistency-check.result
> > index a277b3f..db03feb 100644
> > --- a/test/sql/gh2808-inline-unique-persistency-check.result
> > +++ b/test/sql/gh2808-inline-unique-persistency-check.result
> > @@ -8,7 +8,7 @@ test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> > index 26b646a..ef38ae3 100644
> > --- a/test/sql/gh2808-inline-unique-persistency-check.test.lua
> > +++ b/test/sql/gh2808-inline-unique-persistency-check.test.lua
> > @@ -2,7 +2,7 @@
> > env = require('test_run')
> > test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Create a table and insert a datum
> > box.execute([[CREATE TABLE t1(a INT PRIMARY KEY, b INT, UNIQUE(b));]])
> > diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result
> > index 8ff7528..cb687a1 100644
> > --- a/test/sql/icu-upper-lower.result
> > +++ b/test/sql/icu-upper-lower.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
> > index 00e9699..bbd4f00 100644
> > --- a/test/sql/icu-upper-lower.test.lua
> > +++ b/test/sql/icu-upper-lower.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > test_run:cmd("setopt delimiter ';'")
> >
> > diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
> > index 1cf44c9..ec57681 100644
> > --- a/test/sql/insert-unique.result
> > +++ b/test/sql/insert-unique.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -19,7 +19,7 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entry
> > box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > ---
> > diff --git a/test/sql/insert-unique.test.lua b/test/sql/insert-unique.test.lua
> > index 026bc9d..243333e 100644
> > --- a/test/sql/insert-unique.test.lua
> > +++ b/test/sql/insert-unique.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -9,7 +9,7 @@ box.execute("CREATE TABLE zoobar (c1 INT, c2 INT PRIMARY KEY, c3 TEXT, c4 INT)")
> > box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entry
> > box.execute("INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
> > index 223ba02..c886f8c 100644
> > --- a/test/sql/integer-overflow.result
> > +++ b/test/sql/integer-overflow.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
> > index 1b3e8ce..57929e2 100644
> > --- a/test/sql/integer-overflow.test.lua
> > +++ b/test/sql/integer-overflow.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- gh-3735: make sure that integer overflows errors are
> > -- handled during VDBE execution.
> > diff --git a/test/sql/iproto.result b/test/sql/iproto.result
> > index ffc7cd9..38f9789 100644
> > --- a/test/sql/iproto.result
> > +++ b/test/sql/iproto.result
> > @@ -7,7 +7,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
> > index b5ec2c0..d31fb7f 100644
> > --- a/test/sql/iproto.test.lua
> > +++ b/test/sql/iproto.test.lua
> > @@ -1,7 +1,7 @@
> > remote = require('net.box')
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > box.execute('create table test (id int primary key, a NUMBER, b text)')
> > space = box.space.TEST
> > diff --git a/test/sql/max-on-index.result b/test/sql/max-on-index.result
> > index 57ce95b..45f29fd 100644
> > --- a/test/sql/max-on-index.result
> > +++ b/test/sql/max-on-index.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -25,7 +25,7 @@ box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries
> > box.execute("INSERT INTO test1 VALUES(1, 2)");
> > ---
> > diff --git a/test/sql/max-on-index.test.lua b/test/sql/max-on-index.test.lua
> > index 4cceaa7..73e4199 100644
> > --- a/test/sql/max-on-index.test.lua
> > +++ b/test/sql/max-on-index.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -13,7 +13,7 @@ box.execute("CREATE INDEX test1_index ON test1 (f2)")
> > box.execute("CREATE TABLE test2 (f1 INT, f2 INT, PRIMARY KEY(f1))")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries
> > box.execute("INSERT INTO test1 VALUES(1, 2)");
> > diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
> > index 69e3ee0..d198e14 100644
> > --- a/test/sql/message-func-indexes.result
> > +++ b/test/sql/message-func-indexes.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
> > index 9ac5f47..dc67606 100644
> > --- a/test/sql/message-func-indexes.test.lua
> > +++ b/test/sql/message-func-indexes.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Creating tables.
> > box.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
> > diff --git a/test/sql/misc.result b/test/sql/misc.result
> > index a157ddb..b06ac57 100644
> > --- a/test/sql/misc.result
> > +++ b/test/sql/misc.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
> > index 541660c..e581b73 100644
> > --- a/test/sql/misc.test.lua
> > +++ b/test/sql/misc.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Forbid multistatement queries.
> > box.execute('select 1;')
> > diff --git a/test/sql/no-pk-space.result b/test/sql/no-pk-space.result
> > index 025f363..d0274ea 100644
> > --- a/test/sql/no-pk-space.result
> > +++ b/test/sql/no-pk-space.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/no-pk-space.test.lua b/test/sql/no-pk-space.test.lua
> > index 318c2ac..f451b57 100644
> > --- a/test/sql/no-pk-space.test.lua
> > +++ b/test/sql/no-pk-space.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > format = {}
> > format[1] = {'id', 'integer'}
> > diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
> > index 6851e21..c0bb802 100644
> > --- a/test/sql/on-conflict.result
> > +++ b/test/sql/on-conflict.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
> > index 1aa4d1b..958303e 100644
> > --- a/test/sql/on-conflict.test.lua
> > +++ b/test/sql/on-conflict.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > --
> > -- Check that original sql ON CONFLICT clause is really
> > -- disabled.
> > diff --git a/test/sql/persistency.result b/test/sql/persistency.result
> > index f8f992c..88778ec 100644
> > --- a/test/sql/persistency.result
> > +++ b/test/sql/persistency.result
> > @@ -7,7 +7,7 @@ test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
> > index 1964453..72d1992 100644
> > --- a/test/sql/persistency.test.lua
> > +++ b/test/sql/persistency.test.lua
> > @@ -1,7 +1,7 @@
> > env = require('test_run')
> > test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- create space
> > box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> > diff --git a/test/sql/row-count.result b/test/sql/row-count.result
> > index 6bf74ed..dd898aa 100644
> > --- a/test/sql/row-count.result
> > +++ b/test/sql/row-count.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -314,13 +314,13 @@ box.execute("SELECT ROW_COUNT();")
> > rows:
> > - [0]
> > ...
> > -box.execute('PRAGMA recursive_triggers')
> > +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
> > ---
> > - metadata:
> > - - name: recursive_triggers
> > - type: integer
> > + - name: value
> > + type: any
> > rows:
> > - - [1]
> > + - [true]
> > ...
> > -- Clean-up.
> > --
> > diff --git a/test/sql/row-count.test.lua b/test/sql/row-count.test.lua
> > index 369e7fa..f5a9820 100644
> > --- a/test/sql/row-count.test.lua
> > +++ b/test/sql/row-count.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Test cases concerning row count calculations.
> > --
> > @@ -65,7 +65,7 @@ box.execute("SELECT ROW_COUNT();")
> > box.execute("SELECT ROW_COUNT();")
> > box.execute("EXPLAIN QUERY PLAN INSERT INTO t1 VALUES ('b'), ('c'), ('d');")
> > box.execute("SELECT ROW_COUNT();")
> > -box.execute('PRAGMA recursive_triggers')
> > +box.execute([[SELECT "value" FROM "_vsession_settings" WHERE "name" = 'sql_recursive_triggers';]])
> >
> > -- Clean-up.
> > --
> > diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
> > index e48db30..a111e26 100644
> > --- a/test/sql/savepoints.result
> > +++ b/test/sql/savepoints.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
> > index 99622a4..0af67a9 100644
> > --- a/test/sql/savepoints.test.lua
> > +++ b/test/sql/savepoints.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- These tests check that SQL savepoints properly work outside
> > -- transactions as well as inside transactions started in Lua.
> > diff --git a/test/sql/select-null.result b/test/sql/select-null.result
> > index 83d9776..bd25f03 100644
> > --- a/test/sql/select-null.result
> > +++ b/test/sql/select-null.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries
> > box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> > ---
> > diff --git a/test/sql/select-null.test.lua b/test/sql/select-null.test.lua
> > index a49eb43..9f54048 100644
> > --- a/test/sql/select-null.test.lua
> > +++ b/test/sql/select-null.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> > box.execute("CREATE TABLE t3(id INT, a text, b TEXT, PRIMARY KEY(id))")
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries
> > box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
> > diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
> > index 4102b1a..e2d60a9 100644
> > --- a/test/sql/sql-debug.result
> > +++ b/test/sql/sql-debug.result
> > @@ -5,50 +5,130 @@ test_run = require('test_run').new()
> > ---
> > ...
> > --
> > --- gh-3832: Some statements do not return column type
> > --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> > --- without parameter.
> > -result = box.execute('PRAGMA parser_trace').rows
> > +-- gh-4511: make sure that SET works.
> > +--
> > +box.execute('SELECT "name" FROM "_vsession_settings";')
> > +---
> > +- metadata:
> > + - name: name
> > + type: string
> > + rows:
> > + - ['sql_default_engine']
> > + - ['sql_defer_foreign_keys']
> > + - ['sql_full_column_names']
> > + - ['sql_parser_trace']
> > + - ['sql_recursive_triggers']
> > + - ['sql_reverse_unordered_selects']
> > + - ['sql_select_trace']
> > + - ['sql_trace']
> > + - ['sql_vdbe_addoptrace']
> > + - ['sql_vdbe_debug']
> > + - ['sql_vdbe_eqp']
> > + - ['sql_vdbe_listing']
> > + - ['sql_vdbe_trace']
> > + - ['sql_where_trace']
> > +...
> > +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> > +---
> > +...
> > +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> > +---
> > +...
> > +box.execute('SET sql_default_engine = 1;')
> > +---
> > +- null
> > +- 'Inconsistent types: expected string got integer'
> > +...
> > +box.execute("SET sql_default_engine = 'some_engine';")
> > +---
> > +- null
> > +- Space engine 'some_engine' does not exist
> > +...
> > +box.execute("SET engine = 'vinyl';")
> > +---
> > +- null
> > +- Setting is not found
> > +...
> > +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> > +---
> > +- null
> > +- 'Inconsistent types: expected boolean got string'
> > +...
> > +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> > ---
> > +- true
> > ...
> > -box.execute('PRAGMA parser_trace = 1')
> > +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> > +---
> > +- true
> > +...
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > +---
> > +- row_count: 0
> > +...
> > +box.execute("SET sql_reverse_unordered_selects = true;")
> > ---
> > - row_count: 0
> > ...
> > -box.execute('PRAGMA parser_trace')
> > +box.execute('SELECT * FROM "_vsession_settings";')
> > ---
> > - metadata:
> > - - name: parser_trace
> > - type: integer
> > + - name: name
> > + type: string
> > + - name: value
> > + type: any
> > rows:
> > - - [1]
> > + - ['sql_where_trace', false]
> > + - ['sql_vdbe_trace', false]
> > + - ['sql_vdbe_listing', false]
> > + - ['sql_vdbe_eqp', false]
> > + - ['sql_vdbe_debug', false]
> > + - ['sql_vdbe_addoptrace', false]
> > + - ['sql_trace', false]
> > + - ['sql_select_trace', false]
> > + - ['sql_reverse_unordered_selects', true]
> > + - ['sql_recursive_triggers', true]
> > + - ['sql_parser_trace', false]
> > + - ['sql_full_column_names', false]
> > + - ['sql_defer_foreign_keys', false]
> > + - ['sql_default_engine', 'vinyl']
> > ...
> > -box.execute('PRAGMA parser_trace = '.. result[1][1])
> > +box.execute("SET sql_default_engine = 'memtx';")
> > ---
> > - row_count: 0
> > ...
> > ---
> > --- Make PRAGMA command return the result as a result set.
> > ---
> > -box.execute('PRAGMA')
> > +box.execute("SET sql_reverse_unordered_selects = false;")
> > +---
> > +- row_count: 0
> > +...
> > +box.execute('SELECT * FROM "_vsession_settings";')
> > ---
> > - metadata:
> > - - name: pragma_name
> > - type: text
> > - - name: pragma_value
> > - type: integer
> > + - name: name
> > + type: string
> > + - name: value
> > + type: any
> > rows:
> > - - ['defer_foreign_keys', 0]
> > - - ['full_column_names', 0]
> > - - ['parser_trace', 0]
> > - - ['recursive_triggers', 1]
> > - - ['reverse_unordered_selects', 0]
> > - - ['select_trace', 0]
> > - - ['sql_trace', 0]
> > - - ['vdbe_addoptrace', 0]
> > - - ['vdbe_debug', 0]
> > - - ['vdbe_eqp', 0]
> > - - ['vdbe_listing', 0]
> > - - ['vdbe_trace', 0]
> > - - ['where_trace', 0]
> > + - ['sql_default_engine', 'memtx']
> > + - ['sql_defer_foreign_keys', false]
> > + - ['sql_full_column_names', false]
> > + - ['sql_parser_trace', false]
> > + - ['sql_recursive_triggers', true]
> > + - ['sql_reverse_unordered_selects', false]
> > + - ['sql_select_trace', false]
> > + - ['sql_trace', false]
> > + - ['sql_vdbe_addoptrace', false]
> > + - ['sql_vdbe_debug', false]
> > + - ['sql_vdbe_eqp', false]
> > + - ['sql_vdbe_listing', false]
> > + - ['sql_vdbe_trace', false]
> > + - ['sql_where_trace', false]
> > +...
> > +box.execute("SET sql_default_engine = '"..engine.."';")
> > +---
> > +- row_count: 0
> > +...
> > +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> > +---
> > +- row_count: 0
> > ...
> > diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua
> > index edd0ef4..b15deee 100644
> > --- a/test/sql/sql-debug.test.lua
> > +++ b/test/sql/sql-debug.test.lua
> > @@ -2,16 +2,27 @@ remote = require('net.box')
> > test_run = require('test_run').new()
> >
> > --
> > --- gh-3832: Some statements do not return column type
> > +-- gh-4511: make sure that SET works.
> > +--
> > +box.execute('SELECT "name" FROM "_vsession_settings";')
> >
> > --- Check that "PRAGMA parser_trace" returns 0 or 1 if called
> > --- without parameter.
> > -result = box.execute('PRAGMA parser_trace').rows
> > -box.execute('PRAGMA parser_trace = 1')
> > -box.execute('PRAGMA parser_trace')
> > -box.execute('PRAGMA parser_trace = '.. result[1][1])
> > +engine = box.space._vsession_settings:get{'sql_default_engine'}.value
> > +order = box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> >
> > ---
> > --- Make PRAGMA command return the result as a result set.
> > ---
> > -box.execute('PRAGMA')
> > +box.execute('SET sql_default_engine = 1;')
> > +box.execute("SET sql_default_engine = 'some_engine';")
> > +box.execute("SET engine = 'vinyl';")
> > +box.execute("SET sql_defer_foreign_keys = 'vinyl';")
> > +engine == box.space._vsession_settings:get{'sql_default_engine'}.value
> > +order == box.space._vsession_settings:get{'sql_reverse_unordered_selects'}.value
> > +
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > +box.execute("SET sql_reverse_unordered_selects = true;")
> > +box.execute('SELECT * FROM "_vsession_settings";')
> > +
> > +box.execute("SET sql_default_engine = 'memtx';")
> > +box.execute("SET sql_reverse_unordered_selects = false;")
> > +box.execute('SELECT * FROM "_vsession_settings";')
> > +
> > +box.execute("SET sql_default_engine = '"..engine.."';")
> > +box.execute("SET sql_reverse_unordered_selects = "..tostring(order)..";")
> > diff --git a/test/sql/sql-statN-index-drop.result b/test/sql/sql-statN-index-drop.result
> > index b2a4458..cf0f6f4 100644
> > --- a/test/sql/sql-statN-index-drop.result
> > +++ b/test/sql/sql-statN-index-drop.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
> > index 5477a2a..5f9cc68 100644
> > --- a/test/sql/sql-statN-index-drop.test.lua
> > +++ b/test/sql/sql-statN-index-drop.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Initializing some things.
> > box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT);")
> > diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
> > index 1ae9ef2..07a7c41 100644
> > --- a/test/sql/tokenizer.result
> > +++ b/test/sql/tokenizer.result
> > @@ -7,7 +7,7 @@ test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
> > index 3f5dd12..15cf658 100644
> > --- a/test/sql/tokenizer.test.lua
> > +++ b/test/sql/tokenizer.test.lua
> > @@ -1,7 +1,7 @@
> > env = require('test_run')
> > test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > sql_tokenizer = require('sql_tokenizer')
> >
> > diff --git a/test/sql/transition.result b/test/sql/transition.result
> > index 9738092..35e7af6 100644
> > --- a/test/sql/transition.result
> > +++ b/test/sql/transition.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
> > index a05c26a..9b8b868 100644
> > --- a/test/sql/transition.test.lua
> > +++ b/test/sql/transition.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- create space
> > box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
> > diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result
> > index 29c7316..17311ee 100644
> > --- a/test/sql/transitive-transactions.result
> > +++ b/test/sql/transitive-transactions.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> > +box.execute("set sql_default_engine=\'"..engine.."\'")
> > ---
> > - row_count: 0
> > ...
> > @@ -88,7 +88,7 @@ box.space.PARENT:select();
> > ---
> > - - [1, 1]
> > ...
> > --- Make sure that 'PRAGMA defer_foreign_keys' works.
> > +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> > --
> > box.execute('DROP TABLE child;')
> > box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> > @@ -116,7 +116,7 @@ box.space.PARENT:select();
> > ---
> > - - [1, 1]
> > ...
> > -box.execute('PRAGMA defer_foreign_keys = 1;')
> > +box.execute('SET sql_defer_foreign_keys = true;')
> > box.rollback()
> > fk_defer();
> > ---
> > @@ -131,7 +131,7 @@ box.space.PARENT:select();
> > - [2, 2]
> > ...
> > -- Cleanup
> > -box.execute('PRAGMA defer_foreign_keys = 0;')
> > +box.execute('SET sql_defer_foreign_keys = false;')
> >
> > box.execute('DROP TABLE child;');
> > ---
> > diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
> > index 4633f07..3c5fecb 100644
> > --- a/test/sql/transitive-transactions.test.lua
> > +++ b/test/sql/transitive-transactions.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute("pragma sql_default_engine=\'"..engine.."\'")
> > +box.execute("set sql_default_engine=\'"..engine.."\'")
> > test_run:cmd("setopt delimiter ';'")
> >
> > -- These tests are aimed at checking transitive transactions
> > @@ -45,7 +45,7 @@ fk_violation_3();
> > box.space.CHILD:select();
> > box.space.PARENT:select();
> >
> > --- Make sure that 'PRAGMA defer_foreign_keys' works.
> > +-- Make sure that SQL option 'sql_defer_foreign_keys' works.
> > --
> > box.execute('DROP TABLE child;')
> > box.execute('CREATE TABLE child(id INT PRIMARY KEY, x INT REFERENCES parent(y))')
> > @@ -62,13 +62,13 @@ end;
> > fk_defer();
> > box.space.CHILD:select();
> > box.space.PARENT:select();
> > -box.execute('PRAGMA defer_foreign_keys = 1;')
> > +box.execute('SET sql_defer_foreign_keys = true;')
> > box.rollback()
> > fk_defer();
> > box.space.CHILD:select();
> > box.space.PARENT:select();
> >
> > -box.execute('PRAGMA defer_foreign_keys = 0;')
> > +box.execute('SET sql_defer_foreign_keys = false;')
> >
> > -- Cleanup
> > box.execute('DROP TABLE child;');
> > diff --git a/test/sql/triggers.result b/test/sql/triggers.result
> > index 9dfe981..de1f074 100644
> > --- a/test/sql/triggers.result
> > +++ b/test/sql/triggers.result
> > @@ -7,7 +7,7 @@ test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -292,7 +292,7 @@ box.execute("DROP TABLE T1;")
> > -- gh-3531: Assertion with trigger and two storage engines
> > --
> > -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> > -box.execute("PRAGMA sql_default_engine ('vinyl');")
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > ---
> > - row_count: 0
> > ...
> > @@ -304,7 +304,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> > ---
> > - row_count: 1
> > ...
> > -box.execute("PRAGMA sql_default_engine('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > ---
> > - row_count: 0
> > ...
> > @@ -336,7 +336,7 @@ box.execute("DROP TABLE n;")
> > - row_count: 1
> > ...
> > -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> > -box.execute("PRAGMA sql_default_engine ('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > ---
> > - row_count: 0
> > ...
> > @@ -348,7 +348,7 @@ box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SE
> > ---
> > - row_count: 1
> > ...
> > -box.execute("PRAGMA sql_default_engine('vinyl');")
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > ---
> > - row_count: 0
> > ...
> > @@ -380,7 +380,7 @@ box.execute("DROP TABLE n;")
> > - row_count: 1
> > ...
> > -- Test SQL Transaction with LUA
> > -box.execute("PRAGMA sql_default_engine ('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > ---
> > - row_count: 0
> > ...
> > @@ -388,7 +388,7 @@ box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> > ---
> > - row_count: 1
> > ...
> > -box.execute("PRAGMA sql_default_engine='vinyl'")
> > +box.execute("SET sql_default_engine='vinyl'")
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
> > index f0397dc..138d1c0 100644
> > --- a/test/sql/triggers.test.lua
> > +++ b/test/sql/triggers.test.lua
> > @@ -1,7 +1,7 @@
> > env = require('test_run')
> > test_run = env.new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Get invariant part of the tuple; name and opts don't change.
> > function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
> > @@ -100,10 +100,10 @@ box.execute("DROP TABLE T1;")
> > -- gh-3531: Assertion with trigger and two storage engines
> > --
> > -- Case 1: Src 'vinyl' table; Dst 'memtx' table
> > -box.execute("PRAGMA sql_default_engine ('vinyl');")
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> > box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> > -box.execute("PRAGMA sql_default_engine('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> > box.execute("INSERT INTO m VALUES (0, '0');")
> > box.execute("INSERT INTO n VALUES (0, '',null);")
> > @@ -116,10 +116,10 @@ box.execute("DROP TABLE n;")
> >
> >
> > -- Case 2: Src 'memtx' table; Dst 'vinyl' table
> > -box.execute("PRAGMA sql_default_engine ('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
> > box.execute("CREATE TRIGGER m1 BEFORE UPDATE ON m FOR EACH ROW BEGIN UPDATE n SET s2 = 'now'; END;")
> > -box.execute("PRAGMA sql_default_engine('vinyl');")
> > +box.execute("SET sql_default_engine = 'vinyl';")
> > box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
> > box.execute("INSERT INTO m VALUES (0, '0');")
> > box.execute("INSERT INTO n VALUES (0, '',null);")
> > @@ -131,9 +131,9 @@ box.execute("DROP TABLE m;")
> > box.execute("DROP TABLE n;")
> >
> > -- Test SQL Transaction with LUA
> > -box.execute("PRAGMA sql_default_engine ('memtx');")
> > +box.execute("SET sql_default_engine = 'memtx';")
> > box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
> > -box.execute("PRAGMA sql_default_engine='vinyl'")
> > +box.execute("SET sql_default_engine='vinyl'")
> > box.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
> > box.execute("INSERT INTO test2 VALUES (2)")
> > box.execute("START TRANSACTION")
> > diff --git a/test/sql/update-with-nested-select.result b/test/sql/update-with-nested-select.result
> > index 3172430..b6ccda2 100644
> > --- a/test/sql/update-with-nested-select.result
> > +++ b/test/sql/update-with-nested-select.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > @@ -15,7 +15,7 @@ box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
> > - row_count: 1
> > ...
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > -- Seed entries
> > box.execute("INSERT INTO t1 VALUES(1,4,6);");
> > ---
> > diff --git a/test/sql/update-with-nested-select.test.lua b/test/sql/update-with-nested-select.test.lua
> > index 88424fc..07587ff 100644
> > --- a/test/sql/update-with-nested-select.test.lua
> > +++ b/test/sql/update-with-nested-select.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- box.cfg()
> >
> > @@ -8,7 +8,7 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
> > box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);");
> >
> > -- Debug
> > --- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> > +-- box.execute("SET vdbe_debug=ON ; INSERT INTO zoobar VALUES (111, 222, 'c3', 444)")
> >
> > -- Seed entries
> > box.execute("INSERT INTO t1 VALUES(1,4,6);");
> > diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
> > index f0997e1..6627777 100644
> > --- a/test/sql/upgrade.result
> > +++ b/test/sql/upgrade.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
> > index 37425ae..0c882ba 100644
> > --- a/test/sql/upgrade.test.lua
> > +++ b/test/sql/upgrade.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > work_dir = 'sql/upgrade/1.10/'
> > test_run:cmd('create server upgrade with script="sql/upgrade/upgrade.lua", workdir="' .. work_dir .. '"')
> > diff --git a/test/sql/view.result b/test/sql/view.result
> > index d845df8..3df08fc 100644
> > --- a/test/sql/view.result
> > +++ b/test/sql/view.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
> > index 0008056..6a1fae2 100644
> > --- a/test/sql/view.test.lua
> > +++ b/test/sql/view.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> >
> > -- Verify that constraints on 'view' option are working.
> >
> > diff --git a/test/sql/view_delayed_wal.result b/test/sql/view_delayed_wal.result
> > index d518e7d..a5f64f2 100644
> > --- a/test/sql/view_delayed_wal.result
> > +++ b/test/sql/view_delayed_wal.result
> > @@ -4,7 +4,7 @@ test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > ---
> > ...
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
> > index 7e6fce6..ec93e72 100644
> > --- a/test/sql/view_delayed_wal.test.lua
> > +++ b/test/sql/view_delayed_wal.test.lua
> > @@ -1,6 +1,6 @@
> > test_run = require('test_run').new()
> > engine = test_run:get_cfg('engine')
> > -box.execute('pragma sql_default_engine=\''..engine..'\'')
> > +box.execute('set sql_default_engine=\''..engine..'\'')
> > fiber = require('fiber')
> >
> > -- View reference counters are incremented before firing
> > diff --git a/test/sql/vinyl-opts.result b/test/sql/vinyl-opts.result
> > index 10a649a..b9e07c1 100644
> > --- a/test/sql/vinyl-opts.result
> > +++ b/test/sql/vinyl-opts.result
> > @@ -13,7 +13,7 @@ test_run:cmd("switch test")
> > ---
> > - true
> > ...
> > -box.execute('pragma sql_default_engine= \'vinyl\'')
> > +box.execute('set sql_default_engine= \'vinyl\'')
> > ---
> > - row_count: 0
> > ...
> > diff --git a/test/sql/vinyl-opts.test.lua b/test/sql/vinyl-opts.test.lua
> > index 4460724..05864d0 100644
> > --- a/test/sql/vinyl-opts.test.lua
> > +++ b/test/sql/vinyl-opts.test.lua
> > @@ -3,7 +3,7 @@ test_run:cmd("create server test with script='sql/vinyl-opts-cfg.lua'")
> > test_run:cmd("start server test")
> > test_run:cmd("switch test")
> >
> > -box.execute('pragma sql_default_engine= \'vinyl\'')
> > +box.execute('set sql_default_engine= \'vinyl\'')
> > box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
> > box.space.V1.index[0].options
> >
> > --
> > 2.7.4
>
> --
> Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 11:05 ` Mergen Imeev
@ 2019-11-27 11:10 ` Konstantin Osipov
2019-11-27 11:24 ` Mergen Imeev
2019-11-27 23:18 ` Vladislav Shpilevoy
1 sibling, 1 reply; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-27 11:10 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches, v.shpilevoy
* Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:07]:
> > Usually, if one allows SET statement, SET option_name (without
> > "= new_value") prints the current setting. This does the job and
> > makes the "_vsettings" system view unnecessary.
> >
> > Don't you think that having to use one piece of syntax to query a
> > value and entirely different piece to assign it is, ehm,
> > inconsistent, hard to learn & remember, and eventually hard to
> > use?
> >
> You are right. This was also pointed by Vlad in previous
> review:
> "2. Ok, but now it looks really unusable when a user want's to
> learn an option value. I will create a ticket, if this patchset
> will be pushed and nobody will care about usability beforehand."
But how are you going to fix it? By making SET statement powerful
enough to query a value or by making the sysview updatable?
Either way you fix it, the second patch will become unnecessary,
don't you think?
> Personally, I think this is easy to fix, and your
> suggestion is good. In fact, I can fix this in this
> patch-set if Vlad and Nikita agree with this solution.
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 11:10 ` Konstantin Osipov
@ 2019-11-27 11:24 ` Mergen Imeev
2019-11-27 11:39 ` Konstantin Osipov
0 siblings, 1 reply; 22+ messages in thread
From: Mergen Imeev @ 2019-11-27 11:24 UTC (permalink / raw)
To: Konstantin Osipov; +Cc: tarantool-patches, v.shpilevoy
On Wed, Nov 27, 2019 at 02:10:30PM +0300, Konstantin Osipov wrote:
> * Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:07]:
> > > Usually, if one allows SET statement, SET option_name (without
> > > "= new_value") prints the current setting. This does the job and
> > > makes the "_vsettings" system view unnecessary.
> > >
> > > Don't you think that having to use one piece of syntax to query a
> > > value and entirely different piece to assign it is, ehm,
> > > inconsistent, hard to learn & remember, and eventually hard to
> > > use?
> > >
> > You are right. This was also pointed by Vlad in previous
> > review:
> > "2. Ok, but now it looks really unusable when a user want's to
> > learn an option value. I will create a ticket, if this patchset
> > will be pushed and nobody will care about usability beforehand."
>
> But how are you going to fix it? By making SET statement powerful
> enough to query a value or by making the sysview updatable?
>
Since all settings are saved in a “struct session”, I
think that I will use the same methods PRAGMA used. The
system view reads from current_session(), so SET will
also read from there.
> Either way you fix it, the second patch will become unnecessary,
> don't you think?
>
The main idea of the patch is to allow to see the session
settings from any interface. It’s just that at the moment
it only has SQL parameters as session parameters.
> > Personally, I think this is easy to fix, and your
> > suggestion is good. In fact, I can fix this in this
> > patch-set if Vlad and Nikita agree with this solution.
>
> --
> Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 11:24 ` Mergen Imeev
@ 2019-11-27 11:39 ` Konstantin Osipov
2019-11-27 12:21 ` Mergen Imeev
0 siblings, 1 reply; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-27 11:39 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches, v.shpilevoy
* Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:27]:
> > But how are you going to fix it? By making SET statement powerful
> > enough to query a value or by making the sysview updatable?
> >
> Since all settings are saved in a “struct session”, I
> think that I will use the same methods PRAGMA used. The
> system view reads from current_session(), so SET will
> also read from there.
OK, so you are going to allow SET to return an existing value,
without setting it. Then what is the point of having a view,
if you can both get and set the values using SET statement?
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 11:39 ` Konstantin Osipov
@ 2019-11-27 12:21 ` Mergen Imeev
2019-11-27 12:49 ` Konstantin Osipov
0 siblings, 1 reply; 22+ messages in thread
From: Mergen Imeev @ 2019-11-27 12:21 UTC (permalink / raw)
To: Konstantin Osipov; +Cc: tarantool-patches, v.shpilevoy
On Wed, Nov 27, 2019 at 02:39:17PM +0300, Konstantin Osipov wrote:
> * Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:27]:
> > > But how are you going to fix it? By making SET statement powerful
> > > enough to query a value or by making the sysview updatable?
> > >
> > Since all settings are saved in a “struct session”, I
> > think that I will use the same methods PRAGMA used. The
> > system view reads from current_session(), so SET will
> > also read from there.
>
> OK, so you are going to allow SET to return an existing value,
> without setting it. Then what is the point of having a view,
> if you can both get and set the values using SET statement?
>
I agree that _vsession_settings can be moved from this
issue to another. It is here due to historical reasons -
at first it was called _vsql_settings and served as the
only way to get SQL setting values. Even now, even if this
is still the only way to get the values, it can be
transferred to another issue. If we allow to get the
setting value using the SET statement, then this is
definitely worth doing.
However, the basic concept of _vsession_settings is
slightly different. As I said earlier, it allows you to
get the current values of the session settings from all
interfaces.
> --
> Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 12:21 ` Mergen Imeev
@ 2019-11-27 12:49 ` Konstantin Osipov
2019-11-27 13:01 ` Mergen Imeev
0 siblings, 1 reply; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-27 12:49 UTC (permalink / raw)
To: Imeev Mergen; +Cc: tarantool-patches, Vladislav Shpilevoy
[-- Attachment #1: Type: text/plain, Size: 1849 bytes --]
Ok, this goal is nice, but now that it is clear it is a different goal than
fixing pragmas, what about making e.g. box.cfg settings available from all
interfaces? Adding access to global defaults, not just session defaults? Or
plugin settings, like log? Even though the declared aim is to come up with
a general solution, the implementation leaves a lot of questions unanswered.
On Wed, Nov 27, 2019, 15:21 Mergen Imeev <imeevma@tarantool.org> wrote:
> On Wed, Nov 27, 2019 at 02:39:17PM +0300, Konstantin Osipov wrote:
> > * Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:27]:
> > > > But how are you going to fix it? By making SET statement powerful
> > > > enough to query a value or by making the sysview updatable?
> > > >
> > > Since all settings are saved in a “struct session”, I
> > > think that I will use the same methods PRAGMA used. The
> > > system view reads from current_session(), so SET will
> > > also read from there.
> >
> > OK, so you are going to allow SET to return an existing value,
> > without setting it. Then what is the point of having a view,
> > if you can both get and set the values using SET statement?
> >
> I agree that _vsession_settings can be moved from this
> issue to another. It is here due to historical reasons -
> at first it was called _vsql_settings and served as the
> only way to get SQL setting values. Even now, even if this
> is still the only way to get the values, it can be
> transferred to another issue. If we allow to get the
> setting value using the SET statement, then this is
> definitely worth doing.
>
> However, the basic concept of _vsession_settings is
> slightly different. As I said earlier, it allows you to
> get the current values of the session settings from all
> interfaces.
>
> > --
> > Konstantin Osipov, Moscow, Russia
>
[-- Attachment #2: Type: text/html, Size: 2325 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 12:49 ` Konstantin Osipov
@ 2019-11-27 13:01 ` Mergen Imeev
2019-11-27 14:03 ` Nikita Pettik
2019-11-27 23:22 ` Vladislav Shpilevoy
0 siblings, 2 replies; 22+ messages in thread
From: Mergen Imeev @ 2019-11-27 13:01 UTC (permalink / raw)
To: Konstantin Osipov; +Cc: tarantool-patches, Vladislav Shpilevoy
On Wed, Nov 27, 2019 at 03:49:42PM +0300, Konstantin Osipov wrote:
> Ok, this goal is nice, but now that it is clear it is a different goal than
> fixing pragmas, what about making e.g. box.cfg settings available from all
> interfaces? Adding access to global defaults, not just session defaults? Or
> plugin settings, like log? Even though the declared aim is to come up with
> a general solution, the implementation leaves a lot of questions unanswered.
>
So, at the end we have the following questions:
1) Should we return the SQL tuning value when SET is used as
follows:
SET <setup name>;
2) Should we remove _vsession_settings from the problem.
3) If we move sysview out of the problem, where should we move it.
I have no answers to these questions. I hope Kirill, Vlad,
Nikita and Sasha will be able to answer them.
> On Wed, Nov 27, 2019, 15:21 Mergen Imeev <imeevma@tarantool.org> wrote:
>
> > On Wed, Nov 27, 2019 at 02:39:17PM +0300, Konstantin Osipov wrote:
> > > * Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:27]:
> > > > > But how are you going to fix it? By making SET statement powerful
> > > > > enough to query a value or by making the sysview updatable?
> > > > >
> > > > Since all settings are saved in a “struct session”, I
> > > > think that I will use the same methods PRAGMA used. The
> > > > system view reads from current_session(), so SET will
> > > > also read from there.
> > >
> > > OK, so you are going to allow SET to return an existing value,
> > > without setting it. Then what is the point of having a view,
> > > if you can both get and set the values using SET statement?
> > >
> > I agree that _vsession_settings can be moved from this
> > issue to another. It is here due to historical reasons -
> > at first it was called _vsql_settings and served as the
> > only way to get SQL setting values. Even now, even if this
> > is still the only way to get the values, it can be
> > transferred to another issue. If we allow to get the
> > setting value using the SET statement, then this is
> > definitely worth doing.
> >
> > However, the basic concept of _vsession_settings is
> > slightly different. As I said earlier, it allows you to
> > get the current values of the session settings from all
> > interfaces.
> >
> > > --
> > > Konstantin Osipov, Moscow, Russia
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 13:01 ` Mergen Imeev
@ 2019-11-27 14:03 ` Nikita Pettik
2019-11-27 21:50 ` Konstantin Osipov
2019-11-27 23:22 ` Vladislav Shpilevoy
1 sibling, 1 reply; 22+ messages in thread
From: Nikita Pettik @ 2019-11-27 14:03 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches, Vladislav Shpilevoy
On 27 Nov 16:01, Mergen Imeev wrote:
> On Wed, Nov 27, 2019 at 03:49:42PM +0300, Konstantin Osipov wrote:
> > Ok, this goal is nice, but now that it is clear it is a different goal than
> > fixing pragmas, what about making e.g. box.cfg settings available from all
> > interfaces? Adding access to global defaults, not just session defaults? Or
> > plugin settings, like log? Even though the declared aim is to come up with
> > a general solution, the implementation leaves a lot of questions unanswered.
> >
> So, at the end we have the following questions:
> 1) Should we return the SQL tuning value when SET is used as
> follows:
>
> SET <setup name>;
It may sound trite but why not look at other DBs? For instance,
PosgtreSQL uses SHOW command, which looks OK personally to me.
Or alternatively why can't we simply use _sql_settings:select("default_engine")?
In this case SHOW will be purely SQL shortcut for :select().
> 2) Should we remove _vsession_settings from the problem.
What is the problem? What are alternatives?
> 3) If we move sysview out of the problem, where should we move it.
What do you mean by "move sysview out of the problem"?
Could you please clarify last two question.
> I have no answers to these questions. I hope Kirill, Vlad,
> Nikita and Sasha will be able to answer them.
>
> > On Wed, Nov 27, 2019, 15:21 Mergen Imeev <imeevma@tarantool.org> wrote:
> >
> > > On Wed, Nov 27, 2019 at 02:39:17PM +0300, Konstantin Osipov wrote:
> > > > * Mergen Imeev <imeevma@tarantool.org> [19/11/27 14:27]:
> > > > > > But how are you going to fix it? By making SET statement powerful
> > > > > > enough to query a value or by making the sysview updatable?
> > > > > >
> > > > > Since all settings are saved in a “struct session”, I
> > > > > think that I will use the same methods PRAGMA used. The
> > > > > system view reads from current_session(), so SET will
> > > > > also read from there.
> > > >
> > > > OK, so you are going to allow SET to return an existing value,
> > > > without setting it. Then what is the point of having a view,
> > > > if you can both get and set the values using SET statement?
> > > >
> > > I agree that _vsession_settings can be moved from this
> > > issue to another. It is here due to historical reasons -
> > > at first it was called _vsql_settings and served as the
> > > only way to get SQL setting values. Even now, even if this
> > > is still the only way to get the values, it can be
> > > transferred to another issue. If we allow to get the
> > > setting value using the SET statement, then this is
> > > definitely worth doing.
> > >
> > > However, the basic concept of _vsession_settings is
> > > slightly different. As I said earlier, it allows you to
> > > get the current values of the session settings from all
> > > interfaces.
> > >
> > > > --
> > > > Konstantin Osipov, Moscow, Russia
> > >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 14:03 ` Nikita Pettik
@ 2019-11-27 21:50 ` Konstantin Osipov
0 siblings, 0 replies; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-27 21:50 UTC (permalink / raw)
To: Nikita Pettik; +Cc: tarantool-patches, Vladislav Shpilevoy
* Nikita Pettik <korablev@tarantool.org> [19/11/27 17:34]:
>
> It may sound trite but why not look at other DBs? For instance,
> PosgtreSQL uses SHOW command, which looks OK personally to me.
> Or alternatively why can't we simply use _sql_settings:select("default_engine")?
> In this case SHOW will be purely SQL shortcut for :select().
Seriously?-) This sounds like some sort of joke?
I did suggest to look at other DBMS serveral times, in fact the
most widely used DBMS in the world, sqlite, which happens to use
pragmas!
Once again, other dbms are a good source of inspiration, but in
the end of the day one has to have a *different* criteria for
product design, and it is what is the mission of *this* product
and what it is trying to accomplish.
> > 2) Should we remove _vsession_settings from the problem.
>
> What is the problem? What are alternatives?
>
> > 3) If we move sysview out of the problem, where should we move it.
>
> What do you mean by "move sysview out of the problem"?
>
> Could you please clarify last two question.
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 11:05 ` Mergen Imeev
2019-11-27 11:10 ` Konstantin Osipov
@ 2019-11-27 23:18 ` Vladislav Shpilevoy
1 sibling, 0 replies; 22+ messages in thread
From: Vladislav Shpilevoy @ 2019-11-27 23:18 UTC (permalink / raw)
To: Mergen Imeev, Konstantin Osipov; +Cc: tarantool-patches
On 27/11/2019 12:05, Mergen Imeev wrote:
> On Wed, Nov 27, 2019 at 01:51:50PM +0300, Konstantin Osipov wrote:
>> Why is it not possible to make the settings system view updatable,
>> if you decided to go with adding such a view anyway?
>>
> The sysview is empty. Not sure we need to make this
> updatable.
As I said in the very beginning, you could implement DML
operations for the space, and update struct session flags
via them.
Currently we have 'single interface to access the settings',
but we can update them only via SQL.
>> Usually, if one allows SET statement, SET option_name (without
>> "= new_value") prints the current setting. This does the job and
>> makes the "_vsettings" system view unnecessary.
>>
>> Don't you think that having to use one piece of syntax to query a
>> value and entirely different piece to assign it is, ehm,
>> inconsistent, hard to learn & remember, and eventually hard to
>> use?
>>
> You are right. This was also pointed by Vlad in previous
> review:
> "2. Ok, but now it looks really unusable when a user want's to
> learn an option value. I will create a ticket, if this patchset
> will be pushed and nobody will care about usability beforehand."
>
> Personally, I think this is easy to fix, and your
> suggestion is good. In fact, I can fix this in this
> patch-set if Vlad and Nikita agree with this solution.
>
I am ok with that. But that really returns us to the point,
how PRAGMAs worked - exactly the same, AFAIR.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 13:01 ` Mergen Imeev
2019-11-27 14:03 ` Nikita Pettik
@ 2019-11-27 23:22 ` Vladislav Shpilevoy
2019-11-28 12:31 ` Konstantin Osipov
1 sibling, 1 reply; 22+ messages in thread
From: Vladislav Shpilevoy @ 2019-11-27 23:22 UTC (permalink / raw)
To: Mergen Imeev, Konstantin Osipov; +Cc: tarantool-patches
On 27/11/2019 14:01, Mergen Imeev wrote:
> On Wed, Nov 27, 2019 at 03:49:42PM +0300, Konstantin Osipov wrote:
>> Ok, this goal is nice, but now that it is clear it is a different goal than
>> fixing pragmas, what about making e.g. box.cfg settings available from all
>> interfaces? Adding access to global defaults, not just session defaults? Or
>> plugin settings, like log? Even though the declared aim is to come up with
>> a general solution, the implementation leaves a lot of questions unanswered.
>>
> So, at the end we have the following questions:
> 1) Should we return the SQL tuning value when SET is used as
> follows:
>
> SET <setup name>;
Sounds ok. But even more ok - just keep PRAGMAs as they
are.
>
> 2) Should we remove _vsession_settings from the problem.
I always vote yes, when a question is whether should we
delete some code, drop a system space, etc.
>
> 3) If we move sysview out of the problem, where should we move it.
To /dev/null. Together with all the other SQL. But nobody
listens anyway. So we are going to push this space and support
it forever.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-27 23:22 ` Vladislav Shpilevoy
@ 2019-11-28 12:31 ` Konstantin Osipov
2019-11-28 14:01 ` Nikita Pettik
0 siblings, 1 reply; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-28 12:31 UTC (permalink / raw)
To: Vladislav Shpilevoy; +Cc: tarantool-patches
* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/11/28 10:29]:
> > 3) If we move sysview out of the problem, where should we move it.
>
> To /dev/null. Together with all the other SQL.
Wow, wow, easy please ;)
It's always a question of tradeoffs, price/performance, etc.
Even as it is now SQL is quite useful for BETWEEN, IN,
open-bounded predicate + small limit queries. Someone will need to
prepare a benchmark, of course, but eventually it will happen.
There are a few remaining issues out there to make it more broadly
useful, safe foreign keys, information_schema views and remaining
issues with strong typing are high on my list.
But here, the price/value ratio is ... high.
Much faster and easier to replace keyword PRAGMA if someone
doesn't like it with keyword SET, and be done with it.
Besides, Mergen has prepared some cool SQL refactoring patches like
removing some pragmas altogether which
need to be looked at - they are bringing value regardless of
whether there is consensus on the syntax for SQL settings.
One must also admit there is some compose-ability value of SELECT
over SET <value>; SELECT is usable in a join or a view.
But you can easily work this around by lua('') generic built-in
function, you can do lua('box.sql.exeucte("set <value")')
BTW, this lua() function is very neat - it is a good enough
workaround for
anything-you-want-to-have-in-sql-but-have-no-native-keyword-for.
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-28 12:31 ` Konstantin Osipov
@ 2019-11-28 14:01 ` Nikita Pettik
2019-11-28 15:52 ` Konstantin Osipov
0 siblings, 1 reply; 22+ messages in thread
From: Nikita Pettik @ 2019-11-28 14:01 UTC (permalink / raw)
To: Konstantin Osipov, Vladislav Shpilevoy, Mergen Imeev,
tarantool-patches, kyukhin, alexander.turenko
On 28 Nov 15:31, Konstantin Osipov wrote:
> But you can easily work this around by lua('') generic built-in
> function, you can do lua('box.sql.exeucte("set <value")')
>
> BTW, this lua() function is very neat - it is a good enough
> workaround for
> anything-you-want-to-have-in-sql-but-have-no-native-keyword-for.
Kostantin, you contradict yourself:
'''
From: Konstantin Osipov <kostja@scylladb.com>
...
* Nikita Pettik <korablev@tarantool.org> [19/09/11 20:34]:
> As I already said, we can move all these settings to box.sql submodule.
> To query particular value from SQL we can use new Lua() function:
>
> SELECT LUA("return box.sql.count_changes")
Why should the two language frontends be dependent on each other?
I mean, imagine we have JS support,would you want to call from JS
to Lua to configure some JS feature?
'''
'''
Date: Thu, 12 Sep 2019 14:18:56 +0300
From: Konstantin Osipov <kostja.osipov@gmail.com>
...
* Nikita Pettik <korablev@tarantool.org> [19/09/12 14:17]:
> The only way to make settings language independent (as I see) is to
> put them into separate system space (as I suggested below).
I don't mind an own space for settings at all. MySQL performance
schema is managed this way. It's a very flexible approach.
'''
We've started developing view approach to unify access and setting process
of SQL related options, like :update() and :select() operations.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET
2019-11-28 14:01 ` Nikita Pettik
@ 2019-11-28 15:52 ` Konstantin Osipov
0 siblings, 0 replies; 22+ messages in thread
From: Konstantin Osipov @ 2019-11-28 15:52 UTC (permalink / raw)
To: Nikita Pettik; +Cc: tarantool-patches, Vladislav Shpilevoy
* Nikita Pettik <korablev@tarantool.org> [19/11/28 17:03]:
> On 28 Nov 15:31, Konstantin Osipov wrote:
> > But you can easily work this around by lua('') generic built-in
> > function, you can do lua('box.sql.exeucte("set <value")')
> >
> > BTW, this lua() function is very neat - it is a good enough
> > workaround for
> > anything-you-want-to-have-in-sql-but-have-no-native-keyword-for.
>
> Kostantin, you contradict yourself:
Yes, I do, unless you apply a cost function to what I say.
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2019-11-28 15:52 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 10:13 [Tarantool-patches] [PATCH 0/5] Introduce SQL SET statement imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 1/5] sql: remove PRAGMA "count_changes" imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 2/5] sql: remove PRAGMA "short_column_names" imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 3/5] temporary: disable boolean.test.sql imeevma
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 4/5] sql: replace control pragmas by SET imeevma
2019-11-27 10:45 ` Mergen Imeev
2019-11-27 10:51 ` Konstantin Osipov
2019-11-27 11:05 ` Mergen Imeev
2019-11-27 11:10 ` Konstantin Osipov
2019-11-27 11:24 ` Mergen Imeev
2019-11-27 11:39 ` Konstantin Osipov
2019-11-27 12:21 ` Mergen Imeev
2019-11-27 12:49 ` Konstantin Osipov
2019-11-27 13:01 ` Mergen Imeev
2019-11-27 14:03 ` Nikita Pettik
2019-11-27 21:50 ` Konstantin Osipov
2019-11-27 23:22 ` Vladislav Shpilevoy
2019-11-28 12:31 ` Konstantin Osipov
2019-11-28 14:01 ` Nikita Pettik
2019-11-28 15:52 ` Konstantin Osipov
2019-11-27 23:18 ` Vladislav Shpilevoy
2019-11-27 10:13 ` [Tarantool-patches] [PATCH 5/5] sql: refactor PRAGMA-related code imeevma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox