Skip to content

fix(sql): keep one cell per duplicate constant column - #327

Open
EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/constant-row-cell-keys
Open

EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/constant-row-cell-keys

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

SELECT nextval('a'), nextval('a') legally repeats an output name. The constant-result row is a JSON object keyed by column name, so the second cell overwrote the first and both wire columns rendered the last value. The payload and the output schema's lookup keys now use the same unique per-column keys every response encoder derives.

Red proof (the test fails on main without the fix)

────────────
     Summary [  10.891s] 1 test run: 0 passed, 1 failed, 10256 skipped
  TRY 2 FAIL [   4.311s] (1/1) nodedb::wire cases::sql_sequences::duplicate_constant_column_names_keep_their_own_cells
error: test run failed

Validation (local, on this branch)

Check Result
the new test, with the fix 1 passed
related suites: sql_sequences + cell_keys + output_schema 53 passed
cargo fmt --all no change
cargo clippy -p nodedb --all-targets --all-features --profile ci -- -D warnings clean
repository hygiene gate (test registry, comment and commit hygiene, module contracts) pass

One commit; touches sql_plan_convert/output_schema/build.rs, sql_plan_convert/set_ops.rs, and the new wire test only.

`SELECT nextval('s'), nextval('s')` legally repeats an output name. The
constant-result row is a JSON object keyed by column name, so the second
cell overwrote the first and both wire columns rendered the last value.

Key the payload and the output schema's lookup keys by the same unique
per-column keys every response encoder derives, so each column keeps its
own cell.
Copilot AI lite review requested due to automatic review settings September 16, 2026 06:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@farhan-syah farhan-syah added the run-ci Opt this PR into the full test suite; re-add to force a re-run label Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Opt this PR into the full test suite; re-add to force a re-run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants