ID:               48568
 User updated by:  karsten at typo3 dot org
 Reported By:      karsten at typo3 dot org
 Status:           Closed
 Bug Type:         PDO related
 Operating System: OSX 10.5.7
 PHP Version:      5.3.0RC3
 New Comment:

Ah, good to know. Thanks!


Previous Comments:
------------------------------------------------------------------------

[2009-06-16 14:44:48] [email protected]

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.

------------------------------------------------------------------------

[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

Reply via email to