Forum OpenACS Q&A: Response to NULL SQL issues

Collapse
Posted by MaineBob OConnor on

Thanks Dan, This code works great:

update users set admin_note = coalesce(admin_note,'') || ...

AND it saves me from "NOT NULLing" all the columns in existing tables and setting up a default.

This *may* be unconventional, but for what it's worth, I use NULLs regularly when customizing OACS code. I add a char(1) to an existing table then set it to a value such as "1" for true and NULL for false for various rows. This also allows me to use multiple other "true" values (such as an exclusion value) and is more useful than boolean values traditonally used in OACS code with a trailing "_p" in the column (field) name.

-Bob