view - Subquerying MYSQL to select All Databases from server -


i've checked this topic before asking, , found helpful in point, , it's not enough.

i have lot of databases in mariadb server, , 1 of registered views broken, giving me "invalid references" error.

what need find out view broken, considering error preventing me run backup routine, , mariadb log shows "database (got error: 1049) (locktable)"

now have list of views, there way "select *" of them, in different databases?

i've tried this:

select *  table_schema (select table_schema,table_name information_schema.tables table_type 'view'); 

but know not work since i'm not providing specific database.

i think inner-join solve case, can't figure out how accomplish it...

by way, if there's better approach find view defective, appreciate it.

thank in advance!

since answer removed it's contributor, i've developed ugly effective workaround:

  1. i've created file both database , view names, using query provided below:

mysql -p*** -e "select table_schema, table_name information_schema.`tables` table_type 'view'" > views.txt

  1. this saves file "views.txt" flow information need run basic select in view, did following:

while ifs= read -r line; mysql -p*** -e "select * $(echo $line | awk '{print $1}').$(echo $line | awk '{print $2}') limit 1" 2>> errors.txt; echo $line >> errors.txt; done < views.txt

i know it's ugly, run "select *" in every database.table or database.view listed in "views.txt", returning first line of query.

it provided me effective test in server, showed me view broken:

error 1146 (42s02) @ line 1: table '.' doesn't exist

if you're facing similar problems, hope may find better way solve this.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -