#47547 [NEW]: MYSQLI_PRI_KEY_FLAG is not set when ORDER BY is used on LEFT JOINED table field
| From: | rok dot meglic at gmail dot com | Date: | Mon, 02 Mar 2009 18:38:46 +0000 |
| Subject: | #47547 [NEW]: MYSQLI_PRI_KEY_FLAG is not set when ORDER BY is used on LEFT JOINED table field | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-134330@lists.php.net to get a copy of this message | ||
From: rok dot meglic at gmail dot com
Operating system: Linux;Windows
PHP version: 5.2CVS-2009-03-02 (CVS)
PHP Bug Type: MySQLi related
Bug description: MYSQLI_PRI_KEY_FLAG is not set when ORDER BY is used on LEFT JOINED table field
Description:
------------
After we LEFT JOIN two tables and use ORDER BY on foreign table field the
MySQLI doesn't return the primary key flag correctly trough fetch_field
operation. The result is the same regardless of OS. MySQL 5.x is used.
Reproduce code:
---------------
$query = "select cn.id from c_news cn LEFT JOIN c_news_categories cc ON
cc.id = cn.area ORDER BY cc.name"; // if we dont use ORDER BY cc.name, the
primary flag is set correctly
if ($result = $mysqli->query($query)) {
while ($finfo = $result->fetch_field()) {
printf("Flags: %d\n", $finfo->flags);
printf("Primary key: %d\n\n", (bool) ($finfo->flags &
MYSQLI_PRI_KEY_FLAG));
}
$result->close();
}
Expected result:
----------------
Flags: 49699
Primary key: true
Actual result:
--------------
Flags: 32801
Primary key: 0
--
Edit bug report at http://bugs.php.net/?id=47547&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47547&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47547&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47547&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47547&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47547&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47547&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47547&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47547&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47547&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47547&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47547&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47547&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47547&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47547&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47547&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47547&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47547&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47547&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47547&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47547&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47547&r=mysqlcfg