[tarantool-patches] Re: [PATCH 4/4] sql: replace BLOB as column type with SCALAR

n.pettik korablev at tarantool.org
Thu Mar 7 17:00:04 MSK 2019



> On 7 Mar 2019, at 16:40, Konstantin Osipov <kostja at tarantool.org> wrote:
> 
> * Nikita Pettik <korablev at tarantool.org> [19/03/07 16:18]:
>> BLOB column type is represented by SCALAR field type in terms of NoSQL.
>> We attempted at emulating BLOB behaviour, but such efforts turn out to
>> be not decent enough. For this reason, we've decided to abandon these
>> attempts and fairly replace it with SCALAR column type.  SCALAR column
>> type acts in the same way as it does in NoSQL: it is aggregator-type for
>> INTEGER, NUMBER and STRING types. So, column declared with this type can
>> contain values of these three (available in SQL) types. It is worth
>> mentioning that CAST operator in this case does nothing.
>> 
> 
> Shouldn't we keep the BLOB keyword in the list of reserved words?

Yep, surely we should. Fixed:

diff --git a/extra/mkkeywordhash.c b/extra/mkkeywordhash.c
index 0a874c8e6..fbd56fa00 100644
--- a/extra/mkkeywordhash.c
+++ b/extra/mkkeywordhash.c
@@ -213,6 +213,7 @@ static Keyword aKeywordTable[] = {
   { "WHERE",                  "TK_WHERE",       ALWAYS,           true  },
   { "ANY",                    "TK_STANDARD",    RESERVED,         true  },
   { "ASENSITIVE",             "TK_STANDARD",    RESERVED,         true  },
+  { "BLOB",                   "TK_STANDARD",    RESERVED,         true  },
   { "BINARY",                 "TK_ID",          RESERVED,         true  },
   { "CALL",                   "TK_STANDARD",    RESERVED,         true  },
   { "CHAR",                   "TK_CHAR",        RESERVED,         true  },
diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua
index 6895dc16e..44fa1cfb5 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(175)
+test:plan(176)
 
 --!./tcltestrunner.lua
 -- 2009 January 29
@@ -54,6 +54,7 @@ local bannedkws = {
        "asc",
        "begin",
        "between",
+       "blob",
        "by",
        "case",
        "check",

> 
> The same applies to DATE/TIME and other words which are reserved
> in SQL standard.

These words are already reserved.

> The patch itself LGTM.

Also, I’ve rebased patch (after rebase on fresh 2.1 some new tests
failed due to usage of CHAR instead of VARCHAR).

> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov





More information about the Tarantool-patches mailing list