Skip to content

Commit

Permalink
MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT …
Browse files Browse the repository at this point in the history
…clause
  • Loading branch information
Alexander Barkov committed Sep 13, 2017
1 parent dc82f70 commit 250ca1c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions mysql-test/r/default.result
Original file line number Diff line number Diff line change
Expand Up @@ -3381,4 +3381,11 @@ create table t1 (col1 int default(-(default(col1))));
ERROR 01000: Expression for field `col1` is refering to uninitialized field `col1`
create table t1 (col int default (yearweek((exp(710)))));
ERROR 22003: DOUBLE value is out of range in 'exp(710)'
#
# MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT clause
#
CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1;
# end of 10.2 test
10 changes: 10 additions & 0 deletions mysql-test/t/default.test
Original file line number Diff line number Diff line change
Expand Up @@ -2095,4 +2095,14 @@ create table t1 (col1 int default(-(default(col1))));
--error ER_DATA_OUT_OF_RANGE
create table t1 (col int default (yearweek((exp(710)))));

--echo #
--echo # MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT clause
--echo #

CREATE OR REPLACE TABLE t1(i int);
--error ER_BAD_FIELD_ERROR
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1;


--echo # end of 10.2 test
4 changes: 2 additions & 2 deletions sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1446,9 +1446,9 @@ static inline
void mark_unsupported_func(const char *where, const char *processor_name)
{
char buff[64];
sprintf(buff, "%s::%s", where ? where: "", processor_name);
my_snprintf(buff, sizeof(buff), "%s::%s", where ? where: "", processor_name);
DBUG_ENTER(buff);
sprintf(buff, "%s returns TRUE: unsupported function", processor_name);
my_snprintf(buff, sizeof(buff), "%s returns TRUE: unsupported function", processor_name);
DBUG_PRINT("info", ("%s", buff));
DBUG_VOID_RETURN;
}
Expand Down

0 comments on commit 250ca1c

Please sign in to comment.