> It seems there is a mistake in substr function:

> 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 <E.Mergl@bawue.de>
This commit is contained in:
Marc G. Fournier 1998-01-13 03:49:51 +00:00
parent fc7950993d
commit f0445dcbc4
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/*
* Edmund Mergl <E.Mergl@bawue.de>
*
* $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;