[tarantool-patches] Re: [PATCH v2 1/1] sql: support HAVING without GROUP BY clause

Kirill Yukhin kyukhin at tarantool.org
Sat Dec 29 17:58:51 MSK 2018


Hello,

On 29 Nov 17:33, Kirill Shcherbatov wrote:
> Branch: http://github.com/tarantool/tarantool/tree/kshsh/gh-2364-having-without-groupby
> Issue: https://github.com/tarantool/tarantool/issues/2364
> 
> Allowed to make SELECT requests that have HAVING clause without
> GROUP BY. It is possible when both - left and right parts of
> request have aggregate function or constant value.
> 
> Closes #2364.
> 
> @TarantoolBot document
> Title: HAVING without GROUP BY clause
> A query with a having clause should also have a group by clause.
> If you omit group by, all the rows not excluded by the where
> clause return as a single group.
> Because no grouping is performed between the where and having
> clauses, they cannot act independently of each other. Having
> acts like where because it affects the rows in a single group
> rather than groups, except the having clause can still use
> aggregates.
> Having without group by is not supported for select from
> multiple tables.
> ---
>  src/box/sql/resolve.c         |  97 +++++++++++++++++++++++---
>  src/box/sql/sqliteInt.h       |   3 +-
>  test/sql-tap/count.test.lua   |   8 +--
>  test/sql-tap/select3.test.lua |   2 +-
>  test/sql-tap/select5.test.lua | 128 +++++++++++++++++++++++++++++++++-
>  5 files changed, 223 insertions(+), 15 deletions(-)

I've checked your patch into 2.1 branch.

--
Regards, Kirill Yukhin




More information about the Tarantool-patches mailing list