[DBAL-147] PostgreSqlSchemaManager fails to set foreign key onDelete/Update option properly if table has 'SET NULL' or 'SET DEFAULT' foreign key constraints Created: 15/Aug/11  Updated: 27/Aug/11  Resolved: 27/Aug/11

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.1
Fix Version/s: 2.1.2

Type: Bug Priority: Major
Reporter: Payam Hekmat Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None


 Description   

This table structure:
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY(id));
CREATE TABLE t2 (id INT NOT NULL, fk_id INT DEFAULT NULL);
ALTER TABLE t2 ADD FOREIGN KEY (fk_id) REFERENCES t1(id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE;

will cause the listTableForeignKeys to produce incorrect results for the onDelete/Update constraints (the 'DEFAULT' or 'NULL' in 'SET DEFAULT' or 'SET NULL' respectively gets cut off).

This looks to be fixed in the main branch.



 Comments   
Comment by Kenny Millington [ 26/Aug/11 ]

Seems to be fixed in:-

https://github.com/doctrine/dbal/commit/208f995607a544f9606c83d36752a9fd96ed9e64

Would definitely be nice to have that ported to the 2.1.x branch.

Comment by Benjamin Eberlei [ 27/Aug/11 ]

Fixed and merged for 2.1.2

Generated at Sat Dec 20 18:50:06 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.