odbc_fdw
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
odbc_fdw | 0.5.2 | FDW | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8520 | odbc_fdw | No | Yes | No | Yes | No | Yes | - |
Package/source version 0.6.1; SQL extension version 0.5.2. Live queries require an installed ODBC driver and configured DSN.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 0.5.2 | 1817161514 | odbc_fdw | - |
| RPM | PGDG | 0.6.1 | 1817161514 | odbc_fdw_$v | unixODBC |
| DEB | PIGSTY | 0.6.1 | 1817161514 | postgresql-$v-odbc-fdw | libodbc2 |
Build
You can build the DEB packages for odbc_fdw using pig build:
Install
You can install odbc_fdw directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
odbc_fdw exposes tables or driver-specific queries from an ODBC data source as PostgreSQL foreign tables. It is primarily a read/query bridge across heterogeneous systems; validate data-type conversions and remote-driver behavior before relying on it for production queries.
Core Workflow
Use driver instead of dsn for a DSN-less connection. Other driver attributes use the odbc_ prefix and may be placed on the server, user mapping, or foreign table. Put credentials in a user mapping. Quote case-sensitive attribute names, and wrap values containing = or ; in braces as required by the driver.
Queries and Import
sql_query overrides table; pair it with sql_count when the FDW needs an explicit row-count query:
Important Objects and Options
dsnordriverselects the ODBC data source; 0.6.1 restricts these server options to superusers because the driver manager loads shared libraries.schema,table,sql_query, andsql_countselect the remote relation or query.prefixchanges local names created byIMPORT FOREIGN SCHEMA.ODBCTablesList(server_name, ...)lists visible remote tables.ODBCTableSize(server_name, table_name)andODBCQuerySize(server_name, query)return remote row counts.
Version 0.6.0 restores compatibility and fixes crashes on recent PostgreSQL releases. Version 0.6.1 escapes remote literals and identifiers to prevent SQL injection, restricts driver selection, and redacts common credential attributes in debug connection strings. Upgrade before allowing delegated FDW use, while retaining normal server ownership and user-mapping controls.
Only the ODBC types listed by the upstream README are fully supported. Identifier length, driver SQL dialect, encodings, null handling, and binary values can vary. The source/package release is 0.6.1, while the control file and install SQL continue to declare extension version 0.5.2.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)