Skip to content
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

fix(postgresql): Add quotes for CamelCase columns #1729

Merged
merged 1 commit into from
Jul 10, 2022

Conversation

akutschera
Copy link
Contributor

If columns are created with CamelCase, they have to be quoted or else
postgres won't find them.

This PR only applies to SELECT * FROM tablename queries. When the column names are specified individually with quotes, it already works.

fixes #1718

If columns are created with CamelCase, they have to be quoted or else
postgres won't find them.
if c.conf.Engine == config.EnginePostgreSQL {
// camelCase means the column is also camelCase
if strings.ToLower(ident) != ident {
return "\"" + ident + "\""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 This will solve the problem where columns are in camel case and should not break anything.

@kyleconroy kyleconroy merged commit 69593d1 into sqlc-dev:main Jul 10, 2022
@gurleensethi
Copy link

@kyleconroy Can we release a new version of SQLC that contains this functionality?

jlisthood pushed a commit to jlisthood/sqlc that referenced this pull request Apr 28, 2023
If columns are created with CamelCase, they have to be quoted or else
postgres won't find them.
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.

No quotes around column names in Postgres
3 participants