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

Join with 2 AND-ed conditions where one is LIKE/ILIKE returns too many results #2715

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

Comments

@monetdb-team
Copy link

Date: 2010-11-05 17:48:23 +0100
From: @swingbit
To: SQL devs <>
Version: 2.40.1 (Oct2010) [obsolete]
CC: @njnes

Last updated: 2011-03-28 17:31:23 +0200

Comment 15176

Date: 2010-11-05 17:48:23 +0100
From: @swingbit

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.1.12) Gecko/20100907 Fedora/3.5.12-1.fc12 Firefox/3.5.12 GTB7.1
Build Identifier:

The following query returns too many results:

START TRANSACTION;

CREATE TABLE a(id INT, a1 string, a2 string);
INSERT INTO a VALUES (1,'kind','a1');
INSERT INTO a VALUES (2,'kind','b4');
INSERT INTO a VALUES (1,'family','xx');
INSERT INTO a VALUES (2,'family','yy');
INSERT INTO a VALUES (1,'country','EP');
INSERT INTO a VALUES (2,'country','US');

CREATE TABLE b(b1 string, b2 string);
INSERT INTO b VALUES ('country', 'EP');

SELECT *
FROM a,b
WHERE a.a1 = b.b1
AND a.a2 LIKE b.b2;

ROLLBACK;

It behaves as if the two join conditions where OR-ed, rather than AND-ed.
Notice that both join conditions return the correct result if used alone, only when AND-ed they go wrong.

Reproducible: Always

Steps to Reproduce:

1.run the provided script
2.
3.

Actual Results:

+------+---------+------+---------+------+
| id | a1 | a2 | b1 | b2 |
+======+=========+======+=========+======+
| 1 | country | EP | country | EP |
| 2 | country | US | country | EP |
+------+---------+------+---------+------+

Expected Results:

+------+---------+------+---------+------+
| id | a1 | a2 | b1 | b2 |
+======+=========+======+=========+======+
| 1 | country | EP | country | EP |
+------+---------+------+---------+------+

Comment 15185

Date: 2010-11-10 12:55:42 +0100
From: @sjoerdmullender

Changeset 9aee83da8fcf made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

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

Changeset description:

Added test for bug #2715.

Comment 15615

Date: 2011-03-28 17:31:23 +0200
From: @sjoerdmullender

The Mar2011 version has been released.

@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 Nov 9, 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