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

Bug in subselect #6683

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

Bug in subselect #6683

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

Comments

@monetdb-team
Copy link

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

Date: 2019-02-18 18:38:35 +0100
From: Manuel <>
To: SQL devs <>
Version: 11.29.7 (Mar2018-SP1)
CC: @njnes

Last updated: 2019-11-28 10:00:06 +0100

Comment 26893

Date: 2019-02-18 18:38:35 +0100
From: Manuel <>

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
Build Identifier:

With a table created as follows:

CREATE TABLE "sys"."unitTestDontDelete" (
"A" VARCHAR(255),
"B" BIGINT,
"C" DOUBLE,
"D" TIMESTAMP
);
INSERT INTO "sys"."unitTestDontDelete" VALUES (NULL, NULL, NULL, NULL);
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat1', 0, 0.5, '2013-06-10 11:10:10.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat2', 1, 1.5, '2013-06-11 12:11:11.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat1', 2, 2.5, '2013-06-12 13:12:12.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat2', 3, 3.5, '2013-06-13 14:13:13.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat1', 4, 4.5, '2013-06-14 15:14:14.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat2', 5, 5.5, '2013-06-15 16:15:15.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat1', 6, 6.5, '2013-06-16 17:16:16.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat2', 7, 7.5, '2013-06-17 18:17:17.000000');
INSERT INTO "sys"."unitTestDontDelete" VALUES ('Cat1', 8, 8.5, '2013-06-18 19:18:18.000000');

The query

with "c3_t" as
(
select
"c1_t"."A",
"c1_t"."B",
"c1_t"."C",
"c1_t"."D"
from
"unitTestDontDelete" as "c1_t"
)
select
(
select
sum("B")
from
"c3_t" as "c4_t"
where
(
("c4_t"."C" >= (coalesce("c3_t"."C", 0.0) + cast('0x1.0p0' as double precision)))
)
)
as "c2_f1"
from
"c3_t"

returns 10 records, which is correct, however the query (clearly equivalent to the first)

with "c3_t" as
(
select
"c1_t"."A",
"c1_t"."B",
"c1_t"."C",
"c1_t"."D"
from
"unitTestDontDelete" as "c1_t"
)
select
(
select
sum("B")
from
"c3_t" as "c4_t"
where
(
("c4_t"."C" >= (coalesce("c3_t"."C", 0.0) + cast('0x1.0p0' as double precision)))
or
( 1 = 0 )
)
)
as "c2_f1"
from
"c3_t"

returns just 9 records. This bug occurs even if the second or condition is not trivial.

Reproducible: Always

Steps to Reproduce:

  1. Import table as in Details
  2. Execute the two queries as in details

Actual Results:

Just 9 records

Expected Results:

8 records

Comment 26894

Date: 2019-02-18 18:45:58 +0100
From: Manuel <>

I meant

Expected Results:

10 records

Comment 26900

Date: 2019-02-20 16:52:36 +0100
From: MonetDB Mercurial Repository <>

Changeset 4f140644347c 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=4f140644347c

Changeset description:

Added tests for bugs 6683 and 6684.

Also bug #6424 requires the netcdf module.

Comment 26983

Date: 2019-05-01 12:58:35 +0200
From: @njnes

fixed in default, where the subquery implementation is renewed

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