From: Marc G. Fournier Date: Sun, 15 Mar 1998 08:07:01 +0000 (+0000) Subject: From: "Thomas G. Lockhart" X-Git-Tag: REL6_3_2~143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b64a7549b4c2e459e1d64b1d5cc94f4f5998f503;p=thirdparty%2Fpostgresql.git From: "Thomas G. Lockhart" For substr() and substring() on the text data type, the relevant code is in varlena.c. You are right, there is a problem. I have a patch which I will apply to the source tree soon. The copy enclosed below probably does not preserve tabs correctly so cannot be applied directly; the relevant change is simply changing the ">=" to ">"... --- diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index a6b45d20938..c45a5d9a2e3 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.31 1998/02/26 04:37:24 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.32 1998/03/15 08:07:01 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -291,7 +291,7 @@ text_substr(text *string, int32 m, int32 n) len = VARSIZE(string) - VARHDRSZ; /* m will now become a zero-based starting position */ - if (m >= len) + if (m > len) { m = 0; n = 0;