Index: src/backend/commands/prepare.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/commands/prepare.c,v
retrieving revision 1.23
diff -c -r1.23 prepare.c
*** src/backend/commands/prepare.c	8 Aug 2003 21:41:32 -0000	1.23
--- src/backend/commands/prepare.c	24 Sep 2003 06:06:59 -0000
***************
*** 369,375 ****
  		/*
  		 * We can't just use the statement name as supplied by the user:
  		 * the hash package is picky enough that it needs to be
! 		 * NULL-padded out to the appropriate length to work correctly.
  		 */
  		MemSet(key, 0, sizeof(key));
  		strncpy(key, stmt_name, sizeof(key));
--- 369,375 ----
  		/*
  		 * We can't just use the statement name as supplied by the user:
  		 * the hash package is picky enough that it needs to be
! 		 * NUL-padded out to the appropriate length to work correctly.
  		 */
  		MemSet(key, 0, sizeof(key));
  		strncpy(key, stmt_name, sizeof(key));
Index: src/backend/lib/stringinfo.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/lib/stringinfo.c,v
retrieving revision 1.36
diff -c -r1.36 stringinfo.c
*** src/backend/lib/stringinfo.c	4 Aug 2003 02:39:59 -0000	1.36
--- src/backend/lib/stringinfo.c	24 Sep 2003 06:06:59 -0000
***************
*** 3,9 ****
   * stringinfo.c
   *
   * StringInfo provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (null-terminated text)
   * or arbitrary binary data.  All storage is allocated with palloc().
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
--- 3,9 ----
   * stringinfo.c
   *
   * StringInfo provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (NUL-terminated text)
   * or arbitrary binary data.  All storage is allocated with palloc().
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
***************
*** 132,143 ****
  	 */
  	if (nprinted >= 0 && nprinted < avail - 1)
  	{
! 		/* Success.  Note nprinted does not include trailing null. */
  		str->len += nprinted;
  		return true;
  	}
  
! 	/* Restore the trailing null so that str is unmodified. */
  	str->data[str->len] = '\0';
  	return false;
  }
--- 132,143 ----
  	 */
  	if (nprinted >= 0 && nprinted < avail - 1)
  	{
! 		/* Success.  Note nprinted does not include trailing NUL. */
  		str->len += nprinted;
  		return true;
  	}
  
! 	/* Restore the trailing NUL so that str is unmodified. */
  	str->data[str->len] = '\0';
  	return false;
  }
***************
*** 145,151 ****
  /*
   * appendStringInfoString
   *
!  * Append a null-terminated string to str.
   * Like appendStringInfo(str, "%s", s) but faster.
   */
  void
--- 145,151 ----
  /*
   * appendStringInfoString
   *
!  * Append a NUL-terminated string to str.
   * Like appendStringInfo(str, "%s", s) but faster.
   */
  void
***************
*** 192,198 ****
  	str->len += datalen;
  
  	/*
! 	 * Keep a trailing null in place, even though it's probably useless
  	 * for binary data...
  	 */
  	str->data[str->len] = '\0';
--- 192,198 ----
  	str->len += datalen;
  
  	/*
! 	 * Keep a trailing NUL in place, even though it's probably useless
  	 * for binary data...
  	 */
  	str->data[str->len] = '\0';
***************
*** 202,208 ****
   * enlargeStringInfo
   *
   * Make sure there is enough space for 'needed' more bytes
!  * ('needed' does not include the terminating null).
   *
   * External callers usually need not concern themselves with this, since
   * all stringinfo.c routines do it automatically.  However, if a caller
--- 202,208 ----
   * enlargeStringInfo
   *
   * Make sure there is enough space for 'needed' more bytes
!  * ('needed' does not include the terminating NUL).
   *
   * External callers usually need not concern themselves with this, since
   * all stringinfo.c routines do it automatically.  However, if a caller
Index: src/backend/libpq/md5.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/libpq/md5.c,v
retrieving revision 1.21
diff -c -r1.21 md5.c
*** src/backend/libpq/md5.c	4 Aug 2003 02:39:59 -0000	1.21
--- src/backend/libpq/md5.c	24 Sep 2003 06:06:59 -0000
***************
*** 328,335 ****
  
  
  /*
!  * Computes MD5 checksum of "passwd" (a null-terminated string) followed
!  * by "salt" (which need not be null-terminated).
   *
   * Output format is "md5" followed by a 32-hex-digit MD5 checksum.
   * Hence, the output buffer "buf" must be at least 36 bytes long.
--- 328,335 ----
  
  
  /*
!  * Computes MD5 checksum of "passwd" (a NUL-terminated string) followed
!  * by "salt" (which need not be NUL-terminated).
   *
   * Output format is "md5" followed by a 32-hex-digit MD5 checksum.
   * Hence, the output buffer "buf" must be at least 36 bytes long.
Index: src/backend/libpq/pqcomm.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/libpq/pqcomm.c,v
retrieving revision 1.165
diff -c -r1.165 pqcomm.c
*** src/backend/libpq/pqcomm.c	12 Aug 2003 22:42:01 -0000	1.165
--- src/backend/libpq/pqcomm.c	24 Sep 2003 06:06:59 -0000
***************
*** 48,54 ****
   *
   * low-level I/O:
   *		pq_getbytes		- get a known number of bytes from connection
!  *		pq_getstring	- get a null terminated string from connection
   *		pq_getmessage	- get a message with length word from connection
   *		pq_getbyte		- get next byte from connection
   *		pq_peekbyte		- peek at next byte from connection
--- 48,54 ----
   *
   * low-level I/O:
   *		pq_getbytes		- get a known number of bytes from connection
!  *		pq_getstring	- get a NUL terminated string from connection
   *		pq_getmessage	- get a message with length word from connection
   *		pq_getbyte		- get next byte from connection
   *		pq_peekbyte		- peek at next byte from connection
***************
*** 754,760 ****
  }
  
  /* --------------------------------
!  *		pq_getstring	- get a null terminated string from connection
   *
   *		The return value is placed in an expansible StringInfo, which has
   *		already been initialized by the caller.
--- 754,760 ----
  }
  
  /* --------------------------------
!  *		pq_getstring	- get a NUL terminated string from connection
   *
   *		The return value is placed in an expansible StringInfo, which has
   *		already been initialized by the caller.
***************
*** 868,874 ****
  			return EOF;
  		}
  		s->len = len;
! 		/* Place a trailing null per StringInfo convention */
  		s->data[len] = '\0';
  	}
  
--- 868,874 ----
  			return EOF;
  		}
  		s->len = len;
! 		/* Place a trailing NUL per StringInfo convention */
  		s->data[len] = '\0';
  	}
  
Index: src/backend/libpq/pqformat.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/libpq/pqformat.c,v
retrieving revision 1.34
diff -c -r1.34 pqformat.c
*** src/backend/libpq/pqformat.c	4 Aug 2003 02:39:59 -0000	1.34
--- src/backend/libpq/pqformat.c	24 Sep 2003 06:06:59 -0000
***************
*** 40,46 ****
   *		pq_sendbytes	- append raw data to a StringInfo buffer
   *		pq_sendcountedtext - append a counted text string (with character set conversion)
   *		pq_sendtext		- append a text string (with conversion)
!  *		pq_sendstring	- append a null-terminated text string (with conversion)
   *		pq_endmessage	- send the completed message to the frontend
   * Note: it is also possible to append data to the StringInfo buffer using
   * the regular StringInfo routines, but this is discouraged since required
--- 40,46 ----
   *		pq_sendbytes	- append raw data to a StringInfo buffer
   *		pq_sendcountedtext - append a counted text string (with character set conversion)
   *		pq_sendtext		- append a text string (with conversion)
!  *		pq_sendstring	- append a NUL-terminated text string (with conversion)
   *		pq_endmessage	- send the completed message to the frontend
   * Note: it is also possible to append data to the StringInfo buffer using
   * the regular StringInfo routines, but this is discouraged since required
***************
*** 63,69 ****
   *		pq_getmsgbytes	- get raw data from a message buffer
   *		pq_copymsgbytes - copy raw data from a message buffer
   *		pq_getmsgtext	- get a counted text string (with conversion)
!  *		pq_getmsgstring - get a null-terminated text string (with conversion)
   *		pq_getmsgend	- verify message fully consumed
   */
  
--- 63,69 ----
   *		pq_getmsgbytes	- get raw data from a message buffer
   *		pq_copymsgbytes - copy raw data from a message buffer
   *		pq_getmsgtext	- get a counted text string (with conversion)
