[MDEV-29599] mysqldump outputs CREATE VIEW twice Created: 2022-09-21  Updated: 2022-09-22  Resolved: 2022-09-22

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.6.8, 10.6.10
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Vitaliy Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

Windows 10 64bit
10.6.10-MariaDB



 Description   

Create a dump of the database with views.
Output contains these statements:

CREATE VIEW view_name
DROP VIEW view_name
CREATE VIEW view_name



 Comments   
Comment by MG [ 2022-09-21 ]

I believe that this is because alphabetically a view may be created before base tables it depends on. Look in you dump to see that the original CREATE VIEW is just SELECT 1 , 1, ...

I suspect that if you have views which depend on views, you can't just change mysqldump output to have them all created at the end in the logically correct order without expensive parsing of them, but maybe I am wrong about them.

Comment by MG [ 2022-09-21 ]

BTW, If your mysqldump version is pre- MDEV-26447 then you might see that a MyISAM base table is created instead of a temporary VIEW using SELECT 1

Comment by Vitaliy [ 2022-09-22 ]

Maybe it is by design, but this is strange, it looks like a quick workaround and not a real solution.
I imagine views should be output in order of dependencies and not recreated. Dependencies can be stored in metadata (when view is created) if it's difficult to parse while creating a dump.

Comment by Sergei Golubchik [ 2022-09-22 ]

Yes, this is by design, it's how mysqldump works.

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