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

Semijoin returns duplicate values from a column with unique values #6488

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

Semijoin returns duplicate values from a column with unique values #6488

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


Copy link

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

Date: 2017-12-08 15:22:46 +0100
From: @swingbit
To: SQL devs <>
Version: 11.27.9 (Jul2017-SP2)

Last updated: 2018-02-12 16:12:05 +0100

Comment 25971

Date: 2017-12-08 15:22:46 +0100
From: @swingbit

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

-- Just to be sure we can't blame mitosis
set optimizer='sequential_pipe';

-- Sequence of integers from 1 to 2050
create table dict as
select value from generate_series(cast(1 as int), cast(2050 as int))
with data;

create table t (i int);
insert into t values (2),(2);

-- This should return 1 tuple, with value 2
select * from dict where value in (select i from t);

| value |
| 2 |
| 2 |
2 tuples (1.443ms)

Obviously (for how it was created) dict contains only one 2:

select * from dict where value = 2;

| value |
| 2 |
1 tuple (1.443ms)

Interesting notes:

  • If I generate the sequence with 2049 integers or less, I get the correct result
  • The problem is not in how the sequence is generated. The error popped up in a different way.

Reproducible: Always

$ mserver5 --ver
MonetDB 5 server v11.27.10 (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
Visit for further information
Found 15.6GiB available memory, 8 available cpu cores
libpcre: 8.41 2017-07-05 (compiled with 8.41)
openssl: OpenSSL 1.1.0g 2 Nov 2017 (compiled with OpenSSL 1.1.0g-fips 2 Nov 2017)
libxml2: 2.9.4 (compiled with 2.9.4)
Compiled by: (x86_64-unknown-linux-gnu)
Compilation: gcc -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wrestrict -Wnested-externs -Wunreachable-code
Linking : /usr/bin/ld -m elf_x86_64

Comment 25974

Date: 2017-12-08 16:16:44 +0100
From: MonetDB Mercurial Repository <>

Changeset 6af80c755cc6 made by Sjoerd Mullender in the MonetDB repo, refers to this bug.

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

Changeset description:

Don't use fetchjoin implementation for semijoin.
This fixes bug #6488.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant