From: "Thomas G. Lockhart" <lockhart@alumni.caltech.edu>

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 ">"...
This commit is contained in:
Marc G. Fournier 1998-03-15 08:07:01 +00:00
parent 6ac2528616
commit b64a7549b4
1 changed files with 2 additions and 2 deletions

View File

@ -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;