Use COALESCE, IS NULL filters, and default vector functions to safely manage NULL values in ParadeDB columns.
ParadeDB’s text and vector functions error when they receive NULL inputs. Supplying defaults or filtering NULLs keeps searches fast and predictable.
Use IS NULL
or IS NOT NULL
on text, JSON, or vector columns before calling ParadeDB functions.
SELECT id FROM products WHERE description IS NULL;
Replace NULLs whenever the function expects non-NULL text or vector data.COALESCE()
is the simplest approach.
SELECT COALESCE(description,'') AS clean_desc FROM products;
Wrap ParadeDB’s embedder in COALESCE
to avoid runtime errors.
SELECT paradedb_embed(COALESCE(description,'')) AS vector FROM products;
Use COUNT(col)
to ignore NULLs or COUNT(*)
for all rows. SUM()
, AVG()
, and MAX()
automatically skip NULLs.
• Check NULLs on load
• Use defaults on inserts (DEFAULT ''
or zero-vector)
• Wrap ParadeDB calls in COALESCE
• Document assumptions in schema comments
.
No. Vector columns should store a valid array. Insert a zero-vector when no text exists.
No. PostgreSQL rewrites COALESCE into a fast CASE expression, so performance impact is negligible.
Yes. Add DEFAULT ''
for text or DEFAULT paradedb_embed('')
for vector columns during ALTER TABLE
.