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

Sqlitelogictest crash on aggregation with having statement #6553

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

Sqlitelogictest crash on aggregation with having statement #6553

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working minor SQL

Comments

@monetdb-team
Copy link

Date: 2018-03-12 10:30:27 +0100
From: @PedroTadim
To: SQL devs <>
Version: -- development
CC: @njnes

Last updated: 2018-03-29 15:39:20 +0200

Comment 26252

Date: 2018-03-12 10:30:27 +0100
From: @PedroTadim

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

Infinite recursion happens in mserver in rel_reset_subquery call, leading to a stack overflow while optimizing the query bellow.

Reproducible: Always

Steps to Reproduce:

  1. CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER);
  2. INSERT INTO tab1 VALUES(22,6,8), (28,57,45), (82,44,71);
  3. SELECT DISTINCT + cor0.col1 / cor0.col1 col2 FROM tab1 AS cor0 GROUP BY col1 HAVING NOT NULL IN ( - col1 * cor0.col1 );

Actual Results:

Infinite recursion in rel_reset_subquery.

Expected Results:

An empty result set.

Backtrace:

0 0x00007fffe843ad85 in rel_reset_subquery (rel=0x7fffb4254950) at rel_optimizer.c:9281
1 0x00007fffe843ad8a in rel_reset_subquery (rel=0x7fffb4254950) at rel_optimizer.c:9281
2 0x00007fffe843ad8a in rel_reset_subquery (rel=0x7fffb4254950) at rel_optimizer.c:9281
.....

Comment 26254

Date: 2018-03-12 10:35:16 +0100
From: MonetDB Mercurial Repository <>

Changeset 5100acc0528d made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=5100acc0528d

Changeset description:

Added tests for bugs 6552 and 6553

Comment 26255

Date: 2018-03-13 10:13:40 +0100
From: @sjoerdmullender

The problem is that rel==rel->l so when rel_reset_subquery calls itself recursively on rel->l, it just repeats infinitely.

The assignment where rel->l is assigned the value rel is in rel_logical_value_exp where it says
if (outer)
outer->l = z;
because at this point, outer == *rel, left == *rel, and hence z == *rel (this is a different rel, *rel here is the same as the rel above).

Comment 26257

Date: 2018-03-14 10:03:52 +0100
From: MonetDB Mercurial Repository <>

Changeset 8c9f8c70fb25 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=8c9f8c70fb25

Changeset description:

fixed bugs 6552 and 6553, by more defensive code

Comment 26258

Date: 2018-03-14 10:04:05 +0100
From: @njnes

fixed crash

Comment 26319

Date: 2018-03-29 15:39:20 +0200
From: @sjoerdmullender

The Mar2018 version has been released.

@monetdb-team monetdb-team added bug Something isn't working minor SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor SQL
Projects
None yet
Development

No branches or pull requests

2 participants