bug in array contrib - Mailing list pgsql-hackers

From Massimo Dal Zotto
Subject bug in array contrib
Date
Msg-id 199908311501.RAA21503@nikita.wizard.net
Whole thread Raw
Responses Re: bug in array contrib
List pgsql-hackers
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  |
+----------------------------------------------------------------------+


pgsql-hackers by date:

Previous
From: Massimo Dal Zotto
Date:
Subject: Re: [HACKERS] PostgreSQL 6.5.2
Next
From: "G. Anthony Reina"
Date:
Subject: ERROR: Unable to locate type oid 718 in catalog