n1QL role attribute error in where clause


#1

Hi the Community
i have a simple request in N1QL (DP4) wich generate a syntax error when i use the attribute role in the where clause :

select role in catalog where role=“SELLER”

{
“requestID”: “96b6b17d-3fcd-440d-ba24-845294b22c6a”,
“errors”: [
{
“code”: 5000,
“msg”: “syntax error”
}
],
“status”: “fatal”,
“metrics”: {
“elapsedTime”: “1.0001ms”,
“executionTime”: “1.0001ms”,
“resultCount”: 0,
“resultSize”: 0,
“errorCount”: 1
}
}

is it a bug ?

Best regards
Bruno


#2

Hi Bruno,

Role is a reserved word. Try

SELECT `role` …

We are also improving the syntax error message to show where the error happened.

Thanks,
Gerald


#3

Hi Gerald,

nor select ‘role’ … or select a.role from actor a work

we are looking forward for an early update :wink:

Regards
Bruno


#4

Bruno,

You need to replace every occurrence of role with `role`.

Another developer preview coming next week!

Gerald


#5

select * from actor where ‘role’=“CONTENT_PROVIDER”;

response
{
“requestID”: “b50e39c1-a3cc-4cd9-9f8d-3f3e04d43644”,
“signature”: {
"": ""
},
“results”: [
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “40.0023ms”,
“executionTime”: “39.0022ms”,
“resultCount”: 0,
“resultSize”: 0
}
}

and select * from actor
{
“requestID”: “ecbe4352-6f88-4753-8470-14df82efdcce”,
“signature”: {
"": ""
},
“results”: [
{
“actor”: {
“dateCreated”: “2015-03-10T11:55:49.172Z”,
“id”: “c1322f6e-9a5c-41ea-8800-f6282ec8ccaa”,
“role”: “CONTENT_PROVIDER”,
“type”: “actor”
}
}

Bruno
ps : Many thanks for your reactivity, we appreciate


#6

Hi Bruno,

`role` must be in back ticks, not single quotes.

Gerald