[Tarantool-patches] [PATCH v5 4/5] sql: remove control pragmas

imeevma at tarantool.org imeevma at tarantool.org
Mon Dec 30 13:19:32 MSK 2019


This patch removes control pragmas. They are not needed now, after
the introduction of the _session_settings system space.

Closes #4511
---
 src/box/sql/pragma.c                               | 192 +--------------------
 src/box/sql/pragma.h                               | 133 --------------
 src/box/sql/sqlInt.h                               |   3 -
 src/box/sql/util.c                                 |  15 --
 src/box/sql/vdbe.c                                 |   4 +-
 src/box/sql/vdbe.h                                 |   5 -
 src/box/sql/vdbeaux.c                              |  18 --
 test/box/sql-update-with-nested-select.result      |   2 -
 test/box/sql-update-with-nested-select.test.lua    |   3 -
 test/sql-tap/autoinc.test.lua                      |   3 +-
 test/sql-tap/colname.test.lua                      |  14 +-
 test/sql-tap/fkey2.test.lua                        |   4 +-
 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                      |  42 ++---
 test/sql-tap/tkt3731.test.lua                      |   2 +-
 test/sql-tap/trigger2.test.lua                     |   3 +-
 test/sql-tap/triggerC.test.lua                     |  65 +------
 test/sql-tap/whereA.test.lua                       |  24 ++-
 test/sql/check-clear-ephemeral.result              |   5 +-
 test/sql/check-clear-ephemeral.test.lua            |   5 +-
 test/sql/checks.result                             |  10 +-
 test/sql/checks.test.lua                           |   4 +-
 test/sql/clear.result                              |   5 +-
 test/sql/clear.test.lua                            |   5 +-
 test/sql/collation.result                          |   3 +-
 test/sql/collation.test.lua                        |   2 +-
 test/sql/ddl.result                                |   3 +-
 test/sql/ddl.test.lua                              |   2 +-
 test/sql/delete-multiple-idx.result                |   5 +-
 test/sql/delete-multiple-idx.test.lua              |   5 +-
 test/sql/delete.result                             |   5 +-
 test/sql/delete.test.lua                           |   5 +-
 test/sql/drop-index.result                         |   5 +-
 test/sql/drop-index.test.lua                       |   5 +-
 test/sql/drop-table.result                         |   5 +-
 test/sql/drop-table.test.lua                       |   5 +-
 test/sql/engine.cfg                                |   3 -
 test/sql/engine.result                             |  12 +-
 test/sql/engine.test.lua                           |   6 +-
 test/sql/errinj.result                             |   3 +-
 test/sql/errinj.test.lua                           |   2 +-
 test/sql/full_metadata.result                      |   8 +-
 test/sql/full_metadata.test.lua                    |   4 +-
 test/sql/func-recreate.result                      |   3 +-
 test/sql/func-recreate.test.lua                    |   2 +-
 test/sql/gh-2362-select-access-rights.result       |   5 +-
 test/sql/gh-2362-select-access-rights.test.lua     |   2 +-
 test/sql/gh-2929-primary-key.result                |   3 +-
 test/sql/gh-2929-primary-key.test.lua              |   2 +-
 test/sql/gh-2981-check-autoinc.result              |   3 +-
 test/sql/gh-2981-check-autoinc.test.lua            |   2 +-
 test/sql/gh-3199-no-mem-leaks.result               |   3 +-
 test/sql/gh-3199-no-mem-leaks.test.lua             |   2 +-
 test/sql/gh-3613-idx-alter-update-2.result         |   3 +-
 test/sql/gh-3613-idx-alter-update-2.test.lua       |   2 +-
 test/sql/gh-3613-idx-alter-update.result           |   3 +-
 test/sql/gh-3613-idx-alter-update.test.lua         |   2 +-
 test/sql/gh-3888-values-blob-assert.result         |   3 +-
 test/sql/gh-3888-values-blob-assert.test.lua       |   2 +-
 test/sql/gh2141-delete-trigger-drop-table.result   |   3 +-
 test/sql/gh2141-delete-trigger-drop-table.test.lua |   2 +-
 test/sql/gh2251-multiple-update.result             |   3 +-
 test/sql/gh2251-multiple-update.test.lua           |   2 +-
 test/sql/gh2483-remote-persistency-check.result    |   3 +-
 test/sql/gh2483-remote-persistency-check.test.lua  |   2 +-
 .../gh2808-inline-unique-persistency-check.result  |   3 +-
 ...gh2808-inline-unique-persistency-check.test.lua |   2 +-
 test/sql/icu-upper-lower.result                    |   3 +-
 test/sql/icu-upper-lower.test.lua                  |   2 +-
 test/sql/insert-unique.result                      |   5 +-
 test/sql/insert-unique.test.lua                    |   5 +-
 test/sql/integer-overflow.result                   |   3 +-
 test/sql/integer-overflow.test.lua                 |   2 +-
 test/sql/iproto.result                             |   3 +-
 test/sql/iproto.test.lua                           |   2 +-
 test/sql/max-on-index.result                       |   5 +-
 test/sql/max-on-index.test.lua                     |   5 +-
 test/sql/message-func-indexes.result               |   3 +-
 test/sql/message-func-indexes.test.lua             |   2 +-
 test/sql/misc.result                               |   3 +-
 test/sql/misc.test.lua                             |   2 +-
 test/sql/no-pk-space.result                        |   3 +-
 test/sql/no-pk-space.test.lua                      |   2 +-
 test/sql/on-conflict.result                        |   3 +-
 test/sql/on-conflict.test.lua                      |   2 +-
 test/sql/persistency.result                        |   3 +-
 test/sql/persistency.test.lua                      |   2 +-
 test/sql/row-count.result                          |  11 +-
 test/sql/row-count.test.lua                        |   4 +-
 test/sql/savepoints.result                         |   3 +-
 test/sql/savepoints.test.lua                       |   2 +-
 test/sql/select-null.result                        |   5 +-
 test/sql/select-null.test.lua                      |   5 +-
 test/sql/sql-debug.result                          |  55 ------
 test/sql/sql-debug.test.lua                        |  17 --
 test/sql/sql-statN-index-drop.test.lua             |   2 +-
 test/sql/suite.ini                                 |   2 +-
 test/sql/tokenizer.result                          |   3 +-
 test/sql/tokenizer.test.lua                        |   2 +-
 test/sql/transition.result                         |   3 +-
 test/sql/transition.test.lua                       |   2 +-
 test/sql/transitive-transactions.result            |   9 +-
 test/sql/transitive-transactions.test.lua          |   9 +-
 test/sql/triggers.result                           |  27 ++-
 test/sql/triggers.test.lua                         |  14 +-
 test/sql/update-with-nested-select.result          |   5 +-
 test/sql/update-with-nested-select.test.lua        |   5 +-
 test/sql/upgrade.result                            |   3 +-
 test/sql/upgrade.test.lua                          |   2 +-
 test/sql/view.result                               |   3 +-
 test/sql/view.test.lua                             |   2 +-
 test/sql/view_delayed_wal.result                   |   3 +-
 test/sql/view_delayed_wal.test.lua                 |   2 +-
 test/sql/vinyl-opts.result                         |   4 +-
 test/sql/vinyl-opts.test.lua                       |   2 +-
 117 files changed, 187 insertions(+), 934 deletions(-)
 delete mode 100644 test/sql/sql-debug.result
 delete mode 100644 test/sql/sql-debug.test.lua

diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index a8353ba..ee1348c 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)
@@ -126,17 +76,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 *
@@ -159,53 +98,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);
-	vdbe_metadata_set_col_name(v, 0, "pragma_name");
-	vdbe_metadata_set_col_type(v, 0, "text");
-	vdbe_metadata_set_col_name(v, 1, "pragma_value");
-	vdbe_metadata_set_col_type(v, 1, "integer");
-
-	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>).
  *
@@ -371,22 +263,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:
@@ -414,17 +290,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;
@@ -454,38 +325,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;
@@ -563,43 +406,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;
-	}
-
 	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 6c9aa8d..6c66d97 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -6,18 +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
 
 /* 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 */
@@ -92,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_default_engine */
-	/*  70 */ "sql_default_engine",
-	/*  71 */ "text",
-	/* Used by: sql_trace */
-	/*  72 */ "sql_trace",
-	/*  73 */ "integer",
-	/* Used by: vdbe_addoptrace */
-	/*  74 */ "vdbe_addoptrace",
-	/*  75 */ "integer",
-	/* Used by: vdbe_debug */
-	/*  76 */ "vdbe_debug",
-	/*  77 */ "integer",
-	/* Used by: vdbe_eqp */
-	/*  78 */ "vdbe_eqp",
-	/*  79 */ "integer",
-	/* Used by: vdbe_listing */
-	/*  80 */ "vdbe_listing",
-	/*  81 */ "integer",
-	/* Used by: vdbe_trace */
-	/*  82 */ "vdbe_trace",
-	/*  83 */ "integer",
-	/* Used by: where_trace */
-	/*  84 */ "where_trace",
-	/*  85 */ "integer",
-	/* Used by: full_metadata */
-	/*  86 */ "full_metadata",
-	/*  87 */ "integer",
 };
 
 /* Definitions of all built-in pragmas */
@@ -158,27 +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:     */ "full_metadata",
-	  /* ePragTyp:  */ PragTyp_FLAG,
-	  /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	  /* ColNames:  */ 86, 1,
-	  /* iArg:      */ SQL_FullMetadata},
 	{ /* zName:     */ "index_info",
 	 /* ePragTyp:  */ PragTyp_INDEX_INFO,
 	 /* ePragFlg:  */
@@ -191,42 +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_default_engine",
-	 /* ePragTyp:  */ PragTyp_DEFAULT_ENGINE,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 70, 1,
-	 /* iArg:      */ 0},
-#if defined(SQL_DEBUG)
-	{ /* zName:     */ "sql_trace",
-	 /* ePragTyp:  */ PragTyp_FLAG,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 72, 1,
-	 /* iArg:      */ SQL_SqlTrace},
-#endif
 	{ /* zName:     */ "stats",
 	 /* ePragTyp:  */ PragTyp_STATS,
 	 /* ePragFlg:  */
@@ -239,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:  */ 74, 1,
-	 /* iArg:      */ SQL_VdbeAddopTrace},
-	{ /* zName:     */ "vdbe_debug",
-	 /* ePragTyp:  */ PragTyp_FLAG,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 76, 1,
-	 /* iArg:      */
-	 SQL_SqlTrace | SQL_VdbeListing | SQL_VdbeTrace},
-	{ /* zName:     */ "vdbe_eqp",
-	 /* ePragTyp:  */ PragTyp_FLAG,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 78, 1,
-	 /* iArg:      */ SQL_VdbeEQP},
-	{ /* zName:     */ "vdbe_listing",
-	 /* ePragTyp:  */ PragTyp_FLAG,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 80, 1,
-	 /* iArg:      */ SQL_VdbeListing},
-	{ /* zName:     */ "vdbe_trace",
-	 /* ePragTyp:  */ PragTyp_FLAG,
-	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	 /* ColNames:  */ 82, 1,
-	 /* iArg:      */ SQL_VdbeTrace},
-	{ /* zName:     */ "where_trace",
-	/* ePragTyp:  */ PragTyp_FLAG,
-	/* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
-	/* ColNames:  */ 84, 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 d1d1a11..34811e5 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -3794,7 +3794,6 @@ sql_space_def_check_format(const struct space_def *space_def);
 void sqlDetach(Parse *, Expr *);
 int sqlAtoF(const char *z, double *, int);
 int sqlGetInt32(const char *, int *);
-int sqlAtoi(const char *);
 
 /**
  * Return number of symbols in the given string.
@@ -3982,8 +3981,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 *,
diff --git a/src/box/sql/util.c b/src/box/sql/util.c
index 0e115ac..f908e9c 100644
--- a/src/box/sql/util.c
+++ b/src/box/sql/util.c
@@ -495,8 +495,6 @@ sql_atoi64(const char *z, int64_t *val, bool *is_neg, int length)
  * This routine accepts both decimal and hexadecimal notation for integers.
  *
  * Any non-numeric characters that following zNum are ignored.
- * This is different from sqlAtoi64() which requires the
- * input number to be zero-terminated.
  */
 int
 sqlGetInt32(const char *zNum, int *pValue)
@@ -554,19 +552,6 @@ sqlGetInt32(const char *zNum, int *pValue)
 }
 
 /*
- * Return a 32-bit integer value extracted from a string.  If the
- * string is not an integer, just return 0.
- */
-int
-sqlAtoi(const char *z)
-{
-	int x = 0;
-	if (z)
-		sqlGetInt32(z, &x);
-	return x;
-}
-
-/*
  * The variable-length integer encoding is as follows:
  *
  * KEY:
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index b821d9d..eab74db 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -4782,8 +4782,8 @@ case OP_Program: {        /* jump */
 
 	/* If the p5 flag is clear, then recursive invocation of triggers is
 	 * disabled for backwards compatibility (p5 is set if this sub-program
-	 * is really a trigger, not a foreign key action, and the flag set
-	 * and cleared by the "PRAGMA recursive_triggers" command is clear).
+	 * is really a trigger, not a foreign key action, and the setting
+	 * 'recursive_triggers' is not set).
 	 *
 	 * It is recursive invocation of triggers, at the SQL level, that is
 	 * disabled. In some cases a single trigger may generate more than one
diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
index de080cd..48815d4 100644
--- a/src/box/sql/vdbe.h
+++ b/src/box/sql/vdbe.h
@@ -199,11 +199,6 @@ int sqlVdbeAddOp4(Vdbe *, int, int, int, int, const char *zP4, int);
 int sqlVdbeAddOp4Dup8(Vdbe *, int, int, int, int, const u8 *, int);
 int sqlVdbeAddOp4Int(Vdbe *, int, int, int, int, int);
 void sqlVdbeEndCoroutine(Vdbe *, int);
-#if defined(SQL_DEBUG) && !defined(SQL_TEST_REALLOC_STRESS)
-void sqlVdbeVerifyNoResultRow(Vdbe * p);
-#else
-#define sqlVdbeVerifyNoResultRow(A)
-#endif
 void sqlVdbeChangeOpcode(Vdbe *, u32 addr, u8);
 void sqlVdbeChangeP1(Vdbe *, u32 addr, int P1);
 void sqlVdbeChangeP2(Vdbe *, u32 addr, int P2);
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 579f515..1d0fbad 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -532,24 +532,6 @@ sqlVdbeCurrentAddr(Vdbe * p)
 }
 
 /*
- * Verify that the VM passed as the only argument does not contain
- * an OP_ResultRow opcode. Fail an assert() if it does. This is used
- * by code in pragma.c to ensure that the implementation of certain
- * pragmas comports with the flags specified in the mkpragmatab.tcl
- * script.
- */
-#if defined(SQL_DEBUG) && !defined(SQL_TEST_REALLOC_STRESS)
-void
-sqlVdbeVerifyNoResultRow(Vdbe * p)
-{
-	int i;
-	for (i = 0; i < p->nOp; i++) {
-		assert(p->aOp[i].opcode != OP_ResultRow);
-	}
-}
-#endif
-
-/*
  * This function returns a pointer to the array of opcodes associated with
  * the Vdbe passed as the first argument. It is the callers responsibility
  * to arrange for the returned array to be eventually freed using the
diff --git a/test/box/sql-update-with-nested-select.result b/test/box/sql-update-with-nested-select.result
index 4ff090f..cfcc28f 100644
--- a/test/box/sql-update-with-nested-select.result
+++ b/test/box/sql-update-with-nested-select.result
@@ -7,8 +7,6 @@ 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)")
 -- Seed entries
 box.execute("INSERT INTO t1 VALUES(1,4,6);");
 ---
diff --git a/test/box/sql-update-with-nested-select.test.lua b/test/box/sql-update-with-nested-select.test.lua
index 5c5dd96..c15b0de 100644
--- a/test/box/sql-update-with-nested-select.test.lua
+++ b/test/box/sql-update-with-nested-select.test.lua
@@ -5,9 +5,6 @@ test_run = require('test_run').new()
 -- create space
 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)")
-
 -- Seed entries
 box.execute("INSERT INTO t1 VALUES(1,4,6);");
 box.execute("INSERT INTO t1 VALUES(2,5,7);");
diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
index 6105db3..37e65e5 100755
--- a/test/sql-tap/autoinc.test.lua
+++ b/test/sql-tap/autoinc.test.lua
@@ -640,7 +640,8 @@ test:do_test(
         -- </autoinc-10.3>
     })
 
-test:catchsql(" pragma recursive_triggers = off ")
+box.space._session_settings:update('sql_recursive_triggers', {{'=', 2, 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..caa61a0 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -45,12 +45,12 @@ end
 test:do_test(
     "colname-1.1",
     function()
-        return test:execsql "PRAGMA full_column_names"
-    end, {
+        return box.space._session_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';
+            UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_column_names';
             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';
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_column_names';
             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';
+            UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_column_names';
             ]])
         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..bd3e0c7 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;
+        UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_recursive_triggers';
         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;
+        UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_recursive_triggers';
         DROP TABLE t2;
         DROP TABLE t1;
         CREATE TABLE t1(
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 0f34114..9b0218e 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 function test.engine(self)
     return engine
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index b47dbf0..32f38cc 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;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_column_names';
             --SELECT rowid, * FROM t1;
             SELECT * FROM t1;
         ]])
diff --git a/test/sql-tap/pragma.test.lua b/test/sql-tap/pragma.test.lua
index c36f9b9..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 at line 1 near ''memtx''"
-})
-
-test:do_catchsql_test(
-	"pragma-2.5",
-	[[
-		pragma sql_default_engine 1;
-	]], {
-	1, "Syntax error at line 1 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 7029d27..fbebfab 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -2,6 +2,12 @@
 test = require("sqltester")
 test:plan(173)
 
+function set_full_column_names(value)
+    box.space._session_settings:update('sql_full_column_names', {
+        {'=', 2, value}
+    })
+end
+
 --!./tcltestrunner.lua
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -916,7 +922,7 @@ test:do_catchsql2_test(
 test:do_test(
     "select1-6.1.1",
     function()
-        test:execsql "PRAGMA full_column_names=on"
+        set_full_column_names(true)
         return test:catchsql2 "SELECT f1 FROM test1 ORDER BY f2"
     end, {
         -- <select1-6.1.1>
@@ -952,7 +958,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"
+        set_full_column_names(false)
         return table.insert(v,msg) or v
     end, {
         -- <select1-6.1.4>
@@ -1043,13 +1049,13 @@ test:do_catchsql2_test(
 test:do_test(
     "select1-6.5.1",
     function()
-        test:execsql2 "PRAGMA full_column_names=on"
+        set_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"
+        set_full_column_names(false)
         return table.insert(v,msg) or v
     end, {
         -- <select1-6.5.1>
@@ -1123,9 +1129,7 @@ test:do_catchsql2_test(
 test:do_test(
     "select1-6.9.3",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='OFF';
-        ]]
+        set_full_column_names(false)
         return test:execsql2 [[
             SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
         ]]
@@ -1138,9 +1142,7 @@ test:do_test(
 test:do_test(
     "select1-6.9.4",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='ON';
-        ]]
+        set_full_column_names(true)
         return test:execsql2 [[
             SELECT test1 . f1, test1 . f2 FROM test1 LIMIT 1
         ]]
@@ -1153,9 +1155,7 @@ test:do_test(
 test:do_test(
     "select1-6.9.5",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='ON';
-        ]]
+        set_full_column_names(true)
         return test:execsql2 [[
             SELECT 123.45;
         ]]
@@ -1234,9 +1234,7 @@ test:do_execsql2_test(
 test:do_test(
     "select1-6.9.11",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='ON';
-        ]]
+        set_full_column_names(true)
         return test:execsql2 [[
             SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
         ]]
@@ -1259,9 +1257,7 @@ test:do_execsql2_test(
 test:do_test(
     "select1-6.9.13",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='OFF';
-        ]]
+        set_full_column_names(false)
         return test:execsql2 [[
             SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
         ]]
@@ -1284,9 +1280,7 @@ test:do_execsql2_test(
 test:do_test(
     "select1-6.9.15",
     function()
-        test:execsql [[
-            PRAGMA full_column_names='ON';
-        ]]
+        set_full_column_names(true)
         return test:execsql2 [[
             SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
         ]]
@@ -1306,9 +1300,7 @@ test:do_execsql2_test(
         -- </select1-6.9.16>
     })
 
-test:execsql [[
-    PRAGMA full_column_names='OFF';
-]]
+set_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..092e8bf 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 "
+box.space._session_settings:update('sql_recursive_triggers', {{'=', 2, 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..192b707 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -58,7 +58,8 @@ 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 "
+
+box.space._session_settings:update('sql_recursive_triggers', {{'=', 2, 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..ef4d69d 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(43)
 
 --!./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 "
+box.space._session_settings:update('sql_recursive_triggers', {{'=', 2, true}})
 ---------------------------------------------------------------------------
 -- This block of tests, triggerC-1.*, are not aimed at any specific
 -- property of the triggers sub-system. They were created to debug
@@ -501,15 +498,6 @@ test:do_execsql_test(
 --     "
 --   } [concat $t5g $t5]
 -- }
-test:do_execsql_test(
-    "triggerC-5.3.0",
-    [[
-        PRAGMA recursive_triggers = off
-    ]], {
-        -- <triggerC-5.3.0>
-
-        -- </triggerC-5.3.0>
-    })
 
 -- MUST_WORK_TEST
 -- foreach {n dml t5g t5} {
@@ -531,51 +519,6 @@ test:do_execsql_test(
 --     "
 --   } [concat $t5g $t5]
 -- }
-test:do_execsql_test(
-    "triggerC-5.3.8",
-    [[
-        PRAGMA recursive_triggers = on
-    ]], {
-        -- <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
 -- #-------------------------------------------------------------------------
@@ -890,7 +833,7 @@ test:execsql(
 test:do_execsql_test(
     "triggerC-13.1",
     [[
-        PRAGMA recursive_triggers = 'ON';
+        UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_recursive_triggers';
         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 +917,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "triggerC-15.1.1",
     [[
-        PRAGMA recursive_triggers = 1;
+        UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_recursive_triggers';
         CREATE TABLE node(
             id int not null primary key,
             pid int not null default 0,
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index b82575f..a49d1c0 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -39,7 +39,7 @@ test:do_test(
     "whereA-1.2",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=1;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_reverse_unordered_selects';
             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;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_reverse_unordered_selects';
             SELECT * FROM t1;
         ]]
     end, {
@@ -75,14 +75,12 @@ test:do_test(
 test:do_test(
     "whereA-1.6",
     function()
-        return test:execsql [[
-            PRAGMA reverse_unordered_selects;
-        ]]
-    end, {
+        return box.space._session_settings:get('sql_reverse_unordered_selects').value
+    end,
         -- <whereA-1.6>
-        1
+        true
         -- </whereA-1.6>
-    })
+    )
 
 test:do_execsql_test(
     "whereA-1.8",
@@ -108,7 +106,7 @@ test:do_test(
     "whereA-2.1",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=0;
+            UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_reverse_unordered_selects';
             SELECT * FROM t1 WHERE a>0;
         ]]
     end, {
@@ -121,7 +119,7 @@ test:do_test(
     "whereA-2.2",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=1;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_reverse_unordered_selects';
             SELECT * FROM t1 WHERE a>0;
         ]]
     end, {
@@ -140,7 +138,7 @@ test:do_test(
     "whe:reA-3.1",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=0;
+            UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_reverse_unordered_selects';
             SELECT * FROM t1 WHERE b>0;
         ]]
     end, {
@@ -153,7 +151,7 @@ test:do_test(
     "whereA-3.2",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=1;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_reverse_unordered_selects';
             SELECT * FROM t1 WHERE b>0;
         ]]
     end, {
@@ -166,7 +164,7 @@ test:do_test(
     "whereA-3.3",
     function()
         return test:execsql [[
-            PRAGMA reverse_unordered_selects=1;
+            UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_reverse_unordered_selects';
             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..ba28b50 100644
--- a/test/sql/check-clear-ephemeral.result
+++ b/test/sql/check-clear-ephemeral.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -14,8 +13,6 @@ 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)")
 -- 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..694d9a8 100644
--- a/test/sql/check-clear-ephemeral.test.lua
+++ b/test/sql/check-clear-ephemeral.test.lua
@@ -1,14 +1,11 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, 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)")
-
 -- 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 dfea848..0a4b9ca 100644
--- a/test/sql/checks.result
+++ b/test/sql/checks.result
@@ -11,9 +11,8 @@ 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 --
 -- gh-3272: Move SQL CHECK into server
@@ -733,13 +732,6 @@ physics_ck:drop()
 -- Make sure that ck constraints are turned on/off with
 -- :enable configurator.
 --
-engine = test_run:get_cfg('engine')
----
-...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
----
-- row_count: 0
-...
 box.execute("CREATE TABLE test(a INT PRIMARY KEY);");
 ---
 - row_count: 1
diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
index 4d33823..301f8ea 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 --
 -- gh-3272: Move SQL CHECK into server
@@ -239,8 +239,6 @@ physics_ck:drop()
 -- Make sure that ck constraints are turned on/off with
 -- :enable configurator.
 --
-engine = test_run:get_cfg('engine')
-box.execute('pragma 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..2844a1e 100644
--- a/test/sql/clear.result
+++ b/test/sql/clear.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -18,8 +17,6 @@ box.execute("CREATE UNIQUE INDEX zoobar2 ON zoobar(c1, c4)")
 ---
 - row_count: 1
 ...
--- Debug
--- box.execute("PRAGMA 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..d099de5 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
@@ -8,9 +8,6 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
 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;")
-
 -- 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 f8696b6..4e43a7c 100644
--- a/test/sql/collation.result
+++ b/test/sql/collation.result
@@ -7,9 +7,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- gh-3010: COLLATE after LIMIT should throw an error
 -- All of these tests should throw error "near "COLLATE": syntax error"
diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
index a013253..9a2042c 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- gh-3010: COLLATE after LIMIT should throw an error
 
diff --git a/test/sql/ddl.result b/test/sql/ddl.result
index 28acf37..aecd57a 100644
--- a/test/sql/ddl.result
+++ b/test/sql/ddl.result
@@ -8,9 +8,8 @@ json = require('json')
 engine = test_run:get_cfg('engine')
  | ---
  | ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
  | ---
- | - row_count: 0
  | ...
 
 --
diff --git a/test/sql/ddl.test.lua b/test/sql/ddl.test.lua
index 6067b61..b99a520 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 --
 -- gh-4086: SQL transactional DDL.
diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
index ca58feb..b517b5d 100644
--- a/test/sql/delete-multiple-idx.result
+++ b/test/sql/delete-multiple-idx.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- Create space.
@@ -18,8 +17,6 @@ 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)")
 -- 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..2ca07da 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
@@ -8,9 +8,6 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
 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)")
-
 -- Seed entries.
 box.execute("INSERT INTO t3 VALUES (1, 1, NULL);");
 box.execute("INSERT INTO t3 VALUES(2,9,NULL);");
diff --git a/test/sql/delete.result b/test/sql/delete.result
index e27c79d..8c53342 100644
--- a/test/sql/delete.result
+++ b/test/sql/delete.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -14,8 +13,6 @@ 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)")
 -- 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..130a8ed 100644
--- a/test/sql/delete.test.lua
+++ b/test/sql/delete.test.lua
@@ -1,15 +1,12 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
 -- create space
 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)")
-
 -- Seed entries
 box.execute("INSERT INTO t1 VALUES(1, 2);");
 box.execute("INSERT INTO t1 VALUES(2, 4);");
diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
index e8eb642..0c7fe80 100644
--- a/test/sql/drop-index.result
+++ b/test/sql/drop-index.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -22,8 +21,6 @@ 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)")
 -- 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..13cd6be 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
@@ -10,9 +10,6 @@ box.execute("CREATE TABLE zzoobar (c1 NUMBER, c2 INT PRIMARY KEY, c3 TEXT, c4 NU
 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)")
-
 -- 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..807b42c 100644
--- a/test/sql/drop-table.result
+++ b/test/sql/drop-table.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -14,8 +13,6 @@ 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("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..19ee639 100644
--- a/test/sql/drop-table.test.lua
+++ b/test/sql/drop-table.test.lua
@@ -1,15 +1,12 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
 -- create space
 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("CREATE INDEX zb ON zzzoobar(c1, c3)")
 
 -- Dummy entry
diff --git a/test/sql/engine.cfg b/test/sql/engine.cfg
index efc42a1..a97f60a 100644
--- a/test/sql/engine.cfg
+++ b/test/sql/engine.cfg
@@ -2,9 +2,6 @@
     "vinyl-opts.test.lua" : {
         "vinyl": {"engine": "vinyl"}
     },
-    "sql-debug.test.lua": {
-        "memtx": {"engine": "memtx"}
-    },
     "bind.test.lua": {
         "remote": {"remote": "true"},
         "local": {"remote": "false"}
diff --git a/test/sql/engine.result b/test/sql/engine.result
index ff87129..a246677 100644
--- a/test/sql/engine.result
+++ b/test/sql/engine.result
@@ -4,9 +4,9 @@ env = require('test_run')
 test_run = env.new()
 ---
 ...
-box.execute("pragma sql_default_engine='vinyl'")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
 ---
@@ -16,9 +16,9 @@ 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.space._session_settings:update('sql_default_engine', {{'=', 2, 'memtx'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'memtx']
 ...
 box.execute("CREATE TABLE t3_memtx(a INT PRIMARY KEY, b INT, c INT);")
 ---
@@ -66,9 +66,9 @@ assert(box.space.T1_MEMTX.engine == 'memtx')
 ---
 - true
 ...
-box.execute("pragma sql_default_engine='vinyl'")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute("CREATE TABLE t2_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl'")
 ---
diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
index 112d3d3..d71cbc1 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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, '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..68c001f 100644
--- a/test/sql/errinj.result
+++ b/test/sql/errinj.result
@@ -7,9 +7,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 errinj = box.error.injection
 ---
diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
index b978767..72e96a9 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 errinj = box.error.injection
 fiber = require('fiber')
 
diff --git a/test/sql/full_metadata.result b/test/sql/full_metadata.result
index ca69f41..5a93c41 100644
--- a/test/sql/full_metadata.result
+++ b/test/sql/full_metadata.result
@@ -46,9 +46,9 @@ test_run:cmd("setopt delimiter ''");
  | - true
  | ...
 
-execute("PRAGMA full_metadata = true;")
+execute([[UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_metadata';]])
  | ---
- | - row_count: 0
+ | - row_count: 1
  | ...
 -- Make sure collation is presented in extended metadata.
 --
@@ -204,9 +204,9 @@ execute("SELECT x, y FROM v;")
  |   - [2, 1]
  | ...
 
-execute("PRAGMA full_metadata = false;")
+execute([[UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_metadata';]])
  | ---
- | - row_count: 0
+ | - row_count: 1
  | ...
 
 test_run:cmd("setopt delimiter ';'")
diff --git a/test/sql/full_metadata.test.lua b/test/sql/full_metadata.test.lua
index 576c49a..a9ba320 100644
--- a/test/sql/full_metadata.test.lua
+++ b/test/sql/full_metadata.test.lua
@@ -23,7 +23,7 @@ else
 end;
 test_run:cmd("setopt delimiter ''");
 
-execute("PRAGMA full_metadata = true;")
+execute([[UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_metadata';]])
 -- Make sure collation is presented in extended metadata.
 --
 execute("SELECT 'aSd' COLLATE \"unicode_ci\";")
@@ -45,7 +45,7 @@ box.execute("CREATE VIEW v AS SELECT id + 1 AS x, a AS y, c || 'abc' FROM t;")
 execute("SELECT * FROM v;")
 execute("SELECT x, y FROM v;")
 
-execute("PRAGMA full_metadata = false;")
+execute([[UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_metadata';]])
 
 test_run:cmd("setopt delimiter ';'")
 if remote then
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index a0a67a1..3709df7 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- Check errors during function create process
 fiber = require('fiber')
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index 0b32ea9..b76789f 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..5ac82b1 100644
--- a/test/sql/gh-2362-select-access-rights.result
+++ b/test/sql/gh-2362-select-access-rights.result
@@ -4,12 +4,11 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-nb = require('net.box')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
 ...
-box.execute("PRAGMA sql_default_engine='"..engine.."'")
+nb = require('net.box')
 ---
-- row_count: 0
 ...
 box.execute("CREATE TABLE t1 (s1 INT PRIMARY KEY, s2 INT UNIQUE);")
 ---
diff --git a/test/sql/gh-2362-select-access-rights.test.lua b/test/sql/gh-2362-select-access-rights.test.lua
index f2b66b6..3409dcd 100644
--- a/test/sql/gh-2362-select-access-rights.test.lua
+++ b/test/sql/gh-2362-select-access-rights.test.lua
@@ -1,8 +1,8 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 nb = require('net.box')
 
-box.execute("PRAGMA 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..263b89d 100644
--- a/test/sql/gh-2929-primary-key.result
+++ b/test/sql/gh-2929-primary-key.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- 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-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
index 9cc6cd5..935d297 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..71c06e5 100644
--- a/test/sql/gh-2981-check-autoinc.result
+++ b/test/sql/gh-2981-check-autoinc.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 box.cfg{}
 ---
diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
index 0eb8f73..ed60964 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..35d8572 100644
--- a/test/sql/gh-3199-no-mem-leaks.result
+++ b/test/sql/gh-3199-no-mem-leaks.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 fiber = require('fiber')
 ---
diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
index 54a6ce5..41648d0 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..86965c4 100644
--- a/test/sql/gh-3613-idx-alter-update-2.result
+++ b/test/sql/gh-3613-idx-alter-update-2.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
 ---
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..f67b847 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..e8afc4d 100644
--- a/test/sql/gh-3613-idx-alter-update.result
+++ b/test/sql/gh-3613-idx-alter-update.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 box.execute('CREATE TABLE t (s1 INT PRIMARY KEY)')
 ---
diff --git a/test/sql/gh-3613-idx-alter-update.test.lua b/test/sql/gh-3613-idx-alter-update.test.lua
index 3027182..56843d3 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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 2cd6150..0a1af28 100644
--- a/test/sql/gh-3888-values-blob-assert.result
+++ b/test/sql/gh-3888-values-blob-assert.result
@@ -10,9 +10,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- check 'VALUES' against typedef keywords (should fail)
 box.execute('VALUES(scalar)')
diff --git a/test/sql/gh-3888-values-blob-assert.test.lua b/test/sql/gh-3888-values-blob-assert.test.lua
index 0b7c385..497d563 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..f8981e4 100644
--- a/test/sql/gh2141-delete-trigger-drop-table.result
+++ b/test/sql/gh2141-delete-trigger-drop-table.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- create space
 box.execute("CREATE TABLE t(id INT PRIMARY KEY)")
diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
index 4d21fd7..904b52e 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..f3658ed 100644
--- a/test/sql/gh2251-multiple-update.result
+++ b/test/sql/gh2251-multiple-update.result
@@ -5,9 +5,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 box.execute("CREATE TABLE t1(a integer primary key, b INT UNIQUE, e INT);")
diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
index 4d55096..2d0e07d 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
index d69fcbd..3ee49b3 100644
--- a/test/sql/gh2483-remote-persistency-check.result
+++ b/test/sql/gh2483-remote-persistency-check.result
@@ -8,9 +8,8 @@ test_run = env.new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 box.schema.user.grant('guest', 'read,write,execute', 'universe')
 ---
diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
index 7db1602..b36b402 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..b84925c 100644
--- a/test/sql/gh2808-inline-unique-persistency-check.result
+++ b/test/sql/gh2808-inline-unique-persistency-check.result
@@ -8,9 +8,8 @@ test_run = env.new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- 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/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
index 26b646a..bbffc92 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..f7b9dfa 100644
--- a/test/sql/icu-upper-lower.result
+++ b/test/sql/icu-upper-lower.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 test_run:cmd("setopt delimiter ';'")
 ---
diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
index 00e9699..f358733 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 test_run:cmd("setopt delimiter ';'")
 
diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
index 1cf44c9..ff2930e 100644
--- a/test/sql/insert-unique.result
+++ b/test/sql/insert-unique.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -18,8 +17,6 @@ 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)")
 -- 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..2c1214a 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
@@ -8,9 +8,6 @@ box.execute('pragma sql_default_engine=\''..engine..'\'')
 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)")
-
 -- 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 d6223ff..db5c2f7 100644
--- a/test/sql/integer-overflow.result
+++ b/test/sql/integer-overflow.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- gh-3735: make sure that integer overflows errors are
 -- handled during VDBE execution.
diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
index 17051f9..2ac9799 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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 3240c2b..9f67df9 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -7,9 +7,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 box.execute('create table test (id int primary key, a NUMBER, b text)')
 ---
diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
index b5ec2c0..4019fb7 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..1cd488f 100644
--- a/test/sql/max-on-index.result
+++ b/test/sql/max-on-index.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -24,8 +23,6 @@ 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)")
 -- 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..912602e 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
@@ -12,9 +12,6 @@ box.execute("CREATE INDEX test1_index ON test1 (f2)")
 -- integer affinity
 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)")
-
 -- Seed entries
 box.execute("INSERT INTO test1 VALUES(1, 2)");
 box.execute("INSERT INTO test1 VALUES(2, NULL)");
diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
index 69e3ee0..002dbd8 100644
--- a/test/sql/message-func-indexes.result
+++ b/test/sql/message-func-indexes.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- Creating tables.
 box.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
index 9ac5f47..3cbfe3e 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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 050d378..0190a58 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- Forbid multistatement queries.
 box.execute('select 1;')
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 541660c..6324422 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..12f2407 100644
--- a/test/sql/no-pk-space.result
+++ b/test/sql/no-pk-space.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 format = {}
 ---
diff --git a/test/sql/no-pk-space.test.lua b/test/sql/no-pk-space.test.lua
index 318c2ac..d7f9479 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 format = {}
 format[1] = {'id', 'integer'}
diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
index d5a6938..ab6e4f4 100644
--- a/test/sql/on-conflict.result
+++ b/test/sql/on-conflict.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 --
 -- Check that original sql ON CONFLICT clause is really
diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
index 1aa4d1b..ec85fe2 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..6d14d4c 100644
--- a/test/sql/persistency.result
+++ b/test/sql/persistency.result
@@ -7,9 +7,8 @@ test_run = env.new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- create space
 box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
index 1964453..fdd0bb6 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..02acd79 100644
--- a/test/sql/row-count.result
+++ b/test/sql/row-count.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- Test cases concerning row count calculations.
 --
@@ -314,13 +313,9 @@ box.execute("SELECT ROW_COUNT();")
   rows:
   - [0]
 ...
-box.execute('PRAGMA recursive_triggers')
+box.space._session_settings:get('sql_recursive_triggers')
 ---
-- metadata:
-  - name: recursive_triggers
-    type: integer
-  rows:
-  - [1]
+- ['sql_recursive_triggers', true]
 ...
 -- Clean-up.
 --
diff --git a/test/sql/row-count.test.lua b/test/sql/row-count.test.lua
index 369e7fa..d381672 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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.space._session_settings:get('sql_recursive_triggers')
 
 -- Clean-up.
 --
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index e48db30..509c33e 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- These tests check that SQL savepoints properly work outside
 -- transactions as well as inside transactions started in Lua.
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index 99622a4..f1b15c7 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..5bd46cd 100644
--- a/test/sql/select-null.result
+++ b/test/sql/select-null.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -14,8 +13,6 @@ 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)")
 -- 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..2ce964d 100644
--- a/test/sql/select-null.test.lua
+++ b/test/sql/select-null.test.lua
@@ -1,15 +1,12 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
 -- create space
 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)")
-
 -- Seed entries
 box.execute("INSERT INTO t3 VALUES(1, 'abc',NULL)");
 box.execute("INSERT INTO t3 VALUES(2, NULL,'xyz')");
diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
deleted file mode 100644
index ce87f11..0000000
--- a/test/sql/sql-debug.result
+++ /dev/null
@@ -1,55 +0,0 @@
-remote = require('net.box')
----
-...
-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
----
-...
-box.execute('PRAGMA parser_trace = 1')
----
-- row_count: 0
-...
-box.execute('PRAGMA parser_trace')
----
-- metadata:
-  - name: parser_trace
-    type: integer
-  rows:
-  - [1]
-...
-box.execute('PRAGMA parser_trace = '.. result[1][1])
----
-- row_count: 0
-...
---
--- Make PRAGMA command return the result as a result set.
---
-box.execute('PRAGMA')
----
-- metadata:
-  - name: pragma_name
-    type: text
-  - name: pragma_value
-    type: integer
-  rows:
-  - ['defer_foreign_keys', 0]
-  - ['full_column_names', 0]
-  - ['full_metadata', 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]
-...
diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua
deleted file mode 100644
index edd0ef4..0000000
--- a/test/sql/sql-debug.test.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-remote = require('net.box')
-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
-box.execute('PRAGMA parser_trace = 1')
-box.execute('PRAGMA parser_trace')
-box.execute('PRAGMA parser_trace = '.. result[1][1])
-
---
--- Make PRAGMA command return the result as a result set.
---
-box.execute('PRAGMA')
diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
index 5477a2a..7e3a04e 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- Initializing some things.
 box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT);")
diff --git a/test/sql/suite.ini b/test/sql/suite.ini
index a8664c5..57e78f1 100644
--- a/test/sql/suite.ini
+++ b/test/sql/suite.ini
@@ -7,7 +7,7 @@ use_unix_sockets_iproto = True
 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
+release_disabled = errinj.test.lua view_delayed_wal.test.lua
 disabled = sql-statN-index-drop.test.lua
 pretest_clean = True
 fragile = dll.test.lua           ; gh-4427
diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
index 1ae9ef2..d127bd0 100644
--- a/test/sql/tokenizer.result
+++ b/test/sql/tokenizer.result
@@ -7,9 +7,8 @@ test_run = env.new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 sql_tokenizer = require('sql_tokenizer')
 ---
diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
index 3f5dd12..39fdf1f 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.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 sql_tokenizer = require('sql_tokenizer')
 
diff --git a/test/sql/transition.result b/test/sql/transition.result
index 9738092..c14055b 100644
--- a/test/sql/transition.result
+++ b/test/sql/transition.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- create space
 box.execute("CREATE TABLE foobar (foo INT PRIMARY KEY, bar TEXT)")
diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
index a05c26a..053a3cd 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..91c35a3 100644
--- a/test/sql/transitive-transactions.result
+++ b/test/sql/transitive-transactions.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute("pragma sql_default_engine=\'"..engine.."\'")
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 test_run:cmd("setopt delimiter ';'")
 ---
@@ -88,7 +87,7 @@ box.space.PARENT:select();
 ---
 - - [1, 1]
 ...
--- Make sure that 'PRAGMA defer_foreign_keys' works.
+-- Make sure that setting '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 +115,7 @@ box.space.PARENT:select();
 ---
 - - [1, 1]
 ...
-box.execute('PRAGMA defer_foreign_keys = 1;')
+box.space._session_settings:update('sql_defer_foreign_keys', {{'=', 2, true}})
 box.rollback()
 fk_defer();
 ---
@@ -131,7 +130,7 @@ box.space.PARENT:select();
   - [2, 2]
 ...
 -- Cleanup
-box.execute('PRAGMA defer_foreign_keys = 0;')
+box.space._session_settings:update('sql_defer_foreign_keys', {{'=', 2, false}})
 
 box.execute('DROP TABLE child;');
 ---
diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
index 4633f07..5565de7 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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 setting '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,12 @@ end;
 fk_defer();
 box.space.CHILD:select();
 box.space.PARENT:select();
-box.execute('PRAGMA defer_foreign_keys = 1;')
+box.space._session_settings:update('sql_defer_foreign_keys', {{'=', 2, true}})
 box.rollback()
 fk_defer();
 box.space.CHILD:select();
 box.space.PARENT:select();
-
-box.execute('PRAGMA defer_foreign_keys = 0;')
+box.space._session_settings:update('sql_defer_foreign_keys', {{'=', 2, false}})
 
 -- Cleanup
 box.execute('DROP TABLE child;');
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index 7611ea9..ceecb8e 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -7,9 +7,8 @@ test_run = env.new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- 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
@@ -292,9 +291,9 @@ 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.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
 ---
@@ -304,9 +303,9 @@ 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.space._session_settings:update('sql_default_engine', {{'=', 2, 'memtx'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'memtx']
 ...
 box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
 ---
@@ -336,9 +335,9 @@ box.execute("DROP TABLE n;")
 - row_count: 1
 ...
 -- Case 2: Src 'memtx' table; Dst 'vinyl' table
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'memtx'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'memtx']
 ...
 box.execute("CREATE TABLE m (s0 INT PRIMARY KEY, s1 TEXT UNIQUE);")
 ---
@@ -348,9 +347,9 @@ 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.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute("CREATE TABLE n (s0 INT PRIMARY KEY, s1 TEXT UNIQUE, s2 NUMBER);")
 ---
@@ -380,17 +379,17 @@ box.execute("DROP TABLE n;")
 - row_count: 1
 ...
 -- Test SQL Transaction with LUA
-box.execute("PRAGMA sql_default_engine ('memtx');")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'memtx'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'memtx']
 ...
 box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
 ---
 - row_count: 1
 ...
-box.execute("PRAGMA sql_default_engine='vinyl'")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
 ---
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index f0397dc..f5c8a39 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, '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.space._session_settings:update('sql_default_engine', {{'=', 2, 'memtx'}})
 box.execute("CREATE TABLE test (id INT PRIMARY KEY)")
-box.execute("PRAGMA sql_default_engine='vinyl'")
+box.space._session_settings:update('sql_default_engine', {{'=', 2, '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..2b6525e 100644
--- a/test/sql/update-with-nested-select.result
+++ b/test/sql/update-with-nested-select.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- box.cfg()
 -- create space
@@ -14,8 +13,6 @@ 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)")
 -- 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..631ce3566 100644
--- a/test/sql/update-with-nested-select.test.lua
+++ b/test/sql/update-with-nested-select.test.lua
@@ -1,15 +1,12 @@
 test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- box.cfg()
 
 -- create space
 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)")
-
 -- Seed entries
 box.execute("INSERT INTO t1 VALUES(1,4,6);");
 box.execute("INSERT INTO t1 VALUES(2,5,7);");
diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
index f0997e1..8803d2d 100644
--- a/test/sql/upgrade.result
+++ b/test/sql/upgrade.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 work_dir = 'sql/upgrade/1.10/'
 ---
diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
index 37425ae..ad3b20e 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..f3b4da1 100644
--- a/test/sql/view.result
+++ b/test/sql/view.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 -- Verify that constraints on 'view' option are working.
 -- box.cfg()
diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
index 0008056..76ea303 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..14f3bff 100644
--- a/test/sql/view_delayed_wal.result
+++ b/test/sql/view_delayed_wal.result
@@ -4,9 +4,8 @@ test_run = require('test_run').new()
 engine = test_run:get_cfg('engine')
 ---
 ...
-box.execute('pragma sql_default_engine=\''..engine..'\'')
+_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
-- row_count: 0
 ...
 fiber = require('fiber')
 ---
diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
index 7e6fce6..6660fd2 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.space._session_settings:update('sql_default_engine', {{'=', 2, 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..4d80245 100644
--- a/test/sql/vinyl-opts.result
+++ b/test/sql/vinyl-opts.result
@@ -13,9 +13,9 @@ test_run:cmd("switch test")
 ---
 - true
 ...
-box.execute('pragma sql_default_engine= \'vinyl\'')
+box.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 ---
-- row_count: 0
+- ['sql_default_engine', 'vinyl']
 ...
 box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
 ---
diff --git a/test/sql/vinyl-opts.test.lua b/test/sql/vinyl-opts.test.lua
index 4460724..a0cb775 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.space._session_settings:update('sql_default_engine', {{'=', 2, 'vinyl'}})
 box.execute('CREATE TABLE v1 (id INT PRIMARY KEY, b INT);')
 box.space.V1.index[0].options
 
-- 
2.7.4



More information about the Tarantool-patches mailing list