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.5 |
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
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.0.5 |
18 17 16 15 14 | tds_fdw |
- |
| RPM | PGDG | 2.0.5 |
18 17 16 15 14 | tds_fdw_$v |
- |
| DEB | PGDG | 2.0.5 |
18 17 16 15 14 | postgresql-$v-tds-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el8.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el9.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el9.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el10.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el10.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| 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, foreign server, foreign table, user mapping, foreign schema, variables
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.
Pigsty package metadata is version 2.0.5 from PGDG for PostgreSQL 14-18. Upstream docs say the FDW should support PostgreSQL 9.2+ and the current build matrix includes PostgreSQL 13-18, but this stub follows the packaged PostgreSQL versions from db/extension.csv.