Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v4 6/7] sql: start using is_view field from space_def
Date: Thu, 3 May 2018 14:16:43 +0300	[thread overview]
Message-ID: <014d7d01-ff41-79eb-47b8-a027e18b0c3b@tarantool.org> (raw)
In-Reply-To: <705209b9a9caee1fcdd8e4887810f62ae831978b.1524939875.git.kshcherbatov@tarantool.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 {}.

  reply	other threads:[~2018-05-03 11:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 16:52 [tarantool-patches] [PATCH v3 0/4] sql: Removed Column fields to server with region allocations Kirill Shcherbatov
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 1/4] sql: Fix code style in sqlite3Pragma Kirill Shcherbatov
2018-04-26 11:47   ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 2/4] sql: Remove zName and nColumn from SQL Kirill Shcherbatov
2018-04-25 17:10   ` [tarantool-patches] " Kirill Shcherbatov
2018-04-26 12:12     ` Vladislav Shpilevoy
2018-04-26 11:47   ` Vladislav Shpilevoy
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 3/4] sql: Removed type " Kirill Shcherbatov
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 4/4] sql: Region-based allocations Kirill Shcherbatov
2018-04-26 11:47   ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-26 11:47 ` [tarantool-patches] Re: [PATCH v3 0/4] sql: Removed Column fields to server with region allocations Vladislav Shpilevoy
2018-04-28 18:26 ` [tarantool-patches] [PATCH v4 0/7] sql: refactor SQL Parser structures Kirill Shcherbatov
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 1/7] sql: fix code style in sqlite3Pragma Kirill Shcherbatov
2018-05-03 10:10     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 2/7] sql: remove zName and nColumn from SQL Kirill Shcherbatov
2018-05-03 10:10     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 3/7] sql: start using type from space_def Kirill Shcherbatov
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 4/7] sql: start using collations and is_nullable " Kirill Shcherbatov
2018-05-03 10:21     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 5/7] sql: move names to server Kirill Shcherbatov
2018-05-03 11:08     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 6/7] sql: start using is_view field from space_def Kirill Shcherbatov
2018-05-03 11:16     ` Vladislav Shpilevoy [this message]
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 7/7] sql: space_def* instead of Table* in Expr Kirill Shcherbatov
2018-05-03 11:32     ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-03 10:10   ` [tarantool-patches] Re: [PATCH v4 0/7] sql: refactor SQL Parser structures Vladislav Shpilevoy

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=014d7d01-ff41-79eb-47b8-a027e18b0c3b@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v4 6/7] sql: start using is_view field from space_def' \
    /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