Why it happens
A sql/updates/*.sql file uses PREPARE / EXECUTE / DEALLOCATE (often an "idempotent ADD INDEX" trick). Joomla 4+ runs every schema statement through mysqli::prepare(), which rejects those — so the install or update aborts.
How MokoJoomla helps
- Open a schema file under
sql/updates. MokoJoomla underlines any prepared-statement DDL as a diagnostic. - Use the quick-fix to no-op the offending statement.
- Move the conditional logic into your install script: check
information_schemaand run a plainALTER … ADD …only when the column/index is missing — idempotent and fail-open, from a hook that runs on both install and update.
Part of the Moko VS Code suite.