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

Commit5683e70

Browse files
committed
Add missing /contrib files to CVS.
1 parentf7f177d commit5683e70

29 files changed

+2308
-0
lines changed

‎contrib/Contrib.index

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
The PostgreSQL contrib:
3+
~~~~~~~~~~~~~~~~~~~~~~
4+
5+
apache_logging -
6+
Getting Apache to log to PostgreSQL
7+
by Terry Mackintosh <terry@terrym.com>
8+
9+
array -
10+
Array iterator functions
11+
by Massimo Dal Zotto <dz@cs.unitn.it>
12+
13+
earthdistance -
14+
Operator for computing earth distance for two points
15+
by Hal Snyder <hal@vailsys.com>
16+
17+
findoidjoins -
18+
Finds the joins used by oid columns by examining the actual
19+
values in the oid columns and row oids.
20+
by Bruce Momjian <root@candle.pha.pa.us>
21+
22+
fulltextindex -
23+
Full text indexing using triggers
24+
by Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl>
25+
26+
isbn_issn -
27+
PostgreSQL type extensions for ISBN (books) and ISSN (serials)
28+
by Garrett A. Wollman <wollman@khavrinen.lcs.mit.edu>
29+
30+
likeplanning -
31+
Scripts to enable/disable new planning code for LIKE and regexp
32+
pattern match operators. These will go away again once the code
33+
is mature enough to enable by default.
34+
by Tom Lane <tgl@sss.pgh.pa.us>
35+
36+
linux -
37+
Start postgres back end system
38+
by Thomas Lockhart <lockhart@alumni.caltech.edu>
39+
40+
lo -
41+
Large Object maintenance
42+
by Peter Mount <peter@retep.org.uk>
43+
44+
miscutil -
45+
Postgres assert checking and various utility functions
46+
by Dal Zotto <dz@cs.unitn.it>
47+
48+
mSQL-interface -
49+
mSQL API translation library
50+
by Aldrin Leal <aldrin@americasnet.com>
51+
52+
noupdate -
53+
trigger to prevent updates on single columns
54+
55+
56+
pg_dumplo -
57+
Dump large objects
58+
by Karel Zak <zakkr@zf.jcu.cz>
59+
60+
soundex -
61+
Prototype for soundex function
62+
63+
spi -
64+
A general trigger function autoinc() and so on.
65+
66+
string -
67+
C-like input/output conversion routines for strings
68+
by Massimo Dal Zotto <dz@cs.unitn.it>
69+
70+
tools -
71+
Assorted developer tools
72+
by Massimo Dal Zotto <dz@cs.unitn.it>
73+
74+
unixdate -
75+
Conversions from integer to datetime
76+
by Thomas Lockhart <lockhart@alumni.caltech.edu>
77+
78+
userlock -
79+
User locks
80+
by Massimo Dal Zotto <dz@cs.unitn.it>
81+
82+
vacuumlo -
83+
Remove orphaned large objects
84+
by Peter T Mount <peter@retep.org.uk>
85+
86+
pgbench -
87+
TPC-B like benchmarking tool
88+
by Tatsuo Ishii <t-ishii@sra.co.jp>

