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 AD42F215B1 for ; Mon, 23 Jul 2018 04:31:48 -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 3b1aMF7GKC_s for ; Mon, 23 Jul 2018 04:31:48 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 1C3D11FD34 for ; Mon, 23 Jul 2018 04:31:48 -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> <972c8144-0f4c-c882-3ab9-4a50cbaf43c6@tarantool.org> <185A42F6-2824-47BE-A521-147C8D22F944@tarantool.org> From: Kirill Shcherbatov Message-ID: <3ede21f4-dde1-4853-b08c-f3c7f076021b@tarantool.org> Date: Mon, 23 Jul 2018 11:31:45 +0300 MIME-Version: 1.0 In-Reply-To: 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: tarantool-patches@freelists.org, Nikita Pettik Hi again! I've rebased my patch on Kirill's Y. branch kyukhin/gh-3482-remove-ipkey; I've also have succeed in using ON_CONFLICT_ACTION_DEFAULT instead of on_conflict_action_MAX. This changes represented as "[draft] don't use on_conflict_default_MAX" commit on my branch. I've have had to introduce small rule index_onconf that looks very similar with onconf. If I not mistaken, you are going to get rid of Index on_conflict action; and this rudiment crap would disappear. On 20.07.2018 10:29, Kirill Shcherbatov wrote: >>>> 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. >> >> Well, it seems to be total mess. DEFAULT (for nullable on conflict action) >> is always converted into ABORT. If you move this conversation right after >> parser’s pass, you can get rid off using additional enum value: >> >> create table t1(a NULL PRIMARY KEY NOT NULL , b); >> >> a == DEFAULT —> NONE —> ABORT >> b == DEFAULT —> NONE > Please, read my previous message again. > > I need to distinguish no-initialized and initialized columns. > +box.sql.execute('CREATE TABLE te17 (s1 INT NULL PRIMARY KEY NOT NULL);') > +--- > +- error: 'SQL error: NULL declaration for column ''S1'' of table ''TE17'' has been > + already set to ''none''' > > I need a marker. I've tried to use ON_CONFLICT_ACTION_DEFAULT in this role, but it looks not > workable until Index->onError present: onconf parse.y rule should be universal. > > Let's discuss this verbally if you need. > >