SQL functions & operators
This page details Materialize’s supported SQL functions and operators.
Functions
Unmaterializable functions
Several functions in Materialize are unmaterializable because their output
depends upon state besides their input parameters, like the value of a session
parameter or the timestamp of the current transaction. You cannot create an
index or materialized view that depends on an
unmaterializable function, but you can use them in non-materialized views and
one-off SELECT
statements.
Unmaterializable functions are marked as such in the table below.
Side-effecting functions
Several functions in Materialize are side-effecting because their evaluation
changes system state. For example, the pg_cancel_backend
function allows
canceling a query running on another connection.
Materialize offers only limited support for these functions. They may be called
only at the top level of a SELECT
statement, like so:
SELECT side_effecting_function(arg, ...);
You cannot manipulate or alias the function call expression, call multiple
side-effecting functions in the same SELECT
statement, nor add any additional
clauses to the SELECT
statement (e.g., FROM
, WHERE
).
Side-effecting functions are marked as such in the table below.
Generic
Generic functions can typically take arguments of any type.
Function | Computes |
---|---|
|
Value as type T
(docs)
|
|
First non-NULL arg, or NULL if all are NULL |
|
The maximum argument, or NULL if all are NULL |
|
The minimum argument, or NULL if all are NULL |
|
NULL if x == y , else x
|
Aggregate
Aggregate functions take one or more of the same element type as arguments.
Function | Computes |
---|---|
|
Aggregate values (including nulls) as an array. (docs) |
|
Average of T ’s values. Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
NULL if all values of x are NULL, otherwise true if all values of x are true, otherwise false.
|
|
NULL if all values of x are NULL, otherwise true if any values of x are true, otherwise false.
|
|
Number of non-NULL inputs. |
|
Aggregate values (including nulls) as a jsonb array. (docs) |
|
Aggregate keys and values (including nulls) as a jsonb object. (docs) |
|
Maximum value among T
|
|
Minimum value among T
|
|
Historical alias for stddev_samp . (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
Population standard deviation of T ’s values. (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
Sample standard deviation of T ’s values. (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
Concatenates the non-null input values into text. Each value after the first is preceded by the corresponding delimiter. (docs) |
|
Sum of T ’s values Returns bigint if x is int or smallint , numeric if x is bigint or uint8 , uint8 if x is uint4 or uint2 , else returns same type as x .
|
|
Historical alias for var_samp . (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
Population variance of T ’s values. (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
|
Sample variance of T ’s values. (imprecise) Returns numeric if x is int , double if x is real , else returns same type as x .
|
List
List functions take list
arguments, and are polymorphic.
Function | Computes |
---|---|
|
Aggregate values (including nulls) as a list. (docs) |
|
Appends e to l .
|
|
Concatenates l1 and l2 .
|
|
Return the number of elements in l .
|
|
Prepends e to l .
|
Map
Map functions take map
arguments, and are polymorphic.
Function | Computes |
---|---|
|
Return the number of elements in m .
|
Numbers
Number functions take number-like arguments, e.g. int
, float
, numeric
, unless otherwise specified.
Function | Computes |
---|---|
|
The absolute value of x
|
|
The cube root of x .
|
|
The smallest integer >= x
|
|
Alias of ceil
|
|
Exponential of x (e raised to the given power)
|
|
The largest integer <= x
|
|
Natural logarithm of x
|
|
Natural logarithm of x
|
|
Base 10 logarithm of x
|
|
Base 10 logarithm of x
|
|
Base 10 logarithm of x , same as log
|
|
Base 10 logarithm of x , same as log
|
|
Base b logarithm of x
|
|
x % y
|
|
Alias of power
|
|
Alias of power
|
|
x raised to the power of y
|
|
x raised to the power of y
|
|
x rounded to the nearest whole number. If N is real or double precision , rounds ties to the nearest even number. If N is numeric , rounds ties away from zero.
|
|
x rounded to y decimal places, while retaining the same numeric scale; rounds ties away from zero.
|
|
The square root of x .
|
|
The square root of x .
|
|
x truncated toward zero to a whole number
|
Trigonometric
Trigonometric functions take and return double precision
values.
Function | Computes |
---|---|
|
The cosine of x , with x in radians.
|
|
The inverse cosine of x , result in radians.
|
|
The hyperbolic cosine of x , with x as a hyperbolic angle.
|
|
The inverse hyperbolic cosine of x .
|
|
The cotangent of x , with x in radians.
|
|
The sine of x , with x in radians.
|
|
The inverse sine of x , result in radians.
|
|
The hyperbolic sine of x , with x as a hyperbolic angle.
|
|
The inverse hyperbolic sine of x .
|
|
The tangent of x , with x in radians.
|
|
The inverse tangent of x , result in radians.
|
|
The hyperbolic tangent of x , with x as a hyperbolic angle.
|
|
The inverse hyperbolic tangent of x .
|
|
Converts degrees to radians. |
|
Converts radians to degrees. |
String
Function | Computes |
---|---|
|
The ASCII value of s ’s left-most character
|
|
Trim all spaces from both sides of s .
|
|
Trim any character in c from both sides of s .
|
|
Number of bits in s
|
|
Number of bits in b
|
|
Number of code points in s
|
|
Character with the given Unicode codepoint. Only supports codepoints that can be encoded in UTF-8. The NULL (0) character is not allowed. |
|
Concatenates the text representation of non-NULL arguments`. |
|
Concatenates the text representation of non-NULL arguments from f and r separated by sep .
|
|
Convert data b from original encoding specified by src_encoding into text .
|
|
Decode s using the specified textual representation.
(docs)
|
|
Encode b using the specified textual representation.
(docs)
|
|
Return the n th byte from b , where the left-most byte in b is at the 0th position.
|
|
Performs a constant-time comparison between byte arrays a and b . Returns true if the arrays are identical, otherwise returns false . This method is designed to mitigate timing attacks by ensuring the comparison takes the same amount of time regardless of the content of the arrays.
|
|
Performs a constant-time comparison between strings a and b by first converting them to byte sequences. Returns true if the strings are identical, otherwise returns false . This method is designed to mitigate timing attacks by ensuring the comparison takes the same amount of time regardless of the content of the strings.
|
|
The first n characters of s . If n is negative, all but the last |n| characters of s .
|
|
Number of code points in s
(docs)
|
|
Number of bytes in s
(docs)
|
|
Number of code points in s after encoding
(docs)
|
|
Convert s to lowercase.
|
|
Prepend s with spaces up to length len , or right truncate if len is less than the length of s .
|
|
Prepend s with characters pulled from p up to length len , or right truncate if len is less than the length of s .
|
|
Trim all spaces from the left side of s .
|
|
Trim any character in c from the left side of s .
|
|
Number of bytes in s
|
|
Number of bytes in b
|
|
Splits a qualified identifier into an array of identifiers, removing any quoting of individual identifiers. Extra characters after the last identifier are considered an error, unless strict_mode is false or elided, then such extra characters are ignored. (This behavior is useful for parsing names for objects like functions.) Note that this function does not truncate over-length identifiers. (From PG)
|
|
The starting index of sub within s or 0 if sub is not a substring of s .
|
|
Matches the regular expression needle against haystack, returning a string array that contains the value of each capture group specified in needle , in order. If flags is set to the string i matches case-insensitively.
|
|
Replaces the first occurrence of pattern with replacement in source . No match will return source unchanged. If flags is set to g , all occurrences are replaced. If flags is set to i , matches case-insensitively. $N or $name in replacement can be used to match capture groups. ${N} must be used to disambiguate capture group indexes from names if other characters follow N . A $$ in replacement will write a literal $ . See the rust regex docs for more details about replacement.
|
|
Splits text by the regular expression pattern into an array. If flags is set to i , matches case-insensitively.
|
|
Replicate the string n times.
|
|
s with all instances of f replaced with r
|
|
The last n characters of s . If n is negative, all but the first |n| characters of s .
|
|
Trim all spaces from the right side of s .
|
|
Trim any character in c from the right side of s .
|
|
Split s on delimiter d . Return the str at index i , counting from 1.
|
|
Substring of s starting at start_pos
(docs)
|
|
Substring starting at start_pos of length l
(docs)
|
|
Substring starting at start_pos of length l
(docs)
|
|
Any character in s that matches a character in from is replaced by the corresponding character in to . If from is longer than to , occurrences of the extra characters in from are removed.
|
|
Trims any character in c from s on the specified side.Defaults: • Side: BOTH • 'c' : ' ' (space)
|
|
Parses a specific subset of ISO8601 timestamps, returning NULL instead of error on failure: YYYY-MM-DDThh:mm:ss.sssZ
(docs)
|
|
Convert s to uppercase.
|
Scalar
Scalar functions take a list of scalar expressions
Function | Computes |
---|---|
|
true if applying bool_op to expression and every value of s evaluates to true
|
|
true if applying bool_op to expression and any value of s evaluates to true
|
|
true for each value in expression if it matches at least one element of s
|
|
true for each value in expression if it does not match any elements of s
|
|
true if applying bool_op to expression and any value of s evaluates to true
|
Subquery
Subquery functions take a query, e.g. SELECT
Function | Computes |
---|---|
|
s must return exactly one column; true if applying bool_op to expression and every value of s evaluates to true
|
|
s must return exactly one column; true if applying bool_op to expression and any value of s evaluates to true
|
|
Extracts separated values from a column containing a CSV file formatted as a string. (docs) |
|
true if s returns at least one row
|
|
s must return exactly one column; true for each value in expression if it matches at least one element of s
|
|
true if s returns zero rows
|
|
s must return exactly one column; true for each value in expression if it does not match any elements of s
|
|
s must return exactly one column; true if applying bool_op to expression and any value of s evaluates to true
|
Date and Time
Time functions take or produce a time-like type, e.g. date
, timestamp
, timestamp with time zone
.
Function | Computes |
---|---|
|
Subtracts one timestamp from another, producing a “symbolic” result that uses years and months, rather than just days. |
|
The timestamp with time zone representing when the query was executed.
Note: This function is unmaterializable. |
|
Align source with origin along stride .
(docs)
|
|
Largest time_component <= val
(docs)
|
|
Largest time_component <= val
(docs)
|
|
Specified time component from value (docs) |
|
Specified time component from value (docs) |
|
The logical time at which a query executes. Used for temporal filters and query timestamp introspection.
Note: This function generally behaves like an unmaterializable function, but can be used in limited contexts in materialized views as a temporal filter. (docs) Note: This function is unmaterializable. |
|
The timestamp with time zone representing when the query was executed.
(docs)
Note: This function is unmaterializable. |
|
Converts timestamp to the specified time zone, expressed as an offset from UTC. Known limitation: You must explicitly cast the type for the time zone. (docs) |
|
Converts timestamp with time zone from UTC to the specified time zone, expressed as the local time. Known limitation: You must explicitly cast the type for the time zone. (docs) |
|
Converts timestamp to specified time zone, expressed as an offset from UTC. Known limitation: You must explicitly cast the type for the time zone. (docs) |
|
Converts timestamp with time zone from UTC to specified time zone, expressed as the local time. Known limitation: You must explicitly cast the type for the time zone. (docs) |
|
Describes a time zone’s offset from UTC at a specified moment. zone must be a valid IANA Time Zone Database identifier. when is a timestamp with time zone that specifies the moment at which to determine zone ’s offset from UTC. abbrev is the abbreviation for zone that is in use at the specified moment (e.g., EST or EDT ). base_utc_offset is the base offset from UTC at the specified moment (e.g., -5 hours ). Positive offsets mean east of Greenwich; negative offsets mean west of Greenwich. dst_offset is the additional offset at the specified moment due to Daylight Saving Time rules (e.g., 1 hours ). If non-zero, Daylight Saving Time is in effect.
|
|
Converts Unix epoch (seconds since 00:00:00 UTC on January 1, 1970) to timestamp |
|
Converts a timestamp into a string using the specified format. (docs) |
|
Adjust interval so 30-day time periods are represented as months. (docs) |
|
Adjust interval so 24-hour time periods are represented as days. (docs) |
|
Adjust interval using justify_days and justify_hours, with additional sign adjustments. (docs) |
UUID
Function | Computes |
---|---|
|
Generates a version 5 UUID (SHA-1) in the given namespace using the specified input name. |
JSON
Function | Computes |
---|---|
|
Aggregate values (including nulls) as a jsonb array. (docs) |
|
j ’s elements if j is an array.
(docs)
|
|
j ’s elements if j is an array.
(docs)
|
|
Number of elements in j ’s outermost array.
(docs)
|
|
Output each element of x as a jsonb array. Elements can be of heterogenous types.
(docs)
|
|
The elements of x as a jsonb object. The argument list alternates between keys and values.
(docs)
|
|
j ’s outermost elements if j is an object.
(docs)
|
|
j ’s outermost elements if j is an object.
(docs)
|
|
Aggregate keys and values (including nulls) as a jsonb object.
(docs)
|
|
j ’s outermost keys if j is an object.
(docs)
|
|
Pretty printed (i.e. indented) j .
(docs)
|
|
Type of j ’s outermost value. One of object , array , string , number , boolean , and null .
(docs)
|
|
j with all object fields with a value of null removed. Other null values remain.
(docs)
|
|
v as jsonb
(docs)
|
Table
Table functions evaluate to a set of rows, rather than a single expression.
Function | Computes |
---|---|
|
Generate all integer values between start and stop , inclusive.
|
|
Generate all integer values between start and stop , inclusive, incrementing by step each time.
|
|
Generate all timestamp values between start and stop , inclusive, incrementing by step each time.
|
|
Generates a series comprising the valid subscripts of the dim ‘th dimension of the given array a .
|
|
Values of the capture groups of regex as matched in haystack
|
|
Splits text by the regular expression pattern . If flags is set to i , matches case-insensitively.
|
|
Expands the array a into a set of rows.
|
|
Expands the list l into a set of rows.
|
Array
Function | Computes |
---|---|
|
Concatenates a1 and a2 .
|
|
Returns an array initialized with supplied value and dimensions, optionally with lower bounds other than 1. (From PG) |
|
Returns the subscript of needle in haystack . Returns null if not found.
|
|
Returns the subscript of needle in haystack , skipping the first skip elements. Returns null if not found.
|
|
Concatenates the elements of array together separated by sep . Null elements are omitted unless ifnull is non-null, in which case null elements are replaced with the value of ifnull .
|
|
Returns the array a without any elements equal to the given value e . The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics, so it is possible to remove NULLs.
|
Cryptography
Function | Computes |
---|---|
|
Computes a binary hash of the given text data using the specified type algorithm. Supported hash algorithms are: md5 , sha1 , sha224 , sha256 , sha384 , and sha512 .
|
|
Computes a binary hash of the given bytea data using the specified type algorithm. The supported hash algorithms are the same as for the text variant of this function.
|
|
Computes a hashed MAC of the given text data using the specified key and type algorithm. Supported hash algorithms are the same as for digest .
|
|
Computes a hashed MAC of the given bytea data using the specified key and type algorithm. The supported hash algorithms are the same as for digest .
|
|
Computes the MD5 hash of the given bytea data . For PostgreSQL compatibility, returns a hex-encoded value of type text rather than bytea .
|
|
Computes the SHA-224 hash of the given bytea data .
|
|
Computes the SHA-256 hash of the given bytea data .
|
|
Computes the SHA-384 hash of the given bytea data .
|
|
Computes the SHA-512 hash of the given bytea data .
|
Window
Window functions compute values across sets of rows related to the current row. For example, you can use a window aggregation to smooth measurement data by computing the average of the last 5 measurements before every row as follows: SELECT avg(measurement) OVER (ORDER BY time ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM measurements;
. Window functions always need an OVER
clause. For the OVER
clause, Materialize supports the same syntax as PostgreSQL, but currently only with the ROWS
frame mode (except for the default frame, which is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
, and is supported). In addition to the below window functions, you can use the OVER
clause with any aggregation function (e.g., sum
, avg
) as well. Using an aggregation with an OVER
clause is called a window aggregation. A window aggregation computes the aggregate not on the groups specified by the GROUP BY
clause, but on the frames specified inside the OVER
clause. (Note that a window aggregation produces exactly one output value for each input row. This is different from a standard aggregation, which produces one output value for each group specified by the GROUP BY
clause.)
Function | Computes |
---|---|
|
Returns the rank of the current row within its partition without gaps, counting from 1. Rows that compare equal will have the same rank. |
|
Returns value evaluated at the first row of the window frame. The default window frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW .
|
|
Returns value evaluated at the row that is offset rows before the current row within the partition; if there is no such row, instead returns default (which must be of a type compatible with value ). If offset is NULL , NULL is returned instead. Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to NULL .
|
|
Returns value evaluated at the last row of the window frame. The default window frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW .
|
|
Returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead returns default (which must be of a type compatible with value ). If offset is NULL , NULL is returned instead. Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to NULL .
|
|
Returns the rank of the current row within its partition with gaps (counting from 1): rows that compare equal will have the same rank, and then the rank is incremented by the number of rows that compared equal. |
|
Returns the number of the current row within its partition, counting from 1. Rows that compare equal will be ordered in an unspecified way. |
System information
Functions that return information about the system.
Function | Computes |
---|---|
|
Returns a string containing a uuid uniquely identifying the Materialize environment.
Note: This function is unmaterializable. |
|
Returns the length of time that the materialized process has been running.
Note: This function is unmaterializable. |
|
Returns the server’s version information as a human-readable string.
Note: This function is unmaterializable. |
|
Returns the server’s version as an integer having the format XXYYYZZ , where XX is the major version, YYY is the minor version and ZZ is the patch version.
Note: This function is unmaterializable. |
|
Returns the name of the current database.
Note: This function is unmaterializable. |
|
Alias for current_user .
Note: This function is unmaterializable. |
|
Returns the name of the user who executed the containing query.
Note: This function is unmaterializable. |
|
Returns the name of the user who initiated the database connection.
Note: This function is unmaterializable. |
|
Returns the number of bytes used to store a row. |
PostgreSQL compatibility
Functions whose primary purpose is to facilitate compatibility with PostgreSQL tools. These functions may have suboptimal performance characteristics.
Function | Computes |
---|---|
|
Returns the canonical SQL name for the type specified by oid with typemod applied.
|
|
Returns the name of the first non-implicit schema on the search path, or NULL if the search path is empty.
Note: This function is unmaterializable. |
|
Returns the names of the schemas on the search path. The include_implicit parameter controls whether implicit schemas like mz_catalog and pg_catalog are included in the output.
Note: This function is unmaterializable. |
|
Returns the value of the named setting or error if it does not exist. If missing_ok is true, return NULL if it does not exist.
Note: This function is unmaterializable. |
|
PostgreSQL compatibility shim. Currently always returns NULL .
|
|
Returns the internal connection ID.
Note: This function is unmaterializable. |
|
Cancels an in-progress query on the specified connection ID. Returns whether the connection ID existed (not if it cancelled a query).
Note: This function is side-effecting. |
|
Returns the number of bytes used to store any individual data value. |
|
Returns the constraint definition for the given oid . Currently always returns NULL since constraints aren’t supported.
|
|
Reconstructs the creating command for an index. (This is a decompiled reconstruction, not the original text of the command.) If column is supplied and is not zero, only the definition of that column is reconstructed. |
|
Reconstructs the creating command for a rule. This function always returns NULL because Materialize does not support rules. |
|
Returns the role (user) name for the given oid . If no role matches the specified OID, the string unknown (OID=oid) is returned.
|
|
Returns the underlying SELECT command for the given view. |
|
Returns the underlying SELECT command for the given view. |
|
Returns the underlying SELECT command for the given view. |
|
Alias for has_role for PostgreSQL compatibility.
|
|
Returns if the a recovery is still in progress. |
|
Reports whether the relation with the specified OID is visible in the search path. |
|
Returns the path in the file system that the provided tablespace is on. |
|
Reports whether the type with the specified OID is visible in the search path. |
|
Reports whether the function with the specified OID is visible in the search path. |
|
Returns the type of its input argument as a string. |
|
PostgreSQL compatibility shim. Not intended for direct use. |
|
Returns the time when the server started.
Note: This function is unmaterializable. |
|
Disk space used by the specified fork (‘main’, ‘fsm’, ‘vm’, or ‘init’) of the specified table or index. If no fork is specified, it defaults to ‘main’. This function always returns -1 because Materialize does not store tables and indexes on local disk. |
|
Number of sequential scans done when argument is a table, or number of index scans done when argument is an index. This function always returns -1 because Materialize does not collect statistics. |
|
Returns a PostgreSQL-compatible version string.
Note: This function is unmaterializable. |
Access privilege inquiry
Functions that allow querying object access privileges. All of the following functions have
limitations involved in resolving the text names passed in. None of the object names can have
any schema or database qualifiers. For example, has_table_privilege('public.t', 'SELECT')
will not work properly. Additionally, the name lookup does not consider the current search path
or active database.
Function | Computes |
---|---|
|
Reports whether the role with the specified role name or OID has the privilege on the cluster with the specified cluster name. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the connection with the specified connection name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the database with the specified database name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the schema with the specified schema name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the user has the privilege for role . privilege can either be MEMBER or USAGE , however currently this value is ignored. The PUBLIC pseudo-role cannot be used for the user nor the role . If the user is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the secret with the specified secret name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the system privilege. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the relation with the specified relation name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the role with the specified role name or OID has the privilege on the type with the specified type name or OID. If the role is omitted then the current_role is assumed.
|
|
Reports whether the current_role is a superuser.
|
Operators
Generic
Operator | Computes |
---|---|
val::type |
Cast of val as type (docs) |
Boolean
Operator | Computes |
---|---|
AND |
Boolean “and” |
OR |
Boolean “or” |
= |
Equality |
<> |
Inequality |
!= |
Inequality |
< |
Less than |
> |
Greater than |
<= |
Less than or equal to |
>= |
Greater than or equal to |
a BETWEEN x AND y |
a >= x AND a <= y |
a NOT BETWEEN x AND y |
a < x OR a > y |
a IS NULL |
a = NULL |
a ISNULL |
a = NULL |
a IS NOT NULL |
a != NULL |
a IS TRUE |
a is true, requiring a to be a boolean |
a IS NOT TRUE |
a is not true, requiring a to be a boolean |
a IS FALSE |
a is false, requiring a to be a boolean |
a IS NOT FALSE |
a is not false, requiring a to be a boolean |
a IS UNKNOWN |
a = NULL , requiring a to be a boolean |
a IS NOT UNKNOWN |
a != NULL , requiring a to be a boolean |
a LIKE match_expr [ ESCAPE escape_char ] |
a matches match_expr , using SQL LIKE matching |
a ILIKE match_expr [ ESCAPE escape_char ] |
a matches match_expr , using case-insensitive SQL LIKE matching |
Numbers
Operator | Computes |
---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
% |
Modulo |
& |
Bitwise AND |
| |
Bitwise OR |
# |
Bitwise XOR |
~ |
Bitwise NOT |
<< |
Bitwise left shift |
>> |
Bitwise right shift |
String
Operator | Computes |
---|---|
|| |
Concatenation |
~~ |
Matches LIKE pattern case sensitively, see SQL LIKE matching |
~~* |
Matches LIKE pattern case insensitively (ILIKE), see SQL LIKE matching |
!~~ |
Matches NOT LIKE pattern (case sensitive), see SQL LIKE matching |
!~~* |
Matches NOT ILIKE pattern (case insensitive), see SQL LIKE matching |
~ |
Matches regular expression, case sensitive |
~* |
Matches regular expression, case insensitive |
!~ |
Matches regular expression case sensitively, and inverts the match |
!~* |
Match regular expression case insensitively, and inverts the match |
The regular expression syntax supported by Materialize is documented by the
Rust regex
crate.
Time-like
Operation | Computes |
---|---|
date + interval |
timestamp |
date - interval |
timestamp |
date + time |
timestamp |
date - date |
interval |
timestamp + interval |
timestamp |
timestamp - interval |
timestamp |
timestamp - timestamp |
interval |
time + interval |
time |
time - interval |
time |
time - time |
interval |
JSON
Operator | RHS Type | Description |
---|---|---|
-> |
text , int |
Access field by name or index position, and return jsonb (docs) |
->> |
text , int |
Access field by name or index position, and return text (docs) |
#> |
text[] |
Access field by path, and return jsonb (docs) |
#>> |
text[] |
Access field by path, and return text (docs) |
|| |
jsonb |
Concatenate LHS and RHS (docs) |
- |
text |
Delete all values with key of RHS (docs) |
@> |
jsonb |
Does element contain RHS? (docs) |
<@ |
jsonb |
Does RHS contain element? (docs) |
? |
text |
Is RHS a top-level key? (docs) |
Map
Operator | RHS Type | Description |
---|---|---|
-> |
string |
Access field by name, and return target field (docs) |
@> |
map |
Does element contain RHS? (docs) |
<@ |
map |
Does RHS contain element? (docs) |
? |
string |
Is RHS a top-level key? (docs) |
?& |
string[] |
Does LHS contain all RHS top-level keys? (docs) |
?| |
string[] |
Does LHS contain any RHS top-level keys? (docs) |
List
List operators are polymorphic.
Operator | Description |
---|---|
listany || listany |
Concatenate the two lists. |
listany || listelementany |
Append the element to the list. |
listelementany || listany |
Prepend the element to the list. |