Skip to content

fix: Override types of aliased columns and named parameters #1884

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

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

haines
Copy link
Contributor

@haines haines commented Oct 6, 2022

Fixes #606
Fixes #1752
Fixes #1864

Column type overriding fails when columns are aliased or parameter names do not match the underlying column.

This PR makes the compiler preserve the original column name if a column is aliased in a query or if a named parameter is used instead of a numbered one, and uses that name (if present) to check for a matching type override in the config.

@haines haines force-pushed the override-column-types branch from 09bf173 to 5a3e0c2 Compare October 14, 2022 08:58
@haines haines force-pushed the override-column-types branch 2 times, most recently from 1d419ec to 32556c0 Compare October 25, 2022 14:17
@haines haines force-pushed the override-column-types branch from 32556c0 to d6cbd2c Compare November 10, 2022 15:59
@haines haines force-pushed the override-column-types branch from d6cbd2c to 2ff3b63 Compare November 30, 2022 13:19
@haines haines force-pushed the override-column-types branch from 2ff3b63 to 1004300 Compare February 2, 2023 12:26
@haines haines force-pushed the override-column-types branch from 1004300 to f3405f5 Compare February 14, 2023 12:20
@StevenACoffman
Copy link
Contributor

@haines Thanks for keeping this fresh! @kyleconroy We are using this patch and it is working well for us!

@haines haines force-pushed the override-column-types branch from f3405f5 to 7b3861e Compare February 23, 2023 12:53
@haines
Copy link
Contributor Author

haines commented Feb 23, 2023

@kyleconroy could you please take a look?

@haines haines force-pushed the override-column-types branch from 67293b7 to fe18361 Compare June 6, 2023 14:35
@kyleconroy kyleconroy merged commit 99ecfff into sqlc-dev:main Jun 7, 2023
@haines haines deleted the override-column-types branch June 8, 2023 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants