pgvector.git / summary / log / commit / refs
commit 721fcf4d2c92e2ef022c42304d547b807cbfbee1
Author: Andrew Kane <andrew@ankane.org>
Date: Tue Jul 28 09:49:06 2026 +0000
Improved tests for rescans / nested loop joins [skip ci]
test/expected/hnsw_vector.out | 5 ++---
test/expected/ivfflat_vector.out | 5 ++---
test/sql/hnsw_vector.sql | 2 +-
test/sql/ivfflat_vector.sql | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/test/expected/hnsw_vector.out b/test/expected/hnsw_vector.out
index 9cf57ef2..d5a7a0a0 100644
--- a/test/expected/hnsw_vector.out
+++ b/test/expected/hnsw_vector.out
@@ -78,14 +78,13 @@ SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2
3
(1 row)
-SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val IS NOT NULL ORDER BY t.val;
+SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val != '[0,0,0]' ORDER BY t.val;
val | val
---------+---------
- [0,0,0] | [1,1,1]
[1,1,1] | [1,1,1]
[1,2,3] | [1,2,3]
[1,2,4] | [1,2,4]
-(4 rows)
+(3 rows)
DROP TABLE t;
-- L1
diff --git a/test/expected/ivfflat_vector.out b/test/expected/ivfflat_vector.out
index 984cb239..d4ba5f11 100644
--- a/test/expected/ivfflat_vector.out
+++ b/test/expected/ivfflat_vector.out
@@ -81,14 +81,13 @@ SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2
3
(1 row)
-SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val IS NOT NULL ORDER BY t.val;
+SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val != '[0,0,0]' ORDER BY t.val;
val | val
---------+---------
- [0,0,0] | [1,2,3]
[1,1,1] | [1,1,1]
[1,2,3] | [1,2,3]
[1,2,4] | [1,2,4]
-(4 rows)
+(3 rows)
DROP TABLE t;
-- iterative
diff --git a/test/sql/hnsw_vector.sql b/test/sql/hnsw_vector.sql
index f10d2108..8f6c08e3 100644
--- a/test/sql/hnsw_vector.sql
+++ b/test/sql/hnsw_vector.sql
@@ -41,7 +41,7 @@ INSERT INTO t (val) VALUES ('[1,2,4]');
SELECT * FROM t ORDER BY val <=> '[3,3,3]';
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> '[0,0,0]') t2;
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2;
-SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val IS NOT NULL ORDER BY t.val;
+SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val != '[0,0,0]' ORDER BY t.val;
DROP TABLE t;
diff --git a/test/sql/ivfflat_vector.sql b/test/sql/ivfflat_vector.sql
index bd6da74d..3338f639 100644
--- a/test/sql/ivfflat_vector.sql
+++ b/test/sql/ivfflat_vector.sql
@@ -41,7 +41,7 @@ INSERT INTO t (val) VALUES ('[1,2,4]');
SELECT * FROM t ORDER BY val <=> '[3,3,3]';
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> '[0,0,0]') t2;
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2;
-SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val IS NOT NULL ORDER BY t.val;
+SELECT * FROM t CROSS JOIN LATERAL (SELECT * FROM t t2 ORDER BY val <=> t.val LIMIT 1) t2 WHERE t.val != '[0,0,0]' ORDER BY t.val;
DROP TABLE t;
[parent: 2f999115540f]