summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-06-25 19:19:10 -0700
committerIgor Babaev <igor@askmonty.org>2018-06-26 00:02:48 -0700
commit7d0d934ca642e485b2c008727dc20c83e26cce10 (patch)
tree603a28d8a223528a76309fbfc19fe79dc7bcd41b /sql/sql_lex.h
parent31e52b163206c9dc9f4c3542d07e0b64b33dade5 (diff)
downloadmariadb-git-7d0d934ca642e485b2c008727dc20c83e26cce10.tar.gz
MDEV-16473 WITH statement throws 'no database selected' error
Before this patch if no default database was set the server threw an error for any table name reference that was not fully qualified by database name. In particular it happened for table names referenced CTE tables. This was incorrect. The error message was thrown at the parser stage when the names referencing different tables were not resolved yet. Now if no default database is set and a with clause is used in the processed statement any table reference is just supplied with a dummy database name "*none*" at the parser stage. Later after a call of check_dependencies_in_with_clauses() when the names for CTE tables can be resolved error messages are thrown only for those names that refer to non-CTE tables. This is done in open_and_process_table().
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index a1f6b202ae6..ae010a88e46 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -156,6 +156,8 @@ struct LEX_TYPE
extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
+extern const char *no_db;
+
enum enum_sp_suid_behaviour
{
SP_IS_DEFAULT_SUID= 0,