From: "Wout Neirynck" <[EMAIL PROTECTED]>

> Appareantly it's impossible to insert a string, consisting entirely out of
> spaces, in a textual field (I've tried varchar(19) and char(2) types, they
> both don't work).  MySQL doesn't complain about it, but it trims the
> strings down to the empty string.  If I try a select searching for the
> spaces-only string afterwards, it gives me zero results.  The same problem
> occurs when updating.
>
> The problem does not occur, however, when converting the columns to "text"
> types.
>
> MySQL version: 3.23.47-nt
> OS: Windows NT 4.0
> Problem can be reproduced with MySQLGui and Java using the JDBC-MySQL
> bridge driver.
>
> Is this a bug or do I have to do something special to disable the 'string
> trimming'?  Any help would be greatly appreciated!


This looks to be a feature, not a bug.   :)

>From http://www.mysql.com/doc/B/L/BLOB.html:
"There is no trailing-space removal for BLOB and TEXT columns when values
are stored, as there is for VARCHAR columns."

Additionally, from the CHAR and VARCHAR section:
"When CHAR values are stored, they are right-padded with spaces to the
specified length. When CHAR values are retrieved, trailing spaces are
removed. [...] However, in contrast to CHAR, VARCHAR values are stored using
only as many characters as are needed, plus one byte to record the length.
Values are not padded; instead, trailing spaces are removed when values are
stored. (This space removal differs from the ANSI SQL specification.)"



--
denonymous
www.coldcircuit.net
denonymous.ne.mediaone.net



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to