Repository navigation
fix: Refresh the column types of empty results from prepared queries - #676
Merged
Merged
Conversation
A result without rows returned before the column cache was refreshed, so it kept the shape reported by the prepare step. With pg_duckdb, that shape is a placeholder, and `SELECT * FROM read_csv(...) LIMIT 0` returned one `read_csv` column. Immediate queries keep the old behavior, since their statements may return different columns. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc
Member
Author
Accepted limitationsThe clean review (one round) found nothing above Low. On plain PostgreSQL, output is byte-identical to #539 alone: zero-row prepared queries for int8, text, timestamptz, json, numeric and bytea;
Generated by Claude Code |
4 tasks
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.
Follow-up to #539 (merged), for #526; decided in #674 (comment).
With pg_duckdb, the prepare step reports a placeholder shape for some queries. #539 stops enforcing that shape once rows arrive, but a result without rows returned in
step_run()before the column cache was refreshed, so it kept the placeholder:SELECT * FROM read_csv(...) LIMIT 0returned a singleread_csvcolumn instead ofidandname.This PR refreshes the cache from a
PGRES_TUPLES_OKresult too, for prepared queries only. Immediate queries are left as they were, because a multi-statement query such asSELECT 1 AS a WHERE false; SELECT 'x' AS bwould otherwise error instead of returning columnb.No tests added, as requested on #674. Checked locally: the package builds, the full test suite passes against PostgreSQL 16 (0 failures, 9341 passed, 10 skipped), the multi-statement query above still returns column
b, and againstpgduckdb/pgduckdb:17-v1.0.0theLIMIT 0query now returnsidandname(with #539 alone:read_csv).Clean review: nothing above Low; Accepted limitations.
https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc
Generated by Claude Code