From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 137A3469719 for ; Thu, 24 Sep 2020 23:59:21 +0300 (MSK) References: <20200922155903.48421-1-roman.habibov@tarantool.org> From: Vladislav Shpilevoy Message-ID: <0785ca58-7933-0b97-9dba-15882a8b7c75@tarantool.org> Date: Thu, 24 Sep 2020 22:59:19 +0200 MIME-Version: 1.0 In-Reply-To: <20200922155903.48421-1-roman.habibov@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH] box: disallow to modify format of a view List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov , tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! > diff --git a/src/box/alter.cc b/src/box/alter.cc > index ba96d9c62..4d0da347a 100644 > --- a/src/box/alter.cc > +++ b/src/box/alter.cc > @@ -2441,6 +2467,20 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event) > "view"); > return -1; > } > + if (def->opts.is_view && old_space->def->field_count != > + def->field_count) { > + diag_set(ClientError, ER_ALTER_SPACE, > + space_name(old_space), > + "can not modify field count of a view"); > + return -1; > + } > + if (def->opts.is_view && format_is_changed(old_tuple, > + new_tuple)) { > + diag_set(ClientError, ER_ALTER_SPACE, > + space_name(old_space), > + "can not modify format of a view"); > + return -1; > + } Wouldn't it be easier to just prohibit update of such tuple completely? Raise an error if new_tuple != NULL and old_tuple != NULL and the space is a view.