[TYPO3-dev] Question about rev. 2186: TINYTEXT columns to VARCHAR(255)

R. van Twisk typo3 at rvt.dds.nl
Tue Mar 27 18:35:54 CEST 2007


Martin Kutschker wrote:
> Mathias Behrle schrieb:
>   
>> I just wanted to update my postgres schema to the changes of rev. 2186:
>> Replace all TINYTEXT columns with VARCHAR(255)
>>
>> My question is:
>> Does it explicitly have to be varchar(255) DEFAULT '' NOT NULL for the
>> new data type or could/should it also be TEXT ?
>>     
Use TEXT unless you want to setup a constracint on the text size you 
want to storage
. But since the TCA will setup that constraint for you. I would suggest 
using TEXT.

>> Background:
>> 1) I have already NULL values in some of these fields, that were until
>> now bytea in postgres. Since DBAL until now maps fields of type
>> text NOT NULL to just text, it should be possible to keep the NULL
>> values. 
>>     
>
> Why do you need those NULLs? I think the reason for dropping the NOT NULL 
> is that for TEXT columns the behaviour of DEFAULT and NOT NULL varies in an 
> incompatble way between different RDBMSs.
>   
I believe 'we' had problems with oracle. Oracle uses NULL as a empty 
TEXT string (which is
different from heaving a TEXT string of 0 bytes, just to clarify).
But from PHP I don't think it's a big problem. NULL will be converted to 
a empty string whenever needed,
this is just a wild guess....
>   
>> 2) more important:
>> the postgres manual says:
>>  There are no performance differences between these three types
>>  (the different character types), apart
>>  from the increased storage size when using the blank-padded type. While
>>  character(n) has performance advantages in some other database systems,
>>  it has no such advantages in PostgreSQL. In most situations text or
>>  character varying should be used instead.
>>     
>
> Well, it says that is a difference for other systems, so DEFAULT '' NOT 
> NULL makes sense.
>
> I suggest you change all '' to NULL.
>   
This 'might' lead to problems... But I am not sure how TCA will behave.
a default '' NOT NULL follows a bit more what mysql does I think.
>   
>> OTOH I read in the thread
>> http://lists.netfielders.de/pipermail/typo3-team-core/2006-June/004733.html
>> that for matters of string comparison there shouldn't be any NULL values
>> in text fields. 
>>
>> So please could someone shed a little light if
>>
>> 1)  varchar(255) was used in this case for just performance purposes of
>> mysql
>>     
>
> TINYTEXT is Mysql specific and should work the same as VARCHAR(255) as 
> TYPO3 does not really work with NULL values and usually relies on DEFAULTs.
>   
Jusr use TEXT....
>   
>> 2) text fields in postgres should have as well as varchar some default
>> ('') inserted, which is currently not the case
>>     
>
> See above.
>
> Masi
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>   





More information about the TYPO3-dev mailing list