CodeIgniter Forums
drop mysql view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: drop mysql view (/showthread.php?tid=57816)



drop mysql view - El Forum - 04-13-2013

[eluser]vickel[/eluser]
is there a way to drop a mysql view?

Code:
$sql="drop view if exists my_view";
$this->db->query($sql);

doesn't work


drop mysql view - El Forum - 04-13-2013

[eluser]Edy S[/eluser]
Please check whether you've doing this in your applications:
1. You have a privilege that allow an account that you use to drop your view
2. You are mention to the right view name, remember that in this case, View name, Column name, Table name are case sensitive


drop mysql view - El Forum - 04-14-2013

[eluser]vickel[/eluser]
well,I'm using the CI (codeigniter) framework on localhost, so
@1 YES
@ 2 YES

its a generic question: "is there a way to drop a mysql view using:

$sql="drop view if exists my_view";
$this->db->query($sql);


drop mysql view - El Forum - 04-15-2013

[eluser]TheFuzzy0ne[/eluser]
Are you getting any errors? If not, then I suspect it is a problem with your privileges, as Edy S said.


drop mysql view - El Forum - 04-16-2013

[eluser]vickel[/eluser]
I found the error 1356:
View 'my_view' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them.

After looking deeper inside the matter, I found this was due to underlying table/view structures being updated.

hope that helps someone.