head	1.5;
access;
symbols
	REL7_4_29:1.4
	REL8_0_25:1.4
	REL7_4_28:1.4
	REL8_0_24:1.4
	REL7_4_27:1.4
	REL8_0_23:1.4
	REL7_4_26:1.4
	REL8_0_22:1.4
	REL7_4_25:1.4
	REL8_0_21:1.4
	REL7_4_24:1.4
	REL8_0_20:1.4
	REL7_4_23:1.4
	REL8_0_19:1.4
	REL7_4_22:1.4
	REL8_0_18:1.4
	REL7_4_21:1.4
	REL8_0_17:1.4
	REL7_4_20:1.4
	REL8_0_16:1.4
	REL7_3_21:1.2
	REL7_4_19:1.4
	REL8_0_15:1.4
	REL7_3_20:1.2
	REL7_4_18:1.4
	REL8_0_14:1.4
	REL7_3_19:1.2
	REL7_4_17:1.4
	REL8_0_13:1.4
	REL8_0_12:1.4
	REL7_3_18:1.2
	REL7_4_16:1.4
	REL8_0_11:1.4
	REL8_0_10:1.4
	REL7_4_15:1.4
	REL7_3_17:1.2
	REL8_0_9:1.4
	REL7_4_14:1.4
	REL7_3_16:1.2
	REL7_3_15:1.2
	REL7_4_13:1.4
	REL8_0_8:1.4
	REL7_3_14:1.2
	REL7_4_12:1.4
	REL8_0_7:1.4
	REL7_3_13:1.2
	REL7_4_11:1.4
	REL8_0_6:1.4
	REL7_3_12:1.2
	REL7_4_10:1.4
	REL8_0_5:1.4
	REL7_3_11:1.2
	REL7_4_9:1.4
	REL8_0_4:1.4
	REL7_2_8:1.1
	REL7_3_10:1.2
	REL7_4_8:1.4
	REL8_0_3:1.4
	REL8_0_2:1.4
	REL7_2_7:1.1
	REL7_3_9:1.2
	REL7_4_7:1.4
	REL8_0_1:1.4
	REL8_0_STABLE:1.4.0.6
	REL8_0_0:1.4.0.4
	REL8_0_0RC5:1.4
	REL8_0_0RC4:1.4
	REL8_0_0RC3:1.4
	REL8_0_0RC2:1.4
	REL8_0_0RC1:1.4
	REL8_0_0BETA5:1.4
	REL8_0_0BETA4:1.4
	REL7_4_6:1.4
	REL7_3_8:1.2
	REL7_2_6:1.1
	REL8_0_0BETA3:1.4
	REL8_0_0BETA2:1.4
	REL7_2_5:1.1
	REL7_4_5:1.4
	REL7_3_7:1.2
	REL7_4_4:1.4
	REL8_0_0BETA1:1.4
	REL7_4_3:1.4
	REL7_4_2:1.4
	REL7_3_6:1.2
	REL7_4_1:1.4
	REL7_3_5:1.2
	REL7_4:1.4
	REL7_4_RC2:1.4
	REL7_4_STABLE:1.4.0.2
	REL7_4_RC1:1.4
	REL7_4_BETA5:1.4
	REL7_4_BETA4:1.4
	REL7_4_BETA3:1.4
	REL7_4_BETA2:1.2
	WIN32_DEV:1.2.0.4
	REL7_4_BETA1:1.2
	REL7_3_4:1.2
	REL7_3_2:1.2
	REL7_2_4:1.1
	REL7_3_STABLE:1.2.0.2
	REL7_2_3:1.1
	REL7_2_STABLE:1.1.0.4
	REL7_2:1.1
	REL7_2_RC2:1.1
	REL7_2_RC1:1.1
	REL7_2_BETA5:1.1
	REL7_2_BETA4:1.1
	REL7_2_BETA3:1.1
	REL7_2_BETA2:1.1
	REL7_2_BETA1:1.1
	REL7_1_2:1.1
	REL7_1_STABLE:1.1.0.2
	REL7_1_BETA:1.1
	REL7_1_BETA3:1.1
	REL7_1_BETA2:1.1
	REL7_1:1.1;
locks; strict;
comment	@# @;


1.5
date	2005.06.22.22.56.26;	author tgl;	state dead;
branches;
next	1.4;

1.4
date	2003.09.13.17.33.46;	author tgl;	state Exp;
branches;
next	1.3;

1.3
date	2003.09.11.17.15.27;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	2002.08.26.17.53.57;	author tgl;	state Exp;
branches;
next	1.1;

1.1
date	2000.06.19.14.01.18;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Remove contrib modules that have been agreed to be obsolete.
(There are more that will be removed once they've been copied to
pgfoundry.org.)
@
text
@Array iterator functions have been removed as of PostgreSQL 7.4, because
equivalent functionality is now available built in to the backend.

For example, previously, using contrib/array, you might have used the
following construct:

    create table t(id int4[], txt text[]);

    -- select tuples with some id element equal to 123
    select * from t where t.id *= 123;

Now you would do this instead:

    -- select tuples with some id element equal to 123
    select * from t where 123 = any (t.id);

    -- or you could also do this
    select * from t where 123 = some (t.id);

Similarly, if using contrib/array, you did the following:

    -- select tuples with all txt elements matching '^[A-Z]'
    select * from t where t.txt[1:3] **~ '^[A-Z]';

Now do this instead:

    -- select tuples with all txt elements matching '^[A-Z]'
    select * from t where '^[A-Z]' ~ all (t.txt[1:3]);

See this section in the PostgreSQL documentation for more detail:
    The SQL Language => Functions and Operators => Row and Array Comparisons
@


1.4
log
@Minor wording improvements.
@
text
@@


1.3
log
@Here is a patch that removes contrib/array, leaving only the README with
some examples of the new syntax and a reference to the documentation.

Joe Conway.
@
text
@d30 2
a31 3
See the related section in the online documentation for more detail:
    Table of Contents => Functions and Operators => Row and Array Comparisons

@


1.2
log
@Modify array operations to include array's element type OID in the
array header, and to compute sizing and alignment of array elements
the same way normal tuple access operations do --- viz, using the
tupmacs.h macros att_addlength and att_align.  This makes the world
safe for arrays of cstrings or intervals, and should make it much
easier to write array-type-polymorphic functions; as examples see
the cleanups of array_out and contrib/array_iterator.  By Joe Conway
and Tom Lane.
@
text
@d1 2
a2 2
Array iterator functions, by Massimo Dal Zotto <dz@@cs.unitn.it>
Copyright (C) 1999, Massimo Dal Zotto <dz@@cs.unitn.it>
d4 2
a5 2
This software is distributed under the GNU General Public License
either version 2, or (at your option) any later version.
d7 1
d9 23
a31 40
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 operator requires writing a different C function.
This is tedious, and error-prone since one must take care that the correct
datatypes are associated with the selected underlying function.
Can anyone suggest a better and more portable way to do it ?
a32 1
See also array_iterator.sql for an example on how to use this module.
@


1.1
log
@Add missing /contrib files
@
text
@d44 4
a47 4
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 ?
@
