diff --git a/ChangeLog b/ChangeLog
index 62682d0..51bd8c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 Changes for 1.8.3rc4
 
+ - [ZBX-416,ZBX-986] fixed problem of implicit cast with PostgreSQL 8.3, thanks to Fernando Ike de Oliveira (solo)
  - [ZBX-2803] added detection of the proper type to use in place of socklen_t (asaveljevs)
  - [ZBX-2822] fixed js error on node selection (Aly)
  - [ZBX-2821] fixed reference to removed icons (Vedmak)
diff --git a/src/zabbix_server/nodewatcher/nodesender.c b/src/zabbix_server/nodewatcher/nodesender.c
index f76c787..2823531 100644
--- a/src/zabbix_server/nodewatcher/nodesender.c
+++ b/src/zabbix_server/nodewatcher/nodesender.c
@@ -111,8 +111,13 @@ int calculate_checksums(int nodeid, const char *tablename, const zbx_uint64_t id
 							tables[t].fields[f].name);
 					break;
 				default	:
+#ifdef HAVE_POSTGRESQL
+					zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, ZBX_FIELDNAME_LEN + 13, "md5(%s::text)",
+							tables[t].fields[f].name);
+#else
 					zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, ZBX_FIELDNAME_LEN + 6, "md5(%s)",
 							tables[t].fields[f].name);
+#endif
 					break;
 				}
 			} else {
@@ -126,10 +131,17 @@ int calculate_checksums(int nodeid, const char *tablename, const zbx_uint64_t id
 							tables[t].fields[f].name);
 					break;
 				default	:
+#ifdef HAVE_POSTGRESQL
+					zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, 199,
+							"case when %s is null then 'NULL' else md5(%s::text) end",
+							tables[t].fields[f].name,
+							tables[t].fields[f].name);
+#else
 					zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, 192,
 							"case when %s is null then 'NULL' else md5(%s) end",
 							tables[t].fields[f].name,
 							tables[t].fields[f].name);
+#endif
 					break;
 				}
 			}
@@ -292,9 +304,15 @@ char	*get_config_data(int nodeid, int dest_nodetype)
 
 			if (r[0] == NULL || r[1] == NULL || (dest_nodetype == ZBX_NODE_SLAVE && *s != c[0]) ||
 				(dest_nodetype == ZBX_NODE_MASTER && *(s+1) != c[0]) || strcmp(r[0], r[1]) != 0) {
+#ifdef HAVE_POSTGRESQL
+				zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, 135, "%s,length(%s::text),",
+					table->fields[f].name,
+					table->fields[f].name);
+#else
 				zbx_snprintf_alloc(&sql, &sql_allocated, &sql_offset, 128, "%s,length(%s),",
 					table->fields[f].name,
 					table->fields[f].name);
+#endif
 			}
 			s += 2;
 			f++;
