Postgres UNION-Based Query Returning Unexpected Null Rows
When a UNION or UNION ALL query in PostgreSQL returns rows with unexpected NULL values in columns that clearly have data in the underlying tables, the cause is almost always a mismatch between the columns being combined — not a bug in PostgreSQL itself, which handles UNION very literally. The Problem You combine results from … Read more