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

Support for uppercase table name #168

Open
PeterIvanov opened this issue Jul 10, 2020 · 5 comments
Open

Support for uppercase table name #168

PeterIvanov opened this issue Jul 10, 2020 · 5 comments

Comments

@PeterIvanov
Copy link

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:

table.New(table.Metadata{
  Name:    "aBc", 
  ...
})

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.

@mmatczuk
Copy link
Contributor

OK, so what is the use-case you have multiple tables with similar names like Abc and aBc?

@PeterIvanov
Copy link
Author

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.

@PeterIvanov
Copy link
Author

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.

@mmatczuk
Copy link
Contributor

Adding that for tables names is trivial, adding for fields is more complicated. Would you mind sending a PR?

@PeterIvanov
Copy link
Author

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.

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

No branches or pull requests

2 participants