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 8E9562D5B5 for ; Fri, 12 Oct 2018 07:18:51 -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 QpodzYruQ6ID for ; Fri, 12 Oct 2018 07:18:51 -0400 (EDT) Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (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 E1F282D5B3 for ; Fri, 12 Oct 2018 07:18:50 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 1/6] sql: split conflict action and affinity for Expr From: "n.pettik" In-Reply-To: <0bd6c03a-20f7-7b49-31b2-429f4302bb32@tarantool.org> Date: Fri, 12 Oct 2018 14:18:47 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <44846902-C808-4558-9F78-BA8435461B53@tarantool.org> References: <38b42cc370c2e531bb864e6172b8282d14073d56.1537216078.git.korablev@tarantool.org> <0bd6c03a-20f7-7b49-31b2-429f4302bb32@tarantool.org> 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 Cc: Vladislav Shpilevoy > On 27 Sep 2018, at 23:24, Vladislav Shpilevoy = wrote: >=20 > See 1 comment below. >=20 > On 17/09/2018 23:32, Nikita Pettik wrote: >> From: Georgy Kirichenko >> Lets introduce separate field in struct Expr to store conflict action = of >> RAISE() function, instead of messing it with affinity. >> --- >> src/box/sql/expr.c | 46 = ++++++++++++++++++---------------------------- >> src/box/sql/fkey.c | 2 +- >> src/box/sql/parse.y | 4 ++-- >> src/box/sql/sqliteInt.h | 5 ++++- >> src/box/sql/treeview.c | 6 ++++-- >> 5 files changed, 29 insertions(+), 34 deletions(-) >> diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h >> index 1d32c9a03..5ca628aac 100644 >> --- a/src/box/sql/sqliteInt.h >> +++ b/src/box/sql/sqliteInt.h >> @@ -2106,7 +2106,10 @@ typedef int ynVar; >> */ >> struct Expr { >> u8 op; /* Operation performed by this node */ >> - char affinity; /* The affinity of the column or 0 if = not a column */ >> + /** The affinity of the column or 0 if not a column. */ >> + enum affinity_type affinity; >> + /** Conflict action for RAISE() function. */ >> + enum on_conflict_action on_conflict_action; >=20 > As I understand, these two attributes are mutually > exclusive, am I right? Could you put them into a union > instead of the separate fields? Yep, surely: diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index 5ca628aac..55d4ae96e 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -2106,10 +2106,12 @@ typedef int ynVar; */ struct Expr { u8 op; /* Operation performed by this node */ - /** The affinity of the column or 0 if not a column. */ - enum affinity_type affinity; - /** Conflict action for RAISE() function. */ - enum on_conflict_action on_conflict_action; + union { + /** The affinity of the column. */ + enum affinity_type affinity; + /** Conflict action for RAISE() function. */ + enum on_conflict_action on_conflict_action; + };