You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(wire): honor binary result-format codes on the live-data path
Power BI Desktop / Tableau and other Npgsql/pgjdbc clients bind result
columns for binary in the extended-query protocol, but the gateway emitted
text-format DataRows unconditionally. Binary-decoding text bytes fails for
every type except varchar (whose binary and text wire forms are identical),
which surfaced as "ERROR on Float/Integer/Timestamp columns, strings fine"
in the Power BI Navigator preview while the full (text) data load worked.
Real PostgreSQL honors the Bind request and sends binary, which was the one
concrete behavioural difference.
Honor the portal's `result_column_format` on the live-data path:
- `types::encode_cell` dispatches per-column on the requested `FieldFormat`
and converts Trino JSON values to typed Rust values so pgwire's
`DataRowEncoder` emits PostgreSQL binary: bool, int2/4/8, float4/8,
numeric, date, time, timestamp (without tz); the string family passes
through as bytes (binary == text). Unsupported types fail closed
(SQLSTATE 0A000) rather than emit bytes the client would misread; SQL
NULL is handled once (format-independent -1 length).
- `trino_stream::build_pg_schema` sets each column's format from the portal,
threaded through `process_query` -> `execute_trino_query`. The simple-query
path stays text (it never negotiates binary).
The static catalog/intercept path remains text-only (type-loading drivers
request text there); tracked as follow-up.
Tests:
- Byte-level unit tests for `encode_cell` in `types.rs` (no Trino).
- The three extended-protocol tests that were `#[ignore]`'d for this are
re-enabled, plus a new test covering the customer's exact column types
(bigint, real, double, timestamp). Verified end-to-end against Trino 479:
they pass with the fix and fail with "error deserializing column" when the
schema-format line is reverted.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments