> > IMHO boolean columns are just a little different because of their very > > nature. > > I don't see the difference. Where do you see it? > > > Sure, they can be set to be null but I really don't see the > > advantage in it. > > I've run across cases where something was best modeled by SQL-style > 3-valued logic (for example, yes/no/maybe sorts of things). Why > *wouldn't* I use a nullable boolean field for that?
Certainly not very 'academic' but from Wikipedia's page http://en.wikipedia.org/wiki/Boolean_data_type: "In computer science, the Boolean or logical data type is the most primitive data type, having one of two values (true or false), intended to represent the truth values of logic and Boolean algebra." Why do I think boolean columns are a little different? You could interpret that null is 'similar' to false because it is not true, but that could also be the case the other way around. If you look a the issue from the perspective of "well, a boolean column is just a column", yes, I agree, there is no difference. However if you look at boolean columns from the perspective of their most likely reason to exist they are different because they imply that they will always contain a value, either true or false and null is neither. That is different IMO than, for example, a date column, which could very possibly be conceived to contain either a date or no date at all. Could a boolean column be conceived to be null? Certainly, but again, not the most likely case in my experience. Although an interesting proposition I don't think I would ever use a boolean column to store "true/false/maybe sort of things". Of course, the column could be created to allow it but that, IMO, would defeat the purpose of the boolean column. I would rather use a different type because, as it happened to me in the past, a 'true/false/maybe' sort of scenario can quickly become a 'true/false/maybe/likely/not that likely/very likely' sort of scenario and then I would need to change my DB and code. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.