php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38510 complex query leads to truncated resultset
Submitted: 2006-08-19 11:15 UTC Modified: 2006-08-19 16:24 UTC
From: mark at opeinmailadmin dot org Assigned:
Status: Not a bug Package: *Database Functions
PHP Version: 5.1.5 OS: GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 21 = ?
Subscribe to this entry?

 
 [2006-08-19 11:15 UTC] mark at opeinmailadmin dot org
Description:
------------
Following query actually yields four lines in MySQL's command line interface (which is correct), but in PHP only one line is fetched (which is definitely wrong) and no errors appear.

MySQL version is 5.0.24, connected through socket on localhost.

No difference with MySQL or MySQLi interfaces.


Reproduce code:
---------------
The query:
SELECT mbox, pate, COUNT( DISTINCT virt.address ) AS num_alias, COUNT( DISTINCT rexp.ID ) AS num_regexp
FROM user usr
LEFT OUTER JOIN virtual virt ON ( usr.mbox = virt.owner )
LEFT OUTER JOIN virtual_regexp rexp ON ( usr.mbox = rexp.owner )
WHERE pate = 'aaaa'
GROUP BY mbox, pate

... and the common CONNECT, QUERY, MYSQL_FETCH...

Expected result:
----------------
+--------+------+-----------+------------+
| mbox   | pate | num_alias | num_regexp |
+--------+------+-----------+------------+
| aaaa   | aaaa |        24 |          2 |
| pppppp | aaaa |         7 |          1 |
| rrrrr  | aaaa |         1 |          0 |
| ssssss | aaaa |         2 |          0 |
+--------+------+-----------+------------+


Actual result:
--------------
Only one line, the first one.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-19 16:24 UTC] mark at opeinmailadmin dot org
My tools (phpMyAdmin) have silently added LIMIT clauses to that query. So this might be a duplicate of http://bugs.mysql.com/bug.php?id=21705.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 01:01:28 2024 UTC