[MDEV-24370] delete query with table aliases fails when no database has been selected Created: 2020-12-08  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Data Manipulation - Delete
Affects Version/s: 5.5, 10.0, 10.1, 5.5.65, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Dennis Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

CentOS 7



 Description   

MariaDB shares this same bug with MySQL: https://bugs.mysql.com/bug.php?id=82189

In a nutshell: When you do a delete query with table aliases but did not first type "use <database>", the command will fail with ERROR 1046 (3D000): No database selected.



 Comments   
Comment by Alice Sherepa [ 2020-12-08 ]

Thank you for the report!
It is repeatable on the current 5.5-10.5:

create table test.t1 (i int);
create database foo; use foo; drop database foo; # now there is no default database
 
--error 1046
delete a from test.t1 a;
 
--error 1046
delete from a using test.t1 a;

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