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 242EC27B0C for ; Thu, 19 Jul 2018 04:12:57 -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 Kd1kf_Z94P1h for ; Thu, 19 Jul 2018 04:12:57 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 B718E27B15 for ; Thu, 19 Jul 2018 04:12:56 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/3] sql: restrict nullable action definitions References: <33314a00ce2e0602e0a0fa7e30257ff03e3eed16.1531932662.git.kshcherbatov@tarantool.org> <51802451-C9AA-4EB8-8926-D08446738FF1@tarantool.org> From: Kirill Shcherbatov Message-ID: <972c8144-0f4c-c882-3ab9-4a50cbaf43c6@tarantool.org> Date: Thu, 19 Jul 2018 11:12:54 +0300 MIME-Version: 1.0 In-Reply-To: <51802451-C9AA-4EB8-8926-D08446738FF1@tarantool.org> Content-Type: text/plain; charset="utf-8" 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: "n.pettik" , Tarantool MailList > This name sounds really weird.. Why not sql_column_add_nullable_action ? If you wish. -sql_column_nullable_action_add(struct Parse *parser, +sql_column_add_nullable_action(struct Parse *parser, > Why do you need on_conflict_action_MAX when you already have ON_CONFLICT_ACTION_DEFAULT? > Anyway, there is no action DEFAULT, it is sooner or later converted to ABORT. This is the central idea of the patch. on_conflict_action_MAX is a marker that this field wasn't initialized yet manually. This allows to detect second attempt to specify NULL/NOT NULL etc. There is a comment about this concept in sqlite3AddColumn where on_conflict_action_MAX is set. The default behavior is ON_CONFLICT_ACTION_NONE and we have to distinguish non-initialized columns and initialized with ON_CONFLICT_ACTION_DEFAULT. > Could we avoid using iPKey in this function? We are going to remove it soon. I don't increase a complexity here and believe that is patch is not about to suggest a way to exclude iPkey. No idea. - sqlite3TokenInit(&ipkToken, pTab->def->fields[pTab->iPKey].name); + struct field_def *field = &fields[pTab->iPKey]; > Lets write ‘can’t be declared with NULL’. Otherwise, it seems to be confusing. --- gh-3473: Primary key can be declared with NULL. +-- gh-3473: Primary key can't be declared with NULL.