andrewoma/kwery

SQL column names must be escaped

Miha-x64 opened this issue · 4 comments

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

Maybe try using a custom naming convention that applies quotes:

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

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

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

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