#48568 [Opn->Csd]: Query to SQLite fails through PDO, works otherwise

From: Date: Tue, 16 Jun 2009 14:44:49 +0000
Subject: #48568 [Opn->Csd]: Query to SQLite fails through PDO, works otherwise
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138362@lists.php.net to get a copy of this message
ID: 48568 Updated by: scottmac@php.net Reported By: karsten at typo3 dot org -Status: Open +Status: Closed Bug Type: PDO related Operating System: OSX 10.5.7 PHP Version: 5.3.0RC3 New Comment: This was a bug in libsqlite 3.6.14.2, we've updated to 3.6.15 already in CVS so it should be fixed. Previous Comments: ------------------------------------------------------------------------ [2009-06-16 09:48:41] karsten at typo3 dot org 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 this bug report at http://bugs.php.net/?id=48568&edit=1

« previous php.bugs (#138362) next »