mysql_fdw
mysql_fdw · Foreign data wrapper for querying a MySQL server
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8600 | mysql_fdw | mysql_fdw | 2.10.0 | FDW | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | postgres_fdw oracle_fdw tds_fdw db2_fdw sqlite_fdw informix_fdw firebird_fdw odbc_fdw jdbc_fdw db_migrator |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| el8.aarch64 | N/A | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| el9.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| el9.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| el10.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| el10.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| d12.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| d12.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| d13.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| d13.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u22.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u22.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u24.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u24.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u26.x86_64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
| u26.aarch64 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 | PGDG 2.10.0 |
Source
github.com/EnterpriseDB/mysql_fdw
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
mysql_fdw 2.10.0 exposes MySQL tables through PostgreSQL 14–19. Its SQL/control version is 1.2. The server needs the compatible MySQL client library. Installation requires a superuser, without shared preload.
Connect and Map Tables
Create a server and a restricted remote account mapping for an existing table:
dbname is required; table_name defaults to the foreign-table name. The FDW also supports IMPORT FOREIGN SCHEMA. Grant server and table access only to intended roles. Protect mapping credentials and use certificate-verified TLS for untrusted networks.
Writes and Pushdown
The first foreign-table column is used as the row identifier for UPDATE and DELETE; it must identify one remote row. Version 2.10.0 rejects those operations when that column belongs to a composite key, because older versions could affect multiple rows sharing its value. Match local constraints to remote data. Remote writes have their own transaction/failure boundaries.
The FDW can push filters, joins, aggregates, ordering and limits. Check EXPLAIN before relying on an index or pushdown. fetch_size, use_remote_estimate and reconnect affect remote access. Ordering optimization trusts local NOT NULL declarations; a nullable remote column can therefore sort differently if the declarations disagree.
Upgrade and Security Changes
2.10.0 fixes remote/local SQL injection, generated-column INSERT handling, repeated-parameter queries and binary/text buffer reads. init_command, mysql_default_file and SSL path/options are restricted to superusers. Existing foreign servers created by other users with restricted options need a superuser to alter or recreate them.
NO_BACKSLASH_ESCAPES is always added to the remote sql_mode. Imported defaults are now string literals; restore expression defaults such as CURRENT_TIMESTAMP on the foreign table after import. Install the new library and reconnect existing sessions; SQL version 1.2 does not change. Recheck writable-table keys, defaults, escaping and affected-row counts before returning the connection to applications.