Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7f177d

Browse files
committed
/contrib patch from Karel.
1 parent82c4733 commitf7f177d

File tree

73 files changed

+1144
-4496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1144
-4496
lines changed

‎contrib/Makefile

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
1-
# Makefile for contrib code
21
#
3-
# Thefollowing subdirs don't have aMakefile:
2+
# ThePostgreSQL contrib treeMakefile
43
#
5-
# apache_logging
6-
# linux
7-
# mSQL-interface
8-
# noupdate
9-
# unixdate
4+
#Portions Copyright (c) 1999-2000, PostgreSQL, Inc
105
#
11-
#The following subdirs give make errors:
6+
#$Header: /cvsroot/pgsql/contrib/Makefile,v 1.4 2000/06/15 18:54:29 momjian Exp $
127
#
13-
# earthdistance
14-
# os2client
8+
9+
TOPDIR = ..
10+
include Makefile.global
11+
12+
WANTED_DIRS =array\
13+
earthdistance\
14+
findoidjoins\
15+
fulltextindex\
16+
isbn_issn\
17+
likeplanning\
18+
linux\
19+
lo\
20+
mSQL-interface\
21+
miscutil\
22+
noupdate\
23+
pg_dumplo\
24+
pgbench\
25+
soundex\
26+
spi\
27+
string\
28+
tips\
29+
tools\
30+
unixdate\
31+
userlock\
32+
vacuumlo
33+
#odbc
34+
#os2client
35+
1536

1637
all:
17-
fordirin*;do \
38+
fordirin$(WANTED_DIRS);do \
39+
if [-e$$dir/Makefile ];then \
40+
$(MAKE) -C$$dir$@;\
41+
fi;\
42+
done
43+
44+
45+
install:
46+
../config/mkinstalldirs$(CONTRIB_BINDIR)$(CONTRIB_MODDIR)$(CONTRIB_DOCDIR)$(CONTRIB_SQLDIR)$(CONTRIB_EXAMPLESDIR)
47+
fordirin$(WANTED_DIRS);do \
1848
if [-e$$dir/Makefile ];then \
1949
$(MAKE) -C$$dir$@;\
2050
fi;\
2151
done
52+
$(INSTALL)$(INSTL_LIB_OPTS) Contrib.index$(CONTRIB_DOCDIR);
53+
2254

2355
.DEFAULT:
24-
fordirin*;do \
56+
fordirin$(WANTED_DIRS);do \
2557
if [-e$$dir/Makefile ];then \
2658
$(MAKE) -C$$dir$@;\
2759
fi;\

‎contrib/README

Lines changed: 59 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,81 @@
1-
This directory contains the contribution functions or tools.
21

3-
---------------------------------------------------------------------------
2+
The PostgreSQL contrib tree
3+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
44

5-
apache_logging -
6-
Getting Apache to log to PostgreSQL
7-
by Terry Mackintosh <terry@terrym.com>
5+
FIXME:
6+
os2client
7+
odbc
8+
spi/preprocessor
9+
tools
10+
811

9-
array -
10-
Array iterator functions
11-
by Massimo Dal Zotto <dz@cs.unitn.it>
12+
- in each directory must be Makefile, possible Makefile template
13+
is below this text,
1214

13-
bit -
14-
Bit type
15-
by Adriaan Joubert <a.joubert@albourne.com>
15+
--------
16+
#
17+
# $Header: /cvsroot/pgsql/contrib/README,v 1.18 2000/06/15 18:54:29 momjian Exp $
18+
#
1619

17-
datetime -
18-
Date & time functions
19-
by Massimo Dal Zotto <dz@cs.unitn.it>
20+
TOPDIR=../..
2021

21-
earthdistance -
22-
Operator for computing earth distance for two points
23-
by Hal Snyder <hal@vailsys.com>
22+
include ../Makefile.global
2423

25-
findoidjoins -
26-
Finds the joins used by oid columns by examining the actual
27-
values in the oid columns and row oids.
28-
by Bruce Momjian <root@candle.pha.pa.us>
24+
NAME= some_name
2925

30-
fulltextindex -
31-
Full text indexing using triggers
32-
by Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl>
26+
PROGRAM=
27+
OBJS= $(NAME).o
28+
DOCS= $(NAME).doc
29+
SQLS= $(NAME).sql
30+
BINS=
31+
EXAMPLES=
32+
MODS= $(NAME)$(DLSUFFIX)
3333

34-
isbn_issn -
35-
PostgreSQL type extensions for ISBN (books) and ISSN (serials)
36-
by Garrett A. Wollman <wollman@khavrinen.lcs.mit.edu>
34+
CFLAGS += -I. $(CFLAGS_SL)
3735

38-
likeplanning -
39-
Scripts to enable/disable new planning code for LIKE and regexp
40-
pattern match operators. These will go away again once the code
41-
is mature enough to enable by default.
42-
by Tom Lane <tgl@sss.pgh.pa.us>
36+
OTHER_CLEAN = $(SQLS)
4337

