Protects you from coredumps if you do eg. str::int4 where str is a text

field. cf. Tom Lane's <19021.950544016@sss.pgh.pa.us> 14 Feb hackers
message.

Cheers,

Patrick Welche
This commit is contained in:
Bruce Momjian 2000-03-07 23:58:38 +00:00
parent 8fa8f80c1a
commit 0c5422912e
1 changed files with 7 additions and 1 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.33 2000/02/21 03:36:48 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.34 2000/03/07 23:58:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -288,6 +288,9 @@ text_int2(text *string)
int len;
char *str;
if (!string)
return 0;
len = (VARSIZE(string) - VARHDRSZ);
str = palloc(len + 1);
@ -329,6 +332,9 @@ text_int4(text *string)
int len;
char *str;
if (!string)
return 0;
len = (VARSIZE(string) - VARHDRSZ);
str = palloc(len + 1);