Commit dd6710b
Add mysql_fdw for MySQL/Doris support (supabase#584)
* Add mysql_fdw for MySQL/Doris support via text protocol
Uses mysql_async crate with text protocol (simple_query) instead of
prepared statements, which makes it compatible with Doris and other
MySQL-protocol databases that don't support mysql_stmt_result_metadata.
Based on mssql_fdw template with MySQL-specific adaptations:
- MySQL LIMIT without requiring ORDER BY
- String-based date/time parsing for broader compatibility
- Support for conn_string and conn_string_id (vault) options
* fix: update mysql_fdw website URL to upstream repo path
* fix: address CodeRabbit review feedback for mysql_fdw
- Add mysql_fdw to native_fdws feature list in Cargo.toml
- Preserve SQLSTATE codes for OptionsError/CreateRuntimeError and
sanitize mysql_async error messages to avoid leaking credentials
- Propagate datetime/date parse errors instead of silently returning NULL
- Quote SQL identifiers with backticks to prevent injection and
reserved word conflicts
* fix: use MySQL-safe cell formatter for WHERE clause values
Add MysqlCellFormatter that escapes single quotes and backslashes in
string literals, and formats booleans as 0/1 for MySQL compatibility.
Use deparse_with_fmt instead of deparse to apply the safe formatter
when building WHERE predicates.
* fix: inline format args to satisfy clippy uninlined_format_args
* fix: address PR review - vault error propagation, identifier quoting in WHERE, and DML support
- Replace get_vault_secret().unwrap_or_default() with proper error propagation
so missing/failed vault lookups surface as errors instead of empty conn_str
- Add custom deparse_qual() that quotes field names with backticks in WHERE
clauses, matching the quoting used in SELECT columns and ORDER BY
- Implement DML methods (begin_modify, insert, update, delete, end_modify)
using the same runtime/connection pattern as begin_scan
* feat: add streaming support and test cases
* feat(mysql_fdw): enhance schema import and add CRUD tests for MySQL integration
* feat(mysql_fdw): enhance user table schema and add additional data validation tests
* feat(mysql_fdw): add MySQL foreign data wrapper documentation and support for JSON data type
* fix(mysql.md): update author information and change tags from official to community
---------
Co-authored-by: Bo Lu <[email protected]>1 parent 3edd0b1 commit dd6710b
12 files changed
Lines changed: 1444 additions & 3 deletions
File tree
- docs/catalog
- wrappers
- .ci
- src/fdw
- mysql_fdw
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
0 commit comments