bug in 4.04 with select constant and union
am 16.10.2002 22:05:24 von Oliver Seemann
hi there,
something's wrong when selecting constants within union clauses.
How-To-Repeat:
------------------------
mysql> select 'short'
-> union select 'not so short';
+-------+
| short |
+-------+
| short |
| not s |
+-------+
2 rows in set (0.00 sec)
------------------------
the lengths of all rows seem to be cut to the length of the first row.
i don't think that's the way it ought to be, is it?
it should have returned (just to avoid misunderstandings ;)
+--------------+
| short |
| not so short |
+--------------+
i'm running the 4.04 linux rpm version, i had the same problem with 4.02
iirc.
best regards,
oliver
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread12765@lists.mysql.com
To unsubscribe, e-mail
bug in 4.04 with select constant and union
am 17.10.2002 11:30:02 von Michael Widenius
Hi!
>>>>> "Oliver" == Oliver Seemann writes:
Oliver> hi there,
Oliver> something's wrong when selecting constants within union clauses.
Oliver> How-To-Repeat:
Oliver> ------------------------
mysql> select 'short'
-> union select 'not so short';
Oliver> +-------+
Oliver> | short |
Oliver> +-------+
Oliver> | short |
Oliver> | not s |
Oliver> +-------+
Oliver> 2 rows in set (0.00 sec)
Oliver> ------------------------
Oliver> the lengths of all rows seem to be cut to the length of the first row.
Oliver> i don't think that's the way it ought to be, is it?
The above is actually right.
The type of the first SELECT is the one that defines the types for all
other UNION parts.
In your case:
SELECT 'short'
defines the first column in the result to be CHAR(5)
All UNION results are converted to this.
In ANSI SQL it's actually an error if the different SELECT's doesn't
use exactly the same type. In MySQL we convert everything to the
first type.
Regards,
Monty
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread12770@lists.mysql.com
To unsubscribe, e-mail