Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is phpMyAdmin doing to my UNION ALL query?

The following query returns 1 row:

SELECT `coach_id` FROM `table_a` WHERE `coach_id` = 8
UNION ALL
SELECT `coach_id` FROM `table_b` WHERE `coach_id` = 8

But SELECT coach_id FROM table_b WHERE coach_id = 8 returns 2 rows.

And SELECT coach_id FROM table_a WHERE coach_id = 8 returns 1 row.

I'm using UNION ALL to avoid the DISTINCT filtering, because I'm actually just interested in the total number of rows. Still it seems to behave like regular UNION a.k.a UNION DISTINCT.

Whats going on here? Query is executed in phpMyAdmin 4.5.2 interface on MariaDB 10.1.9 Server.

Update

I just discovered that the mysql command line client behaves like expected. So the failure has to be somewhere within my stack of nginx 1.8.0, PHP 5.6.16 mysqli and phpmyadmin.

Update 2

When I run the query from a php script (using mysqli) it also correctly returns 3 rows. I guess that leaves nothing but phpMyAdmin to cause this phenomenon. Thanks for the help so far and sorry that the question has been misleading. I didn't know better...

like image 979
Arsylum Avatar asked Nov 09 '22 23:11

Arsylum


1 Answers

This is a phpMyAdmin bug, which is fixed in v4.5.3.0 (2015-12-23).

like image 118
Code Avatar answered Nov 14 '22 21:11

Code