[MDEV-16473] WITH statement throws 'no database selected' error Created: 2018-06-12  Updated: 2021-08-30  Resolved: 2018-06-28

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE
Affects Version/s: 10.3.7, 10.2, 10.3
Fix Version/s: 10.2.17

Type: Bug Priority: Critical
Reporter: Remy Fox Assignee: Igor Babaev
Resolution: Fixed Votes: 1
Labels: None
Environment:

Windows


Issue Links:
Problem/Incident
causes MDEV-26504 THD::copy_db_to() fails to return err... Closed
Relates
relates to MDEV-15120 CTE table should not belong to datab... Closed
relates to MDEV-22781 CREATE VIEW containing WITH clause Si... Closed

 Description   
  • Create a table `user`.`users` with a couple of columns.
  • Execute, without having selected a database (through USE statement) the following query:
    WITH
    abc AS (SELECT * FROM user.users)
    SELECT * FROM abc
  • Now you will get the error '1046 No database selected'.

On MySQL you don't get this error so I guess it only happens on MariaDB.



 Comments   
Comment by Elena Stepanova [ 2018-06-21 ]

Thanks for the report.

Strangely, we had a similar one MDEV-15120 which is marked as fixed in 10.2.13, but the test case from its description still fails, and the commit looks like it was fixing something different from what was initially reported.

Comment by Oleksandr Byelkin [ 2018-06-26 ]

OK to push!

Comment by Igor Babaev [ 2018-06-28 ]

A fix for this bug was pushed into 10.2 (actually 3 commits in total)

Generated at Thu Feb 08 08:29:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.