MySQL 视图的替代结构.它是什么? [英] MySQL Stand-in structure for view. What is it?

查看:34
本文介绍了MySQL 视图的替代结构.它是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在使用 phpmyadmin 4 导出数据库.数据库包含一些视图并且在通常的 CREATE VIEW 命令之前有一个 CREATE TABLE 命令带有注释视图视图名称的替代结构".

We 've been exporting a database using phpmyadmin 4. The database contains some views and before the usual CREATE VIEW command there is a CREATE TABLE command with a comment "Stand-in structure for view viewName".

为什么要使用这种替代结构?

Why is this stand-in structure used?

注意:除非移除替代结构,否则从导出的文件导入将失败.

Note: Importing from the exported file fails unless the stand-in structures are removed.

推荐答案

stand-in"或standin"结构是从视图创建的表,与视图具有相同的结构.它用于确保在导出多个相互依赖的视图时满足依赖关系.

A "stand-in" or "standin" structure is a table that is created from a view, that has the same structure as the view. It is used to ensure dependencies are met when a number of interdependent views are being exported.

如果存在替代结构,我不确定为什么导出会失败(拥有这些的含义实际上是相反的),但过程中可能存在错误.我必须查看导出文件的相关部分才能真正了解.

I'm not sure why the export should fail if the stand-in structures are present (the implication of having these is actually the reverse), but there could be a bug in the process. I'd have to see the relevant section of the export file to really tell.

phpmyadmin sourceforge 站点在错误 #3846 (http://sourceforge.net/p/phpmyadmin/bugs/3846/):

The phpmyadmin sourceforge site mentions the use of stand-in structures in bug #3846 (http://sourceforge.net/p/phpmyadmin/bugs/3846/):

导出时,phpMyAdmin 为视图创建了一个替代结构(使用 CREATE TABLE),然后它会删除该表并使用 CREATE VIEW.

When exporting, phpMyAdmin creates a stand-in structure for the view (with CREATE TABLE), then later it drops this table and uses CREATE VIEW.

并且在 github 上的 phpmyadmin 错误 #11711 的评论中有另一个参考(https://github.com/phpmyadmin/phpmyadmin/commit/2f2b505):

and there is another reference in the comments for phpmyadmin bug #11711 on github (https://github.com/phpmyadmin/phpmyadmin/commit/2f2b505):

视图 A 可能依赖于下面定义的另一个视图 B,因此如果我们不使用替身,视图 A 创建将失败.依赖项可能比这更复杂,因此我们使用替代项而不是计算所有依赖项.

View A may depend on another view B that is defined below, so the view A creation would fail if we did not use stand-in. Dependencies may be more complex that that, so instead of computing all dependencies we use stand-ins.

这篇关于MySQL 视图的替代结构.它是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