Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window function + group by in subselect, rel2bin_project: Assertion `0' failed #3890

monetdb-team opened this issue Nov 30, 2020 · 0 comments


Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2015-12-18 15:18:56 +0100
From: @swingbit
To: SQL devs <>
Version: 11.21.11 (Jul2015-SP1)
CC: @njnes

Last updated: 2016-03-25 09:59:57 +0100

Comment 21675

Date: 2015-12-18 15:18:56 +0100
From: @swingbit

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36
Build Identifier:

(Possibly related to

CREATE TABLE x(a1 string);
INSERT INTO x VALUES ('aa'),('bb'),('cc'),('aa');
CREATE VIEW y AS SELECT row_number() OVER(ORDER BY a1) AS a1, a1 AS a2 FROM (SELECT a1 FROM x GROUP BY a1) AS t;


2015-12-18 15:09:57 MSG trec2[17004]: could not find t.a1
2015-12-18 15:09:57 MSG trec2[17004]: x.a1
2015-12-18 15:09:57 ERR trec2[17004]: mserver5: /opt/monetdb/Jul2015_optimized/MonetDB.Spinque_Jul2015/src/sql/backends/monet5/rel_bin.c:2378: rel2bin_project: Assertion `0' failed.

The query works if I remove either the window function or the group by in the subselect.

Reproducible: Always

MonetDB 5 server v11.21.12 (64-bit, 64-bit oids, 128-bit integers)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
Visit for further information
Found 31.4GiB available memory, 8 available cpu cores
libpcre: 8.37 2015-04-28 (compiled with 8.37)
openssl: OpenSSL 1.0.1k 8 Jan 2015 (compiled with OpenSSL 1.0.1k-fips 8 Jan 2015)
libxml2: 2.9.2 (compiled with 2.9.2)
Compiled by: (x86_64-unknown-linux-gnu)
Compilation: gcc -O3 -pipe -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code -D_FORTIFY_SOURCE=2
Linking : /usr/bin/ld -m elf_x86_64

Comment 21895

Date: 2016-03-14 08:55:51 +0100
From: MonetDB Mercurial Repository <>

Changeset 98cdca21a670 made by Niels Nes in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=98cdca21a670

Changeset description:

fix bug #3890, ie incorrect rewrite of rank over expressions. 'Should not be propagated to the default branch'

Comment 21896

Date: 2016-03-14 09:02:48 +0100
From: MonetDB Mercurial Repository <>

Changeset ab01ce4fa677 made by Niels Nes in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=ab01ce4fa677

Changeset description:

add test and stable output for bug #3890

Comment 21897

Date: 2016-03-14 09:03:14 +0100
From: @njnes

fixed in 2015 branch (default has a new implementation for window functions, ie didn't have this bug)

Comment 21981

Date: 2016-03-25 09:59:57 +0100
From: @sjoerdmullender

Jul2015-SP3 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant