2009-10-05 16:22:48 +02:00
|
|
|
#
|
2014-02-03 22:28:35 +01:00
|
|
|
# Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
#
|
|
|
|
SELECT t.table_name, c1.column_name
|
|
|
|
FROM information_schema.tables t
|
|
|
|
INNER JOIN
|
|
|
|
information_schema.columns c1
|
|
|
|
ON t.table_schema = c1.table_schema AND
|
|
|
|
t.table_name = c1.table_name
|
|
|
|
WHERE t.table_schema = 'information_schema' AND
|
|
|
|
c1.ordinal_position =
|
|
|
|
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
|
|
|
FROM information_schema.columns c2
|
|
|
|
WHERE c2.table_schema = t.table_schema AND
|
|
|
|
c2.table_name = t.table_name AND
|
|
|
|
c2.column_name LIKE '%SCHEMA%'
|
|
|
|
)
|
2019-08-30 15:06:54 +02:00
|
|
|
AND t.table_name NOT LIKE 'innodb%' and t.table_name NOT LIKE "OPTIMIZER_TRACE%";
|
2009-10-05 16:22:48 +02:00
|
|
|
table_name column_name
|
2013-10-21 01:39:51 +02:00
|
|
|
ALL_PLUGINS PLUGIN_NAME
|
|
|
|
APPLICABLE_ROLES GRANTEE
|
2009-10-05 16:22:48 +02:00
|
|
|
CHARACTER_SETS CHARACTER_SET_NAME
|
2018-10-12 10:43:12 +02:00
|
|
|
CHECK_CONSTRAINTS CONSTRAINT_SCHEMA
|
2012-01-05 00:02:57 +01:00
|
|
|
CLIENT_STATISTICS CLIENT
|
2009-10-05 16:22:48 +02:00
|
|
|
COLLATIONS COLLATION_NAME
|
|
|
|
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
|
|
|
COLUMNS TABLE_SCHEMA
|
|
|
|
COLUMN_PRIVILEGES TABLE_SCHEMA
|
2013-10-21 01:39:51 +02:00
|
|
|
ENABLED_ROLES ROLE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
ENGINES ENGINE
|
|
|
|
EVENTS EVENT_SCHEMA
|
|
|
|
FILES TABLE_SCHEMA
|
2014-11-24 09:25:56 +01:00
|
|
|
GEOMETRY_COLUMNS F_TABLE_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
GLOBAL_STATUS VARIABLE_NAME
|
|
|
|
GLOBAL_VARIABLES VARIABLE_NAME
|
2012-01-05 00:02:57 +01:00
|
|
|
INDEX_STATISTICS TABLE_SCHEMA
|
2021-07-02 10:08:48 +02:00
|
|
|
KEYWORDS WORD
|
2012-01-05 00:02:57 +01:00
|
|
|
KEY_CACHES KEY_CACHE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
2010-11-16 01:11:06 +01:00
|
|
|
PARAMETERS SPECIFIC_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
PARTITIONS TABLE_SCHEMA
|
|
|
|
PLUGINS PLUGIN_NAME
|
|
|
|
PROCESSLIST ID
|
|
|
|
PROFILING QUERY_ID
|
|
|
|
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
|
|
|
ROUTINES ROUTINE_SCHEMA
|
|
|
|
SCHEMATA SCHEMA_NAME
|
|
|
|
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
|
|
|
SESSION_STATUS VARIABLE_NAME
|
|
|
|
SESSION_VARIABLES VARIABLE_NAME
|
2014-11-24 09:25:56 +01:00
|
|
|
SPATIAL_REF_SYS SRID
|
2021-07-02 10:08:48 +02:00
|
|
|
SQL_FUNCTIONS FUNCTION
|
2009-10-05 16:22:48 +02:00
|
|
|
STATISTICS TABLE_SCHEMA
|
2014-09-03 20:16:51 +02:00
|
|
|
SYSTEM_VARIABLES VARIABLE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
TABLES TABLE_SCHEMA
|
2010-11-16 01:11:06 +01:00
|
|
|
TABLESPACES TABLESPACE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
|
|
|
TABLE_PRIVILEGES TABLE_SCHEMA
|
2012-01-05 00:02:57 +01:00
|
|
|
TABLE_STATISTICS TABLE_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
TRIGGERS TRIGGER_SCHEMA
|
|
|
|
USER_PRIVILEGES GRANTEE
|
2012-01-05 00:02:57 +01:00
|
|
|
USER_STATISTICS USER
|
2009-10-05 16:22:48 +02:00
|
|
|
VIEWS TABLE_SCHEMA
|
|
|
|
SELECT t.table_name, c1.column_name
|
|
|
|
FROM information_schema.tables t
|
|
|
|
INNER JOIN
|
|
|
|
information_schema.columns c1
|
|
|
|
ON t.table_schema = c1.table_schema AND
|
|
|
|
t.table_name = c1.table_name
|
|
|
|
WHERE t.table_schema = 'information_schema' AND
|
|
|
|
c1.ordinal_position =
|
|
|
|
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
|
|
|
FROM information_schema.columns c2
|
|
|
|
WHERE c2.table_schema = 'information_schema' AND
|
|
|
|
c2.table_name = t.table_name AND
|
|
|
|
c2.column_name LIKE '%SCHEMA%'
|
|
|
|
)
|
2019-08-30 15:06:54 +02:00
|
|
|
AND t.table_name NOT LIKE 'innodb%' and t.table_name NOT LIKE "OPTIMIZER_TRACE%";
|
2009-10-05 16:22:48 +02:00
|
|
|
table_name column_name
|
2013-10-21 01:39:51 +02:00
|
|
|
ALL_PLUGINS PLUGIN_NAME
|
|
|
|
APPLICABLE_ROLES GRANTEE
|
2009-10-05 16:22:48 +02:00
|
|
|
CHARACTER_SETS CHARACTER_SET_NAME
|
2018-10-12 10:43:12 +02:00
|
|
|
CHECK_CONSTRAINTS CONSTRAINT_SCHEMA
|
2012-01-05 00:02:57 +01:00
|
|
|
CLIENT_STATISTICS CLIENT
|
2009-10-05 16:22:48 +02:00
|
|
|
COLLATIONS COLLATION_NAME
|
|
|
|
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
|
|
|
COLUMNS TABLE_SCHEMA
|
|
|
|
COLUMN_PRIVILEGES TABLE_SCHEMA
|
2013-10-21 01:39:51 +02:00
|
|
|
ENABLED_ROLES ROLE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
ENGINES ENGINE
|
|
|
|
EVENTS EVENT_SCHEMA
|
|
|
|
FILES TABLE_SCHEMA
|
2014-11-24 09:25:56 +01:00
|
|
|
GEOMETRY_COLUMNS F_TABLE_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
GLOBAL_STATUS VARIABLE_NAME
|
|
|
|
GLOBAL_VARIABLES VARIABLE_NAME
|
2012-01-05 00:02:57 +01:00
|
|
|
INDEX_STATISTICS TABLE_SCHEMA
|
2021-07-02 10:08:48 +02:00
|
|
|
KEYWORDS WORD
|
2012-01-05 00:02:57 +01:00
|
|
|
KEY_CACHES KEY_CACHE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
2010-11-16 01:11:06 +01:00
|
|
|
PARAMETERS SPECIFIC_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
PARTITIONS TABLE_SCHEMA
|
|
|
|
PLUGINS PLUGIN_NAME
|
|
|
|
PROCESSLIST ID
|
|
|
|
PROFILING QUERY_ID
|
|
|
|
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
|
|
|
ROUTINES ROUTINE_SCHEMA
|
|
|
|
SCHEMATA SCHEMA_NAME
|
|
|
|
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
|
|
|
SESSION_STATUS VARIABLE_NAME
|
|
|
|
SESSION_VARIABLES VARIABLE_NAME
|
2014-11-24 09:25:56 +01:00
|
|
|
SPATIAL_REF_SYS SRID
|
2021-07-02 10:08:48 +02:00
|
|
|
SQL_FUNCTIONS FUNCTION
|
2009-10-05 16:22:48 +02:00
|
|
|
STATISTICS TABLE_SCHEMA
|
2014-09-03 20:16:51 +02:00
|
|
|
SYSTEM_VARIABLES VARIABLE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
TABLES TABLE_SCHEMA
|
2010-11-16 01:11:06 +01:00
|
|
|
TABLESPACES TABLESPACE_NAME
|
2009-10-05 16:22:48 +02:00
|
|
|
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
|
|
|
TABLE_PRIVILEGES TABLE_SCHEMA
|
2012-01-05 00:02:57 +01:00
|
|
|
TABLE_STATISTICS TABLE_SCHEMA
|
2009-10-05 16:22:48 +02:00
|
|
|
TRIGGERS TRIGGER_SCHEMA
|
|
|
|
USER_PRIVILEGES GRANTEE
|
2012-01-05 00:02:57 +01:00
|
|
|
USER_STATISTICS USER
|
2009-10-05 16:22:48 +02:00
|
|
|
VIEWS TABLE_SCHEMA
|