Skip to main content

Correcting a Broken View in MySQL

Recently I had a problem where I renamed a db field to allow for better maintenance (the field name misrepresented it's actual use and conflicted with another use).

In the process, I broke a view that used the table.

MySQL then complained about "...references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them"

The view itself became impossible to edit.  However you can access the view definition with the following query.

SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'database_name' AND TABLE_NAME = 'view_name';   

Comments

Popular posts from this blog

Javascript Form Validation

It's real simple. All you need to do is call a javascript function in a html  " onsubmit " in the form tag as a javascript return, like this       <form method="post" action="dosomething.php" onsubmit="return validateForm();"> If the code completes ok, the form is then sent to the page listed in "action" http://www.w3schools.com/js/js_form_validation.asp If the function specified in the onsubmit returns false, then the form is not sent to the page mentioned in action.