44-
linux -
45-
Start postgres back end system
46-
by Thomas Lockhart <lockhart@alumni.caltech.edu>
38+
all: $(MODS) $(SQLS)
4739

48-
lo -
49-
Large Object maintenance
50-
by Peter Mount <peter@retep.org.uk>
40+
%.sql: %.sql.in
41+
$(SED) "s|MODULE_PATHNAME|$(CONTRIB_MODDIR)/$@|" < $< > $@
5142

52-
miscutil -
53-
Postgres assert checking and various utility functions
54-
by Dal Zotto <dz@cs.unitn.it>
5543

56-
mSQL-interface -
57-
mSQL API translation library
58-
by Aldrin Leal <aldrin@americasnet.com>
44+
install: install_doc install_sql install_mod install_bin install_example
5945

60-
noupdate -
61-
trigger to prevent updates on single columns
46+
install_doc:
47+
for inst_file in $(DOCS); do \
48+
$(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_DOCDIR); \
49+
done
6250

63-
pg_dumplo -
64-
Dump large objects
51+
install_sql:
52+
for inst_file in $(SQLS); do \
53+
$(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_SQLDIR); \
54+
done
6555

66-
soundex -
67-
Prototype for soundex function
56+
install_mod:
57+
for inst_file in $(MODS); do \
58+
$(INSTALL) $(INSTL_SHLIB_OPTS) $$inst_file $(CONTRIB_MODDIR); \
59+
done
6860

69-
spi -
70-
A general trigger function autoinc() and so on.
61+
install_bin:
62+
for inst_file in $(BINS); do \
63+
$(INSTALL) $(INSTL_EXE_OPTS) $$inst_file $(CONTRIB_BINDIR); \
64+
done
7165

72-
string -
73-
C-like input/output conversion routines for strings
74-
by Massimo Dal Zotto <dz@cs.unitn.it>
66+
install_example:
67+
for inst_file in $(EXAMPLES); do \
68+
$(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_EXAMPLESDIR); \
69+
done
7570

76-
tools -
77-
Assorted developer tools
78-
by Massimo Dal Zotto <dz@cs.unitn.it>
71+
depend dep:
72+
$(CC) -MM -MG $(CFLAGS) *.c > depend
7973

80-
unixdate -
81-
Conversions from integer to datetime
82-
by Thomas Lockhart <lockhart@alumni.caltech.edu>
74+
clean:
75+
$(RM) *~ $(OBJS) $(MODS) $(PROGRAM) depend $(OTHER_CLEAN) core log
8376

84-
userlock -
85-
User locks
86-
by Massimo Dal Zotto <dz@cs.unitn.it>
87-
88-
vacuumlo -
89-
Remove orphaned large objects
90-
by Peter T Mount <peter@retep.org.uk>
91-
92-
pgbench -
93-
TPC-B like benchmarking tool
94-
by Tatsuo Ishii <t-ishii@sra.co.jp>
77+
ifeq (depend,$(wildcard depend))
78+
include depend
79+
endif
80+
-----------
81+

‎contrib/apache_logging/apachelog.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
droptable access;
2-
CREATETABLEaccess (hostchar(200), identchar(200), authuserchar(200), accdate datetime, requestchar(500), ttime int2, status int2, bytes int4) archive= none;
3-
grant allon access to nobody;

‎contrib/apache_logging/httpconf.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
# This is mostly the same as the default, except for no square brakets around
2-
# the time or the extra timezone info, also added the download time, 3rd from
3-
# the end, number of seconds.
4-
5-
LogFormat "insert into access values ( '%h', '%l', '%u', '%{%d/%b/%Y:%H:%M:%S}t', '%r', %T, %s, %b );"
6-
7-
8-
# The above format ALMOST eleminates the need to use sed, except that I noticed
9-
# that when a frameset page is called, then the bytes transfered is '-', which
10-
# will choke the insert, so replaced it with '-1'.
11-
12-
TransferLog '| su -c "sed \"s/, - );$/, -1 );/\" | /usr/local/pgsql/bin/psql www_log" nobody'

‎contrib/array/Makefile

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,53 @@
1-
#-------------------------------------------------------------------------
21
#
3-
# Makefile --
2+
#$Header: /cvsroot/pgsql/contrib/array/Attic/Makefile,v 1.8 2000/06/15 18:54:31 momjian Exp $
43
#
5-
# Makefile for array iterator module.
6-
#
7-
#-------------------------------------------------------------------------
8-
9-
PGDIR = ../..
10-
SRCDIR =$(PGDIR)/src
11-
12-
include$(SRCDIR)/Makefile.global
13-
14-
CFLAGS += -I.$(CFLAGS_SL)
154

16-
MODNAME =array_iterator
5+
TOPDIR=../..
176

18-
SQLDEFS =$(MODNAME).sql
7+
include ../Makefile.global
198

20-
MODULE =$(MODNAME)$(DLSUFFIX)
9+
NAME= array_iterator
2110

