DEV Community

Discussion on: Go nulls and SQL

Collapse
 
geraldew profile image
geraldew

Your description of COALESCE is not quite correct as it can be mis-read as inherently ensuring a non-NULL value. However if all items in the list are NULL then it returns NULL. Of course, putting a literal constant at the end does ensure a non-NULL.

Personally in data work I rarely suggest the best solution is to declare columns as NOT NULL as it tends to mask issues rather than resolve them.