Boolean field nullable problem
Ivan Smahin
ivan_smahin at paradigmasoft.com
Tue Jul 21 01:12:30 CDT 2015
Hi Jon,
> On Jul 20, 2015, at 11:25 PM, jda <jda at his.com> wrote:
>
> Hi Ruslan,
>
> I just upgraded from 5.5.2 to the current release (5.8.6 I think) and of course it broke some of my code.
>
> I have a boolean field that I add to the database like this
>
> ALTER TABLE bibAndDoc ADD forCitation Boolean
>
> In the past I’ve done queries for “forCitation=false”. Worked fine.
>
> But in 5.8.6 these queries return nothing. I look in Valentina Studio and see that this is a nullable field. If I search for IS NULL I get hits. Is this a bug? I don’t want the field to be nullable (it’s a boolean). And if it is for some reason, I want the search for FALSE to find fields that are not TRUE. This is how it always worked.
>
> Is this a bug I should report. I don’t want to change my searches to look for NULL or false…
>
Indeed, a long time any boolean field was not nullable always. But we consider it is wrong because NULL is sort of "unknown" value - it differs from true or false. If you need true/false values only you should make that field "not nullable". Something like this:
ALTER TABLE t1 ADD f1 Boolean NOT NULL;
--
Best regards,
Ivan Smahin
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com
More information about the Valentina
mailing list