Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Stand-in structure for view. What is it?

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.

like image 890
patrox Avatar asked Feb 05 '14 09:02

patrox


1 Answers

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.

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

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

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

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.

like image 58
Raad Avatar answered Sep 28 '22 07:09

Raad