Open PeterIvanov opened 4 years ago
OK, so what is the use-case you have multiple tables with similar names like Abc and aBc?
My particular use-case is that the table name is provided externally, the table itself happens to have uppercase letters in its name, so queries provided by (for example) table.Table::Insert()
fail.
https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/ucase-lcase_r.html Table 'What Works and What Doesn't' here describes the issue some more. If a table is created with uppercase characters, queries with lowercase name (or with uppercase name, unquoted) won't work.
Adding that for tables names is trivial, adding for fields is more complicated. Would you mind sending a PR?
I'm not sure there isn't some subtle issues here or backwards compatibility concern that I'm not aware of, hence the issue, not a PR. Yes, I'll consider sending a PR. Just thought it is a good thing to report this as an issue right away.
https://github.com/scylladb/gocqlx/blob/master/qb/select.go#L83 https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/ucase-lcase_r.html
Unless enclosed in double quotation mark, identifier is case-insensitive. Currently, construrct like this:
doesn't work unless you manually add quotes to name, which is creepy and seems likely to break something in the future. Possibly, the same problem exists for some other identifiers.
The solution seems to be to always enclose identifiers in double quotation mark in generated statements.