Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-8.x)/ SQL Reference/ Data Types/ Vector Data Types
Updated on 2025-08-19 GMT+08:00
Vector Data Types
Vector data types include floatvector and boolvector.
- The floatvector data type indicates that multidimensional data contains data of the float type, for example, [1.0,3.0,11.0,110.0,62.0,22.0,4.0].
- The floatvector member supports only single precision. Single-precision range: -3.402E+38 to +3.402E+38, 6-digit decimal digits.
- The floatvector does not support NULL, Nan, or Inf as elements. If a vector contains NULL values, the database reports an error.
- The floatvector cannot be NULL. The database reports an error when a NULL value is inserted, updated, or converted as vector data.
- In some scenarios (when the execution plan is a streaming plan), the precision of numeric values stored in the floatvector member is influenced by the GUC parameter extra_float_digits. As a result, the calculation results of the same data may be inconsistent. To mitigate this issue, set extra_float_digits to 3.
- The boolvector data type indicates that the multidimensional data contains data of the Boolean type, for example, [0,0,0,0,0,1,0,0,1,0,0,0].
- Members of the boolvector data type can express Boolean data in t(T)/f(F), y(Y)/n(N), 1/0, true/false, yes/no, or on/off mode.
- The boolvector does not support NULL, Nan, or Inf as elements. If a vector contains NULL values, the database reports an error.
- The boolvector cannot be NULL. The database reports an error when a NULL value is inserted, updated, or converted as vector data.
Usage of Vector Types
An example of using the vector type is as follows:
-- Create a table that contains vector types and set data dimensions. Dimensions must be specified for vector types during table creation. gaussdb=# CREATE TABLE t1(id int unique, repr floatvector(4)); gaussdb=# CREATE TABLE t2(id int unique, repr boolvector(3)); -- Insert data. gaussdb=# INSERT INTO t1 VALUES(0, '[30,12,12,25]'); gaussdb=# INSERT INTO t2 VALUES(1, '[1, 0, 1]');
Parent topic: Data Types
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.