Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
sql: column names not being passed correctly #36501
Describe the problem
In psql if you give an alias to a column it will pass that name along:
In CRDB, with a single column, we do not pass the name correctly:
What did you do? Describe in your own words.
If possible, provide steps to reproduce the behavior:
This appears to be a regression in the CBO. Here's a reproduction:
I'll take a first look. Here's a smaller repro:
Note how the column changed name when it shouldn't have.
I believe the problematic code is here:
We should only be doing this if the column didn't have an alias. Not entirely sure how to make that distinction at this point though - maybe add a flag to
Yea, I think I just copied the logic from the heuristic planner and didn't check what Postgres was doing. Although it sounds like I might have made an error in copying from the heuristic planner, too. Anyway, I think we should just get rid of those lines that you found.
Thanks for investigating!