From 22f78fe2540f84b64e7d84d0035d85d1bbe2fa9d Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 4 Jan 2020 07:50:45 +1100 Subject: [PATCH] dev/core#392 Fix FTS INNDOB indexer query to work in MySQL 8 as well as previous MySQL versions --- CRM/Core/InnoDBIndexer.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CRM/Core/InnoDBIndexer.php b/CRM/Core/InnoDBIndexer.php index fdd401eb8d..e9d26997a0 100644 --- a/CRM/Core/InnoDBIndexer.php +++ b/CRM/Core/InnoDBIndexer.php @@ -169,10 +169,17 @@ class CRM_Core_InnoDBIndexer { } // Note: this only works in MySQL 5.6, but this whole system is intended to only work in MySQL 5.6 + // Note: In MYSQL 8 the Tables have been renamed from INNODB_SYS_TABLES and INNODB_SYS_INDEXES to INNODB_TABLES and INNODB_INDEXES + $innodbTable = "innodb_sys_tables"; + $innodbIndex = "innodb_sys_indexes"; + if (version_compare($mysqlVersion, '8.0', '>=')) { + $innodbTable = "innodb_tables"; + $innodbIndex = "innodb_indexes"; + } $sql = " - SELECT i.name as index_name - FROM information_schema.innodb_sys_tables t - JOIN information_schema.innodb_sys_indexes i USING (table_id) + SELECT i.name as `index_name` + FROM information_schema.$innodbTable t + JOIN information_schema.$innodbIndex i USING (table_id) WHERE t.name = concat(database(),'/$table') AND i.name like '" . self::IDX_PREFIX . "%' "; -- 2.25.1