Skip to content

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