But the fact that I'll find length (name) the result is 3, should not?
CodePudding user response:
Really didn't pay attention to this problem, the understanding of the original and the original poster is the same, but the website on the document is written suchhttps://dev.mysql.com/doc/refman/5.7/en/char.html
If a given value is stored into the CHAR (4) and a VARCHAR columns (4), the values retrieved from the columns are not always the same because The trailing Spaces are removed from CHAR columns upon retrieval. The following example illustrates this difference:
CodePudding user response:
The length of a CHAR column is fixed to The length that declare The when you create The table. The length can be any value from 0 to 255. The when CHAR values are stored, they are right - padded with Spaces to The specified length. The when CHAR values are retrieved, trailing Spaces are removed unless The PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.Can try to perform set first session sql_mode PAD_CHAR_TO_FULL_LENGTH '='
Try perform length function results