[tarantool-patches] Re: [PATCH] sql: make GREATEST/LEAST built-ins accept at least two args

Nikita Pettik korablev at tarantool.org
Thu Aug 29 16:27:53 MSK 2019


On Thu, Aug 29, 2019 at 01:38:47PM +0300, Konstantin Osipov wrote:
> * Nikita Pettik <korablev at tarantool.org> [19/08/28 17:58]:
> > Before a46b52004 SQL implementation featured min()/max() functions
> > overloading: if one argument was passed, then aggregate version would be
> > invoked; otherwise - scalar one. We decided to get rid of it and rename
> > scalar version to LEAST()/GREATEST() correspondingly. However, assertion
> > inside their implementations has been remained: it verifies that number
> > of passed arguments is greater than 1. On the other hand, now one can
> > pass literally any number of arguments to this function, including one
> > (which results in fired mentioned assertion) and zero (which leads to
> > NULL dereference in expr.c: these functions are marked with
> > SQL_FUNC_NEEDCOLL flag, and as a consequence they are assumed to have at
> > least one argument). Firstly, let's place check that number of passed
> > arguments more than one. Secondly, let's not assume that functions with
> > SQL_FUNC_NEEDCOLL must have any arguments.
> > 
> > Closes #4453
> 
> If you introduce a new error message, why are you using it in one
> place only?

It is also used in Kirill's branch where he reworks built-ins.
I've aksed him to cherry-pick my commit. See:
https://github.com/tarantool/tarantool/commit/f8927cf3d411c88235cf532cfa3d94ee048969f2

> -- 
> Konstantin Osipov, Moscow, Russia




More information about the Tarantool-patches mailing list