Repository navigation
Add extensions option for foreign servers - #426
Draft
iskakaushik wants to merge 1 commit into
Draft
iskakaushik wants to merge 1 commit into
iskakaushik wants to merge 1 commit into
Conversation
iskakaushik
force-pushed
the
extensions-option
branch
2 times, most recently
from
October 15, 2026 23:41
d30b267 to
cf7a706
Compare
pg_clickhouse pushes down objects from every extension it supports and finds installed: hstore, re2, intarray, fuzzystrmatch, pgcrypto, and pgvector. There was no way to keep an extension's objects local for a server, and the `shippable_extensions` plumbing inherited from postgres_fdw was dead code, always `NIL`. Add the `extensions` server option, a comma-separated list of extension names, as in postgres_fdw. The validator warns about extensions that aren't installed. `clickhouseGetForeignRelSize()` parses the option into `fpinfo->shippable_extensions` and adds pg_clickhouse itself, so that its own functions always push down and a set list is never `NIL`. `chfdw_is_shippable()` now checks that list after `chfdw_check_for_custom_operator()`, `chfdw_check_for_custom_function()`, or `chfdw_check_for_custom_type()` recognizes an object. The option thus only narrows pushdown, and the global custom object cache holds no per-server state. The check uses the per-server shippability cache to avoid repeated `pg_depend` lookups. Nothing changes when the option is unset. Unlike postgres_fdw, listing an extension does not push down objects pg_clickhouse doesn't recognize, so remove that fallback path. Listing an extension pg_clickhouse doesn't support has no effect. Test vector sorts with the option set to `hstore`, set to `vector`, and unset in `vector_pushdown.sql`. Test the intarray `idx()` function and the warning for an extension that isn't installed in `udf.sql`.
iskakaushik
force-pushed
the
extensions-option
branch
from
October 16, 2026 17:01
cf7a706 to
4f3af46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an
extensionsoption for foreign servers, a comma-separated list of extension names, as in postgres_fdw:ALTER SERVER ch OPTIONS (ADD extensions 'vector, re2');This lets a server keep an extension's functions and operators local, for example while a ClickHouse version mishandles one of them.
How it works
SplitIdentifierString(), like postgres_fdw'sExtractExtensionList(). A name that isn't installed gets a WARNING; bad list syntax is an ERROR.clickhouseGetForeignRelSize()fillsfpinfo->shippable_extensions, which was alwaysNIL. It appends pg_clickhouse itself, so that its own functions, such asdictGet(), always push down, and so that a set list is neverNIL.chfdw_is_shippable()checks the list only afterchfdw_check_for_custom_operator(),_function(), or_type()has recognized an object. So the option can only narrow pushdown, and the global custom object caches stay free of per-server state. Lookups go through the existing per-serverShippableCacheHash, whichALTER SERVERalready invalidates.Notes for review
citext, has no effect and no warning, as the docs say. Warning would mean keeping a second list of supported extensions in sync withcustom_types.c.hstore, set tovector, and unset invector_pushdown.sql. They also cover intarray'sidx()and the not-installed warning inudf.sql.vector_pushdown.sqlcreates hstore only for its block, so thatextensions 'hstore'names an installed extension.