‎contrib/Makefile.global

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
#-------------------------------------------------------------------------
3+
#
4+
# Makefile.global
5+
# Build and install PostgreSQL contrib.
6+
#
7+
# Portions Copyright (c) 1999-2000, PostgreSQL, Inc
8+
#
9+
#
10+
# IDENTIFICATION
11+
# $Header: /cvsroot/pgsql/contrib/Attic/Makefile.global,v 1.1 2000/06/15 19:04:37 momjian Exp $
12+
#
13+
#-------------------------------------------------------------------------
14+
15+
SRCDIR = $(TOPDIR)/src
16+
include $(SRCDIR)/Makefile.global
17+
18+
### ---------------------------------------------------------
19+
### DELETE THIS PART if ../src/Makefile.global is standardize
20+
### (has define all next definitions itself)
21+
22+
DOCDIR=$(POSTDOCDIR)
23+
24+
# not $PGDATA, but anything like '/usr/local/pgsql/share'
25+
DATADIR=$(LIBDIR)
26+
27+
### ----------------------------------------------------------
28+
29+
# execute-able
30+
CONTRIB_BINDIR = $(BINDIR)
31+
# *.so
32+
CONTRIB_MODDIR = $(LIBDIR)/modules
33+
# *.doc
34+
CONTRIB_DOCDIR= $(DOCDIR)/contrib
35+
# *.sql
36+
CONTRIB_SQLDIR= $(DATADIR)/sql
37+
# *.examples
38+
CONTRIB_EXAMPLESDIR= $(CONTRIB_DOCDIR)/examples
39+
40+
41+
RM= rm -f
42+
SED= sed
43+
44+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
--------------- geo_distance
3+
4+
DROP FUNCTION geo_distance (point, point);
5+
CREATE FUNCTION geo_distance (point, point) RETURNS float8
6+
AS 'MODULE_PATHNAME' LANGUAGE 'c';
7+
8+
SELECT geo_distance ('(1,2)'::point, '(3,4)'::point);
9+
10+
--------------- geo_distance as operator <@>
11+
12+
DROP OPERATOR <@> (point, point);
13+
CREATE OPERATOR <@> (
14+
leftarg = point,
15+
rightarg = point,
16+
procedure = geo_distance,
17+
commutator = <@>
18+
);
19+
20+
-- ( 87.6, 41.8) is in Chicago
21+
-- (106.7, 35.1) is in Albuquerque
22+
-- The cities are about 1100 miles apart
23+
SELECT '(87.6,41.8)'::point <@> '(106.7,35.1)'::point;

