1--- postgresql-9.0.3/contrib/intarray/_int_bool.c      2011-01-27 18:21:31.000000000 -0800 
2+++ postgresql/contrib/intarray/_int_bool.c    2011-04-03 09:38:09.000000000 -0700 
3@@ -56,6 +56,8 @@
4 	int4		num;
5 } WORKSTATE;
6 
7+#define STACKDEPTH      16
8+
9 /*
10  * get token from query string
11  */
12@@ -90,7 +92,10 @@
13 				}
14 				else if (*(state->buf) == '(')
15 				{
16-					state->count++;
17+					if (state->count++ > STACKDEPTH)
18+						ereport(ERROR,
19+							(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
20+							errmsg("statement too complex")));
21 					(state->buf)++;
22 					return OPEN;
23 				}
24@@ -160,8 +165,6 @@
25 	state->num++;
26 }
27 
28-#define STACKDEPTH	16
29-
30 /*
31  * make polish notation of query
32  */
33
34