Re: Query on support for trigger functions defined in a Shared library in Windows - Mailing list pgsql-hackers-win32
From | Reini Urban |
---|---|
Subject | Re: Query on support for trigger functions defined in a Shared library in Windows |
Date | |
Msg-id | 6910a60601270200s3e5fe7a6y@mail.gmail.com Whole thread Raw |
In response to | Re: Query on support for trigger functions defined in a Shared library in Windows ("Mehul Doshi-A20614" <mehul@motorola.com>) |
List | pgsql-hackers-win32 |
2006/1/24, Mehul Doshi-A20614 <mehul@motorola.com>: > This is related to the problem that I faced some time ago. I have > created a dll library file with inbuilt constraints and triggers. > I also built the same for Linux environment. Here's what I am facing. > Any clues as to what I am doing wrong? > > Linux: Fedora Core 2 Running Postgresql 7.4.2 > Windows: Windows XP Service Pack 2 running PostgreSQL 8.1.2 > > The testtrigfuncs.dll is placed in C:\Program Files\Test\lib\ directory > and in Linux it is placed in /opt/WMS/rel/lib/testtrigfuncs.so > > On linux when I do the following it works: > createdb test > test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS > trigger > test-# AS '/opt/WMS/rel/lib/testtrigfuncs.so' > test-# LANGUAGE C ; > CREATE FUNCTION > test=# > > On Windows for the same I get: (Includes extra \ to account for Windows) > > test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS > trigger > 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 > found. Surround the path with extra "" because of the space in the path. AS '"C:\\Program Files\\Test\\lib\\testtrigfuncs.dll"' Or better move your lib to a path without spaces. > 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. > > test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS > trigger > test-# AS 'C:\Program Files\Test\lib\testtrigfuncs.dll' > test-# LANGUAGE C ; > ERROR: component in parameter "dynamic_library_path" is not an absolute > path > test=# > > What is this absolute path? Where do I set it? While I know that if I > place > testtrigfuncs.dll in C:\Program Files\PostgreSQL\8.1\bin folder and do > the > same it works. > > test=# CREATE OR REPLACE FUNCTION trigf_stdhlr_pid_insert() RETURNS > trigger > test-# AS 'C:\\Program Files\\PostgreSQL\\8.1\\bin\\testtrigfuncs.dll' > test-# LANGUAGE C ; > CREATE FUNCTION > test=# > > Any clues on what I need to do to go ahead would be great. I want to be > able to do the > same thing on both Linux and Windows without having to write in > PostgreSQL\bin folder > where my program has no use of being there. > > Thanks & Regards, > Mehul > > > > -----Original Message----- > From: Mehul Doshi-A20614 > Sent: Wednesday, July 27, 2005 8:35 AM > To: 'Magnus Hagander'; pgsql-hackers-win32@postgresql.org > Cc: Mehul Doshi-A20614 > Subject: RE: [pgsql-hackers-win32] Query on support for trigger > functions defined in a Shared library in Windows > > > > Hi Magnus, > > Thanks. That helped me. I used MingW to compile the code. I still used > 8.0.0 because it is the version that we are currently working on. I will > migrate to 8.0.3 once I am Able to validate the entire setup. > > I did get another problem, if you could help me out, it would be great. > Problem Description: > 1) I generated the dll using the code. > 2) Added the following in postgresql.conf: > dynamic_library_path = 'C:\test\lib,$libdir' > The above didn't work so I went ahead and copied the dll into C:\Program > Files\PostgreSQL\8.0\lib\ > 3) I restarted the postmaster both times. I got this error both times. > :25: ERROR: could not load library "C:/Program > Files/PostgreSQL/8.0/lib/testtrigfuncs.dll": dynamic load error > > The log shows: > 2005-07-26 22:38:07 DEBUG: InitPostgres > 2005-07-26 22:38:07 DEBUG: StartTransaction > 2005-07-26 22:38:07 DEBUG: name: unnamed; blockState: DEFAULT; > state: INPROGR, xid/subid/cid: 33475/1/0, nestlvl: 1, children: <> > 2005-07-26 22:38:07 DEBUG: CommitTransaction > 2005-07-26 22:38:07 DEBUG: name: unnamed; blockState: STARTED; > state: INPROGR, xid/subid/cid: 33475/1/0, nestlvl: 1, children: <> > 2005-07-26 22:38:07 DEBUG: StartTransactionCommand > 2005-07-26 22:38:07 DEBUG: StartTransaction > 2005-07-26 22:38:07 DEBUG: name: unnamed; blockState: DEFAULT; > state: INPROGR, xid/subid/cid: 33476/1/0, nestlvl: 1, children: <> > 2005-07-26 22:38:07 DEBUG: ProcessUtility > 2005-07-26 22:38:07 DEBUG: find_in_dynamic_libpath: trying "C:/Program > Files/PostgreSQL/8.0/lib/testtrigfuncs.dll" > 2005-07-26 22:38:07 ERROR: could not load library "C:/Program > Files/PostgreSQL/8.0/lib/testtrigfuncs.dll": dynamic load error > 2005-07-26 22:38:07 DEBUG: proc_exit(0) > 2005-07-26 22:38:07 DEBUG: shmem_exit(0) > 2005-07-26 22:38:07 DEBUG: exit(0) > > However, when I ran the newly compiled postgres code (along with my test > dll in /usr/local/pgsql/lib) via msys. It didn't give me any such errors > and everything worked out fine. I don't know what I need to do to make > this dll which I built run with the already installed version of > PostgreSQL (8.0.0). I can upgrade it to 8.0.3 if it solves the problem. > > Please let me know. Thanks & have a nice day. > > > Thanks & Regards, > Mehul > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Reini Urban http://phpwiki.org/ http://spacemovie.mur.at/
pgsql-hackers-win32 by date: