From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> |
---|---|
To: | Jon Collette <jon(at)etelos(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Boolean without default declared |
Date: | 2007-08-15 19:23:58 |
Message-ID: | 775216.56005.qm@web31807.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
--- Jon Collette <jon(at)etelos(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2007-08-15 19:36:14 | Re: Boolean without default declared |
Previous Message | Jon Collette | 2007-08-15 18:46:02 | Boolean without default declared |