pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: rjuju (@rjuju) <noreply+rjuju@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] PR #890: Use NIL for empty lists
Date: Sat, 23 Aug 2025 10:07:48 +0000
Message-ID: <gh-pgvector-pgvector-890@github.com> (raw)

Postgres standard way to check for list emptiness is to compare a pointer to NIL rather than NULL.

inline patch 1: src/hnsw.c, src/ivfflat.c (+2/-2 lines) download inline-1.patchdiff --git a/src/hnsw.c b/src/hnsw.c index 5bfc6193e..606466c82 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -130,7 +130,7 @@ hnswcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Relation index; /* Never use index without order */ - if (path->indexorderbys == NULL) + if (path->indexorderbys == NIL) { *indexStartupCost = get_float8_infinity(); *indexTotalCost = get_float8_infinity(); diff --git a/src/ivfflat.c b/src/ivfflat.c index 9e8370ffe..c4cd1bbdf 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -92,7 +92,7 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Relation index; /* Never use index without order */ - if (path->indexorderbys == NULL) + if (path->indexorderbys == NIL) { *indexStartupCost = get_float8_infinity(); *indexTotalCost = get_float8_infinity();

view thread (7+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-890@github.com>
Permalink:  ../gh-pgvector-pgvector-890@github.com/

 ·  · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox