WordPress / WordPress/sqlite-database-integration
SHOW TABLE STATUS support in Site Health
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 363
- Forks
- 67
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 7
Description
While support for SHOW TABLE STATUS was added in #77 it appears that the expression must be followed by a filter or a ;.
WordPress makes this query without a ; and without any conditional filtering.
This was noticed via https://core.trac.wordpress.org/ticket/63058 (This doesn't cause the entirety of that ticket)
Testing with WP Console in Playground verifies this behaviour, a DB error is visible within the browser console:
[02-May-2025 01:56:54 UTC] WordPress database error <div style="clear:both"> </div>
<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">
<p>MySQL query:</p>
<p>SHOW TABLE STATUS</p>
<p>Queries made or created this session were:</p>
<ol>
<li>Executing: BEGIN | (no parameters)</li>
<li>Executing: ROLLBACK | (no parameters)</li>
</ol>
</div>
<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">
Error occurred at line 4164 in Function <code>handle_error</code>. Error message was: Syntax error: Unexpected token in query SHOW TABLE STATUS.
</div>
<p>Backtrace:</p>
<pre>#0 /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()
#1 /wordpress/wp-includes/class-wpdb.php(4): WP_SQLite_DB->query('SHOW TABLE STAT...')
#2 /wordpress/wp-content/plugins/wp-console/includes/Core/Console/RestController.php(139) : eval()'d code(3): wpdb->get_results('SHOW TABLE STAT...', 'ARRAY_A')
#3 /wordpress/wp-content/plugins/wp-console/includes/Core/Console/RestController.php(139): eval()
#4 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(3): WPConsole\Core\Console\RestController->create_item(Object(WP_REST_Request))
#5 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(3): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp-console/v1/...', Array, NULL)
#6 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(3): WP_REST_Server->dispatch(Object(WP_REST_Request))
#7 /wordpress/wp-includes/rest-api.php(2): WP_REST_Server->serve_request('/wp-console/v1/...')
#8 /wordpress/wp-includes/class-wp-hook.php(3): rest_api_loaded(Object(WP))
#9 /wordpress/wp-includes/class-wp-hook.php(3): WP_Hook->apply_filters('', Array)
#10 /wordpress/wp-includes/plugin.php(2): WP_Hook->do_action(Array)
#11 /wordpress/wp-includes/class-wp.php(3): do_action_ref_array('parse_request', Array)
#12 /wordpress/wp-includes/class-wp.php(3): WP->parse_request('')
#13 /wordpress/wp-includes/functions.php(2): WP->main('')
#14 /wordpress/wp-blog-header.php(2): wp()
#15 /wordpress/index.php(2): require('/wordpress/wp-b...')
#16 {main}</pre>
for query SHOW TABLE STATUS made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WPConsole\Core\Console\RestController->create_item, eval, WP_SQLite_DB->query, WP_SQLite_DB->print_error
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in wp-includes/sqlite/class-wp-sqlite-translator.php around the SHOW TABLE STATUS implementation at lines 3537-3553, then reproduce the query through WP Console or WordPress Site Health. Done means SHOW TABLE STATUS without a semicolon or conditional filter no longer produces the reported syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100