From: "n.pettik" <korablev@tarantool.org> To: Konstantin Osipov <kostja@tarantool.org> Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH v2 1/2] Introduce 'view' space option Date: Tue, 27 Mar 2018 14:04:46 +0300 [thread overview] Message-ID: <715A7546-5404-4D7B-9853-8FBB5E615C41@tarantool.org> (raw) In-Reply-To: <20180327060256.GA4581@atlas> > On 27 Mar 2018, at 09:02, Konstantin Osipov <kostja@tarantool.org> wrote: > > * Nikita Pettik <korablev@tarantool.org> [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. Fixed: - if (opts.view && opts.sql == NULL) { + if (opts.is_view && opts.sql == NULL) tnt_raise(ClientError, ER_VIEW_MISSING_SQL); - } > >> 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. Fixed: - if (old_space->def->opts.view) { + if (old_space->def->opts.is_view) { tnt_raise(ClientError, ER_ALTER_SPACE, space_name(old_space), - "can not alter indexes on view"); + "can not add index on a 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. But field ’temporary’ in the same struct isn’t called ‘is_temporary’, so I just didn’t want to outline this field. Anyway, renamed to ‘is_view’. > >> + 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. > Fixed: - if (new_def->opts.view != old_def->opts.view) { + if (new_def->opts.is_view != old_def->opts.is_view) { diag_set(ClientError, ER_ALTER_SPACE, old_def->name, - "can not transform space to view and visa versa"); + "can not convert a space to a view and vice versa");
next prev parent reply other threads:[~2018-03-27 11:04 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-26 23:03 [tarantool-patches] [PATCH v2 0/2] " Nikita Pettik 2018-03-26 23:03 ` [tarantool-patches] [PATCH v2 1/2] " Nikita Pettik 2018-03-27 6:02 ` [tarantool-patches] " Konstantin Osipov 2018-03-27 11:04 ` n.pettik [this message] 2018-03-26 23:03 ` [tarantool-patches] [PATCH v2 2/2] sql: use 'view' opts from space Nikita Pettik 2018-03-27 6:04 ` [tarantool-patches] " Konstantin Osipov 2018-03-27 11:05 ` n.pettik 2018-03-27 11:35 ` [tarantool-patches] Re: [PATCH v2 0/2] Introduce 'view' space option v.shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=715A7546-5404-4D7B-9853-8FBB5E615C41@tarantool.org \ --to=korablev@tarantool.org \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v2 1/2] Introduce '\''view'\'' space option' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox