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

SIGSEGV when combining a cast/column alias with a UNION ALL view #3769

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

SIGSEGV when combining a cast/column alias with a UNION ALL view #3769

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

Comments

@monetdb-team
Copy link

Date: 2015-07-17 13:03:36 +0200
From: tim.brown
To: SQL devs <>
Version: 11.19.15 (Oct2014-SP4)
CC: martin.van.dinther, @njnes, tim.brown

Last updated: 2015-08-28 13:42:01 +0200

Comment 21020

Date: 2015-07-17 13:03:36 +0200
From: tim.brown

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36
Build Identifier:

When querying a view based on UNION ALL query, then grouping by a CASTed value in that query, the databases crashes with a SIGSEGV fault.

Reproducible: Always

Steps to Reproduce:

1.Create tables union_a and union_b including a timestamp column mytimestamp
2.CREATE VIEW union_view AS SELECT * FROM union_a UNION ALL union_b
3.SELECT COUNT(*), CAST(mytimestamp AS date) AS mydate GROUP BY mydate

Actual Results:

mclient and other tools report connection loss.
merovingian.log reports:
2015-07-17 11:47:06 MSG merovingian[44201]: database '' (44903) was killed by signal SIGSEGV

Expected Results:

Produce record set. The expected set can be obtained by running the same query against a table instead of a view.

One of the test cases here shows the same behaviour, but I cannot find it in the bug tracker:
https://www.monetdb.org/pipermail/users-list/2013-May/006347.html

Comment 21021

Date: 2015-07-17 13:11:59 +0200
From: tim.brown

Sorry, step 3 in steps to reproduce should read:

3.SELECT COUNT(*), CAST(mytimestamp AS date) AS mydate FROM union_view GROUP BY mydate

Comment 21052

Date: 2015-07-22 23:04:44 +0200
From: @njnes

It seems we are unable to reproduce this. I get an error, ie in the last query, ie
SELECT: identifier 'mytimestamp' unknown

Comment 21053

Date: 2015-07-23 10:05:09 +0200
From: tim.brown

Yes, I made a mistake in the steps to reproduce - see my first comment.

Full steps:

create table union_a (id bigint, mytimestamp timestamp);

create table union_b (id bigint, mytimestamp timestamp);

create view union_view as select * from union_a union all select * from union_b;

select count(*), cast(mytimestamp as date) as mydate from union_view group by mydate;

Comment 21059

Date: 2015-07-23 12:37:27 +0200
From: Martin van Dinther <<martin.van.dinther>>

Is reproducable in default branch. With assertions enabled it fails with assertion failure:

mserver5: ../../../dev/sql/server/rel_optimizer.c:3114: rel_push_aggr_down: Assertion `ne' failed.

Comment 21079

Date: 2015-08-01 15:18:17 +0200
From: MonetDB Mercurial Repository <>

Changeset 30d12a4105a0 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

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

Changeset description:

Bug fixes

Bug #3759 fixed types of returned bats (ie use timestamps instead of lng) in modules/mal/clients.c
Bug #3769 fixed crash (triggered assert) by properly looking for referenced groupby columns in push aggr down
optimizer in rel_optimizer.c
Bug #3760 fixed correlated subquery handling in rel_select.c, ie merge only distinct expressions.
Bug #3761 fixed by properly adding the zero_or_one aggregation only when needed (ie when the cardinality of
the outer query is a column/table, ie when we expect one value per row for the subquery).
Bug #3364 fixed in sql_privileges.c, ie allow set role when role_id == auth_id (ie default role).
Bug #3365 fixed in sql_privileges.c, the sql_grant_table_privs always added 'all' privileges in one go
	       in rel_schema.c properly pass the login_id or role_id based on the 'from current_{role/user}'
		part of the grant statement
Bug #3476 was already fixed by previous revoke / schema fixes.

in gdk/gdk_select.c fixed problem with anti select and nils (stop before first nil instead of last)

Comment 21082

Date: 2015-08-01 16:17:09 +0200
From: MonetDB Mercurial Repository <>

Changeset 4fc2c4e0adbe made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

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

Changeset description:

added test for bug #3769

Comment 21083

Date: 2015-08-01 16:17:39 +0200
From: @njnes

properly look for referenced groupby columns in push aggr down

Comment 21199

Date: 2015-08-28 13:42:01 +0200
From: @sjoerdmullender

Jul2015 has been released.

@monetdb-team monetdb-team added bug Something isn't working major SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 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 major SQL
Projects
None yet
Development

No branches or pull requests

2 participants