Selection string rules and restrictions
Familiarize yourself with these rules about how selection strings are interpreted and character restrictions to avoid potential problems when using selectors.
- Message selection for publish/subscribe messaging occurs on the message as sent by the publisher. See Selection strings.
- Equivalence is tested using a single equals character; for example, a = b is correct, whereas a == b is incorrect.
- An operator used by many programming languages to represent 'not equal to' is !=. This representation is not a valid synonym for <> ; for example, a <> b is valid, whereas a != b is not valid.
- Single quotation marks are recognized only if the ' (U+0027) character is used. Similarly, double quotation marks, valid only when used to enclose byte strings, must use the " (U+0022) character.
- The symbols &, &&, | and || are not synonyms for logical conjunction/disjunction; for example, a && b must be specified as a AND b.
- The wildcard characters * and ? are not synonyms for % and _.
- Selectors containing compound expressions such as 20 < b < 30 are not valid. The parser evaluates operators that have the same precedence from left to right. The example would therefore become (20 < b) < 30, which does not make sense. Instead the expression must be written as (b > 20) AND (b < 30).
- Byte strings must be enclosed in double quotation marks; if single quotation marks are used, the byte string is taken to be a string literal. The number of characters (not the number that the characters represent) following the 0x must be a multiple of two.
- The keyword IS is not a synonym for the equals character. Thus the selection strings a IS 3 and b IS 'red' are not valid. The IS keyword exists only to support IS NULL and IS NOT NULL cases.