-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spannertest: support for aliases in SELECT statements #2463
Comments
There's already support for aliases in SELECT expression lists and FROM clauses, I believe. Do you have an example query not using JOIN that has an alias that doesn't work? |
Using the 1.6.0 version of spanner we get this error message when I run a query: SQL for table:
Test code:
service_test.go:nn: spanner: code = "InvalidArgument", desc = "bad query: unexpected trailing query contents "s.* \n\t\tFROM something as s\n\t\tWHERE s.id = @some_id \n\t\tORDER BY s.created_time ASC\n\t\tLIMIT 1"" |
The missing feature there is the |
I ran a test for that case, and got an error. I tested with and without the
Output:
|
This adds support for aliases in SELECT statements, and in particular table aliases that can then be referenced from other places in the query evaluation. Fixes #2463.
Is your feature request related to a problem? Please describe.
To make our queries shorter and easier to read we use aliases in our queries. We want to unit test code that has such queries.
Example:
Granted, at this point there is no support for
JOIN
inSELECT
statements, but we are hoping that this will be added, so that we can properly unit test our code.Describe the solution you'd like
We would like to se aliases in
SELECT
statements.Describe alternatives you've considered
The only viable option would be to spin up a new table in one of our projects, but that is out of scope for unit tests.
Additional context
Ẃe have another feature request for JOIN in SELECT statements, that is by far a more important feature. This would be a further quality of life improvement, we can write queries without aliases, though it would be nice to have them.
The text was updated successfully, but these errors were encountered: