Hi,

there is a bug in my array contrib. The varchar and bpchar function don't
work correctly. The following patch (for 6.5.1) fixes the problem.

*** contrib/array/array_iterator.c.orig	Sat Jun  5 21:09:35 1999
--- contrib/array/array_iterator.c	Tue Aug 31 11:22:44 1999
***************
*** 6,14 ****
   * elements of the array and the value and compute a result as
   * the logical OR or AND of the iteration results.
   *
!  * Copyright (c) 1997, Massimo Dal Zotto <dz@cs.unitn.it>
   * ported to postgreSQL 6.3.2,added oid_functions, 18.1.1999,
   * Tobias Gabele <gabele@wiz.uni-kassel.de>
   */
  
  #include <ctype.h>
--- 6,17 ----
   * elements of the array and the value and compute a result as
   * the logical OR or AND of the iteration results.
   *
!  * Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
   * ported to postgreSQL 6.3.2,added oid_functions, 18.1.1999,
   * Tobias Gabele <gabele@wiz.uni-kassel.de>
+  *
+  * This software is distributed under the GNU General Public License
+  * either version 2, or (at your option) any later version.
   */
  
  #include <ctype.h>
***************
*** 180,186 ****
  int32
  array_varchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* varchar */
  						  (Oid) 1070,	/* varchareq */
  						  0,			/* logical or */
  						  array, (Datum) value);
--- 183,189 ----
  int32
  array_varchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1043,	/* varchar */
  						  (Oid) 1070,	/* varchareq */
  						  0,			/* logical or */
  						  array, (Datum) value);
***************
*** 189,195 ****
  int32
  array_all_varchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* varchar */
  						  (Oid) 1070,	/* varchareq */
  						  1,			/* logical and */
  						  array, (Datum) value);
--- 192,198 ----
  int32
  array_all_varchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1043,	/* varchar */
  						  (Oid) 1070,	/* varchareq */
  						  1,			/* logical and */
  						  array, (Datum) value);
***************
*** 198,204 ****
  int32
  array_varcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* varchar */
  						  (Oid) 1254,	/* textregexeq */
  						  0,			/* logical or */
  						  array, (Datum) value);
--- 201,207 ----
  int32
  array_varcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1043,	/* varchar */
  						  (Oid) 1254,	/* textregexeq */
  						  0,			/* logical or */
  						  array, (Datum) value);
***************
*** 207,213 ****
  int32
  array_all_varcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* varchar */
  						  (Oid) 1254,	/* textregexeq */
  						  1,			/* logical and */
  						  array, (Datum) value);
--- 210,216 ----
  int32
  array_all_varcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1043,	/* varchar */
  						  (Oid) 1254,	/* textregexeq */
  						  1,			/* logical and */
  						  array, (Datum) value);
***************
*** 221,227 ****
  int32
  array_bpchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* bpchar */
  						  (Oid) 1048,	/* bpchareq */
  						  0,			/* logical or */
  						  array, (Datum) value);
--- 224,230 ----
  int32
  array_bpchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1042,	/* bpchar */
  						  (Oid) 1048,	/* bpchareq */
  						  0,			/* logical or */
  						  array, (Datum) value);
***************
*** 230,236 ****
  int32
  array_all_bpchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* bpchar */
  						  (Oid) 1048,	/* bpchareq */
  						  1,			/* logical and */
  						  array, (Datum) value);
--- 233,239 ----
  int32
  array_all_bpchareq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1042,	/* bpchar */
  						  (Oid) 1048,	/* bpchareq */
  						  1,			/* logical and */
  						  array, (Datum) value);
***************
*** 239,245 ****
  int32
  array_bpcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* bpchar */
  						  (Oid) 1254,	/* textregexeq */
  						  0,			/* logical or */
  						  array, (Datum) value);
--- 242,248 ----
  int32
  array_bpcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1042,	/* bpchar */
  						  (Oid) 1254,	/* textregexeq */
  						  0,			/* logical or */
  						  array, (Datum) value);
***************
*** 248,254 ****
  int32
  array_all_bpcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 20,		/* bpchar */
  						  (Oid) 1254,	/* textregexeq */
  						  1,			/* logical and */
  						  array, (Datum) value);
