MXS-2095: Add runtime detection of unknown SQL

If the query statement is wrongly treated as a table creation statement it
could cause a crash. To handle this, unknown SQL is now reported and the
processing is stopped early. This does not solve the root cause of the
problem but makes it possible to detect it in the future.
This commit is contained in:
Markus Mäkelä
2018-10-31 13:07:03 +02:00
parent 348c86d22b
commit 7f36ec83da

View File

@ -712,6 +712,12 @@ TABLE_CREATE* table_create_alloc(const char* ident, const char* sql, int len)
const char* statement_sql = get_table_definition(sql, len, &stmt_len);
ss_dassert(statement_sql);
if (!statement_sql)
{
MXS_ERROR("Cannot process SQL: %.*s", len, sql);
return NULL;
}
char* tbl_start = strchr(ident, '.');
ss_dassert(tbl_start);
*tbl_start++ = '\0';