Skip to content

Warn on duplicate column names #80

@vmvarela

Description

@vmvarela

Description

When a CSV has duplicate column names (e.g., two columns both named value), sql-pipe silently renames them by appending a suffix (value, value_1, value_2). The user has no way to know this happened and may write queries against the original names that silently select the wrong column.

Example

$ printf 'id,value,value\n1,a,b' | sql-pipe 'SELECT value_1 FROM t'
b

The user expected column value but had to guess the renamed form value_1.

Acceptance Criteria

  • When one or more column names are deduplicated, print a warning to stderr listing each rename: warning: duplicate column "value" renamed to "value_1"
  • Warning is written to stderr so it does not corrupt stdout (CSV/JSON output)
  • Warning is suppressed when stderr is not a TTY (pipe mode) — or printed always, consistently; decide and document
  • Existing tests still pass; add a test for the warning message

Notes

  • Deduplication logic is in src/main.zig around lines 356–364
  • Format: warning: duplicate column "<original>" renamed to "<new>" (one line per rename)

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highMust be in the next sprintsize:xsTrivial — less than 1 hourstatus:readyRefined and ready for sprint selectiontype:bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions