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 45761229AF for ; Thu, 25 Jul 2019 18:09:57 -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 FsMkGMRppgam for ; Thu, 25 Jul 2019 18:09:57 -0400 (EDT) Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (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 06A40227D1 for ; Thu, 25 Jul 2019 18:09:56 -0400 (EDT) Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1hqlvv-0005kf-6w for tarantool-patches@freelists.org; Fri, 26 Jul 2019 01:09:55 +0300 Subject: [tarantool-patches] Re: [PATCH 4/5] sql: make built-ins raise errors for varbin args References: <61adf9b0d2ce82a927f318c386dd0a004eb3ca45.1563967510.git.korablev@tarantool.org> From: Vladislav Shpilevoy Message-ID: <5bb71271-27ea-423b-ed27-634ba7a2c132@tarantool.org> Date: Fri, 26 Jul 2019 00:11:53 +0200 MIME-Version: 1.0 In-Reply-To: <61adf9b0d2ce82a927f318c386dd0a004eb3ca45.1563967510.git.korablev@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 24/07/2019 13:42, Nikita Pettik wrote: > Since values of type 'varbinary' can't be cast to any other type, let's > patch built-in functions which are not assumed to accept arguments of > this type to raise an error in case argument turn out to be of type > varbinary. > > Part of #4206 > --- > src/box/sql/func.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 4ec591eee..5fd1496fd 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -506,6 +507,12 @@ roundFunc(sql_context * context, int argc, sql_value ** argv) > } > if (sql_value_is_null(argv[0])) > return; > + if (sql_value_type(argv[0]) == MP_BIN) { > + diag_set(ClientError, ER_SQL_TYPE_MISMATCH, The patch is ok, but now I see, that we allow 'string' values to functions, taking numbers, such as round(). Is it ok?