struct(...) (re-cased to tuple(...) when the query runs on ClickHouse); PostgreSQL has no equivalent and rejects them.
struct
Constructs a tuple literal from one or more values, letting you carry several columns as a single ordered value. This is the constructor you use everywhere a tuple is expected. There is no separaterow(...) constructor — always write tuple literals as struct(...) (ClickHouse only).
Syntax
x1, x2, …— one or more values of any type. Element order is preserved.
- A tuple of the supplied values,
Tuple(T1, T2, …). Extract a single element withtupleElementto export it as a scalar.
Build a tuple and read one element
tupleElement
Returns the n-th element (1-based) of a tuple (ClickHouse only). Syntaxtuple— the tuple to read from, e.g. built withstruct(...).index— the 1-based position of the element to return (constant integer).
- The element at the given position; its type is the type of that tuple member.
Read the second element
tuplePlus
Performs element-wise addition of two numeric tuples of equal length (ClickHouse only). Syntaxt1— the first numeric tuple.t2— the second numeric tuple; must be the same length ast1.
- A tuple of the element-wise sums. Wrap it in
tupleElementto export a single result as a scalar.
Element-wise addition
tupleMinus
Performs element-wise subtraction of two numeric tuples of equal length (ClickHouse only). Syntaxt1— the minuend tuple (numeric elements).t2— the subtrahend tuple; must be the same length ast1.
- A tuple of the element-wise differences. Wrap it in
tupleElementto export a single result as a scalar.
Element-wise subtraction
tupleMultiply
Performs element-wise multiplication of two numeric tuples of equal length (ClickHouse only). Syntaxt1— the first numeric tuple.t2— the second numeric tuple; must be the same length ast1.
- A tuple of the element-wise products. Wrap it in
tupleElementto export a single result as a scalar.
Element-wise multiplication
tupleNegate
Negates each element of a numeric tuple (ClickHouse only). Syntaxt— a numeric tuple.
- A tuple with each element negated. Wrap it in
tupleElementto export a single result as a scalar.
Negate each element
tupleHammingDistance
Counts the number of positions at which two tuples of equal length differ (ClickHouse only). Syntaxt1— the first tuple.t2— the second tuple; must be the same length ast1.
- The count of positions where the two tuples differ, as
UInt64.
Count differing positions