PostgreSQL 9.0.5 concat Issue

From: "Keegan,Nate" <nate(dot)keegan(at)prescott-az(dot)gov>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: PostgreSQL 9.0.5 concat Issue
Date: 2011-11-09 23:00:02
Message-ID: 0488BA670C8E594D93BE0556FEB89063051C5E7587@obsidian.ad.cityofprescott.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm using a Perl script to take SNMP traps and send them to Zabbix on FreeBSD 8.2-RELEASE amd64.

The original Perl script can be found at http://www.zabbix.com/wiki/howto/monitor/snmp/snmp_traps_-_a_new_solution

This script works just fine under PostgreSQL 9.0.4.

I'm using the FreeBSD ports system to manage PostgreSQL and Zabbix and I noticed that a test upgrade to PostgreSQL server 9.0.5 causes the script to break in a predictable way.

The script debug log is showing this:

/usr/local/bin/zabbix_sender --zabbix-server 127.0.0.1 --port 10051 --host Template_Dell_OpenManage

This is incorrect as 'host' should be an actual hostname and not the name of a Zabbix template (the Template_blah_blah part).

/var/log/messages on my system has some output that takes me to the following line in the script:

$dbh->selectrow_hashref("SELECT itemid,description,key_ FROM items where hostid='$hostid' and \
'$keyoidvaluenum' like concat(key_,'%') order by length(key_) desc limit 1;");

And here is the /var/log/messages output:

ERROR: function concat(character varying, unknown) does not exist at character 98
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
STATEMENT: SELECT itemid,description,key_ FROM items where hostid='10022' and '.1.3.6.1.4.1.318.0.77' like concat(key_,'%') order by length(key_) desc limit 1;

There is only one line in the script which uses the concat function so I'm sure I'm in the right spot.

I'm guessing that the concat function changed between PostgreSQL 9.0.4 and 9.0.5 in a subtle way that is breaking this script by causing the wrong information to be returned from the database.

I can see the hint being offered but I'm unsure as to how to implement this in the given line of code exactly. I would be very grateful for any advice or direction as to how I might go about fixing this item.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-11-09 23:04:07 Re: Weird waste time when UNION ALL to an empty result set
Previous Message Robert Treat 2011-11-09 22:26:50 Re: SIGNALNAME in "pg_ctl kill"