[ZBX-3063] not compatible with PostGreSQL 9.x Created: 2010 Sep 30  Updated: 2017 May 30  Resolved: 2011 Jul 06

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: 1.8.6

Type: Incident report Priority: Critical
Reporter: Andrey Groshev Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

zabbix-1.8.3
postgresql-9.0
freebsd-8.1-amd64



 Description   

I tried a bunch of zabbix and postgresql 9.0.
Discovered the following problem - not showing pictures.
The problem is that PG9 by default uses a new type of output data BYTEA.
Here is a small patch that-be tell PG to give data in the old format.

#diff -u db.inc.php.bak db.inc.php
— db.inc.php.bak 2010-09-30 13:14:29.000000000 +0400
+++ db.inc.php 2010-09-30 14:12:21.000000000 +0400
@@ -83,6 +83,10 @@
$error = 'Error connecting to database';
$result = false;
}
+/* if pg_version exist and begins with the nines then set bytea_output = 'escape', as PG9 new hex bytea default type output. */
+ elseif(($ver = pg_version($DB['DB'])) && preg_match('/^9.*/',$ver['server']))

{ + DBexecute('set bytea_output = escape'); + }

break;
case 'ORACLE':
$connect = '';



 Comments   
Comment by Florian Koch [ 2011 May 01 ]

Hi,

we have had the same problem.
your solution fix the problem.

@zabbix Dev

please integrate this fix in 1.8.6

rgds Florian

Comment by Denis [ 2011 May 16 ]

thanks!
your solution fix the problem

Zabbix Server v1.8.4
PostgreSQL 9.0.4
PHP 5.1.6 (cli)
CentOS release 5.6 (Final), 2.6.18-238.9.1.el5PAE, i386

Comment by Alexey Fukalov [ 2011 Jun 16 ]

dev branch: ZBX-3063

Comment by Andrey Groshev [ 2011 Jun 16 ]

Не прошло и года

Comment by Andrey Groshev [ 2011 Jun 21 ]

why reopen?

Comment by richlv [ 2011 Jun 21 ]

issue was reopened to make version check more generic (instead of checking for 9 exclusively, check for >= 9)

Comment by Andrey Groshev [ 2011 Jun 24 ]

....
elseif(($ver = pg_version($DB['DB'])) && (int)$ver['server']>8){
....
P.S. sorry for the many edits, I'm today in blow.

Comment by Andrey Groshev [ 2011 Jun 28 ]

....
elseif ((int)pg_parameter_status($DB['DB'],"server_version")>8)

{ DBexecute('set bytea_output = escape'); }

....
Just another variant. Make your choice!

Comment by Jamie Duncan [ 2011 Jun 29 ]

confirmed the original diff worked on the following setup:

[root@sfo-it-zabbix-prod-01 zabbix]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root@sfo-it-zabbix-prod-01 zabbix]# rpm -qa postgresql-server
postgresql-server-9.0.0-1PGDG.el5
[root@sfo-it-zabbix-prod-01 zabbix]# rpm -qa zabbix-server
zabbix-server-1.8.4-4.el5.fws

Comment by Daniel Santos [ 2011 Jun 30 ]

Same problem here. The solution works like a charm. Thanks a lot. Please, include this fix in 1.8.6.

An alternative way is to change bytea_output = 'escape' in postgresql.conf.

Zabbix Server v1.8.5
PostgreSQL 9.0.3
PHP 5.1.6 (cli)
CentOS release 5.6 (Final), 2.6.18-194.32.1.el5 x86_64

Comment by Aleksandrs Saveljevs [ 2011 Jul 05 ]

In distributed monitoring setup images were not synchronized properly. So I have applied the same fix to the server, too.

Available in development branch svn://svn.zabbix.com/branches/dev/ZBX-3063 and is currently being reviewed.

Comment by Alexey Fukalov [ 2011 Jul 06 ]

branches/1.8 20439

Generated at Thu Mar 28 12:05:43 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.