feat(mysql): Add database analyzer for MySQL #4201
Draft
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Summary
sqlc_managed_{hash}) based on migration content hash for cachingPrepareContextagainst real MySQLImplementation Details
The MySQL analyzer (
internal/engine/dolphin/analyzer/analyze.go) follows the same pattern as the SQLite analyzer:PrepareContextto validate queries against the real databaseTest Fixes
Fixed MySQL test cases that were using PostgreSQL-specific syntax:
$1/$2placeholders to?(MySQL syntax)AS countaliases tocount(*)expressions in CTEsauthor_id→id,authors.parent_id→a.parent_id)public.schema prefixTests restricted to
basecontext (incompatible with real MySQL):mysql_vector- requires MySQL HeatWave (DISTANCE/STRING_TO_VECTOR functions)vet_explain- requires MySQL env vars for explain rulesshow_warnings- SHOW WARNINGS not supported in prepared statementsselect_subquery_no_alias- MySQL requires derived tables to have aliasesvalid_group_by_reference- MySQL's ONLY_FULL_GROUP_BY mode incompatibilityinsert_select_invalid,invalid_group_by_reference,invalid_table_alias- expected error messages differTest plan
go test ./...)go test --tags=examples -timeout 20m ./internal/endtoend/...)🤖 Generated with Claude Code