From: ce at netage dot bg
Operating system: linux
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: deferred constraints not raise error on commit
Description:
------------
When using deferred constraints in postgresql, the commit statement
doesn't raise exception on constraint violation
Reproduce code:
---------------
create table parent (id integer not null primary key);
create table child (parent integer not null references parent(id)
deferrable);
$dbh = new PDO('pgsql:dbname=test;host=localhost');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->beginTransaction();
$dbh->exec('SET CONSTRAINTS ALL DEFERRED');
$dbh->exec('insert into child VALUES (1)');
$dbh->commit();
Expected result:
----------------
PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[23503]: Foreign key violation: 7 ERROR: insert or update on
table "child" violates foreign key constraint "child_parent_fkey"
Actual result:
--------------
nothing
--
Edit bug report at http://bugs.php.net/?id=36681&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36681&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36681&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36681&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36681&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36681&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36681&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36681&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36681&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36681&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36681&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36681&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36681&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36681&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36681&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36681&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36681&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36681&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36681&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36681&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36681&r=mysqlcfg