• Igor Babaev's avatar
    MDEV-16473 WITH statement throws 'no database selected' error · 7d0d934c
    Igor Babaev authored
    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().
    7d0d934c
sql_lex.h 99.9 KB