Make max dimensions consistent across types [skip ci]

This commit is contained in:
Andrew Kane
2024-03-28 16:41:13 -07:00
parent 4f1a379638
commit 49bc34caf3
3 changed files with 5 additions and 3 deletions

View File

@@ -722,7 +722,7 @@ sum(vector) → vector | sum | 0.5.0
### Halfvec Type
Each half vector takes `2 * dimensions + 8` bytes of storage. Each element is a half-precision floating-point number, and all elements must be finite (no `NaN`, `Infinity` or `-Infinity`). Half vectors can have up to 32,000 dimensions.
Each half vector takes `2 * dimensions + 8` bytes of storage. Each element is a half-precision floating-point number, and all elements must be finite (no `NaN`, `Infinity` or `-Infinity`). Half vectors can have up to 16,000 dimensions.
### Halfvec Operators

View File

@@ -18,7 +18,7 @@
#define HALF_MAX 65504
#endif
#define HALFVEC_MAX_DIM 32000
#define HALFVEC_MAX_DIM 16000
#define HALFVEC_SIZE(_dim) (offsetof(HalfVector, x) + sizeof(half)*(_dim))
#define DatumGetHalfVector(x) ((HalfVector *) PG_DETOAST_DATUM(x))

View File

@@ -133,7 +133,9 @@ ERROR: dimensions for type halfvec must be at least 1
LINE 1: SELECT '[1,2,3]'::halfvec(0);
^
SELECT '[1,2,3]'::halfvec(16001);
ERROR: expected 16001 dimensions, not 3
ERROR: dimensions for type halfvec cannot exceed 16000
LINE 1: SELECT '[1,2,3]'::halfvec(16001);
^
SELECT unnest('{"[1,2,3]", "[4,5,6]"}'::halfvec[]);
unnest
---------