MySQL Forums
Forum List  »  Connector/Node.js

Re: Results are being padded
Posted by: Rui Quelhas
Date: June 29, 2018 02:28AM

Hi Amit,

that is the expected behavior for the CHAR type, as specified in the documentation (https://dev.mysql.com/doc/refman/8.0/en/char.html):

> The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length

You should use VARCHAR instead.

In any case, I guess the padding would have to be whitespaces and not "0"s, unless you are explicitly using a 'binary' charset instead of 'utf8' (which you probably are using by default). So, that actually might be an issue. We will investigate.

Options: ReplyQuote


Subject
Written By
Posted
June 24, 2018 04:49AM
Re: Results are being padded
June 29, 2018 02:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.