int2vector.patch
application/octet-stream
Filename: int2vector.patch
Type: application/octet-stream
Part: 0
Message:
[PATCH] bugfix for int2vectorin
Patch
Format: context
| File | + | − |
|---|---|---|
| src/backend/utils/adt/int.c | 13 | 2 |
Index: src/backend/utils/adt/int.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/int.c,v
retrieving revision 1.86
diff -c -r1.86 int.c
*** src/backend/utils/adt/int.c 4 Sep 2009 11:20:22 -0000 1.86
--- src/backend/utils/adt/int.c 2 Dec 2009 02:23:09 -0000
***************
*** 150,164 ****
break;
while (*intString && isspace((unsigned char) *intString))
intString++;
! while (*intString && !isspace((unsigned char) *intString))
intString++;
}
while (*intString && isspace((unsigned char) *intString))
intString++;
! if (*intString)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("int2vector has too many elements")));
SET_VARSIZE(result, Int2VectorSize(n));
result->ndim = 1;
--- 150,175 ----
break;
while (*intString && isspace((unsigned char) *intString))
intString++;
! while (*intString && isdigit((unsigned char) *intString))
intString++;
}
while (*intString && isspace((unsigned char) *intString))
intString++;
!
! /*
! * If there is anything left over then we either ran out of space, or the
! * input contained something other than digits and spaces. Either way we
! * generate an error.
! */
! if (isdigit((unsigned char) *intString))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("int2vector has too many elements")));
+ else if (*intString)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid input for int2vector: \"%s\"",
+ PG_GETARG_CSTRING(0))));
SET_VARSIZE(result, Int2VectorSize(n));
result->ndim = 1;