22-
MODDIR =$(LIBDIR)/modules
11+
PROGRAM=
12+
OBJS=$(NAME).o
13+
DOCS=$(NAME).doc
14+
SQLS=$(NAME).sql
15+
BINS=
16+
EXAMPLES=
17+
MODS=$(NAME)$(DLSUFFIX)
2318

24-
SQLDIR =$(LIBDIR)/sql
25-
26-
all:module sql
27-
28-
module:$(MODULE)
19+
CFLAGS += -I.$(CFLAGS_SL)
2920

30-
sql:$(SQLDEFS)
21+
OTHER_CLEAN =$(SQLS)
3122

32-
install:$(MODULE)$(SQLDEFS)$(MODDIR)$(SQLDIR)
33-
cp -p$(MODULE)$(MODDIR)/
34-
strip$(MODDIR)/$(MODULE)
35-
cp -p$(SQLDEFS)$(SQLDIR)/
23+
all:$(MODS)$(SQLS)
3624

37-
install-doc:
38-
if [-d"$(DOCDIR)" ];then \
39-
cp -p*.doc$(DOCDIR);\
40-
else\
41-
cp -p*.doc$(SQLDIR);\
42-
fi
25+
%.sql:%.sql.in
26+
$(SED)"s|MODULE_PATHNAME|$(CONTRIB_MODDIR)/$@|"<$<>$@
4327

44-
$(MODDIR):
45-
mkdir -p$@
28+
install: install_doc install_sql install_mod
4629

47-
$(SQLDIR):
48-
mkdir -p$@
30+
install_doc:
31+
forinst_filein$(DOCS);do \
32+
$(INSTALL)$(INSTL_LIB_OPTS)$$inst_file$(CONTRIB_DOCDIR);\
33+
done
4934

50-
%.sql:%.sql.in
51-
sed"s|MODULE_PATHNAME|$(MODDIR)/$(MODULE)|"<$<>$@
35+
install_sql:
36+
forinst_filein$(SQLS);do \
37+
$(INSTALL)$(INSTL_LIB_OPTS)$$inst_file$(CONTRIB_SQLDIR);\
38+
done
5239

53-
.SUFFIXES:$(DLSUFFIX)
40+
install_mod:
41+
forinst_filein$(MODS);do \
42+
$(INSTALL)$(INSTL_SHLIB_OPTS)$$inst_file$(CONTRIB_MODDIR);\
43+
done
5444

55-
%$(DLSUFFIX):%.c
56-
$(CC)$(CFLAGS) -shared -o$@$<
5745

5846
dependdep:
59-
$(CC) -MM$(CFLAGS)*.c>depend
47+
$(CC) -MM-MG$(CFLAGS)*.c>depend
6048

6149
clean:
62-
rm -f*~$(MODULE)$(MODNAME).sql
50+
$(RM)*~$(OBJS)$(MODS)$(PROGRAM) depend$(OTHER_CLEAN) core log
6351

6452
ifeq (depend,$(wildcard depend))
6553
include depend

‎contrib/array/README

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Array iterator functions, by Massimo Dal Zotto <dz@cs.unitn.it>
2+
Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
3+
4+
This software is distributed under the GNU General Public License
5+
either version 2, or (at your option) any later version.
6+
7+
8+
This loadable module defines a new class of functions which take
9+
an array and a scalar value, iterate a scalar operator over the
10+
elements of the array and the value, and compute a result as
11+
the logical OR or AND of the iteration results.
12+
For example array_int4eq returns true if some of the elements
13+
of an array of int4 is equal to the given value:
14+
15+
array_int4eq({1,2,3}, 1) --> true
16+
array_int4eq({1,2,3}, 4) --> false
17+
18+
If we have defined T array types and O scalar operators we can
19+
define T x O x 2 array functions, each of them has a name like
20+
"array_[all_]<basetype><operation>" and takes an array of type T
21+
iterating the operator O over all the elements. Note however
22+
that some of the possible combination are invalid, for example
23+
the array_int4_like because there is no like operator for int4.
24+
25+
We can then define new operators based on these functions and use
26+
them to write queries with qualification clauses based on the
27+
values of some of the elements of an array.
28+
For example to select rows having some or all element of an array
29+
attribute equal to a given value or matching a regular expression:
30+
31+
create table t(id int4[], txt text[]);
32+
33+
-- select tuples with some id element equal to 123
34+
select * from t where t.id *= 123;
35+
36+
-- select tuples with some txt element matching '[a-z]'
37+
select * from t where t.txt *~ '[a-z]';
38+
39+
-- select tuples with all txt elements matching '^[A-Z]'
40+
select * from t where t.txt[1:3] **~ '^[A-Z]';
41+
42+
The scheme is quite general, each operator which operates on a base type
43+
can be iterated over the elements of an array. It seem to work well but
44+
defining each new operators requires writing a different C function.
45+
Furthermore in each function there are two hardcoded OIDs which reference
46+
a base type and a procedure. Not very portable. Can anyone suggest a
47+
better and more portable way to do it ?
48+
49+
See also array_iterator.sql for an example on how to use this module.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp