From 5b4b3d563d0db16a00909a64090efa877593cffd Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Wed, 22 Apr 1998 04:16:46 +0000 Subject: [PATCH] From: Jun Kuwamura 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/). --- contrib/array/Makefile | 8 +- contrib/array/array_iterator.c | 2 +- contrib/array/array_iterator.sql | 137 ------------------------ contrib/datetime/Makefile | 8 +- contrib/datetime/datetime_functions.sql | 75 ------------- contrib/int8/Makefile | 10 +- contrib/ip_and_mac/Makefile | 42 +++++--- contrib/ip_and_mac/ip.sql | 131 ---------------------- contrib/ip_and_mac/mac.sql | 125 --------------------- contrib/miscutil/Makefile | 8 +- contrib/pginterface/Makefile | 26 +++-- contrib/sequence/Makefile | 8 +- contrib/soundex/soundex.sql | 57 ---------- contrib/spi/Makefile | 2 +- contrib/string/Makefile | 8 +- contrib/string/string_io.sql | 111 ------------------- contrib/userlock/Makefile | 8 +- 17 files changed, 75 insertions(+), 691 deletions(-) delete mode 100644 contrib/array/array_iterator.sql delete mode 100644 contrib/datetime/datetime_functions.sql delete mode 100644 contrib/ip_and_mac/ip.sql delete mode 100644 contrib/ip_and_mac/mac.sql delete mode 100644 contrib/soundex/soundex.sql delete mode 100644 contrib/string/string_io.sql diff --git a/contrib/array/Makefile b/contrib/array/Makefile index 03c57e57c68..dd2ff66091d 100644 --- a/contrib/array/Makefile +++ b/contrib/array/Makefile @@ -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 diff --git a/contrib/array/array_iterator.c b/contrib/array/array_iterator.c index 7c301c8e236..b97530b124d 100644 --- a/contrib/array/array_iterator.c +++ b/contrib/array/array_iterator.c @@ -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); diff --git a/contrib/array/array_iterator.sql b/contrib/array/array_iterator.sql deleted file mode 100644 index 7a3356266c1..00000000000 --- a/contrib/array/array_iterator.sql +++ /dev/null @@ -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 */ - diff --git a/contrib/datetime/Makefile b/contrib/datetime/Makefile index 52023b8e8af..fdab004eda0 100644 --- a/contrib/datetime/Makefile +++ b/contrib/datetime/Makefile @@ -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 diff --git a/contrib/datetime/datetime_functions.sql b/contrib/datetime/datetime_functions.sql deleted file mode 100644 index 955377909a2..00000000000 --- a/contrib/datetime/datetime_functions.sql +++ /dev/null @@ -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); -% diff --git a/contrib/int8/Makefile b/contrib/int8/Makefile index 13528fc185e..d5e093058aa 100644 --- a/contrib/int8/Makefile +++ b/contrib/int8/Makefile @@ -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" \ diff --git a/contrib/ip_and_mac/Makefile b/contrib/ip_and_mac/Makefile index 773fdc24f9c..3ec9c3f59aa 100644 --- a/contrib/ip_and_mac/Makefile +++ b/contrib/ip_and_mac/Makefile @@ -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 diff --git a/contrib/ip_and_mac/ip.sql b/contrib/ip_and_mac/ip.sql deleted file mode 100644 index d5a695b6912..00000000000 --- a/contrib/ip_and_mac/ip.sql +++ /dev/null @@ -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 --- diff --git a/contrib/ip_and_mac/mac.sql b/contrib/ip_and_mac/mac.sql deleted file mode 100644 index 47c6b811c9b..00000000000 --- a/contrib/ip_and_mac/mac.sql +++ /dev/null @@ -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 --- diff --git a/contrib/miscutil/Makefile b/contrib/miscutil/Makefile index 982515ab296..33ba1e09370 100644 --- a/contrib/miscutil/Makefile +++ b/contrib/miscutil/Makefile @@ -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 diff --git a/contrib/pginterface/Makefile b/contrib/pginterface/Makefile index 8e86345a448..a13b336fb2f 100644 --- a/contrib/pginterface/Makefile +++ b/contrib/pginterface/Makefile @@ -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 + diff --git a/contrib/sequence/Makefile b/contrib/sequence/Makefile index e82817fd15a..ade134651d3 100644 --- a/contrib/sequence/Makefile +++ b/contrib/sequence/Makefile @@ -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 diff --git a/contrib/soundex/soundex.sql b/contrib/soundex/soundex.sql deleted file mode 100644 index af8ea41fd2f..00000000000 --- a/contrib/soundex/soundex.sql +++ /dev/null @@ -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'; - diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile index d0c4af56bc9..6bb634aa770 100644 --- a/contrib/spi/Makefile +++ b/contrib/spi/Makefile @@ -3,7 +3,7 @@ SRCDIR= ../../src include $(SRCDIR)/Makefile.global -CONTRIBDIR=$(LIBDIR)/contrib +CONTRIBDIR=$(LIBDIR)/modules CFLAGS+= $(CFLAGS_SL) -I$(SRCDIR)/include diff --git a/contrib/string/Makefile b/contrib/string/Makefile index b9ff534137e..4aba9482772 100644 --- a/contrib/string/Makefile +++ b/contrib/string/Makefile @@ -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 diff --git a/contrib/string/string_io.sql b/contrib/string/string_io.sql deleted file mode 100644 index 011371707d5..00000000000 --- a/contrib/string/string_io.sql +++ /dev/null @@ -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'; - diff --git a/contrib/userlock/Makefile b/contrib/userlock/Makefile index 0865bde7321..2b678594538 100644 --- a/contrib/userlock/Makefile +++ b/contrib/userlock/Makefile @@ -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