Index: src/backend/utils/adt/numeric.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/numeric.c,v
retrieving revision 1.70
diff -c -r1.70 numeric.c
*** src/backend/utils/adt/numeric.c	2 Dec 2003 00:26:59 -0000	1.70
--- src/backend/utils/adt/numeric.c	2 Feb 2004 18:09:23 -0000
***************
*** 2723,2728 ****
--- 2723,2736 ----
  {
  	NumericDigit *newbuf;
  
+ 	/*
+ 	 * If asked to assign a variable to itself, return immediately:
+ 	 * it's a no-op, and we don't want to memcpy() an overlapping
+ 	 * memory range.
+ 	 */
+ 	if (value == dest)
+ 		return;
+ 
  	newbuf = digitbuf_alloc(value->ndigits + 1);
  	newbuf[0] = 0;				/* spare digit for rounding */
  	memcpy(newbuf + 1, value->digits, value->ndigits * sizeof(NumericDigit));
