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

GROUP BY-subquery crashes MonetDb #7180

Closed
jniewerth opened this issue Sep 29, 2021 · 2 comments
Closed

GROUP BY-subquery crashes MonetDb #7180

jniewerth opened this issue Sep 29, 2021 · 2 comments
Labels
bug
Milestone

Comments

@jniewerth
Copy link

@jniewerth jniewerth commented Sep 29, 2021

Describe the bug
In a query that has a subquery with a GROUP BY-clause in the FROM clause MonetDB server crashes when having another correlated subquery in the SELECT clause.

To Reproduce

root@dd2a1e8e05d4:~# mclient testdb
Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
Database: MonetDB v11.39.18 (hg id: d0fc592188), 'mapi:monetdb://dd2a1e8e05d4:50000/testdb'
FOLLOW US on https://twitter.com/MonetDB or https://github.com/MonetDB/MonetDB
Type \q to quit, \? for a list of available commands
auto commit mode: on
sql>CREATE TABLE table1 (a bigint);
operation successful
sql>CREATE TABLE table2 (a bigint);
operation successful
sql>SELECT (SELECT max(1) FROM table2 WHERE a=tmp.a) FROM (SELECT a FROM table1 GROUP BY a) tmp;
sql>
write error on stream
2021-09-29 16:43:03 ERR testdb[381]: mserver5: /home/niewerth/git/MonetDB/sql/server/sql_query.c:105: query_outer_used_exp: Assertion `(!is_sql_aggr(f) && sq->grouped == 0 && e->card != CARD_AGGR) || (!is_sql_aggr(f) && sq->grouped == 1 && e->card <= CARD_AGGR) || (is_sql_aggr(f) && !is_sql_farg(f) && !sq->grouped && e->card != CARD_AGGR) || (is_sql_aggr(f) && !is_sql_farg(f) && sq->grouped && e->card != CARD_AGGR) || (is_sql_aggr(f) && is_sql_farg(f) && sq->grouped && e->card <= CARD_AGGR) || (is_sql_aggr(f) && sq->grouped && e->card <= CARD_AGGR)' failed.
2021-09-29 16:43:07 MSG merovingian[34]: database 'testdb' (-1) has crashed with signal SIGABRT (dumped core)

Expected behavior
MonetDB does not crash

Screenshots
If applicable, add screenshots to help explain your problem.

Software versions

  • MonetDB version number v11.39.18
  • OS and version: Ubuntu 20.04
  • self-compiled
@sjoerdmullender
Copy link
Member

@sjoerdmullender sjoerdmullender commented Sep 29, 2021

Assertion in query_outer_used_exp goes off.
Problem is, this is true: !is_sql_aggr(f) && sq->grouped == 0 && e->card == CARD_AGGR which is almost the first part of the assert, except for the == vs. != at the end.

monetdb-team pushed a commit that referenced this issue Oct 15, 2021
@PedroTadim PedroTadim added the bug label Oct 18, 2021
@PedroTadim PedroTadim added this to the NEXTFEATURERELEASE milestone Oct 18, 2021
@PedroTadim
Copy link
Contributor

@PedroTadim PedroTadim commented Oct 18, 2021

This was fixed on the default branch today and it will be available on the next feature release.

@sjoerdmullender sjoerdmullender removed this from the NEXTFEATURERELEASE milestone Jan 24, 2022
@sjoerdmullender sjoerdmullender added this to the Jan2022 milestone Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug
Projects
None yet
Development

No branches or pull requests

3 participants