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

query with union all silently crashes #6069

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

query with union all silently crashes #6069

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

Comments

@monetdb-team
Copy link

Date: 2016-10-05 18:22:51 +0200
From: muesli4
To: SQL devs <>
Version: 11.23.7 (Jun2016-SP1)
CC: @njnes

Last updated: 2016-12-21 13:07:43 +0100

Comment 24461

Date: 2016-10-05 18:22:51 +0200
From: muesli4

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

The following query fails silently:

WITH t1(x) AS (
SELECT 0
FROM (values (0)) as v(x)
), t2(x) AS (
SELECT 0
FROM ( SELECT 0, 0, 0, 0, 0, 0, 0
UNION ALL
SELECT 1, 0, 0, 0, 0, 0, 0
) AS a23(x1, x2, x3, x4, x5, x6, x7)
)
SELECT 0 FROM t1, t2;

Reproducible: Always

Steps to Reproduce:

  1. Run the query.
  2. Wonder that there is no output.

Actual Results:

None.

Expected Results:

There should be a result with cardinality 2.

It seems somehow related to the projection lists within the UNION ALL: Whenever I remove one of the zeroes (or change the 1 to a 0), the expected result appears.

Revision: http://dev.monetdb.org/hg/MonetDB/rev/08b99a61d03c

Comment 24462

Date: 2016-10-05 18:23:52 +0200
From: muesli4

Created attachment 471
A reduced example showing the bug.

Attached file: bug3.sql (application/sql, 289 bytes)
Description: A reduced example showing the bug.

Comment 24480

Date: 2016-10-11 20:04:21 +0200
From: muesli4

One thing I noticed, is that it only happens, when the amount of columns doesn't match with those specified in the schema in the from clause, but only if there are more than 6 columns. The following fails:
select 0 from (select 0, 0, 0, 0, 0, 0, 0 union all select 1, 0, 0, 0, 0, 0, 0) as t(a, b, c, d, e, f, g), (values (0)) as v(x);

While this query is perfectly fine:
select 0 from (select 0, 0, 0, 0, 0, 0 union all select 1, 0, 0, 0, 0, 0) as t(a, b, c, d, e, f), (values (0)) as v(x);

This is what the log file says for the already posted snippet:

2016-10-11 19:59:19 ERR test[7024]: could not find L17.L17
2016-10-11 19:59:19 ERR test[7024]: L10.L10
2016-10-11 19:59:19 ERR test[7024]: L11.L11
2016-10-11 19:59:19 ERR test[7024]: L12.L12
2016-10-11 19:59:19 ERR test[7024]: L13.L13
2016-10-11 19:59:19 ERR test[7024]: L14.L14
2016-10-11 19:59:19 ERR test[7024]: L15.L15
2016-10-11 19:59:19 ERR test[7024]: L16.L10
2016-10-11 19:59:19 ERR test[7024]: L16.L11
2016-10-11 19:59:19 ERR test[7024]: L16.L12
2016-10-11 19:59:19 ERR test[7024]: L16.L13
2016-10-11 19:59:19 ERR test[7024]: L16.L14
2016-10-11 19:59:19 ERR test[7024]: L16.L15

Comment 24482

Date: 2016-10-12 18:57:21 +0200
From: MonetDB Mercurial Repository <>

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

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

Changeset description:

created simple fix for bug #6069, but lots of tests got new output (ie L.. changes)

Comment 24483

Date: 2016-10-12 18:59:55 +0200
From: @njnes

resolved by properly naming al expressions

Comment 24485

Date: 2016-10-12 19:02:45 +0200
From: MonetDB Mercurial Repository <>

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

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

Changeset description:

added test for bug #6069
@monetdb-team monetdb-team added bug Something isn't working normal 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 normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants