A newer version of this documentation is available.

View Latest

Reserved Words

    +
    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:

    ADVISE

    ALL

    ALTER

    ANALYZE

    AND

    ANY

    ARRAY

    AS

    ASC

    BEGIN

    BETWEEN

    BINARY

    BOOLEAN

    BREAK

    BUCKET

    BUILD

    BY

    CALL

    CASE

    CAST

    CLUSTER

    COLLATE

    COLLECTION

    COMMIT

    CONNECT

    CONTINUE

    CORRELATED

    COVER

    CREATE

    CURRENT

    DATABASE

    DATASET

    DATASTORE

    DECLARE

    DECREMENT

    DELETE

    DERIVED

    DESC

    DESCRIBE

    DISTINCT

    DO

    DROP

    EACH

    ELEMENT

    ELSE

    END

    EVERY

    EXCEPT

    EXCLUDE

    EXECUTE

    EXISTS

    EXPLAIN

    FALSE

    FETCH

    FIRST

    FLATTEN

    FOLLOWING

    FOR

    FORCE

    FROM

    FTS

    FUNCTION

    GOLANG

    GRANT

    GROUP

    GROUPS

    GSI

    HASH

    HAVING

    IF

    IGNORE

    ILIKE

    IN

    INCLUDE

    INCREMENT

    INDEX

    INFER

    INLINE

    INNER

    INSERT

    INTERSECT

    INTO

    IS

    JAVASCRIPT

    JOIN

    KEY

    KEYS

    KEYSPACE

    KNOWN

    LANGUAGE

    LAST

    LEFT

    LET

    LETTING

    LIKE

    LIMIT

    LSM

    MAP

    MAPPING

    MATCHED

    MATERIALIZED

    MERGE

    MINUS

    MISSING

    NAMESPACE

    NEST

    NL

    NO

    NOT

    NTH_VALUE

    NULL

    NULLS

    NUMBER

    OBJECT

    OFFSET

    ON

    OPTION

    OPTIONS [1]

    OR

    ORDER

    OTHERS

    OUTER

    OVER

    PARSE

    PARTITION

    PASSWORD

    PATH

    POOL

    PRECEDING

    PREPARE

    PRIMARY

    PRIVATE

    PRIVILEGE

    PROBE

    PROCEDURE

    PUBLIC

    RANGE

    RAW

    REALM

    REDUCE

    RENAME

    RESPECT

    RETURN

    RETURNING

    REVOKE

    RIGHT

    ROLE

    ROLLBACK

    ROW

    ROWS

    SATISFIES

    SCHEMA

    SELECT

    SELF

    SEMI

    SET

    SHOW

    SOME

    START

    STATISTICS

    STRING

    SYSTEM

    THEN

    TIES

    TO

    TRANSACTION

    TRIGGER

    TRUE

    TRUNCATE

    UNBOUNDED

    UNDER

    UNION

    UNIQUE

    UNKNOWN

    UNNEST

    UNSET

    UPDATE

    UPSERT

    USE

    USER

    USING

    VALIDATE

    VALUE

    VALUED

    VALUES

    VIA

    VIEW

    WHEN

    WHERE

    WHILE

    WITH

    WITHIN

    WORK

    XOR


    1. Couchbase Server 6.5.1 and later.