I originally thought its a bug in a older 6.6.x version but after upgrading to 7.0.3 it still happens. If you go and have a N1QL query that has a field like admin in it , no matter if it is admin or c.admin it will query correctly but as soon as the result is returned, the text in the actual query changes from admin to an All capital ADMIN. I can not see that this is a desired behavoir.
Also is there a list of reserved words in N1QL as they seem to have changed from 6.6 to 7.X, in 6.6 the worrd level did not have to be escaped, without escape in 7.x the query will fail.
cc @eben ,
Yes level is reserved word part of transaction statement: SET ISOLATION LVEL …
Reserve words : Reserved Words | Couchbase Docs
or query/parser/n1ql/n1ql.nex at master · couchbase/query · GitHub
@aponnath Can you give some more details? I created a document with a field called ‘admin’, and when I query it the capitalization doesn’t appear to change:
select admin from test;
[
{
"admin": "me"
}
]
Are you using cbq or the admin GUI? Where do you see the field name in upper case?
@aponnath - it looks like the problem is the query formatter, which is formatting roles such as “admin”. There are a few workarounds you can use:
- put back ticks around the name, e.g.
select `admin` from test
- turn off formatting in the query workbench options (the gear icon in the upper right).
The formatter is nice but the ticks don’t work well if you use your N1QL workbench to build query and then move it to a NodeJS API as then you have to escape the backticks.
Just wondering was that an oversight / bug of the formatter ? I don’t see the logic to capitalize ADMIN by default as most languages are case sensitive
Yes, the problem with the formatter is an oversight, and I’m putting a fix in for the next release. It’s probably not a high enough priority to get fixes into the previous versions, however, so the work-arounds will have to suffice for those cases.
No worries, i agree that this is not urgent and no need to fix it backwards. I am happy just to know its a bug and not something i made up in my mind