!  *		pq_getmsgstring - get a NUL-terminated text string (with conversion)
   *		pq_getmsgend	- verify message fully consumed
   */
  
***************
*** 126,132 ****
   * The data sent to the frontend by this routine is a 4-byte count field
   * followed by the string.	The count includes itself or not, as per the
   * countincludesself flag (pre-3.0 protocol requires it to include itself).
!  * The passed text string need not be null-terminated, and the data sent
   * to the frontend isn't either.
   * --------------------------------
   */
--- 126,132 ----
   * The data sent to the frontend by this routine is a 4-byte count field
   * followed by the string.	The count includes itself or not, as per the
   * countincludesself flag (pre-3.0 protocol requires it to include itself).
!  * The passed text string need not be NUL-terminated, and the data sent
   * to the frontend isn't either.
   * --------------------------------
   */
***************
*** 155,161 ****
  /* --------------------------------
   *		pq_sendtext		- append a text string (with conversion)
   *
!  * The passed text string need not be null-terminated, and the data sent
   * to the frontend isn't either.  Note that this is not actually useful
   * for direct frontend transmissions, since there'd be no way for the
   * frontend to determine the string length.  But it is useful for binary
--- 155,161 ----
  /* --------------------------------
   *		pq_sendtext		- append a text string (with conversion)
   *
!  * The passed text string need not be NUL-terminated, and the data sent
   * to the frontend isn't either.  Note that this is not actually useful
   * for direct frontend transmissions, since there'd be no way for the
   * frontend to determine the string length.  But it is useful for binary
***************
*** 179,187 ****
  }
  
  /* --------------------------------
!  *		pq_sendstring	- append a null-terminated text string (with conversion)
   *
!  * NB: passed text string must be null-terminated, and so is the data
   * sent to the frontend.
   * --------------------------------
   */
--- 179,187 ----
  }
  
  /* --------------------------------
!  *		pq_sendstring	- append a NUL-terminated text string (with conversion)
   *
!  * NB: passed text string must be NUL-terminated, and so is the data
   * sent to the frontend.
   * --------------------------------
   */
***************
*** 398,404 ****
   *		pq_puttextmessage - generate a character set-converted message in one step
   *
   *		This is the same as the pqcomm.c routine pq_putmessage, except that
!  *		the message body is a null-terminated string to which encoding
   *		conversion applies.
   * --------------------------------
   */
--- 398,404 ----
   *		pq_puttextmessage - generate a character set-converted message in one step
   *
   *		This is the same as the pqcomm.c routine pq_putmessage, except that
!  *		the message body is a NUL-terminated string to which encoding
   *		conversion applies.
   * --------------------------------
   */
***************
*** 615,621 ****
   *		pq_getmsgtext	- get a counted text string (with conversion)
   *
   *		Always returns a pointer to a freshly palloc'd result.
!  *		The result has a trailing null, *and* we return its strlen in *nbytes.
   * --------------------------------
   */
  char *
--- 615,621 ----
   *		pq_getmsgtext	- get a counted text string (with conversion)
   *
   *		Always returns a pointer to a freshly palloc'd result.
!  *		The result has a trailing NUL, *and* we return its strlen in *nbytes.
   * --------------------------------
   */
  char *
***************
*** 645,651 ****
  }
  
  /* --------------------------------
!  *		pq_getmsgstring - get a null-terminated text string (with conversion)
   *
   *		May return a pointer directly into the message buffer, or a pointer
   *		to a palloc'd conversion result.
--- 645,651 ----
  }
  
  /* --------------------------------
!  *		pq_getmsgstring - get a NUL-terminated text string (with conversion)
   *
   *		May return a pointer directly into the message buffer, or a pointer
   *		to a palloc'd conversion result.
***************
*** 661,667 ****
  
  	/*
  	 * It's safe to use strlen() here because a StringInfo is guaranteed
! 	 * to have a trailing null byte.  But check we found a null inside the
  	 * message.
  	 */
  	slen = strlen(str);
--- 661,667 ----
  
  	/*
  	 * It's safe to use strlen() here because a StringInfo is guaranteed
! 	 * to have a trailing NUL byte.  But check we found a NUL inside the
  	 * message.
  	 */
  	slen = strlen(str);
Index: src/backend/parser/scan.l
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/parser/scan.l,v
retrieving revision 1.110
diff -c -r1.110 scan.l
*** src/backend/parser/scan.l	4 Aug 2003 02:40:02 -0000	1.110
--- src/backend/parser/scan.l	24 Sep 2003 06:06:59 -0000
***************
*** 656,662 ****
  		} while ((literallen+yleng) >= literalalloc);
  		literalbuf = (char *) repalloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing null */
  	memcpy(literalbuf+literallen, ytext, yleng);
  	literallen += yleng;
  	literalbuf[literallen] = '\0';
--- 656,662 ----
  		} while ((literallen+yleng) >= literalalloc);
  		literalbuf = (char *) repalloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing NUL */
  	memcpy(literalbuf+literallen, ytext, yleng);
  	literallen += yleng;
  	literalbuf[literallen] = '\0';
***************
*** 672,678 ****
  		literalalloc *= 2;
  		literalbuf = (char *) repalloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing null */
  	literalbuf[literallen] = ychar;
  	literallen += 1;
  	literalbuf[literallen] = '\0';
--- 672,678 ----
  		literalalloc *= 2;
  		literalbuf = (char *) repalloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing NUL */
  	literalbuf[literallen] = ychar;
  	literallen += 1;
  	literalbuf[literallen] = '\0';
Index: src/backend/port/nextstep/port.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/port/nextstep/port.c,v
retrieving revision 1.10
diff -c -r1.10 port.c
*** src/backend/port/nextstep/port.c	5 Sep 2002 00:43:07 -0000	1.10
--- src/backend/port/nextstep/port.c	24 Sep 2003 06:06:59 -0000
***************
*** 16,22 ****
  	static int	was_mallocated = 0;
  	int			size;
  
! 	/* Compute the size of environ array including the final NULL */
  	for (size = 1; environ[size++];)
  		 /* nothing */ ;
  
--- 16,22 ----
  	static int	was_mallocated = 0;
  	int			size;
  
! 	/* Compute the size of environ array including the final NUL */
  	for (size = 1; environ[size++];)
  		 /* nothing */ ;
  
***************
*** 33,39 ****
  
  	environ = realloc(environ, (size + 1) * sizeof(char *));
  	environ[size - 1] = strcpy(malloc(strlen(name) + 1), name);
! 	environ[size] = NULL;
  }
  
  #ifndef _POSIX_SOURCE
--- 33,39 ----
  
  	environ = realloc(environ, (size + 1) * sizeof(char *));
  	environ[size - 1] = strcpy(malloc(strlen(name) + 1), name);
! 	environ[size] = '\0';
  }
  
  #ifndef _POSIX_SOURCE
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.345
diff -c -r1.345 postmaster.c
*** src/backend/postmaster/postmaster.c	12 Sep 2003 19:33:59 -0000	1.345
--- src/backend/postmaster/postmaster.c	24 Sep 2003 06:06:59 -0000
***************
*** 1206,1212 ****
  	/*
  	 * Allocate at least the size of an old-style startup packet, plus one
  	 * extra byte, and make sure all are zeroes.  This ensures we will
! 	 * have null termination of all strings, in both fixed- and
  	 * variable-length packet layouts.
  	 */
  	if (len <= (int32) sizeof(StartupPacket))
--- 1206,1212 ----
  	/*
  	 * Allocate at least the size of an old-style startup packet, plus one
  	 * extra byte, and make sure all are zeroes.  This ensures we will
! 	 * have NUL termination of all strings, in both fixed- and
  	 * variable-length packet layouts.
  	 */
  	if (len <= (int32) sizeof(StartupPacket))
***************
*** 1302,1308 ****
  
  		/*
  		 * Scan packet body for name/option pairs.	We can assume any
! 		 * string beginning within the packet body is null-terminated,
  		 * thanks to zeroing extra byte above.
  		 */
  		port->guc_options = NIL;
--- 1302,1308 ----
  
  		/*
  		 * Scan packet body for name/option pairs.	We can assume any
! 		 * string beginning within the packet body is NUL-terminated,
  		 * thanks to zeroing extra byte above.
  		 */
  		port->guc_options = NIL;
Index: src/backend/tcop/fastpath.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/tcop/fastpath.c,v
retrieving revision 1.68
diff -c -r1.68 fastpath.c
*** src/backend/tcop/fastpath.c	4 Aug 2003 02:40:04 -0000	1.68
--- src/backend/tcop/fastpath.c	24 Sep 2003 06:06:59 -0000
***************
*** 115,121 ****
  			if (pq_getbytes(buf->data + buf->len, argsize))
  				return EOF;
  			buf->len += argsize;
