After explaining my problem on IRC, formorer showed me an SQL expression that creates plpgsql only if needed. You'll notice that plpgsql is created with CREATE LANGUAGE because since PostgreSQL 9, plpgsql is created by default. Hence, if it needs to be created the old CREATE LANGUAGE construct should be used.
I tried installing dspam with this patch with both PostgreSQL 8.4 from Squeeze and PostgreSQL 9.1 from Wheezy with success. Purging works fine too. If this diff suits you, should I rather upload to tpu with a new changelog entry as in the attached debdiff or merge the entry in the previous one so that only one upload appears to have been done? Best regards, Thomas
diff -Nru dspam-3.10.1+dfsg/debian/changelog dspam-3.10.1+dfsg/debian/changelog --- dspam-3.10.1+dfsg/debian/changelog 2013-03-04 17:39:52.000000000 +0100 +++ dspam-3.10.1+dfsg/debian/changelog 2013-03-07 11:03:34.000000000 +0100 @@ -1,6 +1,12 @@ +dspam (3.10.1+dfsg-11) testing-proposed-updates; urgency=low + + * Create plpgsql only if it is not loaded yet. + + -- Thomas Preud'homme <robo...@debian.org> Thu, 07 Mar 2013 10:25:49 +0100 + dspam (3.10.1+dfsg-10) testing-proposed-updates; urgency=low - * Explicitely require legacy mode for string escaping in PostgreSQL since it + * Explicitly require legacy mode for string escaping in PostgreSQL since it now defaults to standard compliant mode (Closes: #694942). * Fix error when creating database in PostgreSQL by creating plpgsql as extension instead of language. diff -Nru dspam-3.10.1+dfsg/debian/sqlfiles/install-dbadmin/pgsql dspam-3.10.1+dfsg/debian/sqlfiles/install-dbadmin/pgsql --- dspam-3.10.1+dfsg/debian/sqlfiles/install-dbadmin/pgsql 2013-03-04 17:39:52.000000000 +0100 +++ dspam-3.10.1+dfsg/debian/sqlfiles/install-dbadmin/pgsql 2013-03-07 11:03:34.000000000 +0100 @@ -1 +1,19 @@ -CREATE EXTENSION IF NOT EXISTS plpgsql; +CREATE OR REPLACE FUNCTION public.create_plpgsql_language () + RETURNS TEXT + AS $$ + CREATE LANGUAGE plpgsql; + SELECT 'language plpgsql created'::TEXT; + $$ +LANGUAGE 'sql'; + +SELECT CASE WHEN + (SELECT true::BOOLEAN + FROM pg_language + WHERE lanname='plpgsql') + THEN + (SELECT 'language already installed'::TEXT) + ELSE + (SELECT public.create_plpgsql_language()) + END; + +DROP FUNCTION public.create_plpgsql_language ();
signature.asc
Description: This is a digitally signed message part.