[Tarantool-patches] [PATCH 1/1] Add test and changelog for issue gh-5890

Mergen Imeev imeevma at tarantool.org
Fri Apr 16 13:59:14 MSK 2021


Sorry, I didn't include links to issue and branch in original letter.

https://github.com/tarantool/tarantool/issues/5890
https://github.com/tarantool/tarantool/tree/imeevma/gh-5890-changelog-and-test

On Fri, Apr 16, 2021 at 01:56:40PM +0300, Mergen Imeev via Tarantool-patches wrote:
> ---
>  ...fix-wrong-result-on-select-with-groupby.md |  4 +++
>  ...gh-5890-wrong-select-with-groupby.test.lua | 28 +++++++++++++++++++
>  2 files changed, 32 insertions(+)
>  create mode 100644 changelogs/unreleased/fix-wrong-result-on-select-with-groupby.md
>  create mode 100755 test/sql-tap/gh-5890-wrong-select-with-groupby.test.lua
> 
> diff --git a/changelogs/unreleased/fix-wrong-result-on-select-with-groupby.md b/changelogs/unreleased/fix-wrong-result-on-select-with-groupby.md
> new file mode 100644
> index 000000000..1ed39ccce
> --- /dev/null
> +++ b/changelogs/unreleased/fix-wrong-result-on-select-with-groupby.md
> @@ -0,0 +1,4 @@
> +## bugfix/sql
> +
> +* Fix wrong result of SELECT with GROUP BY in case one of selected values is
> +  VARBINARY, which is not directly obtained from a space (gh-5890).
> diff --git a/test/sql-tap/gh-5890-wrong-select-with-groupby.test.lua b/test/sql-tap/gh-5890-wrong-select-with-groupby.test.lua
> new file mode 100755
> index 000000000..2b7e19862
> --- /dev/null
> +++ b/test/sql-tap/gh-5890-wrong-select-with-groupby.test.lua
> @@ -0,0 +1,28 @@
> +#!/usr/bin/env tarantool
> +local test = require("sqltester")
> +test:plan(2)
> +
> +--
> +-- Make sure the SELECT result does not change if GROUP BY is used in case one of
> +-- selected values is also used in GROUP BY and is a VARBINARY that is not
> +-- directly received from space.
> +--
> +test:do_execsql_test(
> +    "gh-5890-1",
> +    [[
> +        CREATE TABLE t(i INT PRIMARY KEY, v VARBINARY);
> +        INSERT INTO t VALUES(1, x'6178'), (2, x'6278'), (3, x'6379');
> +        SELECT count(*), substr(v,2,1) AS m FROM t GROUP BY m;
> +    ]], {
> +        2, 'x', 1, 'y'
> +    })
> +
> +test:do_execsql_test(
> +    "gh-5890-2",
> +    [[
> +        SELECT count(*), v || v AS m FROM t GROUP BY m;
> +    ]], {
> +        1, 'axax', 1, 'bxbx', 1, 'cycy'
> +    })
> +
> +test:finish_test()
> -- 
> 2.25.1
> 


More information about the Tarantool-patches mailing list