Martijn Tonies wrote:
>>The manual <http://www.mysql.com/doc/en/Open_bugs.html> says
>>>The following problems are known and will be fixed in due time:
>>>All string columns, except BLOB and TEXT columns, automatically have
>>>all trailing spaces removed when retrieved. For CHAR types this is okay,
>>>and may be regarded as a feature according to SQL-92. The bug is that in
>>>MySQL Server, VARCHAR columns are treated the same way.
>>That seems the reverse of what you are saying.
> Indeed. Nevertheless, I'm right at this one :-)
I defer to your expertise on SQL standards. Regardless of the standard,
however, mysql does not pad CHARs with spaces. Thus, CHARs and VARCHARs
are identical from the client's point of view, so silently changing
CHARs to VARCHARs for tables with variable length rows does not affect
the client, but does save space and time. As I understand it, a string
is a string in mysql. CHAR and VARCHAR are just two string storage
methods. So long as that's true, mysql is doing you a favor when it
makes this change.
> Chars should be padded.
You mean according to the standard, I assume. I am unconvinced changing
mysql to pad CHARS at this point, at the cost of speed and compatibility
with existing code, is a good idea.
> With regards,
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
> Upscene Productions