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 9356B232FE for ; Thu, 3 May 2018 07:22:49 -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 h0H7SLIUSqXW for ; Thu, 3 May 2018 07:22:49 -0400 (EDT) Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (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 F0DB0232EA for ; Thu, 3 May 2018 07:22:48 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v4 6/7] sql: start using is_view field from space_def References: <705209b9a9caee1fcdd8e4887810f62ae831978b.1524939875.git.kshcherbatov@tarantool.org> From: Vladislav Shpilevoy Message-ID: <014d7d01-ff41-79eb-47b8-a027e18b0c3b@tarantool.org> Date: Thu, 3 May 2018 14:16:43 +0300 MIME-Version: 1.0 In-Reply-To: <705209b9a9caee1fcdd8e4887810f62ae831978b.1524939875.git.kshcherbatov@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Kirill Shcherbatov , tarantool-patches@freelists.org "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 {}.