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

  • From: "n.pettik" <korablev@xxxxxxxxxxxxx>
  • To: tarantool-patches@xxxxxxxxxxxxx
  • Date: Fri, 20 Jul 2018 05:39:48 +0300


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

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.

Nevermind, Kirill already reworked this function in order to avoid using iPKey.


Other related posts: