From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1970446971A for ; Wed, 4 Dec 2019 19:33:02 +0300 (MSK) Received: by mail-lj1-f196.google.com with SMTP id d20so8795450ljc.12 for ; Wed, 04 Dec 2019 08:33:01 -0800 (PST) Date: Wed, 4 Dec 2019 19:32:58 +0300 From: Cyrill Gorcunov Message-ID: <20191204163258.GR10140@uranus> References: <0218889f41f954a10bbe36c6d0c43f32fa7dd4b4.1575468493.git.roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0218889f41f954a10bbe36c6d0c43f32fa7dd4b4.1575468493.git.roman.habibov@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 3/3] box: let only box handle constraint dup errors List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org 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?