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

SQL: ALTER TABLE with incorrect syntax crashes mserver5 #2795

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

SQL: ALTER TABLE with incorrect syntax crashes mserver5 #2795

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

Comments

@monetdb-team
Copy link

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

Date: 2011-03-31 14:44:02 +0200
From: @yzchang
To: SQL devs <>
Version: 11.1.1 (Mar2011) [obsolete]
CC: @njnes

Last updated: 2011-04-28 16:25:39 +0200

Comment 15711

Date: 2011-03-31 14:44:02 +0200
From: @yzchang

The following queries crashes mserver5 (both in Mar2011 and in default):

sql>CREATE TABLE t3 (x INTEGER, y INTEGER);
operation successful
sql>alter table t3 add r float default sqrt(power(t3.x, 2) + power(t3.y, 2));
MAPI = monetdb@localhost:60000
ACTION= read_line
QUERY = alter table t3 add r float default sqrt(power(t3.x, 2) + power(t3.y, 2));
ERROR = !Connection terminated

GDB says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7bab700 (LWP 26196)]
0x00007fffe8e0a593 in rel_parse_val (m=0x7fffd8005468,
query=0x7fffd806d868 "select sqrt(sql_add(power((null),2),power((null),2)));\n", emode=0 '\000') at /ufs/zhang/monet/default/sql/server/rel_subquery.c:402
402 if (m->sym->token == SQL_SELECT) {

If I understand the SQL:2003 grammar correctly (http://savage.net.au/SQL/sql-2003-2.bnf.html), such an expression is not allowed in de DEFAULT clause. But it is not rejected by the SQL parser.

Comment 15719

Date: 2011-04-05 12:35:15 +0200
From: @njnes

Changeset 3e42e98ee928 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=3e42e98ee928

Changeset description:

fixed bug #2795. The case that parsing the 'default' expression
fails is now properly handled.

Comment 15720

Date: 2011-04-05 12:36:20 +0200
From: @njnes

added test to BugTracker-2011/alter_incorrect_syntax_crash.Bug-2795.sql

Fixed bug by handling the failed parsing of the default expression.

Comment 15755

Date: 2011-04-28 16:25:39 +0200
From: @sjoerdmullender

The Apr2011 release has been uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant