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

Assertion error in sql_ref_dec (sqlsmith) #6451

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

Assertion error in sql_ref_dec (sqlsmith) #6451

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


Copy link

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

Date: 2017-10-27 09:43:51 +0200
From: @mlkersten
To: SQL devs <>
Version: -- development
CC: @njnes

Last updated: 2017-12-14 14:45:59 +0100

Comment 25813

Date: 2017-10-27 09:43:51 +0200
From: @mlkersten

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

4 0x00007f7b0bc80699 in sql_ref_dec (r=0x7f7ad4172210)
at /export/scratch1/home/mk/default//package/sql/common/sql_mem.c:29
5 0x00007f7b0bbec4a3 in rel_destroy (rel=0x7f7ad4172210)
at /export/scratch1/home/mk/default//package/sql/server/rel_rel.c:77
6 0x00007f7b0bbec39a in rel_destroy_ (rel=0x7f7ad4176860)
at /export/scratch1/home/mk/default//package/sql/server/rel_rel.c:60
7 0x00007f7b0bbec4b3 in rel_destroy (rel=0x7f7ad4176860)
at /export/scratch1/home/mk/default//package/sql/server/rel_rel.c:79
8 0x00007f7b0bbcff07 in rel_joinquery_ (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
tab1=0x7f7ad416d970, natural=0, jointype=jt_left, tab2=0x7f7ad416ea00,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5325
9 0x00007f7b0bbd07e6 in rel_joinquery (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5439
10 0x00007f7b0bbb7ee5 in query_exp_optname (sql=0x7f7ad410d640, r=0x7f7ad4172210,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:340
11 0x00007f7b0bbbb30e in table_ref (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
tableref=0x7f7ad416edc0, lateral=0)
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:945
12 0x00007f7b0bbcfce4 in rel_joinquery_ (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
tab1=0x7f7ad416edc0, natural=0, jointype=jt_right, tab2=0x7f7ad416ef70,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5305
13 0x00007f7b0bbd07e6 in rel_joinquery (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5439
14 0x00007f7b0bbb7ee5 in query_exp_optname (sql=0x7f7ad410d640, r=0x7f7ad4172210,
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:340
15 0x00007f7b0bbbb30e in table_ref (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
tableref=0x7f7ad416f240, lateral=0)
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:945
16 0x00007f7b0bbcf0f1 in rel_query (sql=0x7f7ad410d640, rel=0x7f7ad4172210,
sq=0x7f7ad416f440, toplevel=0, ek=..., apply=32)
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5117
17 0x00007f7b0bbd0c00 in rel_subquery (sql=0x7f7ad410d640, rel=0x7f7ad4171050,
sq=0x7f7ad416f440, ek=..., apply=32)
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:5518
18 0x00007f7b0bbc3755 in rel_logical_exp (sql=0x7f7ad410d640, rel=0x7f7ad4171050,
sc=0x7f7ad416f4c0, f=1)
at /export/scratch1/home/mk/default//package/sql/server/rel_select.c:2723
19 0x00007f7b0bbce042 in rel_select_exp (sql=0x7f7ad410d640, rel=0x7f7ad4171050,
sn=0x7f7ad416f580, ek=...)

Reproducible: Always

Steps to Reproduce:

ref_2.y as c0,
ref_2.z) as clob) as c1,
ref_2.z as c2,
case when ref_2.y is NULL then subq_0.c0 else subq_0.c0 end
as c3,
ref_2.y as c4,
ref_2.z) as clob) as c5,
ref_2.x as c6
sys.r2 as ref_2,
lateral (select
ref_2.z as c0
sys.netcdf_vardim as ref_3
where ref_3.dim_id is NULL) as subq_0
where EXISTS (
case when false then ref_9.z else ref_9.z end
as c0,
subq_2.c5 as c1,
subq_0.c0 as c2,
ref_2.z as c3,
subq_2.c5 as c4
ref_2.y as c0,
ref_4.type as c1,
subq_0.c0 as c2,
ref_2.y as c3
sys.keys as ref_4
where ref_2.z is NULL) as subq_1
left join (select
ref_5.gr_name as c0,
ref_5.att_name as c1,
ref_2.z as c2,
subq_0.c0 as c3,
44 as c4,
subq_0.c0 as c5,
ref_2.y as c6,
ref_2.x as c7,
ref_2.y as c8
sys.netcdf_attrs as ref_5
where false) as subq_2
on (subq_1.c2 = subq_2.c2 )
right join sys.r as ref_9
on (subq_2.c4 = ref_9.x )
where ref_9.x is not NULL)
limit 64;

Comment 25828

Date: 2017-11-01 12:28:40 +0100
From: @njnes

fixed naming of subqueries with correlated parts (ie don't rename the correlated partes).

Comment 25829

Date: 2017-11-01 16:14:54 +0100
From: MonetDB Mercurial Repository <>

Changeset 860ca030d222 made by Niels Nes in the MonetDB repo, refers to this bug.

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

Changeset description:

fixes for bugs 6451, 6453 and 6455

fixed bug in apply expression name conflict resolution

fixed naming of relations with correlations

also added tests and stable output
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