tds_fdw
tds_fdw · Foreign data wrapper for querying a TDS database (Sybase or Microsoft SQL Server)
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8620 | tds_fdw | tds_fdw | 2.0.6 | 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 | babelfishpg_tds odbc_fdw jdbc_fdw oracle_fdw wrappers multicorn mysql_fdw orafce db2fce db2_fdw |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| el8.aarch64 | N/A | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| el9.x86_64 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| el9.aarch64 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| el10.x86_64 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| el10.aarch64 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 | PGDG 2.0.6 |
| d12.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| d12.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| d13.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| d13.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u22.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u22.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u24.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u24.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u26.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| u26.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
Source
github.com/tds-fdw/tds_fdw
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
- README.md
- tds_fdw.control
- ForeignServerCreation.md
- ForeignTableCreation.md
- UserMappingCreation.md
- ForeignSchemaImporting.md
- Variables.md
tds_fdw is a foreign data wrapper for querying TDS databases such as Sybase and Microsoft SQL Server through a DB-Library implementation such as FreeTDS.
Create Server
Server Options: servername (server address or DSN, supports comma-separated failover list), port, database, dbuse (0 for direct connection, non-0 for dbuse()), tds_version (protocol version), language, character_set, msg_handler (notice or blackhole), sqlserver_ansi_mode, fdw_startup_cost, fdw_tuple_cost.
Create User Mapping
For Azure SQL databases, use the format username@servername for the username option.
Create Foreign Table
Map a remote table directly:
Or use a custom SQL query:
Table Options: table_name or query (one required, mutually exclusive), schema_name, match_column_names (map by name vs position), use_remote_estimate, local_tuple_estimate, row_estimate_method (execute or showplan_all).
Column Options: column_name (remote column name if different from local).
Query and Debug
Import Foreign Schema
Import Options: import_default, import_not_null, and keep_custom_types for preserving Sybase user-defined types when matching PostgreSQL domains already exist.
Planner And Runtime Notes
The upstream README says the current version does not support join pushdown or write operations. It does support WHERE and column pushdown when match_column_names is enabled.
Set diagnostic memory-stat variables with PostgreSQL SET, for example:
Available variables are tds_fdw.show_before_row_memory_stats, tds_fdw.show_after_row_memory_stats, and tds_fdw.show_finished_memory_stats.
Version 2.0.6
The release adds PostgreSQL 19 build compatibility while retaining historical support described by upstream. It improves Sybase user-defined type handling, foreign-table row estimates and EXPLAIN VERBOSE diagnostics, and conversion of some defaults during IMPORT FOREIGN SCHEMA. Character-set conversion problems now warn rather than terminating the whole query; examine warnings and validate returned text. The read-only and pushdown limits above remain. Use matching FreeTDS and extension files, and replace sessions using an older library after installation.