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 B2AEB27C15 for ; Tue, 27 Mar 2018 02:16:59 -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 V6AchHsWxnrU for ; Tue, 27 Mar 2018 02:16:59 -0400 (EDT) Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (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 716D427C13 for ; Tue, 27 Mar 2018 02:16:59 -0400 (EDT) Received: by smtp55.i.mail.ru with esmtpa (envelope-from ) id 1f0huj-0002JW-3h for tarantool-patches@freelists.org; Tue, 27 Mar 2018 09:16:57 +0300 Date: Tue, 27 Mar 2018 09:16:56 +0300 From: Konstantin Osipov Subject: [tarantool-patches] [kostja@tarantool.org: Re: [PATCH v2 1/2] Introduce 'view' space option] Message-ID: <20180327061656.GD4581@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 ----- Forwarded message from Konstantin Osipov ----- Date: Tue, 27 Mar 2018 09:02:56 +0300 From: Konstantin Osipov To: tarantool-patches@freelists.org Cc: tarantool-patches@freelist.org, Nikita Pettik Subject: [tarantool-patches] Re: [PATCH v2 1/2] Introduce 'view' space option * Nikita Pettik [18/03/27 02:06]: > + if (opts.view && opts.sql == NULL) { > + tnt_raise(ClientError, ER_VIEW_MISSING_SQL); > + } We usually do not add {} braces around one-line if bodies. > struct space_def *def = > space_def_new_xc(id, uid, exact_field_count, name, name_len, > engine_name, engine_name_len, &opts, fields, > @@ -1590,6 +1593,10 @@ on_replace_dd_index(struct trigger * /* trigger */, void *event) > uint32_t iid = tuple_field_u32_xc(old_tuple ? old_tuple : new_tuple, > BOX_INDEX_FIELD_ID); > struct space *old_space = space_cache_find_xc(id); > + if (old_space->def->opts.view) { > + tnt_raise(ClientError, ER_ALTER_SPACE, space_name(old_space), > + "can not alter indexes on view"); > + } can not add index on a view. You know for sure it's add, since it can't be drop or modify, so let's the error message more specific. You can also introduce a separate error code for the purpose, ER_ALTER_VIEW. > const struct space_opts space_opts_default = { > /* .temporary = */ false, > + /* .view = */ false, > /* .sql = */ NULL, > }; is_view. Usually we add is_ or has_ prefix to boolean state variables. > + if (new_def->opts.view != old_def->opts.view) { > + diag_set(ClientError, ER_ALTER_SPACE, old_def->name, > + "can not transform space to view and visa versa"); > + return -1; > + } can't convert a space to a view or vice vice versa. In future, please check all error messages you add with Elena. -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.org - www.twitter.com/kostja_osipov ----- End forwarded message ----- -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.org - www.twitter.com/kostja_osipov