This patch removes the TCL_ARRAY symbol.  This seems to be a leftover
from when pgtcl was around in the backend; if enabled, it causes
array_out to emit bogus array values:

alvherre=# create table bar ( a text);
CREATE TABLE
alvherre=# insert into bar values ('foo"');
INSERT 0 1
alvherre=# select array_append('{}', a) from bar;
 array_append 
--------------
 {"foo""}
(1 ligne)

The correct value is

alvherre=# select array_append('{}', a) from bar;
 array_append 
--------------
 {"foo\""}
(1 ligne)


Of course, the system does not accept the TCL_ARRAY value back.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: src/backend/utils/adt/arrayfuncs.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/adt/arrayfuncs.c,v
retrieving revision 1.140
diff -c -p -r1.140 arrayfuncs.c
*** src/backend/utils/adt/arrayfuncs.c	1 Jan 2008 19:45:52 -0000	1.140
--- src/backend/utils/adt/arrayfuncs.c	29 Feb 2008 14:30:28 -0000
*************** array_out(PG_FUNCTION_ARGS)
*** 1030,1038 ****
  				if (ch == '"' || ch == '\\')
  				{
  					needquote = true;
- #ifndef TCL_ARRAYS
  					overall_length += 1;
- #endif
  				}
  				else if (ch == '{' || ch == '}' || ch == typdelim ||
  						 isspace((unsigned char) ch))
--- 1030,1036 ----
*************** array_out(PG_FUNCTION_ARGS)
*** 1103,1109 ****
  		if (needquotes[k])
  		{
  			APPENDCHAR('"');
- #ifndef TCL_ARRAYS
  			for (tmp = values[k]; *tmp; tmp++)
  			{
  				char		ch = *tmp;
--- 1101,1106 ----
*************** array_out(PG_FUNCTION_ARGS)
*** 1113,1121 ****
  				*p++ = ch;
  			}
  			*p = '\0';
- #else
- 			APPENDSTR(values[k]);
- #endif
  			APPENDCHAR('"');
  		}
  		else
--- 1110,1115 ----
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to