Bug with UNION ALL

Bug with UNION ALL

am 15.05.2003 15:09:56 von slack

Hi!
UNION ALL works incorrectly with NULLs when making queries that can return
with NULL.
For example, when we use LEFT JOIN on 2 tables, we can get NULL in result
for second table. if we make that as a single query, we get:
tbl ID Para Cr_ IDD Par
1 5613 5492 NULL NULL NULL
1 5594 5492 NULL NULL NULL
1 5638 5492 NULL NULL NULL
1 5653 5492 NULL NULL NULL
1 5739 5738 NULL NULL NULL

when we UNION ALL 2 or more queries, we can get:

tbl ID Parent_id ID Cr__
1 5632 0 0 0
1 5633 0 0 0
1 3657 3135 119 1
1 5653 5492 182 1
1 5732 0 0 1
1 5738 0 171 1
1 3045 1675 122 1
1 3135 3045 160 1
1 5492 0 170 1
1 5634 0 0 1

the result shown above is stable:
we've get a garbage data in columns, that MUST be NULL.


Thanx!


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: Bug with UNION ALL

am 15.05.2003 19:05:32 von Peter Zaitsev

On Thu, 2003-05-15 at 17:09, slack@slackware.ru wrote:
> Hi!
> UNION ALL works incorrectly with NULLs when making queries that can return
> with NULL.
> For example, when we use LEFT JOIN on 2 tables, we can get NULL in result
> for second table. if we make that as a single query, we get:
> tbl ID Para Cr_ IDD Par
> 1 5613 5492 NULL NULL NULL
> 1 5594 5492 NULL NULL NULL
> 1 5638 5492 NULL NULL NULL
> 1 5653 5492 NULL NULL NULL
> 1 5739 5738 NULL NULL NULL
>

This issue looks like the one fixed in MySQL 4.0.13
The official binary is out in a few days but if you wish to check bug is
fixed now you can pull version from our BK tree. The detailed docs are
available at following location:

http://www.mysql.com/doc/en/Installing_source_tree.html

If you'll be able to repeat the bug still please make sure to create
repeatable test case for it which can be checked simply by

mysql test < queries.sql

Many bugs are data/structure dependent so basic description often does
not help.


--
Are you MySQL certified?, http://www.mysql.com/certification/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Peter Zaitsev
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Moscow, Russia
<___/ www.mysql.com


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org