> It seems there is a mistake in substr function:
authorMarc G. Fournier
Tue, 13 Jan 1998 03:49:51 +0000 (03:49 +0000)
committerMarc G. Fournier
Tue, 13 Jan 1998 03:49:51 +0000 (03:49 +0000)
> then you try get substr, which consists only of last char in string
> you get all string
>
> For example:
> userbase=> select substr('123456', 6,1) ;
> substr
> ------
> 123456
> (1 row)
>

From Edmund Mergl 

src/backend/utils/adt/oracle_compat.c

index 27216ab3d805d9f3966152bb858026e7cc2ef8c8..e39c83aa26f17318a9f8d93b2e8e7063f9968a4d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Edmund Mergl 
  *
- * $Id: oracle_compat.c,v 1.10 1997/09/08 21:48:39 momjian Exp $
+ * $Id: oracle_compat.c,v 1.11 1998/01/13 03:49:51 scrappy Exp $
  *
  */
 
@@ -512,7 +512,7 @@ substr(text *string, int4 m, int4 n)
 
    if ((string == (text *) NULL) ||
        (m <= 0) || (n <= 0) ||
-       ((len = VARSIZE(string) - VARHDRSZ - m) <= 0))
+       ((len = VARSIZE(string) - VARHDRSZ - m + 1) <= 0))
        return string;
 
    len = len + 1 < n ? len + 1 : n;