! 			/* Place a trailing null per StringInfo convention */
  			buf->data[buf->len] = '\0';
  		}
  	}
--- 115,121 ----
  			if (pq_getbytes(buf->data + buf->len, argsize))
  				return EOF;
  			buf->len += argsize;
! 			/* Place a trailing NUL per StringInfo convention */
  			buf->data[buf->len] = '\0';
  		}
  	}
***************
*** 475,481 ****
  			getTypeInputInfo(fip->argtypes[i], &typInput, &typElem);
  
  			/*
! 			 * Since stringinfo.c keeps a trailing null in place even for
  			 * binary data, the contents of abuf are a valid C string.	We
  			 * have to do encoding conversion before calling the typinput
  			 * routine, though.
--- 475,481 ----
  			getTypeInputInfo(fip->argtypes[i], &typInput, &typElem);
  
  			/*
! 			 * Since stringinfo.c keeps a trailing NUL in place even for
  			 * binary data, the contents of abuf are a valid C string.	We
  			 * have to do encoding conversion before calling the typinput
  			 * routine, though.
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/tcop/postgres.c,v
retrieving revision 1.363
diff -c -r1.363 postgres.c
*** src/backend/tcop/postgres.c	14 Sep 2003 00:03:32 -0000	1.363
--- src/backend/tcop/postgres.c	24 Sep 2003 06:06:59 -0000
***************
*** 1364,1370 ****
  					 * phony StringInfo pointing to the correct portion of
  					 * the message buffer.	We assume we can scribble on
  					 * the message buffer so as to maintain the convention
! 					 * that StringInfos have a trailing null.  This is
  					 * grotty but is a big win when dealing with very
  					 * large parameter strings.
  					 */
--- 1364,1370 ----
  					 * phony StringInfo pointing to the correct portion of
  					 * the message buffer.	We assume we can scribble on
  					 * the message buffer so as to maintain the convention
! 					 * that StringInfos have a trailing NUL.  This is
  					 * grotty but is a big win when dealing with very
  					 * large parameter strings.
  					 */
Index: src/backend/utils/adt/acl.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/acl.c,v
retrieving revision 1.98
diff -c -r1.98 acl.c
*** src/backend/utils/adt/acl.c	15 Sep 2003 20:03:37 -0000	1.98
--- src/backend/utils/adt/acl.c	24 Sep 2003 06:06:59 -0000
***************
*** 354,360 ****
  
  /*
   * aclitemout
!  *		Allocates storage for, and fills in, a new null-delimited string
   *		containing a formatted ACL specification.  See aclparse for details.
   *
   * RETURNS:
--- 354,360 ----
  
  /*
   * aclitemout
!  *		Allocates storage for, and fills in, a new NUL-delimited string
   *		containing a formatted ACL specification.  See aclparse for details.
   *
   * RETURNS:
Index: src/backend/utils/adt/arrayfuncs.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/arrayfuncs.c,v
retrieving revision 1.99
diff -c -r1.99 arrayfuncs.c
*** src/backend/utils/adt/arrayfuncs.c	17 Aug 2003 19:58:05 -0000	1.99
--- src/backend/utils/adt/arrayfuncs.c	24 Sep 2003 06:06:59 -0000
***************
*** 1026,1032 ****
  		 * Rather than copying data around, we just set up a phony
  		 * StringInfo pointing to the correct portion of the input buffer.
  		 * We assume we can scribble on the input buffer so as to maintain
! 		 * the convention that StringInfos have a trailing null.
  		 */
  		elem_buf.data = &buf->data[buf->cursor];
  		elem_buf.maxlen = itemlen + 1;
--- 1026,1032 ----
  		 * Rather than copying data around, we just set up a phony
  		 * StringInfo pointing to the correct portion of the input buffer.
  		 * We assume we can scribble on the input buffer so as to maintain
! 		 * the convention that StringInfos have a trailing NUL.
  		 */
  		elem_buf.data = &buf->data[buf->cursor];
  		elem_buf.maxlen = itemlen + 1;
***************
*** 1279,1285 ****
  	/*
  	 * 33 since we assume 15 digits per number + ':' +'[]'
  	 *
! 	 * +1 allows for temp trailing null
  	 */
  
  	result = (text *) palloc(nbytes + VARHDRSZ);
--- 1279,1285 ----
  	/*
  	 * 33 since we assume 15 digits per number + ':' +'[]'
  	 *
! 	 * +1 allows for temp trailing NUL
  	 */
  
  	result = (text *) palloc(nbytes + VARHDRSZ);
Index: src/backend/utils/adt/char.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/char.c,v
retrieving revision 1.38
diff -c -r1.38 char.c
*** src/backend/utils/adt/char.c	4 Aug 2003 02:40:04 -0000	1.38
--- src/backend/utils/adt/char.c	24 Sep 2003 06:06:59 -0000
***************
*** 39,45 ****
   *		charout			- converts 'x' to "x"
   *
   * Note that if the char value is \0, the resulting string will appear
!  * to be empty (null-terminated after zero characters).  So this is the
   * inverse of the charin() function for such data.
   */
  Datum
--- 39,45 ----
   *		charout			- converts 'x' to "x"
   *
   * Note that if the char value is \0, the resulting string will appear
!  * to be empty (NUL-terminated after zero characters).  So this is the
   * inverse of the charin() function for such data.
   */
  Datum
***************
*** 216,222 ****
  
  	/*
  	 * Convert \0 to an empty string, for consistency with charout (and
! 	 * because the text stuff doesn't like embedded nulls all that well).
  	 */
  	if (arg1 != '\0')
  	{
--- 216,222 ----
  
  	/*
  	 * Convert \0 to an empty string, for consistency with charout (and
! 	 * because the text stuff doesn't like embedded NULs all that well).
  	 */
  	if (arg1 != '\0')
  	{
Index: src/backend/utils/adt/date.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/date.c,v
retrieving revision 1.91
diff -c -r1.91 date.c
*** src/backend/utils/adt/date.c	27 Aug 2003 23:29:27 -0000	1.91
--- src/backend/utils/adt/date.c	24 Sep 2003 06:06:59 -0000
***************
*** 509,515 ****
  
  /* text_date()
   * Convert text string to date.
!  * Text type is not null terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
--- 509,515 ----
  
  /* text_date()
   * Convert text string to date.
!  * Text type is not NUL terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
***************
*** 1237,1243 ****
  
  /* text_time()
   * Convert text string to time.
!  * Text type is not null terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
--- 1237,1243 ----
  
  /* text_time()
   * Convert text string to time.
!  * Text type is not NUL terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
***************
*** 2000,2006 ****
  
  /* text_timetz()
   * Convert text string to timetz.
!  * Text type is not null terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
--- 2000,2006 ----
  
  /* text_timetz()
   * Convert text string to timetz.
!  * Text type is not NUL terminated, so use temporary string
   *	then call the standard input routine.
   */
  Datum
Index: src/backend/utils/adt/datum.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/datum.c,v
retrieving revision 1.27
diff -c -r1.27 datum.c
*** src/backend/utils/adt/datum.c	4 Aug 2003 02:40:04 -0000	1.27
--- src/backend/utils/adt/datum.c	24 Sep 2003 06:06:59 -0000
***************
*** 30,36 ****
   * particular instance of the type and about its value.
   *
   * D) if a type is not "byVal" and has typlen == -2,
!  * then the "Datum" always points to a null-terminated C string.
   *
   * Note that we do not treat "toasted" datums specially; therefore what
   * will be copied or compared is the compressed data or toast reference.
--- 30,36 ----
   * particular instance of the type and about its value.
   *
   * D) if a type is not "byVal" and has typlen == -2,
!  * then the "Datum" always points to a NUL-terminated C string.
   *
   * Note that we do not treat "toasted" datums specially; therefore what
   * will be copied or compared is the compressed data or toast reference.
Index: src/backend/utils/adt/like_match.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/like_match.c,v
retrieving revision 1.7
diff -c -r1.7 like_match.c
*** src/backend/utils/adt/like_match.c	4 Aug 2003 23:59:38 -0000	1.7
--- src/backend/utils/adt/like_match.c	24 Sep 2003 06:06:59 -0000
***************
*** 50,56 ****
  **	any specified escape character (or none at all) to the internal
  **	default escape character, which is still '\'. - tgl 9/2000
  **
