Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH 1/3] sql: remove usless #ifdef directives
Date: Tue,  3 Apr 2018 17:54:28 +0300	[thread overview]
Message-ID: <36f222edde4edcd81e544a2c3e83c5b0aef721bd.1522763649.git.korablev@tarantool.org> (raw)
In-Reply-To: <cover.1522763649.git.korablev@tarantool.org>
In-Reply-To: <cover.1522763649.git.korablev@tarantool.org>

Since in our SQL implemetation triggers, foreign keys and views are
always available, there is no need in #ifdef directives which
turn them off.
Removed: SQLITE_OMIT_VIEW, SQLITE_OMIT_TRIGGER, SQLITE_OMIT_FOREIGN_KEY
defines. Also, removed obsolete compelete.c source file.
---
 src/box/sql/CMakeLists.txt |   1 -
 src/box/sql/alter.c        |   2 -
 src/box/sql/attach.c       |   6 -
 src/box/sql/build.c        |  20 ---
 src/box/sql/complete.c     | 333 ---------------------------------------------
 src/box/sql/delete.c       |  18 ---
 src/box/sql/expr.c         |   5 +-
 src/box/sql/fkey.c         |   8 --
 src/box/sql/insert.c       |  15 --
 src/box/sql/parse.c        | 320 +++++++++++++++++++++----------------------
 src/box/sql/parse.y        |   7 -
 src/box/sql/pragma.c       |   8 --
 src/box/sql/pragma.h       |   8 --
 src/box/sql/resolve.c      |   3 -
 src/box/sql/select.c       |  20 ++-
 src/box/sql/sqliteInt.h    |  39 ------
 src/box/sql/treeview.c     |   2 -
 src/box/sql/trigger.c      |   3 -
 src/box/sql/update.c       |  15 --
 src/box/sql/vdbe.c         |   5 -
 src/box/sql/vdbe.h         |   2 -
 src/box/sql/vdbeInt.h      |   4 -
 src/box/sql/vdbeaux.c      |   4 -
 23 files changed, 169 insertions(+), 679 deletions(-)
 delete mode 100644 src/box/sql/complete.c

diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 678eb4cc4..65143f431 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -35,7 +35,6 @@ add_library(sql STATIC
         cursor.c
     build.c
     callback.c
-    complete.c
     date.c
     delete.c
     expr.c
diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index 054c0856c..87de03217 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -106,13 +106,11 @@ sqlite3AlterRenameTable(Parse * pParse,	/* Parser context. */
 		goto exit_rename_table;
 	}
 
-#ifndef SQLITE_OMIT_VIEW
 	if (space_is_view(pTab)) {
 		sqlite3ErrorMsg(pParse, "view %s may not be altered",
 				pTab->zName);
 		goto exit_rename_table;
 	}
-#endif
 
 	/* Begin a transaction for database.
 	 * Then modify the schema cookie (since the ALTER TABLE modifies the
diff --git a/src/box/sql/attach.c b/src/box/sql/attach.c
index 0a68b76ca..59492351c 100644
--- a/src/box/sql/attach.c
+++ b/src/box/sql/attach.c
@@ -83,17 +83,14 @@ sqlite3FixSrcList(DbFixer * pFix,	/* Context of the fixation */
 		if (pFix->bVarOnly == 0) {
 			pItem->pSchema = pFix->pSchema;
 		}
-#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
 		if (sqlite3FixSelect(pFix, pItem->pSelect))
 			return 1;
 		if (sqlite3FixExpr(pFix, pItem->pOn))
 			return 1;
-#endif
 	}
 	return 0;
 }
 
-#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
 int
 sqlite3FixSelect(DbFixer * pFix,	/* Context of the fixation */
 		 Select * pSelect	/* The SELECT statement to be fixed to one database */
@@ -178,9 +175,7 @@ sqlite3FixExprList(DbFixer * pFix,	/* Context of the fixation */
 	}
 	return 0;
 }
-#endif
 
-#ifndef SQLITE_OMIT_TRIGGER
 int
 sqlite3FixTriggerStep(DbFixer * pFix,	/* Context of the fixation */
 		      TriggerStep * pStep	/* The trigger step be fixed to one database */
@@ -200,4 +195,3 @@ sqlite3FixTriggerStep(DbFixer * pFix,	/* Context of the fixation */
 	}
 	return 0;
 }
-#endif
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 5e3ed0f39..75b26a93a 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1912,11 +1912,9 @@ sqlite3EndTable(Parse * pParse,	/* Parse context */
 		if (p->pSelect == 0) {
 			/* A regular table */
 			zType = "TABLE";
-#ifndef SQLITE_OMIT_VIEW
 		} else {
 			/* A view */
 			zType = "VIEW";
-#endif
 		}
 
 		/* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT
@@ -2011,7 +2009,6 @@ sqlite3EndTable(Parse * pParse,	/* Parse context */
 	}
 }
 
-#ifndef SQLITE_OMIT_VIEW
 /*
  * The parser calls this routine in order to create a new VIEW
  */
@@ -2080,9 +2077,7 @@ sqlite3CreateView(Parse * pParse,	/* The parsing context */
 	sqlite3ExprListDelete(db, pCNames);
 	return;
 }
-#endif				/* SQLITE_OMIT_VIEW */
 
-#if !defined(SQLITE_OMIT_VIEW)
 /*
  * The Table structure pTable is really a VIEW.  Fill in the names of
  * the columns of the view in the pTable structure.  Return the number
@@ -2099,7 +2094,6 @@ sqlite3ViewGetColumnNames(Parse * pParse, Table * pTable)
 
 	assert(pTable);
 
-#ifndef SQLITE_OMIT_VIEW
 	/* A positive nCol means the columns names for this view are
 	 * already known.
 	 */
@@ -2179,12 +2173,9 @@ sqlite3ViewGetColumnNames(Parse * pParse, Table * pTable)
 	} else {
 		nErr++;
 	}
-#endif				/* SQLITE_OMIT_VIEW */
 	return nErr;
 }
-#endif				/* !defined(SQLITE_OMIT_VIEW) */
 
-#ifndef SQLITE_OMIT_VIEW
 /*
  * Clear the column names from every VIEW in database idx.
  */
@@ -2202,9 +2193,6 @@ sqliteViewResetAll(sqlite3 * db)
 		}
 	}
 }
-#else
-#define sqliteViewResetAll(A,B)
-#endif				/* SQLITE_OMIT_VIEW */
 
 /*
  * Remove entries from the sqlite_statN tables (for N in (1,2,3))
@@ -2385,7 +2373,6 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int isView, int noErr)
 			sqlite3CodeVerifySchema(pParse);
 		goto exit_drop_table;
 	}
-#ifndef SQLITE_OMIT_VIEW
 	/* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used
 	 * on a table.
 	 */
@@ -2399,7 +2386,6 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int isView, int noErr)
 				pTab->zName);
 		goto exit_drop_table;
 	}