--- 251,257 ----
  int32
  array_all_bpcharregexeq(ArrayType *array, char *value)
  {
! 	return array_iterator((Oid) 1042,	/* bpchar */
  						  (Oid) 1254,	/* textregexeq */
  						  1,			/* logical and */
  						  array, (Datum) value);

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+

Tue, 31 Aug 1999 17:01:43 +0200 (MEST)
Massimo Dal Zotto <dz@wizard.net>
bug in array contrib
This shows as already applied.


> Hi,
> 
> there is a bug in my array contrib. The varchar and bpchar function don't
> work correctly. The following patch (for 6.5.1) fixes the problem.
> 
> *** contrib/array/array_iterator.c.orig	Sat Jun  5 21:09:35 1999
> --- contrib/array/array_iterator.c	Tue Aug 31 11:22:44 1999
> ***************
> *** 6,14 ****
>    * elements of the array and the value and compute a result as
>    * the logical OR or AND of the iteration results.
>    *
> !  * Copyright (c) 1997, Massimo Dal Zotto <dz@cs.unitn.it>
>    * ported to postgreSQL 6.3.2,added oid_functions, 18.1.1999,
>    * Tobias Gabele <gabele@wiz.uni-kassel.de>
>    */
>   
>   #include <ctype.h>
> --- 6,17 ----
>    * elements of the array and the value and compute a result as
>    * the logical OR or AND of the iteration results.
>    *
> !  * Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
>    * ported to postgreSQL 6.3.2,added oid_functions, 18.1.1999,
>    * Tobias Gabele <gabele@wiz.uni-kassel.de>
> +  *
> +  * This software is distributed under the GNU General Public License
> +  * either version 2, or (at your option) any later version.
>    */
>   
>   #include <ctype.h>
> ***************
> *** 180,186 ****
>   int32
>   array_varchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* varchar */
>   						  (Oid) 1070,	/* varchareq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> --- 183,189 ----
>   int32
>   array_varchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1043,	/* varchar */
>   						  (Oid) 1070,	/* varchareq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> ***************
> *** 189,195 ****
>   int32
>   array_all_varchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* varchar */
>   						  (Oid) 1070,	/* varchareq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> --- 192,198 ----
>   int32
>   array_all_varchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1043,	/* varchar */
>   						  (Oid) 1070,	/* varchareq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> ***************
> *** 198,204 ****
>   int32
>   array_varcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* varchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> --- 201,207 ----
>   int32
>   array_varcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1043,	/* varchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> ***************
> *** 207,213 ****
>   int32
>   array_all_varcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* varchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> --- 210,216 ----
>   int32
>   array_all_varcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1043,	/* varchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> ***************
> *** 221,227 ****
>   int32
>   array_bpchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* bpchar */
>   						  (Oid) 1048,	/* bpchareq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> --- 224,230 ----
>   int32
>   array_bpchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1042,	/* bpchar */
>   						  (Oid) 1048,	/* bpchareq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> ***************
> *** 230,236 ****
>   int32
>   array_all_bpchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* bpchar */
>   						  (Oid) 1048,	/* bpchareq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> --- 233,239 ----
>   int32
>   array_all_bpchareq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1042,	/* bpchar */
>   						  (Oid) 1048,	/* bpchareq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> ***************
> *** 239,245 ****
>   int32
>   array_bpcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* bpchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> --- 242,248 ----
>   int32
>   array_bpcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1042,	/* bpchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  0,			/* logical or */
>   						  array, (Datum) value);
> ***************
> *** 248,254 ****
>   int32
>   array_all_bpcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 20,		/* bpchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> --- 251,257 ----
>   int32
>   array_all_bpcharregexeq(ArrayType *array, char *value)
>   {
> ! 	return array_iterator((Oid) 1042,	/* bpchar */
>   						  (Oid) 1254,	/* textregexeq */
>   						  1,			/* logical and */
>   						  array, (Datum) value);
> 
> -- 
> Massimo Dal Zotto
> 
> +----------------------------------------------------------------------+
> |  Massimo Dal Zotto               email: dz@cs.unitn.it               |
> |  Via Marconi, 141                phone: ++39-0461534251              |
> |  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
> |  Italy                             pgp: finger dz@tango.cs.unitn.it  |
> +----------------------------------------------------------------------+
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 27 Sep 1999 16:39:40 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: bug in array contrib