diff --git a/ChangeLog b/ChangeLog
index 3683cb014724cfea8c29e4585dcd73e270ba540a..c0a7917a08679f8d8de8f98b404bb7386e8a8f6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@ Fix: [ bug #520 ] Product statistics and detailed lists are wrong.
 Fix: [ bug #1240 ] traduction.
 Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation.
 Fix: [ bug #1280 ] service with not end of date was tagged as expired.
+Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference
 
 ***** ChangeLog for 3.5 compared to 3.4.* *****
 For users:
diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php
index ce1f6b9e3eaf2d0251311b52e86899f4bc1ba97e..923f04f992a5ed3c130526841658a309722e1603 100644
--- a/htdocs/core/db/mysql.class.php
+++ b/htdocs/core/db/mysql.class.php
@@ -985,7 +985,7 @@ class DoliDBMysql extends DoliDB
     {
         // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
         // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
-        $sql= "ALTER TABLE ".$table." ADD ".$field_name." ";
+        $sql= "ALTER TABLE ".$table." ADD `".$field_name."` ";
         $sql.= $field_desc['type'];
         if(preg_match("/^[^\s]/i",$field_desc['value']))
         if (! in_array($field_desc['type'],array('date','datetime')))
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 8a653fc65795e2013ed19dacaa71b1c4b84853b2..2ed4c74bb17fb858060d5deb3d9f9ed575a5f49a 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -979,7 +979,7 @@ class DoliDBMysqli extends DoliDB
     {
         // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
         // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
-        $sql= "ALTER TABLE ".$table." ADD ".$field_name." ";
+        $sql= "ALTER TABLE ".$table." ADD `".$field_name."` ";
         $sql.= $field_desc['type'];
         if(preg_match("/^[^\s]/i",$field_desc['value']))
         if (! in_array($field_desc['type'],array('date','datetime')))