Search code examples
pythonpostgresqlinstallationplpython

install plpython in postgresql 8 or 9


i want to install plpython on postgresql to have python trigger

when i restore my DB (my db has some python trigger) this error apears (error message was too big so i paste first lines of it):

C:/Program Files/PostgreSQL/9.0/bin/pg_restore.exe
   --host localhost
   --port 5432
   --username "postgres"
   --dbname "mfa"
   --verbose
   "%HOMEPATH%/Desktop/EhSAA/MFA/db_schema/mydb.backup"

pg_restore: connecting to database for restore
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating PROCEDURAL LANGUAGE plpgsql
pg_restore: creating PROCEDURAL LANGUAGE plpythonu
pg_restore: [archiver (db)] Error while PROCESSING TOC:

pg_restore: [archiver (db)] Error from TOC entry 315; 2612 16595
                                  PROCEDURAL LANGUAGE plpythonu postgres

pg_restore: [archiver (db)] could not execute query:
ERROR: could not load library "C:/Program Files/PostgreSQL/9.0/lib/plpython.dll":
The specified module could not be found.

Command was:

CREATE OR REPLACE PROCEDURAL LANGUAGE plpythonu;

Solution

  • It looks like you need to put plpython.dll in C:/Program Files/PostgreSQL/9.0/lib. I just tried the following commands on my system, and it worked.

    cd C:\Program Files\PostgreSQL\8.2\bin
    createlang --dbname=MyDb plpythonu -U myuser
    

    Checking into my C:\Program Files\PostgreSQL\8.2\lib reveals that I have plpython.dll in there. As your error says, it looks like plpython.dll is missing from the lib folder of your postgresql installation.