! ** The code is rewritten to avoid requiring null-terminated strings,
  ** which in turn allows us to leave out some memcpy() operations.
  ** This code should be faster and take less memory, but no promises...
  ** - thomas 2000-08-06
--- 50,56 ----
  **	any specified escape character (or none at all) to the internal
  **	default escape character, which is still '\'. - tgl 9/2000
  **
! ** The code is rewritten to avoid requiring NUL-terminated strings,
  ** which in turn allows us to leave out some memcpy() operations.
  ** This code should be faster and take less memory, but no promises...
  ** - thomas 2000-08-06
Index: src/backend/utils/adt/nabstime.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/nabstime.c,v
retrieving revision 1.115
diff -c -r1.115 nabstime.c
*** src/backend/utils/adt/nabstime.c	27 Aug 2003 23:29:29 -0000	1.115
--- src/backend/utils/adt/nabstime.c	24 Sep 2003 06:06:59 -0000
***************
*** 1644,1650 ****
  	if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0)
  		return 0;				/* undefined range, handled like a syntax
  								 * err. */
! 	/* search for the end of the first date and change it to a NULL */
  	p1 = p;
  	while ((c = *p1) != '\0')
  	{
--- 1644,1650 ----
  	if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0)
  		return 0;				/* undefined range, handled like a syntax
  								 * err. */
! 	/* search for the end of the first date and change it to a NUL */
  	p1 = p;
  	while ((c = *p1) != '\0')
  	{
***************
*** 1658,1664 ****
  	/* get the first date */
  	*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
  													CStringGetDatum(p)));
! 	/* rechange NULL at the end of the first date to a '"' */
  	*p1 = '"';
  	p = ++p1;
  	/* skip blanks up to '"', beginning of second date */
--- 1658,1664 ----
  	/* get the first date */
  	*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
  													CStringGetDatum(p)));
! 	/* rechange NUL at the end of the first date to a '"' */
  	*p1 = '"';
  	p = ++p1;
  	/* skip blanks up to '"', beginning of second date */
***************
*** 1672,1678 ****
  			break;
  	}
  	p++;
! 	/* search for the end of the second date and change it to a NULL */
  	p1 = p;
  	while ((c = *p1) != '\0')
  	{
--- 1672,1678 ----
  			break;
  	}
  	p++;
! 	/* search for the end of the second date and change it to a NUL */
  	p1 = p;
  	while ((c = *p1) != '\0')
  	{
***************
*** 1686,1692 ****
  	/* get the second date */
  	*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
  													CStringGetDatum(p)));
! 	/* rechange NULL at the end of the first date to a '"' */
  	*p1 = '"';
  	p = ++p1;
  	/* skip blanks up to ']' */
--- 1686,1692 ----
  	/* get the second date */
  	*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
  													CStringGetDatum(p)));
! 	/* rechange NUL at the end of the first date to a '"' */
  	*p1 = '"';
  	p = ++p1;
  	/* skip blanks up to ']' */
Index: src/backend/utils/adt/name.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/name.c,v
retrieving revision 1.49
diff -c -r1.49 name.c
*** src/backend/utils/adt/name.c	4 Aug 2003 02:40:05 -0000	1.49
--- src/backend/utils/adt/name.c	24 Sep 2003 06:06:59 -0000
***************
*** 39,46 ****
   *		namein	- converts "..." to internal representation
   *
   *		Note:
!  *				[Old] Currently if strlen(s) < NAMEDATALEN, the extra chars are nulls
!  *				Now, always NULL terminated
   */
  Datum
  namein(PG_FUNCTION_ARGS)
--- 39,46 ----
   *		namein	- converts "..." to internal representation
   *
   *		Note:
!  *				[Old] Currently if strlen(s) < NAMEDATALEN, the extra chars are NULs
!  *				Now, always NUL terminated
   */
  Datum
  namein(PG_FUNCTION_ARGS)
Index: src/backend/utils/adt/varchar.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/varchar.c,v
retrieving revision 1.102
diff -c -r1.102 varchar.c
*** src/backend/utils/adt/varchar.c	4 Aug 2003 04:03:10 -0000	1.102
--- src/backend/utils/adt/varchar.c	24 Sep 2003 06:06:59 -0000
***************
*** 37,43 ****
   * the length of the attributes and hence the exact length of the char() or
   * varchar(). We pass this to bpcharin() or varcharin().) In the case where
   * we cannot determine the length, we pass in -1 instead and the input string
!  * must be null-terminated.
   *
   * We actually implement this as a varlena so that we don't have to pass in
   * the length for the comparison functions. (The difference between these
--- 37,43 ----
   * the length of the attributes and hence the exact length of the char() or
   * varchar(). We pass this to bpcharin() or varcharin().) In the case where
   * we cannot determine the length, we pass in -1 instead and the input string
