[tarantool-patches] Re: [PATCH v1 1/1] sql: remove unnecessary templates for bindings

Kirill Shcherbatov kshcherbatov at tarantool.org
Wed May 23 18:42:31 MSK 2018


> 1. As I said, it is syntax error, not unsupported format.
+++ b/src/box/sql/parse.y
@@ -896,9 +896,10 @@ term(A) ::= INTEGER(X). {
 expr(A) ::= VARIABLE(X).     {
   if( !(X.z[0]=='#' && sqlite3Isdigit(X.z[1])) ){
     u32 n = X.n;
+    Token t = X;
     spanExpr(&A, pParse, TK_VARIABLE, X);
     if (A.pExpr->u.zToken[0] == '?' && n > 1) {
-        sqlite3ErrorMsg(pParse, "Unsupported variable format");
+        sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);

> 2. Wrong alignment.
> 3. This function takes already valid identifier. Again - check this in the parser.
> 4. n > 1 is guaranteed by the checks above.
> 5. Why do you need !sqlite3Isalpha(z[1])? '1a' is valid identifier, but your check forbids it. Strictly
> speaking, any number is valid identifier too. So mayby I was wrong, lets allow ':NNNN' syntax. But here
> NNNN will be interpreted as name, not number. It should be documented.
+++ b/src/box/sql/expr.c
@@ -1139,13 +1139,6 @@ sqlite3ExprAssignVarNumber(Parse * pParse, Expr * pExpr, u32 n)
 				x = (ynVar) (++pParse->nVar);
 				doAdd = 1;
 			}
-			if (n > 1 && (!sqlite3Isalpha(z[1]) ||
-			     sqlite3CheckIdentifierName(pParse, &z[1]) !=
-			     SQLITE_OK)) {
-				sqlite3ErrorMsg(pParse,
-						"name '%s' is invalid identifier", z);
-				return;
-			}

> 6. I still do not see TarantoolBot request in the issue comments.

done.




More information about the Tarantool-patches mailing list