fix: use 'is not None' instead of truthiness for vector/payload in pgvector update (#5488)

This commit is contained in:
Hrushikesh Yadav
2026-06-11 22:12:38 +05:30
committed by GitHub
parent cf268da19d
commit 2dd2872c08
2 changed files with 35 additions and 2 deletions
+2 -2
View File
@@ -425,12 +425,12 @@ class PGVector(VectorStoreBase):
"""
self._ensure_collection()
with self._get_cursor(commit=True) as cur:
if vector:
if vector is not None:
cur.execute(
sql.SQL("UPDATE {} SET vector = %s WHERE id = %s").format(self._col()),
(vector, vector_id),
)
if payload:
if payload is not None:
# Handle JSON serialization based on psycopg version
if PSYCOPG_VERSION == 3:
# psycopg3 uses psycopg.types.json.Json