From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 35A5127676 for ; Sun, 15 Jul 2018 16:45:00 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8SqkLbl860CW for ; Sun, 15 Jul 2018 16:45:00 -0400 (EDT) Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E6BAC266A7 for ; Sun, 15 Jul 2018 16:44:59 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH 5/5] Enforce space format for columns Date: Sun, 15 Jul 2018 23:44:50 +0300 Message-Id: <582fad08d6cb63540ac484064a81ea1ce4912b39.1531686753.git.georgy@tarantool.org> In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko 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), { -- - 1, "abc", "", 2, "", "xyz", 11, 11, 22, 33, 33, 44 + 1, "abc", "", 2, "", "xyz", 11, "11", "22", 33, "33", "44" -- }) -- 2.18.0