!  * must be NUL-terminated.
   *
   * We actually implement this as a varlena so that we don't have to pass in
   * the length for the comparison functions. (The difference between these
***************
*** 144,150 ****
  	char	   *result;
  	int			len;
  
! 	/* copy and add null term */
  	len = VARSIZE(s) - VARHDRSZ;
  	result = (char *) palloc(len + 1);
  	memcpy(result, VARDATA(s), len);
--- 144,150 ----
  	char	   *result;
  	int			len;
  
! 	/* copy and add NUL term */
  	len = VARSIZE(s) - VARHDRSZ;
  	result = (char *) palloc(len + 1);
  	memcpy(result, VARDATA(s), len);
***************
*** 305,311 ****
  	result = (NameData *) palloc(NAMEDATALEN);
  	memcpy(NameStr(*result), VARDATA(s), len);
  
! 	/* Now null pad to full length... */
  	while (len < NAMEDATALEN)
  	{
  		*(NameStr(*result) + len) = '\0';
--- 305,311 ----
  	result = (NameData *) palloc(NAMEDATALEN);
  	memcpy(NameStr(*result), VARDATA(s), len);
  
! 	/* Now NUL pad to full length... */
  	while (len < NAMEDATALEN)
  	{
  		*(NameStr(*result) + len) = '\0';
***************
*** 402,408 ****
  	char	   *result;
  	int32		len;
  
! 	/* copy and add null term */
  	len = VARSIZE(s) - VARHDRSZ;
  	result = palloc(len + 1);
  	memcpy(result, VARDATA(s), len);
--- 402,408 ----
  	char	   *result;
  	int32		len;
  
! 	/* copy and add NUL term */
  	len = VARSIZE(s) - VARHDRSZ;
  	result = palloc(len + 1);
  	memcpy(result, VARDATA(s), len);
Index: src/backend/utils/adt/varlena.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/varlena.c,v
retrieving revision 1.105
diff -c -r1.105 varlena.c
*** src/backend/utils/adt/varlena.c	4 Aug 2003 04:03:10 -0000	1.105
--- src/backend/utils/adt/varlena.c	24 Sep 2003 06:06:59 -0000
***************
*** 824,830 ****
  /* varstr_cmp()
   * Comparison function for text strings with given lengths.
   * Includes locale support, but must copy strings to temporary memory
!  *	to allow null-termination for inputs to strcoll().
   * Returns -1, 0 or 1
   */
  int
--- 824,830 ----
  /* varstr_cmp()
   * Comparison function for text strings with given lengths.
   * Includes locale support, but must copy strings to temporary memory
!  *	to allow NUL-termination for inputs to strcoll().
   * Returns -1, 0 or 1
   */
  int
***************
*** 1556,1562 ****
  	result = (Name) palloc(NAMEDATALEN);
  	memcpy(NameStr(*result), VARDATA(s), len);
  
! 	/* now null pad to full length... */
  	while (len < NAMEDATALEN)
  	{
  		*(NameStr(*result) + len) = '\0';
--- 1556,1562 ----
  	result = (Name) palloc(NAMEDATALEN);
  	memcpy(NameStr(*result), VARDATA(s), len);
  
! 	/* now NUL pad to full length... */
  	while (len < NAMEDATALEN)
  	{
  		*(NameStr(*result) + len) = '\0';
***************
*** 1733,1739 ****
  		else
  			return false;		/* invalid syntax */
  
! 		/* Now safe to overwrite separator with a null */
  		*endp = '\0';
  
  		/* Truncate name if it's overlength; again, should match scan.l */
--- 1733,1739 ----
  		else
  			return false;		/* invalid syntax */
  
! 		/* Now safe to overwrite separator with a NUL */
  		*endp = '\0';
  
  		/* Truncate name if it's overlength; again, should match scan.l */
Index: src/backend/utils/cache/relcache.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/cache/relcache.c,v
retrieving revision 1.188
diff -c -r1.188 relcache.c
*** src/backend/utils/cache/relcache.c	4 Aug 2003 02:40:06 -0000	1.188
--- src/backend/utils/cache/relcache.c	24 Sep 2003 06:06:59 -0000
***************
*** 1532,1538 ****
  
  	/*
  	 * make sure that the name key used for hash lookup is properly
! 	 * null-padded
  	 */
  	namestrcpy(&name, relationName);
  	RelationSysNameCacheLookup(NameStr(name), rd);
--- 1532,1538 ----
  
  	/*
  	 * make sure that the name key used for hash lookup is properly
! 	 * NUL-padded
  	 */
  	namestrcpy(&name, relationName);
  	RelationSysNameCacheLookup(NameStr(name), rd);
Index: src/backend/utils/hash/hashfn.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/hash/hashfn.c,v
retrieving revision 1.19
diff -c -r1.19 hashfn.c
*** src/backend/utils/hash/hashfn.c	19 Aug 2003 01:13:41 -0000	1.19
--- src/backend/utils/hash/hashfn.c	24 Sep 2003 06:06:59 -0000
***************
*** 20,26 ****
  
  
  /*
!  * string_hash: hash function for keys that are null-terminated strings.
   *
   * NOTE: this is the default hash function if none is specified.
   */
--- 20,26 ----
  
  
  /*
!  * string_hash: hash function for keys that are NUL-terminated strings.
   *
   * NOTE: this is the default hash function if none is specified.
   */
Index: src/backend/utils/mb/conv.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/mb/conv.c,v
retrieving revision 1.48
diff -c -r1.48 conv.c
*** src/backend/utils/mb/conv.c	4 Aug 2003 02:40:07 -0000	1.48
--- src/backend/utils/mb/conv.c	24 Sep 2003 06:06:59 -0000
***************
*** 335,341 ****
   * UTF-8 ---> local code
   *
   * utf: input UTF-8 string. Its length is limited by "len" parameter
!  *		or a null terminator.
   * iso: pointer to the output.
   * map: the conversion map.
   * size: the size of the conversion map.
--- 335,341 ----
   * UTF-8 ---> local code
   *
   * utf: input UTF-8 string. Its length is limited by "len" parameter
!  *		or a NUL terminator.
   * iso: pointer to the output.
   * map: the conversion map.
   * size: the size of the conversion map.
Index: src/backend/utils/mb/mbutils.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/mb/mbutils.c,v
retrieving revision 1.43
diff -c -r1.43 mbutils.c
*** src/backend/utils/mb/mbutils.c	4 Aug 2003 00:43:27 -0000	1.43
--- src/backend/utils/mb/mbutils.c	24 Sep 2003 06:06:59 -0000
***************
*** 331,337 ****
  				 errmsg("invalid destination encoding name \"%s\"",
  						dest_encoding_name)));
  
! 	/* make sure that source string is null terminated */
  	len = VARSIZE(string) - VARHDRSZ;
  	str = palloc(len + 1);
  	memcpy(str, VARDATA(string), len);
--- 331,337 ----
  				 errmsg("invalid destination encoding name \"%s\"",
  						dest_encoding_name)));
  
! 	/* make sure that source string is NUL terminated */
  	len = VARSIZE(string) - VARHDRSZ;
  	str = palloc(len + 1);
  	memcpy(str, VARDATA(string), len);
***************
*** 482,488 ****
  }
  
  /* returns the length (counted as a wchar) of a multibyte string
!    (not necessarily  NULL terminated) */
  int
  pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
  {
--- 482,488 ----
  }
  
  /* returns the length (counted as a wchar) of a multibyte string
!    (not necessarily NUL terminated) */
  int
  pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
  {
***************
*** 501,507 ****
  
  /*
   * returns the byte length of a multibyte string
!  * (not necessarily  NULL terminated)
   * that is no longer than limit.
   * this function does not break multibyte word boundary.
   */
--- 501,507 ----
  
  /*
   * returns the byte length of a multibyte string
!  * (not necessarily NUL terminated)
   * that is no longer than limit.
   * this function does not break multibyte word boundary.
   */
Index: src/backend/utils/mb/wchar.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/mb/wchar.c,v
retrieving revision 1.33
diff -c -r1.33 wchar.c
*** src/backend/utils/mb/wchar.c	4 Aug 2003 00:43:27 -0000	1.33
--- src/backend/utils/mb/wchar.c	24 Sep 2003 06:06:59 -0000
***************
*** 269,275 ****
   * convert UTF-8 string to pg_wchar (UCS-2)
   * caller should allocate enough space for "to"
   * len: length of from.
!  * "from" not necessarily null terminated.
   */
  static int
  pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
--- 269,275 ----
   * convert UTF-8 string to pg_wchar (UCS-2)
   * caller should allocate enough space for "to"
   * len: length of from.
!  * "from" not necessarily NUL terminated.
   */
  static int
  pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
***************
*** 337,343 ****
   * convert mule internal code to pg_wchar
   * caller should allocate enough space for "to"
   * len: length of from.
!  * "from" not necessarily null terminated.
   */
  static int
  pg_mule2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
--- 337,343 ----
   * convert mule internal code to pg_wchar
   * caller should allocate enough space for "to"
   * len: length of from.
!  * "from" not necessarily NUL terminated.
   */
  static int
  pg_mule2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
***************
*** 609,615 ****
  
  /*
   * Verify mbstr to make sure that it has a valid character sequence.
!  * mbstr is not necessarily NULL terminated; length of mbstr is
   * specified by len.
   *
   * If OK, return TRUE.	If a problem is found, return FALSE when noError is
--- 609,615 ----
  
  /*
   * Verify mbstr to make sure that it has a valid character sequence.
!  * mbstr is not necessarily NUL terminated; length of mbstr is
   * specified by len.
   *
   * If OK, return TRUE.	If a problem is found, return FALSE when noError is
Index: src/backend/utils/misc/guc-file.l
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/misc/guc-file.l,v
retrieving revision 1.18
diff -c -r1.18 guc-file.l
*** src/backend/utils/misc/guc-file.l	4 Aug 2003 23:59:39 -0000	1.18
--- src/backend/utils/misc/guc-file.l	24 Sep 2003 06:06:59 -0000
***************
*** 204,210 ****
  					/* remove the beginning and ending quote/apostrophe */
  					/* first: shift the whole thing down one character */
  					memmove(opt_value,opt_value+1,strlen(opt_value)-1);
! 					/* second: null out the 2 characters we shifted */
  					opt_value[strlen(opt_value)-2]='\0';
  					/* do the escape thing.  free()'s the strdup above */
  					opt_value=GUC_scanstr(opt_value);
--- 204,210 ----
  					/* remove the beginning and ending quote/apostrophe */
  					/* first: shift the whole thing down one character */
  					memmove(opt_value,opt_value+1,strlen(opt_value)-1);
! 					/* second: NUL out the 2 characters we shifted */
  					opt_value[strlen(opt_value)-2]='\0';
  					/* do the escape thing.  free()'s the strdup above */
  					opt_value=GUC_scanstr(opt_value);
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/misc/guc.c,v
retrieving revision 1.158
diff -c -r1.158 guc.c
*** src/backend/utils/misc/guc.c	15 Sep 2003 22:28:58 -0000	1.158
--- src/backend/utils/misc/guc.c	24 Sep 2003 06:09:59 -0000
***************
*** 299,305 ****
  	gettext_noop("Version & Platform Compatibility / Other Platforms & Clients"),
  	/* DEVELOPER_OPTIONS */
  	gettext_noop("Developer Options"),
! 	/* help_config wants this array to be null-terminated */
  	NULL
  };
  
--- 299,305 ----
  	gettext_noop("Version & Platform Compatibility / Other Platforms & Clients"),
  	/* DEVELOPER_OPTIONS */
  	gettext_noop("Developer Options"),
! 	/* help_config wants this array to be NULL terminated */
  	NULL
  };
  
***************
*** 3728,3735 ****
   *	This routine dumps out all non-default GUC options into a binary
   *	file that is read by all exec'ed backends.  The format is:
   *
!  *		variable name, string, null terminated
!  *		variable value, string, null terminated
   *		variable source, integer
   */
  void
--- 3728,3735 ----
   *	This routine dumps out all non-default GUC options into a binary
   *	file that is read by all exec'ed backends.  The format is:
   *
