Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9.5
-
Fix Version/s: 1.9.6
-
Component/s: Zend_Test_PHPUnit
-
Labels:None
Description
If a Postgres database has tables with foreign keys, Zend_Test_PHPUnit_Db_Operation_Truncate fails with:
[SQLSTATE[0A000]: Feature not supported: 7 ERROR: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "foo" references "bar".
HINT: Truncate table "foo" at the same time, or use TRUNCATE ... CASCADE.]
The attached trivial patch fixes the problem on Postgres 8.3, but I don't know if it will work for older versions of Postgres. From what I can tell, the CASCADE parameter was added in 8.2. In 8.1, the documentation just says to TRUNCATE all the tables at once.
See:
http://www.postgresql.org/docs/8.2/interactive/sql-truncate.html
http://www.postgresql.org/docs/8.1/interactive/sql-truncate.html
Trivial patch that fixes the issue for Postgres 8.3