Install Perl in PostgreSQL, The specified module could not be found.

Here i provide few steps to guide how to install Perl in windows PostgreSQL

1) Install ActivePerl to make your windows support Perl script.

2) Set Perl bin folder to windows environment variable

3) Restart PostgreSQL

4) Issue Createlang command

C:\>createlang -U postgres plperl DB_NAME

If you hit “The specified module could not be found” error, please view my below story.

C:\>createlang -U postgres plperl postgres
createlang: language installation failed: ERROR:  could not load library "C:/Program Files/PostgreSQ
L/8.2/lib/plperl.dll": The specified module could not be found.


hmm… It’s seem i’m missing plperl.dll file in my PostgreSQL library folder, however i check plperl.dll indeed exists in my PostgreSQL lib folder. I started to wonder what went wrong with this dll file? I downloaded a software call “Dependency walker”, it is a small program to check what are the dependency of a dll file. After check with Dependency walker, i find out plperl.dll is depend on a dll file call perl58.dll. As i know , Perl58.dll is a dll file in Perl version 5.8. haha.. ya i forgot to install Perl script in my windows, go here http://www.activestate.com/downloads/index.mhtml to install Active Perl on window. After install please remember to set Perl bin folder to windows environment variable. Try it again,

C:\>createlang -U postgres plperl postgres
createlang: language installation failed: ERROR:  could not load library "C:/Program Files/PostgreSQ
L/8.2/lib/plperl.dll": The specified module could not be found.


….WTF… i check with “Dependency walker”, everything is ok. All dll files are loaded. It drive me insane, and shut down PostgreSQL immediately. After few hours, i started PostgreSQL again, and issue command

C:\>createlang -U postgres plperl DB_NAME

Wow, plperl installed in my PostgreSQL successful. …………restart…..this is windows.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
7 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
JoelLeomarwa kartiChi FlehartyJean Myra Recent comment authors
newest oldest most voted
Joel
Guest
Joel

Thanks for the suggestion of Dependency Walker. Definitely a tool I will be using again! I had a different issue, but your suggestion of using Dependency Walker is helping me track down my issue. Thanks!

Leo
Guest
Leo

Thanks for the hint to the “Dependency walker” software. Helped me to get forward in a similar problem with PostgreSQL

marwa karti
Guest
marwa karti

Thanks for info , but still the error (specified module could not be found) is appear of me , and it is every time appearing to me lost lib

Chi Fleharty
Guest
Chi Fleharty

Great article and straight to the point. I am not sure if this is in fact the best place to ask but do you people have any ideea where to employ some professional writers? Thanks in advance :)

Jean Myra
Guest
Jean Myra

Thanks for the tips. Really a big help. However, I’m using Postgresql 9.0. The latest version of Active Perl (5.12) doesn’t work with it. I installed Perl 5.10 and I’ve got it working already. :)

lucia
Guest
lucia

Hi, yong, Could you tell me which version of Perl you installed? I have the same problem as you. And according to your solution steps, I got the following problem: D:\Program Files\Postgresql\bin>createlang –U postgres –e plperl example (example is my dbname) Password: SELECT oid FROM pg_catalog.pg_language WHERE lanname = ‘plperl’; CREATE LANGUAGE “plperl”; createlang: language installation failed: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. So maybe the version of Perl I have installed has something wrong?BTW, the installation of Perl goes very well and my version is Perl 5.8.9.build… Read more »

Stephen Agneta
Guest
Stephen Agneta

This post helped me out. Now I can help you.

I know why you had the issue finding perl58.dlla after your ActivePerl installation and why the issue resolved itself. It’s insufficient to simply install the perl58.dll and then add c:\Perl\bin to your PATH environment variable. THEN you must restart postgresql to obtain the new environment that contains the new PATH variable setting. THEN it will work.

Hope that helps.