Re: Query on support for trigger functions

Mehul Doshi-A20614 <[email protected]> Tue, 26 Jul 2005 18:26:36 +0530
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
Hi Magnus,

Thanks. Here's what I did:
1. Downloaded the 8.0 source code.
2. Created a test directory in postgresql-8.0.0\src\
3. Wrote a  sample c snippet as given below:
4. Compiled using gcc (version 3.4.4) in cygwin 
5. Used the following make file to generate the dll.

----------------------------------------------------------------------------
-------
 
# Makefile to build test DLL
subdir = src/test
top_builddir = ../..

NAME = test
SO_MAJOR_VERSION = 1
SO_MINOR_VERSION = 0
SHLIB_LINK = $(filter -lintl, $(LIBS)) $(BE_DLLLIBS) -lpcre

SRCS = test.c trigger_test_funcs.c
OBJS = $(SRCS:.c=.o)

include $(top_builddir)/src/Makefile.global
include $(top_builddir)/src/Makefile.shlib

MYCFLAGS = -ansi
MYINCLUDES = -I../include

all: all-lib 

%.o: %.c

$(CC) -c $(MYCFLAGS) $(MYINCLUDES) $< 

clean: 

rm -f $(OBJS) $(NAME).dll

# TODO: dependencies

----------------------------------------------------------------------------
-------

What do I need to do to make it work?

Please let me know. 

Thanks & Regards,
Mehul


-----Original Message-----
From: Magnus Hagander [mailto:[email protected]] 
Sent: Monday, July 25, 2005 8:45 PM
To: Mehul Doshi-A20614; [email protected]
Subject: RE: [pgsql-hackers-win32] Query on support for trigger functions
defined in a Shared library in Windows


> Hi,
> 
> I would like to know whether the native Windows version of
> PostgreSQL (version 8.0.0) supports trigger functions defined 
> in shared libraries. Specifically, I am trying to port a 
> Linux shared object used as the snippet below shows to Windows:
> 
> CREATE FUNCTION foo() returns trigger AS
> '/path/to/sharedlib.so' LANGUAGE C;
> 
> Are DLLs supported in a similar context in Windows?

Yes, they should be.


> What do I need to do to port such code?

Most functions should work without modifications.


> My initial attempts resulted in a failure. I created the DLL
> and attempted to run the SQL CREATE FUNCTION which specified 
> the Windows path to the DLL. However the server died without 
> any clueful messages.

How exactly did you build your DLL?

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match