Use case
When using Airport to attach a remote DuckDB instance, the current behavior decomposes function calls into TVF descriptors with positional parameters. This works for custom server-defined functions, but breaks for DuckDB-native extension functions like read_csv, read_text, lsr, etc. that:
- Have 40+ parameters with named parameter syntax (
auto_detect:=true)
- Depend on extensions loaded on the remote side (shellfs, hostfs, etc.)
- Have dynamic output schemas that depend on the input
The server IS DuckDB — it can execute any SQL natively. airport_take_flight already sends raw SQL and works perfectly. But ATTACH + USE goes through TVF decomposition, which loses named parameters and requires the server to pre-register every function signature.
Proposal
Add an optional mode parameter to ATTACH:
ATTACH 'grpc://remote:8815' AS remote (TYPE airport, mode passthrough);
USE remote;
-- This SQL is forwarded as-is to the remote DuckDB, not decomposed into TVF calls
SELECT * FROM read_csv('cmd |', auto_detect:=true, header:=false);
In passthrough mode, when the attached catalog receives a query it can't resolve locally (or all queries), it forwards the entire SQL string as a CMD descriptor to the remote — the same path airport_take_flight uses.
The default TVF decomposition behavior stays unchanged for servers that define custom functions. Passthrough mode is for when the remote is a full DuckDB instance and you want ATTACH to be syntactic sugar for airport_take_flight.
Context
Does this make sense as an approach? I don't want to change the default TVF decomposition behavior — just add an optional mode for the remote-DuckDB use case.
Use case
When using Airport to attach a remote DuckDB instance, the current behavior decomposes function calls into TVF descriptors with positional parameters. This works for custom server-defined functions, but breaks for DuckDB-native extension functions like
read_csv,read_text,lsr, etc. that:auto_detect:=true)The server IS DuckDB — it can execute any SQL natively.
airport_take_flightalready sends raw SQL and works perfectly. ButATTACH + USEgoes through TVF decomposition, which loses named parameters and requires the server to pre-register every function signature.Proposal
Add an optional
modeparameter toATTACH:In passthrough mode, when the attached catalog receives a query it can't resolve locally (or all queries), it forwards the entire SQL string as a CMD descriptor to the remote — the same path
airport_take_flightuses.The default TVF decomposition behavior stays unchanged for servers that define custom functions. Passthrough mode is for when the remote is a full DuckDB instance and you want
ATTACHto be syntactic sugar forairport_take_flight.Context
LookupSchemafor DEFAULT_SCHEMA —USE remoteand qualified function calls now workread_csv('cmd |')), hostfs (lsr,read_text), and any extension function with named parametersDoes this make sense as an approach? I don't want to change the default TVF decomposition behavior — just add an optional mode for the remote-DuckDB use case.