[Open-bio-l] char(n) vs. varchar(n) in BioSQL

Thomas Down td2@sanger.ac.uk
Fri, 8 Mar 2002 20:47:53 +0000


Hi...

During the last round of schema-changes, some columns
were changed from varchar(n) to char(n) data types.  When
I questioned this, I was told that it's still possible to
store variable-length strings in char(n) columns.  This
doesn't turn out to be entirely true.  MySQL includes some
special-case code to strip trailing spaces when retrieving
char(n) attributes, which gives the illusion of supporting
variable length strings.  Other databases don't even do
this.

Anyway, just to give other implementors a heads-up: strings
from the ontology_term.term_name and seqfeature_source.source_name
columns will need to be trimmed client-side, if you want to
maintain database portability.  I still think these should
probably have stayed varchar(n).  On the other hand, it's
not a big enough issue to warrant another schema change.

    Thomas.