9 May 2010

ERROR: language "plpgsql" does not exist

A freshly installed PostgreSQL 8.3 on OSX (Snow Leopard) via MacPorts would not accept the plpgsql language, this can be fixed easily:

-- Create a function handler:
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql' LANGUAGE C;

-- Create the language 'plpgsql'
CREATE TRUSTED LANGUAGE plpgsql
HANDLER "plpgsql_call_handler";

-- and I don't know if is a good thing to :
GRANT USAGE ON LANGUAGE plpgsql TO public;