--- Jon Collette <jon@etelos.com> wrote:
> If a column with a boolean datatype doesn't have a default value. What
> type of value is set if nothing is inserted into that column? Here is
> my test table and the queries I have tried. I can't seem to be able to
> select the rows where happy has no value.
>
> *select * from users where happy = '';*
> ERROR: invalid input syntax for type boolean: ""
Databases have three value logic in it expressions.
is the expression true,
is the expression false,
is the expreassion unknown i.e. null.
SELECT * FROM users WHERE happy IS NULL;
UPDATE users SET happy = false WHERE happy IS NULL;
ALTER TABLE USER ALTER COLUMN happy SET NOT NULL;
Regards,
Richard Broersma Jr.