diff --git a/test/t/020_hnsw_limit.pl b/test/t/020_hnsw_limit.pl index 70dfd9c..68ec877 100644 --- a/test/t/020_hnsw_limit.pl +++ b/test/t/020_hnsw_limit.pl @@ -23,6 +23,12 @@ my $explain = $node->safe_psql("postgres", qq( )); like($explain, qr/Index Scan/); +# Test limit with CTE +$explain = $node->safe_psql("postgres", qq( + EXPLAIN ANALYZE WITH cte AS (SELECT * FROM tst ORDER BY v <-> '[1,2,3]' LIMIT 40) SELECT * FROM cte; +)); +like($explain, qr/Index Scan/); + # Test limit + offset $explain = $node->safe_psql("postgres", qq( EXPLAIN ANALYZE SELECT * FROM tst ORDER BY v <-> '[1,2,3]' LIMIT 30 OFFSET 10; @@ -35,6 +41,12 @@ $explain = $node->safe_psql("postgres", qq( )); like($explain, qr/Seq Scan/); +# Test limit > ef_search with CTE +$explain = $node->safe_psql("postgres", qq( + EXPLAIN ANALYZE WITH cte AS (SELECT * FROM tst ORDER BY v <-> '[1,2,3]' LIMIT 41) SELECT * FROM cte; +)); +like($explain, qr/Seq Scan/); + # Test limit + offset > ef_search $explain = $node->safe_psql("postgres", qq( EXPLAIN ANALYZE SELECT * FROM tst ORDER BY v <-> '[1,2,3]' LIMIT 31 OFFSET 10;