From: Jun Kuwamura <juk@rccm.co.jp>
This patch fix the Makefiles in contrib/{pginterface, spi, miscutil, int8, ip_and_mac, sequence, soundex, string, userlock, array, datetime} to install their modules in one directory(lib/modules/).
This commit is contained in:
parent
2201d48ccd
commit
5b4b3d563d
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
@ -71,7 +71,7 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
|
||||
|
||||
/* Lookup the function entry point */
|
||||
proc_fn = (func_ptr) NULL;
|
||||
fmgr_info(proc, &proc_fn, &pronargs);
|
||||
fmgr_info(proc, &pronargs); /* (proc, &proc_fn, &pronargs); */
|
||||
if ((proc_fn == NULL) || (pronargs != 2))
|
||||
{
|
||||
elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
|
||||
|
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* SQL code
|
||||
|
||||
- - -- load the new functions
|
||||
- - --
|
||||
load '/home/dz/lib/postgres/array_iterator.so';
|
||||
|
||||
- - -- define the array operators *=, **=, *~ and **~ for type _text
|
||||
- - --
|
||||
create function array_texteq(_text, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_texteq(_text, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_textregexeq(_text, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_textregexeq(_text, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create operator *= (
|
||||
leftarg=_text,
|
||||
rightarg=text,
|
||||
procedure=array_texteq);
|
||||
|
||||
create operator **= (
|
||||
leftarg=_text,
|
||||
rightarg=text,
|
||||
procedure=array_all_texteq);
|
||||
|
||||
create operator *~ (
|
||||
leftarg=_text,
|
||||
rightarg=text,
|
||||
procedure=array_textregexeq);
|
||||
|
||||
create operator **~ (
|
||||
leftarg=_text,
|
||||
rightarg=text,
|
||||
procedure=array_all_textregexeq);
|
||||
|
||||
- - -- define the array operators *=, **=, *~ and **~ for type _char16
|
||||
- - --
|
||||
create function array_char16eq(_char16, char16)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_char16eq(_char16, char16)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_char16regexeq(_char16, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_char16regexeq(_char16, text)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create operator *= (
|
||||
leftarg=_char16,
|
||||
rightarg=char16,
|
||||
procedure=array_char16eq);
|
||||
|
||||
create operator **= (
|
||||
leftarg=_char16,
|
||||
rightarg=char16,
|
||||
procedure=array_all_char16eq);
|
||||
|
||||
create operator *~ (
|
||||
leftarg=_char16,
|
||||
rightarg=text,
|
||||
procedure=array_char16regexeq);
|
||||
|
||||
create operator **~ (
|
||||
leftarg=_char16,
|
||||
rightarg=text,
|
||||
procedure=array_all_char16regexeq);
|
||||
|
||||
- - -- define the array operators *=, **=, *> and **> for type _int4
|
||||
- - --
|
||||
create function array_int4eq(_int4, int4)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_int4eq(_int4, int4)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_int4gt(_int4, int4)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create function array_all_int4gt(_int4, int4)
|
||||
returns bool
|
||||
as '/home/dz/lib/postgres/array_iterator.so'
|
||||
language 'c';
|
||||
|
||||
create operator *= (
|
||||
leftarg=_int4,
|
||||
rightarg=int4,
|
||||
procedure=array_int4eq);
|
||||
|
||||
create operator **= (
|
||||
leftarg=_int4,
|
||||
rightarg=int4,
|
||||
procedure=array_all_int4eq);
|
||||
|
||||
create operator *> (
|
||||
leftarg=_int4,
|
||||
rightarg=int4,
|
||||
procedure=array_int4gt);
|
||||
|
||||
create operator **> (
|
||||
leftarg=_int4,
|
||||
rightarg=int4,
|
||||
procedure=array_all_int4gt);
|
||||
|
||||
*/
|
||||
|
||||
/* end of file */
|
||||
|
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
@ -1,75 +0,0 @@
|
||||
func=$1
|
||||
cat <<% > datetime_functions.sql
|
||||
drop function time_difference(time,time);
|
||||
drop function currentdate();
|
||||
drop function currenttime();
|
||||
drop function hours(time);
|
||||
drop function minutes(time);
|
||||
drop function seconds(time);
|
||||
drop function day(date);
|
||||
drop function month(date);
|
||||
drop function year(date);
|
||||
drop function asminutes(time);
|
||||
drop function asseconds(time);
|
||||
drop operator - (time,time);
|
||||
|
||||
create function time_difference(time,time)
|
||||
returns time
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function currentdate()
|
||||
returns date
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function currenttime()
|
||||
returns time
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function hours(time)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function minutes(time)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function seconds(time)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function day(date)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function month(date)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function year(date)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function asminutes(time)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create function asseconds(time)
|
||||
returns int4
|
||||
as '$func'
|
||||
language 'c';
|
||||
|
||||
create operator - (
|
||||
leftarg=time,
|
||||
rightarg=time,
|
||||
procedure=time_difference);
|
||||
%
|
@ -17,7 +17,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
ifndef PGDIR
|
||||
PGDIR= /opt/postgres/current
|
||||
PGDIR= ../..
|
||||
endif
|
||||
|
||||
SRCDIR= $(PGDIR)/src
|
||||
@ -27,13 +27,13 @@ include $(SRCDIR)/Makefile.global
|
||||
# Comment out this re-declaration of LIBDIR
|
||||
# if you are installing as the postgres superuser
|
||||
# into a specific database or into template1.
|
||||
LIBDIR= /home/tgl/lib
|
||||
#LIBDIR= /home/tgl/lib
|
||||
|
||||
CFLAGS+= -I$(PGDIR)/include -I$(PGDIR)/src/include -I$(LIBPQDIR)
|
||||
|
||||
# This extra library is for the 64-bit division routine on my Linux box
|
||||
# and probably will need to be commented-out for most other platforms.
|
||||
CLIBS+= /usr/lib/gcc-lib/i486-linux/2.7.2/libgcc.a
|
||||
#CLIBS+= /usr/lib/gcc-lib/i486-linux/2.7.2/libgcc.a
|
||||
|
||||
TARGETS= int8.sql int8$(DLSUFFIX)
|
||||
|
||||
@ -44,7 +44,7 @@ int8$(DLSUFFIX): int8.o
|
||||
|
||||
install:
|
||||
$(MAKE) all
|
||||
cp -p int8$(DLSUFFIX) $(LIBDIR)
|
||||
cp -p int8$(DLSUFFIX) $(LIBDIR)/modules
|
||||
|
||||
%.sql: %.source
|
||||
if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
|
||||
@ -53,7 +53,7 @@ install:
|
||||
rm -f $@; \
|
||||
C=`pwd`; \
|
||||
O=$C; \
|
||||
if [ -d ${LIBDIR} ]; then O=${LIBDIR}; fi; \
|
||||
if [ -d ${LIBDIR}/contrib ]; then O=${LIBDIR}/contrib; fi; \
|
||||
sed -e "s:_CWD_:$$C:g" \
|
||||
-e "s:_OBJWD_:$$O:g" \
|
||||
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
|
||||
|
@ -1,25 +1,37 @@
|
||||
#
|
||||
# PostgreSQL types for IP and MAC addresses
|
||||
#
|
||||
# $Id: Makefile,v 1.2 1998/02/14 17:58:02 scrappy Exp $
|
||||
# $Id: Makefile,v 1.3 1998/04/22 04:14:11 scrappy Exp $
|
||||
|
||||
all: ip.so mac.so
|
||||
SRCDIR= ../../src
|
||||
|
||||
ip.so: ip.o
|
||||
ld -Bshareable -o ip.so ip.o
|
||||
include $(SRCDIR)/Makefile.global
|
||||
|
||||
ip.o: ip.c
|
||||
cc -g -O -fPIC -I/usr/local/pgsql/include -c ip.c
|
||||
CONTRIBDIR=$(LIBDIR)/modules
|
||||
|
||||
mac.so: mac.o
|
||||
ld -Bshareable -o mac.so mac.o
|
||||
CFLAGS+= $(CFLAGS_SL) -I$(SRCDIR)/include
|
||||
|
||||
mac.o: mac.c mac.h
|
||||
cc -g -O -fPIC -I/usr/local/pgsql/include -c mac.c
|
||||
ifdef REFINT_VERBOSE
|
||||
CFLAGS+= -DREFINT_VERBOSE
|
||||
endif
|
||||
|
||||
install: ip.so mac.so
|
||||
install -c ip.so mac.so /usr/local/pgsql/modules
|
||||
TARGETS= ip$(DLSUFFIX) ip.sql mac$(DLSUFFIX) mac.sql
|
||||
|
||||
#
|
||||
# eof
|
||||
#
|
||||
CLEANFILES+= $(TARGETS)
|
||||
|
||||
all:: $(TARGETS)
|
||||
|
||||
install:: all $(CONTRIBDIR)
|
||||
for f in *$(DLSUFFIX); do $(INSTALL) -c $$f $(CONTRIBDIR)/$$f; done
|
||||
|
||||
$(CONTRIBDIR):
|
||||
mkdir -p $(CONTRIBDIR)
|
||||
|
||||
%.sql: %.sql.in
|
||||
rm -f $@; \
|
||||
C=`pwd`; \
|
||||
sed -e "s:_OBJWD_:$(CONTRIBDIR):g" \
|
||||
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" < $< > $@
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS) *.o
|
||||
|
@ -1,131 +0,0 @@
|
||||
--
|
||||
-- PostgreSQL code for IP addresses.
|
||||
--
|
||||
-- $Id: ip.sql,v 1.2 1998/02/14 17:58:04 scrappy Exp $
|
||||
--
|
||||
|
||||
load '/usr/local/pgsql/modules/ip.so';
|
||||
|
||||
--
|
||||
-- Input and output functions and the type itself:
|
||||
--
|
||||
|
||||
create function ipaddr_in(opaque)
|
||||
returns opaque
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_out(opaque)
|
||||
returns opaque
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create type ipaddr (
|
||||
internallength = 6,
|
||||
externallength = variable,
|
||||
input = ipaddr_in,
|
||||
output = ipaddr_out
|
||||
);
|
||||
|
||||
--
|
||||
-- The various boolean tests:
|
||||
--
|
||||
|
||||
create function ipaddr_lt(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_le(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_eq(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_ge(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_gt(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_ne(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_in_net(ipaddr, ipaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_mask(ipaddr)
|
||||
returns ipaddr
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
create function ipaddr_bcast(ipaddr)
|
||||
returns ipaddr
|
||||
as '/usr/local/pgsql/modules/ip.so'
|
||||
language 'c';
|
||||
|
||||
--
|
||||
-- Now the operators. Note how some of the parameters to some
|
||||
-- of the 'create operator' commands are commented out. This
|
||||
-- is because they reference as yet undefined operators, and
|
||||
-- will be implicitly defined when those are, further down.
|
||||
--
|
||||
|
||||
create operator < (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
-- negator = >=,
|
||||
procedure = ipaddr_lt
|
||||
);
|
||||
|
||||
create operator <= (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
-- negator = >,
|
||||
procedure = ipaddr_le
|
||||
);
|
||||
|
||||
create operator = (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
commutator = =,
|
||||
-- negator = <>,
|
||||
procedure = ipaddr_eq
|
||||
);
|
||||
|
||||
create operator >= (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
negator = <,
|
||||
procedure = ipaddr_ge
|
||||
);
|
||||
|
||||
create operator > (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
negator = <=,
|
||||
procedure = ipaddr_gt
|
||||
);
|
||||
|
||||
create operator <> (
|
||||
leftarg = ipaddr,
|
||||
rightarg = ipaddr,
|
||||
negator = =,
|
||||
procedure = ipaddr_ne
|
||||
);
|
||||
|
||||
--
|
||||
-- eof
|
||||
--
|
@ -1,125 +0,0 @@
|
||||
--
|
||||
-- PostgreSQL code for MAC addresses.
|
||||
--
|
||||
-- $Id: mac.sql,v 1.2 1998/02/14 17:58:08 scrappy Exp $
|
||||
--
|
||||
|
||||
load '/usr/local/pgsql/modules/mac.so';
|
||||
|
||||
--
|
||||
-- Input and output functions and the type itself:
|
||||
--
|
||||
|
||||
create function macaddr_in(opaque)
|
||||
returns opaque
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_out(opaque)
|
||||
returns opaque
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create type macaddr (
|
||||
internallength = 6,
|
||||
externallength = variable,
|
||||
input = macaddr_in,
|
||||
output = macaddr_out
|
||||
);
|
||||
|
||||
--
|
||||
-- The boolean tests:
|
||||
--
|
||||
|
||||
create function macaddr_lt(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_le(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_eq(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_ge(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_gt(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
create function macaddr_ne(macaddr, macaddr)
|
||||
returns bool
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
--
|
||||
-- Now the operators. Note how some of the parameters to some
|
||||
-- of the 'create operator' commands are commented out. This
|
||||
-- is because they reference as yet undefined operators, and
|
||||
-- will be implicitly defined when those are, further down.
|
||||
--
|
||||
|
||||
create operator < (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
-- negator = >=,
|
||||
procedure = macaddr_lt
|
||||
);
|
||||
|
||||
create operator <= (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
-- negator = >,
|
||||
procedure = macaddr_le
|
||||
);
|
||||
|
||||
create operator = (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
commutator = =,
|
||||
-- negator = <>,
|
||||
procedure = macaddr_eq
|
||||
);
|
||||
|
||||
create operator >= (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
negator = <,
|
||||
procedure = macaddr_ge
|
||||
);
|
||||
|
||||
create operator > (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
negator = <=,
|
||||
procedure = macaddr_gt
|
||||
);
|
||||
|
||||
create operator <> (
|
||||
leftarg = macaddr,
|
||||
rightarg = macaddr,
|
||||
negator = =,
|
||||
procedure = macaddr_ne
|
||||
);
|
||||
|
||||
--
|
||||
-- Finally, the special manufacurer matching function:
|
||||
--
|
||||
|
||||
create function macaddr_manuf(macaddr)
|
||||
returns text
|
||||
as '/usr/local/pgsql/modules/mac.so'
|
||||
language 'c';
|
||||
|
||||
--
|
||||
-- eof
|
||||
--
|
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
@ -4,21 +4,29 @@
|
||||
#
|
||||
PGINTERFACE = pginterface.o halt.o
|
||||
TARGET = pginsert pgwordcount pgnulltest
|
||||
CFLAGS = -g -Wall -I/usr/local/pgsql/include
|
||||
CFLAGS = -g -fpic -Wall -I. -I../../src/interfaces/libpq -I/usr/local/pgsql/include
|
||||
LDFLAGS = -L/usr/local/pgsql/lib -lpq
|
||||
|
||||
all : $(TARGET)
|
||||
|
||||
$(TARGET): $(PGINTERFACE) $*.c
|
||||
cc -o $* $(CFLAGS) $*.c $(PGINTERFACE) $(LDFLAGS)
|
||||
pginsert: $(PGINTERFACE) pginsert.c
|
||||
gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS)
|
||||
|
||||
pgwordcount: $(PGINTERFACE) pgwordcount.c
|
||||
gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS)
|
||||
|
||||
pgnulltest: $(PGINTERFACE) pgnulltest.c
|
||||
gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS)
|
||||
|
||||
pginterface.o: pginterface.c
|
||||
gcc -c $(CFLAGS) pginterface.c
|
||||
|
||||
halt.o: halt.c
|
||||
gcc -c $(CFLAGS) halt.c
|
||||
|
||||
$(PGINTERFACE): pginterface.c halt.c
|
||||
cc -c $(CFLAGS) pginterface.c halt.c
|
||||
|
||||
clean:
|
||||
rm -f *.o $(TARGET) log core
|
||||
|
||||
install:
|
||||
make clean
|
||||
make CFLAGS=-O
|
||||
install -s -o bin -g bin $(TARGET) /usr/local/bin
|
||||
install -s -o bin -g bin $(TARGET) /usr/local/pgsql/bin
|
||||
|
||||
|
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
@ -1,57 +0,0 @@
|
||||
--------------- soundex.sql:
|
||||
|
||||
CREATE FUNCTION text_soundex(text) RETURNS text
|
||||
AS '/usr/local/postgres/postgres95/src/funcs/soundex.so' LANGUAGE 'c';
|
||||
|
||||
SELECT text_soundex('hello world!');
|
||||
|
||||
CREATE TABLE s (nm text)\g
|
||||
|
||||
insert into s values ('john')\g
|
||||
insert into s values ('joan')\g
|
||||
insert into s values ('wobbly')\g
|
||||
|
||||
select * from s
|
||||
where text_soundex(nm) = text_soundex('john')\g
|
||||
|
||||
select nm from s a, s b
|
||||
where text_soundex(a.nm) = text_soundex(b.nm)
|
||||
and a.oid <> b.oid\g
|
||||
|
||||
CREATE FUNCTION text_sx_eq(text, text) RETURNS bool AS
|
||||
'select text_soundex($1) = text_soundex($2)'
|
||||
LANGUAGE 'sql'\g
|
||||
|
||||
CREATE FUNCTION text_sx_lt(text,text) RETURNS bool AS
|
||||
'select text_soundex($1) < text_soundex($2)'
|
||||
LANGUAGE 'sql'\g
|
||||
|
||||
CREATE FUNCTION text_sx_gt(text,text) RETURNS bool AS
|
||||
'select text_soundex($1) > text_soundex($2)'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
CREATE FUNCTION text_sx_le(text,text) RETURNS bool AS
|
||||
'select text_soundex($1) <= text_soundex($2)'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
CREATE FUNCTION text_sx_ge(text,text) RETURNS bool AS
|
||||
'select text_soundex($1) >= text_soundex($2)'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
CREATE FUNCTION text_sx_ne(text,text) RETURNS bool AS
|
||||
'select text_soundex($1) <> text_soundex($2)'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
DROP OPERATOR #= (text,text)\g
|
||||
|
||||
CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq,
|
||||
commutator=text_sx_eq)\g
|
||||
|
||||
SELECT *
|
||||
FROM s
|
||||
WHERE text_sx_eq(nm,'john')\g
|
||||
|
||||
SELECT *
|
||||
from s
|
||||
where s.nm #= 'john';
|
||||
|
@ -3,7 +3,7 @@ SRCDIR= ../../src
|
||||
|
||||
include $(SRCDIR)/Makefile.global
|
||||
|
||||
CONTRIBDIR=$(LIBDIR)/contrib
|
||||
CONTRIBDIR=$(LIBDIR)/modules
|
||||
|
||||
CFLAGS+= $(CFLAGS_SL) -I$(SRCDIR)/include
|
||||
|
||||
|
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
@ -1,111 +0,0 @@
|
||||
|
||||
- - -- load the new functions
|
||||
- - --
|
||||
load '/home/dz/lib/postgres/string_output.so';
|
||||
|
||||
- - -- create function c_textin(opaque)
|
||||
- - -- returns text
|
||||
- - -- as '/home/dz/lib/postgres/string_output.so'
|
||||
- - -- language 'c';
|
||||
|
||||
create function c_charout(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_char2out(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_char4out(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_char8out(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_char16out(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_textout(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
create function c_varcharout(opaque)
|
||||
returns int4
|
||||
as '/home/dz/lib/postgres/string_output.so'
|
||||
language 'c';
|
||||
|
||||
- - -- define a function which sets the new output routines for char types
|
||||
- - --
|
||||
- - -- select c_mode();
|
||||
- - --
|
||||
create function c_mode()
|
||||
returns text
|
||||
as 'update pg_type set typoutput=''c_charout'' where typname=''char''\;
|
||||
update pg_type set typoutput=''c_char2out'' where typname=''char2''\;
|
||||
update pg_type set typoutput=''c_char4out'' where typname=''char4''\;
|
||||
update pg_type set typoutput=''c_char8out'' where typname=''char8''\;
|
||||
update pg_type set typoutput=''c_char16out'' where typname=''char16''\;
|
||||
update pg_type set typoutput=''c_textout'' where typname=''text''\;
|
||||
update pg_type set typoutput=''c_textout'' where typname=''bytea''\;
|
||||
update pg_type set typoutput=''c_textout'' where typname=''unknown''\;
|
||||
update pg_type set typoutput=''c_textout'' where typname=''SET''\;
|
||||
update pg_type set typoutput=''c_varcharout'' where typname=''varchar''\;
|
||||
update pg_type set typoutput=''c_varcharout'' where typname=''bpchar''\;
|
||||
select ''c_mode''::text'
|
||||
language 'sql';
|
||||
|
||||
- - -- define a function which restores the original routines for char types
|
||||
- - --
|
||||
- - -- select pg_mode();
|
||||
- - --
|
||||
create function pg_mode()
|
||||
returns text
|
||||
as 'update pg_type set typoutput=''charout'' where typname=''char''\;
|
||||
update pg_type set typoutput=''char2out'' where typname=''char2''\;
|
||||
update pg_type set typoutput=''char4out'' where typname=''char4''\;
|
||||
update pg_type set typoutput=''char8out'' where typname=''char8''\;
|
||||
update pg_type set typoutput=''char16out'' where typname=''char16''\;
|
||||
update pg_type set typoutput=''textout'' where typname=''text''\;
|
||||
update pg_type set typoutput=''textout'' where typname=''bytea''\;
|
||||
update pg_type set typoutput=''textout'' where typname=''unknown''\;
|
||||
update pg_type set typoutput=''textout'' where typname=''SET''\;
|
||||
update pg_type set typoutput=''varcharout'' where typname=''varchar''\;
|
||||
update pg_type set typoutput=''varcharout'' where typname=''bpchar''\;
|
||||
select ''pg_mode''::text'
|
||||
language 'sql';
|
||||
|
||||
- - -- or do the changes manually
|
||||
- - --
|
||||
- - -- update pg_type set typoutput='charout' where typname='char';
|
||||
- - -- update pg_type set typoutput='char2out' where typname='char2';
|
||||
- - -- update pg_type set typoutput='char4out' where typname='char4';
|
||||
- - -- update pg_type set typoutput='char8out' where typname='char8';
|
||||
- - -- update pg_type set typoutput='char16out' where typname='char16';
|
||||
- - -- update pg_type set typoutput='textout' where typname='text';
|
||||
- - -- update pg_type set typoutput='textout' where typname='bytea';
|
||||
- - -- update pg_type set typoutput='textout' where typname='unknown';
|
||||
- - -- update pg_type set typoutput='textout' where typname='SET';
|
||||
- - -- update pg_type set typoutput='varcharout' where typname='varchar';
|
||||
- - -- update pg_type set typoutput='varcharout' where typname='bpchar';
|
||||
- - --
|
||||
- - -- update pg_type set typoutput='c_charout' where typname='char';
|
||||
- - -- update pg_type set typoutput='c_char2out' where typname='char2';
|
||||
- - -- update pg_type set typoutput='c_char4out' where typname='char4';
|
||||
- - -- update pg_type set typoutput='c_char8out' where typname='char8';
|
||||
- - -- update pg_type set typoutput='c_char16out' where typname='char16';
|
||||
- - -- update pg_type set typoutput='c_textout' where typname='text';
|
||||
- - -- update pg_type set typoutput='c_textout' where typname='bytea';
|
||||
- - -- update pg_type set typoutput='c_textout' where typname='unknown';
|
||||
- - -- update pg_type set typoutput='c_textout' where typname='SET';
|
||||
- - -- update pg_type set typoutput='c_varcharout' where typname='varchar';
|
||||
- - -- update pg_type set typoutput='c_varcharout' where typname='bpchar';
|
||||
|
@ -40,16 +40,16 @@ module: $(MODULE)
|
||||
sql: $(MODNAME).sql
|
||||
|
||||
install: $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)
|
||||
cd $(LIBDIR); strip $(MODULE)
|
||||
cp -p $(MODULE) $(LIBDIR)/modules
|
||||
cd $(LIBDIR)/modules; strip $(MODULE)
|
||||
|
||||
%.sql: %.sql.in
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/$(MODULE)|" < $< > $@
|
||||
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
|
||||
|
||||
.SUFFIXES: $(DLSUFFIX)
|
||||
|
||||
%$(DLSUFFIX): %.c
|
||||
cc $(CFLAGS) -shared -o $@ $<
|
||||
$(CC) $(CFLAGS) -shared -o $@ $<
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
||||
|
Loading…
Reference in New Issue
Block a user