[TYPO3-dev] Why have boolean database fields types like tinyint(4) etc?

Steffen Kamper info at sk-typo3.de
Thu Nov 12 17:55:31 CET 2009


Hi,

Ries van Twisk schrieb:
> 
> 
> I wouldn't opt for ENUM but keep it as tiny int,
> the main problem here is MySQL's odd behavior of the 'BOOLEAN' types 
> TRUE and FALSE.
> They are constants for 1 and 0. Apparently this is legal in MySQL SELECT 
> TRUE + TRUE;
> Which is totally bogus and doesn't make sense, code like that could even 
> sli`p into extension (I think core people are smarter..)
>

ouch

> I would simply accept that  MySQL doesn't have an efficient storage 
> mechanism for booleans.
> 
tinyint is totally ok, and it's small. Using 0 and 1 in query is also 
perfect, and it's compatible to any other DB.

> emulating ENUMS in other DB's might be more harder then it sounds like,
> special when it comes to modifying enums....
> 

i first liked ENUM, but in all the years i really didn't needed them. In 
general i do such logic in php and not in MySQL.

I see no real potential for optimizing for boolean. There are lot of 
other places where optimization is needed, so let's bundle the forces to 
them.

vg Steffen




More information about the TYPO3-dev mailing list