Repository navigation
Conversation
The Describe phase built its OutputSchema with lookup_key equal to the field name, and the execute path replaced the planner's columns with it. Two output columns sharing a name then read the same cell: rows are written under the unique keys cell_keys derives (id, id_1), so the second column never saw its own value on Parse/Bind/Execute while simple query stayed correct. Merge instead of replace: lookup keys come from the planner, the one derivation that runs cell_keys; the announced schema supplies the client-facing display names and catalog types. An announced arity that disagrees with the plan keeps the announced columns but derives their keys with cell_keys so reader and writer still agree. Tests: unit coverage for the merge (duplicate names keep id/id_1; arity mismatch falls back to derived keys) and two wire cases — SELECT 1 AS id, 2 AS id and a w/b join of bare ids — each asserting its own cell on the prepared path.
Member
|
Closing: right behaviour, wrong place. The producer is |
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.
Why
Over Parse/Bind/Execute (extended protocol), two output columns sharing a name render the same cell:
SELECT w.id, b.id …returns(w1, w1)andSELECT nextval('s'), nextval('s')returns(1, 1).The Describe phase built its
OutputSchemawithlookup_key = display_name = field name(prepared/execute.rs:136-149), and the execute path replaced the planner's columns with it (routing/execute.rs:153-160). Rows are written under the unique keyscell_keysderives (id,id_1), so the second column's cell was never read. Simple query has been correct since the derived-key work.Fixes #337.
What
lookup_keycomes from the planner'sbuild_output_schema— the single derivation that runscell_keys; the announced schema suppliesdisplay_name,ty, andis_star;cp_computedstays the planner's.cell_keys, so the reader still agrees with the row writer.effective_output_schemais private, unit-tested in place; no signature or public-API change.Validation
SELECT 1 AS id, 2 AS id→(1, 2);SELECT w.id, b.id FROM w JOIN b …→(w1, b1). Both cases fail on the currentmain(red:left: 1, right: 2; the join case reportserror retrieving column 0) and pass with the fix (green).cargo check -p nodedb --all-targets— clean.cargo test -p nodedb --lib routing::execute— pass (merge keeps the planner keys; arity mismatch derives announced keys).Notes