-#endif
 
 	/* Generate code to remove the table from Tarantool and internal SQL
 	 * tables. Basically, it consists from 3 stages:
@@ -2448,7 +2434,6 @@ sqlite3CreateForeignKey(Parse * pParse,	/* Parsing context */
     )
 {
 	sqlite3 *db = pParse->db;
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 	FKey *pFKey = 0;
 	FKey *pNextTo;
 	Table *p = pParse->pNewTable;
@@ -2552,7 +2537,6 @@ sqlite3CreateForeignKey(Parse * pParse,	/* Parsing context */
 
  fk_end:
 	sqlite3DbFree(db, pFKey);
-#endif				/* !defined(SQLITE_OMIT_FOREIGN_KEY) */
 	sqlite3ExprListDelete(db, pFromCol);
 	sqlite3ExprListDelete(db, pToCol);
 }
@@ -2567,14 +2551,12 @@ sqlite3CreateForeignKey(Parse * pParse,	/* Parsing context */
 void
 sqlite3DeferForeignKey(Parse * pParse, int isDeferred)
 {
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 	Table *pTab;
 	FKey *pFKey;
 	if ((pTab = pParse->pNewTable) == 0 || (pFKey = pTab->pFKey) == 0)
 		return;
 	assert(isDeferred == 0 || isDeferred == 1);	/* EV: R-30323-21917 */
 	pFKey->isDeferred = (u8) isDeferred;
-#endif
 }
 
 /*
@@ -2896,12 +2878,10 @@ sqlite3CreateIndex(Parse * pParse,	/* All information about this parse */
 
 	assert(pTab != 0);
 	assert(pParse->nErr == 0);
-#ifndef SQLITE_OMIT_VIEW
 	if (pTab->pSelect) {
 		sqlite3ErrorMsg(pParse, "views may not be indexed");
 		goto exit_create_index;
 	}
-#endif
 	/*
 	 * Find the name of the index.  Make sure there is not already another
 	 * index or table with the same name.
diff --git a/src/box/sql/complete.c b/src/box/sql/complete.c
deleted file mode 100644
index bdd17e1da..000000000
--- a/src/box/sql/complete.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright 2010-2017, Tarantool AUTHORS, please see AUTHORS file.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- *    copyright notice, this list of conditions and the
- *    following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials
- *    provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * An tokenizer for SQL
- *
- * This file contains C code that implements the sqlite3_complete() API.
- * This code used to be part of the tokenizer.c source file.  But by
- * separating it out, the code will be automatically omitted from
- * static links that do not use it.
- */
-#include "sqliteInt.h"
-#ifndef SQLITE_OMIT_COMPLETE
-
-/*
- * This is defined in tokenize.c.  We just have to import the definition.
- */
-#ifndef SQLITE_AMALGAMATION
-#ifdef SQLITE_ASCII
-#define IdChar(C)  ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0)
-#endif
-#ifdef SQLITE_EBCDIC
-extern const char sqlite3IsEbcdicIdChar[];
-#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))
-#endif
-#endif				/* SQLITE_AMALGAMATION */
-
-/*
- * Token types used by the sqlite3_complete() routine.  See the header
- * comments on that procedure for additional information.
- */
-#define tkSEMI    0
-#define tkWS      1
-#define tkOTHER   2
-#ifndef SQLITE_OMIT_TRIGGER
-#define tkEXPLAIN 3
-#define tkCREATE  4
-#define tkTEMP    5
-#define tkTRIGGER 6
-#define tkEND     7
-#endif
-
-/*
- * Return TRUE if the given SQL string ends in a semicolon.
- *
- * Special handling is require for CREATE TRIGGER statements.
- * Whenever the CREATE TRIGGER keywords are seen, the statement
- * must end with ";END;".
- *
- * This implementation uses a state machine with 8 states:
- *
- *   (0) INVALID   We have not yet seen a non-whitespace character.
- *
- *   (1) START     At the beginning or end of an SQL statement.  This routine
- *                 returns 1 if it ends in the START state and 0 if it ends
- *                 in any other state.
- *
- *   (2) NORMAL    We are in the middle of statement which ends with a single
- *                 semicolon.
- *
- *   (3) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of
- *                 a statement.
- *
- *   (4) CREATE    The keyword CREATE has been seen at the beginning of a
- *                 statement, possibly preceded by EXPLAIN and/or followed by
- *                 TEMP or TEMPORARY
- *
- *   (5) TRIGGER   We are in the middle of a trigger definition that must be
- *                 ended by a semicolon, the keyword END, and another semicolon.
- *
- *   (6) SEMI      We've seen the first semicolon in the ";END;" that occurs at
- *                 the end of a trigger definition.
- *
- *   (7) END       We've seen the ";END" of the ";END;" that occurs at the end
- *                 of a trigger definition.
- *
- * Transitions between states above are determined by tokens extracted
- * from the input.  The following tokens are significant:
- *
- *   (0) tkSEMI      A semicolon.
- *   (1) tkWS        Whitespace.
- *   (2) tkOTHER     Any other SQL token.
- *   (3) tkEXPLAIN   The "explain" keyword.
- *   (4) tkCREATE    The "create" keyword.
- *   (5) tkTEMP      The "temp" or "temporary" keyword.
- *   (6) tkTRIGGER   The "trigger" keyword.
- *   (7) tkEND       The "end" keyword.
- *
- * Whitespace never causes a state transition and is always ignored.
- * This means that a SQL string of all whitespace is invalid.
- *
- * If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
- * to recognize the end of a trigger can be omitted.  All we have to do
- * is look for a semicolon that is not part of an string or comment.
- */
-int
-sqlite3_complete(const char *zSql)
-{
-	u8 state = 0;		/* Current state, using numbers defined in header comment */
-	u8 token;		/* Value of the next token */
-
-#ifndef SQLITE_OMIT_TRIGGER
-	/* A complex statement machine used to detect the end of a CREATE TRIGGER
-	 * statement.  This is the normal case.
-	 */
-	static const u8 trans[8][8] = {
-		/* Token:                                                */
-		/* State:       *  SEMI  WS  OTHER  EXPLAIN  CREATE  TEMP  TRIGGER  END */
-		/* 0 INVALID: */ {1, 0, 2, 3, 4, 2, 2, 2,},
-		/* 1   START: */ {1, 1, 2, 3, 4, 2, 2, 2,},
-		/* 2  NORMAL: */ {1, 2, 2, 2, 2, 2, 2, 2,},
-		/* 3 EXPLAIN: */ {1, 3, 3, 2, 4, 2, 2, 2,},
-		/* 4  CREATE: */ {1, 4, 2, 2, 2, 4, 5, 2,},
-		/* 5 TRIGGER: */ {6, 5, 5, 5, 5, 5, 5, 5,},
-		/* 6    SEMI: */ {6, 6, 5, 5, 5, 5, 5, 7,},
-		/* 7     END: */ {1, 7, 5, 5, 5, 5, 5, 5,},
-	};
-#else
-	/* If triggers are not supported by this compile then the statement machine
-	 * used to detect the end of a statement is much simpler
-	 */
-	static const u8 trans[3][3] = {
-		/* Token:           */
-		/* State:       *  SEMI  WS  OTHER */
-		/* 0 INVALID: */ {1, 0, 2,},
-		/* 1   START: */ {1, 1, 2,},
-		/* 2  NORMAL: */ {1, 2, 2,},
-	};
-#endif				/* SQLITE_OMIT_TRIGGER */
-
-#ifdef SQLITE_ENABLE_API_ARMOR
-	if (zSql == 0) {
-		(void)SQLITE_MISUSE_BKPT;
-		return 0;
-	}
-#endif
-
-	while (*zSql) {
-		switch (*zSql) {
-		case ';':{	/* A semicolon */
-				token = tkSEMI;
-				break;
-			}
-		case ' ':
-		case '\r':
-		case '\t':
-		case '\n':
-		case '\f':{	/* White space is ignored */
-				token = tkWS;
-				break;
-			}
-		case '/':{	/* C-style comments */
-				if (zSql[1] != '*') {
-					token = tkOTHER;
-					break;
-				}
-				zSql += 2;
-				while (zSql[0]
-				       && (zSql[0] != '*' || zSql[1] != '/')) {
-					zSql++;
-				}
-				if (zSql[0] == 0)
-					return 0;
-				zSql++;
-				token = tkWS;
-				break;
-			}
-		case '-':{	/* SQL-style comments from "--" to end of line */
-				if (zSql[1] != '-') {
-					token = tkOTHER;
-					break;
-				}
-				while (*zSql && *zSql != '\n') {
-					zSql++;
-				}
-				if (*zSql == 0)
-					return state == 1;
-				token = tkWS;
-				break;
-			}
-		case '[':{	/* Microsoft-style identifiers in [...] */
-				zSql++;
-				while (*zSql && *zSql != ']') {
-					zSql++;
-				}
-				if (*zSql == 0)
-					return 0;
-				token = tkOTHER;
-				break;
-			}
-		case '`':	/* Grave-accent quoted symbols used by MySQL */
-		case '"':	/* single- and double-quoted strings */
-		case '\'':{
-				int c = *zSql;
-				zSql++;
-				while (*zSql && *zSql != c) {
-					zSql++;
-				}
-				if (*zSql == 0)
-					return 0;
-				token = tkOTHER;
-				break;
-			}
-		default:{
-#ifdef SQLITE_EBCDIC
-				unsigned char c;
-#endif
-				if (IdChar((u8) * zSql)) {
-					/* Keywords and unquoted identifiers */
-					int nId;
-					for (nId = 1; IdChar(zSql[nId]); nId++) {
-					}
-#ifdef SQLITE_OMIT_TRIGGER
-					token = tkOTHER;
-#else
-					switch (*zSql) {
-					case 'c':
-					case 'C':{
-							if (nId == 6
-							    &&
-							    sqlite3StrNICmp
-							    (zSql, "create",
-							     6) == 0) {
-								token =
-								    tkCREATE;
-							} else {
-								token = tkOTHER;
-							}
-							break;
-						}
-					case 't':
-					case 'T':{
-							if (nId == 7
-							    &&
-							    sqlite3StrNICmp
-							    (zSql, "trigger",
-							     7) == 0) {
-								token =
-								    tkTRIGGER;
-							} else if (nId == 4
-								   &&
-								   sqlite3StrNICmp
-								   (zSql,
-								    "temp",
-								    4) == 0) {
-								token = tkTEMP;
-							} else if (nId == 9
-								   &&
-								   sqlite3StrNICmp
-								   (zSql,
-								    "temporary",
-								    9) == 0) {
-								token = tkTEMP;
-							} else {
-								token = tkOTHER;
-							}
-							break;
-						}
-					case 'e':
-					case 'E':{
-							if (nId == 3
-							    &&
-							    sqlite3StrNICmp
-							    (zSql, "end",
-							     3) == 0) {
-								token = tkEND;
-							} else
-#ifndef SQLITE_OMIT_EXPLAIN
-							if (nId == 7
-								    &&
-								    sqlite3StrNICmp
-								    (zSql,
-									     "explain",
-									     7)
-								    == 0) {
-								token =
-								    tkEXPLAIN;
-							} else
-#endif
-							{
-								token = tkOTHER;
-							}
-							break;
-						}
-					default:{
-							token = tkOTHER;
-							break;
-						}
-					}
-#endif				/* SQLITE_OMIT_TRIGGER */
-					zSql += nId - 1;
-				} else {
-					/* Operators and special symbols */
-					token = tkOTHER;
-				}
-				break;
-			}
-		}
-		state = trans[state][token];
-		zSql++;
-	}
-	return state == 1;
-}
-
-#endif				/* SQLITE_OMIT_COMPLETE */
diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c
index 7d1d71577..a588082e1 100644
--- a/src/box/sql/delete.c
+++ b/src/box/sql/delete.c
@@ -87,17 +87,14 @@ sqlite3IsReadOnly(Parse * pParse, Table * pTab, int viewOk)
 				pTab->zName);
 		return 1;
 	}
-#ifndef SQLITE_OMIT_VIEW
 	if (!viewOk && space_is_view(pTab)) {
 		sqlite3ErrorMsg(pParse, "cannot modify %s because it is a view",
 				pTab->zName);
 		return 1;
 	}
-#endif
 	return 0;
 }
 
-#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
 /*
  * Evaluate a view and store its result in an ephemeral table.  The
  * pWhere argument is an optional WHERE clause that restricts the
@@ -128,7 +125,6 @@ sqlite3MaterializeView(Parse * pParse,	/* Parsing context */
 	sqlite3Select(pParse, pSel, &dest);
 	sqlite3SelectDelete(db, pSel);
 }
-#endif				/* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */
 
 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
 /*
@@ -261,11 +257,8 @@ sqlite3DeleteFrom(Parse * pParse,	/* The parser context */
 				 * subqueries in the WHERE clause
 				 */
 	struct session *user_session = current_session();
-
-#ifndef SQLITE_OMIT_TRIGGER
 	int isView;		/* True if attempting to delete from a view */
 	Trigger *pTrigger;	/* List of table triggers, if required */
-#endif
 
 	db = pParse->db;
 	if (pParse->nErr || db->mallocFailed) {
@@ -285,18 +278,9 @@ sqlite3DeleteFrom(Parse * pParse,	/* The parser context */
 	/* Figure out if we have any triggers and if the table being
 	 * deleted from is a view
 	 */
-#ifndef SQLITE_OMIT_TRIGGER
 	pTrigger = sqlite3TriggersExist(pTab, TK_DELETE, 0, 0);
 	isView = pTab->pSelect != 0;
 	bComplex = pTrigger || sqlite3FkRequired(pTab, 0);
-#else
-#define pTrigger 0
-#define isView 0
-#endif
-#ifdef SQLITE_OMIT_VIEW
-#undef isView
-#define isView 0
-#endif
 
 	/* If pTab is really a view, make sure it has been initialized.
 	 */
@@ -330,12 +314,10 @@ sqlite3DeleteFrom(Parse * pParse,	/* The parser context */
 	/* If we are trying to delete from a view, realize that view into
 	 * an ephemeral table.
 	 */
-#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
 	if (isView) {
 		sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur);
 		iDataCur = iIdxCur = iTabCur;
 	}
-#endif
 
 	/* Resolve the column names in the WHERE clause.
 	 */
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index f4e3cf735..12d5cabce 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -1537,8 +1537,7 @@ sqlite3ExprListDup(sqlite3 * db, ExprList * p, int flags)
  * sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes
  * called with a NULL argument.
  */
-#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \
- || !defined(SQLITE_OMIT_SUBQUERY)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 SrcList *
 sqlite3SrcListDup(sqlite3 * db, SrcList * p, int flags)
 {
@@ -4429,7 +4428,6 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 			sqlite3VdbeResolveLabel(v, endLabel);
 			break;
 		}
-#ifndef SQLITE_OMIT_TRIGGER
 	case TK_RAISE:{
 			assert(pExpr->affinity == ON_CONFLICT_ACTION_ROLLBACK
 			       || pExpr->affinity == ON_CONFLICT_ACTION_ABORT
@@ -4459,7 +4457,6 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 
 			break;
 		}
-#endif
 	}
 	sqlite3ReleaseTempReg(pParse, regFree1);
 	sqlite3ReleaseTempReg(pParse, regFree2);
diff --git a/src/box/sql/fkey.c b/src/box/sql/fkey.c
index f4a6b2707..686888320 100644
--- a/src/box/sql/fkey.c
+++ b/src/box/sql/fkey.c
@@ -37,9 +37,6 @@
 #include "sqliteInt.h"
 #include "box/session.h"
 
-#ifndef SQLITE_OMIT_FOREIGN_KEY
-#ifndef SQLITE_OMIT_TRIGGER
-
 /*
  * Deferred and Immediate FKs
  * --------------------------
@@ -1495,8 +1492,6 @@ sqlite3FkActions(Parse * pParse,	/* Parse context */
 	}
 }
 
-#endif				/* ifndef SQLITE_OMIT_TRIGGER */
-
 /*
  * Free all memory associated with foreign key definitions attached to
  * table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
@@ -1531,13 +1526,10 @@ sqlite3FkDelete(sqlite3 * db, Table * pTab)
 		assert(pFKey->isDeferred == 0 || pFKey->isDeferred == 1);
 
 		/* Delete any triggers created to implement actions for this FK. */
-#ifndef SQLITE_OMIT_TRIGGER
 		fkTriggerDelete(db, pFKey->apTrigger[0]);
 		fkTriggerDelete(db, pFKey->apTrigger[1]);
-#endif
 
 		pNext = pFKey->pNextFrom;
 		sqlite3DbFree(db, pFKey);
 	}
 }