!  *		variable name, string, NUL-terminated
!  *		variable value, string, NUL-terminated
   *		variable source, integer
   */
  void
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.77
diff -c -r1.77 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	23 Sep 2003 23:31:52 -0000	1.77
--- src/bin/pg_dump/pg_backup_archiver.c	24 Sep 2003 06:07:47 -0000
***************
*** 1006,1012 ****
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing null
  	 */
  
  	/*
--- 1006,1012 ----
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing NUL
  	 */
  
  	/*
***************
*** 1125,1131 ****
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing null
  	 */
  
  	/*
--- 1125,1131 ----
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing NUL
  	 */
  
  	/*
Index: src/bin/pg_dump/pg_backup_tar.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_backup_tar.c,v
retrieving revision 1.37
diff -c -r1.37 pg_backup_tar.c
*** src/bin/pg_dump/pg_backup_tar.c	4 Aug 2003 00:43:27 -0000	1.37
--- src/bin/pg_dump/pg_backup_tar.c	24 Sep 2003 06:06:59 -0000
***************
*** 822,828 ****
  
  		tarClose(AH, th);
  
! 		/* Add a block of NULLs since it's de-rigeur. */
  		for (i = 0; i < 512; i++)
  		{
  			if (fputc(0, ctx->tarFH) == EOF)
--- 822,828 ----
  
  		tarClose(AH, th);
  
! 		/* Add a block of NULs since it's de-rigeur. */
  		for (i = 0; i < 512; i++)
  		{
  			if (fputc(0, ctx->tarFH) == EOF)
***************
*** 944,950 ****
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing null
  	 */
  
  	/*
--- 944,950 ----
  
  	/*
  	 * This is paranoid: deal with the possibility that vsnprintf is
! 	 * willing to ignore trailing NUL
  	 */
  
  	/*
Index: src/bin/psql/stringutils.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/psql/stringutils.c,v
retrieving revision 1.34
diff -c -r1.34 stringutils.c
*** src/bin/psql/stringutils.c	4 Aug 2003 23:59:40 -0000	1.34
--- src/bin/psql/stringutils.c	24 Sep 2003 06:06:59 -0000
***************
*** 73,79 ****
  		free(storage);
  
  		/*
! 		 * We may need extra space to insert delimiter nulls for adjacent
  		 * tokens.	2X the space is a gross overestimate, but it's
  		 * unlikely that this code will be used on huge strings anyway.
  		 */
--- 73,79 ----
  		free(storage);
  
  		/*
! 		 * We may need extra space to insert delimiter NULs for adjacent
  		 * tokens.	2X the space is a gross overestimate, but it's
  		 * unlikely that this code will be used on huge strings anyway.
  		 */
***************
*** 105,111 ****
  	if (delim && strchr(delim, *start))
  	{
  		/*
! 		 * If not at end of string, we need to insert a null to terminate
  		 * the returned token.	We can just overwrite the next character
  		 * if it happens to be in the whitespace set ... otherwise move
  		 * over the rest of the string to make room.  (This is why we
--- 105,111 ----
  	if (delim && strchr(delim, *start))
  	{
  		/*
! 		 * If not at end of string, we need to insert a NUL to terminate
  		 * the returned token.	We can just overwrite the next character
  		 * if it happens to be in the whitespace set ... otherwise move
  		 * over the rest of the string to make room.  (This is why we
***************
*** 148,154 ****
  		}
  
  		/*
! 		 * If not at end of string, we need to insert a null to terminate
  		 * the returned token.	See notes above.
  		 */
  		if (*p != '\0')
--- 148,154 ----
  		}
  
  		/*
! 		 * If not at end of string, we need to insert a NUL to terminate
  		 * the returned token.	See notes above.
  		 */
  		if (*p != '\0')
***************
*** 198,204 ****
  	p = start + offset;
  
  	/*
! 	 * If not at end of string, we need to insert a null to terminate the
  	 * returned token.	See notes above.
  	 */
  	if (*p != '\0')
--- 198,204 ----
  	p = start + offset;
  
  	/*
! 	 * If not at end of string, we need to insert a NUL to terminate the
  	 * returned token.	See notes above.
  	 */
  	if (*p != '\0')
Index: src/bin/psql/variables.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/psql/variables.h,v
retrieving revision 1.14
diff -c -r1.14 variables.h
*** src/bin/psql/variables.h	4 Aug 2003 23:59:40 -0000	1.14
--- src/bin/psql/variables.h	24 Sep 2003 06:06:59 -0000
***************
*** 44,50 ****
  			   bool allowtrail);
  
  
! /* Find value of variable <name> among NULL-terminated list of alternative
   * options.  Returns VAR_NOTSET if the variable was not set, VAR_NOTFOUND
   * if its value did not occur in the list of options, or the number of the
   * matching option.  The first option is 1, the second is 2 and so on.
--- 44,50 ----
  			   bool allowtrail);
  
  
! /* Find value of variable <name> among NUL-terminated list of alternative
   * options.  Returns VAR_NOTSET if the variable was not set, VAR_NOTFOUND
   * if its value did not occur in the list of options, or the number of the
   * matching option.  The first option is 1, the second is 2 and so on.
Index: src/include/c.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/include/c.h,v
retrieving revision 1.153
diff -c -r1.153 c.h
*** src/include/c.h	21 Sep 2003 17:57:21 -0000	1.153
--- src/include/c.h	24 Sep 2003 06:06:59 -0000
***************
*** 422,428 ****
  
  /*
   * These widely-used datatypes are just a varlena header and the data bytes.
!  * There is no terminating null or anything like that --- the data length is
   * always VARSIZE(ptr) - VARHDRSZ.
   */
  typedef struct varlena bytea;
--- 422,428 ----
  
  /*
   * These widely-used datatypes are just a varlena header and the data bytes.
!  * There is no terminating NUL or anything like that --- the data length is
   * always VARSIZE(ptr) - VARHDRSZ.
   */
  typedef struct varlena bytea;
***************
*** 559,571 ****
  /*
   * StrNCpy
   *	Like standard library function strncpy(), except that result string
!  *	is guaranteed to be null-terminated --- that is, at most N-1 bytes
   *	of the source string will be kept.
   *	Also, the macro returns no result (too hard to do that without
   *	evaluating the arguments multiple times, which seems worse).
   *
!  *	BTW: when you need to copy a non-null-terminated string (like a text
!  *	datum) and add a null, do not do it with StrNCpy(..., len+1).  That
   *	might seem to work, but it fetches one byte more than there is in the
   *	text object.  One fine day you'll have a SIGSEGV because there isn't
   *	another byte before the end of memory.	Don't laugh, we've had real
--- 559,571 ----
  /*
   * StrNCpy
   *	Like standard library function strncpy(), except that result string
!  *	is guaranteed to be NUL-terminated --- that is, at most N-1 bytes
   *	of the source string will be kept.
   *	Also, the macro returns no result (too hard to do that without
   *	evaluating the arguments multiple times, which seems worse).
   *
!  *	BTW: when you need to copy a non-NUL-terminated string (like a text
!  *	datum) and add a NUL, do not do it with StrNCpy(..., len+1).  That
   *	might seem to work, but it fetches one byte more than there is in the
   *	text object.  One fine day you'll have a SIGSEGV because there isn't
   *	another byte before the end of memory.	Don't laugh, we've had real
Index: src/include/miscadmin.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/include/miscadmin.h,v
retrieving revision 1.133
diff -c -r1.133 miscadmin.h
*** src/include/miscadmin.h	26 Aug 2003 15:38:25 -0000	1.133
--- src/include/miscadmin.h	24 Sep 2003 06:06:59 -0000
***************
*** 180,186 ****
  extern bool HasCTZSet;
  extern int	CTimeZone;
  
! #define MAXTZLEN		10		/* max TZ name len, not counting tr. null */
  
  extern bool enableFsync;
  extern bool allowSystemTableMods;
--- 180,186 ----
  extern bool HasCTZSet;
  extern int	CTimeZone;
  
! #define MAXTZLEN		10		/* max TZ name len, not counting trailing NUL */
  
  extern bool enableFsync;
  extern bool allowSystemTableMods;
Index: src/include/postgres.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/include/postgres.h,v
retrieving revision 1.65
diff -c -r1.65 postgres.h
*** src/include/postgres.h	4 Aug 2003 02:40:10 -0000	1.65
--- src/include/postgres.h	24 Sep 2003 06:06:59 -0000
***************
*** 308,314 ****
  
  /*
   * DatumGetCString
!  *		Returns C string (null-terminated string) value of a datum.
   *
   * Note: C string is not a full-fledged Postgres type at present,
   * but type input functions use this conversion for their inputs.
--- 308,314 ----
  
  /*
   * DatumGetCString
!  *		Returns C string (NUL-terminated string) value of a datum.
   *
   * Note: C string is not a full-fledged Postgres type at present,
   * but type input functions use this conversion for their inputs.
***************
*** 318,324 ****
  
  /*
   * CStringGetDatum
!  *		Returns datum representation for a C string (null-terminated string).
   *
   * Note: C string is not a full-fledged Postgres type at present,
   * but type output functions use this conversion for their outputs.
--- 318,324 ----
  
  /*
   * CStringGetDatum
!  *		Returns datum representation for a C string (NUL-terminated string).
   *
   * Note: C string is not a full-fledged Postgres type at present,
   * but type output functions use this conversion for their outputs.
Index: src/include/lib/stringinfo.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/include/lib/stringinfo.h,v
retrieving revision 1.28
diff -c -r1.28 stringinfo.h
*** src/include/lib/stringinfo.h	4 Aug 2003 02:40:13 -0000	1.28
--- src/include/lib/stringinfo.h	24 Sep 2003 06:06:59 -0000
***************
*** 4,10 ****
   *	  Declarations/definitions for "StringInfo" functions.
   *
   * StringInfo provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (null-terminated text)
   * or arbitrary binary data.  All storage is allocated with palloc().
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
--- 4,10 ----
   *	  Declarations/definitions for "StringInfo" functions.
   *
   * StringInfo provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (NUL-terminated text)
   * or arbitrary binary data.  All storage is allocated with palloc().
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
***************
*** 102,108 ****
  
  /*------------------------
   * appendStringInfoString
!  * Append a null-terminated string to str.
   * Like appendStringInfo(str, "%s", s) but faster.
   */
  extern void appendStringInfoString(StringInfo str, const char *s);
--- 102,108 ----
  
  /*------------------------
   * appendStringInfoString
!  * Append a NUL-terminated string to str.
   * Like appendStringInfo(str, "%s", s) but faster.
   */
  extern void appendStringInfoString(StringInfo str, const char *s);
Index: src/interfaces/ecpg/pgtypeslib/dt.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/ecpg/pgtypeslib/dt.h,v
retrieving revision 1.13
diff -c -r1.13 dt.h
*** src/interfaces/ecpg/pgtypeslib/dt.h	9 Sep 2003 10:46:38 -0000	1.13
--- src/interfaces/ecpg/pgtypeslib/dt.h	24 Sep 2003 06:06:59 -0000
***************
*** 166,172 ****
  #define DTK_TIME_M		(DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
  
  #define MAXDATELEN		51		/* maximum possible length of an input
! 								 * date string (not counting tr. null) */
  #define MAXDATEFIELDS	25		/* maximum possible number of fields in a
  								 * date string */
  #define TOKMAXLEN		10		/* only this many chars are stored in
--- 166,172 ----
  #define DTK_TIME_M		(DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
  
  #define MAXDATELEN		51		/* maximum possible length of an input
! 								 * date string (not counting trailing NUL) */
  #define MAXDATEFIELDS	25		/* maximum possible number of fields in a
  								 * date string */
  #define TOKMAXLEN		10		/* only this many chars are stored in
Index: src/interfaces/ecpg/preproc/pgc.l
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/ecpg/preproc/pgc.l,v
retrieving revision 1.120
diff -c -r1.120 pgc.l
*** src/interfaces/ecpg/preproc/pgc.l	4 Aug 2003 02:40:15 -0000	1.120
--- src/interfaces/ecpg/preproc/pgc.l	24 Sep 2003 06:06:59 -0000
***************
*** 1009,1015 ****
  		while ((literallen+yleng) >= literalalloc);
  		literalbuf = (char *) realloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing null */
  	memcpy(literalbuf+literallen, ytext, yleng);
  	literallen += yleng;
  	literalbuf[literallen] = '\0';
--- 1009,1015 ----
  		while ((literallen+yleng) >= literalalloc);
  		literalbuf = (char *) realloc(literalbuf, literalalloc);
  	}
