install plpython in postgresql 8 or 9
Asked Answered
A

1

8

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;
Anatolio answered 4/5, 2011 at 17:25 Comment(1)
Format your output properly - otherwise this posting is a disasterCoben
H
6

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.

Himes answered 4/5, 2011 at 17:49 Comment(6)
my postgres is 9 and when i use above command, i get errors :(Anatolio
Remove the leading > on the lines. That was there to show the command prompt. Also, change 8.2 to whatever version your dir is. Lastly, ensure that plpython.dll is actually inside C:\Program Files\PostgreSQL\x.x\binHimes
Did you make sure that plpython.dll is in the lib folder?Himes
Lastly, ensure that plpython.dll is actually inside C:\Program Files\PostgreSQL\x.x\bin I made an error on this comment above, sorry, it's actually C:\Program Files\PostgreSQL\x.x\lib.Himes
i found the solution, all these problems are related to my x64 postgresql and its x86 dll s. thanks so much for your realtime helping :)Anatolio
Thanks for posting the solution. I'll make a note of this in case someone else has the same problem.Himes

© 2022 - 2024 — McMap. All rights reserved.