[Tarantool-patches] [PATCH v2 3/3] box: let only box handle constraint dup errors

Cyrill Gorcunov gorcunov at gmail.com
Wed Dec 4 19:32:58 MSK 2019


On Wed, Dec 04, 2019 at 07:23:11PM +0300, Roman Khabibov wrote:
>  
> +/**
> + * Just return string with constraint type to print it in error
> + * message.
> + */
> +static inline const char *
> +cosntraint_type_str(struct constraint_def *def) {
> +	switch (def->type) {
> +	case CONSTRAINT_TYPE_PK:
> +		return "PRIMARY KEY";
> +	case CONSTRAINT_TYPE_UNIQUE:
> +		return "UNIQUE";
> +	case CONSTRAINT_TYPE_FK:
> +		return "FOREIGN KEY";
> +	case CONSTRAINT_TYPE_CK:
> +		return "CHECK";
> +	}
> +}

Should not here be either default case or assert()? What would
be returned if someone add a new def->type and forget about
this place?


More information about the Tarantool-patches mailing list