fix: count column aliases only once#2399
Conversation
Alias column names don't exist in the table definition. When we take it from the select target list, we only need to do this once (and not once for every table in a join statement). Refs: sqlc-dev#2398 sqlc-dev#1886
|
Thanks for this and sorry for the delay. There is definitely a bug, but I don't know if restricting the restarget counting is the right fix (although your change does seem to have "fixed" the bug). The issue seems to be that sqlc doesn't understand what list of refs the aliases in I'm going to dig in a little bit and see if I can come up with a recommendation for a different approach. |
|
After poking around a little, I think your solution is basically correct. I opted to pull the loop checking for aliases in the target list out of the table iteration loop, which I think is the right thing to do. The PR I have is here: #2537. If you see an issue with that please leave a comment over there. If my PR gets merged then I'll close this PR. |
… joins (sqlc-dev#2537) * fix(compiler): correctly validate alias in order/group by clauses for joins Resolves sqlc-dev#1886 Resolves sqlc-dev#2398 Resolves sqlc-dev#2399 * remove dead code and split up test
Alias column names don't exist in the table definition. When we take it from the select target list, we only need to do this once (and not once for every table in a join statement).
Refs: #2398 #1886