Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Query on support for trigger functions


  • From: Mehul Doshi-A20614 <mehul(at)motorola(dot)com>
  • To: "'Magnus Hagander'" <mha(at)sollentuna(dot)net>, pgsql-hackers-win32(at)postgresql(dot)org
  • Cc: Mehul Doshi-A20614 <mehul(at)motorola(dot)com>
  • Subject: Re: Query on support for trigger functions
  • Date: Tue, 26 Jul 2005 18:26:36 +0530
  • Message-id: <45AAAAED8B10F547878F52FE15C57C5D15D04A(at)zin24exm03(dot)corp(dot)mot(dot)com>

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:mha(at)sollentuna(dot)net] 
Sent: Monday, July 25, 2005 8:45 PM
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


> 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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group