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

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Fri Mar 23 15:20:31 CET 2007


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 ?
> 
> 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.

> 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.

> 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.

> 2) text fields in postgres should have as well as varchar some default
> ('') inserted, which is currently not the case

See above.

Masi




More information about the TYPO3-dev mailing list