From: Kirill Yukhin <kyukhin@tarantool.org> To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Ivan Koptelov <ivan.koptelov@tarantool.org> Subject: [tarantool-patches] Re: [PATCH] sql: add index_def to struct Index Date: Tue, 22 May 2018 19:30:19 +0300 [thread overview] Message-ID: <20180522163019.n7xftuqcmtrc5ipg@tarantool.org> (raw) In-Reply-To: <20180522160320.83110-1-ivan.koptelov@tarantool.org> 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 <ctype.h> > #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);
next prev parent reply other threads:[~2018-05-22 16:30 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-22 16:03 [tarantool-patches] " Ivan Koptelov 2018-05-22 16:30 ` Kirill Yukhin [this message] 2018-05-22 19:10 ` [tarantool-patches] " Vladislav Shpilevoy 2018-05-25 16:19 ` Ivan Koptelov
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=20180522163019.n7xftuqcmtrc5ipg@tarantool.org \ --to=kyukhin@tarantool.org \ --cc=ivan.koptelov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH] sql: add index_def to struct Index' \ /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