[tarantool-patches] [PATCH] sql: remove ENGINE from list of reserved keywords

Nikita Pettik korablev at tarantool.org
Tue Sep 10 23:20:44 MSK 2019


ENGINE became reserved keyword in 1013a744b. There's no any actual
reason why ENGINE should be reserved keyword. What is more, we are going
to use this word as a name of some fields for tables forming
informational schema. Hence, until it is too late (it is not documented
yet), let's remove ENGINE from the list of reserved keywords and allow
identifiers be that word.
---
Branch: https://github.com/tarantool/tarantool/tree/np/sql-remove-engine-from-keywords

 extra/mkkeywordhash.c          | 2 +-
 src/box/sql/parse.y            | 2 +-
 test/sql-tap/keyword1.test.lua | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/extra/mkkeywordhash.c b/extra/mkkeywordhash.c
index bb706ac01..2a59d6a61 100644
--- a/extra/mkkeywordhash.c
+++ b/extra/mkkeywordhash.c
@@ -93,7 +93,7 @@ static Keyword aKeywordTable[] = {
   { "DISTINCT",               "TK_DISTINCT",    true  },
   { "DROP",                   "TK_DROP",        true  },
   { "END",                    "TK_END",         true  },
-  { "ENGINE",                 "TK_ENGINE",      true  },
+  { "ENGINE",                 "TK_ENGINE",      false },
   { "EACH",                   "TK_EACH",        true  },
   { "ELSE",                   "TK_ELSE",        true  },
   { "ESCAPE",                 "TK_ESCAPE",      true  },
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index be3c5c399..643e025bd 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -248,7 +248,7 @@ columnname(A) ::= nm(A) typedef(Y). {sqlAddColumn(pParse,&A,&Y);}
 //
 %fallback ID
   ABORT ACTION ADD AFTER AUTOINCREMENT BEFORE CASCADE
-  CONFLICT DEFERRED END FAIL
+  CONFLICT DEFERRED END ENGINE FAIL
   IGNORE INITIALLY INSTEAD NO MATCH PLAN
   QUERY KEY OFFSET RAISE RELEASE REPLACE RESTRICT
   RENAME CTIME_KW IF
diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua
index 655adaf58..03b1054d2 100755
--- a/test/sql-tap/keyword1.test.lua
+++ b/test/sql-tap/keyword1.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 test = require("sqltester")
-test:plan(178)
+test:plan(180)
 
 --!./tcltestrunner.lua
 -- 2009 January 29
@@ -33,6 +33,7 @@ local kwlist = {
 	"before",
 	"conflict",
 	"deferred",
+	"engine",
 	"fail",
 	"ignore",
 	"initially",
-- 
2.15.1





More information about the Tarantool-patches mailing list