[tarantool-patches] Re: [PATCH v4 6/7] sql: start using is_view field from space_def
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Thu May 3 14:16:43 MSK 2018
"start using is_view field from space_def" instead of what? It is
not obvious that the previous flag was Table->pSelect != NULL.
See 3 comments below.
On 28/04/2018 21:26, Kirill Shcherbatov wrote:
> Part of #3272.
> ---
> src/box/sql.c | 2 ++
> src/box/sql/build.c | 24 +++++++++++++++++-------
> src/box/sql/delete.c | 9 ++++++---
> src/box/sql/expr.c | 3 ++-
> src/box/sql/select.c | 2 ++
> src/box/sql/update.c | 3 ++-
> 6 files changed, 31 insertions(+), 12 deletions(-)
>
> diff --git a/src/box/sql.c b/src/box/sql.c
> index 47f7cb1..9f5a124 100644
> --- a/src/box/sql.c
> +++ b/src/box/sql.c
> @@ -1511,6 +1511,8 @@ int tarantoolSqlite3MakeTableOpts(Table *pTable, const char *zSql, void *buf)
> bool is_view = false;
> if (pTable != NULL)
> is_view = pTable->pSelect != NULL;
> + assert(!pTable || pTable->def->opts.is_view == is_view);
1. You said, that you start using is_view, but here you continue to
use pSelect. Why? 🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔 Lets move pSelect into
assert, and use is_view from table space_def. And how pTable can be NULL here?
2. Remove (void)pTable;. The pTable argument is not unused now.
> @@ -1933,7 +1937,8 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
> iSpaceId = getNewSpaceId(pParse);
> createSpace(pParse, iSpaceId, zStmt);
> /* Indexes aren't required for VIEW's. */
> - if (p->pSelect == NULL) {
> + assert(p->def->opts.is_view == (p->pSelect != NULL));
> + if (!p->def->opts.is_view) {
> createImplicitIndices(pParse, iSpaceId);
> }
3. Unnecessary {}.
More information about the Tarantool-patches
mailing list