pythonpostgresqlplpython

postgres and python


In postgres 9.2 I am trying to create a python program that can be a trigger. I want to run an external program (an exe on the local disk) so I am using python to run it. When I try to create a simple program like this:

CREATE FUNCTION one ()
RETURNS int
AS $$
# PL/Python function body
$$ LANGUAGE plpythonu;

I get the error:

ERROR:  language "plpythonu" does not exist
HINT:  Use CREATE LANGUAGE to load the language into the database.

When I run:

CREATE LANGUAGE plpythonu

I get the error:

ERROR:  could not access file "$libdir/plpython2": No such file or directory

I am using Windows 7 and python 2.5 .

I have looked in many places but cannot find a solution.

Any ideas?


Solution

  • To resolve this for plpython3, it was necessary to:

    Update: I've written a much better explanation here: https://stackoverflow.com/a/24218449/398670