August 6th, 2003, 03:58 PM
Cannot use plpgsql
I try to create a function using clause LANGUAGE 'plpgsql', but an error occurs: Language plpgsql does not exist.
I think that maybe need to configure plpgsql support, but I don't know what to do.
I appreciate some help.
August 6th, 2003, 04:01 PM
CREATE FUNCTION plpgsql() RETURNS language_handler AS '$libdir/plpgsql';
CREATE LANGUAGE plpgsql HANDLER plpgsql();
I'm not sure that it's right so RTFM
August 6th, 2003, 05:06 PM
You're right this is syntax I followed from psql:
CREATE FUNCTION plpgsql_call_handler()
RETURNS language_handler AS
CREATE LANGUAGE plpgsql
August 6th, 2003, 05:51 PM
but you know, that $libdir is a postgres variable and you can use it instead /usr/local/postgresql/lib (to make your applications more flexible).
August 6th, 2003, 10:30 PM
You can also do that from the command line with the 'createlang' command, the same way you create a new database:
createlang plpgsql [databasename]