I just wanted to drop a line to the community - perhaps this has been
addressed already and I'm just disorganized.

I see that in the 4.12 SQL upgrade scripts we use "ALTER VIEW" rather than
the previous pattern of "DROP VIEW IF EXISTS" + "CREATE".

The problem I've seen with ALTER VIEW is that in order to alter view, the
SQL may need to be run by the same user that initially created the view.
This can cause issues for clusters or for DBs that have been migrated.

Consider an installation that has started on a local MySQL instance, the
view may have DEFINER=`cloud`@`localhost` - if the database is migrated off
to a remote MySQL server, the user cloudstack is using may now be seen as
`cloud`@`server1` - at which point ALTER VIEW is no longer going to work.
DROP works, and CREATE will update the view to DEFINER=`cloud`@`server1`.

I guess this is my plea to the community to think about not using ALTER
VIEW in the future for SQL upgrades :-)

Reply via email to