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 C6BF2219A7 for ; Tue, 22 May 2018 12:30:21 -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 9A1jji7LTVgM for ; Tue, 22 May 2018 12:30:21 -0400 (EDT) Received: from smtp20.mail.ru (smtp20.mail.ru [94.100.179.251]) (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 8323C21909 for ; Tue, 22 May 2018 12:30:21 -0400 (EDT) Date: Tue, 22 May 2018 19:30:19 +0300 From: Kirill Yukhin Subject: [tarantool-patches] Re: [PATCH] sql: add index_def to struct Index Message-ID: <20180522163019.n7xftuqcmtrc5ipg@tarantool.org> References: <20180522160320.83110-1-ivan.koptelov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180522160320.83110-1-ivan.koptelov@tarantool.org> 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: v.shpilevoy@tarantool.org, Ivan Koptelov On 22 мая 19:03, Ivan Koptelov wrote: > Currently there is a problem with > non-deterministic nullability in > index_def. To see the error just > uncomment printfs on build.c 2999 > and run any sql-tap test that > has to do with indexes, e.g > distinct.test.lua. > github branch: https://github.com/tarantool/tarantool/tree/sb/gh-3369-use-index-def-in-select-and-where > --- > src/box/sql/build.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++- > src/box/sql/sqliteInt.h | 2 + > 2 files changed, 179 insertions(+), 2 deletions(-) > > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 742f8a572..6bd70fa9f 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -43,6 +43,7 @@ > * COMMIT > * ROLLBACK > */ > +#include > #include "sqliteInt.h" > #include "vdbeInt.h" > #include "tarantoolInt.h" > @@ -2841,9 +2842,173 @@ index_is_unique(Index *idx) > return tnt_index->def->opts.is_unique; > } > > +/* > + * In CREATE INDEX requests user may set binary collation with COLLATE > + * [BINARY, binary, "binary" and "bInarY"] This function is to handle all > + * these cases. > + */ > +bool is_binary_collation(const char *coll_name) > +{ > + char *upper_case_name = > + malloc(sizeof(*coll_name) * strlen(coll_name)); > + for (int i = 0; i < (int) strlen(coll_name); i++) { > + upper_case_name[i] = toupper(coll_name[i]); > + } > + > + bool res = (strcmp(upper_case_name, "BINARY") == 0); > + free(upper_case_name); > + return res; > +} > + > +//bool is_index_equal(Index * old, struct index_def *new) > +//{ > +// assert(strcmp(old->zName, new->name); > +// return true; > +//} Junk. > + > +// part_def_tmp[i].is_nullable = > +// (fieldno < space_def->field_count ? > +// space_def->fields[fieldno].is_nullable : > +// false); Junk. > @@ -3283,8 +3455,11 @@ sqlite3CreateIndex(Parse * pParse, /* All information about this parse */ > > /* Clean up before exiting */ > exit_create_index: > - if (pIndex) > + if (pIndex) { > + if (pIndex->def) != NULL. > + index_def_delete(pIndex->def); > freeIndex(db, pIndex); > + } > sql_expr_free(db, pPIWhere, false); > sqlite3ExprListDelete(db, pList); > sqlite3SrcListDelete(db, pTblName);