From a87cefa64d4069d3066d08e6e299ce661507d2ae Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 13 May 2012 17:36:43 +0200
Subject: [PATCH] Fix: pgsql

---
 htdocs/core/db/pgsql.class.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 2f42a9cb9c4..2ef7e5a6ce3 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -278,7 +278,8 @@ class DoliDBPgsql
                 // ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)
                 if (preg_match('/ALTER\s+TABLE\s+(.*)\s*ADD CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*(.*)$/i',$line,$reg))
                 {
-                     $line.=" DEFERRABLE INITIALLY IMMEDIATE";
+                    $line=preg_replace('/;$/','',$line);
+                    $line.=" DEFERRABLE INITIALLY IMMEDIATE;";
                 }
 
                 // alter table add [unique] [index] (field1, field2 ...)
-- 
GitLab