‎contrib/fulltextindex/fti.pl

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
#!/usr/bin/perl
2+
#
3+
# This script substracts all substrings out of a specific column in a table
4+
# and generates output that can be loaded into a new table with the
5+
# psql '\copy' command. The new table should have the following structure:
6+
#
7+
#create table tab (
8+
#string text,
9+
#id oid
10+
#);
11+
#
12+
# Note that you cannot use 'copy' (the SQL-command) directly, because
13+
# there's no '\.' included at the end of the output.
14+
#
15+
# The output can be fed through the UNIX commands 'uniq' and 'sort'
16+
# to generate the smallest and sorted output to populate the fti-table.
17+
#
18+
# Example:
19+
#
20+
# fti.pl -u -d mydb -t mytable -c mycolumn -f myfile
21+
#sort -o myoutfile myfile
22+
#uniq myoutfile sorted-file
23+
#
24+
# psql -u mydb
25+
#
26+
#\copy my_fti_table from myfile
27+
#
28+
# create index fti_idx on my_fti_table (string,id);
29+
#
30+
#create function fti() returns opaque as
31+
#'/path/to/fti/file/fti.so'
32+
#language 'newC';
33+
#
34+
#create trigger my_fti_trigger after update or insert or delete
35+
#on mytable
36+
#for each row execute procedure fti(my_fti_table, mycolumn);
37+
#
38+
# Make sure you have an index on mytable(oid) to be able to do somewhat
39+
# efficient substring searches.
40+
41+
#use lib '/usr/local/pgsql/lib/perl5/';
42+
use lib'/mnt/web/guide/postgres/lib/perl5/site_perl';
43+
use Pg;
44+
use Getopt::Std;
45+
46+
$PGRES_EMPTY_QUERY = 0 ;
47+
$PGRES_COMMAND_OK = 1 ;
48+
$PGRES_TUPLES_OK = 2 ;
49+
$PGRES_COPY_OUT = 3 ;
50+
$PGRES_COPY_IN = 4 ;
51+
$PGRES_BAD_RESPONSE = 5 ;
52+
$PGRES_NONFATAL_ERROR = 6 ;
53+
$PGRES_FATAL_ERROR = 7 ;
54+
55+
$[ = 0;# make sure string offsets start at 0
56+
57+
subbreak_up {
58+
my$string =pop@_;
59+
60+
@strings =split(/\W+/,$string);
61+
@subs = ();
62+
63+
foreach$s (@strings) {
64+
$len =length($s);
65+
nextif ($len < 4);
66+
67+
$lpos =$len-1;
68+
while ($lpos >= 3) {
69+
$fpos =$lpos - 3;
70+
while ($fpos >= 0) {
71+
$sub =substr($s,$fpos,$lpos -$fpos + 1);
72+
push(@subs,$sub);
73+
$fpos =$fpos - 1;
74+
}
75+
$lpos =$lpos - 1;
76+
}
77+
}
78+
79+
return@subs;
80+
}
81+
82+
subconnect_db {
83+
my$dbname =shift@_;
84+
my$user =shift@_;
85+
my$passwd =shift@_;
86+
87+
if (!defined($dbname) ||$dbnameeq"") {
88+
return 1;
89+
}
90+
$connect_string ="dbname=$dbname";
91+
92+
if ($userne"") {
93+
if ($passwdeq"") {
94+
return 0;
95+
}
96+
$connect_string ="$connect_string user=$user password=$passwd".
97+
"authtype=password";
98+
}
99+
100+
$PG_CONN = PQconnectdb($connect_string);
101+
102+
if (PQstatus($PG_CONN)) {
103+
printSTDERR"Couldn't make connection with database!\n";
104+
printSTDERR PQerrorMessage($PG_CONN),"\n";
105+
return 0;
106+
}
107+
108+
return 1;
109+
}
110+
111+
subquit_prog {
112+
close(OUT);
113+
unlink$opt_f;
114+
if (defined($PG_CONN)) {
115+
PQfinish($PG_CONN);
116+
}
117+
exit 1;
118+
}
119+
120+
subget_username {
121+
print"Username:";
122+
chop($n = <STDIN>);
123+
124+
return$n;;
125+
}
126+
127+
subget_password {
128+
print"Password:";
129+
130+
system("stty -echo < /dev/tty");
131+
chop($pwd = <STDIN>);
132+
print"\n";
133+
system("stty echo < /dev/tty");
134+
135+
return$pwd;
136+
}
137+
138+
submain {
139+
getopts('d:t:c:f:u');
140+
141+
if (!$opt_d || !$opt_t || !$opt_c || !$opt_f) {
142+
printSTDERR"usage:$0 [-u] -d database -t table -c column".
143+
"-f output-file\n";
144+
return 1;
145+
}
146+
147+
if (defined($opt_u)) {
148+
$uname = get_username();
149+
$pwd = get_password();
150+
}else {
151+
$uname ="";
152+
$pwd ="";
153+
}
154+
155+
$SIG{'INT'} ='quit_prog';
156+
if (!connect_db($opt_d,$uname,$pwd)) {
157+
printSTDERR"Connecting to database failed!\n";
158+
return 1;
159+
}
160+
161+
if (!open(OUT,">$opt_f")) {
162+
printSTDERR"Couldnt' open file '$opt_f' for output!\n";
163+
return 1;
164+
}
165+
166+
PQexec($PG_CONN,"begin");
167+
168+
$query ="declare C cursor for select$opt_c, oid from$opt_t";
169+
$res = PQexec($PG_CONN,$query);
170+
if (!$res || (PQresultStatus($res) !=$PGRES_COMMAND_OK)) {
171+
printSTDERR"Error declaring cursor!\n";
172+
printSTDERR PQerrorMessage($PG_CONN),"\n";
173+
PQfinish($PG_CONN);
174+
return 1;
175+
}
176+
PQclear($res);
177+
178+
$query ="fetch in C";
179+
while (($res = PQexec($PG_CONN,$query)) &&
180+
(PQresultStatus($res) ==$PGRES_TUPLES_OK) &&
181+
(PQntuples($res) == 1)) {
182+
$col = PQgetvalue($res, 0, 0);
183+
$oid = PQgetvalue($res, 0, 1);
184+
185+
@subs = break_up($col);
186+
foreach$i (@subs) {
187+
print OUT"$i\t$oid\n";
188+
}
189+
}
190+
191+
if (!$res || (PQresultStatus($res) != PGRES_TUPLES_OK)) {
192+
printSTDERR"Error retrieving data from backend!\n";
193+
printSTDERR PQerrorMEssage($PG_CONN),"\n";
194+
PQfinish($PG_CONN);
195+
return 1;
196+
}
197+
198+
PQclear($res);
199+
PQfinish($PG_CONN);
200+
201+
return 0;
202+
}
203+
204+
exit main();

‎contrib/fulltextindex/fti.sql.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
create function fti() returns opaque as
2+
'MODULE_PATHNAME'
3+
language 'C';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp