Identifiers
In Materialize, identifiers are used to refer to columns and database objects like sources, views, and indexes.
Naming restrictions
-
The first character of an identifier must be an ASCII letter (
a
-z
andA
-Z
), an underscore (_
), or any non-ASCII character. -
The remaining characters of an identifier must be ASCII letters (
a
-z
andA
-Z
), ASCII digits (0
-9
), underscores (_
), dollar signs ($
), or any non-ASCII characters.
You can circumvent any of the above rules by double-quoting the the identifier,
e.g. "123_source"
or "fun_source_@"
. All characters inside a quoted
identifier are taken literally, except that double-quotes must be escaped by
writing two adjacent double-quotes, as in "includes""quote"
.
Case sensitivity
Materialize performs case folding (the caseless comparison of text) for identifiers, which means that identifiers are effectively case-insensitive (foo
is the same as FOO
is the same as fOo
). This can cause issues when column names come from data sources which do support case-sensitive names, such as Avro-formatted sources or CSV headers.
To avoid conflicts, double-quote all field names ("field_name"
) when working with case-sensitive sources.
Keyword collision
Materialize is very permissive with accepting SQL keywords as identifiers (e.g.
offset
, user
). If Materialize cannot use a keyword as an
identifier in a particular location, it throws a syntax error. You can wrap the
identifier in double quotes to force Materialize to interpret the word as an
identifier instead of a keyword.
For example, SELECT offset
is invalid, because it looks like a mistyping of
SELECT OFFSET <n>
. You can wrap the identifier in double quotes, as in
SELECT "offset"
, to resolve the error.
We recommend that you avoid using keywords as identifiers whenever possible, as the syntax errors that result are not always obvious.
The keywords known to the latest unstable build of Materialize are listed below. Note that new keywords may be added in any release.
ALL
ALTER
AND
ANY
ARN
ARRANGEMENT
ARRAY
AS
ASC
AT
AVRO
BEGIN
BETWEEN
BIGINT
BOOLEAN
BOTH
BPCHAR
BROKER
BUCKET
BY
BYTES
CASCADE
CASE
CAST
CHAIN
CHANNEL
CHAR
CHARACTER
CHARACTERISTICS
CHECK
CLOSE
CLUSTER
CLUSTERS
COALESCE
COLLATE
COLUMNS
COMMIT
COMMITTED
COMPILED
COMPRESSION
CONFLUENT
CONNECTION
CONSISTENCY
CONSTRAINT
COPY
CREATE
CROSS
CSV
CURRENT
CURSOR
DATABASE
DATABASES
DAY
DAYS
DEALLOCATE
DEBEZIUM
DEBUG
DEBUGGING
DEC
DECIMAL
DECLARE
DECORRELATED
DEFAULT
DELETE
DELIMITED
DESC
DETAILS
DISCARD
DISCOVER
DISTINCT
DOUBLE
DROP
ELSE
ENABLED
END
ENFORCED
ENVELOPE
ESCAPE
EXCEPT
EXECUTE
EXISTS
EXPLAIN
EXTENDED
EXTRACT
FALSE
FETCH
FIELDS
FILE
FILTER
FIRST
FLOAT
FOLLOWING
FOR
FOREIGN
FORMAT
FORWARD
FROM
FULL
GRANULARITY
GRAPH
GREATEST
GROUP
GROUPS
GZIP
HAVING
HEADER
HEADERS
HOLD
HOUR
HOURS
IF
ILIKE
IN
INCLUDE
INDEX
INDEXES
INFO
INNER
INSERT
INT
INTEGER
INTERSECT
INTERVAL
INTO
INTROSPECTION
IS
ISNULL
ISOLATION
JOIN
JSON
KAFKA
KEY
KEYS
KINESIS
LATERAL
LEADING
LEAST
LEFT
LEVEL
LIKE
LIMIT
LIST
LOCAL
LOG
LOGIN
MAP
MATCHING
MATERIALIZE
MATERIALIZED
MESSAGE
MINUTE
MINUTES
MONTH
MONTHS
NAMES
NATURAL
NEXT
NO
NOLOGIN
NONE
NOSUPERUSER
NOT
NOTICE
NOTIFICATIONS
NULL
NULLIF
OBJECTS
OCF
OF
OFFSET
ON
ONLY
OPERATOR
OPTIMIZED
OPTION
OR
ORDER
ORDINALITY
OUTER
OVER
PARTITION
PHYSICAL
PLAN
PLANS
POSITION
POSTGRES
PRECEDING
PRECISION
PREPARE
PRIMARY
PROTOBUF
PUBLICATION
PUBNUB
QUERY
RAISE
RANGE
RAW
READ
REAL
REFERENCES
REGEX
REGISTRY
REMOTE
RENAME
REPEATABLE
REPLACE
RESET
RESTRICT
RIGHT
ROLE
ROLES
ROLLBACK
ROW
ROWS
S3
SCAN
SCHEMA
SCHEMAS
SECOND
SECONDS
SECRET
SECRETS
SEED
SELECT
SEQUENCES
SERIALIZABLE
SESSION
SET
SHOW
SINK
SINKS
SIZE
SLOT
SMALLINT
SNAPSHOT
SOME
SOURCE
SOURCES
SQS
START
STDIN
STDOUT
STRING
SUBSCRIBE
SUBSTRING
SUPERUSER
TABLE
TABLES
TAIL
TEMP
TEMPORARY
TEXT
THEN
TIES
TIME
TIMESTAMP
TIMING
TO
TOPIC
TRAILING
TRANSACTION
TRIM
TRUE
TYPE
TYPED
TYPES
UNBOUNDED
UNCOMMITTED
UNION
UNIQUE
UNKNOWN
UPDATE
UPSERT
USER
USERS
USING
VALUE
VALUES
VARCHAR
VARYING
VIEW
VIEWS
WARNING
WHEN
WHERE
WITH
WITHOUT
WORK
WRITE
YEAR
YEARS
ZONE