! 	/* append new data, add trailing NUL */
  	memcpy(literalbuf+literallen, ytext, yleng);
  	literallen += yleng;
  	literalbuf[literallen] = '\0';
***************
*** 1024,1030 ****
                  literalalloc *= 2;
                  literalbuf = (char *) realloc(literalbuf, literalalloc);
          }
! 	/* append new data, add trailing null */
  	literalbuf[literallen] = ychar;
  	literallen += 1;
  	literalbuf[literallen] = '\0';
--- 1024,1030 ----
                  literalalloc *= 2;
                  literalbuf = (char *) realloc(literalbuf, literalalloc);
          }
! 	/* append new data, add trailing NUL */
  	literalbuf[literallen] = ychar;
  	literallen += 1;
  	literalbuf[literallen] = '\0';
Index: src/interfaces/libpq/fe-exec.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/fe-exec.c,v
retrieving revision 1.148
diff -c -r1.148 fe-exec.c
*** src/interfaces/libpq/fe-exec.c	22 Sep 2003 00:23:35 -0000	1.148
--- src/interfaces/libpq/fe-exec.c	24 Sep 2003 06:06:59 -0000
***************
*** 1484,1490 ****
   * PQgetline - gets a newline-terminated string from the backend.
   *
   * Chiefly here so that applications can use "COPY <rel> to stdout"
!  * and read the output string.	Returns a null-terminated string in s.
   *
   * XXX this routine is now deprecated, because it can't handle binary data.
   * If called during a COPY BINARY we return EOF.
--- 1484,1490 ----
   * PQgetline - gets a newline-terminated string from the backend.
   *
   * Chiefly here so that applications can use "COPY <rel> to stdout"
!  * and read the output string.	Returns a NUL-terminated string in s.
   *
   * XXX this routine is now deprecated, because it can't handle binary data.
   * If called during a COPY BINARY we return EOF.
***************
*** 1550,1556 ****
   * data row will be returned.  In text mode this can be detected by testing
   * whether the last returned byte is '\n' or not.
   *
!  * The returned data is *not* null-terminated.
   */
  
  int
--- 1550,1556 ----
   * data row will be returned.  In text mode this can be detected by testing
   * whether the last returned byte is '\n' or not.
   *
!  * The returned data is *not* NUL-terminated.
   */
  
  int
***************
*** 1580,1586 ****
  }
  
  /*
!  * PQputnbytes -- like PQputline, but buffer need not be null-terminated.
   * Returns 0 if OK, EOF if not.
   */
  int
--- 1580,1586 ----
  }
  
  /*
!  * PQputnbytes -- like PQputline, but buffer need not be NUL-terminated.
   * Returns 0 if OK, EOF if not.
   */
  int
***************
*** 2270,2276 ****
  #define VAL(CH) ((CH) - '0')
  
  /*
!  *		PQunescapeBytea - converts the null terminated string representation
   *		of a bytea, strtext, into binary, filling a buffer. It returns a
   *		pointer to the buffer which is NULL on error, and the size of the
   *		buffer in retbuflen. The pointer may subsequently be used as an
--- 2270,2276 ----
  #define VAL(CH) ((CH) - '0')
  
  /*
!  *		PQunescapeBytea - converts the NUL terminated string representation
   *		of a bytea, strtext, into binary, filling a buffer. It returns a
   *		pointer to the buffer which is NULL on error, and the size of the
   *		buffer in retbuflen. The pointer may subsequently be used as an
***************
*** 2298,2304 ****
  		return NULL;
  
  	strtextlen = strlen(strtext);		/* will shrink, also we discover
! 										 * if strtext isn't NULL
  										 * terminated */
  	buffer = (unsigned char *) malloc(strtextlen);
  	if (buffer == NULL)
--- 2298,2304 ----
  		return NULL;
  
  	strtextlen = strlen(strtext);		/* will shrink, also we discover
! 										 * if strtext isn't NUL
  										 * terminated */
  	buffer = (unsigned char *) malloc(strtextlen);
  	if (buffer == NULL)
Index: src/interfaces/libpq/fe-misc.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/fe-misc.c,v
retrieving revision 1.102
diff -c -r1.102 fe-misc.c
*** src/interfaces/libpq/fe-misc.c	8 Aug 2003 21:42:55 -0000	1.102
--- src/interfaces/libpq/fe-misc.c	24 Sep 2003 06:06:59 -0000
***************
*** 109,115 ****
  
  /*
   * pqGets:
!  * get a null-terminated string from the connection,
   * and store it in an expansible PQExpBuffer.
   * If we run out of memory, all of the string is still read,
   * but the excess characters are silently discarded.
--- 109,115 ----
  
  /*
   * pqGets:
!  * get a NUL-terminated string from the connection,
   * and store it in an expansible PQExpBuffer.
   * If we run out of memory, all of the string is still read,
   * but the excess characters are silently discarded.
***************
*** 145,151 ****
  
  
  /*
!  * pqPuts: write a null-terminated string to the current message
   */
  int
  pqPuts(const char *s, PGconn *conn)
