Reserved Words
- reference
N1QL defines an extensive list of keywords that are reserved words. You cannot use these keywords as identifiers unless you escape them. All of the N1QL keywords are case insensitive.
Some of the keywords are not currently implemented but are reserved for future use.
Using Reserved Words as Identifiers
N1QL allows escaped identifiers to overlap with keywords.
To use a reserved word as an identifier, you must escape it by enclosing the reserved word inside backticks (``).
For example, if your JSON document contains a field named index
, you can use it in your queries by escaping it like this:
{
"age": "42",
"index": 27,
"name": "Elvis"
}
CREATE INDEX myindex ON default(`index`) USING GSI;
N1QL Reserved Words
The following keywords are reserved and cannot be used as unescaped identifiers:
ALTER |
ANALYZE |
||||
ASC |
AT |
BEGIN |
BETWEEN |
||
BREAK |
BUCKET |
BUILD |
BY |
||
CALL |
CASE |
CAST |
CLUSTER |
COLLATE |
COLLECTION |
COMMIT |
CONNECT |
CONTINUE |
CORRELATED |
COVER |
|
DATABASE |
DATASET |
DATASTORE |
DECLARE |
||
DECREMENT |
DERIVED |
DESC |
DESCRIBE |
||
DO |
EACH |
ELEMENT |
ELSE |
END |
|
EXCLUDE |
EXECUTE |
||||
FALSE |
FETCH |
FILTER |
FIRST |
FLATTEN |
FLUSH |
FOR |
FORCE |
||||
GOLANG |
GRANT |
||||
HAVING |
IF |
IGNORE |
ILIKE |
||
INCLUDE |
INCREMENT |
INDEX |
INFER |
INLINE |
INNER |
INTO |
IS |
||||
KEY |
KEYS |
KEYSPACE |
KNOWN |
LAST |
|
LEFT |
LETTING |
LIKE |
|||
LSM |
MAP |
MAPPING |
MATCHED |
MATERIALIZED |
|
MINUS |
NAMESPACE |
||||
NUMBER |
OBJECT |
||||
ON |
OPTION |
||||
OUTER |
PARSE |
PARTITION |
PASSWORD |
||
PATH |
POOL |
PREPARE |
PRIMARY |
PRIVATE |
|
PRIVILEGE |
PROCEDURE |
PUBLIC |
RAW |
||
REALM |
REDUCE |
RENAME |
RETURN |
RETURNING |
|
REVOKE |
RIGHT |
ROLE |
|||
SATISFIES |
SCHEMA |
SCOPE |
SELF |
||
SEMI |
SET |
SHOW |
SOME |
START |
STATISTICS |
STRING |
SYSTEM |
THEN |
TO |
||
TRIGGER |
TRUE |
TRUNCATE |
UNDER |
||
UNIQUE |
UNKNOWN |
UNSET |
|||
USER |
USING |
VALIDATE |
VALUE |
||
VALUED |
VALUES |
VIA |
VIEW |
WHEN |
|
WHILE |
WINDOW |
WITH |
XOR |