[tarantool-patches] Re: [PATCH] sql: remove pragma schema_version

Kirill Yukhin kyukhin at tarantool.org
Tue Jul 31 16:20:53 MSK 2018


Hello Vlad,
On 31 июл 15:33, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch! I've pushed my fixes as a separate
> commit on the branch.

Thanks, I've squashed your changes.
Also, I've squashed into main patch this extra:

diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
index d846fbd..91b6515 100644
--- a/src/box/sql/alter.c
+++ b/src/box/sql/alter.c
@@ -111,10 +111,7 @@ sqlite3AlterRenameTable(Parse * pParse,	/* Parser context. */
 				pTab->def->name);
 		goto exit_rename_table;
 	}
-	/* Begin a transaction for database.
-	 * Then modify the schema cookie (since the ALTER TABLE modifies the
-	 * schema).
-	 */
+	/* Begin a transaction for database. */
 	v = sqlite3GetVdbe(pParse);
 	if (v == 0) {
 		goto exit_rename_table;
@@ -304,7 +301,7 @@ sqlite3AlterBeginAddColumn(Parse * pParse, SrcList * pSrc)
 	pNew->addColOffset = pTab->addColOffset;
 	pNew->nTabRef = 1;
 
-	/* Begin a transaction and increment the schema cookie.  */
+	/* Begin a transaction. */
 	sql_set_multi_write(pParse, false);
 	v = sqlite3GetVdbe(pParse);
 	if (!v)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index dcbeeb0..d812eb9 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -179,10 +179,8 @@ sqlite3LocateTable(Parse * pParse,	/* context in which to report errors */
 	if (p == NULL) {
 		const char *zMsg =
 		    flags & LOCATE_VIEW ? "no such view" : "no such table";
-		if ((flags & LOCATE_NOERR) == 0) {
+		if ((flags & LOCATE_NOERR) == 0)
 			sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName);
-			pParse->checkSchema = 1;
-		}
 	}
 
 	return p;
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 432e003..edd0c31 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -469,7 +469,6 @@ sqlite3Insert(Parse * pParse,	/* Parser context */
 				sqlite3ErrorMsg(pParse,
 						"table %S has no column named %s",
 						pTabList, 0, pColumn->a[i].zName);
-				pParse->checkSchema = 1;
 				goto insert_cleanup;
 			}
 			if (bit_test(used_columns, j)) {
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index a4767f2..280ecd9 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -434,7 +434,6 @@ lookupName(Parse * pParse,	/* The parsing context */
 		} else {
 			sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
 		}
-		pParse->checkSchema = 1;
 		pTopNC->nErr++;
 	}
 
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index d060a46..d824b8b 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -4385,7 +4385,6 @@ sqlite3IndexedByLookup(Parse * pParse, struct SrcList_item *pFrom)
 		if (!pIdx) {
 			sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy,
 					0);
-			pParse->checkSchema = 1;
 			return SQLITE_ERROR;
 		}
 		pFrom->pIBIndex = pIdx;
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 8b0b4b7..468b6c6 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -2824,7 +2824,6 @@ struct Parse {
 	Vdbe *pVdbe;		/* An engine for executing database bytecode */
 	int rc;			/* Return code from execution */
 	u8 colNamesSet;		/* TRUE after OP_ColumnName has been issued to pVdbe */
-	u8 checkSchema;		/* Causes schema cookie check after an error */
 	u8 nTempReg;		/* Number of temporary registers in aTempReg[] */
 	u8 isMultiWrite;	/* True if statement may modify/insert multiple rows */
 	u8 mayAbort;		/* True if statement may throw an ABORT exception */
diff --git a/src/box/sql/update.c b/src/box/sql/update.c
index 489a456..a2f6c73 100644
--- a/src/box/sql/update.c
+++ b/src/box/sql/update.c
@@ -217,7 +217,6 @@ sqlite3Update(Parse * pParse,		/* The parser context */
 		if (j >= (int)def->field_count) {
 			sqlite3ErrorMsg(pParse, "no such column: %s",
 					pChanges->a[i].zName);
-			pParse->checkSchema = 1;
 			goto update_cleanup;
 		}
 	}


--
Regards, Kirill Yukhin




More information about the Tarantool-patches mailing list