Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown drop type: INDEX #116

Open
stuartlangridge opened this issue May 27, 2024 · 2 comments
Open

Unknown drop type: INDEX #116

stuartlangridge opened this issue May 27, 2024 · 2 comments

Comments

@stuartlangridge
Copy link

wp2static tries to run this command

DROP INDEX status ON wp_wp2static_jobs

as part of setup. This plugin doesn't know how to handle that, it seems: I get the error (with formatting HTML removed)

MySQL query:
DROP INDEX status ON wp_wp2static_jobs
Queries made or created this session were:
* Executing: BEGIN | (no parameters)
* Executing: ROLLBACK | (no parameters)
Error occurred at line 3777 in Function <code>handle_error</code>. Error message was: Unknown drop type: INDEX.

Backtrace:
#0 ...path/to/webroot/wp-content/plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()
#1 ...path/to/webroot/wp-content/plugins/wp2static/src/JobQueue.php(28): WP_SQLite_DB->query('DROP INDEX stat...')
#2 ...path/to/webroot/wp-content/plugins/wp2static/src/Controller.php(110): WP2Static\JobQueue::createTable()
#3 ...path/to/webroot/wp-content/plugins/wp2static/src/Controller.php(136): WP2Static\Controller::activateForSingleSite()
...
@stuartlangridge
Copy link
Author

stuartlangridge commented May 27, 2024

I suspect this is because of

switch ( $what ) {
case 'TABLE':
$this->rewriter->consume_all();
$this->execute_sqlite_query( $this->rewriter->get_updated_query() );
$this->results = $this->last_exec_returned;
break;
case 'PROCEDURE':
case 'DATABASE':
$this->results = true;
return;
default:
throw new Exception( 'Unknown drop type: ' . $what );
which seems to understand DROP TABLE, DROP PROCEDURE, and DROP DATABASE, but not DROP INDEX.

However,

* Divide the query types into seven different ones. That is to say:
*
* 1. SELECT SQL_CALC_FOUND_ROWS
* 2. INSERT
* 3. CREATE TABLE(INDEX)
* 4. ALTER TABLE
* 5. SHOW VARIABLES
* 6. DROP INDEX
* 7. THE OTHERS
*
claims that DROP INDEX is a specific type of query that needs special support, although I can't find whether it actually implements that special support anywhere.

@stuartlangridge
Copy link
Author

stuartlangridge commented May 27, 2024

checking into this further, CREATE INDEX isn't supported either, it seems.

Error message was: Unknown create type: INDEX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant