Skip to content

etcd_fdw

Foreign data wrapper for etcd

etcd_fdw · Foreign data wrapper for etcd

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
8660etcd_fdwetcd_fdw0.0.1FDWMITRust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono
Relationships
See Alsoredis_fdw rdf_fdw mongo_fdw redis pgmq

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.0.119 18 17 16 15etcd_fdw-
RPMPIGSTY0.0.119 18 17 16 15etcd_fdw_$v-
DEBPIGSTY0.0.119 18 17 16 15postgresql-$v-etcd-fdw-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el8.aarch64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
PackageVersionOSORGSIZEFile URL
etcd_fdw_180.0.1el8.x86_64pigsty2.8 MiBetcd_fdw_18-0.0.1-3PIGSTY.el8.x86_64.rpm
etcd_fdw_180.0.1el8.aarch64pigsty2.6 MiBetcd_fdw_18-0.0.1-3PIGSTY.el8.aarch64.rpm
etcd_fdw_180.0.1el9.x86_64pigsty3.3 MiBetcd_fdw_18-0.0.1-4PGSTY.el9.x86_64.rpm
etcd_fdw_180.0.1el9.aarch64pigsty3.3 MiBetcd_fdw_18-0.0.1-4PGSTY.el9.aarch64.rpm
etcd_fdw_180.0.1el10.x86_64pigsty3.3 MiBetcd_fdw_18-0.0.1-4PGSTY.el10.x86_64.rpm
etcd_fdw_180.0.1el10.aarch64pigsty3.3 MiBetcd_fdw_18-0.0.1-4PGSTY.el10.aarch64.rpm
postgresql-18-etcd-fdw0.0.1d12.x86_64pigsty2.2 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~bookworm_amd64.deb
postgresql-18-etcd-fdw0.0.1d12.aarch64pigsty2.0 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~bookworm_arm64.deb
postgresql-18-etcd-fdw0.0.1d13.x86_64pigsty2.2 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~trixie_amd64.deb
postgresql-18-etcd-fdw0.0.1d13.aarch64pigsty2.0 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~trixie_arm64.deb
postgresql-18-etcd-fdw0.0.1u22.x86_64pigsty2.5 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~jammy_amd64.deb
postgresql-18-etcd-fdw0.0.1u22.aarch64pigsty2.4 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~jammy_arm64.deb
postgresql-18-etcd-fdw0.0.1u24.x86_64pigsty2.5 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~noble_amd64.deb
postgresql-18-etcd-fdw0.0.1u24.aarch64pigsty2.4 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~noble_arm64.deb
postgresql-18-etcd-fdw0.0.1u26.x86_64pigsty2.4 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~resolute_amd64.deb
postgresql-18-etcd-fdw0.0.1u26.aarch64pigsty2.4 MiBpostgresql-18-etcd-fdw_0.0.1-3PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
etcd_fdw_170.0.1el8.x86_64pigsty2.8 MiBetcd_fdw_17-0.0.1-3PIGSTY.el8.x86_64.rpm
etcd_fdw_170.0.1el8.aarch64pigsty2.6 MiBetcd_fdw_17-0.0.1-3PIGSTY.el8.aarch64.rpm
etcd_fdw_170.0.1el9.x86_64pigsty3.3 MiBetcd_fdw_17-0.0.1-4PGSTY.el9.x86_64.rpm
etcd_fdw_170.0.1el9.aarch64pigsty3.3 MiBetcd_fdw_17-0.0.1-4PGSTY.el9.aarch64.rpm
etcd_fdw_170.0.1el10.x86_64pigsty3.3 MiBetcd_fdw_17-0.0.1-4PGSTY.el10.x86_64.rpm
etcd_fdw_170.0.1el10.aarch64pigsty3.3 MiBetcd_fdw_17-0.0.1-4PGSTY.el10.aarch64.rpm
postgresql-17-etcd-fdw0.0.1d12.x86_64pigsty2.2 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~bookworm_amd64.deb
postgresql-17-etcd-fdw0.0.1d12.aarch64pigsty2.0 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~bookworm_arm64.deb
postgresql-17-etcd-fdw0.0.1d13.x86_64pigsty2.2 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~trixie_amd64.deb
postgresql-17-etcd-fdw0.0.1d13.aarch64pigsty2.0 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~trixie_arm64.deb
postgresql-17-etcd-fdw0.0.1u22.x86_64pigsty2.5 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~jammy_amd64.deb
postgresql-17-etcd-fdw0.0.1u22.aarch64pigsty2.4 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~jammy_arm64.deb
postgresql-17-etcd-fdw0.0.1u24.x86_64pigsty2.4 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~noble_amd64.deb
postgresql-17-etcd-fdw0.0.1u24.aarch64pigsty2.4 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~noble_arm64.deb
postgresql-17-etcd-fdw0.0.1u26.x86_64pigsty2.4 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~resolute_amd64.deb
postgresql-17-etcd-fdw0.0.1u26.aarch64pigsty2.4 MiBpostgresql-17-etcd-fdw_0.0.1-3PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
etcd_fdw_160.0.1el8.x86_64pigsty2.8 MiBetcd_fdw_16-0.0.1-3PIGSTY.el8.x86_64.rpm
etcd_fdw_160.0.1el8.aarch64pigsty2.5 MiBetcd_fdw_16-0.0.1-3PIGSTY.el8.aarch64.rpm
etcd_fdw_160.0.1el9.x86_64pigsty3.3 MiBetcd_fdw_16-0.0.1-4PGSTY.el9.x86_64.rpm
etcd_fdw_160.0.1el9.aarch64pigsty3.3 MiBetcd_fdw_16-0.0.1-4PGSTY.el9.aarch64.rpm
etcd_fdw_160.0.1el10.x86_64pigsty3.3 MiBetcd_fdw_16-0.0.1-4PGSTY.el10.x86_64.rpm
etcd_fdw_160.0.1el10.aarch64pigsty3.3 MiBetcd_fdw_16-0.0.1-4PGSTY.el10.aarch64.rpm
postgresql-16-etcd-fdw0.0.1d12.x86_64pigsty2.2 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~bookworm_amd64.deb
postgresql-16-etcd-fdw0.0.1d12.aarch64pigsty2.0 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~bookworm_arm64.deb
postgresql-16-etcd-fdw0.0.1d13.x86_64pigsty2.2 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~trixie_amd64.deb
postgresql-16-etcd-fdw0.0.1d13.aarch64pigsty2.0 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~trixie_arm64.deb
postgresql-16-etcd-fdw0.0.1u22.x86_64pigsty2.5 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~jammy_amd64.deb
postgresql-16-etcd-fdw0.0.1u22.aarch64pigsty2.4 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~jammy_arm64.deb
postgresql-16-etcd-fdw0.0.1u24.x86_64pigsty2.4 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~noble_amd64.deb
postgresql-16-etcd-fdw0.0.1u24.aarch64pigsty2.4 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~noble_arm64.deb
postgresql-16-etcd-fdw0.0.1u26.x86_64pigsty2.4 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~resolute_amd64.deb
postgresql-16-etcd-fdw0.0.1u26.aarch64pigsty2.4 MiBpostgresql-16-etcd-fdw_0.0.1-3PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
etcd_fdw_150.0.1el8.x86_64pigsty2.8 MiBetcd_fdw_15-0.0.1-3PIGSTY.el8.x86_64.rpm
etcd_fdw_150.0.1el8.aarch64pigsty2.5 MiBetcd_fdw_15-0.0.1-3PIGSTY.el8.aarch64.rpm
etcd_fdw_150.0.1el9.x86_64pigsty3.3 MiBetcd_fdw_15-0.0.1-4PGSTY.el9.x86_64.rpm
etcd_fdw_150.0.1el9.aarch64pigsty3.3 MiBetcd_fdw_15-0.0.1-4PGSTY.el9.aarch64.rpm
etcd_fdw_150.0.1el10.x86_64pigsty3.3 MiBetcd_fdw_15-0.0.1-4PGSTY.el10.x86_64.rpm
etcd_fdw_150.0.1el10.aarch64pigsty3.3 MiBetcd_fdw_15-0.0.1-4PGSTY.el10.aarch64.rpm
postgresql-15-etcd-fdw0.0.1d12.x86_64pigsty2.2 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~bookworm_amd64.deb
postgresql-15-etcd-fdw0.0.1d12.aarch64pigsty2.0 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~bookworm_arm64.deb
postgresql-15-etcd-fdw0.0.1d13.x86_64pigsty2.2 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~trixie_amd64.deb
postgresql-15-etcd-fdw0.0.1d13.aarch64pigsty2.0 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~trixie_arm64.deb
postgresql-15-etcd-fdw0.0.1u22.x86_64pigsty2.5 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~jammy_amd64.deb
postgresql-15-etcd-fdw0.0.1u22.aarch64pigsty2.4 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~jammy_arm64.deb
postgresql-15-etcd-fdw0.0.1u24.x86_64pigsty2.4 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~noble_amd64.deb
postgresql-15-etcd-fdw0.0.1u24.aarch64pigsty2.3 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~noble_arm64.deb
postgresql-15-etcd-fdw0.0.1u26.x86_64pigsty2.4 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~resolute_amd64.deb
postgresql-15-etcd-fdw0.0.1u26.aarch64pigsty2.3 MiBpostgresql-15-etcd-fdw_0.0.1-3PGSTY~resolute_arm64.deb

Source

pig build pkg etcd_fdw;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install etcd_fdw;		# install by package name

pig install etcd_fdw -v 19;   # install for PG 19
pig install etcd_fdw -v 18;   # install for PG 18
pig install etcd_fdw -v 17;   # install for PG 17
pig install etcd_fdw -v 16;   # install for PG 16
pig install etcd_fdw -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION etcd_fdw;

Usage

Sources: intro blog, GitHub repo, v0.0.1 release


Quick Start

1. Enable Extension

CREATE EXTENSION etcd_fdw;

2. Create Foreign Data Wrapper

CREATE FOREIGN DATA WRAPPER etcd_fdw
  HANDLER etcd_fdw_handler
  VALIDATOR etcd_fdw_validator;

3. Create Server

-- Basic connection
CREATE SERVER etcd_plain
  FOREIGN DATA WRAPPER etcd_fdw
  OPTIONS (connstr '127.0.0.1:2379');

-- Production etcd with authentication and SSL
CREATE SERVER etcd FOREIGN DATA WRAPPER etcd_fdw OPTIONS (
    connstr '127.0.0.1:2379',
    username 'root',
    password 'Etcd.Root',
    ssl_ca '/pg/cert/ca.crt',
    ssl_cert '/pg/cert/server.crt',
    ssl_key '/pg/cert/server.key'
);

4. Create Foreign Table

-- Basic table mapping all keys
CREATE FOREIGN TABLE etcd_kv (key TEXT, value TEXT) SERVER etcd OPTIONS (rowid_column 'key');

-- Table with prefix filter (only keys starting with '/config/')
CREATE FOREIGN TABLE etcd_config (key TEXT, value TEXT)
  SERVER etcd OPTIONS (rowid_column 'key', prefix '/config/');

5. Query Data

-- Read all keys
SELECT * FROM etcd_kv;

-- Filter by key pattern (pushdown supported)
SELECT * FROM etcd_kv WHERE key LIKE '/app/%';

-- Range query
SELECT * FROM etcd_kv WHERE key >= '/a' AND key < '/b';

-- Insert new key
INSERT INTO etcd_kv (key, value) VALUES ('/mykey', 'myvalue');

-- Delete key
DELETE FROM etcd_kv WHERE key = '/mykey';

6. Real-time Sync with etcd

Changes made outside PostgreSQL are immediately visible:

# Insert via etcdctl
etcdctl put '/config/db_pool_size' '20'
-- Instantly visible in PostgreSQL
SELECT * FROM etcd_config;
     key               | value
-----------------------+-------
 /config/db_pool_size  | 20
(1 row)

Reference

Server Options

OptionRequiredDescription
connstrYesetcd endpoint (e.g., 127.0.0.1:2379)
usernameNoAuthentication username
passwordNoAuthentication password
ssl_caNoCA certificate file path
ssl_certNoClient certificate file path
ssl_keyNoClient private key file path
ssl_servernameNoDomain name for TLS verification
connect_timeoutNoConnection timeout (default: 10s)
request_timeoutNoRequest timeout (default: 30s)

Foreign Table Options

OptionDefaultDescription
rowid_columnRequiredColumn used as unique row identifier
prefixNoneRestrict to keys with this prefix
keys_onlyfalseFetch only keys, skip values
revision0Read at specific etcd revision
key\0Starting key for range scan
range_endNoneExclusive end key for range scan
consistencyll (linearizable) or s (serializable)

Query Pushdown

The following operations are pushed down to etcd for better performance:

  • WHERE: =, >=, >, <=, <, BETWEEN, LIKE 'prefix%'
  • ORDER BY: Remote sorting
  • LIMIT/OFFSET: Remote pagination

Limitations

  • UPDATE on key column is not supported. Workaround: INSERT new key, then DELETE old key.
  • Requires etcd v3 API.

Version Notes

etcd_fdw 0.0.1 is the first public release. It uses pgrx 0.18.1, and the documented SQL surface is the FDW/server/table workflow above.

Table reader