Thread: Re: make_greater_string busted
Tom Lane wrote: > I see in your recent bytea-LIKE patch > > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > else > len -= -1; > > Surely there's one too many minus signs in that last? Bug by Joe; review by Tom; patch attached; please apply. Almost sounds like a short poem ;-) Joe Index: src/backend/utils/adt/selfuncs.c =================================================================== RCS file: /opt/src/cvs/pgsql-server/src/backend/utils/adt/selfuncs.c,v retrieving revision 1.117 diff -c -r1.117 selfuncs.c *** src/backend/utils/adt/selfuncs.c 4 Sep 2002 20:31:29 -0000 1.117 --- src/backend/utils/adt/selfuncs.c 18 Sep 2002 22:56:28 -0000 *************** *** 3376,3382 **** if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); else ! len -= -1; if (datatype != BYTEAOID) workstr[len] = '\0'; --- 3376,3382 ---- if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); else ! len -= 1; if (datatype != BYTEAOID) workstr[len] = '\0';
Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. --------------------------------------------------------------------------- Joe Conway wrote: > Tom Lane wrote: > > I see in your recent bytea-LIKE patch > > > > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > > else > > len -= -1; > > > > Surely there's one too many minus signs in that last? > > Bug by Joe; review by Tom; patch attached; please apply. > > Almost sounds like a short poem ;-) > > Joe > > > Index: src/backend/utils/adt/selfuncs.c > =================================================================== > RCS file: /opt/src/cvs/pgsql-server/src/backend/utils/adt/selfuncs.c,v > retrieving revision 1.117 > diff -c -r1.117 selfuncs.c > *** src/backend/utils/adt/selfuncs.c 4 Sep 2002 20:31:29 -0000 1.117 > --- src/backend/utils/adt/selfuncs.c 18 Sep 2002 22:56:28 -0000 > *************** > *** 3376,3382 **** > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > else > ! len -= -1; > > if (datatype != BYTEAOID) > workstr[len] = '\0'; > --- 3376,3382 ---- > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > else > ! len -= 1; > > if (datatype != BYTEAOID) > workstr[len] = '\0'; > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Patch applied. Thanks. --------------------------------------------------------------------------- Patch applied. Thanks. --------------------------------------------------------------------------- Joe Conway wrote: > Tom Lane wrote: > > I see in your recent bytea-LIKE patch > > > > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > > else > > len -= -1; > > > > Surely there's one too many minus signs in that last? > > Bug by Joe; review by Tom; patch attached; please apply. > > Almost sounds like a short poem ;-) > > Joe > > > Index: src/backend/utils/adt/selfuncs.c > =================================================================== > RCS file: /opt/src/cvs/pgsql-server/src/backend/utils/adt/selfuncs.c,v > retrieving revision 1.117 > diff -c -r1.117 selfuncs.c > *** src/backend/utils/adt/selfuncs.c 4 Sep 2002 20:31:29 -0000 1.117 > --- src/backend/utils/adt/selfuncs.c 18 Sep 2002 22:56:28 -0000 > *************** > *** 3376,3382 **** > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > else > ! len -= -1; > > if (datatype != BYTEAOID) > workstr[len] = '\0'; > --- 3376,3382 ---- > if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1) > len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1); > else > ! len -= 1; > > if (datatype != BYTEAOID) > workstr[len] = '\0'; > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073