From: Kirill Shcherbatov <kshcherbatov@tarantool.org> To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v1 3/3] sql: get rid of Column structure Date: Thu, 19 Jul 2018 11:12:51 +0300 [thread overview] Message-ID: <73ba298b-8546-6a67-1b6e-87d2b55a9d8a@tarantool.org> (raw) In-Reply-To: <4A0B514A-C0DA-406F-BD14-B1F11D4357EF@tarantool.org> > Again: why did this patch trapped in patch-set? All three patches seem to be independent. You and Vlad sometimes ask me to do some unrelated to patch work; This is the same situation. And it is also convenient to ask Kirill to merge a big patch set than to noise a lot for each small fix. > Typo: ‘becomes’. Yep, fixed. > Why do you need to move collation ptr to field_def? It already features collation id, > so you can always get pointer to it by simple lookup. It would make sense if it was > utilised everywhere. But I see assignment only in sqlite3SelectAddColumnTypeAndCollation() > and no real usages..Lets remove it at all. diff --git a/src/box/alter.cc b/src/box/alter.cc index 444bc48..7b6bd1a 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -407,9 +407,6 @@ field_def_decode(struct field_def *field, const char **data, tt_sprintf("collation is reasonable only for " "string, scalar and any fields")); } - struct coll_id *collation = coll_by_id(field->coll_id); - if (collation != NULL) - field->coll = collation->coll; const char *dv = field->default_value; if (dv != NULL) { diff --git a/src/box/field_def.c b/src/box/field_def.c index 12cc3b2..8dbead6 100644 --- a/src/box/field_def.c +++ b/src/box/field_def.c @@ -106,7 +106,6 @@ const struct field_def field_def_default = { .is_nullable = false, .nullable_action = ON_CONFLICT_ACTION_DEFAULT, .coll_id = COLL_NONE, - .coll = NULL, .default_value = NULL, .default_value_expr = NULL }; diff --git a/src/box/field_def.h b/src/box/field_def.h index c8f158c..05f80d4 100644 --- a/src/box/field_def.h +++ b/src/box/field_def.h @@ -123,8 +123,6 @@ struct field_def { enum on_conflict_action nullable_action; /** Collation ID for string comparison. */ uint32_t coll_id; - /** Collating sequence for string comparison. */ - struct coll *coll; /** 0-terminated SQL expression for DEFAULT value. */ char *default_value; /** AST for parsed default value. */ diff --git a/src/box/sql/build.c b/src/box/sql/build.c index 6f803cf..2615624 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -992,9 +992,8 @@ sqlite3AddCollateType(Parse * pParse, Token * pToken) char *zColl = sqlite3NameFromToken(db, pToken); if (!zColl) return; - uint32_t *id = &p->def->fields[i].coll_id; - p->def->fields[i].coll = sql_get_coll_seq(pParse, zColl, id); - if (p->def->fields[i].coll != NULL) { + uint32_t *coll_id = &p->def->fields[i].coll_id; + if (sql_get_coll_seq(pParse, zColl, coll_id) != NULL) { /* If the column is declared as "<name> PRIMARY KEY COLLATE <type>", * then an index may have been created on this column before the * collation type was added. Correct this if it is the case. @@ -1003,9 +1002,8 @@ sqlite3AddCollateType(Parse * pParse, Token * pToken) pIdx = pIdx->pNext) { assert(pIdx->def->key_def->part_count == 1); if (pIdx->def->key_def->parts[0].fieldno == i) { - id = &pIdx->def->key_def->parts[0].coll_id; - pIdx->def->key_def->parts[0].coll = - sql_column_collation(p->def, i, id); + coll_id = &pIdx->def->key_def->parts[0].coll_id; + (void)sql_column_collation(p->def, i, coll_id); } } } diff --git a/src/box/sql/select.c b/src/box/sql/select.c index d577648..ab91bd0 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -1962,12 +1962,8 @@ sqlite3SelectAddColumnTypeAndCollation(Parse * pParse, /* Parsing contexts */ affinity = AFFINITY_BLOB; pTab->def->fields[i].affinity = affinity; bool unused; - uint32_t id; - struct coll *coll = sql_expr_coll(pParse, p, &unused, &id); - if (coll != NULL && pTab->def->fields[i].coll == NULL) { - pTab->def->fields[i].coll = coll; - pTab->def->fields[i].coll_id = id; - } + (void)sql_expr_coll(pParse, p, &unused, + &pTab->def->fields[i].coll_id); } } > Here you are simply fixing changes made in first patch, so mb it is better to > move them to first patch? No, I rethink thous changes taking into account new situation. It is better to keep it as is, except you think to merge this patch with first one. But it seems to be a bad idea.
next prev parent reply other threads:[~2018-07-19 8:12 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-18 16:52 [tarantool-patches] [PATCH v1 0/3] sql: restrict nullable action definitions Kirill Shcherbatov 2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 1/3] " Kirill Shcherbatov 2018-07-18 20:12 ` [tarantool-patches] " n.pettik 2018-07-19 8:12 ` Kirill Shcherbatov 2018-07-20 2:39 ` n.pettik 2018-07-20 7:29 ` Kirill Shcherbatov 2018-07-23 8:31 ` Kirill Shcherbatov 2018-07-23 16:53 ` Kirill Shcherbatov 2018-07-23 19:27 ` n.pettik 2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable Kirill Shcherbatov 2018-07-18 20:12 ` [tarantool-patches] " n.pettik 2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 3/3] sql: get rid of Column structure Kirill Shcherbatov 2018-07-18 20:13 ` [tarantool-patches] " n.pettik 2018-07-19 8:12 ` Kirill Shcherbatov [this message] 2018-07-19 8:39 ` Vladislav Shpilevoy 2018-07-19 10:17 ` Kirill Shcherbatov 2018-07-20 2:43 ` n.pettik 2018-07-24 15:26 ` [tarantool-patches] Re: [PATCH v1 0/3] sql: restrict nullable action definitions Kirill Yukhin
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=73ba298b-8546-6a67-1b6e-87d2b55a9d8a@tarantool.org \ --to=kshcherbatov@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 3/3] sql: get rid of Column structure' \ /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