mysql cli indentation issue

Benubird asked:

I’ve got some really weird output from an sql query:

mysql> select concat('abcdef', license_code, 'c') from fulfillment_licenses_list limit 1;
+-------------------------------------+
| concat('abcdef', license_code, 'c') |
+-------------------------------------+
c    |ef06F1-DFD2-4425-83AF-A4EF
+-------------------------------------+
1 row in set (0.08 sec)

As you can see, it is missing the first 4 characters (abcd), while the ‘c’ that should be concatenated to the end is somehow pushed to before the start of the line. What could cause this?

More importantly, what can I do about it? How do I query this table in a way that produces meaningful, usable output, without the weird indentation? If I include any other columns, the output gets even more messed up until it is totally unintelligible.

My answer:


You somehow managed to embed a carriage return (r) into the data in your license_code field. You’re going to need to clean up the data, and figure out what bug in the application introduced the carriage return.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.