Bug #73259 trailing spaces show up in the formatting
Submitted: 10 Jul 2014 13:29 Modified: 11 Aug 2014 12:15
Reporter: Alex Boese Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.6.17 OS:Windows
Assigned to: CPU Architecture:Any
Tags: display, formatting, result

[10 Jul 2014 13:29] Alex Boese
Description:
I have this udf I created to pull contents out of a set depending on position. Anyway, I was noticing that the result set has an unnecessary tendency to pad with extra spaces for no obvious reason. Allow me to demonstrate:

This should be simply '' as a result, but the display makes it confusing:

mysql> select udf_pos_set('asd,asd',9) i;
+------+
| i    |
+------+
|      |
+------+
1 row in set (0.00 sec)

Even here it's padded with extra:
mysql> select udf_pos_set('asd,asd',0) i;
+------+
| i    |
+------+
| asd  |
+------+
1 row in set (0.00 sec)

This is what I normally expect:
mysql> select 0;
+---+
| 0 |
+---+
| 0 |
+---+
1 row in set (0.00 sec)

This is normal too:
mysql> select 0 i;
+---+
| i |
+---+
| 0 |
+---+
1 row in set (0.00 sec)

This shows that no spaces are passed by the function, but extra padding instead:
mysql> select concat(",",udf_pos_set('asd,asd',2),",") i;
+------+
| i    |
+------+
| ,,   |
+------+
1 row in set (0.00 sec)

This is normal:
mysql> select "a";
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)

This is normal:
mysql> select "a" as "a";
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)

This is normal:
mysql> select 'a' as 'a';
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)

This is normal:
mysql> select 'ab' as 'a';
+----+
| a  |
+----+
| ab |
+----+
1 row in set (0.00 sec)

This is normal:
mysql> select 'abb' as 'a';
+-----+
| a   |
+-----+
| abb |
+-----+
1 row in set (0.00 sec)

This is normal too:
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.6.17    |
+-----------+
1 row in set (0.00 sec)

How to repeat:
See steps above.

Suggested fix:
None known.
[11 Jul 2014 12:15] MySQL Verification Team
Thank you for the report.
Could you please provide the complete repeatable test case(udf code, all the steps)?

Thanks,
Umesh
[12 Aug 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".