Repository navigation
v2026.09.04 — scans that can be run twice, and a backend with no known gaps
sap_read_table gains row-range partitioning, and the three extensions gain one tuning
vocabulary. The reason this is one release rather than two is the second half of the list:
four separate silent wrong-results defects, all in released erpl, all returning data
rather than failing.
The sharpest is that a re-scanned sap_read_table returned nothing at all — a prepared
statement, a nested-loop join or an un-materialised CTE referenced twice would silently
answer zero rows on the second scan. If you use erpl from a prepared statement or in a
join, upgrade.
The erpl-proto backend also passes every suite with no recorded gaps for the first time.
Added
-
[rfc]
sap_read_tablecan now split a scan by rows. Parallelism was per
column — one concurrentRFC_READ_TABLEcall per projected column — so a narrow
extract got none at all, and raisingthreadsdid nothing.partitionshands each
worker a row window read withROWSKIPS/ROWCOUNT. Measured on a 164,664-row
single-column extract: 2.23s unpartitioned, 0.83s at eight partitions (2.7x),
with the knee visible at eight. Opt-in, because partitioned workers finish in
whatever order they finish while an unpartitioned scan returns rows sorted. -
[rfc]
erpl_rfc_partitionsanderpl_rfc_partition_window_rows, plus a
partitionsnamed parameter. -
[rfc] One tuning vocabulary across the extensions. Paging and parallelism were
spelled differently everywhere: RFC hadTHREADSpluserpl_rfc_read_table_batch_budget,
ODP hadthreadsand no settings at all, BICS had neither.threads/
erpl_rfc_max_threadsandfetch_size/erpl_rfc_fetch_sizenow mean the same thing
wherever they appear, andfetch_sizeis settable per query rather than per session.
No breaking renames —erpl_rfc_read_table_batch_budgetstill works and writes the same
value. -
[odp]
erpl_odp_fetch_sizeanderpl_odp_max_threads, ODP's first settings.
I_MAXPACKAGESIZEwas compiled in at 2 MiB and reachable from nowhere, so round-trips
could not be traded against per-packet memory. -
[bics]
sap_bics_beginhonours itsrows,columnsandfiltersparameters.
They were declared and never read — accepted with no error and no effect. Building a
query this way also costs three fewer full session round-trips. -
[rfc]
sap_rfc_live_connections(),sap_rfc_connections_opened()and
sap_rfc_connections_closed()report how many SAP RFC connections erpl has opened,
closed and still holds. Between queries the live count should be 0 — a non-zero value
means SAP sessions are still reserved, which client-side timing cannot reveal.
Fixed
-
[odp]
PRAGMA sap_odp_close_delta_cursornever closed anything. It matched the
cursor on(SUBSCRIBER_PROC, QUEUENAME)and took the first row, but SAP retains every
closed cursor as history, so that pair routinely has a dozen rows — the open one was
found at position 7 behind six closed rows from previous days. The pragma reported
'CLOSED'without ever callingRODPS_REPL_ODP_CLOSE, so delta cursors accumulated
server-side while cleanup looked like it was working.Two more defects sat in the branch that made unreachable: every exception was reported
as'CLOSED', and the call'sET_RETURNwas never read —RODPS_REPL_ODP_CLOSEreturns
RFC_OKeven when it refuses, so a rejected close was indistinguishable from a
successful one. Behaviour change: two new results, neither of which raises —
'REFUSED: <SAP message>'when SAP rejects the close (typically
ILLEGAL_REQ_STATE_FOR_CONFIRM, meaning the request was left mid-fetch and only
sap_odp_dropwill clear it) and'STILL_OPEN'when the cursor survives a call that
reported no error. -
[odp]
sap_odp_read_fullcrashed atthreads := 8on a source with fewer packages
than workers — a null local state, dereferenced unconditionally. -
[bics] The result-size refusal message stated what a query would really cost. BICS
memory scales with result rows, not data cells, so the cell-derived figure it used
to quote understated a 46,755-row result by 19x — and suggested raising a setting that
would have let the query through and then run the process out of memory. -
[rfc]
sap_rfc_invokefailed on any module whose result parameters are all
tables.RFC_READ_TABLEis the canonical case — its results areDATA,FIELDS
andOPTIONS, with no scalar export — and invoking it raised
Unimplemented type for cast (STRUCT(WA VARCHAR) -> STRUCT(WA VARCHAR)[]).The result was treated as pivoted whenever every value happened to be list-shaped,
so rows were unnested into columns still declaredLIST(STRUCT). Detection now also
requires each element type to match its declared column type, which distinguishes
genuinely pivoted (path-selected) data from a bare invoke. Selecting a table through
path :=still pivots to the row's fields, as before. -
[rfc]
MAX_ROWScombined withpartitionshung. The unpartitioned path trims
ROWCOUNTto land exactly on the limit, which a partitioned window cannot do because
ROWCOUNTmust stay batch-aligned; it over-fetches the final batch, and the clip then
left the read spinning with rows it would never emit. -
[rfc] The runtime
RFC_READ_TABLEfallback reassigned astd::stringon the
bind data from execute time. Column-parallel reads already made that reachable from
two tasks at once; it is now serialised. -
[rfc]
fetch_sizeandpartitionsdid nothing to the batch size of a
single-column scan.MaxBatchSizeForColumnCountreturned the full 32768-row cap
whenever a scan projected one column, discarding the budget that
ResolveEffectiveMaxBatchSizehad just divided across the partition workers — so every
worker asked SAP forROWCOUNT=32768howevererpl_rfc_fetch_sizeandpartitions
were set. The exemption was deliberate, on the reasoning that a narrow scan is already
under any sane budget; that reasoning ignored the division, and a narrow scan is
precisely what partitioning exists for.Measured on a 300,000-row single-column read at
partitions = 8: peak RSS 405 MB →
307 MB (−24%) with no loss of throughput (2.17s → 2.07s). The budget now binds for
every column count; only a zero budget or a scan with no projected column bypasses it. -
[rfc] A partitioned scan never returned its allocator arenas to the OS. The serial
path callsmalloc_trim(0)when the scan finishes, but each partition worker retires on
a different code path that did not, so every worker thread's glibc arena kept its
high-water mark — which is whatgetrusagereports. -
[rfc] A partitioned scan past the
ROWSKIPSceiling returned a truncated result
instead of refusing. The row-window scheduler signalled the ABAPINT4limit by
returning "no more windows", which is the same answer it gives at the end of a table —
and a worker retires on an empty chunk, which DuckDB reads as end-of-scan. A scan beyond
2,147,483,647 rows therefore produced a silently short answer, whileAPI_REFERENCE
states that erpl refuses rather than wrapping. It now raises, naming the limit.The same guard was off by one and refused the last legal window (start
2,147,450,880 at a 32768-row window). Both are covered by new boundary tests. -
[rfc] The
RFC_READ_TABLEfallback could retry without limit. After the runtime
fallback had switched functions, the selection call returns a cached success, and the
retry branch neither counted the attempt nor slept — so a secondTABLE_WITHOUT_DATA
from the fallback function became a tight loop against the SAP system, once per
partition worker. It now retries only when the selected function actually changed, and
otherwise reports the original error. -
[rfc] A re-scanned
sap_read_tablesilently returned nothing. The column state
machines lived in bind data, which DuckDB reuses across executions of one bound plan,
so the second scan resumed from an exhausted cursor:PREPARE q AS SELECT count(*) FROM sap_read_table('SFLIGHT'); EXECUTE q; -- 94 EXECUTE q; -- 0 <- no error
Any re-scanned plan hit it: a prepared statement, a nested-loop join, an
un-materialised CTE referenced twice. Serial scans now build their machines in the
global state, which DuckDB rebuilds per execution — the pattern the partitioned path
already used, which is whyPARTITIONSwas never affected.The same defect was present in
sap_show_tables,sap_odp_show_subscriptionsand the
internal table lister behindATTACH; all three are fixed. -
[rfc] The persistent-connection budget was spent permanently.
erpl_rfc_max_persistent_connectionswas a monotonic counter on bind data that never
released a slot, so a second execution of a bound plan began with the budget already
exhausted and every scan fell back to per-batch open/close. Slots are now leased:
released when the connection is dropped, reset per execution. -
[rfc] A long scan could follow a secret replaced underneath it. The DuckDB
secret was re-resolved on every connection open, so replacing it mid-query could send
later windows of the same scan to a different SAP system, with no error. Credentials are
now resolved once per execution. -
[rfc] Setting a trace option while tracing was enabled deadlocked the process.
erpl_trace_level,erpl_trace_outputand the other setters logged their own change
while holding the tracer mutex, which the writer re-locks. The sequence documented for
diagnosing SAP communication was itself the trigger; it presents as a hung query.
Changed
- [all] The
erpl-protobackend is pinned tov2026.9.2.1, and its known-failure
list is now empty. The previous pin carried a table-delta padding gap
(sap_rfc_struct_layout), and the releases that fixed it regressed BICS from 45/45 to
23/45 on a nested-TTYPbasXML defect. Both are now fixed upstream, so every suite
passes on the proto backend with no recorded gaps for the first time: RFC 34/34,
ODP 25/25, BICS 45/45.
Build
- [all] The
erpl-protobackend is pinned to thev2026.8.29.1release rather than
an untagged commit.