Skip to content

[DON'T MERGE] Code change to upstream#1

Draft
qsliu2017 wants to merge 14 commits intomainfrom
pgducklake
Draft

[DON'T MERGE] Code change to upstream#1
qsliu2017 wants to merge 14 commits intomainfrom
pgducklake

Conversation

@qsliu2017
Copy link

No description provided.

qsliu2017 and others added 13 commits February 12, 2026 15:49
Add a C-exported function that returns a void* pointer to the DuckDB
database instance managed by pg_duckdb. This allows external PostgreSQL
extensions (e.g. pg_ducklake_next) to access the DuckDB instance for
loading statically-linked DuckDB extensions via LoadStaticExtension<T>().

Follows the same pattern as RegisterDuckdbTableAm in pgduckdb_table_am.cpp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
External extensions (e.g. pg_ducklake) need to call
LoadStaticExtension() but cannot do so during _PG_init() because the
DuckDB instance is not yet initialized. This adds a callback
registration API so external extensions can register a loader that
pg_duckdb invokes during DuckDBManager::Initialize(), after the
instance is fully configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add extern "C" with default visibility to these two functions so
pg_ducklake can resolve them at runtime for CTAS support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add pg_ducklake's extension OID check to BuildDuckdbOnlyFunctions() so
functions registered by pg_ducklake (e.g. ducklake.options()) are
recognized as DuckDB-only functions and routed correctly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Set DDLType::ALTER_TABLE for tables using registered external AMs
  (e.g. ducklake) in utility hook, not just native duckdb tables
- Export DuckdbIsAlterTableInProgress() for external extensions
- Export pgduckdb_get_alter_tabledef() and pgduckdb_get_rename_relationdef()
  with extern "C" visibility for use by external extensions
- Fix pgduckdb_get_rename_relationdef() to use actual table AM name instead
  of hardcoded "duckdb"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Exports DuckdbAllowSubtransaction(bool) so that extensions like
pg_ducklake can temporarily suppress the SAVEPOINT check in the
subxact callback while starting an internal PostgreSQL subtransaction
as part of a DuckDB-coordinated metadata commit.

Declared in pgduckdb_contracts.h for use by downstream extensions.
Wraps DuckDBManager::IsInitialized() as an extern "C" visible symbol
so downstream extensions can check whether DuckDB has been initialized
in the current backend without triggering lazy initialization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add DuckdbLockGlobalProcess/DuckdbUnlockGlobalProcess exports so
pg_ducklake can acquire the lock across DSO boundaries without
depending on the C++ header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…views

Add "time_travel" to DuckDB-only function list. Expand duckdb.row columns
to proper PostgreSQL types in CREATE VIEW for queries requiring DuckDB
execution, so pg_attribute shows real column names and types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Register external table check and relation name callbacks so
  downstream extensions can route foreign tables through DuckDB
- Export GetPostgresDuckDBType/Typemod with default visibility
  for column inference in pg_ducklake's FDW

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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