-#endif				/* ifndef SQLITE_OMIT_FOREIGN_KEY */
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 4a57b23f5..5e67c2b73 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -347,12 +347,9 @@ sqlite3Insert(Parse * pParse,	/* Parser context */
 	int regData;		/* register holding first column to insert */
 	int *aRegIdx = 0;	/* One register allocated to each index */
 	uint32_t space_id = 0;
-
-#ifndef SQLITE_OMIT_TRIGGER
 	int isView;		/* True if attempting to insert into a view */
 	Trigger *pTrigger;	/* List of triggers on pTab, if required */
 	int tmask;		/* Mask of trigger times */
-#endif
 
 	db = pParse->db;
 	memset(&dest, 0, sizeof(dest));
@@ -388,18 +385,8 @@ sqlite3Insert(Parse * pParse,	/* Parser context */
 	/* Figure out if we have any triggers and if the table being
 	 * inserted into is a view
 	 */
-#ifndef SQLITE_OMIT_TRIGGER
 	pTrigger = sqlite3TriggersExist(pTab, TK_INSERT, 0, &tmask);
 	isView = space_is_view(pTab);
-#else
-#define pTrigger 0
-#define tmask 0
-#define isView 0
-#endif
-#ifdef SQLITE_OMIT_VIEW
-#undef isView
-#define isView 0
-#endif
 	assert((pTrigger && tmask) || (pTrigger == 0 && tmask == 0));
 
 	/* If pTab is really a view, make sure it has been initialized.
@@ -1896,7 +1883,6 @@ xferOptimization(Parse * pParse,	/* Parser context */
 		return 0;	/* Tables have different CHECK constraints.  Ticket #2252 */
 	}
 #endif
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 	/* Disallow the transfer optimization if the destination table constains
 	 * any foreign key constraints.  This is more restrictive than necessary.
 	 * So the extra complication to make this rule less restrictive is probably
@@ -1906,7 +1892,6 @@ xferOptimization(Parse * pParse,	/* Parser context */
 	    && pDest->pFKey != 0) {
 		return 0;
 	}
-#endif
 	if ((user_session->sql_flags & SQLITE_CountRows) != 0) {
 		return 0;	/* xfer opt does not play well with PRAGMA count_changes */
 	}
diff --git a/src/box/sql/parse.c b/src/box/sql/parse.c
index 9f547d25e..72a2cf0bd 100644
--- a/src/box/sql/parse.c
+++ b/src/box/sql/parse.c
@@ -81,7 +81,7 @@ static void disableLookaside(Parse *pParse){
   pParse->db->lookaside.bDisable++;
 }
 
-#line 398 "parse.y"
+#line 396 "parse.y"
 
   /*
   ** For a compound SELECT statement, make sure p->pPrior->pNext==p for
@@ -104,7 +104,7 @@ static void disableLookaside(Parse *pParse){
       }
     }
   }
-#line 837 "parse.y"
+#line 835 "parse.y"
 
   /* This is a utility routine used to set the ExprSpan.zStart and
   ** ExprSpan.zEnd values of pOut so that the span covers the complete
@@ -140,7 +140,7 @@ static void disableLookaside(Parse *pParse){
     pOut->zStart = t.z;
     pOut->zEnd = &t.z[t.n];
   }
-#line 945 "parse.y"
+#line 943 "parse.y"
 
   /* This routine constructs a binary expression node out of two ExprSpan
   ** objects and uses the result to populate a new ExprSpan object.
@@ -163,7 +163,7 @@ static void disableLookaside(Parse *pParse){
       pSpan->pExpr = sqlite3PExpr(pParse, TK_NOT, pSpan->pExpr, 0);
     }
   }
-#line 1019 "parse.y"
+#line 1017 "parse.y"
 
   /* Construct an expression node for a unary postfix operator
   */
@@ -176,7 +176,7 @@ static void disableLookaside(Parse *pParse){
     pOperand->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0);
     pOperand->zEnd = &pPostOp->z[pPostOp->n];
   }                           
-#line 1036 "parse.y"
+#line 1034 "parse.y"
 
   /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
   ** unary TK_ISNULL or TK_NOTNULL expression. */
@@ -188,7 +188,7 @@ static void disableLookaside(Parse *pParse){
       pA->pRight = 0;
     }
   }
-#line 1064 "parse.y"
+#line 1062 "parse.y"
 
   /* Construct an expression node for a unary prefix operator
   */
@@ -203,7 +203,7 @@ static void disableLookaside(Parse *pParse){
     pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0);
     pOut->zEnd = pOperand->zEnd;
   }
-#line 1269 "parse.y"
+#line 1267 "parse.y"
 
   /* Add a single new term to an ExprList that is used to store a
   ** list of identifiers.  Report an error if the ID list contains
@@ -1468,7 +1468,7 @@ static void yy_destructor(
     case 183: /* oneselect */
     case 194: /* values */
 {
-#line 392 "parse.y"
+#line 390 "parse.y"
 sqlite3SelectDelete(pParse->db, (yypminor->yy279));
 #line 1474 "parse.c"
 }
@@ -1476,7 +1476,7 @@ sqlite3SelectDelete(pParse->db, (yypminor->yy279));
     case 160: /* term */
     case 161: /* expr */
 {
-#line 835 "parse.y"
+#line 833 "parse.y"
 sql_expr_free(pParse->db, (yypminor->yy162).pExpr, false);
 #line 1482 "parse.c"
 }
@@ -1494,7 +1494,7 @@ sql_expr_free(pParse->db, (yypminor->yy162).pExpr, false);
     case 213: /* paren_exprlist */
     case 215: /* case_exprlist */
 {
-#line 1267 "parse.y"
+#line 1265 "parse.y"
 sqlite3ExprListDelete(pParse->db, (yypminor->yy382));
 #line 1500 "parse.c"
 }
@@ -1504,7 +1504,7 @@ sqlite3ExprListDelete(pParse->db, (yypminor->yy382));
     case 199: /* seltablist */
     case 200: /* stl_prefix */
 {
-#line 619 "parse.y"
+#line 617 "parse.y"
 sqlite3SrcListDelete(pParse->db, (yypminor->yy387));
 #line 1510 "parse.c"
 }
@@ -1512,7 +1512,7 @@ sqlite3SrcListDelete(pParse->db, (yypminor->yy387));
     case 184: /* with */
     case 229: /* wqlist */
 {
-#line 1517 "parse.y"
+#line 1510 "parse.y"
 sqlite3WithDelete(pParse->db, (yypminor->yy151));
 #line 1518 "parse.c"
 }
@@ -1524,7 +1524,7 @@ sqlite3WithDelete(pParse->db, (yypminor->yy151));
     case 216: /* case_else */
     case 225: /* when_clause */
 {
-#line 744 "parse.y"
+#line 742 "parse.y"
 sql_expr_free(pParse->db, (yypminor->yy362), false);
 #line 1530 "parse.c"
 }
@@ -1533,7 +1533,7 @@ sql_expr_free(pParse->db, (yypminor->yy362), false);
     case 206: /* idlist */
     case 209: /* idlist_opt */
 {
-#line 656 "parse.y"
+#line 654 "parse.y"
 sqlite3IdListDelete(pParse->db, (yypminor->yy40));
 #line 1539 "parse.c"
 }
@@ -1541,14 +1541,14 @@ sqlite3IdListDelete(pParse->db, (yypminor->yy40));
     case 221: /* trigger_cmd_list */
     case 226: /* trigger_cmd */
 {
-#line 1391 "parse.y"
+#line 1387 "parse.y"
 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
 #line 1547 "parse.c"
 }
       break;
     case 223: /* trigger_event */
 {
-#line 1377 "parse.y"
+#line 1373 "parse.y"
 sqlite3IdListDelete(pParse->db, (yypminor->yy10).b);
 #line 1554 "parse.c"
 }
@@ -2535,21 +2535,21 @@ static void yy_reduce(
 #line 2536 "parse.c"
         break;
       case 73: /* cmd ::= createkw VIEW ifnotexists nm eidlist_opt AS select */
-#line 372 "parse.y"
+#line 371 "parse.y"
 {
   sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy382, yymsp[0].minor.yy279, yymsp[-4].minor.yy52);
 }
 #line 2543 "parse.c"
         break;
       case 74: /* cmd ::= DROP VIEW ifexists fullname */
-#line 375 "parse.y"
+#line 374 "parse.y"
 {
   sqlite3DropTable(pParse, yymsp[0].minor.yy387, 1, yymsp[-1].minor.yy52);
 }
 #line 2550 "parse.c"
         break;
       case 75: /* cmd ::= select */
