Improved sparsevec error messages [skip ci]

This commit is contained in:
Andrew Kane
2024-04-26 17:11:11 -07:00
parent c9fb66d54d
commit 1e94907179
2 changed files with 33 additions and 21 deletions

View File

@@ -170,11 +170,11 @@ SELECT '{2:1,1:1}/2'::sparsevec;
(1 row)
SELECT '{1:1,1:1}/2'::sparsevec;
ERROR: indexes must not contain duplicates
ERROR: sparsevec indices must not contain duplicates
LINE 1: SELECT '{1:1,1:1}/2'::sparsevec;
^
SELECT '{1:1,2:1,1:1}/2'::sparsevec;
ERROR: indexes must not contain duplicates
ERROR: sparsevec indices must not contain duplicates
LINE 1: SELECT '{1:1,2:1,1:1}/2'::sparsevec;
^
SELECT '{}/5'::sparsevec;
@@ -208,27 +208,27 @@ ERROR: sparsevec must have at least 1 dimension
LINE 1: SELECT '{}/-9223372036854775809'::sparsevec;
^
SELECT '{2147483647:1}/1'::sparsevec;
ERROR: index must be less than or equal to dimensions
ERROR: sparsevec index out of bounds (> dimensions)
LINE 1: SELECT '{2147483647:1}/1'::sparsevec;
^
SELECT '{2147483648:1}/1'::sparsevec;
ERROR: index must be less than or equal to dimensions
ERROR: sparsevec index out of bounds (> dimensions)
LINE 1: SELECT '{2147483648:1}/1'::sparsevec;
^
SELECT '{-2147483648:1}/1'::sparsevec;
ERROR: index must be greater than zero
ERROR: sparsevec index out of bounds (< 1)
LINE 1: SELECT '{-2147483648:1}/1'::sparsevec;
^
SELECT '{-2147483649:1}/1'::sparsevec;
ERROR: index must be greater than zero
ERROR: sparsevec index out of bounds (< 1)
LINE 1: SELECT '{-2147483649:1}/1'::sparsevec;
^
SELECT '{0:1}/1'::sparsevec;
ERROR: index must be greater than zero
ERROR: sparsevec index out of bounds (< 1)
LINE 1: SELECT '{0:1}/1'::sparsevec;
^
SELECT '{2:1}/1'::sparsevec;
ERROR: index must be less than or equal to dimensions
ERROR: sparsevec index out of bounds (> dimensions)
LINE 1: SELECT '{2:1}/1'::sparsevec;
^
SELECT '{}/3'::sparsevec(3);