When using a custom table prefix, a SQL error occurs while accessing the Site Health page in the WordPress admin area. The error appears to be related to querying table information.
WordPress database error:
Queries made or created this session were
- Raw query: SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data_length + index_length) as 'bytes' FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'null-db-name' AND TABLE_NAME IN ('custom_comments','custom_options','custom_posts','custom_terms','custom_users') GROUP BY TABLE_NAME;
- Rewritten: SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data_length + index_length) as 'bytes' FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'null-db-name' AND TABLE_NAME IN ('custom_comments','custom_options','custom_posts','custom_terms','custom_users') GROUP BY TABLE_NAME;
- With Placeholders: SELECT TABLE_NAME AS :param_0 , TABLE_ROWS AS :param_1 , SUM(data_length + index_length) as :param_2 FROM information_schema.TABLES WHERE TABLE_SCHEMA = :param_3 AND TABLE_NAME IN ( :param_4 , :param_5 , :param_6 , :param_7 , :param_8 ) GROUP BY TABLE_NAME;
- Prepare: SELECT TABLE_NAME AS :param_0 , TABLE_ROWS AS :param_1 , SUM(data_length + index_length) as :param_2 FROM information_schema.TABLES WHERE TABLE_SCHEMA = :param_3 AND TABLE_NAME IN ( :param_4 , :param_5 , :param_6 , :param_7 , :param_8 ) GROUP BY TABLE_NAME;
Error occurred at line 1644 in Function prepare_query.
Error message was: Problem preparing the PDO SQL Statement. Error was: SQLSTATE[HY000]: General error: 1 near ":param_0": syntax error
#0 /home/username/public_html/wp-content/db.php(2746): WP_SQLite_DB\PDOEngine->get_error_message()
#1 /home/username/public_html/wp-includes/class-wpdb.php(3141): WP_SQLite_DB\wpsqlitedb->query('SELECT TABLE_NA...')
#2 /home/username/public_html/wp-admin/includes/class-wp-site-health.php(3568): wpdb->get_results('SELECT TABLE_NA...', 'OBJECT_K')
#3 /home/username/public_html/wp-admin/includes/class-wp-site-health.php(2538): WP_Site_Health->should_suggest_persistent_object_cache()
#4 /home/username/public_html/wp-admin/includes/class-wp-site-health.php(194): WP_Site_Health->get_test_persistent_object_cache()
#5 /home/username/public_html/wp-admin/includes/class-wp-site-health.php(139): WP_Site_Health->perform_test(Array)
#6 /home/username/public_html/wp-includes/class-wp-hook.php(324): WP_Site_Health->enqueue_scripts('site-health.php')
#7 /home/username/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#8 /home/username/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /home/username/public_html/wp-admin/admin-header.php(118): do_action('admin_enqueue_s...', 'site-health.php')
#10 /home/username/public_html/wp-admin/site-health.php(96): require_once('/home/username/p...')
SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data_length + index_length) as 'bytes' FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'null-db-name' AND TABLE_NAME IN ('custom_comments','custom_options','custom_posts','custom_terms','custom_users') GROUP BY TABLE_NAME;
When using a custom table prefix, a SQL error occurs while accessing the Site Health page in the WordPress admin area. The error appears to be related to querying table information.
Steps to Reproduce
Error Message
Additional Information