Exclude zero vectors for cosine distance to be consistent with other types [skip ci]

This commit is contained in:
Andrew Kane
2024-09-23 13:35:36 -07:00
parent 0296a08ccf
commit ffca8e720c
5 changed files with 16 additions and 5 deletions

View File

@@ -64,19 +64,18 @@ SELECT * FROM t ORDER BY val <=> '[3,3,3]';
[1,1,1]
[1,2,3]
[1,2,4]
[0,0,0]
(4 rows)
(3 rows)
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> '[0,0,0]') t2;
count
-------
4
3
(1 row)
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::intvec)) t2;
count
-------
4
3
(1 row)
DROP TABLE t;