Skip to content
Snippets Groups Projects
Commit 6de7d4fe authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Update to /contrib from Karel.

parent b2c56574
No related branches found
No related tags found
No related merge requests found
Showing
with 9 additions and 158 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
The PostgreSQL contrib: The PostgreSQL contrib:
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
apache_logging - tips/apache_logging -
Getting Apache to log to PostgreSQL Getting Apache to log to PostgreSQL
by Terry Mackintosh <terry@terrym.com> by Terry Mackintosh <terry@terrym.com>
...@@ -27,12 +27,6 @@ isbn_issn - ...@@ -27,12 +27,6 @@ isbn_issn -
PostgreSQL type extensions for ISBN (books) and ISSN (serials) PostgreSQL type extensions for ISBN (books) and ISSN (serials)
by Garrett A. Wollman <wollman@khavrinen.lcs.mit.edu> by Garrett A. Wollman <wollman@khavrinen.lcs.mit.edu>
likeplanning -
Scripts to enable/disable new planning code for LIKE and regexp
pattern match operators. These will go away again once the code
is mature enough to enable by default.
by Tom Lane <tgl@sss.pgh.pa.us>
linux - linux -
Start postgres back end system Start postgres back end system
by Thomas Lockhart <lockhart@alumni.caltech.edu> by Thomas Lockhart <lockhart@alumni.caltech.edu>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Portions Copyright (c) 1999-2000, PostgreSQL, Inc # Portions Copyright (c) 1999-2000, PostgreSQL, Inc
# #
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.4 2000/06/15 18:54:29 momjian Exp $ # $Header: /cvsroot/pgsql/contrib/Makefile,v 1.5 2000/06/19 13:52:59 momjian Exp $
# #
TOPDIR = .. TOPDIR = ..
...@@ -14,7 +14,6 @@ WANTED_DIRS = array \ ...@@ -14,7 +14,6 @@ WANTED_DIRS = array \
findoidjoins \ findoidjoins \
fulltextindex \ fulltextindex \
isbn_issn \ isbn_issn \
likeplanning \
linux \ linux \
lo \ lo \
mSQL-interface \ mSQL-interface \
...@@ -31,7 +30,6 @@ WANTED_DIRS = array \ ...@@ -31,7 +30,6 @@ WANTED_DIRS = array \
userlock \ userlock \
vacuumlo vacuumlo
# odbc # odbc
# os2client
all: all:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/contrib/Attic/Makefile.global,v 1.1 2000/06/15 19:04:37 momjian Exp $ # $Header: /cvsroot/pgsql/contrib/Attic/Makefile.global,v 1.2 2000/06/19 13:52:59 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
......
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
FIXME: FIXME:
os2client
odbc odbc
spi/preprocessor spi/preprocessor
tools tools
- the contrib contain is in the "Contrib.index"
- in each directory must be Makefile, possible Makefile template - in each directory must be Makefile, possible Makefile template
is below this text, is below this text,
-------- --------
# #
# $Header: /cvsroot/pgsql/contrib/README,v 1.18 2000/06/15 18:54:29 momjian Exp $ # $Header: /cvsroot/pgsql/contrib/README,v 1.19 2000/06/19 13:52:59 momjian Exp $
# #
TOPDIR=../.. TOPDIR=../..
......
# #
# $Header: /cvsroot/pgsql/contrib/array/Attic/Makefile,v 1.9 2000/06/16 18:58:25 momjian Exp $ # $Header: /cvsroot/pgsql/contrib/array/Attic/Makefile,v 1.10 2000/06/19 13:53:03 momjian Exp $
# #
TOPDIR=../.. TOPDIR=../..
...@@ -10,7 +10,7 @@ NAME = array_iterator ...@@ -10,7 +10,7 @@ NAME = array_iterator
PROGRAM = PROGRAM =
OBJS = $(NAME).o OBJS = $(NAME).o
DOCS = README DOCS = README.$(NAME)
SQLS = $(NAME).sql SQLS = $(NAME).sql
BINS = BINS =
EXAMPLES= EXAMPLES=
...@@ -29,7 +29,7 @@ install: install_doc install_sql install_mod ...@@ -29,7 +29,7 @@ install: install_doc install_sql install_mod
install_doc: install_doc:
for inst_file in $(DOCS); do \ for inst_file in $(DOCS); do \
$(INSTALL) $(INSTL_LIB_OPTS) $$inst_file (CONTRIB_DOCDIR)/$(DOCS).$(NAME) ; \ $(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_DOCDIR); \
done done
install_sql: install_sql:
......
Array iterator functions, by Massimo Dal Zotto <dz@cs.unitn.it>
Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
This software is distributed under the GNU General Public License
either version 2, or (at your option) any later version.
This loadable module defines a new class of functions which take
an array and a scalar value, iterate a scalar operator over the
elements of the array and the value, and compute a result as
the logical OR or AND of the iteration results.
For example array_int4eq returns true if some of the elements
of an array of int4 is equal to the given value:
array_int4eq({1,2,3}, 1) --> true
array_int4eq({1,2,3}, 4) --> false
If we have defined T array types and O scalar operators we can
define T x O x 2 array functions, each of them has a name like
"array_[all_]<basetype><operation>" and takes an array of type T
iterating the operator O over all the elements. Note however
that some of the possible combination are invalid, for example
the array_int4_like because there is no like operator for int4.
We can then define new operators based on these functions and use
them to write queries with qualification clauses based on the
values of some of the elements of an array.
For example to select rows having some or all element of an array
attribute equal to a given value or matching a regular expression:
create table t(id int4[], txt text[]);
-- select tuples with some id element equal to 123
select * from t where t.id *= 123;
-- select tuples with some txt element matching '[a-z]'
select * from t where t.txt *~ '[a-z]';
-- select tuples with all txt elements matching '^[A-Z]'
select * from t where t.txt[1:3] **~ '^[A-Z]';
The scheme is quite general, each operator which operates on a base type
can be iterated over the elements of an array. It seem to work well but
defining each new operators requires writing a different C function.
Furthermore in each function there are two hardcoded OIDs which reference
a base type and a procedure. Not very portable. Can anyone suggest a
better and more portable way to do it ?
See also array_iterator.sql for an example on how to use this module.
A set of C routines to implement an SQL-compliant bitstring type.
The file varbit.c contains the c-functions to implement both BIT and
BIT VARYING. Both types are implemented in essentially the same way,
except that BIT is zero padded to a specified length. I've tried to
make this code as independent as possible of the byte length, but it
is quite possible that there may be problems on machines that don't
have 8 bits/byte (are there still any around?).
The SQL standard only defines comparison, SUBSTR and concatenation
operators, and these have been implemented. In addition all logical
operators have been implemented, i.e. ~,|,&,^,<< and >>. This is
useful if one wants to build bit masks. If the two strings are not of
the same length the longer string is truncated (truncation was the
only real option, as padding with zeros could give unintuitive results
for ^) and the result has the length of the shorter string. If there
is a requirement for any other functions, let me know, and I will have
a look.
My knowledge of postgres is not up to integrating a type, so I'm hoping
that somebody can integrate this type for me, or give me some hints as
to what needs to be done. These routines were developed outside the
postgres source tree, with a hacked version of postgres.h. The header
files probably need some ammending.
The included files are
varbit.h -- bit string header type
varbit.c -- the routines
vartest.c -- a few calls to the routines to
The following routines are available.
char * zpbitin(char *s, int dummy, int32 atttypmod);
Read in a zero padded bit string of the form X'...' or B'...'
char * zpbitout(char *s);
Print a zero padded bit string in hex X'...'
char * zpbitsout(char *s);
Print a zero padded bit string in binary B'...'
char * varbitin(char *s, int dummy, int32 atttypmod);
Read in a varying length bit string of the form X'...' or B'...'
[There is no need for separate output functions for varying bit, as
zpbitout will print them out correctly]
char * bitcat (char *arg1, char *arg2);
Bit concatenation.
char * bitsubstr (char *arg, int32 s, int32 l);
Substring of a bit string.
bool biteq (char *arg1, char *arg2);
bool bitne (char *arg1, char *arg2);
bool bitge (char *arg1, char *arg2);
bool bitgt (char *arg1, char *arg2);
bool bitle (char *arg1, char *arg2);
bool bitlt (char *arg1, char *arg2);
int bitcmp (char *arg1, char *arg2);
Comparison operators
char * bitand (char * arg1, char * arg2);
char * bitor (char * arg1, char * arg2);
char * bitxor (char * arg1, char * arg2);
char * bitnot (char * arg);
char * bitshiftright (char * arg, int shft);
char * bitshiftleft (char * arg, int shft);
Bit operations.
If anything else needs to be done, please let me know.
Adriaan (adriaan@albourne.com)
Datetime functions.
Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
This software is distributed under the GNU General Public License
either version 2, or (at your option) any later version.
I have written some new funtions for time and date data types which can
be used to extract hour,minutes,seconds from time values, and year,
month,day from a date. There is also a time_difference and functions
to convert a time to minutes or seconds.
There are also new input/output functions for the time data type which
allow the insertion of time attributes with value 24:00:00.
This can be useful if your application needs to compute time difference
from two time values representing an elapsed time of 24 hours.
Massimo Dal Zotto <dz@cs.unitn.it>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment