Skip to content

fix(api): qualify column names in device queries with JOINs#6130

Merged
gustavosbarreto merged 1 commit intomasterfrom
fix/ambiguous-column-device-query
Apr 7, 2026
Merged

fix(api): qualify column names in device queries with JOINs#6130
gustavosbarreto merged 1 commit intomasterfrom
fix/ambiguous-column-device-query

Conversation

@gustavosbarreto
Copy link
Copy Markdown
Member

Summary

  • Device queries that JOIN with namespaces produce ambiguous column references for columns present in both tables (e.g. name), causing ERROR: column reference "name" is ambiguous (SQLSTATE 42702)
  • Propagate CtxTableAlias through filter, sort, and status query options so all column references are table-qualified
  • Set CtxTableAlias to "device" in DeviceList and DeviceResolve, same pattern already used by sessions

Device queries that JOIN with namespaces produce ambiguous
column references for columns present in both tables (e.g.
"name"). Propagate CtxTableAlias through filters, sort, and
status options so all column references are table-qualified.
@gustavosbarreto gustavosbarreto requested a review from a team as a code owner April 7, 2026 18:11
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Claude finished @gustavosbarreto's task in 3m 30s —— View job


Code Review Complete

Reviewed 3 files across code quality, security, testing, Go patterns, and architecture — no issues found. The code looks good as-is.

The fix correctly follows the existing CtxTableAlias pattern already established by sessions, the qualifyColumn helper properly uses bun.Ident for safe identifier quoting, and the ParseFilterProperty signature change has no cross-repo impact (the internal package prevents external imports, and cloud/ uses its own mongo-based variant).


To request another review round, comment /review.

@gustavosbarreto gustavosbarreto merged commit b2122bd into master Apr 7, 2026
20 of 21 checks passed
@gustavosbarreto gustavosbarreto deleted the fix/ambiguous-column-device-query branch April 7, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant