Skip to content

feat: add ducklake_fdw for read-only access to DuckLake tables#59

Merged
qsliu2017 merged 5 commits intomainfrom
refactor/simplify-fdw
Mar 5, 2026
Merged

feat: add ducklake_fdw for read-only access to DuckLake tables#59
qsliu2017 merged 5 commits intomainfrom
refactor/simplify-fdw

Conversation

@qsliu2017
Copy link
Collaborator

@qsliu2017 qsliu2017 commented Mar 4, 2026

Summary

Add ducklake_fdw, a read-only Foreign Data Wrapper for DuckLake tables. Supports both PostgreSQL-backed metadata catalogs and frozen HTTP-hosted .ducklake snapshots.

Queries route through DuckDB via pg_duckdb's external-table-check hook, preserving vectorized execution. Column definitions are auto-inferred at CREATE FOREIGN TABLE time.

Test plan

  • All 19 regression tests pass (including fdw and frozen_fdw)
  • All 2 isolation tests pass
  • CI across PG 14-18

Add a PostgreSQL Foreign Data Wrapper that provides read-only access to
DuckLake tables, supporting both regular PostgreSQL-backed metadata
catalogs and frozen HTTP-hosted .ducklake snapshots.

Key design decisions:
- Queries route through DuckDB via pg_duckdb's external-table-check
  hook rather than FDW scan callbacks, preserving DuckDB's vectorized
  execution for full query plans.
- Column inference at CREATE FOREIGN TABLE time probes the remote
  schema via a temporary DuckDB connection, so users never specify
  column definitions manually.
- DML is blocked at plan time with clear error messages.
- Reuses pg_duckdb's GetPostgresDuckDBType/Typemod for type mapping
  (exported with default visibility in the submodule update).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qsliu2017 qsliu2017 force-pushed the refactor/simplify-fdw branch from d38e061 to b1519ce Compare March 4, 2026 13:47
The previous commit referenced the old submodule pointer. This updates
it to include the hooks and visibility exports needed by ducklake_fdw.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qsliu2017 qsliu2017 force-pushed the refactor/simplify-fdw branch 3 times, most recently from dfc3b25 to 40d28d7 Compare March 5, 2026 06:31
@qsliu2017 qsliu2017 force-pushed the refactor/simplify-fdw branch from 40d28d7 to 342ac05 Compare March 5, 2026 06:56
qsliu2017 and others added 2 commits March 5, 2026 15:10
The function signature differs across PG versions:
- PG 14-16: 10 args (no fdw_restrictinfo)
- PG 17: 11 args (added fdw_restrictinfo)
- PG 18: 12 args (added disabled_nodes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unrelated .dockerignore changes (belong to duckdb-postgres PR)
- Eliminate namespace forwarding wrapper for RegisterForeignTablesInQuery
- Restore original header comment in pgducklake_duckdb.hpp
- Fix #pragma once placement in pgducklake_fdw.hpp

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qsliu2017 qsliu2017 merged commit e1a33e8 into main Mar 5, 2026
5 checks passed
@qsliu2017 qsliu2017 deleted the refactor/simplify-fdw branch March 5, 2026 07:44
@qsliu2017 qsliu2017 mentioned this pull request Mar 5, 2026
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant