← Browse the extensions catalog

tds-fdw

Source README ↗

tds_fdw

tds_fdw is a PostgreSQL Foreign Data Wrapper (FDW) that enables PostgreSQL to query Microsoft SQL Server and Sybase databases using the TDS (Tabular Data Stream) protocol via FreeTDS.

Follow the quick start to set up extension-update email alerts first, then use the CronJob to install and refresh the catalog. These examples inherit image references and runtime settings from the catalog. The Cluster YAML is an excerpt: replace imageCatalogRef: ... with your catalog reference and keep your existing instance and storage settings.

Usage

1. Add the tds-fdw extension image to your Cluster

Define the tds-fdw extension under the postgresql.extensions section of your Cluster resource. For example:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-tds-fdw
spec:
  imageCatalogRef: ...
  postgresql:
    extensions:
    - name: tds-fdw

2. Enable the extension in a database

Once the extension's files are available in the cluster, you can install it in a database in either of two ways:

Platform teams may make extension containers available across their clusters without installing every extension in every database. Install only the extensions a database uses; letting users enable them through SQL alongside the rest of their DDL schema management code can be a convenient approach.

For extensions that normally require superuser privileges, platform teams can use pgextwlist to allow non-superusers to install an administrator-approved selection of extensions.

3. Verify installation

Once the database is ready, connect to it with psql and run:

\dx

You should see tds_fdw listed among the installed extensions.

Known Caveats

  • CI coverage: The CI tests verify that the extension can be created (CREATE EXTENSION tds_fdw), but do not test actual connectivity to a SQL Server or Sybase instance. Actual foreign table queries require a running TDS-compatible database server and proper CREATE SERVER / CREATE USER MAPPING configuration. A manual test on CNPG 1.30.1 / PostgreSQL 18.7 (Trixie, AMD64) queried an isolated SQL Server 2022 fixture successfully; other servers and authentication modes remain unverified.
  • Runtime library dependency: The FreeTDS library (libsybdb5) is bundled in the image under /system/.
  • License: tds_fdw itself is PostgreSQL-licensed, but its runtime dependency libsybdb5 (FreeTDS) is LGPL-2+, which is why this extension is hosted in the CNPG Extensions project rather than upstream.

This container image contains software that may be licensed under various open-source licenses.

All relevant license and copyright information for the tds-fdw extension and its dependencies are bundled within the image at:

/licenses/

By using this image, you agree to comply with the terms of the licenses contained therein.