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
fix(pgwire): keep both cells when two output columns share a name
`SELECT w.id, b.id FROM w JOIN b ON ...` returned the right table's
value in BOTH columns. The join executor and planner were correct — the
merged row carries `w.id` and `b.id` and `project_row` read each by its
qualified lookup key — but the shaped row is a JSON map keyed by the
column's DISPLAY name, and an unaliased qualified projection displays as
its bare last segment. Both columns keyed on `id`, so the second insert
overwrote the first and every encoder then re-read that one cell by name.
Aliasing (`w.id AS w_id`) produced distinct display names and was
unaffected, which is why the bug only showed on the unaliased spelling.
Shaped rows now store each column's cell under a unique key from
`response_shape::project::cell_keys` — the display name for the first
occurrence, `<name>_<n>` for later duplicates, skipping any candidate
that would shadow another column's name. The three consumers (pgwire
non-streaming and streaming encoders, native conversion) derive the same
keys, so they stay aligned. Wire column names are unchanged: duplicates
still describe as `id`, `id`, matching PostgreSQL. For a duplicate-free
column list the mapping is the identity, so nothing else changes.
Tests: unit coverage for `cell_keys` and duplicate-name `project_row`;
sql_join_correctness gains the unaliased and aliased join projections.
0 commit comments