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

Crash (and assertion failure) with a correlated subquery with NOT IN in the select-list #6290

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

Comments

@monetdb-team
Copy link

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

Date: 2017-04-21 15:14:56 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.25.15 (Dec2016-SP3)

Last updated: 2017-06-12 15:21:50 +0200

Comment 25256

Date: 2017-04-21 15:14:56 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Build Identifier:

Assertion failure:
mserver5: ../../../dev/sql/server/rel_optimizer.c:8536: rel_apply_rewrite: Assertion `col' failed.

when running query:
SELECT s.name AS schema_nm, s.system AS is_system_schema
, (SELECT CAST(COUNT() as int) FROM sys.functions f WHERE f.schema_id = s.id AND f.type <> 2 AND f.id NOT IN (SELECT function_id FROM sys.systemfunctions)) AS " user defined functions"
, (SELECT CAST(COUNT(
) as int) FROM sys.functions f WHERE f.schema_id = s.id AND f.type = 2 AND f.id NOT IN (SELECT function_id FROM sys.systemfunctions)) AS " user defined procedures"
FROM sys.schemas AS s
WHERE s.name IN ('json', 'profiler', 'sys');

The problem is with the:
AND f.id NOT IN (SELECT function_id FROM sys.systemfunctions)
part. Without it the query does not crash.

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5 (MonetDB 5 server v11.25.20 with assertions enabled)
  2. Start mclient
  3. Run query:
    SELECT s.name AS schema_nm, s.system AS is_system_schema
    , (SELECT CAST(COUNT() as int) FROM sys.functions f WHERE f.schema_id = s.id AND f.type <> 2 AND f.id NOT IN (SELECT function_id FROM sys.systemfunctions)) AS " user defined functions"
    , (SELECT CAST(COUNT(
    ) as int) FROM sys.functions f WHERE f.schema_id = s.id AND f.type = 2 AND f.id NOT IN (SELECT function_id FROM sys.systemfunctions)) AS " user defined procedures"
    FROM sys.schemas AS s
    WHERE s.name IN ('json', 'profiler', 'sys');

Actual Results:

Crash of mserver5, with assertion failure.
mserver5: ../../../dev/sql/server/rel_optimizer.c:8536: rel_apply_rewrite: Assertion `col' failed.

Expected Results:

No crash and no assertion violation.

Comment 25290

Date: 2017-05-11 13:44:39 +0200
From: MonetDB Mercurial Repository <>

Changeset d46b715e0f7a made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

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

Changeset description:

Add test for Bug #6290

Comment 25291

Date: 2017-05-11 13:48:46 +0200
From: Martin van Dinther <<martin.van.dinther>>

Fix has been implemented as part of http//devmonetdborg/hg/MonetDB?cmd=changeset;node=e4578a201e15

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

Successfully merging a pull request may close this issue.

None yet
1 participant