Bug #7083 | CHAR columns should report correct length | ||
---|---|---|---|
Submitted: | 7 Dec 2004 20:30 | Modified: | 8 Jan 2014 14:38 |
Reporter: | Trudy Pelzer | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.0.3-alpha-debug | OS: | Linux (SuSE 9.1) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[7 Dec 2004 20:30]
Trudy Pelzer
[15 Apr 2005 10:28]
Alexander Barkov
Reassigning to Sergey Glukhov, due to leaving to UC.
[23 May 2005 12:07]
Michael Widenius
This is not a bug in CHAR_LENGTH() but a consequence of how CHAR columns are returned. In MySQL we automaticly strip of all end space from CHAR columns as the end spare are not signficant anyway. (In MySQL 5.0 we don't do this for VARCHAR columns as for these end space are significant) We can't change this in 5.0 becasue of the following reasons: - This would case a notable problem for current users as they have to add TRIM() around all character columns to get the current behaviour. - Having to use TRIM would be slow down things for normal users - LIKE expressions for CHAR columns would have to be rewritten to take into account space expansion - It would make MySQL notable slower for CHAR columns as we would have to padd all CHAR strings with end space when sending to the client. - In 5.1 we can probably add a mode for not automaticly striping of end space for CHAR columns to satisfy those users that would need this for compability reasons.
[19 Jul 2005 14:39]
Tal Kormas
Any idea when on 5.1 this would be fixed? We're unable to use MySQL until this issue is solved.
[8 Jan 2014 14:38]
Erlend Dahl
Setting this to 'verified' as we are discontinuing the use of 'to be fixed later'. The same behaviour is still there on mysql-trunk.
[11 Nov 2017 19:11]
Federico Razzoli
Frankly, I don't see how CHAR_LENGTH() behaviour contradicts the documentation. In my opinion this is the real bug here: if documentation doesn't specify a behaviour for CHAR, different users may expect different behaviours, based on their interpretation. By the way, behaviour and documentation ambiguity are still in 8.0.3.