--- 145,151 ----
  
  
  /*
!  * pqPuts: write a NUL-terminated string to the current message
   */
  int
  pqPuts(const char *s, PGconn *conn)
***************
*** 161,167 ****
  
  /*
   * pqGetnchar:
!  *	get a string of exactly len bytes in buffer s, no null termination
   */
  int
  pqGetnchar(char *s, size_t len, PGconn *conn)
--- 161,167 ----
  
  /*
   * pqGetnchar:
!  *	get a string of exactly len bytes in buffer s, no NUL termination
   */
  int
  pqGetnchar(char *s, size_t len, PGconn *conn)
***************
*** 170,176 ****
  		return EOF;
  
  	memcpy(s, conn->inBuffer + conn->inCursor, len);
! 	/* no terminating null */
  
  	conn->inCursor += len;
  
--- 170,176 ----
  		return EOF;
  
  	memcpy(s, conn->inBuffer + conn->inCursor, len);
! 	/* no terminating NUL */
  
  	conn->inCursor += len;
  
Index: src/interfaces/libpq/fe-protocol3.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/fe-protocol3.c,v
retrieving revision 1.9
diff -c -r1.9 fe-protocol3.c
*** src/interfaces/libpq/fe-protocol3.c	27 Aug 2003 00:33:34 -0000	1.9
--- src/interfaces/libpq/fe-protocol3.c	24 Sep 2003 06:06:59 -0000
***************
*** 923,929 ****
  				return -2;
  			}
  			memcpy(*buffer, &conn->inBuffer[conn->inCursor], msgLength);
! 			(*buffer)[msgLength] = '\0';		/* Add terminating null */
  
  			/* Mark message consumed */
  			conn->inStart = conn->inCursor + msgLength;
--- 923,929 ----
  				return -2;
  			}
  			memcpy(*buffer, &conn->inBuffer[conn->inCursor], msgLength);
! 			(*buffer)[msgLength] = '\0';		/* Add terminating NUL */
  
  			/* Mark message consumed */
  			conn->inStart = conn->inCursor + msgLength;
***************
*** 984,990 ****
  		return 0;
  	}
  
! 	/* Add null terminator, and strip trailing \n if present */
  	if (s[status - 1] == '\n')
  	{
  		s[status - 1] = '\0';
--- 984,990 ----
  		return 0;
  	}
  
! 	/* Add NUL terminator, and strip trailing \n if present */
  	if (s[status - 1] == '\n')
  	{
  		s[status - 1] = '\0';
Index: src/interfaces/libpq/libpq-fe.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/libpq-fe.h,v
retrieving revision 1.100
diff -c -r1.100 libpq-fe.h
*** src/interfaces/libpq/libpq-fe.h	27 Aug 2003 00:33:34 -0000	1.100
--- src/interfaces/libpq/libpq-fe.h	24 Sep 2003 06:06:59 -0000
***************
*** 148,154 ****
  	char	   *fieldSep;		/* field separator */
  	char	   *tableOpt;		/* insert to HTML <table ...> */
  	char	   *caption;		/* HTML <caption> */
! 	char	  **fieldName;		/* null terminated array of repalcement
  								 * field names */
  } PQprintOpt;
  
--- 148,154 ----
  	char	   *fieldSep;		/* field separator */
  	char	   *tableOpt;		/* insert to HTML <table ...> */
  	char	   *caption;		/* HTML <caption> */
! 	char	  **fieldName;		/* NUL terminated array of replacement
  								 * field names */
  } PQprintOpt;
  
Index: src/interfaces/libpq/libpq-int.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/libpq-int.h,v
retrieving revision 1.82
diff -c -r1.82 libpq-int.h
*** src/interfaces/libpq/libpq-int.h	5 Sep 2003 02:08:36 -0000	1.82
--- src/interfaces/libpq/libpq-int.h	24 Sep 2003 06:06:59 -0000
***************
*** 92,102 ****
   *
   * We use char* for Attribute values.
   *
!  * The value pointer always points to a null-terminated area; we add a
!  * null (zero) byte after whatever the backend sends us.  This is only
   * particularly useful for text values ... with a binary value, the
!  * value might have embedded nulls, so the application can't use C string
!  * operators on it.  But we add a null anyway for consistency.
   * Note that the value itself does not contain a length word.
   *
   * A NULL attribute is a special case in two ways: its len field is NULL_LEN
--- 92,102 ----
   *
   * We use char* for Attribute values.
   *
!  * The value pointer always points to a NUL-terminated area; we add a
!  * NUL (zero) byte after whatever the backend sends us.  This is only
   * particularly useful for text values ... with a binary value, the
!  * value might have embedded NULs, so the application can't use C string
!  * operators on it.  But we add a NUL anyway for consistency.
   * Note that the value itself does not contain a length word.
   *
   * A NULL attribute is a special case in two ways: its len field is NULL_LEN
Index: src/interfaces/libpq/pqexpbuffer.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/pqexpbuffer.c,v
retrieving revision 1.15
diff -c -r1.15 pqexpbuffer.c
*** src/interfaces/libpq/pqexpbuffer.c	4 Aug 2003 02:40:20 -0000	1.15
--- src/interfaces/libpq/pqexpbuffer.c	24 Sep 2003 06:06:59 -0000
***************
*** 3,9 ****
   * pqexpbuffer.c
   *
   * PQExpBuffer provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (null-terminated text)
   * or arbitrary binary data.  All storage is allocated with malloc().
   *
   * This module is essentially the same as the backend's StringInfo data type,
--- 3,9 ----
   * pqexpbuffer.c
   *
   * PQExpBuffer provides an indefinitely-extensible string data type.
!  * It can be used to buffer either ordinary C strings (NUL-terminated text)
   * or arbitrary binary data.  All storage is allocated with malloc().
   *
   * This module is essentially the same as the backend's StringInfo data type,
***************
*** 122,128 ****
  /*
   * enlargePQExpBuffer
   * Make sure there is enough space for 'needed' more bytes in the buffer
!  * ('needed' does not include the terminating null).
   *
   * Returns 1 if OK, 0 if failed to enlarge buffer.
   */
--- 122,128 ----
  /*
   * enlargePQExpBuffer
   * Make sure there is enough space for 'needed' more bytes in the buffer
!  * ('needed' does not include the terminating NUL).
   *
   * Returns 1 if OK, 0 if failed to enlarge buffer.
   */
***************
*** 194,200 ****
  			 */
  			if (nprinted >= 0 && nprinted < (int) avail - 1)
  			{
! 				/* Success.  Note nprinted does not include trailing null. */
  				str->len += nprinted;
  				break;
  			}
--- 194,200 ----
  			 */
  			if (nprinted >= 0 && nprinted < (int) avail - 1)
  			{
! 				/* Success.  Note nprinted does not include trailing NUL. */
  				str->len += nprinted;
  				break;
  			}
***************
*** 242,248 ****
  			 */
  			if (nprinted >= 0 && nprinted < (int) avail - 1)
  			{
! 				/* Success.  Note nprinted does not include trailing null. */
  				str->len += nprinted;
  				break;
  			}
--- 242,248 ----
  			 */
  			if (nprinted >= 0 && nprinted < (int) avail - 1)
  			{
! 				/* Success.  Note nprinted does not include trailing NUL. */
  				str->len += nprinted;
  				break;
  			}
***************
*** 300,306 ****
  	str->len += datalen;
  
  	/*
! 	 * Keep a trailing null in place, even though it's probably useless
  	 * for binary data...
  	 */
  	str->data[str->len] = '\0';
--- 300,306 ----
  	str->len += datalen;
  
  	/*
! 	 * Keep a trailing NUL in place, even though it's probably useless
  	 * for binary data...
  	 */
  	str->data[str->len] = '\0';
Index: src/port/strdup.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/port/strdup.c,v
retrieving revision 1.2
diff -c -r1.2 strdup.c
*** src/port/strdup.c	4 Aug 2003 02:40:20 -0000	1.2
--- src/port/strdup.c	24 Sep 2003 06:06:59 -0000
***************
*** 1,7 ****
  /*-------------------------------------------------------------------------
   *
   * strdup.c
!  *	  copies a null-terminated string.
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
--- 1,7 ----
  /*-------------------------------------------------------------------------
   *
   * strdup.c
!  *	  copies a NUL-terminated string.
   *
   * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
