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 v1 1/2] sql: restrict nullable action definitions
Date: Mon, 16 Jul 2018 13:20:30 +0300	[thread overview]
Message-ID: <7c6f7d73-5b64-0076-38a4-41f8c0a5ebc4@tarantool.org> (raw)
In-Reply-To: <ef570c99-3686-febc-5225-4a0bfe71e949@tarantool.org>

Hello. Thanks for the fixes! See 3 comments below.

On 16/07/2018 12:43, Kirill Shcherbatov wrote:
>> I have pushed my review fixes on the branch, and they
>> correct some of the comments. Please, finish the patch
>> after my fixes including rest of the comments.
> Thank you for review, I've fixed all problems on branch and squashed.
> 
>> 1. Please, remove is_primkey. It is not needed here and can be easily
>> removed together with merging this cycle into the code below. The
>> only place where it is still used except here is
>> check_on_conflict_replace_entries, that can be spread over other
>> primary key checks.
>> 2. Please, use ER_NULLABLE_PRIMARY.
>> 3. This is checked already, so the rest of hunk below can be removed.
> Fixed with review fixes.

1. No, is_primkey still is not removed. I see it in struct Column.

> 
> 
> ============================================
> 
> 
> This patch dissallows define multiple "NULL", "NOT NULL"
> options per column and fixes silent implicit behavior
> for invalid "NULL PRIMARY KEY" construction.
> 
> Closes #3473.
> ---
>   src/box/sql/build.c           | 86 +++++++++++++++++++++++++++++++++----------
>   src/box/sql/parse.y           |  7 +++-
>   test/sql/on-conflict.result   | 21 +++++++++++
>   test/sql/on-conflict.test.lua |  8 ++++
>   4 files changed, 101 insertions(+), 21 deletions(-)
> 
> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> index ac935fd..e2bdc4a 100644
> --- a/src/box/sql/parse.y
> +++ b/src/box/sql/parse.y
> @@ -276,7 +276,12 @@ ccons ::= DEFAULT id(X).              {
>   // In addition to the type name, we also care about the primary key and
>   // UNIQUE constraints.
>   //
> -ccons ::= NULL onconf.
> +ccons ::= NULL onconf(R).        {
> +    sqlite3AddNotNull(pParse, ON_CONFLICT_ACTION_NONE);
> +    /* Trigger nullability mismatch error if required. */
> +    if (R != ON_CONFLICT_ACTION_DEFAULT)

2. Why do you need this check?

3. Why sqlite3AddNotNull is called when NULL is allowed?
Please, rename the function or split it or something.

> +        sqlite3AddNotNull(pParse, R);
> +}
>   ccons ::= NOT NULL onconf(R).    {sqlite3AddNotNull(pParse, R);}
>   ccons ::= PRIMARY KEY sortorder(Z) onconf(R) autoinc(I).
>                                    {sqlite3AddPrimaryKey(pParse,0,R,I,Z);}

  reply	other threads:[~2018-07-16 10:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 16:34 [tarantool-patches] [PATCH v1 0/2] " Kirill Shcherbatov
2018-07-12 16:34 ` [tarantool-patches] [PATCH v1 1/2] " Kirill Shcherbatov
2018-07-13 10:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-13 16:05     ` Kirill Shcherbatov
2018-07-13 20:03       ` Vladislav Shpilevoy
2018-07-16  9:43         ` Kirill Shcherbatov
2018-07-16 10:20           ` Vladislav Shpilevoy [this message]
2018-07-16 12:27             ` Kirill Shcherbatov
2018-07-12 16:34 ` [tarantool-patches] [PATCH v1 2/2] sql: fixed possible leak in sqlite3EndTable Kirill Shcherbatov
2018-07-13 10:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-13 16:05     ` Kirill Shcherbatov
2018-07-13 10:26 ` [tarantool-patches] Re: [PATCH v1 0/2] sql: restrict nullable action definitions Vladislav Shpilevoy
2018-07-16 12:28 ` [tarantool-patches] [PATCH v1 2/4] sql: refactor sqlite3AddNotNull function Kirill Shcherbatov
2018-07-16 13:41   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-16 12:28 ` [tarantool-patches] [PATCH v1 4/4] sql: get rid of Column structure Kirill Shcherbatov
2018-07-16 13:40   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-16 16:33     ` Kirill Shcherbatov
2018-07-17  9:32       ` Vladislav Shpilevoy
2018-07-17 14:08         ` Kirill Shcherbatov
2018-07-17 22:01           ` Vladislav Shpilevoy
2018-07-18  7:25             ` Kirill Shcherbatov
2018-07-18  8:04               ` Vladislav Shpilevoy
2018-07-18 16:41                 ` n.pettik

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=7c6f7d73-5b64-0076-38a4-41f8c0a5ebc4@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/2] sql: restrict nullable action definitions' \
    /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