-#line 382 "parse.y"
+#line 380 "parse.y"
 {
   SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
   if(!pParse->parse_only)
@@ -2561,7 +2561,7 @@ static void yy_reduce(
 #line 2562 "parse.c"
         break;
       case 76: /* select ::= with selectnowith */
-#line 422 "parse.y"
+#line 420 "parse.y"
 {
   Select *p = yymsp[0].minor.yy279;
   if( p ){
@@ -2575,7 +2575,7 @@ static void yy_reduce(
 #line 2576 "parse.c"
         break;
       case 77: /* selectnowith ::= selectnowith multiselect_op oneselect */
-#line 435 "parse.y"
+#line 433 "parse.y"
 {
   Select *pRhs = yymsp[0].minor.yy279;
   Select *pLhs = yymsp[-2].minor.yy279;
@@ -2602,17 +2602,17 @@ static void yy_reduce(
         break;
       case 78: /* multiselect_op ::= UNION */
       case 80: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==80);
-#line 458 "parse.y"
+#line 456 "parse.y"
 {yymsp[0].minor.yy52 = yymsp[0].major; /*A-overwrites-OP*/}
 #line 2608 "parse.c"
         break;
       case 79: /* multiselect_op ::= UNION ALL */
-#line 459 "parse.y"
+#line 457 "parse.y"
 {yymsp[-1].minor.yy52 = TK_ALL;}
 #line 2613 "parse.c"
         break;
       case 81: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
-#line 463 "parse.y"
+#line 461 "parse.y"
 {
 #ifdef SELECTTRACE_ENABLED
   Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
@@ -2646,14 +2646,14 @@ static void yy_reduce(
 #line 2647 "parse.c"
         break;
       case 82: /* values ::= VALUES LP nexprlist RP */
-#line 497 "parse.y"
+#line 495 "parse.y"
 {
   yymsp[-3].minor.yy279 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy382,0,0,0,0,0,SF_Values,0,0);
 }
 #line 2654 "parse.c"
         break;
       case 83: /* values ::= values COMMA LP exprlist RP */
-#line 500 "parse.y"
+#line 498 "parse.y"
 {
   Select *pRight, *pLeft = yymsp[-4].minor.yy279;
   pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy382,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
@@ -2669,12 +2669,12 @@ static void yy_reduce(
 #line 2670 "parse.c"
         break;
       case 84: /* distinct ::= DISTINCT */
-#line 517 "parse.y"
+#line 515 "parse.y"
 {yymsp[0].minor.yy52 = SF_Distinct;}
 #line 2675 "parse.c"
         break;
       case 85: /* distinct ::= ALL */
-#line 518 "parse.y"
+#line 516 "parse.y"
 {yymsp[0].minor.yy52 = SF_All;}
 #line 2680 "parse.c"
         break;
@@ -2684,12 +2684,12 @@ static void yy_reduce(
       case 196: /* exprlist ::= */ yytestcase(yyruleno==196);
       case 199: /* paren_exprlist ::= */ yytestcase(yyruleno==199);
       case 204: /* eidlist_opt ::= */ yytestcase(yyruleno==204);
-#line 531 "parse.y"
+#line 529 "parse.y"
 {yymsp[1].minor.yy382 = 0;}
 #line 2690 "parse.c"
         break;
       case 88: /* selcollist ::= sclp expr as */
-#line 532 "parse.y"
+#line 530 "parse.y"
 {
    yymsp[-2].minor.yy382 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy382, yymsp[-1].minor.yy162.pExpr);
    if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy382, &yymsp[0].minor.yy0, 1);
@@ -2698,7 +2698,7 @@ static void yy_reduce(
 #line 2699 "parse.c"
         break;
       case 89: /* selcollist ::= sclp STAR */
-#line 537 "parse.y"
+#line 535 "parse.y"
 {
   Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
   yymsp[-1].minor.yy382 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy382, p);
@@ -2706,7 +2706,7 @@ static void yy_reduce(
 #line 2707 "parse.c"
         break;
       case 90: /* selcollist ::= sclp nm DOT STAR */
-#line 541 "parse.y"
+#line 539 "parse.y"
 {
   Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
   Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -2718,17 +2718,17 @@ static void yy_reduce(
       case 91: /* as ::= AS nm */
       case 218: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==218);
       case 219: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==219);
-#line 552 "parse.y"
+#line 550 "parse.y"
 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
 #line 2724 "parse.c"
         break;
       case 93: /* from ::= */
-#line 566 "parse.y"
+#line 564 "parse.y"
 {yymsp[1].minor.yy387 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy387));}
 #line 2729 "parse.c"
         break;
       case 94: /* from ::= FROM seltablist */
-#line 567 "parse.y"
+#line 565 "parse.y"
 {
   yymsp[-1].minor.yy387 = yymsp[0].minor.yy387;
   sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy387);
@@ -2736,19 +2736,19 @@ static void yy_reduce(
 #line 2737 "parse.c"
         break;
       case 95: /* stl_prefix ::= seltablist joinop */
-#line 575 "parse.y"
+#line 573 "parse.y"
 {
    if( ALWAYS(yymsp[-1].minor.yy387 && yymsp[-1].minor.yy387->nSrc>0) ) yymsp[-1].minor.yy387->a[yymsp[-1].minor.yy387->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy52;
 }
 #line 2744 "parse.c"
         break;
       case 96: /* stl_prefix ::= */
-#line 578 "parse.y"
+#line 576 "parse.y"
 {yymsp[1].minor.yy387 = 0;}
 #line 2749 "parse.c"
         break;
       case 97: /* seltablist ::= stl_prefix nm as indexed_opt on_opt using_opt */
-#line 580 "parse.y"
+#line 578 "parse.y"
 {
   yymsp[-5].minor.yy387 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy387,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy362,yymsp[0].minor.yy40);
   sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy387, &yymsp[-2].minor.yy0);
@@ -2756,7 +2756,7 @@ static void yy_reduce(
 #line 2757 "parse.c"
         break;
       case 98: /* seltablist ::= stl_prefix nm LP exprlist RP as on_opt using_opt */
-#line 585 "parse.y"
+#line 583 "parse.y"
 {
   yymsp[-7].minor.yy387 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy387,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy362,yymsp[0].minor.yy40);
   sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy387, yymsp[-4].minor.yy382);
@@ -2764,14 +2764,14 @@ static void yy_reduce(
 #line 2765 "parse.c"
         break;
       case 99: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
-#line 591 "parse.y"
+#line 589 "parse.y"
 {
     yymsp[-6].minor.yy387 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy387,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy279,yymsp[-1].minor.yy362,yymsp[0].minor.yy40);
   }
 #line 2772 "parse.c"
         break;
       case 100: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
-#line 595 "parse.y"
+#line 593 "parse.y"
 {
     if( yymsp[-6].minor.yy387==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy362==0 && yymsp[0].minor.yy40==0 ){
       yymsp[-6].minor.yy387 = yymsp[-4].minor.yy387;
@@ -2796,27 +2796,27 @@ static void yy_reduce(
 #line 2797 "parse.c"
         break;
       case 101: /* fullname ::= nm */
-#line 621 "parse.y"
+#line 619 "parse.y"
 {yymsp[0].minor.yy387 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
 #line 2802 "parse.c"
         break;
       case 102: /* joinop ::= COMMA|JOIN */
-#line 627 "parse.y"
+#line 625 "parse.y"
 { yymsp[0].minor.yy52 = JT_INNER; }
 #line 2807 "parse.c"
         break;
       case 103: /* joinop ::= JOIN_KW JOIN */
-#line 629 "parse.y"
+#line 627 "parse.y"
 {yymsp[-1].minor.yy52 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0);  /*X-overwrites-A*/}
 #line 2812 "parse.c"
         break;
       case 104: /* joinop ::= JOIN_KW join_nm JOIN */
-#line 631 "parse.y"
+#line 629 "parse.y"
 {yymsp[-2].minor.yy52 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
 #line 2817 "parse.c"
         break;
       case 105: /* joinop ::= JOIN_KW join_nm join_nm JOIN */
-#line 633 "parse.y"
+#line 631 "parse.y"
 {yymsp[-3].minor.yy52 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
 #line 2822 "parse.c"
         break;
@@ -2824,7 +2824,7 @@ static void yy_reduce(
       case 123: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==123);
       case 130: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==130);
       case 192: /* case_else ::= ELSE expr */ yytestcase(yyruleno==192);
-#line 637 "parse.y"
+#line 635 "parse.y"
 {yymsp[-1].minor.yy362 = yymsp[0].minor.yy162.pExpr;}
 #line 2830 "parse.c"
         break;
@@ -2833,44 +2833,44 @@ static void yy_reduce(
       case 129: /* where_opt ::= */ yytestcase(yyruleno==129);
       case 193: /* case_else ::= */ yytestcase(yyruleno==193);
       case 195: /* case_operand ::= */ yytestcase(yyruleno==195);
-#line 638 "parse.y"
+#line 636 "parse.y"
 {yymsp[1].minor.yy362 = 0;}
 #line 2839 "parse.c"
         break;
       case 108: /* indexed_opt ::= */
-#line 651 "parse.y"
+#line 649 "parse.y"
 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
 #line 2844 "parse.c"
         break;
       case 109: /* indexed_opt ::= INDEXED BY nm */
-#line 652 "parse.y"
+#line 650 "parse.y"
 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
 #line 2849 "parse.c"
         break;
       case 110: /* indexed_opt ::= NOT INDEXED */
-#line 653 "parse.y"
+#line 651 "parse.y"
 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
 #line 2854 "parse.c"
         break;
       case 111: /* using_opt ::= USING LP idlist RP */
-#line 657 "parse.y"
+#line 655 "parse.y"
 {yymsp[-3].minor.yy40 = yymsp[-1].minor.yy40;}
 #line 2859 "parse.c"
         break;
       case 112: /* using_opt ::= */
       case 140: /* idlist_opt ::= */ yytestcase(yyruleno==140);
-#line 658 "parse.y"
+#line 656 "parse.y"
 {yymsp[1].minor.yy40 = 0;}
 #line 2865 "parse.c"
         break;
       case 114: /* orderby_opt ::= ORDER BY sortlist */
       case 121: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==121);
-#line 672 "parse.y"
+#line 670 "parse.y"
 {yymsp[-2].minor.yy382 = yymsp[0].minor.yy382;}
 #line 2871 "parse.c"
         break;
       case 115: /* sortlist ::= sortlist COMMA expr sortorder */
-#line 673 "parse.y"
+#line 671 "parse.y"
 {
   yymsp[-3].minor.yy382 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy382,yymsp[-1].minor.yy162.pExpr);
   sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy382,yymsp[0].minor.yy52);
@@ -2878,7 +2878,7 @@ static void yy_reduce(
 #line 2879 "parse.c"
         break;
       case 116: /* sortlist ::= expr sortorder */
-#line 677 "parse.y"
+#line 675 "parse.y"
 {
   yymsp[-1].minor.yy382 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy162.pExpr); /*A-overwrites-Y*/
   sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy382,yymsp[0].minor.yy52);
@@ -2886,42 +2886,42 @@ static void yy_reduce(
 #line 2887 "parse.c"
         break;
       case 117: /* sortorder ::= ASC */
-#line 684 "parse.y"
+#line 682 "parse.y"
 {yymsp[0].minor.yy52 = SQLITE_SO_ASC;}
 #line 2892 "parse.c"
         break;
       case 118: /* sortorder ::= DESC */
-#line 685 "parse.y"
+#line 683 "parse.y"
 {yymsp[0].minor.yy52 = SQLITE_SO_DESC;}
 #line 2897 "parse.c"
         break;
       case 119: /* sortorder ::= */
-#line 686 "parse.y"
+#line 684 "parse.y"
 {yymsp[1].minor.yy52 = SQLITE_SO_UNDEFINED;}
 #line 2902 "parse.c"
         break;
       case 124: /* limit_opt ::= */
-#line 711 "parse.y"
+#line 709 "parse.y"
 {yymsp[1].minor.yy384.pLimit = 0; yymsp[1].minor.yy384.pOffset = 0;}
 #line 2907 "parse.c"
         break;
       case 125: /* limit_opt ::= LIMIT expr */
-#line 712 "parse.y"
+#line 710 "parse.y"
 {yymsp[-1].minor.yy384.pLimit = yymsp[0].minor.yy162.pExpr; yymsp[-1].minor.yy384.pOffset = 0;}
 #line 2912 "parse.c"
         break;
       case 126: /* limit_opt ::= LIMIT expr OFFSET expr */
-#line 714 "parse.y"
+#line 712 "parse.y"
 {yymsp[-3].minor.yy384.pLimit = yymsp[-2].minor.yy162.pExpr; yymsp[-3].minor.yy384.pOffset = yymsp[0].minor.yy162.pExpr;}
 #line 2917 "parse.c"
         break;
       case 127: /* limit_opt ::= LIMIT expr COMMA expr */
-#line 716 "parse.y"
+#line 714 "parse.y"
 {yymsp[-3].minor.yy384.pOffset = yymsp[-2].minor.yy162.pExpr; yymsp[-3].minor.yy384.pLimit = yymsp[0].minor.yy162.pExpr;}
 #line 2922 "parse.c"
         break;
       case 128: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
-#line 733 "parse.y"
+#line 731 "parse.y"
 {
   sqlite3WithPush(pParse, yymsp[-5].minor.yy151, 1);
   sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy387, &yymsp[-1].minor.yy0);
@@ -2933,7 +2933,7 @@ static void yy_reduce(
 #line 2934 "parse.c"
         break;
       case 131: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
-#line 766 "parse.y"
+#line 764 "parse.y"
 {
   sqlite3WithPush(pParse, yymsp[-7].minor.yy151, 1);
   sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy387, &yymsp[-3].minor.yy0);
@@ -2946,7 +2946,7 @@ static void yy_reduce(
 #line 2947 "parse.c"
         break;
       case 132: /* setlist ::= setlist COMMA nm EQ expr */
-#line 780 "parse.y"
+#line 778 "parse.y"
 {
   yymsp[-4].minor.yy382 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy382, yymsp[0].minor.yy162.pExpr);
   sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy382, &yymsp[-2].minor.yy0, 1);
@@ -2954,14 +2954,14 @@ static void yy_reduce(
 #line 2955 "parse.c"
         break;
       case 133: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
-#line 784 "parse.y"
+#line 782 "parse.y"
 {
   yymsp[-6].minor.yy382 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy382, yymsp[-3].minor.yy40, yymsp[0].minor.yy162.pExpr);
 }
 #line 2962 "parse.c"
         break;
       case 134: /* setlist ::= nm EQ expr */
-#line 787 "parse.y"
+#line 785 "parse.y"
 {
   yylhsminor.yy382 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy162.pExpr);
   sqlite3ExprListSetName(pParse, yylhsminor.yy382, &yymsp[-2].minor.yy0, 1);
@@ -2970,14 +2970,14 @@ static void yy_reduce(
   yymsp[-2].minor.yy382 = yylhsminor.yy382;
         break;
       case 135: /* setlist ::= LP idlist RP EQ expr */
-#line 791 "parse.y"
+#line 789 "parse.y"
 {
   yymsp[-4].minor.yy382 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy40, yymsp[0].minor.yy162.pExpr);
 }
 #line 2978 "parse.c"
         break;
       case 136: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
-#line 797 "parse.y"
+#line 795 "parse.y"
 {
   sqlite3WithPush(pParse, yymsp[-5].minor.yy151, 1);
   sqlSubProgramsRemaining = SQL_MAX_COMPILING_TRIGGERS;
@@ -2988,7 +2988,7 @@ static void yy_reduce(
 #line 2989 "parse.c"
         break;
       case 137: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
-#line 805 "parse.y"
+#line 803 "parse.y"
 {
   sqlite3WithPush(pParse, yymsp[-6].minor.yy151, 1);
   sqlSubProgramsRemaining = SQL_MAX_COMPILING_TRIGGERS;
@@ -2999,40 +2999,40 @@ static void yy_reduce(
 #line 3000 "parse.c"
         break;
       case 141: /* idlist_opt ::= LP idlist RP */
-#line 823 "parse.y"
+#line 821 "parse.y"
 {yymsp[-2].minor.yy40 = yymsp[-1].minor.yy40;}
 #line 3005 "parse.c"
         break;
       case 142: /* idlist ::= idlist COMMA nm */
-#line 825 "parse.y"
+#line 823 "parse.y"
 {yymsp[-2].minor.yy40 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy40,&yymsp[0].minor.yy0);}
 #line 3010 "parse.c"
         break;
       case 143: /* idlist ::= nm */
-#line 827 "parse.y"
+#line 825 "parse.y"
 {yymsp[0].minor.yy40 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
 #line 3015 "parse.c"
         break;
       case 144: /* expr ::= LP expr RP */
-#line 876 "parse.y"
+#line 874 "parse.y"
 {spanSet(&yymsp[-2].minor.yy162,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/  yymsp[-2].minor.yy162.pExpr = yymsp[-1].minor.yy162.pExpr;}
 #line 3020 "parse.c"
         break;
       case 145: /* term ::= NULL */
       case 149: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==149);
       case 150: /* term ::= STRING */ yytestcase(yyruleno==150);
-#line 877 "parse.y"
+#line 875 "parse.y"
 {spanExpr(&yymsp[0].minor.yy162,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}
 #line 3027 "parse.c"
         break;
       case 146: /* expr ::= ID|INDEXED */
       case 147: /* expr ::= JOIN_KW */ yytestcase(yyruleno==147);
-#line 878 "parse.y"
+#line 876 "parse.y"
 {spanExpr(&yymsp[0].minor.yy162,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
 #line 3033 "parse.c"
         break;
       case 148: /* expr ::= nm DOT nm */
-#line 880 "parse.y"
+#line 878 "parse.y"
 {
   Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
   Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
@@ -3042,7 +3042,7 @@ static void yy_reduce(
 #line 3043 "parse.c"
         break;
       case 151: /* term ::= INTEGER */
-#line 888 "parse.y"
+#line 886 "parse.y"
 {
   yylhsminor.yy162.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
   yylhsminor.yy162.zStart = yymsp[0].minor.yy0.z;
@@ -3053,7 +3053,7 @@ static void yy_reduce(
   yymsp[0].minor.yy162 = yylhsminor.yy162;
         break;
       case 152: /* expr ::= VARIABLE */
-#line 894 "parse.y"
+#line 892 "parse.y"
 {
   if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
     u32 n = yymsp[0].minor.yy0.n;
@@ -3078,7 +3078,7 @@ static void yy_reduce(
 #line 3079 "parse.c"
         break;
       case 153: /* expr ::= expr COLLATE ID|INDEXED */
-#line 915 "parse.y"
+#line 913 "parse.y"
 {
   yymsp[-2].minor.yy162.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy162.pExpr, &yymsp[0].minor.yy0, 1);
   yymsp[-2].minor.yy162.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
@@ -3086,7 +3086,7 @@ static void yy_reduce(
 #line 3087 "parse.c"
         break;
       case 154: /* expr ::= CAST LP expr AS typetoken RP */
-#line 920 "parse.y"
+#line 918 "parse.y"
 {
   spanSet(&yymsp[-5].minor.yy162,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
   yymsp[-5].minor.yy162.pExpr = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
@@ -3095,7 +3095,7 @@ static void yy_reduce(
 #line 3096 "parse.c"
         break;
       case 155: /* expr ::= ID|INDEXED LP distinct exprlist RP */
-#line 926 "parse.y"
+#line 924 "parse.y"
 {
   if( yymsp[-1].minor.yy382 && yymsp[-1].minor.yy382->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
     sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
@@ -3110,7 +3110,7 @@ static void yy_reduce(
   yymsp[-4].minor.yy162 = yylhsminor.yy162;
         break;
       case 156: /* expr ::= ID|INDEXED LP STAR RP */
-#line 936 "parse.y"
+#line 934 "parse.y"
 {
   yylhsminor.yy162.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
   spanSet(&yylhsminor.yy162,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
@@ -3119,7 +3119,7 @@ static void yy_reduce(
   yymsp[-3].minor.yy162 = yylhsminor.yy162;
         break;
       case 157: /* term ::= CTIME_KW */
-#line 940 "parse.y"
+#line 938 "parse.y"
 {
   yylhsminor.yy162.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
   spanSet(&yylhsminor.yy162, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
@@ -3128,7 +3128,7 @@ static void yy_reduce(
   yymsp[0].minor.yy162 = yylhsminor.yy162;
         break;
       case 158: /* expr ::= LP nexprlist COMMA expr RP */
-#line 969 "parse.y"
+#line 967 "parse.y"
 {
   ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy382, yymsp[-1].minor.yy162.pExpr);
   yylhsminor.yy162.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
@@ -3150,22 +3150,22 @@ static void yy_reduce(
       case 164: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==164);
       case 165: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==165);
       case 166: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==166);
-#line 980 "parse.y"
+#line 978 "parse.y"
 {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy162,&yymsp[0].minor.yy162);}
 #line 3156 "parse.c"
         break;
       case 167: /* likeop ::= LIKE_KW|MATCH */
-#line 993 "parse.y"
+#line 991 "parse.y"
 {yymsp[0].minor.yy0=yymsp[0].minor.yy0;/*A-overwrites-X*/}
 #line 3161 "parse.c"
         break;
       case 168: /* likeop ::= NOT LIKE_KW|MATCH */
-#line 994 "parse.y"
+#line 992 "parse.y"
 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
 #line 3166 "parse.c"
         break;
       case 169: /* expr ::= expr likeop expr */
-#line 995 "parse.y"
+#line 993 "parse.y"
 {
   ExprList *pList;
   int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
@@ -3180,7 +3180,7 @@ static void yy_reduce(
 #line 3181 "parse.c"
         break;
       case 170: /* expr ::= expr likeop expr ESCAPE expr */
-#line 1006 "parse.y"
+#line 1004 "parse.y"
 {
   ExprList *pList;
   int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
@@ -3196,17 +3196,17 @@ static void yy_reduce(
 #line 3197 "parse.c"
         break;
       case 171: /* expr ::= expr ISNULL|NOTNULL */
-#line 1033 "parse.y"
+#line 1031 "parse.y"
 {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy162,&yymsp[0].minor.yy0);}
 #line 3202 "parse.c"
         break;
       case 172: /* expr ::= expr NOT NULL */
-#line 1034 "parse.y"
+#line 1032 "parse.y"
 {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
 #line 3207 "parse.c"
         break;
       case 173: /* expr ::= expr IS expr */
-#line 1055 "parse.y"
+#line 1053 "parse.y"
 {
   spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy162,&yymsp[0].minor.yy162);
   binaryToUnaryIfNull(pParse, yymsp[0].minor.yy162.pExpr, yymsp[-2].minor.yy162.pExpr, TK_ISNULL);
@@ -3214,7 +3214,7 @@ static void yy_reduce(
 #line 3215 "parse.c"
         break;
       case 174: /* expr ::= expr IS NOT expr */
-#line 1059 "parse.y"
+#line 1057 "parse.y"
 {
   spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy162,&yymsp[0].minor.yy162);
   binaryToUnaryIfNull(pParse, yymsp[0].minor.yy162.pExpr, yymsp[-3].minor.yy162.pExpr, TK_NOTNULL);
@@ -3223,28 +3223,28 @@ static void yy_reduce(
         break;
       case 175: /* expr ::= NOT expr */
       case 176: /* expr ::= BITNOT expr */ yytestcase(yyruleno==176);
-#line 1083 "parse.y"
+#line 1081 "parse.y"
 {spanUnaryPrefix(&yymsp[-1].minor.yy162,pParse,yymsp[-1].major,&yymsp[0].minor.yy162,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
 #line 3229 "parse.c"
         break;
       case 177: /* expr ::= MINUS expr */
-#line 1087 "parse.y"
+#line 1085 "parse.y"
 {spanUnaryPrefix(&yymsp[-1].minor.yy162,pParse,TK_UMINUS,&yymsp[0].minor.yy162,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
 #line 3234 "parse.c"
         break;
       case 178: /* expr ::= PLUS expr */
-#line 1089 "parse.y"
+#line 1087 "parse.y"
 {spanUnaryPrefix(&yymsp[-1].minor.yy162,pParse,TK_UPLUS,&yymsp[0].minor.yy162,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
 #line 3239 "parse.c"
         break;
       case 179: /* between_op ::= BETWEEN */
       case 182: /* in_op ::= IN */ yytestcase(yyruleno==182);
-#line 1092 "parse.y"
+#line 1090 "parse.y"
 {yymsp[0].minor.yy52 = 0;}
 #line 3245 "parse.c"
         break;
       case 181: /* expr ::= expr between_op expr AND expr */
-#line 1094 "parse.y"
+#line 1092 "parse.y"
 {
   ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy162.pExpr);
   pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy162.pExpr);
@@ -3260,7 +3260,7 @@ static void yy_reduce(
 #line 3261 "parse.c"
         break;
       case 184: /* expr ::= expr in_op LP exprlist RP */
-#line 1110 "parse.y"
+#line 1108 "parse.y"
 {
     if( yymsp[-1].minor.yy382==0 ){
       /* Expressions of the form
@@ -3315,7 +3315,7 @@ static void yy_reduce(
 #line 3316 "parse.c"
         break;
       case 185: /* expr ::= LP select RP */
-#line 1161 "parse.y"
+#line 1159 "parse.y"
 {
     spanSet(&yymsp[-2].minor.yy162,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
     yymsp[-2].minor.yy162.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
@@ -3324,7 +3324,7 @@ static void yy_reduce(
 #line 3325 "parse.c"
         break;
       case 186: /* expr ::= expr in_op LP select RP */
-#line 1166 "parse.y"
+#line 1164 "parse.y"
 {
     yymsp[-4].minor.yy162.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy162.pExpr, 0);
     sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy162.pExpr, yymsp[-1].minor.yy279);
@@ -3334,7 +3334,7 @@ static void yy_reduce(
 #line 3335 "parse.c"
         break;
       case 187: /* expr ::= expr in_op nm paren_exprlist */
-#line 1172 "parse.y"
+#line 1170 "parse.y"
 {
     SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0);
     Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
@@ -3347,7 +3347,7 @@ static void yy_reduce(
 #line 3348 "parse.c"
         break;
       case 188: /* expr ::= EXISTS LP select RP */
-#line 1181 "parse.y"
+#line 1179 "parse.y"
 {
     Expr *p;
     spanSet(&yymsp[-3].minor.yy162,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
@@ -3357,7 +3357,7 @@ static void yy_reduce(
 #line 3358 "parse.c"
         break;
       case 189: /* expr ::= CASE case_operand case_exprlist case_else END */
-#line 1190 "parse.y"
+#line 1188 "parse.y"
 {
   spanSet(&yymsp[-4].minor.yy162,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-C*/
   yymsp[-4].minor.yy162.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy362, 0);
@@ -3372,7 +3372,7 @@ static void yy_reduce(
 #line 3373 "parse.c"
         break;
       case 190: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
-#line 1203 "parse.y"
+#line 1201 "parse.y"
 {
   yymsp[-4].minor.yy382 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy382, yymsp[-2].minor.yy162.pExpr);
   yymsp[-4].minor.yy382 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy382, yymsp[0].minor.yy162.pExpr);
@@ -3380,7 +3380,7 @@ static void yy_reduce(
 #line 3381 "parse.c"
         break;
       case 191: /* case_exprlist ::= WHEN expr THEN expr */
-#line 1207 "parse.y"
+#line 1205 "parse.y"
 {
   yymsp[-3].minor.yy382 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy162.pExpr);
   yymsp[-3].minor.yy382 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy382, yymsp[0].minor.yy162.pExpr);
@@ -3388,28 +3388,28 @@ static void yy_reduce(
 #line 3389 "parse.c"
         break;
       case 194: /* case_operand ::= expr */
-#line 1217 "parse.y"
+#line 1215 "parse.y"
 {yymsp[0].minor.yy362 = yymsp[0].minor.yy162.pExpr; /*A-overwrites-X*/}
 #line 3394 "parse.c"
         break;
       case 197: /* nexprlist ::= nexprlist COMMA expr */
-#line 1228 "parse.y"
+#line 1226 "parse.y"
 {yymsp[-2].minor.yy382 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy382,yymsp[0].minor.yy162.pExpr);}
 #line 3399 "parse.c"
         break;
       case 198: /* nexprlist ::= expr */
-#line 1230 "parse.y"
+#line 1228 "parse.y"
 {yymsp[0].minor.yy382 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy162.pExpr); /*A-overwrites-Y*/}
 #line 3404 "parse.c"
         break;
       case 200: /* paren_exprlist ::= LP exprlist RP */
       case 205: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==205);
-#line 1238 "parse.y"
+#line 1236 "parse.y"
 {yymsp[-2].minor.yy382 = yymsp[-1].minor.yy382;}
 #line 3410 "parse.c"
         break;
       case 201: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm ON nm LP sortlist RP where_opt */
-#line 1245 "parse.y"
+#line 1243 "parse.y"
 {
   sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, 
                      sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0), yymsp[-2].minor.yy382, yymsp[-9].minor.yy52,
@@ -3419,87 +3419,87 @@ static void yy_reduce(
         break;
       case 202: /* uniqueflag ::= UNIQUE */
       case 243: /* raisetype ::= ABORT */ yytestcase(yyruleno==243);
-#line 1252 "parse.y"
+#line 1250 "parse.y"
 {yymsp[0].minor.yy52 = ON_CONFLICT_ACTION_ABORT;}
 #line 3425 "parse.c"
         break;
       case 203: /* uniqueflag ::= */
-#line 1253 "parse.y"
+#line 1251 "parse.y"
 {yymsp[1].minor.yy52 = ON_CONFLICT_ACTION_NONE;}
 #line 3430 "parse.c"
         break;
       case 206: /* eidlist ::= eidlist COMMA nm collate sortorder */
-#line 1296 "parse.y"
+#line 1294 "parse.y"
 {
   yymsp[-4].minor.yy382 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy382, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy52, yymsp[0].minor.yy52);
 }
 #line 3437 "parse.c"
         break;
       case 207: /* eidlist ::= nm collate sortorder */
-#line 1299 "parse.y"
+#line 1297 "parse.y"
 {
   yymsp[-2].minor.yy382 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy52, yymsp[0].minor.yy52); /*A-overwrites-Y*/
 }
 #line 3444 "parse.c"
         break;
       case 210: /* cmd ::= DROP INDEX ifexists fullname ON nm */
-#line 1310 "parse.y"
+#line 1308 "parse.y"
 {
     sqlite3DropIndex(pParse, yymsp[-2].minor.yy387, &yymsp[0].minor.yy0, yymsp[-3].minor.yy52);
 }
 #line 3451 "parse.c"
         break;
       case 211: /* cmd ::= PRAGMA nm */
-#line 1317 "parse.y"
+#line 1315 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[0].minor.yy0,0,0,0,0);
 }
 #line 3458 "parse.c"
         break;
       case 212: /* cmd ::= PRAGMA nm EQ nmnum */
-#line 1320 "parse.y"
+#line 1318 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy0,0,0);
 }
 #line 3465 "parse.c"
         break;
       case 213: /* cmd ::= PRAGMA nm LP nmnum RP */
-#line 1323 "parse.y"
+#line 1321 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,0,&yymsp[-1].minor.yy0,0,0);
 }
 #line 3472 "parse.c"
         break;
       case 214: /* cmd ::= PRAGMA nm EQ minus_num */
-#line 1326 "parse.y"
+#line 1324 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy0,0,1);
 }
 #line 3479 "parse.c"
         break;
       case 215: /* cmd ::= PRAGMA nm LP minus_num RP */
-#line 1329 "parse.y"
+#line 1327 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,0,&yymsp[-1].minor.yy0,0,1);
 }
 #line 3486 "parse.c"
         break;
       case 216: /* cmd ::= PRAGMA nm EQ nm DOT nm */
-#line 1332 "parse.y"
+#line 1330 "parse.y"
 {
     sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0,0);
 }
 #line 3493 "parse.c"
         break;
       case 217: /* cmd ::= PRAGMA */
-#line 1335 "parse.y"
+#line 1333 "parse.y"
 {
     sqlite3Pragma(pParse, 0,0,0,0,0);
 }
 #line 3500 "parse.c"
         break;
       case 220: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
-#line 1355 "parse.y"
+#line 1351 "parse.y"
 {
   Token all;
   all.z = yymsp[-3].minor.yy0.z;
@@ -3510,7 +3510,7 @@ static void yy_reduce(
 #line 3511 "parse.c"
         break;
       case 221: /* trigger_decl ::= TRIGGER ifnotexists nm trigger_time trigger_event ON fullname foreach_clause when_clause */
-#line 1365 "parse.y"
+#line 1361 "parse.y"
 {
   sqlite3BeginTrigger(pParse, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy52, yymsp[-4].minor.yy10.a, yymsp[-4].minor.yy10.b, yymsp[-2].minor.yy387, yymsp[0].minor.yy362, yymsp[-7].minor.yy52);
   yymsp[-8].minor.yy0 = yymsp[-6].minor.yy0; /*yymsp[-8].minor.yy0-overwrites-T*/
@@ -3518,48 +3518,48 @@ static void yy_reduce(
 #line 3519 "parse.c"
         break;
       case 222: /* trigger_time ::= BEFORE */
-#line 1371 "parse.y"
+#line 1367 "parse.y"
 { yymsp[0].minor.yy52 = TK_BEFORE; }
 #line 3524 "parse.c"
         break;
       case 223: /* trigger_time ::= AFTER */
-#line 1372 "parse.y"
+#line 1368 "parse.y"
 { yymsp[0].minor.yy52 = TK_AFTER;  }
 #line 3529 "parse.c"
         break;
       case 224: /* trigger_time ::= INSTEAD OF */
-#line 1373 "parse.y"
+#line 1369 "parse.y"
 { yymsp[-1].minor.yy52 = TK_INSTEAD;}
 #line 3534 "parse.c"
         break;
       case 225: /* trigger_time ::= */
-#line 1374 "parse.y"
+#line 1370 "parse.y"
 { yymsp[1].minor.yy52 = TK_BEFORE; }
 #line 3539 "parse.c"
         break;
       case 226: /* trigger_event ::= DELETE|INSERT */
       case 227: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==227);
-#line 1378 "parse.y"
+#line 1374 "parse.y"
 {yymsp[0].minor.yy10.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy10.b = 0;}
 #line 3545 "parse.c"
         break;
       case 228: /* trigger_event ::= UPDATE OF idlist */
-#line 1380 "parse.y"
+#line 1376 "parse.y"
 {yymsp[-2].minor.yy10.a = TK_UPDATE; yymsp[-2].minor.yy10.b = yymsp[0].minor.yy40;}
 #line 3550 "parse.c"
         break;
       case 229: /* when_clause ::= */
-#line 1387 "parse.y"
+#line 1383 "parse.y"
 { yymsp[1].minor.yy362 = 0; }
 #line 3555 "parse.c"
         break;
       case 230: /* when_clause ::= WHEN expr */
-#line 1388 "parse.y"
+#line 1384 "parse.y"
 { yymsp[-1].minor.yy362 = yymsp[0].minor.yy162.pExpr; }
 #line 3560 "parse.c"
         break;
       case 231: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
-#line 1392 "parse.y"
+#line 1388 "parse.y"
 {
   assert( yymsp[-2].minor.yy427!=0 );
   yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
@@ -3568,7 +3568,7 @@ static void yy_reduce(
 #line 3569 "parse.c"
         break;
       case 232: /* trigger_cmd_list ::= trigger_cmd SEMI */
-#line 1397 "parse.y"
+#line 1393 "parse.y"
 { 
   assert( yymsp[-1].minor.yy427!=0 );
   yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
@@ -3576,7 +3576,7 @@ static void yy_reduce(
 #line 3577 "parse.c"
         break;
       case 233: /* trnm ::= nm DOT nm */
-#line 1408 "parse.y"
+#line 1404 "parse.y"
 {
   yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
   sqlite3ErrorMsg(pParse, 
@@ -3586,7 +3586,7 @@ static void yy_reduce(
 #line 3587 "parse.c"
         break;
       case 234: /* tridxby ::= INDEXED BY nm */
-#line 1420 "parse.y"
+#line 1416 "parse.y"
 {
   sqlite3ErrorMsg(pParse,
         "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
@@ -3595,7 +3595,7 @@ static void yy_reduce(
 #line 3596 "parse.c"
         break;
       case 235: /* tridxby ::= NOT INDEXED */
-#line 1425 "parse.y"
+#line 1421 "parse.y"
 {
   sqlite3ErrorMsg(pParse,
         "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
@@ -3604,27 +3604,27 @@ static void yy_reduce(
 #line 3605 "parse.c"
         break;
       case 236: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
-#line 1438 "parse.y"
+#line 1434 "parse.y"
 {yymsp[-6].minor.yy427 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy382, yymsp[0].minor.yy362, yymsp[-5].minor.yy52);}
 #line 3610 "parse.c"
         break;
       case 237: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
-#line 1442 "parse.y"
+#line 1438 "parse.y"
 {yymsp[-4].minor.yy427 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy40, yymsp[0].minor.yy279, yymsp[-4].minor.yy52);/*A-overwrites-R*/}
 #line 3615 "parse.c"
         break;
       case 238: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
-#line 1446 "parse.y"
+#line 1442 "parse.y"
 {yymsp[-4].minor.yy427 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy362);}
 #line 3620 "parse.c"
         break;
       case 239: /* trigger_cmd ::= select */
-#line 1450 "parse.y"
+#line 1446 "parse.y"
 {yymsp[0].minor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy279); /*A-overwrites-X*/}
 #line 3625 "parse.c"
         break;
       case 240: /* expr ::= RAISE LP IGNORE RP */
-#line 1453 "parse.y"
+#line 1449 "parse.y"
 {
   spanSet(&yymsp[-3].minor.yy162,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/
   yymsp[-3].minor.yy162.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0); 
@@ -3635,7 +3635,7 @@ static void yy_reduce(
 #line 3636 "parse.c"
         break;
       case 241: /* expr ::= RAISE LP raisetype COMMA STRING RP */
-#line 1460 "parse.y"
+#line 1456 "parse.y"
 {
   spanSet(&yymsp[-5].minor.yy162,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/
   yymsp[-5].minor.yy162.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); 
@@ -3646,78 +3646,78 @@ static void yy_reduce(
 #line 3647 "parse.c"
         break;
       case 242: /* raisetype ::= ROLLBACK */
-#line 1470 "parse.y"
+#line 1465 "parse.y"
 {yymsp[0].minor.yy52 = ON_CONFLICT_ACTION_ROLLBACK;}
 #line 3652 "parse.c"
         break;
       case 244: /* raisetype ::= FAIL */
-#line 1472 "parse.y"
+#line 1467 "parse.y"
 {yymsp[0].minor.yy52 = ON_CONFLICT_ACTION_FAIL;}
 #line 3657 "parse.c"
         break;
       case 245: /* cmd ::= DROP TRIGGER ifexists fullname */
-#line 1477 "parse.y"
+#line 1471 "parse.y"
 {
   sqlite3DropTrigger(pParse,yymsp[0].minor.yy387,yymsp[-1].minor.yy52);
 }
 #line 3664 "parse.c"
         break;
       case 246: /* cmd ::= REINDEX */
-#line 1484 "parse.y"
+#line 1477 "parse.y"
 {sqlite3Reindex(pParse, 0, 0);}
 #line 3669 "parse.c"
         break;
       case 247: /* cmd ::= REINDEX nm */
-#line 1485 "parse.y"
+#line 1478 "parse.y"
 {sqlite3Reindex(pParse, &yymsp[0].minor.yy0, 0);}
 #line 3674 "parse.c"
         break;
       case 248: /* cmd ::= REINDEX nm ON nm */
-#line 1486 "parse.y"
+#line 1479 "parse.y"
 {sqlite3Reindex(pParse, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
 #line 3679 "parse.c"
         break;
       case 249: /* cmd ::= ANALYZE */
-#line 1491 "parse.y"
+#line 1484 "parse.y"
 {sqlite3Analyze(pParse, 0);}
 #line 3684 "parse.c"
         break;
       case 250: /* cmd ::= ANALYZE nm */
-#line 1492 "parse.y"
+#line 1485 "parse.y"
 {sqlite3Analyze(pParse, &yymsp[0].minor.yy0);}
 #line 3689 "parse.c"
         break;
       case 251: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
-#line 1497 "parse.y"
+#line 1490 "parse.y"
 {
   sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy387,&yymsp[0].minor.yy0);
 }
 #line 3696 "parse.c"
         break;
       case 252: /* with ::= */
-#line 1520 "parse.y"
+#line 1513 "parse.y"
 {yymsp[1].minor.yy151 = 0;}
 #line 3701 "parse.c"
         break;
       case 253: /* with ::= WITH wqlist */
-#line 1522 "parse.y"
+#line 1515 "parse.y"
 { yymsp[-1].minor.yy151 = yymsp[0].minor.yy151; }
 #line 3706 "parse.c"
         break;
       case 254: /* with ::= WITH RECURSIVE wqlist */
-#line 1523 "parse.y"
+#line 1516 "parse.y"
 { yymsp[-2].minor.yy151 = yymsp[0].minor.yy151; }
 #line 3711 "parse.c"
         break;
       case 255: /* wqlist ::= nm eidlist_opt AS LP select RP */
-#line 1525 "parse.y"
+#line 1518 "parse.y"
 {
   yymsp[-5].minor.yy151 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy382, yymsp[-1].minor.yy279); /*A-overwrites-X*/
 }
 #line 3718 "parse.c"
         break;
       case 256: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
-#line 1528 "parse.y"
+#line 1521 "parse.y"
 {
   yymsp[-7].minor.yy151 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy151, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy382, yymsp[-1].minor.yy279);
 }
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 9ee7daccf..7fc19bded 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -367,7 +367,6 @@ ifexists(A) ::= .            {A = 0;}
 
 ///////////////////// The CREATE VIEW statement /////////////////////////////
 //
-%ifndef SQLITE_OMIT_VIEW
 cmd ::= createkw(X) VIEW ifnotexists(E) nm(Y) eidlist_opt(C)
           AS select(S). {
   sqlite3CreateView(pParse, &X, &Y, C, S, E);
@@ -375,7 +374,6 @@ cmd ::= createkw(X) VIEW ifnotexists(E) nm(Y) eidlist_opt(C)
 cmd ::= DROP VIEW ifexists(E) fullname(X). {
   sqlite3DropTable(pParse, X, 1, E);
 }
-%endif  SQLITE_OMIT_VIEW
 
 //////////////////////// The SELECT statement /////////////////////////////////
 //
@@ -1350,8 +1348,6 @@ plus_num(A) ::= number(A).
 minus_num(A) ::= MINUS number(X).     {A = X;}
 //////////////////////////// The CREATE TRIGGER command /////////////////////
 
-%ifndef SQLITE_OMIT_TRIGGER
-
 cmd ::= createkw trigger_decl(A) BEGIN trigger_cmd_list(S) END(Z). {
   Token all;
   all.z = A.z;
@@ -1464,7 +1460,6 @@ expr(A) ::= RAISE(X) LP raisetype(T) COMMA STRING(Z) RP(Y).  {
     A.pExpr->affinity = (char)T;
   }
 }
-%endif  !SQLITE_OMIT_TRIGGER
 
 %type raisetype {int}
 raisetype(A) ::= ROLLBACK.  {A = ON_CONFLICT_ACTION_ROLLBACK;}
@@ -1473,11 +1468,9 @@ raisetype(A) ::= FAIL.      {A = ON_CONFLICT_ACTION_FAIL;}
 
 
 ////////////////////////  DROP TRIGGER statement //////////////////////////////
-%ifndef SQLITE_OMIT_TRIGGER
 cmd ::= DROP TRIGGER ifexists(NOERR) fullname(X). {
   sqlite3DropTrigger(pParse,X,NOERR);
 }
-%endif  !SQLITE_OMIT_TRIGGER
 
 ////////////////////////// REINDEX collation //////////////////////////////////
 %ifndef SQLITE_OMIT_REINDEX
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 23b4c73b5..8aa96119f 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -153,7 +153,6 @@ returnSingleInt(Vdbe * v, i64 value)
 /*
  * Return a human-readable name for a constraint resolution action.
  */
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 static const char *
 actionName(u8 action)
 {
@@ -178,7 +177,6 @@ actionName(u8 action)
 	}
 	return zName;
 }
-#endif
 
 /*
  * Locate a pragma in the aPragmaName[] array.
@@ -536,7 +534,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	}
 #endif				/* SQLITE_OMIT_SCHEMA_PRAGMAS */
 
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 	case PragTyp_FOREIGN_KEY_LIST:{
 			if (zRight) {
 				FKey *pFK;
@@ -569,10 +566,7 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 			}
 			break;
 		}
-#endif				/* !defined(SQLITE_OMIT_FOREIGN_KEY) */
 
-#ifndef SQLITE_OMIT_FOREIGN_KEY
-#ifndef SQLITE_OMIT_TRIGGER
 	case PragTyp_FOREIGN_KEY_CHECK:{
 			FKey *pFK;	/* A foreign key constraint */
 			Table *pTab;	/* Child table contain "REFERENCES"
@@ -743,8 +737,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 			}
 			break;
 		}
-#endif				/* !defined(SQLITE_OMIT_TRIGGER) */
-#endif				/* !defined(SQLITE_OMIT_FOREIGN_KEY) */
 
 #ifndef NDEBUG
 	case PragTyp_PARSER_TRACE:{
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index f04c27d47..cfdd868c5 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -153,14 +153,12 @@ static const PragmaName aPragmaName[] = {
 	 /* iArg:      */ 0},
 #endif
 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
-#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
 	{ /* zName:     */ "defer_foreign_keys",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_DeferFKs},
 #endif
-#endif
 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "empty_result_callbacks",
 	 /* ePragTyp:  */ PragTyp_FLAG,
@@ -168,30 +166,24 @@ static const PragmaName aPragmaName[] = {
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_NullCallback},
 #endif
-#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
 	{ /* zName:     */ "foreign_key_check",
 	 /* ePragTyp:  */ PragTyp_FOREIGN_KEY_CHECK,
 	 /* ePragFlg:  */ PragFlg_NeedSchema,
 	 /* ColNames:  */ 37, 4,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQLITE_OMIT_FOREIGN_KEY)
 	{ /* zName:     */ "foreign_key_list",
 	 /* ePragTyp:  */ PragTyp_FOREIGN_KEY_LIST,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 29, 8,
 	 /* iArg:      */ 0},
-#endif
 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
-#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
 	{ /* zName:     */ "foreign_keys",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_ForeignKeys},
 #endif
-#endif
 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "full_column_names",
 	 /* ePragTyp:  */ PragTyp_FLAG,
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 63997f25e..c5db29c96 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -307,8 +307,6 @@ lookupName(Parse * pParse,	/* The parsing context */
 				}
 			}
 		}
-		/* if( pSrcList ) */
-#ifndef SQLITE_OMIT_TRIGGER
 		/* If we have not already resolved the name, then maybe
 		 * it is a new.* or old.* trigger argument reference
 		 */
@@ -367,7 +365,6 @@ lookupName(Parse * pParse,	/* The parsing context */
 				}
 			}
 		}
-#endif				/* !defined(SQLITE_OMIT_TRIGGER) */
 
 		/*
 		 * If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index c7f87f340..44863b394 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -1175,7 +1175,6 @@ selectInnerLoop(Parse * pParse,		/* The parser context */
 		}
 #endif				/* SQLITE_OMIT_CTE */
 
-#if !defined(SQLITE_OMIT_TRIGGER)
 		/* Discard the results.  This is used for SELECT statements inside
 		 * the body of a TRIGGER.  The purpose of such selects is to call
 		 * user-defined functions that have side effects.  We do not care
@@ -1185,7 +1184,6 @@ selectInnerLoop(Parse * pParse,		/* The parser context */
 			assert(eDest == SRT_Discard);
 			break;
 		}
-#endif
 	}
 
 	/* Jump to the end of the loop if the LIMIT is reached.  Except, if
@@ -3471,7 +3469,7 @@ multiSelectOrderBy(Parse * pParse,	/* Parsing context */
 }
 #endif
 
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 /* Forward Declarations */
 static void substExprList(Parse *, ExprList *, int, ExprList *);
 static void substSelect(Parse *, Select *, int, ExprList *, int);
@@ -3576,9 +3574,9 @@ substSelect(Parse * pParse,	/* Report errors here */
 		}
 	} while (doPrior && (p = p->pPrior) != 0);
 }
-#endif				/* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
+#endif /* !defined(SQLITE_OMIT_SUBQUERY) */
 
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 /*
  * This routine attempts to flatten subqueries as a performance optimization.
  * This routine returns 1 if it makes changes and 0 if no flattening occurs.
@@ -4146,9 +4144,9 @@ flattenSubquery(Parse * pParse,		/* Parsing context */
 
 	return 1;
 }
-#endif				/* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
+#endif /* !defined(SQLITE_OMIT_SUBQUERY) */
 
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 /*
  * Make copies of relevant WHERE clause terms of the outer query into
  * the WHERE clause of subquery.  Example:
@@ -4225,7 +4223,7 @@ pushDownWhereTerms(Parse * pParse,	/* Parse context (for malloc() and error repo
 	}
 	return nChng;
 }
-#endif				/* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
+#endif /* !defined(SQLITE_OMIT_SUBQUERY) */
 
 /*
  * Based on the contents of the AggInfo structure indicated by the first
@@ -4759,7 +4757,6 @@ selectExpander(Walker * pWalker, Select * p)
 			if (cannotBeFunction(pParse, pFrom)) {
 				return WRC_Abort;
 			}
-#if !defined(SQLITE_OMIT_VIEW)
 			if (space_is_view(pTab)) {
 				i16 nCol;
 				if (sqlite3ViewGetColumnNames(pParse, pTab))
@@ -4774,7 +4771,6 @@ selectExpander(Walker * pWalker, Select * p)
 				sqlite3WalkSelect(pWalker, pFrom->pSelect);
 				pTab->nCol = nCol;
 			}
-#endif
 		}
 
 		/* Locate the index named by the INDEXED BY clause, if any. */
@@ -5416,7 +5412,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 
 	/* Try to flatten subqueries in the FROM clause up into the main query
 	 */
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 	for (i = 0; !p->pPrior && i < pTabList->nSrc; i++) {
 		struct SrcList_item *pItem = &pTabList->a[i];
 		Select *pSub = pItem->pSelect;
@@ -5478,7 +5474,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 
 	/* Generate code for all sub-queries in the FROM clause
 	 */
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+#if !defined(SQLITE_OMIT_SUBQUERY)
 	for (i = 0; i < pTabList->nSrc; i++) {
 		struct SrcList_item *pItem = &pTabList->a[i];
 		SelectDest dest;
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index f43711a7f..91a338246 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -3580,12 +3580,7 @@ int sqlite3FaultSim(int);
 #endif
 
 void sqlite3CreateView(Parse *, Token *, Token *, ExprList *, Select *, int);
-
-#if !defined(SQLITE_OMIT_VIEW)
 int sqlite3ViewGetColumnNames(Parse *, Table *);
-#else
-#define sqlite3ViewGetColumnNames(A,B) 0
-#endif
 
 #if SQLITE_MAX_ATTACHED>30
 int sqlite3DbMaskAllZero(yDbMask);
@@ -3742,11 +3737,8 @@ int sqlite3SafetyCheckOk(sqlite3 *);
 int sqlite3SafetyCheckSickOrOk(sqlite3 *);
 void sqlite3ChangeCookie(Parse *);
 
-#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
 void sqlite3MaterializeView(Parse *, Table *, Expr *, int);
-#endif
 
-#ifndef SQLITE_OMIT_TRIGGER
 void sqlite3BeginTrigger(Parse *, Token *, int, int, IdList *, SrcList *,
 			 Expr *, int);
 void sqlite3FinishTrigger(Parse *, TriggerStep *, Token *);
@@ -3770,17 +3762,6 @@ u32 sqlite3TriggerColmask(Parse *, Trigger *, ExprList *, int, int, Table *,
 			  int);
 #define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
 #define sqlite3IsToplevel(p) ((p)->pToplevel==0)
-#else
-#define sqlite3TriggersExist(C,D,E,F) 0
-#define sqlite3DeleteTrigger(A,B)
-#define sqlite3DropTriggerPtr(A,B)
-#define sqlite3UnlinkAndDeleteTrigger(A,B,C)
-#define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)
-#define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
-#define sqlite3ParseToplevel(p) p
-#define sqlite3IsToplevel(p) 1
-#define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
-#endif
 
 int sqlite3JoinType(Parse *, Token *, Token *, Token *);
 void sqlite3CreateForeignKey(Parse *, ExprList *, Token *, ExprList *, int);
@@ -3997,34 +3978,14 @@ void sqlite3WithPush(Parse *, With *, u8);
 #define sqlite3WithDelete(x,y)
 #endif
 
-/* Declarations for functions in fkey.c. All of these are replaced by
- * no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
- * key functionality is available. If OMIT_TRIGGER is defined but
- * OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
- * this case foreign keys are parsed, but no other functionality is
- * provided (enforcement of FK constraints requires the triggers sub-system).
- */
-#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
 void sqlite3FkCheck(Parse *, Table *, int, int, int *);
 void sqlite3FkDropTable(Parse *, SrcList *, Table *);
 void sqlite3FkActions(Parse *, Table *, ExprList *, int, int *);
 int sqlite3FkRequired(Table *, int *);
 u32 sqlite3FkOldmask(Parse *, Table *);
 FKey *sqlite3FkReferences(Table *);
-#else
-#define sqlite3FkActions(a,b,c,d,e)
-#define sqlite3FkCheck(a,b,c,d,e,f)
-#define sqlite3FkDropTable(a,b,c)
-#define sqlite3FkOldmask(a,b)         0
-#define sqlite3FkRequired(b,c)    0
-#endif
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 void sqlite3FkDelete(sqlite3 *, Table *);
 int sqlite3FkLocateIndex(Parse *, Table *, FKey *, Index **, int **);
-#else
-#define sqlite3FkDelete(a,b)
-#define sqlite3FkLocateIndex(a,b,c,d,e)
-#endif
 
 /*
  * Available fault injectors.  Should be numbered beginning with 0.
diff --git a/src/box/sql/treeview.c b/src/box/sql/treeview.c
index 3cdf64b56..8568e206e 100644
--- a/src/box/sql/treeview.c
+++ b/src/box/sql/treeview.c
@@ -574,7 +574,6 @@ sqlite3TreeViewExpr(TreeView * pView, const Expr * pExpr, u8 moreToFollow)
 			sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
 			break;
 		}
-#ifndef SQLITE_OMIT_TRIGGER
 	case TK_RAISE:{
 			const char *zType = "unk";
 			switch (pExpr->affinity) {
@@ -595,7 +594,6 @@ sqlite3TreeViewExpr(TreeView * pView, const Expr * pExpr, u8 moreToFollow)
 					    pExpr->u.zToken);
 			break;
 		}
-#endif
 	case TK_MATCH:{
 			sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s",
 					    pExpr->iTable, pExpr->iColumn,
diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c
index 859b421db..6248059bf 100644
--- a/src/box/sql/trigger.c
+++ b/src/box/sql/trigger.c
@@ -41,7 +41,6 @@
 /* See comment in sqliteInt.h */
 int sqlSubProgramsRemaining;
 
-#ifndef SQLITE_OMIT_TRIGGER
 /*
  * Delete a linked list of TriggerStep structures.
  */
@@ -1161,5 +1160,3 @@ sqlite3TriggerColmask(Parse * pParse,	/* Parse context */
 
 	return mask;
 }
-
-#endif				/* !defined(SQLITE_OMIT_TRIGGER) */
diff --git a/src/box/sql/update.c b/src/box/sql/update.c
index 7727ae5d5..fe568ad4c 100644
--- a/src/box/sql/update.c
+++ b/src/box/sql/update.c
@@ -127,12 +127,9 @@ sqlite3Update(Parse * pParse,		/* The parser context */
 	int labelBreak;		/* Jump here to break out of UPDATE loop */
 	int labelContinue;	/* Jump here to continue next step of UPDATE loop */
 	struct session *user_session = current_session();
-
-#ifndef SQLITE_OMIT_TRIGGER
 	int isView;		/* True when updating a view (INSTEAD OF trigger) */
 	Trigger *pTrigger;	/* List of triggers on pTab, if required */
 	int tmask;		/* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */
-#endif
 	int newmask;		/* Mask of NEW.* columns accessed by BEFORE triggers */
 	int iEph = 0;		/* Ephemeral table holding all primary key values */
 	int nKey = 0;		/* Number of elements in regKey */
@@ -161,19 +158,9 @@ sqlite3Update(Parse * pParse,		/* The parser context */
 	/* Figure out if we have any triggers and if the table being
 	 * updated is a view.
 	 */
-#ifndef SQLITE_OMIT_TRIGGER
 	pTrigger = sqlite3TriggersExist(pTab, TK_UPDATE, pChanges, &tmask);
 	isView = space_is_view(pTab);
 	assert(pTrigger || tmask == 0);
-#else
-#define pTrigger 0
-#define isView 0
-#define tmask 0
-#endif
-#ifdef SQLITE_OMIT_VIEW
-#undef isView
-#define isView 0
-#endif
 
 	if (sqlite3ViewGetColumnNames(pParse, pTab)) {
 		goto update_cleanup;
@@ -306,13 +293,11 @@ sqlite3Update(Parse * pParse,		/* The parser context */
 	/* If we are trying to update a view, realize that view into
 	 * an ephemeral table.
 	 */
-#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
 	if (isView) {
 		sqlite3MaterializeView(pParse, pTab, pWhere, iDataCur);
 		/* Number of columns from SELECT plus ID.*/
 		nKey = pTab->nCol + 1;
 	}
-#endif
 
 	/* Resolve the column names in all the expressions in the
 	 * WHERE clause.
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 329d46886..c7c84bbc0 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -4919,7 +4919,6 @@ case OP_DropTrigger: {
 	sqlite3UnlinkAndDeleteTrigger(db, pOp->p4.z);
 	break;
 }
-#ifndef SQLITE_OMIT_TRIGGER
 
 /* Opcode: Program P1 P2 P3 P4 P5
  *
@@ -5076,9 +5075,6 @@ case OP_Param: {           /* out2 */
 	break;
 }
 
-#endif /* #ifndef SQLITE_OMIT_TRIGGER */
-
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 /* Opcode: FkCounter P1 P2 * * *
  * Synopsis: fkctr[P1]+=P2
  *
@@ -5120,7 +5116,6 @@ case OP_FkIfZero: {         /* jump */
 	}
 	break;
 }
-#endif /* #ifndef SQLITE_OMIT_FOREIGN_KEY */
 
 /* Opcode: IfPos P1 P2 P3 * *
  * Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2
diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
index 340ddc766..79ebc2d0d 100644
--- a/src/box/sql/vdbe.h
+++ b/src/box/sql/vdbe.h
@@ -266,9 +266,7 @@ int sql_vdbe_mem_alloc_region(Mem *, uint32_t);
 typedef int (*RecordCompare) (int, const void *, UnpackedRecord *);
 RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *);
 
-#ifndef SQLITE_OMIT_TRIGGER
 void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
-#endif
 
 /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on
  * each VDBE opcode.
diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h
index fcb45c8a8..e5308ed85 100644
--- a/src/box/sql/vdbeInt.h
+++ b/src/box/sql/vdbeInt.h
@@ -556,11 +556,7 @@ void sqlite3VdbeMemAboutToChange(Vdbe *, Mem *);
 int sqlite3VdbeCheckMemInvariants(Mem *);
 #endif
 
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 int sqlite3VdbeCheckFk(Vdbe *, int);
-#else
-#define sqlite3VdbeCheckFk(p,i) 0
-#endif
 
 int sqlite3VdbeMemTranslate(Mem *, u8);
 #ifdef SQLITE_DEBUG
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index e4335524a..a4dd698ca 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -619,11 +619,9 @@ sqlite3VdbeAssertMayAbort(Vdbe * v, int mayAbort)
 			hasAbort = 1;
 			break;
 		}
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 		if (opcode == OP_FkCounter && pOp->p1 == 0 && pOp->p2 == 1) {
 			hasFkCounter = 1;
 		}
-#endif
 	}
 	sqlite3DbFree(v->db, sIter.apSub);
 
@@ -2463,7 +2461,6 @@ sqlite3VdbeCloseStatement(Vdbe * p, int eOp)
  * SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY
  * and write an error message to it. Then return SQLITE_ERROR.
  */
-#ifndef SQLITE_OMIT_FOREIGN_KEY
 int
 sqlite3VdbeCheckFk(Vdbe * p, int deferred)
 {
@@ -2477,7 +2474,6 @@ sqlite3VdbeCheckFk(Vdbe * p, int deferred)
 	}
 	return SQLITE_OK;
 }
-#endif
 
 int
 sql_txn_begin(Vdbe *p)
-- 
2.15.1

  reply	other threads:[~2018-04-03 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 14:54 [tarantool-patches] [PATCH 0/3] Rework VIEW processing Nikita Pettik
2018-04-03 14:54 ` Nikita Pettik [this message]
2018-04-03 17:23   ` [tarantool-patches] Re: [PATCH 1/3] sql: remove usless #ifdef directives Vladislav Shpilevoy
2018-04-03 14:54 ` [tarantool-patches] [PATCH 2/3] sql: add view column aliases to space format Nikita Pettik
2018-04-03 14:54 ` [tarantool-patches] [PATCH 3/3] sql: load SELECT from 'CREATE VIEW ...' string Nikita Pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36f222edde4edcd81e544a2c3e83c5b0aef721bd.1522763649.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH 1/3] sql: remove usless #ifdef directives' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox