As I putter around the MySQL
INFORMATION_SCHEMA, I am finding lots of undocumented behavior for fields that should be straightforward. For example, the
VIEWS table holds information about views, and the
VIEW_DEFINITION field contains the view definition, right?
Well, when I was looking at the
VIEW_DEFINITION today, I noticed an odd thing. Even though I had permissions to see the view definition (as proven by the
SHOW CREATE VIEW command), the
INFORMATION_SCHEMA.VIEWS table sometimes came up blank for the
VIEW_DEFINITION. I had to figure out why, and now that I know, I’m not sure if it’s a bug or a feature…..can you figure it out?
mysql> USE INFORMATION_SCHEMA; Database changed mysql> SELECT TABLE_NAME,VIEW_DEFINITION FROM VIEWS WHERE TABLE_SCHEMA='sakila';[Read more...]