Constant Expressions

Syntax

constant_expression ::= number | string | TRUE | FALSE | NULL

number ::= [MINUS] (FLOAT_CONSTANT | INT_CONSTANT | NUMBER_CONSTANT)
string ::= STRING_CONSTANT | DSTRING_CONSTANT

Semantics

The syntax for INT_CONSTANT, FLOAT_CONSTANT, NUMBER_CONSTANT, STRING_CONSTANT, and DSTRING_CONSTANT was given in the Identifiers section.

In the current version, a query can contain the following constants (a.k.a. literals):

String

String literals are sequences of unicode characters enclosed in double or single quotes. String literals are translated into String items. Notice that any escape sequences appearing in a string literal will be converted to their corresponding character inside the corresponding String item.

Integer

Integer literals are sequences of one or more digits. Integer literals are translated into Integer items, if their value fits in 4 bytes, into Long items, if they fit in 8 bytes, otherwise to Number items.

Floating point

Floating point literals represent real numbers using decimal notation and/or exponent. Floating-point literals are translated into Double items, if possible, otherwise to Number items.

Number

Number literals are integer or floating-point literals followed by the 'n' or 'N' character. Number literals are always translated into Number items.

TRUE / FALSE

The TRUE and FALSE literals are translated to the boolean true and false items, respectively.

NULL

The NULL literal is translated to the json null item.