diff --git a/ChangeLog b/ChangeLog
index d85b8e3535d290d5c54a25173291c7ee781a56d4..de1d5fd70405d4f4f8a039ca8d0bdc13e04b5610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ English Dolibarr ChangeLog
 - Fix: ref_ext was not saved when recording a customer order from web service
 - Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
 - Fix: withdrawal create error if in the same month are deleted previus withdrawals.
+- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
 - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 4f253b47f8b5e1db45cade87e5e4c89ce1baf69f..678660b7e6ff5999ea816e9f6309b66088a72d99 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -287,8 +287,8 @@ class Task extends CommonObject
         $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").",";
         $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").",";
         $sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").",";
-        $sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null').",";
-        $sql.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').",";
+        $sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').",";
+        $sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').",";
         $sql.= " progress=".$this->progress.",";
         $sql.= " rang=".((!empty($this->rang))?$this->rang:"0");
         $sql.= " WHERE rowid=".$this->id;