From 3c9ef40d1e59549eea5d60094a4544479689dc3d Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Sun, 22 May 2011 15:03:30 +0200 Subject: [PATCH] Add table alias in PMA_DBI_get_tables_full to avoid ambiguous field names in filtered queries (broken by join with TABLE_CACHE) --- libraries/database_interface.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 7f03c6804b..c01f80c210 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -257,13 +257,13 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals // get table information from information_schema if ($table) { if (true === $tbl_is_group) { - $sql_where_table = 'AND `TABLE_NAME` LIKE \'' + $sql_where_table = 'AND t.`TABLE_NAME` LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; } elseif ('comment' === $tbl_is_group) { - $sql_where_table = 'AND `TABLE_COMMENT` LIKE \'' + $sql_where_table = 'AND t.`TABLE_COMMENT` LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; } else { - $sql_where_table = 'AND `TABLE_NAME` = \'' . addslashes($table) . '\''; + $sql_where_table = 'AND t.`TABLE_NAME` = \'' . addslashes($table) . '\''; } } else { $sql_where_table = ''; @@ -341,7 +341,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment` - FROM `information_schema`.`TABLES` + FROM `information_schema`.`TABLES` t WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN (\'' . implode("', '", $this_databases) . '\') ' . $sql_where_table; } -- 2.11.4.GIT