From: Georgy Kirichenko <georgy@tarantool.org> To: tarantool-patches@freelists.org Cc: Georgy Kirichenko <georgy@tarantool.org> Subject: [tarantool-patches] [PATCH 5/5] Enforce space format for columns Date: Sun, 15 Jul 2018 23:44:50 +0300 [thread overview] Message-ID: <582fad08d6cb63540ac484064a81ea1ce4912b39.1531686753.git.georgy@tarantool.org> (raw) In-Reply-To: <cover.1531686753.git.georgy@tarantool.org> Use correct field type for each table column instead of scalar --- src/box/sql.c | 18 +++++++----------- test/sql-tap/select1.test.lua | 6 +++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/box/sql.c b/src/box/sql.c index 12279d0e1..c2af5c4de 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -1376,26 +1376,22 @@ static const struct Enc *get_enc(void *buf) */ static const char *convertSqliteAffinity(int affinity, bool allow_nulls) { - if (allow_nulls || 1) { + (void) allow_nulls; +/* if (allow_nulls || 1) { return "scalar"; - } + }*/ switch (affinity) { - default: - assert(false); case AFFINITY_BLOB: return "scalar"; case AFFINITY_TEXT: return "string"; case AFFINITY_NUMERIC: case AFFINITY_REAL: - /* Tarantool workaround: to make comparators able to compare, e.g. - double and int use generic type. This might be a performance issue. */ - /* return "number"; */ - return "scalar"; + return "number"; case AFFINITY_INTEGER: - /* See comment above. */ - /* return "integer"; */ - return "scalar"; + return "integer"; + default: + assert(false); } } diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua index 1503bd041..9415256c6 100755 --- a/test/sql-tap/select1.test.lua +++ b/test/sql-tap/select1.test.lua @@ -222,17 +222,17 @@ string.format([[ INSERT INTO test1 VALUES(11,22); INSERT INTO test1 VALUES(33,44); DROP TABLE IF EXISTS t3; - CREATE TABLE t3(id INT, a INT , b INT , PRIMARY KEY(id)); + CREATE TABLE t3(id INT, a TEXT, b TEXT, PRIMARY KEY(id)); INSERT INTO t3 VALUES(1, 'abc',NULL); INSERT INTO t3 VALUES(2, NULL,'xyz'); INSERT INTO t3 SELECT f1, * FROM test1; DROP TABLE IF EXISTS t4; - CREATE TABLE t4(id INT, a INT , b INT , PRIMARY KEY(id)); + CREATE TABLE t4(id INT, a INT , b TEXT , PRIMARY KEY(id)); INSERT INTO t4 VALUES(1, NULL,'%s'); SELECT * FROM t3; ]], long), { -- <select1-2.0> - 1, "abc", "", 2, "", "xyz", 11, 11, 22, 33, 33, 44 + 1, "abc", "", 2, "", "xyz", 11, "11", "22", 33, "33", "44" -- </select1-2.0> }) -- 2.18.0
prev parent reply other threads:[~2018-07-15 20:45 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-15 20:44 [tarantool-patches] [PATCH 0/5] SQL static types Georgy Kirichenko 2018-07-15 20:44 ` [tarantool-patches] [PATCH 1/5] Specify types for internal tables Georgy Kirichenko 2018-07-15 20:44 ` [tarantool-patches] [PATCH 2/5] Split on_conflict_action and affinity Georgy Kirichenko 2018-07-15 20:44 ` [tarantool-patches] [PATCH 3/5] Annotate a sql function with affinity Georgy Kirichenko 2018-07-15 20:44 ` [tarantool-patches] [PATCH 4/5] Column type should be defined on table creation Georgy Kirichenko 2018-07-15 20:44 ` Georgy Kirichenko [this message]
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=582fad08d6cb63540ac484064a81ea1ce4912b39.1531686753.git.georgy@tarantool.org \ --to=georgy@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH 5/5] Enforce space format for columns' \ /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