Here's a weird scenario that seems to be coming out of so many different
a) When the dll is placed in C:\Program Files\PostgreSQL\8.0\bin it
b) When the dll is placed in C:\Program Files\Test\lib, it fails if
dynamic_library_path is set to 'C:\Program Files\Test\lib;$libdir'
However I had help from two people on this,
i) Jean Marc: Replace \ with / i.e dynamic_library_path is set to
ii) Thomas Hallgreen: Do \\ instead of just \. i.e. dynamic_library_path
is set to 'C:\\Program Files\\Test\\lib;$libdir'
Now both of these "start to" work after some time only. There is no
logic that I can explain as to how they work.
Here's what I have tried to do to understand this behavior.
a) Uninstall postgres completely and delete the data folder.
b) Re-install Postgres.
c) Modify the postgresql.conf file with either of the methods. I used
method (ii) since it is more Windows like.
d) Modify the System Variable PATH to contain the extra term "C:\Program
d) Now I stop the service, start the service. I even rebooted my system.
e) On a new command prompt, I test it out ... Error as before. I can
verify the PATH variable does have C:\Program Files\Test\lib in it.
f) Anyways since I can't do much, I go back and add the dll to the bin
folder and start using it.
g) I can now go back to first command prompt and retest it starts to
work!!!. It works with libdir.
i)I can also go back and modify and delete the dll file that I placed in
the bin folder.
j) I can again retest the dll and it works fine.
Infact it starts to take the dynamic path perfectly.
test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS
test-# AS 'testrigfuncs'
test-# LANGUAGE C ;
I have tried this on 4 different systems running Windows XP (Service
Packs 1 & 2) using PostgreSQL 8.0 as well as PostgreSQL 8.1.
Any clues as to why it won't work till I placed the dll in
Postgresql\bin folder and then once I have placed the dll there and
used it, it starts to work at either places even if I delete the dll
from the bin folder.
Thanks & Regards,
[mailto:pgsql-hackers-win32-owner(at)postgresql(dot)org] On Behalf Of Magnus
Sent: Friday, January 27, 2006 2:32 AM
To: Mehul Doshi-A20614; pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: [pgsql-hackers-win32] Query on support for trigger
functions defined in a Shared library in Windows
> On Windows for the same I get: (Includes extra \ to account for
> test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS
> test-# AS 'C:\\Program Files\\Test\\lib\\testtrigfuncs.dll'
> test-# LANGUAGE C ;
> ERROR: could not load library "C:\Program
> Files\Test\lib\testtrigfuncs.dll": The specified module could not be
> I went and modified the dynamic_library_path to dynamic_library_path =
> 'C:\Program Files\Test\lib;$libdir'
> I also added C:\Program Files\Test\lib to the PATH variable.
> I restarted postgres service and then retried the below.
Are you sure you added this to the SYSTEM path and not the USER path?
Because if it's the second, it won't affect the pg service. I'd also try
a reboot after changing the one in SYSTEM - I've seen cases where it
didn't "take" even if the service was restarted.
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
pgsql-hackers-win32 by date
|Previous:||From: Reini Urban||Date: 2006-01-27 10:00:51|
|Subject: Re: Query on support for trigger functions defined in a Shared library in Windows|