From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2C37146970E for ; Wed, 25 Dec 2019 03:40:13 +0300 (MSK) Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1ijuii-0005hj-E8 for tarantool-patches@dev.tarantool.org; Wed, 25 Dec 2019 03:40:12 +0300 Date: Wed, 25 Dec 2019 03:40:12 +0300 From: Nikita Pettik Message-ID: <20191225004012.GB18639@tarantool.org> References: <6ff37ee003c8278c1676e72277c4033dae3e0871.1576692754.git.korablev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6ff37ee003c8278c1676e72277c4033dae3e0871.1576692754.git.korablev@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] sql: allow nil to be returned from UDF List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org On 18 Dec 21:27, Nikita Pettik wrote: > Any user defined function features assumed type of returned value > (if it is not set explicitly during UDF creation, then it is ANY). > After function's invocation in SQL, type of returned value is checked to > be compatible with mentioned type of returned value specified in > function's definition. It is done by means of > field_mp_plain_type_is_compatible(). This functions accepts > 'is_nullable' arguments which indicates whether value can be nullable or > not. For some reason 'is_nullable' is set to 'false' in our particular > case. Hence, nils can't be returned from UDF for SCALAR types. > > Since there's no reason why nils can't be returned from UDFs, > let's fix this unfortunate bug. > --- > Branch: https://github.com/tarantool/tarantool/tree/np/fix-sql-func-ret-nullability > > src/box/sql/vdbe.c | 2 +- > test/sql-tap/func.test.lua | 36 ++++++++++++++++++------------------ > 2 files changed, 19 insertions(+), 19 deletions(-) Pushed to master as obvious.