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

Sqlitelogictest crash in MySQL query #6445

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

Sqlitelogictest crash in MySQL query #6445

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

Comments

@monetdb-team
Copy link

Date: 2017-10-24 17:00:39 +0200
From: @PedroTadim
To: SQL devs <>
Version: -- development
CC: @njnes

Last updated: 2017-12-14 14:46:04 +0100

Comment 25785

Date: 2017-10-24 17:00:39 +0200
From: @PedroTadim

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

I am now running Sqlitelogictest queries that are exclusive to some database systems. This query is supposed to run only on MySQL. In MonetDB I guess we are are supposed to get a compilation error or an empty result set instead of a crash.

The original query for the other database systems including MonetDB was:
SELECT col0 + - - CAST ( NULL AS REAL ) - + col0 + + col1 FROM tab1 cor0 WHERE ( NULL ) IS NOT NULL

In the MySQL version the cast is made to a DECIMAL instead of a REAL, because I guess MySQL does not support the REAL type. However I think that the MySQL version should also run in MonetDB, by casting the col0 column into a decimal.

Reproducible: Always

Steps to Reproduce:

  1. CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER);
  2. SELECT col0 + - - CAST( NULL AS DECIMAL ) - + col0 + + col1 FROM tab1 cor0 WHERE ( NULL ) IS NOT NULL;

Actual Results:

A SIGSEGV is received in a exp_is_atom call.

Expected Results:

An empty result set.

The SIGSEV:

Thread 6 "mserver5" received signal SIGSEGV, Segmentation fault.
0x00007fffe8b0a4b5 in exp_is_atom (e=0x0) at rel_exp.c:1337
1337 switch (e->type) {

Backtrace:

0 0x00007fffe8b0a4b5 in exp_is_atom (e=0x0) at rel_exp.c:1337
1 0x00007fffe8b1d51f in exp_simplify_math (sql=0x7fffb800a5f0, e=0x7fffb80baf40, changes=0x7fffcd396874) at rel_optimizer.c:2941
2 0x00007fffe8b1de61 in rel_simplify_math (changes=0x7fffcd396874, sql=0x7fffb800a5f0, rel=0x7fffb80b8630) at rel_optimizer.c:3080
3 0x00007fffe8b377e4 in rewrite (sql=0x7fffb800a5f0, rel=0x7fffb80b8630, rewriter=0x7fffe8b1dd02 <rel_simplify_math>, has_changes=0x7fffcd396938) at rel_optimizer.c:8821
4 0x00007fffe8b37816 in rewrite (sql=0x7fffb800a5f0, rel=0x7fffb80b8630, rewriter=0x7fffe8b1dd02 <rel_simplify_math>, has_changes=0x7fffcd396938) at rel_optimizer.c:8824
5 0x00007fffe8b376c1 in rewrite (sql=0x7fffb800a5f0, rel=0x7fffb80ba3b0, rewriter=0x7fffe8b1dd02 <rel_simplify_math>, has_changes=0x7fffcd396938) at rel_optimizer.c:8805
6 0x00007fffe8b37bd1 in _rel_optimizer (sql=0x7fffb800a5f0, rel=0x7fffb80ba3b0, g_changes=0x7fffcd3969c0, level=0) at rel_optimizer.c:8907
7 0x00007fffe8b3843f in rel_optimizer (sql=0x7fffb800a5f0, rel=0x7fffb80b8630) at rel_optimizer.c:9054
8 0x00007fffe8a18b85 in sql_symbol2relation (c=0x7fffb800a5f0, sym=0x7fffb80b7da0) at sql.c:121
9 0x00007fffe8a37a35 in SQLparser (c=0x7fffea11e338) at sql_scenario.c:1129
10 0x00007ffff7a15e20 in runPhase (c=0x7fffea11e338, phase=1) at mal_scenario.c:506
11 0x00007ffff7a15f64 in runScenarioBody (c=0x7fffea11e338) at mal_scenario.c:539
12 0x00007ffff7a16107 in runScenario (c=0x7fffea11e338) at mal_scenario.c:568
13 0x00007ffff7a17cbc in MSserveClient (dummy=0x7fffea11e338) at mal_session.c:473
14 0x00007ffff7a177ac in MSscheduleClient (command=0x7fffb80008d0 "0", challenge=0x7fffcd396deb "jwuMCBng4", fin=0x7fffb80028f0, fout=0x7fffc4002b70, protocol=PROTOCOL_9, blocksize=8190,
compute_column_widths=0) at mal_session.c:364
15 0x00007ffff7ab7694 in doChallenge (data=0x7fffc40008d0) at mal_mapi.c:273
16 0x00007ffff7691213 in thread_starter (arg=0x7fffc4004c60) at gdk_system.c:485
17 0x00007ffff4ca436d in start_thread () from /lib64/libpthread.so.0
18 0x00007ffff49dcbbf in clone () from /lib64/libc.so.6

Comment 25787

Date: 2017-10-24 17:11:17 +0200
From: @PedroTadim

I added the test in this commit https://dev.monetdb.org/hg/MonetDB/rev/6d5c21f423bd Sorry I misspelled the Bug number with 64455 instead of 6445.

Comment 25801

Date: 2017-10-25 11:42:21 +0200
From: @njnes

fixed (properly return old expression if optimization isn't possible)

Comment 25804

Date: 2017-10-26 07:56:37 +0200
From: MonetDB Mercurial Repository <>

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

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

Changeset description:

fixed bugs 6444, 6445
@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 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 normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants