From: karsten at typo3 dot org
Operating system: OSX 10.5.7
PHP version: 5.3.0RC3
PHP Bug Type: PDO related
Bug description: Query to SQLite fails through PDO, works otherwise
Description:
------------
After updating to 5.3.0RC3 two unit tests started to fail which worked
before. The same tests continue to succeed on MySQL and PostgreSQL, the
failure only occurs with SQLite.
Reproduce code:
---------------
<?php
/*
-- put this in test.db:
CREATE TABLE "referenceproperties" (
"parent" VARCHAR(36) NOT NULL,
"name" TEXT NOT NULL,
"namespace" TEXT NOT NULL DEFAULT '',
"index" INTEGER NOT NULL DEFAULT 0,
"value" VARCHAR(36) NOT NULL,
PRIMARY KEY ("parent", "name", "namespace", "index")
);
CREATE TABLE "properties" (
"parent" VARCHAR(36) NOT NULL,
"name" TEXT NOT NULL,
"namespace" TEXT NOT NULL DEFAULT '',
"multivalue" BOOLEAN NOT NULL DEFAULT '0',
"type" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY ("parent", "name", "namespace")
);
*/
$sql = 'SELECT "properties"."parent" FROM (SELECT DISTINCT "parent" FROM
"referenceproperties") AS "pv" JOIN "properties" USING ("parent")';
$databaseHandle = new \PDO('sqlite:test.db');
$databaseHandle->setAttribute(\PDO::ATTR_ERRMODE,
\PDO::ERRMODE_EXCEPTION);
$databaseHandle->prepare($sql);
?>
Expected result:
----------------
simply nothing
Actual result:
--------------
[note the doubled exception - wtf?]
kmac:~ karsten$ php test.php
PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 1 cannot join using column parent -
column not present in both tables' in /Users/karsten/test.php:6
Stack trace:
#0 /Users/karsten/test.php(6): PDO->prepare('SELECT "propert...')
#1 {main}
thrown in /Users/karsten/test.php on line 6
Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 1 cannot join using column parent -
column not present in both tables' in /Users/karsten/test.php:6
Stack trace:
#0 /Users/karsten/test.php(6): PDO->prepare('SELECT "propert...')
#1 {main}
thrown in /Users/karsten/test.php on line 6
--
Edit bug report at http://bugs.php.net/?id=48568&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48568&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48568&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48568&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48568&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48568&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48568&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48568&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48568&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48568&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48568&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48568&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48568&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48568&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48568&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48568&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48568&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48568&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48568&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48568&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48568&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48568&r=mysqlcfg