What is a NULL value in PostgreSQL?

Answer

NULL represents the absence of a value — it is not zero, not empty string, not false. NULL follows three-valued logic: any comparison with NULL yields NULL (unknown), not TRUE or FALSE. NULL = NULL is NULL (not TRUE) — use IS NULL or IS NOT NULL to check for NULLs. Aggregate functions ignore NULLs (e.g., AVG skips NULL values). COALESCE(a, b, c) returns the first non-NULL argument — essential for providing defaults. NULLIF(a, b) returns NULL if a equals b (useful to avoid division by zero: NULLIF(divisor, 0)). NOT IN with a list containing NULL can return no rows — a common gotcha. Constrain with NOT NULL at column level.