[Tarantool-patches] [PATCH] sql: allow nil to be returned from UDF

Nikita Pettik korablev at tarantool.org
Wed Dec 25 03:40:12 MSK 2019


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.



More information about the Tarantool-patches mailing list