on postgresql 9.1 db patching to zabbix 2.0 schema fails with :
language "plpgsql" already exists
we change the language in two locations :
hosts.sql:CREATE LANGUAGE 'plpgsql';
hosts.sql:DROP LANGUAGE 'plpgsql';
node_cksum.sql:CREATE LANGUAGE 'plpgsql';
node_cksum.sql:DROP LANGUAGE 'plpgsql';
pgsql 9.0 release notes ( http://www.postgresql.org/docs/9.0/static/release-9-0.html ) say :
"PL/pgSQL is now installed by default"
our approach of unconditional adding & removing of plpgsql might have a side effect where users with 9.0 were supposed to have plpgsql, but after zabbix patch they do not have it anymore.
(or zabbix user might not have permissions to drop the language and that would error out as well. to be tested)
potential solution is suggested at http://wiki.postgresql.org/wiki/CREATE_OR_REPLACE_LANGUAGE - but it probably should be modified to add language only if it's missing, and remove it only if we added it