[Tarantool-patches] [PATCH v4 5/6] box: disallow to modify format of a view

Nikita Pettik korablev at tarantool.org
Wed Sep 16 16:37:28 MSK 2020


On 12 Sep 00:51, Roman Khabibov wrote:
> Disallow to modify format and field_count of a view.

Please add rationale
 
> Needed for #3075
> ---
>  src/box/alter.cc                          |  8 ++++
>  test/box/view-dont-modify-format.result   | 51 +++++++++++++++++++++++
>  test/box/view-dont-modify-format.test.lua | 18 ++++++++
>  3 files changed, 77 insertions(+)
>  create mode 100644 test/box/view-dont-modify-format.result
>  create mode 100644 test/box/view-dont-modify-format.test.lua
> 
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index ba96d9c62..3bfbb690a 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -2441,6 +2441,14 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
>  				  "view");
>  			return -1;
>  		}
> +		if (def->opts.is_view && (def->field_count !=
> +		    old_space->def->field_count)) {
> +			diag_set(ClientError, ER_ALTER_SPACE,
> +				  space_name(old_space),
> +				  "can not modify format or field_count of a "

field_count -> field count

What if field count count is the same, but we modify column's type?

> +				  "view");
> +			return -1;
> +		}
>  		/*
>  		 * Allow change of space properties, but do it
>  		 * in WAL-error-safe mode.
> diff --git a/test/box/view-dont-modify-format.result b/test/box/view-dont-modify-format.result
> new file mode 100644
> index 000000000..c130db49c
> --- /dev/null
> +++ b/test/box/view-dont-modify-format.result

Why not put the test case into sql/view.test.lua?



More information about the Tarantool-patches mailing list