Vector Value Operations
The following sections describe the supported casting, comparison and assignment operations for Vector values.
Casting
Any Vector value may be cast to a new Vector type with a different coordinate type, provided the coordinate values are within the range of the destination type.
This can be accomplished using:
CAST(vec AS VECTOR(<dimension>, <new coordinate type>))
or
VECTOR(vec, <dimension>, <new coordinate type>))
Note: Casting cannot change the dimension of a Vector value; it can only change the coordinate type.
Comparison
Vector-typed values can only be compared for equality or inequality. You can’t use ORDER BY on Vector values because they can’t be compared as greater or smaller.
Comparison between Vector values is only permitted if they have the same dimension and coordinate type. To compare two Vector values of the same dimension but different coordinate types, you must cast one of the values to the other’s type first. Vector values with different dimensions cannot be compared.
Two Vector values are equal if and only if they have the same dimension and the same coordinate values.
Assignment
A Vector value can be assigned to another Vector value, for example in an INSERT or UPDATE query as long as both Vector types have the same dimension. If the two Vector values have the same dimension but different coordinate types, the Vector value is cast to the destination type if possible; otherwise, it fails with an error.
Last modified date: 09/11/2026