Bug 6524 - Sqlitelogictest: Crash in aggregation query with IN operator
Summary: Sqlitelogictest: Crash in aggregation query with IN operator
Status: RESOLVED FIXED
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: -- development
Hardware: x86_64 (amd64/em64t) Linux
: Normal normal
Assignee: SQL devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-25 13:32 CET by pedrotadim
Modified: 2018-02-14 10:20 CET (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pedrotadim 2018-01-25 13:32:42 CET
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Build Identifier: 

Mserver gets an assertion error on default branch in rel_bin.c while compiling the query bellow.

Reproducible: Always

Steps to Reproduce:
1. CREATE TABLE tab2(col0 INTEGER, col1 INTEGER, col2 INTEGER);
2. INSERT INTO tab2 VALUES (15,61,87), (91,59,79), (92,41,58);
3. SELECT ALL - col0 AS col1 FROM tab2 AS cor0 GROUP BY col0 HAVING - COUNT ( * ) NOT IN ( - COUNT ( * ), 88, COUNT ( * ) );
Actual Results:  
An assertion error (in default branch):
mserver5: rel_bin.c:575: exp_bin: Assertion `s' failed.

Expected Results:  
An empty result set.

Backtrace:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff4748381 in __GI_abort () at abort.c:79
#2  0x00007ffff473e8fa in __assert_fail_base (fmt=0x7ffff48b9c28 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fffe84ccd48 "s", file=file@entry=0x7fffe84cccd8 "rel_bin.c", 
    line=line@entry=575, function=function@entry=0x7fffe84cd428 <__PRETTY_FUNCTION__.15580> "exp_bin") at assert.c:92
#3  0x00007ffff473e972 in __GI___assert_fail (assertion=0x7fffe84ccd48 "s", file=0x7fffe84cccd8 "rel_bin.c", line=575, function=0x7fffe84cd428 <__PRETTY_FUNCTION__.15580> "exp_bin") at assert.c:101
#4  0x00007fffe83598d9 in exp_bin (be=0x7fffb4002b60, e=0x7fffb40f2690, left=0x7fffb40e3060, right=0x7fffb40e4a90, grp=0x0, ext=0x0, cnt=0x0, sel=0x0) at rel_bin.c:575
#5  0x00007fffe8362bce in rel2bin_project (be=0x7fffb4002b60, rel=0x7fffb40f27c0, refs=0x7fffb40e1940, topn=0x0) at rel_bin.c:2479
#6  0x00007fffe836d9db in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40f27c0, refs=0x7fffb40e1940) at rel_bin.c:4856
#7  0x00007fffe8362afb in rel2bin_project (be=0x7fffb4002b60, rel=0x7fffb40fdb20, refs=0x7fffb40e1940, topn=0x0) at rel_bin.c:2467
#8  0x00007fffe836d9db in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40fdb20, refs=0x7fffb40e1940) at rel_bin.c:4856
#9  0x00007fffe83612bd in rel2bin_union (be=0x7fffb4002b60, rel=0x7fffb40fb4d0, refs=0x7fffb40e1940) at rel_bin.c:2158
#10 0x00007fffe836d94f in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40fb4d0, refs=0x7fffb40e1940) at rel_bin.c:4844
#11 0x00007fffe83602ee in rel2bin_semijoin (be=0x7fffb4002b60, rel=0x7fffb40f2fb0, refs=0x7fffb40e1940) at rel_bin.c:1937
#12 0x00007fffe836d921 in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40f2fb0, refs=0x7fffb40e1940) at rel_bin.c:4840
#13 0x00007fffe8362afb in rel2bin_project (be=0x7fffb4002b60, rel=0x7fffb40ef790, refs=0x7fffb40e1940, topn=0x0) at rel_bin.c:2467
#14 0x00007fffe836d9db in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40ef790, refs=0x7fffb40e1940) at rel_bin.c:4856
#15 0x00007fffe8362afb in rel2bin_project (be=0x7fffb4002b60, rel=0x7fffb40f6840, refs=0x7fffb40e1940, topn=0x0) at rel_bin.c:2467
#16 0x00007fffe836d9db in subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40f6840, refs=0x7fffb40e1940) at rel_bin.c:4856
#17 0x00007fffe836dc83 in _subrel_bin (be=0x7fffb4002b60, rel=0x7fffb40f6840, refs=0x7fffb40e1940) at rel_bin.c:4913
#18 0x00007fffe836dd9b in output_rel_bin (be=0x7fffb4002b60, rel=0x7fffb40f6840) at rel_bin.c:4936
#19 0x00007fffe838a23a in sql_relation2stmt (be=0x7fffb4002b60, r=0x7fffb40f6840) at sql_gencode.c:532
#20 0x00007fffe838a42d in backend_dumpstmt (be=0x7fffb4002b60, mb=0x7fffb4101220, r=0x7fffb40f6840, top=1, add_end=1, 
    query=0x7fffb40feb30 "select all - col0 as col1 from tab2 as cor0 group by col0 having - count ( * ) not in ( - count ( * ), 88, count ( * ) );") at sql_gencode.c:572
#21 0x00007fffe838aca5 in backend_dumpproc (be=0x7fffb4002b60, c=0x7fffe970e368, cq=0x7fffb4105a00, r=0x7fffb40f6840) at sql_gencode.c:702
#22 0x00007fffe834db01 in SQLparser (c=0x7fffe970e368) at sql_scenario.c:1226
#23 0x00007ffff7a0c9e1 in runPhase (c=0x7fffe970e368, phase=1) at mal_scenario.c:510
#24 0x00007ffff7a0caea in runScenarioBody (c=0x7fffe970e368, once=0) at mal_scenario.c:532
#25 0x00007ffff7a0cda3 in runScenario (c=0x7fffe970e368, once=0) at mal_scenario.c:569
#26 0x00007ffff7a0ecde in MSserveClient (dummy=0x7fffe970e368) at mal_session.c:514
#27 0x00007ffff7a0e82d in MSscheduleClient (command=0x7fffb4000b30 "0", challenge=0x7fffcb3b3d9b "ffre5Z6IKuY", fin=0x17fc360, fout=0x7fffc4002d90, protocol=PROTOCOL_9, blocksize=8190, compute_column_widths=0)
    at mal_session.c:397
#28 0x00007ffff7aae527 in doChallenge (data=0x17fc370) at mal_mapi.c:273
#29 0x00007ffff7694515 in thread_starter (arg=0x7fffc4004e80) at gdk_system.c:475
#30 0x00007ffff4af961b in start_thread (arg=0x7fffcb3b4700) at pthread_create.c:465
#31 0x00007ffff482698f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 1 MonetDB Mercurial Repository cwiconfidential 2018-01-25 13:46:45 CET
Changeset d1c6e7340c11, made by Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> in the MonetDB repo, refers to this bug.

For complete details, see https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d1c6e7340c11

Changeset description:

	Added test for bug 6524 (it only crashes on default branch)
Comment 2 MonetDB Mercurial Repository cwiconfidential 2018-01-31 18:29:44 CET
Changeset c8b7cdf0221a, made by Niels Nes <niels@cwi.nl> in the MonetDB repo, refers to this bug.

For complete details, see https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8b7cdf0221a

Changeset description:

	fix crash because of reused (later renamed) expression, bug 6524
Comment 3 Niels Nes cwiconfidential 2018-01-31 18:30:47 CET
crash was caused by a reused expression (we now create a reference expression)
Comment 4 MonetDB Mercurial Repository cwiconfidential 2018-02-06 17:50:08 CET
Changeset 63141e9bb22d, made by Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> in the MonetDB repo, refers to this bug.

For complete details, see https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=63141e9bb22d

Changeset description:

	Approve test for bug 6524
Comment 5 MonetDB Mercurial Repository cwiconfidential 2018-02-14 10:20:34 CET
Changeset 9ecef945b19a, made by Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> in the MonetDB repo, refers to this bug.

For complete details, see https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9ecef945b19a

Changeset description:

	Approve test for bug 6524 (not done on Mar2018 branch)