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

SQL column names must be escaped #19

Open
Miha-x64 opened this issue Oct 1, 2017 · 4 comments · May be fixed by #24
Open

SQL column names must be escaped #19

Miha-x64 opened this issue Oct 1, 2017 · 4 comments · May be fixed by #24

Comments

@Miha-x64
Copy link

Miha-x64 commented Oct 1, 2017

AbstractDao#findById executes such SQL for me:

select id, urlPathComponent, metaTitle, metaDescription, metaKeywords, linkText, h1, description, sortIndex, lastModified 
from whatever 
where id = :id

which is incorrect for PostgreSQL dialect: it requires camelCase column names to be in quotes, at least like this:

select id, "urlPathComponent", "metaTitle", "metaDescription", "metaKeywords", "linkText", h1, description, "sortIndex", "lastModified" 
from whatever 
where id = :id
@Miha-x64 Miha-x64 changed the title AbstractDao should escape column names SQL column names must be escaped Oct 1, 2017
@andrewoma
Copy link
Owner

Maybe try using a custom naming convention that applies quotes:

val namingConvention: (String) -> String = camelToLowerUnderscore)

@Miha-x64
Copy link
Author

Miha-x64 commented Oct 1, 2017

Column names remain unchanged in SQL: they neither getting underscored (by default namingConvention), nor quoted (after adding TableConfiguration).

@andrewoma
Copy link
Owner

Sounds a bit surprising. I'll have a look tomorrow my time

@Miha-x64
Copy link
Author

Maybe that's because I specify col names explicitly. And it looks quite uncomfortable and dangerous to write "\"columnName\"" in every table.

@Miha-x64 Miha-x64 linked a pull request Dec 9, 2017 that will close this issue
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 a pull request may close this issue.

2 participants