[TYPO3-core] RFC #8542: Cannot create page with Mysl in strict mode (STRICT_TRANS_TABLES)

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Thu May 29 13:58:18 CEST 2008


Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> Martin Kutschker wrote:
>> After further analysis I have found that the problem is a bit odd. THe 
>> TCA has the type "group"/"db" which uses an integer when uses as "MM". 
> 
> Because it stores only number of MM relations in this case.

Sorry, that wasn't the odd part.

>> But this is not the case for "storage_pid". What we have here is a 
>> field that has "maxitems" of 1 and "prepend_tname" = 0, which means 
>> that there will only be an integer stored and not a comma separated 
>> list of strings. TYPO3 copes with the fact that Mysql will turn an 
>> empty list/string into 0. This is fine, but a bit of a hack as a group 
>> with exactly one item isn't a group at all.
> 
> Wait, it is not the case. Integer will be 0 but string will be empty. 
> These are two valid cases. If you set prepend_tname to false, you can 
> use integer and have 0 in it because it is logical for integer field. 
> But having 0 in string field is not logical, in fact it is invalid 
> reference value. And if you use prepend_tname=true, you just cannot have 
> just 0 in the string field, it is not valid (due to prepend_tname).

Well, the point is that the same TCA type may be based on different 
Mysql types depending on additional properties. It's easy for MM fields, 
they always use INTs (this is documented). The only other combination 
I'm aware is the one I have outlined "maxitems" = 1 and "prepend_tname" 
= 0. In all other combinations the value be a comma separated list.

>> A "group"/"db" field that is no "MM" would usually be a VARCHAR, but 
>> because of the special constraints it may be an INT. What to do now? 
>> Change the fields in the Core to VARCHAR or make sure that all fields 
>> with such a setup write 0 to the DB? The latter would fix all 
>> occurrences in the Core an extensions that follow the (bad?) example 
>> of "storage_pid".
> 
> What about unsetting empty values in TCEmain? Leave it to MySQL to 
> decide what to put by default.

Hm, probably possible, but not logical. Because some value has to be set 
when you safe a TCE form that has been displayed. The error occurs when 
you want eg to save a new page. Then the incoming value is an empty 
string (because the field has been displayed) and not a 0 *. Also I'm 
not happy with unsetting values in the middle of the processing.

If "maxitems" = 1 and "prepend_tname" = 0 requires an integer, TYPO3 
should use one. No need to rely on DB defaults.

Masi

* So there is one more solution. Change TCE forms in such a way it uses 
0 as value for initial display.


More information about the TYPO3-team-core mailing list