[tarantool-patches] Re: [PATCH v1 1/3] sql: restrict nullable action definitions

Kirill Shcherbatov kshcherbatov at tarantool.org
Fri Jul 20 10:29:54 MSK 2018

>>> 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);
> 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.

More information about the Tarantool-patches mailing list