diff --git a/src/backend/Makefile b/src/backend/Makefile
index 87e4b75c1d89be6c764f942ab747934348a2b3d8..0ec08e55365e40bb040a13fb33d101b6f305e703 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -34,7 +34,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.35 1999/01/17 06:18:11 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.36 1999/01/21 16:08:36 vadim Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -111,9 +111,6 @@ catalog/global1.description catalog/local1_template1.description:
 postgres.o: $(OBJS)
 	$(CC) -r -o postgres.o $(OBJS) $(LDFLAGS)
 
-fast:
-	$(CC) -r -o postgres.o $(OBJS) $(LDFLAGS)
-
 ############################################################################
 # The following targets are specified in make commands that appear in the
 # make files in our subdirectories.
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 5577bbb290c234c4d9510f93a88c1ec0ef918e14..aa9c01ed082b4b7a6bd00dec1786d429f0b86ea5 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *  $Id: outfuncs.c,v 1.59 1999/01/18 00:09:45 momjian Exp $
+ *  $Id: outfuncs.c,v 1.60 1999/01/21 16:08:36 vadim Exp $
  *
  * NOTES
  *	  Every (plan) node in POSTGRES has an associated "out" routine which
@@ -162,6 +162,7 @@ _outIndexElem(StringInfo str, IndexElem *node)
 static void
 _outQuery(StringInfo str, Query *node)
 {
+
 	appendStringInfo(str, " QUERY :command %d ", node->commandType);
 
 	if (node->utilityStmt)
@@ -235,6 +236,10 @@ _outQuery(StringInfo str, Query *node)
 
 	appendStringInfo(str, " :limitCount ");
 	_outNode(str, node->limitCount);
+
+	appendStringInfo(str, " :rowMark ");
+	_outNode(str, node->rowMark);
+
 }
 
 static void
@@ -907,6 +912,12 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
 			node->skipAcl ? "true" : "false");
 }
 
+static void
+_outRowMark(StringInfo str, RowMark *node)
+{
+	appendStringInfo(str, " ROWMARK :rti %u :info %u", node->rti, node->info);
+}
+
 /*
  *	Path is a subclass of Node.
  */
@@ -1528,6 +1539,9 @@ _outNode(StringInfo str, void *obj)
 			case T_RangeTblEntry:
 				_outRangeTblEntry(str, obj);
 				break;
+			case T_RowMark:
+				_outRowMark(str, obj);
+				break;
 			case T_Path:
 				_outPath(str, obj);
 				break;
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index edcfdd9d261b2eebe654992b5ad13651c494a87e..6a4237def2f432fe619fe43c042fefe402f79d56 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.41 1999/01/18 00:09:46 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.42 1999/01/21 16:08:37 vadim Exp $
  *
  * NOTES
  *	  Most of the read functions for plan nodes are tested. (In fact, they
@@ -174,6 +174,9 @@ _readQuery()
 	token = lsptok(NULL, &length);		/* skip :limitCount */
 	local_node->limitCount = nodeRead(true);
 
+	token = lsptok(NULL, &length);		/* skip :rowMark */
+	local_node->rowMark = nodeRead(true);
+
 	return local_node;
 }
 
@@ -1427,6 +1430,24 @@ _readRangeTblEntry()
 	return local_node;
 }
 
+static RowMark *
+_readRowMark()
+{
+	RowMark	   *local_node = makeNode(RowMark);
+	char	   *token;
+	int			length;
+
+	token = lsptok(NULL, &length);		/* eat :rti */
+	token = lsptok(NULL, &length);		/* get :rti */
+	local_node->rti = strtoul(token, NULL, 10);
+
+	token = lsptok(NULL, &length);		/* eat :info */
+	token = lsptok(NULL, &length);		/* get :info */
+	local_node->info = strtoul(token, NULL, 10);
+
+	return local_node;
+}
+
 /* ----------------
  *		_readPath
  *
@@ -2090,6 +2111,8 @@ parsePlanString(void)
 		return_value = _readCaseExpr();
 	else if (!strncmp(token, "WHEN", length))
 		return_value = _readCaseWhen();
+	else if (!strncmp(token, "ROWMARK", length))
+		return_value = _readRowMark();
 	else
 		elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token);
 
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index ea9cb5fa8c2df9dee969a7519efe334a32eefa23..af94800d2ed8c39057ba0bf0e56ed48ca3c0fbdb 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *  $Id: analyze.c,v 1.92 1999/01/18 00:09:49 momjian Exp $
+ *  $Id: analyze.c,v 1.93 1999/01/21 16:08:38 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,6 +45,8 @@ static Query *transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt);
 static Query *transformCursorStmt(ParseState *pstate, SelectStmt *stmt);
 static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt);
 
+static void   transformForUpdate(Query *qry, List *forUpdate);
+
 List	   *extras_before = NIL;
 List	   *extras_after = NIL;
 
@@ -387,7 +389,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	/*
 	 * The INSERT INTO ... SELECT ... could have a UNION in child, so
 	 * unionClause may be false
-	 */
+,	 */
   	qry->unionall = stmt->unionall;	
 
  	/***S*I***/
@@ -408,6 +410,9 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 		return (Query *) NIL;
 	}
 
+	if (stmt->forUpdate != NULL)
+		transformForUpdate(qry, stmt->forUpdate);
+
 	return (Query *) qry;
 }
 
@@ -971,6 +976,9 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
 		return (Query *) NIL;
 	}
 
+	if (stmt->forUpdate != NULL)
+		transformForUpdate(qry, stmt->forUpdate);
+
 	return (Query *) qry;
 }
 
@@ -1121,3 +1129,59 @@ Node *A_Expr_to_Expr(Node *ptr, bool *intersect_present)
     }
   return result;  
 }
+
+static void
+transformForUpdate(Query *qry, List *forUpdate)
+{
+	List	   *rowMark = NULL;
+	RowMark	   *newrm;
+	List	   *l;
+	Index		i;
+
+	if (lfirst(forUpdate) == NULL)		/* all tables */
+	{
+		i = 1;
+		foreach (l, qry->rtable)
+		{
+			newrm = makeNode(RowMark);
+			newrm->rti = i++;
+			newrm->info = ROW_MARK_FOR_UPDATE|ROW_ACL_FOR_UPDATE;
+			rowMark = lappend(rowMark, newrm);
+		}
+		qry->rowMark = nconc(qry->rowMark, rowMark);
+		return;
+	}
+
+	foreach (l, forUpdate)
+	{
+		List   *l2;
+		List   *l3;
+
+		i = 1;
+		foreach (l2, qry->rtable)
+		{
+			if (strcmp(((RangeTblEntry*)lfirst(l2))->refname, lfirst(l)) == 0)
+			{
+				foreach (l3, rowMark)
+				{
+					if (((RowMark*)lfirst(l3))->rti == i)	/* duplicate */
+						break;
+				}
+				if (l3 == NULL)
+				{
+					newrm = makeNode(RowMark);
+					newrm->rti = i;
+					newrm->info = ROW_MARK_FOR_UPDATE|ROW_ACL_FOR_UPDATE;
+					rowMark = lappend(rowMark, newrm);
+				}
+				break;
+			}
+			i++;
+		}
+		if (l2 == NULL)
+			elog(ERROR, "FOR UPDATE: relation %s not found in FROM clause", lfirst(l));
+	}
+
+	qry->rowMark = rowMark;
+	return;
+}
diff --git a/src/backend/parser/gram.c b/src/backend/parser/gram.c
index 15b4c690502f739619247ff4dbf1ba76d07feaf3..687d2cdc23a3b37ed4b2844a093171f27c117ab2 100644
--- a/src/backend/parser/gram.c
+++ b/src/backend/parser/gram.c
@@ -239,7 +239,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.58 1999/01/20 22:31:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.59 1999/01/21 16:08:39 vadim Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -864,58 +864,58 @@ static const short yyrline[] = { 0,
   2300,  2301,  2304,  2305,  2308,  2309,  2310,  2313,  2314,  2315,
   2325,  2341,  2358,  2367,  2380,  2381,  2384,  2385,  2388,  2389,
   2392,  2394,  2406,  2427,  2428,  2429,  2430,  2431,  2432,  2449,
-  2456,  2468,  2484,  2500,  2514,  2532,  2533,  2536,  2539,  2543,
-  2560,  2570,  2578,  2604,  2621,  2638,  2639,  2649,  2671,  2693,
-  2694,  2695,  2696,  2697,  2700,  2701,  2704,  2705,  2713,  2730,
-  2832,  2836,  2840,  2845,  2854,  2861,  2888,  2889,  2892,  2893,
-  2896,  2897,  2900,  2901,  2902,  2903,  2906,  2907,  2910,  2911,
-  2914,  2922,  2923,  2924,  2925,  2926,  2927,  2937,  2938,  2941,
-  2943,  2945,  2949,  2950,  2953,  2957,  2960,  2965,  2969,  2983,
-  2988,  2989,  2992,  2994,  2996,  3000,  3006,  3012,  3020,  3021,
-  3023,  3025,  3027,  3029,  3031,  3033,  3037,  3038,  3041,  3042,
-  3043,  3046,  3047,  3050,  3065,  3072,  3081,  3082,  3085,  3092,
-  3100,  3102,  3104,  3108,  3110,  3112,  3127,  3149,  3150,  3157,
-  3158,  3159,  3162,  3170,  3171,  3179,  3185,  3190,  3196,  3204,
-  3206,  3208,  3210,  3214,  3225,  3231,  3242,  3250,  3256,  3267,
-  3275,  3289,  3316,  3335,  3355,  3356,  3357,  3358,  3361,  3362,
-  3365,  3366,  3369,  3370,  3373,  3379,  3386,  3392,  3400,  3401,
-  3402,  3403,  3404,  3405,  3408,  3409,  3412,  3413,  3414,  3415,
-  3416,  3417,  3418,  3419,  3420,  3430,  3432,  3449,  3459,  3469,
-  3482,  3495,  3501,  3507,  3511,  3517,  3518,  3519,  3520,  3521,
-  3522,  3523,  3524,  3527,  3528,  3539,  3544,  3546,  3548,  3556,
-  3558,  3560,  3562,  3564,  3566,  3568,  3570,  3572,  3574,  3576,
-  3578,  3594,  3610,  3612,  3614,  3616,  3618,  3620,  3622,  3634,
-  3641,  3648,  3663,  3678,  3700,  3715,  3737,  3744,  3751,  3761,
-  3768,  3775,  3783,  3790,  3797,  3804,  3811,  3813,  3815,  3817,
-  3824,  3834,  3844,  3854,  3864,  3870,  3876,  3876,  3890,  3890,
-  3904,  3914,  3924,  3934,  3944,  3954,  3964,  3974,  3984,  3994,
-  4004,  4014,  4024,  4034,  4044,  4054,  4064,  4074,  4084,  4094,
-  4104,  4114,  4124,  4134,  4144,  4146,  4148,  4150,  4159,  4164,
-  4166,  4174,  4176,  4178,  4180,  4182,  4184,  4186,  4188,  4190,
-  4206,  4222,  4224,  4226,  4228,  4230,  4237,  4244,  4259,  4274,
-  4296,  4311,  4333,  4340,  4347,  4354,  4362,  4369,  4376,  4383,
-  4392,  4399,  4406,  4410,  4412,  4414,  4418,  4425,  4429,  4430,
-  4431,  4434,  4436,  4440,  4445,  4447,  4449,  4451,  4453,  4455,
-  4457,  4459,  4475,  4491,  4493,  4495,  4497,  4499,  4507,  4514,
-  4521,  4528,  4536,  4543,  4550,  4557,  4566,  4570,  4574,  4576,
-  4585,  4587,  4591,  4593,  4595,  4599,  4605,  4609,  4611,  4617,
-  4623,  4627,  4629,  4650,  4658,  4669,  4687,  4689,  4693,  4702,
-  4703,  4706,  4711,  4719,  4723,  4731,  4741,  4743,  4745,  4756,
-  4758,  4760,  4775,  4782,  4789,  4808,  4810,  4815,  4822,  4829,
-  4841,  4855,  4856,  4859,  4864,  4876,  4877,  4878,  4879,  4880,
-  4886,  4887,  4889,  4890,  4895,  4902,  4909,  4916,  4924,  4926,
-  4936,  4948,  4956,  4957,  4958,  4965,  4967,  4969,  4980,  4981,
-  4982,  4983,  4984,  4985,  4986,  4987,  4988,  4989,  4990,  4991,
-  4992,  4993,  4994,  4995,  4996,  4997,  4998,  4999,  5000,  5001,
-  5002,  5003,  5004,  5005,  5006,  5007,  5008,  5009,  5010,  5011,
-  5012,  5013,  5014,  5015,  5016,  5017,  5018,  5019,  5020,  5021,
-  5022,  5023,  5024,  5025,  5026,  5027,  5028,  5029,  5030,  5031,
-  5032,  5033,  5034,  5035,  5036,  5037,  5038,  5039,  5040,  5041,
-  5042,  5043,  5044,  5045,  5046,  5047,  5048,  5049,  5050,  5063,
-  5064,  5065,  5066,  5067,  5068,  5069,  5070,  5071,  5072,  5073,
-  5074,  5075,  5076,  5077,  5078,  5079,  5080,  5081,  5082,  5083,
-  5084,  5085,  5086,  5087,  5088,  5089,  5090,  5091,  5092,  5093,
-  5094,  5095,  5096,  5097,  5098,  5099,  5100,  5101,  5104,  5111
+  2456,  2468,  2484,  2501,  2515,  2533,  2534,  2537,  2540,  2544,
+  2561,  2571,  2579,  2605,  2622,  2639,  2640,  2650,  2672,  2694,
+  2695,  2696,  2697,  2698,  2701,  2702,  2705,  2706,  2714,  2731,
+  2833,  2837,  2841,  2846,  2855,  2862,  2889,  2890,  2893,  2894,
+  2897,  2898,  2901,  2902,  2903,  2904,  2907,  2908,  2911,  2912,
+  2915,  2923,  2924,  2925,  2926,  2927,  2928,  2938,  2939,  2942,
+  2944,  2946,  2950,  2951,  2954,  2958,  2961,  2966,  2970,  2984,
+  2989,  2990,  2993,  2995,  2997,  3001,  3007,  3013,  3021,  3022,
+  3024,  3026,  3028,  3030,  3032,  3034,  3038,  3039,  3042,  3043,
+  3044,  3047,  3048,  3051,  3066,  3073,  3082,  3083,  3086,  3093,
+  3101,  3103,  3105,  3109,  3111,  3113,  3128,  3150,  3151,  3158,
+  3159,  3160,  3163,  3171,  3172,  3180,  3186,  3191,  3197,  3205,
+  3207,  3209,  3211,  3215,  3226,  3232,  3243,  3251,  3257,  3268,
+  3276,  3290,  3317,  3336,  3356,  3357,  3358,  3359,  3362,  3363,
+  3366,  3367,  3370,  3371,  3374,  3380,  3387,  3393,  3401,  3402,
+  3403,  3404,  3405,  3406,  3409,  3410,  3413,  3414,  3415,  3416,
+  3417,  3418,  3419,  3420,  3421,  3431,  3433,  3450,  3460,  3470,
+  3483,  3496,  3502,  3508,  3512,  3518,  3519,  3520,  3521,  3522,
+  3523,  3524,  3525,  3528,  3529,  3540,  3545,  3547,  3549,  3557,
+  3559,  3561,  3563,  3565,  3567,  3569,  3571,  3573,  3575,  3577,
+  3579,  3595,  3611,  3613,  3615,  3617,  3619,  3621,  3623,  3635,
+  3642,  3649,  3664,  3679,  3701,  3716,  3738,  3745,  3752,  3762,
+  3769,  3776,  3784,  3791,  3798,  3805,  3812,  3814,  3816,  3818,
+  3825,  3835,  3845,  3855,  3865,  3871,  3877,  3877,  3891,  3891,
+  3905,  3915,  3925,  3935,  3945,  3955,  3965,  3975,  3985,  3995,
+  4005,  4015,  4025,  4035,  4045,  4055,  4065,  4075,  4085,  4095,
+  4105,  4115,  4125,  4135,  4145,  4147,  4149,  4151,  4160,  4165,
+  4167,  4175,  4177,  4179,  4181,  4183,  4185,  4187,  4189,  4191,
+  4207,  4223,  4225,  4227,  4229,  4231,  4238,  4245,  4260,  4275,
+  4297,  4312,  4334,  4341,  4348,  4355,  4363,  4370,  4377,  4384,
+  4393,  4400,  4407,  4411,  4413,  4415,  4419,  4426,  4430,  4431,
+  4432,  4435,  4437,  4441,  4446,  4448,  4450,  4452,  4454,  4456,
+  4458,  4460,  4476,  4492,  4494,  4496,  4498,  4500,  4508,  4515,
+  4522,  4529,  4537,  4544,  4551,  4558,  4567,  4571,  4575,  4577,
+  4586,  4588,  4592,  4594,  4596,  4600,  4606,  4610,  4612,  4618,
+  4624,  4628,  4630,  4651,  4659,  4670,  4688,  4690,  4694,  4703,
+  4704,  4707,  4712,  4720,  4724,  4732,  4742,  4744,  4746,  4757,
+  4759,  4761,  4776,  4783,  4790,  4809,  4811,  4816,  4823,  4830,
+  4842,  4856,  4857,  4860,  4865,  4877,  4878,  4879,  4880,  4881,
+  4887,  4888,  4890,  4891,  4896,  4903,  4910,  4917,  4925,  4927,
+  4937,  4949,  4957,  4958,  4959,  4966,  4968,  4970,  4981,  4982,
+  4983,  4984,  4985,  4986,  4987,  4988,  4989,  4990,  4991,  4992,
+  4993,  4994,  4995,  4996,  4997,  4998,  4999,  5000,  5001,  5002,
+  5003,  5004,  5005,  5006,  5007,  5008,  5009,  5010,  5011,  5012,
+  5013,  5014,  5015,  5016,  5017,  5018,  5019,  5020,  5021,  5022,
+  5023,  5024,  5025,  5026,  5027,  5028,  5029,  5030,  5031,  5032,
+  5033,  5034,  5035,  5036,  5037,  5038,  5039,  5040,  5041,  5042,
+  5043,  5044,  5045,  5046,  5047,  5048,  5049,  5050,  5051,  5064,
+  5065,  5066,  5067,  5068,  5069,  5070,  5071,  5072,  5073,  5074,
+  5075,  5076,  5077,  5078,  5079,  5080,  5081,  5082,  5083,  5084,
+  5085,  5086,  5087,  5088,  5089,  5090,  5091,  5092,  5093,  5094,
+  5095,  5096,  5097,  5098,  5099,  5100,  5101,  5102,  5105,  5112
 };
 #endif
 
@@ -4791,7 +4791,7 @@ static const short yycheck[] = {     3,
     -1,    -1,    -1,    -1,    -1,    -1,    -1,   214
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/local/bison/bison.simple"
+#line 3 "/usr/share/misc/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -4984,7 +4984,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 
-#line 196 "/usr/local/bison/bison.simple"
+#line 196 "/usr/share/misc/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -7638,10 +7638,11 @@ case 443:
 					yyval.astmt->havingClause = n->havingClause;
 					yyval.astmt->unionClause = n->unionClause;
 					yyval.astmt->intersectClause = n->intersectClause;
+					yyval.astmt->forUpdate = n->forUpdate;
 				;
     break;}
 case 444:
-#line 2501 "gram.y"
+#line 2502 "gram.y"
 {
 					yyval.astmt = makeNode(InsertStmt);
 					yyval.astmt->cols = yyvsp[-5].list;
@@ -7657,7 +7658,7 @@ case 444:
 				;
     break;}
 case 445:
-#line 2515 "gram.y"
+#line 2516 "gram.y"
 {
 					SelectStmt *n;
 
@@ -7675,23 +7676,23 @@ case 445:
 				;
     break;}
 case 446:
-#line 2532 "gram.y"
+#line 2533 "gram.y"
 { yyval.list = yyvsp[-1].list; ;
     break;}
 case 447:
-#line 2533 "gram.y"
+#line 2534 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 448:
-#line 2538 "gram.y"
+#line 2539 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node); ;
     break;}
 case 449:
-#line 2540 "gram.y"
+#line 2541 "gram.y"
 { yyval.list = lcons(yyvsp[0].node, NIL); ;
     break;}
 case 450:
-#line 2544 "gram.y"
+#line 2545 "gram.y"
 {
 					Ident *id = makeNode(Ident);
 					id->name = yyvsp[-1].str;
@@ -7700,7 +7701,7 @@ case 450:
 				;
     break;}
 case 451:
-#line 2562 "gram.y"
+#line 2563 "gram.y"
 {
 					DeleteStmt *n = makeNode(DeleteStmt);
 					n->relname = yyvsp[-1].str;
@@ -7709,7 +7710,7 @@ case 451:
 				;
     break;}
 case 452:
-#line 2571 "gram.y"
+#line 2572 "gram.y"
 {
 					LockStmt *n = makeNode(LockStmt);
 
@@ -7719,7 +7720,7 @@ case 452:
 				;
     break;}
 case 453:
-#line 2579 "gram.y"
+#line 2580 "gram.y"
 {
 					LockStmt *n = makeNode(LockStmt);
 
@@ -7747,7 +7748,7 @@ case 453:
 				;
     break;}
 case 454:
-#line 2605 "gram.y"
+#line 2606 "gram.y"
 {
 					LockStmt *n = makeNode(LockStmt);
 
@@ -7766,7 +7767,7 @@ case 454:
 				;
     break;}
 case 455:
-#line 2622 "gram.y"
+#line 2623 "gram.y"
 {
 					LockStmt *n = makeNode(LockStmt);
 
@@ -7783,15 +7784,15 @@ case 455:
 				;
     break;}
 case 456:
-#line 2638 "gram.y"
+#line 2639 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 457:
-#line 2639 "gram.y"
+#line 2640 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 458:
-#line 2653 "gram.y"
+#line 2654 "gram.y"
 {
 					UpdateStmt *n = makeNode(UpdateStmt);
 					n->relname = yyvsp[-4].str;
@@ -7802,7 +7803,7 @@ case 458:
 				;
     break;}
 case 459:
-#line 2672 "gram.y"
+#line 2673 "gram.y"
 {
  					SelectStmt *n;
   
@@ -7824,39 +7825,39 @@ case 459:
 				;
     break;}
 case 460:
-#line 2693 "gram.y"
+#line 2694 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 461:
-#line 2694 "gram.y"
+#line 2695 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 462:
-#line 2695 "gram.y"
+#line 2696 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 463:
-#line 2696 "gram.y"
+#line 2697 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 464:
-#line 2697 "gram.y"
+#line 2698 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 465:
-#line 2700 "gram.y"
+#line 2701 "gram.y"
 { yyval.boolean = yyvsp[0].boolean; ;
     break;}
 case 466:
-#line 2701 "gram.y"
+#line 2702 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 467:
-#line 2704 "gram.y"
+#line 2705 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 468:
-#line 2706 "gram.y"
+#line 2707 "gram.y"
 {
 				elog(ERROR,"DECLARE/UPDATE not supported;"
 					 " Cursors must be READ ONLY.");
@@ -7864,13 +7865,13 @@ case 468:
 			;
     break;}
 case 469:
-#line 2714 "gram.y"
+#line 2715 "gram.y"
 {
 				yyval.boolean = FALSE;
 			;
     break;}
 case 470:
-#line 2731 "gram.y"
+#line 2732 "gram.y"
 {
 				/* There were no set operations, so just attach the sortClause */
 				if IsA(yyvsp[-2].node, SelectStmt)
@@ -7958,26 +7959,26 @@ case 470:
 			;
     break;}
 case 471:
-#line 2833 "gram.y"
+#line 2834 "gram.y"
 {
 				yyval.node = yyvsp[-1].node; 
 			;
     break;}
 case 472:
-#line 2837 "gram.y"
+#line 2838 "gram.y"
 {
 				yyval.node = yyvsp[0].node; 
 			;
     break;}
 case 473:
-#line 2841 "gram.y"
+#line 2842 "gram.y"
 {
 				yyval.node = (Node *)makeA_Expr(AND,NULL,yyvsp[-2].node,
 							makeA_Expr(NOT,NULL,NULL,yyvsp[0].node));
 			;
     break;}
 case 474:
-#line 2846 "gram.y"
+#line 2847 "gram.y"
 {	
 				if (IsA(yyvsp[0].node, SelectStmt))
 				  {
@@ -7988,13 +7989,13 @@ case 474:
 			;
     break;}
 case 475:
-#line 2855 "gram.y"
+#line 2856 "gram.y"
 {
 				yyval.node = (Node *)makeA_Expr(AND,NULL,yyvsp[-2].node,yyvsp[0].node);
 			;
     break;}
 case 476:
-#line 2864 "gram.y"
+#line 2865 "gram.y"
 {
 					SelectStmt *n = makeNode(SelectStmt);
 					n->unique = yyvsp[-6].str;
@@ -8019,63 +8020,63 @@ case 476:
 				;
     break;}
 case 477:
-#line 2888 "gram.y"
+#line 2889 "gram.y"
 { yyval.str= yyvsp[0].str; ;
     break;}
 case 478:
-#line 2889 "gram.y"
+#line 2890 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 479:
-#line 2892 "gram.y"
+#line 2893 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 480:
-#line 2893 "gram.y"
+#line 2894 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 481:
-#line 2896 "gram.y"
+#line 2897 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 482:
-#line 2897 "gram.y"
+#line 2898 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 483:
-#line 2900 "gram.y"
+#line 2901 "gram.y"
 { yyval.str = "*"; ;
     break;}
 case 484:
-#line 2901 "gram.y"
+#line 2902 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 485:
-#line 2902 "gram.y"
+#line 2903 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 486:
-#line 2903 "gram.y"
+#line 2904 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 487:
-#line 2906 "gram.y"
+#line 2907 "gram.y"
 { yyval.list = yyvsp[0].list; ;
     break;}
 case 488:
-#line 2907 "gram.y"
+#line 2908 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 489:
-#line 2910 "gram.y"
+#line 2911 "gram.y"
 { yyval.list = lcons(yyvsp[0].sortgroupby, NIL); ;
     break;}
 case 490:
-#line 2911 "gram.y"
+#line 2912 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].sortgroupby); ;
     break;}
 case 491:
-#line 2915 "gram.y"
+#line 2916 "gram.y"
 {
 					yyval.sortgroupby = makeNode(SortGroupBy);
 					yyval.sortgroupby->node = yyvsp[-1].node;
@@ -8083,110 +8084,110 @@ case 491:
 				;
     break;}
 case 492:
-#line 2922 "gram.y"
+#line 2923 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 493:
-#line 2923 "gram.y"
+#line 2924 "gram.y"
 { yyval.str = "<"; ;
     break;}
 case 494:
-#line 2924 "gram.y"
+#line 2925 "gram.y"
 { yyval.str = ">"; ;
     break;}
 case 495:
-#line 2925 "gram.y"
+#line 2926 "gram.y"
 { yyval.str = "<"; ;
     break;}
 case 496:
-#line 2926 "gram.y"
+#line 2927 "gram.y"
 { yyval.str = ">"; ;
     break;}
 case 497:
-#line 2927 "gram.y"
+#line 2928 "gram.y"
 { yyval.str = "<"; /*default*/ ;
     break;}
 case 498:
-#line 2937 "gram.y"
+#line 2938 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 499:
-#line 2938 "gram.y"
+#line 2939 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 501:
-#line 2944 "gram.y"
+#line 2945 "gram.y"
 {	yyval.list = lcons(makeString(yyvsp[0].str),NIL); ;
     break;}
 case 502:
-#line 2946 "gram.y"
+#line 2947 "gram.y"
 {	yyval.list = lappend(yyvsp[-2].list,makeString(yyvsp[0].str)); ;
     break;}
 case 503:
-#line 2949 "gram.y"
+#line 2950 "gram.y"
 { yyval.list = yyvsp[0].list; ;
     break;}
 case 504:
-#line 2950 "gram.y"
+#line 2951 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 505:
-#line 2954 "gram.y"
+#line 2955 "gram.y"
 {
 					yyval.node = yyvsp[0].node;
 				;
     break;}
 case 506:
-#line 2957 "gram.y"
+#line 2958 "gram.y"
 { yyval.node = NULL; ;
     break;}
 case 507:
-#line 2962 "gram.y"
+#line 2963 "gram.y"
 {
 				yyval.list = lcons(NULL, NULL);
 			;
     break;}
 case 508:
-#line 2966 "gram.y"
+#line 2967 "gram.y"
 {
 				yyval.list = yyvsp[0].list;
 			;
     break;}
 case 509:
-#line 2970 "gram.y"
+#line 2971 "gram.y"
 {
 				yyval.list = NULL;
 			;
     break;}
 case 510:
-#line 2984 "gram.y"
+#line 2985 "gram.y"
 {
 					yyval.list = NIL;
 					elog(ERROR,"JOIN not yet implemented");
 				;
     break;}
 case 511:
-#line 2988 "gram.y"
+#line 2989 "gram.y"
 { yyval.list = yyvsp[0].list; ;
     break;}
 case 512:
-#line 2989 "gram.y"
+#line 2990 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 513:
-#line 2993 "gram.y"
+#line 2994 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].range); ;
     break;}
 case 514:
-#line 2995 "gram.y"
+#line 2996 "gram.y"
 { elog(ERROR,"CROSS JOIN not yet implemented"); ;
     break;}
 case 515:
-#line 2997 "gram.y"
+#line 2998 "gram.y"
 { yyval.list = lcons(yyvsp[0].range, NIL); ;
     break;}
 case 516:
-#line 3001 "gram.y"
+#line 3002 "gram.y"
 {
 					yyval.range = makeNode(RangeVar);
 					yyval.range->relExpr = yyvsp[-2].relexp;
@@ -8194,7 +8195,7 @@ case 516:
 				;
     break;}
 case 517:
-#line 3007 "gram.y"
+#line 3008 "gram.y"
 {
 					yyval.range = makeNode(RangeVar);
 					yyval.range->relExpr = yyvsp[-1].relexp;
@@ -8202,7 +8203,7 @@ case 517:
 				;
     break;}
 case 518:
-#line 3013 "gram.y"
+#line 3014 "gram.y"
 {
 					yyval.range = makeNode(RangeVar);
 					yyval.range->relExpr = yyvsp[0].relexp;
@@ -8210,67 +8211,67 @@ case 518:
 				;
     break;}
 case 519:
-#line 3020 "gram.y"
+#line 3021 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 520:
-#line 3022 "gram.y"
+#line 3023 "gram.y"
 { elog(ERROR,"FULL OUTER JOIN not yet implemented"); ;
     break;}
 case 521:
-#line 3024 "gram.y"
+#line 3025 "gram.y"
 { elog(ERROR,"LEFT OUTER JOIN not yet implemented"); ;
     break;}
 case 522:
-#line 3026 "gram.y"
+#line 3027 "gram.y"
 { elog(ERROR,"RIGHT OUTER JOIN not yet implemented"); ;
     break;}
 case 523:
-#line 3028 "gram.y"
+#line 3029 "gram.y"
 { elog(ERROR,"OUTER JOIN not yet implemented"); ;
     break;}
 case 524:
-#line 3030 "gram.y"
+#line 3031 "gram.y"
 { elog(ERROR,"INNER JOIN not yet implemented"); ;
     break;}
 case 525:
-#line 3032 "gram.y"
+#line 3033 "gram.y"
 { elog(ERROR,"UNION JOIN not yet implemented"); ;
     break;}
 case 526:
-#line 3034 "gram.y"
+#line 3035 "gram.y"
 { elog(ERROR,"INNER JOIN not yet implemented"); ;
     break;}
 case 527:
-#line 3037 "gram.y"
+#line 3038 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 528:
-#line 3038 "gram.y"
+#line 3039 "gram.y"
 { yyval.str = NULL;  /* no qualifiers */ ;
     break;}
 case 529:
-#line 3041 "gram.y"
+#line 3042 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 530:
-#line 3042 "gram.y"
+#line 3043 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 531:
-#line 3043 "gram.y"
+#line 3044 "gram.y"
 { yyval.str = NULL;  /* no qualifiers */ ;
     break;}
 case 532:
-#line 3046 "gram.y"
+#line 3047 "gram.y"
 { yyval.list = lcons(yyvsp[0].joinusing, NIL); ;
     break;}
 case 533:
-#line 3047 "gram.y"
+#line 3048 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].joinusing); ;
     break;}
 case 534:
-#line 3059 "gram.y"
+#line 3060 "gram.y"
 {
 					yyval.joinusing = makeNode(JoinUsing);
 					yyval.joinusing->resno = 0;
@@ -8279,7 +8280,7 @@ case 534:
 				;
     break;}
 case 535:
-#line 3066 "gram.y"
+#line 3067 "gram.y"
 {
 					yyval.joinusing = makeNode(JoinUsing);
 					yyval.joinusing->resno = 0;
@@ -8288,7 +8289,7 @@ case 535:
 				;
     break;}
 case 536:
-#line 3073 "gram.y"
+#line 3074 "gram.y"
 {
 					yyval.joinusing = makeNode(JoinUsing);
 					yyval.joinusing->resno = yyvsp[0].ival;
@@ -8297,15 +8298,15 @@ case 536:
 				;
     break;}
 case 537:
-#line 3081 "gram.y"
+#line 3082 "gram.y"
 { yyval.node = yyvsp[0].node; ;
     break;}
 case 538:
-#line 3082 "gram.y"
+#line 3083 "gram.y"
 { yyval.node = NULL;  /* no qualifiers */ ;
     break;}
 case 539:
-#line 3086 "gram.y"
+#line 3087 "gram.y"
 {
 					/* normal relations */
 					yyval.relexp = makeNode(RelExpr);
@@ -8314,7 +8315,7 @@ case 539:
 				;
     break;}
 case 540:
-#line 3093 "gram.y"
+#line 3094 "gram.y"
 {
 					/* inheritance query */
 					yyval.relexp = makeNode(RelExpr);
@@ -8323,31 +8324,31 @@ case 540:
 				;
     break;}
 case 541:
-#line 3101 "gram.y"
+#line 3102 "gram.y"
 {  yyval.list = lcons(makeInteger(-1), yyvsp[0].list); ;
     break;}
 case 542:
-#line 3103 "gram.y"
+#line 3104 "gram.y"
 {  yyval.list = lcons(makeInteger(yyvsp[-2].ival), yyvsp[0].list); ;
     break;}
 case 543:
-#line 3105 "gram.y"
+#line 3106 "gram.y"
 {  yyval.list = NIL; ;
     break;}
 case 544:
-#line 3109 "gram.y"
+#line 3110 "gram.y"
 {  yyval.list = lcons(makeInteger(-1), yyvsp[0].list); ;
     break;}
 case 545:
-#line 3111 "gram.y"
+#line 3112 "gram.y"
 {  yyval.list = lcons(makeInteger(yyvsp[-2].ival), yyvsp[0].list); ;
     break;}
 case 546:
-#line 3113 "gram.y"
+#line 3114 "gram.y"
 {  yyval.list = NIL; ;
     break;}
 case 547:
-#line 3128 "gram.y"
+#line 3129 "gram.y"
 {
 					yyval.typnam = yyvsp[-1].typnam;
 					yyval.typnam->arrayBounds = yyvsp[0].list;
@@ -8371,14 +8372,14 @@ case 547:
 				;
     break;}
 case 549:
-#line 3151 "gram.y"
+#line 3152 "gram.y"
 {
 					yyval.typnam = yyvsp[0].typnam;
 					yyval.typnam->setof = TRUE;
 				;
     break;}
 case 553:
-#line 3163 "gram.y"
+#line 3164 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType(yyvsp[0].str);
@@ -8386,15 +8387,15 @@ case 553:
 				;
     break;}
 case 554:
-#line 3170 "gram.y"
+#line 3171 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 555:
-#line 3171 "gram.y"
+#line 3172 "gram.y"
 { yyval.str = xlateSqlType("type"); ;
     break;}
 case 556:
-#line 3180 "gram.y"
+#line 3181 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType(yyvsp[0].str);
@@ -8402,14 +8403,14 @@ case 556:
 				;
     break;}
 case 557:
-#line 3186 "gram.y"
+#line 3187 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("float");
 				;
     break;}
 case 558:
-#line 3191 "gram.y"
+#line 3192 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("numeric");
@@ -8417,7 +8418,7 @@ case 558:
 				;
     break;}
 case 559:
-#line 3197 "gram.y"
+#line 3198 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("numeric");
@@ -8425,23 +8426,23 @@ case 559:
 				;
     break;}
 case 560:
-#line 3205 "gram.y"
+#line 3206 "gram.y"
 {	yyval.str = xlateSqlType("float8"); ;
     break;}
 case 561:
-#line 3207 "gram.y"
+#line 3208 "gram.y"
 {	yyval.str = xlateSqlType("float8"); ;
     break;}
 case 562:
-#line 3209 "gram.y"
+#line 3210 "gram.y"
 {	yyval.str = xlateSqlType("numeric"); ;
     break;}
 case 563:
-#line 3211 "gram.y"
+#line 3212 "gram.y"
 {	yyval.str = xlateSqlType("numeric"); ;
     break;}
 case 564:
-#line 3215 "gram.y"
+#line 3216 "gram.y"
 {
 					if (yyvsp[-1].ival < 1)
 						elog(ERROR,"precision for FLOAT must be at least 1");
@@ -8454,13 +8455,13 @@ case 564:
 				;
     break;}
 case 565:
-#line 3226 "gram.y"
+#line 3227 "gram.y"
 {
 					yyval.str = xlateSqlType("float8");
 				;
     break;}
 case 566:
-#line 3232 "gram.y"
+#line 3233 "gram.y"
 {
 					if (yyvsp[-3].ival < 1 || yyvsp[-3].ival > NUMERIC_MAX_PRECISION)
 						elog(ERROR,"NUMERIC precision %d must be beween 1 and %d",
@@ -8473,7 +8474,7 @@ case 566:
 				;
     break;}
 case 567:
-#line 3243 "gram.y"
+#line 3244 "gram.y"
 {
 					if (yyvsp[-1].ival < 1 || yyvsp[-1].ival > NUMERIC_MAX_PRECISION)
 						elog(ERROR,"NUMERIC precision %d must be beween 1 and %d",
@@ -8483,13 +8484,13 @@ case 567:
 				;
     break;}
 case 568:
-#line 3251 "gram.y"
+#line 3252 "gram.y"
 {
 					yyval.ival = ((NUMERIC_DEFAULT_PRECISION << 16) | NUMERIC_DEFAULT_SCALE) + VARHDRSZ;
 				;
     break;}
 case 569:
-#line 3257 "gram.y"
+#line 3258 "gram.y"
 {
 					if (yyvsp[-3].ival < 1 || yyvsp[-3].ival > NUMERIC_MAX_PRECISION)
 						elog(ERROR,"DECIMAL precision %d must be beween 1 and %d",
@@ -8502,7 +8503,7 @@ case 569:
 				;
     break;}
 case 570:
-#line 3268 "gram.y"
+#line 3269 "gram.y"
 {
 					if (yyvsp[-1].ival < 1 || yyvsp[-1].ival > NUMERIC_MAX_PRECISION)
 						elog(ERROR,"DECIMAL precision %d must be beween 1 and %d",
@@ -8512,13 +8513,13 @@ case 570:
 				;
     break;}
 case 571:
-#line 3276 "gram.y"
+#line 3277 "gram.y"
 {
 					yyval.ival = ((NUMERIC_DEFAULT_PRECISION << 16) | NUMERIC_DEFAULT_SCALE) + VARHDRSZ;
 				;
     break;}
 case 572:
-#line 3290 "gram.y"
+#line 3291 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					if (strcasecmp(yyvsp[-3].str, "char") == 0)
@@ -8547,7 +8548,7 @@ case 572:
 				;
     break;}
 case 573:
-#line 3317 "gram.y"
+#line 3318 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					/* Let's try to make all single-character types into bpchar(1)
@@ -8566,7 +8567,7 @@ case 573:
 				;
     break;}
 case 574:
-#line 3336 "gram.y"
+#line 3337 "gram.y"
 {
 					char *type, *c;
 					if ((yyvsp[-1].str == NULL) || (strcasecmp(yyvsp[-1].str, "sql_text") == 0)) {
@@ -8588,47 +8589,47 @@ case 574:
 				;
     break;}
 case 575:
-#line 3355 "gram.y"
+#line 3356 "gram.y"
 { yyval.str = xlateSqlType(yyvsp[0].boolean? "varchar": "char"); ;
     break;}
 case 576:
-#line 3356 "gram.y"
+#line 3357 "gram.y"
 { yyval.str = xlateSqlType("varchar"); ;
     break;}
 case 577:
-#line 3357 "gram.y"
+#line 3358 "gram.y"
 { yyval.str = xlateSqlType(yyvsp[0].boolean? "varchar": "char"); ;
     break;}
 case 578:
-#line 3358 "gram.y"
+#line 3359 "gram.y"
 { yyval.str = xlateSqlType(yyvsp[0].boolean? "varchar": "char"); ;
     break;}
 case 579:
-#line 3361 "gram.y"
+#line 3362 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 580:
-#line 3362 "gram.y"
+#line 3363 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 581:
-#line 3365 "gram.y"
+#line 3366 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 582:
-#line 3366 "gram.y"
+#line 3367 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 583:
-#line 3369 "gram.y"
+#line 3370 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 584:
-#line 3370 "gram.y"
+#line 3371 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 585:
-#line 3374 "gram.y"
+#line 3375 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType(yyvsp[0].str);
@@ -8636,7 +8637,7 @@ case 585:
 				;
     break;}
 case 586:
-#line 3380 "gram.y"
+#line 3381 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("timestamp");
@@ -8645,7 +8646,7 @@ case 586:
 				;
     break;}
 case 587:
-#line 3387 "gram.y"
+#line 3388 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("time");
@@ -8653,7 +8654,7 @@ case 587:
 				;
     break;}
 case 588:
-#line 3393 "gram.y"
+#line 3394 "gram.y"
 {
 					yyval.typnam = makeNode(TypeName);
 					yyval.typnam->name = xlateSqlType("interval");
@@ -8661,79 +8662,79 @@ case 588:
 				;
     break;}
 case 589:
-#line 3400 "gram.y"
+#line 3401 "gram.y"
 { yyval.str = "year"; ;
     break;}
 case 590:
-#line 3401 "gram.y"
+#line 3402 "gram.y"
 { yyval.str = "month"; ;
     break;}
 case 591:
-#line 3402 "gram.y"
+#line 3403 "gram.y"
 { yyval.str = "day"; ;
     break;}
 case 592:
-#line 3403 "gram.y"
+#line 3404 "gram.y"
 { yyval.str = "hour"; ;
     break;}
 case 593:
-#line 3404 "gram.y"
+#line 3405 "gram.y"
 { yyval.str = "minute"; ;
     break;}
 case 594:
-#line 3405 "gram.y"
+#line 3406 "gram.y"
 { yyval.str = "second"; ;
     break;}
 case 595:
-#line 3408 "gram.y"
+#line 3409 "gram.y"
 { yyval.boolean = TRUE; ;
     break;}
 case 596:
-#line 3409 "gram.y"
+#line 3410 "gram.y"
 { yyval.boolean = FALSE; ;
     break;}
 case 597:
-#line 3412 "gram.y"
+#line 3413 "gram.y"
 { yyval.list = lcons(yyvsp[0].str, NIL); ;
     break;}
 case 598:
-#line 3413 "gram.y"
+#line 3414 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 599:
-#line 3414 "gram.y"
+#line 3415 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 600:
-#line 3415 "gram.y"
+#line 3416 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 601:
-#line 3416 "gram.y"
+#line 3417 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 602:
-#line 3417 "gram.y"
+#line 3418 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 603:
-#line 3418 "gram.y"
+#line 3419 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 604:
-#line 3419 "gram.y"
+#line 3420 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 605:
-#line 3420 "gram.y"
+#line 3421 "gram.y"
 { yyval.list = NIL; ;
     break;}
 case 606:
-#line 3431 "gram.y"
+#line 3432 "gram.y"
 { yyval.node = yyvsp[0].node; ;
     break;}
 case 607:
-#line 3433 "gram.y"
+#line 3434 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_Null;
@@ -8741,7 +8742,7 @@ case 607:
 				;
     break;}
 case 608:
-#line 3450 "gram.y"
+#line 3451 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = yyvsp[-5].list;
@@ -8753,7 +8754,7 @@ case 608:
 				;
     break;}
 case 609:
-#line 3460 "gram.y"
+#line 3461 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = yyvsp[-6].list;
@@ -8765,7 +8766,7 @@ case 609:
 				;
     break;}
 case 610:
-#line 3470 "gram.y"
+#line 3471 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = yyvsp[-6].list;
@@ -8780,7 +8781,7 @@ case 610:
 				;
     break;}
 case 611:
-#line 3483 "gram.y"
+#line 3484 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = yyvsp[-5].list;
@@ -8795,86 +8796,86 @@ case 611:
 				;
     break;}
 case 612:
-#line 3496 "gram.y"
+#line 3497 "gram.y"
 {
 					yyval.node = makeRowExpr(yyvsp[-3].str, yyvsp[-5].list, yyvsp[-1].list);
 				;
     break;}
 case 613:
-#line 3502 "gram.y"
+#line 3503 "gram.y"
 {
 					yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node);
 				;
     break;}
 case 614:
-#line 3508 "gram.y"
+#line 3509 "gram.y"
 {
 					yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node);
 				;
     break;}
 case 615:
-#line 3512 "gram.y"
+#line 3513 "gram.y"
 {
 					yyval.list = lcons(yyvsp[0].node, NIL);
 				;
     break;}
 case 616:
-#line 3517 "gram.y"
+#line 3518 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 617:
-#line 3518 "gram.y"
+#line 3519 "gram.y"
 { yyval.str = "<"; ;
     break;}
 case 618:
-#line 3519 "gram.y"
+#line 3520 "gram.y"
 { yyval.str = "="; ;
     break;}
 case 619:
-#line 3520 "gram.y"
+#line 3521 "gram.y"
 { yyval.str = ">"; ;
     break;}
 case 620:
-#line 3521 "gram.y"
+#line 3522 "gram.y"
 { yyval.str = "+"; ;
     break;}
 case 621:
-#line 3522 "gram.y"
+#line 3523 "gram.y"
 { yyval.str = "-"; ;
     break;}
 case 622:
-#line 3523 "gram.y"
+#line 3524 "gram.y"
 { yyval.str = "*"; ;
     break;}
 case 623:
-#line 3524 "gram.y"
+#line 3525 "gram.y"
 { yyval.str = "/"; ;
     break;}
 case 624:
-#line 3527 "gram.y"
+#line 3528 "gram.y"
 { yyval.ival = ANY_SUBLINK; ;
     break;}
 case 625:
-#line 3528 "gram.y"
+#line 3529 "gram.y"
 { yyval.ival = ALL_SUBLINK; ;
     break;}
 case 626:
-#line 3540 "gram.y"
+#line 3541 "gram.y"
 {
 					yyvsp[-1].attr->indirection = yyvsp[0].list;
 					yyval.node = (Node *)yyvsp[-1].attr;
 				;
     break;}
 case 627:
-#line 3545 "gram.y"
+#line 3546 "gram.y"
 {	yyval.node = yyvsp[0].node;  ;
     break;}
 case 628:
-#line 3547 "gram.y"
+#line 3548 "gram.y"
 {	yyval.node = yyvsp[0].node;  ;
     break;}
 case 629:
-#line 3549 "gram.y"
+#line 3550 "gram.y"
 {
 					/* could be a column name or a relation_name */
 					Ident *n = makeNode(Ident);
@@ -8884,51 +8885,51 @@ case 629:
 				;
     break;}
 case 630:
-#line 3557 "gram.y"
+#line 3558 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", NULL, yyvsp[0].node); ;
     break;}
 case 631:
-#line 3559 "gram.y"
+#line 3560 "gram.y"
 {	yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 632:
-#line 3561 "gram.y"
+#line 3562 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 633:
-#line 3563 "gram.y"
+#line 3564 "gram.y"
 {	yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 634:
-#line 3565 "gram.y"
+#line 3566 "gram.y"
 {	yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 635:
-#line 3567 "gram.y"
+#line 3568 "gram.y"
 {	yyval.node = makeA_Expr(OP, "<", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 636:
-#line 3569 "gram.y"
+#line 3570 "gram.y"
 {	yyval.node = makeA_Expr(OP, ">", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 637:
-#line 3571 "gram.y"
+#line 3572 "gram.y"
 {	yyval.node = makeA_Expr(OP, "=", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 638:
-#line 3573 "gram.y"
+#line 3574 "gram.y"
 {	yyval.node = makeA_Expr(OP, ":", NULL, yyvsp[0].node); ;
     break;}
 case 639:
-#line 3575 "gram.y"
+#line 3576 "gram.y"
 {	yyval.node = makeA_Expr(OP, ";", NULL, yyvsp[0].node); ;
     break;}
 case 640:
-#line 3577 "gram.y"
+#line 3578 "gram.y"
 {	yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
     break;}
 case 641:
-#line 3579 "gram.y"
+#line 3580 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-2].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -8946,7 +8947,7 @@ case 641:
 				;
     break;}
 case 642:
-#line 3595 "gram.y"
+#line 3596 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-3].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -8964,31 +8965,31 @@ case 642:
 				;
     break;}
 case 643:
-#line 3611 "gram.y"
+#line 3612 "gram.y"
 {	yyval.node = yyvsp[-1].node; ;
     break;}
 case 644:
-#line 3613 "gram.y"
+#line 3614 "gram.y"
 {	yyval.node = makeIndexable(yyvsp[-1].str,yyvsp[-2].node,yyvsp[0].node);	;
     break;}
 case 645:
-#line 3615 "gram.y"
+#line 3616 "gram.y"
 {	yyval.node = makeIndexable("~~", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 646:
-#line 3617 "gram.y"
+#line 3618 "gram.y"
 {	yyval.node = makeA_Expr(OP, "!~~", yyvsp[-3].node, yyvsp[0].node); ;
     break;}
 case 647:
-#line 3619 "gram.y"
+#line 3620 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
     break;}
 case 648:
-#line 3621 "gram.y"
+#line 3622 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
     break;}
 case 649:
-#line 3623 "gram.y"
+#line 3624 "gram.y"
 {
 					/* cheap hack for aggregate (eg. count) */
 					FuncCall *n = makeNode(FuncCall);
@@ -9002,7 +9003,7 @@ case 649:
 				;
     break;}
 case 650:
-#line 3635 "gram.y"
+#line 3636 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-2].str;
@@ -9011,7 +9012,7 @@ case 650:
 				;
     break;}
 case 651:
-#line 3642 "gram.y"
+#line 3643 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-3].str;
@@ -9020,7 +9021,7 @@ case 651:
 				;
     break;}
 case 652:
-#line 3649 "gram.y"
+#line 3650 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9037,7 +9038,7 @@ case 652:
 				;
     break;}
 case 653:
-#line 3664 "gram.y"
+#line 3665 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9054,7 +9055,7 @@ case 653:
 				;
     break;}
 case 654:
-#line 3679 "gram.y"
+#line 3680 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					A_Const *s = makeNode(A_Const);
@@ -9078,7 +9079,7 @@ case 654:
 				;
     break;}
 case 655:
-#line 3701 "gram.y"
+#line 3702 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9095,7 +9096,7 @@ case 655:
 				;
     break;}
 case 656:
-#line 3716 "gram.y"
+#line 3717 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					A_Const *s = makeNode(A_Const);
@@ -9119,7 +9120,7 @@ case 656:
 				;
     break;}
 case 657:
-#line 3738 "gram.y"
+#line 3739 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "getpgusername";
@@ -9128,7 +9129,7 @@ case 657:
 				;
     break;}
 case 658:
-#line 3745 "gram.y"
+#line 3746 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "getpgusername";
@@ -9137,7 +9138,7 @@ case 658:
 				;
     break;}
 case 659:
-#line 3752 "gram.y"
+#line 3753 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = NIL;
@@ -9149,7 +9150,7 @@ case 659:
 				;
     break;}
 case 660:
-#line 3762 "gram.y"
+#line 3763 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "date_part";
@@ -9158,7 +9159,7 @@ case 660:
 				;
     break;}
 case 661:
-#line 3769 "gram.y"
+#line 3770 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "strpos";
@@ -9167,7 +9168,7 @@ case 661:
 				;
     break;}
 case 662:
-#line 3776 "gram.y"
+#line 3777 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "substr";
@@ -9176,7 +9177,7 @@ case 662:
 				;
     break;}
 case 663:
-#line 3784 "gram.y"
+#line 3785 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -9185,7 +9186,7 @@ case 663:
 				;
     break;}
 case 664:
-#line 3791 "gram.y"
+#line 3792 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "ltrim";
@@ -9194,7 +9195,7 @@ case 664:
 				;
     break;}
 case 665:
-#line 3798 "gram.y"
+#line 3799 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "rtrim";
@@ -9203,7 +9204,7 @@ case 665:
 				;
     break;}
 case 666:
-#line 3805 "gram.y"
+#line 3806 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -9212,23 +9213,23 @@ case 666:
 				;
     break;}
 case 667:
-#line 3812 "gram.y"
+#line 3813 "gram.y"
 {	yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[-1].node, NULL); ;
     break;}
 case 668:
-#line 3814 "gram.y"
+#line 3815 "gram.y"
 {	yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[-2].node, NULL); ;
     break;}
 case 669:
-#line 3816 "gram.y"
+#line 3817 "gram.y"
 {	yyval.node = makeA_Expr(NOTNULL, NULL, yyvsp[-1].node, NULL); ;
     break;}
 case 670:
-#line 3818 "gram.y"
+#line 3819 "gram.y"
 {	yyval.node = makeA_Expr(NOTNULL, NULL, yyvsp[-3].node, NULL); ;
     break;}
 case 671:
-#line 3825 "gram.y"
+#line 3826 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -9240,7 +9241,7 @@ case 671:
 				;
     break;}
 case 672:
-#line 3835 "gram.y"
+#line 3836 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -9252,7 +9253,7 @@ case 672:
 				;
     break;}
 case 673:
-#line 3845 "gram.y"
+#line 3846 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -9264,7 +9265,7 @@ case 673:
 				;
     break;}
 case 674:
-#line 3855 "gram.y"
+#line 3856 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -9276,7 +9277,7 @@ case 674:
 				;
     break;}
 case 675:
-#line 3865 "gram.y"
+#line 3866 "gram.y"
 {
 					yyval.node = makeA_Expr(AND, NULL,
 						makeA_Expr(OP, ">=", yyvsp[-4].node, yyvsp[-2].node),
@@ -9284,7 +9285,7 @@ case 675:
 				;
     break;}
 case 676:
-#line 3871 "gram.y"
+#line 3872 "gram.y"
 {
 					yyval.node = makeA_Expr(OR, NULL,
 						makeA_Expr(OP, "<", yyvsp[-5].node, yyvsp[-2].node),
@@ -9292,11 +9293,11 @@ case 676:
 				;
     break;}
 case 677:
-#line 3876 "gram.y"
+#line 3877 "gram.y"
 { saved_In_Expr = lcons(yyvsp[-1].node,saved_In_Expr); ;
     break;}
 case 678:
-#line 3877 "gram.y"
+#line 3878 "gram.y"
 {
 					saved_In_Expr = lnext(saved_In_Expr);
 					if (nodeTag(yyvsp[-1].node) == T_SubLink)
@@ -9312,11 +9313,11 @@ case 678:
 				;
     break;}
 case 679:
-#line 3890 "gram.y"
+#line 3891 "gram.y"
 { saved_In_Expr = lcons(yyvsp[-2].node,saved_In_Expr); ;
     break;}
 case 680:
-#line 3891 "gram.y"
+#line 3892 "gram.y"
 {
 					saved_In_Expr = lnext(saved_In_Expr);
 					if (nodeTag(yyvsp[-1].node) == T_SubLink)
@@ -9332,7 +9333,7 @@ case 680:
 				;
     break;}
 case 681:
-#line 3905 "gram.y"
+#line 3906 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9344,7 +9345,7 @@ case 681:
 				;
     break;}
 case 682:
-#line 3915 "gram.y"
+#line 3916 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9356,7 +9357,7 @@ case 682:
 				;
     break;}
 case 683:
-#line 3925 "gram.y"
+#line 3926 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9368,7 +9369,7 @@ case 683:
 				;
     break;}
 case 684:
-#line 3935 "gram.y"
+#line 3936 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9380,7 +9381,7 @@ case 684:
 				;
     break;}
 case 685:
-#line 3945 "gram.y"
+#line 3946 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9392,7 +9393,7 @@ case 685:
 				;
     break;}
 case 686:
-#line 3955 "gram.y"
+#line 3956 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9404,7 +9405,7 @@ case 686:
 				;
     break;}
 case 687:
-#line 3965 "gram.y"
+#line 3966 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9416,7 +9417,7 @@ case 687:
 				;
     break;}
 case 688:
-#line 3975 "gram.y"
+#line 3976 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-4].node, NULL);
@@ -9428,7 +9429,7 @@ case 688:
 				;
     break;}
 case 689:
-#line 3985 "gram.y"
+#line 3986 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9440,7 +9441,7 @@ case 689:
 				;
     break;}
 case 690:
-#line 3995 "gram.y"
+#line 3996 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9452,7 +9453,7 @@ case 690:
 				;
     break;}
 case 691:
-#line 4005 "gram.y"
+#line 4006 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9464,7 +9465,7 @@ case 691:
 				;
     break;}
 case 692:
-#line 4015 "gram.y"
+#line 4016 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9476,7 +9477,7 @@ case 692:
 				;
     break;}
 case 693:
-#line 4025 "gram.y"
+#line 4026 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9488,7 +9489,7 @@ case 693:
 				;
     break;}
 case 694:
-#line 4035 "gram.y"
+#line 4036 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9500,7 +9501,7 @@ case 694:
 				;
     break;}
 case 695:
-#line 4045 "gram.y"
+#line 4046 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9512,7 +9513,7 @@ case 695:
 				;
     break;}
 case 696:
-#line 4055 "gram.y"
+#line 4056 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node,NIL);
@@ -9524,7 +9525,7 @@ case 696:
 				;
     break;}
 case 697:
-#line 4065 "gram.y"
+#line 4066 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9536,7 +9537,7 @@ case 697:
 				;
     break;}
 case 698:
-#line 4075 "gram.y"
+#line 4076 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9548,7 +9549,7 @@ case 698:
 				;
     break;}
 case 699:
-#line 4085 "gram.y"
+#line 4086 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9560,7 +9561,7 @@ case 699:
 				;
     break;}
 case 700:
-#line 4095 "gram.y"
+#line 4096 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9572,7 +9573,7 @@ case 700:
 				;
     break;}
 case 701:
-#line 4105 "gram.y"
+#line 4106 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9584,7 +9585,7 @@ case 701:
 				;
     break;}
 case 702:
-#line 4115 "gram.y"
+#line 4116 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9596,7 +9597,7 @@ case 702:
 				;
     break;}
 case 703:
-#line 4125 "gram.y"
+#line 4126 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9608,7 +9609,7 @@ case 703:
 				;
     break;}
 case 704:
-#line 4135 "gram.y"
+#line 4136 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->lefthand = lcons(yyvsp[-5].node, NULL);
@@ -9620,34 +9621,34 @@ case 704:
 				;
     break;}
 case 705:
-#line 4145 "gram.y"
+#line 4146 "gram.y"
 {	yyval.node = makeA_Expr(AND, NULL, yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 706:
-#line 4147 "gram.y"
+#line 4148 "gram.y"
 {	yyval.node = makeA_Expr(OR, NULL, yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 707:
-#line 4149 "gram.y"
+#line 4150 "gram.y"
 {	yyval.node = makeA_Expr(NOT, NULL, NULL, yyvsp[0].node); ;
     break;}
 case 708:
-#line 4151 "gram.y"
+#line 4152 "gram.y"
 {	yyval.node = yyvsp[0].node; ;
     break;}
 case 709:
-#line 4160 "gram.y"
+#line 4161 "gram.y"
 {
 					yyvsp[-1].attr->indirection = yyvsp[0].list;
 					yyval.node = (Node *)yyvsp[-1].attr;
 				;
     break;}
 case 710:
-#line 4165 "gram.y"
+#line 4166 "gram.y"
 {	yyval.node = yyvsp[0].node;  ;
     break;}
 case 711:
-#line 4167 "gram.y"
+#line 4168 "gram.y"
 {
 					/* could be a column name or a relation_name */
 					Ident *n = makeNode(Ident);
@@ -9657,39 +9658,39 @@ case 711:
 				;
     break;}
 case 712:
-#line 4175 "gram.y"
+#line 4176 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", NULL, yyvsp[0].node); ;
     break;}
 case 713:
-#line 4177 "gram.y"
+#line 4178 "gram.y"
 {	yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 714:
-#line 4179 "gram.y"
+#line 4180 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 715:
-#line 4181 "gram.y"
+#line 4182 "gram.y"
 {	yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 716:
-#line 4183 "gram.y"
+#line 4184 "gram.y"
 {	yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 717:
-#line 4185 "gram.y"
+#line 4186 "gram.y"
 {	yyval.node = makeA_Expr(OP, ":", NULL, yyvsp[0].node); ;
     break;}
 case 718:
-#line 4187 "gram.y"
+#line 4188 "gram.y"
 {	yyval.node = makeA_Expr(OP, ";", NULL, yyvsp[0].node); ;
     break;}
 case 719:
-#line 4189 "gram.y"
+#line 4190 "gram.y"
 {	yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
     break;}
 case 720:
-#line 4191 "gram.y"
+#line 4192 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-2].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -9707,7 +9708,7 @@ case 720:
 				;
     break;}
 case 721:
-#line 4207 "gram.y"
+#line 4208 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-3].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -9725,23 +9726,23 @@ case 721:
 				;
     break;}
 case 722:
-#line 4223 "gram.y"
+#line 4224 "gram.y"
 {	yyval.node = yyvsp[-1].node; ;
     break;}
 case 723:
-#line 4225 "gram.y"
+#line 4226 "gram.y"
 {	yyval.node = makeIndexable(yyvsp[-1].str,yyvsp[-2].node,yyvsp[0].node);	;
     break;}
 case 724:
-#line 4227 "gram.y"
+#line 4228 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
     break;}
 case 725:
-#line 4229 "gram.y"
+#line 4230 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
     break;}
 case 726:
-#line 4231 "gram.y"
+#line 4232 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-2].str;
@@ -9750,7 +9751,7 @@ case 726:
 				;
     break;}
 case 727:
-#line 4238 "gram.y"
+#line 4239 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-3].str;
@@ -9759,7 +9760,7 @@ case 727:
 				;
     break;}
 case 728:
-#line 4245 "gram.y"
+#line 4246 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9776,7 +9777,7 @@ case 728:
 				;
     break;}
 case 729:
-#line 4260 "gram.y"
+#line 4261 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9793,7 +9794,7 @@ case 729:
 				;
     break;}
 case 730:
-#line 4275 "gram.y"
+#line 4276 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					A_Const *s = makeNode(A_Const);
@@ -9817,7 +9818,7 @@ case 730:
 				;
     break;}
 case 731:
-#line 4297 "gram.y"
+#line 4298 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					TypeName *t = makeNode(TypeName);
@@ -9834,7 +9835,7 @@ case 731:
 				;
     break;}
 case 732:
-#line 4312 "gram.y"
+#line 4313 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					A_Const *s = makeNode(A_Const);
@@ -9858,7 +9859,7 @@ case 732:
 				;
     break;}
 case 733:
-#line 4334 "gram.y"
+#line 4335 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "getpgusername";
@@ -9867,7 +9868,7 @@ case 733:
 				;
     break;}
 case 734:
-#line 4341 "gram.y"
+#line 4342 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "getpgusername";
@@ -9876,7 +9877,7 @@ case 734:
 				;
     break;}
 case 735:
-#line 4348 "gram.y"
+#line 4349 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "strpos";
@@ -9885,7 +9886,7 @@ case 735:
 				;
     break;}
 case 736:
-#line 4355 "gram.y"
+#line 4356 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "substr";
@@ -9894,7 +9895,7 @@ case 736:
 				;
     break;}
 case 737:
-#line 4363 "gram.y"
+#line 4364 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -9903,7 +9904,7 @@ case 737:
 				;
     break;}
 case 738:
-#line 4370 "gram.y"
+#line 4371 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "ltrim";
@@ -9912,7 +9913,7 @@ case 738:
 				;
     break;}
 case 739:
-#line 4377 "gram.y"
+#line 4378 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "rtrim";
@@ -9921,7 +9922,7 @@ case 739:
 				;
     break;}
 case 740:
-#line 4384 "gram.y"
+#line 4385 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -9930,7 +9931,7 @@ case 740:
 				;
     break;}
 case 741:
-#line 4393 "gram.y"
+#line 4394 "gram.y"
 {
 					A_Indices *ai = makeNode(A_Indices);
 					ai->lidx = NULL;
@@ -9939,7 +9940,7 @@ case 741:
 				;
     break;}
 case 742:
-#line 4400 "gram.y"
+#line 4401 "gram.y"
 {
 					A_Indices *ai = makeNode(A_Indices);
 					ai->lidx = yyvsp[-4].node;
@@ -9948,23 +9949,23 @@ case 742:
 				;
     break;}
 case 743:
-#line 4407 "gram.y"
+#line 4408 "gram.y"
 {	yyval.list = NIL; ;
     break;}
 case 744:
-#line 4411 "gram.y"
+#line 4412 "gram.y"
 { yyval.list = lcons(yyvsp[0].node, NIL); ;
     break;}
 case 745:
-#line 4413 "gram.y"
+#line 4414 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node); ;
     break;}
 case 746:
-#line 4415 "gram.y"
+#line 4416 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node); ;
     break;}
 case 747:
-#line 4419 "gram.y"
+#line 4420 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -9973,66 +9974,66 @@ case 747:
 				;
     break;}
 case 748:
-#line 4426 "gram.y"
+#line 4427 "gram.y"
 {	yyval.list = NIL; ;
     break;}
 case 749:
-#line 4429 "gram.y"
+#line 4430 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 750:
-#line 4430 "gram.y"
+#line 4431 "gram.y"
 { yyval.str = "tz_hour"; ;
     break;}
 case 751:
-#line 4431 "gram.y"
+#line 4432 "gram.y"
 { yyval.str = "tz_minute"; ;
     break;}
 case 752:
-#line 4435 "gram.y"
+#line 4436 "gram.y"
 {	yyval.list = makeList(yyvsp[0].node, yyvsp[-2].node, -1); ;
     break;}
 case 753:
-#line 4437 "gram.y"
+#line 4438 "gram.y"
 {	yyval.list = NIL; ;
     break;}
 case 754:
-#line 4441 "gram.y"
+#line 4442 "gram.y"
 {
 					yyvsp[-1].attr->indirection = yyvsp[0].list;
 					yyval.node = (Node *)yyvsp[-1].attr;
 				;
     break;}
 case 755:
-#line 4446 "gram.y"
+#line 4447 "gram.y"
 {	yyval.node = yyvsp[0].node;  ;
     break;}
 case 756:
-#line 4448 "gram.y"
+#line 4449 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", NULL, yyvsp[0].node); ;
     break;}
 case 757:
-#line 4450 "gram.y"
+#line 4451 "gram.y"
 {	yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 758:
-#line 4452 "gram.y"
+#line 4453 "gram.y"
 {	yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 759:
-#line 4454 "gram.y"
+#line 4455 "gram.y"
 {	yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 760:
-#line 4456 "gram.y"
+#line 4457 "gram.y"
 {	yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 761:
-#line 4458 "gram.y"
+#line 4459 "gram.y"
 {	yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
     break;}
 case 762:
-#line 4460 "gram.y"
+#line 4461 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-2].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -10050,7 +10051,7 @@ case 762:
 				;
     break;}
 case 763:
-#line 4476 "gram.y"
+#line 4477 "gram.y"
 {
 					yyval.node = (Node *)yyvsp[-3].node;
 					/* AexprConst can be either A_Const or ParamNo */
@@ -10068,23 +10069,23 @@ case 763:
 				;
     break;}
 case 764:
-#line 4492 "gram.y"
+#line 4493 "gram.y"
 {	yyval.node = yyvsp[-1].node; ;
     break;}
 case 765:
-#line 4494 "gram.y"
+#line 4495 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[-1].str, yyvsp[-2].node, yyvsp[0].node); ;
     break;}
 case 766:
-#line 4496 "gram.y"
+#line 4497 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
     break;}
 case 767:
-#line 4498 "gram.y"
+#line 4499 "gram.y"
 {	yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
     break;}
 case 768:
-#line 4500 "gram.y"
+#line 4501 "gram.y"
 {
 					/* could be a column name or a relation_name */
 					Ident *n = makeNode(Ident);
@@ -10094,7 +10095,7 @@ case 768:
 				;
     break;}
 case 769:
-#line 4508 "gram.y"
+#line 4509 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-2].str;
@@ -10103,7 +10104,7 @@ case 769:
 				;
     break;}
 case 770:
-#line 4515 "gram.y"
+#line 4516 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = yyvsp[-3].str;
@@ -10112,7 +10113,7 @@ case 770:
 				;
     break;}
 case 771:
-#line 4522 "gram.y"
+#line 4523 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "strpos";
@@ -10121,7 +10122,7 @@ case 771:
 				;
     break;}
 case 772:
-#line 4529 "gram.y"
+#line 4530 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "substr";
@@ -10130,7 +10131,7 @@ case 772:
 				;
     break;}
 case 773:
-#line 4537 "gram.y"
+#line 4538 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -10139,7 +10140,7 @@ case 773:
 				;
     break;}
 case 774:
-#line 4544 "gram.y"
+#line 4545 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "ltrim";
@@ -10148,7 +10149,7 @@ case 774:
 				;
     break;}
 case 775:
-#line 4551 "gram.y"
+#line 4552 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "rtrim";
@@ -10157,7 +10158,7 @@ case 775:
 				;
     break;}
 case 776:
-#line 4558 "gram.y"
+#line 4559 "gram.y"
 {
 					FuncCall *n = makeNode(FuncCall);
 					n->funcname = "btrim";
@@ -10166,21 +10167,21 @@ case 776:
 				;
     break;}
 case 777:
-#line 4567 "gram.y"
+#line 4568 "gram.y"
 {
 					yyval.list = nconc(nconc(yyvsp[-2].list,yyvsp[-1].list),yyvsp[0].list);
 				;
     break;}
 case 778:
-#line 4571 "gram.y"
+#line 4572 "gram.y"
 {	yyval.list = NIL; ;
     break;}
 case 779:
-#line 4575 "gram.y"
+#line 4576 "gram.y"
 {	yyval.list = yyvsp[0].list; ;
     break;}
 case 780:
-#line 4577 "gram.y"
+#line 4578 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_Integer;
@@ -10189,27 +10190,27 @@ case 780:
 				;
     break;}
 case 781:
-#line 4586 "gram.y"
+#line 4587 "gram.y"
 {	yyval.list = yyvsp[0].list; ;
     break;}
 case 782:
-#line 4588 "gram.y"
+#line 4589 "gram.y"
 {	yyval.list = NIL; ;
     break;}
 case 783:
-#line 4592 "gram.y"
+#line 4593 "gram.y"
 { yyval.list = lappend(yyvsp[0].list, yyvsp[-2].node); ;
     break;}
 case 784:
-#line 4594 "gram.y"
+#line 4595 "gram.y"
 { yyval.list = yyvsp[0].list; ;
     break;}
 case 785:
-#line 4596 "gram.y"
+#line 4597 "gram.y"
 { yyval.list = yyvsp[0].list; ;
     break;}
 case 786:
-#line 4600 "gram.y"
+#line 4601 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->subselect = yyvsp[0].node;
@@ -10217,21 +10218,21 @@ case 786:
 				;
     break;}
 case 787:
-#line 4606 "gram.y"
+#line 4607 "gram.y"
 {	yyval.node = yyvsp[0].node; ;
     break;}
 case 788:
-#line 4610 "gram.y"
+#line 4611 "gram.y"
 {	yyval.node = makeA_Expr(OP, "=", lfirst(saved_In_Expr), yyvsp[0].node); ;
     break;}
 case 789:
-#line 4612 "gram.y"
+#line 4613 "gram.y"
 {	yyval.node = makeA_Expr(OR, NULL, yyvsp[-2].node,
 						makeA_Expr(OP, "=", lfirst(saved_In_Expr), yyvsp[0].node));
 				;
     break;}
 case 790:
-#line 4618 "gram.y"
+#line 4619 "gram.y"
 {
 					SubLink *n = makeNode(SubLink);
 					n->subselect = yyvsp[0].node;
@@ -10239,21 +10240,21 @@ case 790:
 				;
     break;}
 case 791:
-#line 4624 "gram.y"
+#line 4625 "gram.y"
 {	yyval.node = yyvsp[0].node; ;
     break;}
 case 792:
-#line 4628 "gram.y"
+#line 4629 "gram.y"
 {	yyval.node = makeA_Expr(OP, "<>", lfirst(saved_In_Expr), yyvsp[0].node); ;
     break;}
 case 793:
-#line 4630 "gram.y"
+#line 4631 "gram.y"
 {	yyval.node = makeA_Expr(AND, NULL, yyvsp[-2].node,
 						makeA_Expr(OP, "<>", lfirst(saved_In_Expr), yyvsp[0].node));
 				;
     break;}
 case 794:
-#line 4651 "gram.y"
+#line 4652 "gram.y"
 {
 					CaseExpr *c = makeNode(CaseExpr);
 					c->arg = yyvsp[-3].node;
@@ -10263,7 +10264,7 @@ case 794:
 				;
     break;}
 case 795:
-#line 4659 "gram.y"
+#line 4660 "gram.y"
 {
 					CaseExpr *c = makeNode(CaseExpr);
 					CaseWhen *w = makeNode(CaseWhen);
@@ -10276,7 +10277,7 @@ case 795:
 				;
     break;}
 case 796:
-#line 4670 "gram.y"
+#line 4671 "gram.y"
 {
 					CaseExpr *c = makeNode(CaseExpr);
 					CaseWhen *w;
@@ -10294,15 +10295,15 @@ case 796:
 				;
     break;}
 case 797:
-#line 4688 "gram.y"
+#line 4689 "gram.y"
 { yyval.list = lappend(yyvsp[-1].list, yyvsp[0].node); ;
     break;}
 case 798:
-#line 4690 "gram.y"
+#line 4691 "gram.y"
 { yyval.list = lcons(yyvsp[0].node, NIL); ;
     break;}
 case 799:
-#line 4694 "gram.y"
+#line 4695 "gram.y"
 {
 					CaseWhen *w = makeNode(CaseWhen);
 					w->expr = yyvsp[-2].node;
@@ -10311,22 +10312,22 @@ case 799:
 				;
     break;}
 case 800:
-#line 4702 "gram.y"
+#line 4703 "gram.y"
 { yyval.node = yyvsp[0].node; ;
     break;}
 case 801:
-#line 4703 "gram.y"
+#line 4704 "gram.y"
 { yyval.node = NULL; ;
     break;}
 case 802:
-#line 4707 "gram.y"
+#line 4708 "gram.y"
 {
 					yyvsp[-1].attr->indirection = yyvsp[0].list;
 					yyval.node = (Node *)yyvsp[-1].attr;
 				;
     break;}
 case 803:
-#line 4712 "gram.y"
+#line 4713 "gram.y"
 {
 					/* could be a column name or a relation_name */
 					Ident *n = makeNode(Ident);
@@ -10336,11 +10337,11 @@ case 803:
 				;
     break;}
 case 804:
-#line 4720 "gram.y"
+#line 4721 "gram.y"
 {	yyval.node = NULL; ;
     break;}
 case 805:
-#line 4724 "gram.y"
+#line 4725 "gram.y"
 {
 					yyval.attr = makeNode(Attr);
 					yyval.attr->relname = yyvsp[-2].str;
@@ -10350,7 +10351,7 @@ case 805:
 				;
     break;}
 case 806:
-#line 4732 "gram.y"
+#line 4733 "gram.y"
 {
 					yyval.attr = makeNode(Attr);
 					yyval.attr->relname = NULL;
@@ -10360,27 +10361,27 @@ case 806:
 				;
     break;}
 case 807:
-#line 4742 "gram.y"
+#line 4743 "gram.y"
 { yyval.list = lcons(makeString(yyvsp[0].str), NIL); ;
     break;}
 case 808:
-#line 4744 "gram.y"
+#line 4745 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, makeString(yyvsp[0].str)); ;
     break;}
 case 809:
-#line 4746 "gram.y"
+#line 4747 "gram.y"
 { yyval.list = lappend(yyvsp[-2].list, makeString("*")); ;
     break;}
 case 810:
-#line 4757 "gram.y"
+#line 4758 "gram.y"
 {	yyval.list = lappend(yyvsp[-2].list,yyvsp[0].target);  ;
     break;}
 case 811:
-#line 4759 "gram.y"
+#line 4760 "gram.y"
 {	yyval.list = lcons(yyvsp[0].target, NIL);  ;
     break;}
 case 812:
-#line 4761 "gram.y"
+#line 4762 "gram.y"
 {
 					ResTarget *rt = makeNode(ResTarget);
 					Attr *att = makeNode(Attr);
@@ -10395,7 +10396,7 @@ case 812:
 				;
     break;}
 case 813:
-#line 4776 "gram.y"
+#line 4777 "gram.y"
 {
 					yyval.target = makeNode(ResTarget);
 					yyval.target->name = yyvsp[-3].str;
@@ -10404,7 +10405,7 @@ case 813:
 				;
     break;}
 case 814:
-#line 4783 "gram.y"
+#line 4784 "gram.y"
 {
 					yyval.target = makeNode(ResTarget);
 					yyval.target->name = NULL;
@@ -10413,7 +10414,7 @@ case 814:
 				;
     break;}
 case 815:
-#line 4790 "gram.y"
+#line 4791 "gram.y"
 {
 					Attr *att = makeNode(Attr);
 					att->relname = yyvsp[-2].str;
@@ -10427,15 +10428,15 @@ case 815:
 				;
     break;}
 case 816:
-#line 4809 "gram.y"
+#line 4810 "gram.y"
 {	yyval.list = lappend(yyvsp[-2].list, yyvsp[0].target);  ;
     break;}
 case 817:
-#line 4811 "gram.y"
+#line 4812 "gram.y"
 {	yyval.list = lcons(yyvsp[0].target, NIL);  ;
     break;}
 case 818:
-#line 4816 "gram.y"
+#line 4817 "gram.y"
 {
 					yyval.target = makeNode(ResTarget);
 					yyval.target->name = yyvsp[0].str;
@@ -10444,7 +10445,7 @@ case 818:
 				;
     break;}
 case 819:
-#line 4823 "gram.y"
+#line 4824 "gram.y"
 {
 					yyval.target = makeNode(ResTarget);
 					yyval.target->name = NULL;
@@ -10453,7 +10454,7 @@ case 819:
 				;
     break;}
 case 820:
-#line 4830 "gram.y"
+#line 4831 "gram.y"
 {
 					Attr *att = makeNode(Attr);
 					att->relname = yyvsp[-2].str;
@@ -10467,7 +10468,7 @@ case 820:
 				;
     break;}
 case 821:
-#line 4842 "gram.y"
+#line 4843 "gram.y"
 {
 					Attr *att = makeNode(Attr);
 					att->relname = "*";
@@ -10481,22 +10482,22 @@ case 821:
 				;
     break;}
 case 822:
-#line 4855 "gram.y"
+#line 4856 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 823:
-#line 4856 "gram.y"
+#line 4857 "gram.y"
 { yyval.str = NULL; ;
     break;}
 case 824:
-#line 4860 "gram.y"
+#line 4861 "gram.y"
 {
 					yyval.str = yyvsp[0].str;
 					StrNCpy(saved_relname, yyvsp[0].str, NAMEDATALEN);
 				;
     break;}
 case 825:
-#line 4865 "gram.y"
+#line 4866 "gram.y"
 {
 					/* disallow refs to variable system tables */
 					if (strcmp(LogRelationName, yyvsp[0].str) == 0
@@ -10508,43 +10509,43 @@ case 825:
 				;
     break;}
 case 826:
-#line 4876 "gram.y"
+#line 4877 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 827:
-#line 4877 "gram.y"
+#line 4878 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 828:
-#line 4878 "gram.y"
+#line 4879 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 829:
-#line 4879 "gram.y"
+#line 4880 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 830:
-#line 4880 "gram.y"
+#line 4881 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 831:
-#line 4886 "gram.y"
+#line 4887 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 832:
-#line 4887 "gram.y"
+#line 4888 "gram.y"
 { yyval.str = xlateSqlFunc(yyvsp[0].str); ;
     break;}
 case 833:
-#line 4889 "gram.y"
+#line 4890 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 834:
-#line 4890 "gram.y"
+#line 4891 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 835:
-#line 4896 "gram.y"
+#line 4897 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_Integer;
@@ -10553,7 +10554,7 @@ case 835:
 				;
     break;}
 case 836:
-#line 4903 "gram.y"
+#line 4904 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_Float;
@@ -10562,7 +10563,7 @@ case 836:
 				;
     break;}
 case 837:
-#line 4910 "gram.y"
+#line 4911 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -10571,7 +10572,7 @@ case 837:
 				;
     break;}
 case 838:
-#line 4917 "gram.y"
+#line 4918 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->typename = yyvsp[-1].typnam;
@@ -10581,11 +10582,11 @@ case 838:
 				;
     break;}
 case 839:
-#line 4925 "gram.y"
+#line 4926 "gram.y"
 {	yyval.node = (Node *)yyvsp[0].paramno;  ;
     break;}
 case 840:
-#line 4927 "gram.y"
+#line 4928 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -10597,7 +10598,7 @@ case 840:
 				;
     break;}
 case 841:
-#line 4937 "gram.y"
+#line 4938 "gram.y"
 {
 					A_Const *n = makeNode(A_Const);
 					n->val.type = T_String;
@@ -10609,7 +10610,7 @@ case 841:
 				;
     break;}
 case 842:
-#line 4949 "gram.y"
+#line 4950 "gram.y"
 {
 					yyval.paramno = makeNode(ParamNo);
 					yyval.paramno->number = yyvsp[-1].ival;
@@ -10617,471 +10618,471 @@ case 842:
 				;
     break;}
 case 843:
-#line 4956 "gram.y"
+#line 4957 "gram.y"
 { yyval.ival = yyvsp[0].ival; ;
     break;}
 case 844:
-#line 4957 "gram.y"
+#line 4958 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 845:
-#line 4958 "gram.y"
+#line 4959 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 846:
-#line 4966 "gram.y"
+#line 4967 "gram.y"
 {	yyval.str = xlateSqlType(yyvsp[0].str); ;
     break;}
 case 847:
-#line 4968 "gram.y"
+#line 4969 "gram.y"
 {	yyval.str = xlateSqlType(yyvsp[0].str); ;
     break;}
 case 848:
-#line 4970 "gram.y"
+#line 4971 "gram.y"
 {	yyval.str = xlateSqlType(yyvsp[0].str); ;
     break;}
 case 849:
-#line 4980 "gram.y"
+#line 4981 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 850:
-#line 4981 "gram.y"
+#line 4982 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 851:
-#line 4982 "gram.y"
+#line 4983 "gram.y"
 { yyval.str = "absolute"; ;
     break;}
 case 852:
-#line 4983 "gram.y"
+#line 4984 "gram.y"
 { yyval.str = "action"; ;
     break;}
 case 853:
-#line 4984 "gram.y"
+#line 4985 "gram.y"
 { yyval.str = "after"; ;
     break;}
 case 854:
-#line 4985 "gram.y"
+#line 4986 "gram.y"
 { yyval.str = "aggregate"; ;
     break;}
 case 855:
-#line 4986 "gram.y"
+#line 4987 "gram.y"
 { yyval.str = "backward"; ;
     break;}
 case 856:
-#line 4987 "gram.y"
+#line 4988 "gram.y"
 { yyval.str = "before"; ;
     break;}
 case 857:
-#line 4988 "gram.y"
+#line 4989 "gram.y"
 { yyval.str = "cache"; ;
     break;}
 case 858:
-#line 4989 "gram.y"
+#line 4990 "gram.y"
 { yyval.str = "createdb"; ;
     break;}
 case 859:
-#line 4990 "gram.y"
+#line 4991 "gram.y"
 { yyval.str = "createuser"; ;
     break;}
 case 860:
-#line 4991 "gram.y"
+#line 4992 "gram.y"
 { yyval.str = "cycle"; ;
     break;}
 case 861:
-#line 4992 "gram.y"
+#line 4993 "gram.y"
 { yyval.str = "database"; ;
     break;}
 case 862:
-#line 4993 "gram.y"
+#line 4994 "gram.y"
 { yyval.str = "delimiters"; ;
     break;}
 case 863:
-#line 4994 "gram.y"
+#line 4995 "gram.y"
 { yyval.str = "double"; ;
     break;}
 case 864:
-#line 4995 "gram.y"
+#line 4996 "gram.y"
 { yyval.str = "each"; ;
     break;}
 case 865:
-#line 4996 "gram.y"
+#line 4997 "gram.y"
 { yyval.str = "encoding"; ;
     break;}
 case 866:
-#line 4997 "gram.y"
+#line 4998 "gram.y"
 { yyval.str = "forward"; ;
     break;}
 case 867:
-#line 4998 "gram.y"
+#line 4999 "gram.y"
 { yyval.str = "function"; ;
     break;}
 case 868:
-#line 4999 "gram.y"
+#line 5000 "gram.y"
 { yyval.str = "handler"; ;
     break;}
 case 869:
-#line 5000 "gram.y"
+#line 5001 "gram.y"
 { yyval.str = "increment"; ;
     break;}
 case 870:
-#line 5001 "gram.y"
+#line 5002 "gram.y"
 { yyval.str = "index"; ;
     break;}
 case 871:
-#line 5002 "gram.y"
+#line 5003 "gram.y"
 { yyval.str = "inherits"; ;
     break;}
 case 872:
-#line 5003 "gram.y"
+#line 5004 "gram.y"
 { yyval.str = "insensitive"; ;
     break;}
 case 873:
-#line 5004 "gram.y"
+#line 5005 "gram.y"
 { yyval.str = "instead"; ;
     break;}
 case 874:
-#line 5005 "gram.y"
+#line 5006 "gram.y"
 { yyval.str = "isnull"; ;
     break;}
 case 875:
-#line 5006 "gram.y"
+#line 5007 "gram.y"
 { yyval.str = "key"; ;
     break;}
 case 876:
-#line 5007 "gram.y"
+#line 5008 "gram.y"
 { yyval.str = "language"; ;
     break;}
 case 877:
-#line 5008 "gram.y"
+#line 5009 "gram.y"
 { yyval.str = "lancompiler"; ;
     break;}
 case 878:
-#line 5009 "gram.y"
+#line 5010 "gram.y"
 { yyval.str = "location"; ;
     break;}
 case 879:
-#line 5010 "gram.y"
+#line 5011 "gram.y"
 { yyval.str = "match"; ;
     break;}
 case 880:
-#line 5011 "gram.y"
+#line 5012 "gram.y"
 { yyval.str = "maxvalue"; ;
     break;}
 case 881:
-#line 5012 "gram.y"
+#line 5013 "gram.y"
 { yyval.str = "minvalue"; ;
     break;}
 case 882:
-#line 5013 "gram.y"
+#line 5014 "gram.y"
 { yyval.str = "next"; ;
     break;}
 case 883:
-#line 5014 "gram.y"
+#line 5015 "gram.y"
 { yyval.str = "nocreatedb"; ;
     break;}
 case 884:
-#line 5015 "gram.y"
+#line 5016 "gram.y"
 { yyval.str = "nocreateuser"; ;
     break;}
 case 885:
-#line 5016 "gram.y"
+#line 5017 "gram.y"
 { yyval.str = "nothing"; ;
     break;}
 case 886:
-#line 5017 "gram.y"
+#line 5018 "gram.y"
 { yyval.str = "notnull"; ;
     break;}
 case 887:
-#line 5018 "gram.y"
+#line 5019 "gram.y"
 { yyval.str = "of"; ;
     break;}
 case 888:
-#line 5019 "gram.y"
+#line 5020 "gram.y"
 { yyval.str = "oids"; ;
     break;}
 case 889:
-#line 5020 "gram.y"
+#line 5021 "gram.y"
 { yyval.str = "only"; ;
     break;}
 case 890:
-#line 5021 "gram.y"
+#line 5022 "gram.y"
 { yyval.str = "operator"; ;
     break;}
 case 891:
-#line 5022 "gram.y"
+#line 5023 "gram.y"
 { yyval.str = "option"; ;
     break;}
 case 892:
-#line 5023 "gram.y"
+#line 5024 "gram.y"
 { yyval.str = "password"; ;
     break;}
 case 893:
-#line 5024 "gram.y"
+#line 5025 "gram.y"
 { yyval.str = "prior"; ;
     break;}
 case 894:
-#line 5025 "gram.y"
+#line 5026 "gram.y"
 { yyval.str = "privileges"; ;
     break;}
 case 895:
-#line 5026 "gram.y"
+#line 5027 "gram.y"
 { yyval.str = "procedural"; ;
     break;}
 case 896:
-#line 5027 "gram.y"
+#line 5028 "gram.y"
 { yyval.str = "read"; ;
     break;}
 case 897:
-#line 5028 "gram.y"
+#line 5029 "gram.y"
 { yyval.str = "recipe"; ;
     break;}
 case 898:
-#line 5029 "gram.y"
+#line 5030 "gram.y"
 { yyval.str = "relative"; ;
     break;}
 case 899:
-#line 5030 "gram.y"
+#line 5031 "gram.y"
 { yyval.str = "rename"; ;
     break;}
 case 900:
-#line 5031 "gram.y"
+#line 5032 "gram.y"
 { yyval.str = "returns"; ;
     break;}
 case 901:
-#line 5032 "gram.y"
+#line 5033 "gram.y"
 { yyval.str = "row"; ;
     break;}
 case 902:
-#line 5033 "gram.y"
+#line 5034 "gram.y"
 { yyval.str = "rule"; ;
     break;}
 case 903:
-#line 5034 "gram.y"
+#line 5035 "gram.y"
 { yyval.str = "scroll"; ;
     break;}
 case 904:
-#line 5035 "gram.y"
+#line 5036 "gram.y"
 { yyval.str = "sequence"; ;
     break;}
 case 905:
-#line 5036 "gram.y"
+#line 5037 "gram.y"
 { yyval.str = "serial"; ;
     break;}
 case 906:
-#line 5037 "gram.y"
+#line 5038 "gram.y"
 { yyval.str = "start"; ;
     break;}
 case 907:
-#line 5038 "gram.y"
+#line 5039 "gram.y"
 { yyval.str = "statement"; ;
     break;}
 case 908:
-#line 5039 "gram.y"
+#line 5040 "gram.y"
 { yyval.str = "stdin"; ;
     break;}
 case 909:
-#line 5040 "gram.y"
+#line 5041 "gram.y"
 { yyval.str = "stdout"; ;
     break;}
 case 910:
-#line 5041 "gram.y"
+#line 5042 "gram.y"
 { yyval.str = "time"; ;
     break;}
 case 911:
-#line 5042 "gram.y"
+#line 5043 "gram.y"
 { yyval.str = "timestamp"; ;
     break;}
 case 912:
-#line 5043 "gram.y"
+#line 5044 "gram.y"
 { yyval.str = "timezone_hour"; ;
     break;}
 case 913:
-#line 5044 "gram.y"
+#line 5045 "gram.y"
 { yyval.str = "timezone_minute"; ;
     break;}
 case 914:
-#line 5045 "gram.y"
+#line 5046 "gram.y"
 { yyval.str = "trigger"; ;
     break;}
 case 915:
-#line 5046 "gram.y"
+#line 5047 "gram.y"
 { yyval.str = "trusted"; ;
     break;}
 case 916:
-#line 5047 "gram.y"
+#line 5048 "gram.y"
 { yyval.str = "type"; ;
     break;}
 case 917:
-#line 5048 "gram.y"
+#line 5049 "gram.y"
 { yyval.str = "valid"; ;
     break;}
 case 918:
-#line 5049 "gram.y"
+#line 5050 "gram.y"
 { yyval.str = "version"; ;
     break;}
 case 919:
-#line 5050 "gram.y"
+#line 5051 "gram.y"
 { yyval.str = "zone"; ;
     break;}
 case 920:
-#line 5063 "gram.y"
+#line 5064 "gram.y"
 { yyval.str = yyvsp[0].str; ;
     break;}
 case 921:
-#line 5064 "gram.y"
+#line 5065 "gram.y"
 { yyval.str = "abort"; ;
     break;}
 case 922:
-#line 5065 "gram.y"
+#line 5066 "gram.y"
 { yyval.str = "analyze"; ;
     break;}
 case 923:
-#line 5066 "gram.y"
+#line 5067 "gram.y"
 { yyval.str = "binary"; ;
     break;}
 case 924:
-#line 5067 "gram.y"
+#line 5068 "gram.y"
 { yyval.str = "case"; ;
     break;}
 case 925:
-#line 5068 "gram.y"
+#line 5069 "gram.y"
 { yyval.str = "cluster"; ;
     break;}
 case 926:
-#line 5069 "gram.y"
+#line 5070 "gram.y"
 { yyval.str = "coalesce"; ;
     break;}
 case 927:
-#line 5070 "gram.y"
+#line 5071 "gram.y"
 { yyval.str = "constraint"; ;
     break;}
 case 928:
-#line 5071 "gram.y"
+#line 5072 "gram.y"
 { yyval.str = "copy"; ;
     break;}
 case 929:
-#line 5072 "gram.y"
+#line 5073 "gram.y"
 { yyval.str = "cross"; ;
     break;}
 case 930:
-#line 5073 "gram.y"
+#line 5074 "gram.y"
 { yyval.str = "current"; ;
     break;}
 case 931:
-#line 5074 "gram.y"
+#line 5075 "gram.y"
 { yyval.str = "do"; ;
     break;}
 case 932:
-#line 5075 "gram.y"
+#line 5076 "gram.y"
 { yyval.str = "else"; ;
     break;}
 case 933:
-#line 5076 "gram.y"
+#line 5077 "gram.y"
 { yyval.str = "end"; ;
     break;}
 case 934:
-#line 5077 "gram.y"
+#line 5078 "gram.y"
 { yyval.str = "explain"; ;
     break;}
 case 935:
-#line 5078 "gram.y"
+#line 5079 "gram.y"
 { yyval.str = "extend"; ;
     break;}
 case 936:
-#line 5079 "gram.y"
+#line 5080 "gram.y"
 { yyval.str = "false"; ;
     break;}
 case 937:
-#line 5080 "gram.y"
+#line 5081 "gram.y"
 { yyval.str = "foreign"; ;
     break;}
 case 938:
-#line 5081 "gram.y"
+#line 5082 "gram.y"
 { yyval.str = "group"; ;
     break;}
 case 939:
-#line 5082 "gram.y"
+#line 5083 "gram.y"
 { yyval.str = "listen"; ;
     break;}
 case 940:
-#line 5083 "gram.y"
+#line 5084 "gram.y"
 { yyval.str = "load"; ;
     break;}
 case 941:
-#line 5084 "gram.y"
+#line 5085 "gram.y"
 { yyval.str = "lock"; ;
     break;}
 case 942:
-#line 5085 "gram.y"
+#line 5086 "gram.y"
 { yyval.str = "move"; ;
     break;}
 case 943:
-#line 5086 "gram.y"
+#line 5087 "gram.y"
 { yyval.str = "new"; ;
     break;}
 case 944:
-#line 5087 "gram.y"
+#line 5088 "gram.y"
 { yyval.str = "none"; ;
     break;}
 case 945:
-#line 5088 "gram.y"
+#line 5089 "gram.y"
 { yyval.str = "nullif"; ;
     break;}
 case 946:
-#line 5089 "gram.y"
+#line 5090 "gram.y"
 { yyval.str = "order"; ;
     break;}
 case 947:
-#line 5090 "gram.y"
+#line 5091 "gram.y"
 { yyval.str = "position"; ;
     break;}
 case 948:
-#line 5091 "gram.y"
+#line 5092 "gram.y"
 { yyval.str = "precision"; ;
     break;}
 case 949:
-#line 5092 "gram.y"
+#line 5093 "gram.y"
 { yyval.str = "reset"; ;
     break;}
 case 950:
-#line 5093 "gram.y"
+#line 5094 "gram.y"
 { yyval.str = "setof"; ;
     break;}
 case 951:
-#line 5094 "gram.y"
+#line 5095 "gram.y"
 { yyval.str = "show"; ;
     break;}
 case 952:
-#line 5095 "gram.y"
+#line 5096 "gram.y"
 { yyval.str = "table"; ;
     break;}
 case 953:
-#line 5096 "gram.y"
+#line 5097 "gram.y"
 { yyval.str = "then"; ;
     break;}
 case 954:
-#line 5097 "gram.y"
+#line 5098 "gram.y"
 { yyval.str = "transaction"; ;
     break;}
 case 955:
-#line 5098 "gram.y"
+#line 5099 "gram.y"
 { yyval.str = "true"; ;
     break;}
 case 956:
-#line 5099 "gram.y"
+#line 5100 "gram.y"
 { yyval.str = "vacuum"; ;
     break;}
 case 957:
-#line 5100 "gram.y"
+#line 5101 "gram.y"
 { yyval.str = "verbose"; ;
     break;}
 case 958:
-#line 5101 "gram.y"
+#line 5102 "gram.y"
 { yyval.str = "when"; ;
     break;}
 case 959:
-#line 5105 "gram.y"
+#line 5106 "gram.y"
 {
 					if (QueryIsRule)
 						yyval.str = "*CURRENT*";
@@ -11090,7 +11091,7 @@ case 959:
 				;
     break;}
 case 960:
-#line 5112 "gram.y"
+#line 5113 "gram.y"
 {
 					if (QueryIsRule)
 						yyval.str = "*NEW*";
@@ -11100,7 +11101,7 @@ case 960:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/local/bison/bison.simple"
+#line 498 "/usr/share/misc/bison.simple"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -11296,7 +11297,7 @@ yyerrhandle:
   yystate = yyn;
   goto yynewstate;
 }
-#line 5120 "gram.y"
+#line 5121 "gram.y"
 
 
 static Node *
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 4893b2429dbbad88d29cd51b67338fc9860e5ce6..f960c6b594cd7762b6fbdb47f836b359ab3d9a12 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.46 1999/01/20 19:48:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.47 1999/01/21 16:08:46 vadim Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -2496,6 +2496,7 @@ insert_rest:  VALUES '(' res_target_list2 ')'
 					$$->havingClause = n->havingClause;
 					$$->unionClause = n->unionClause;
 					$$->intersectClause = n->intersectClause;
+					$$->forUpdate = n->forUpdate;
 				}
 		| '(' columnList ')' VALUES '(' res_target_list2 ')'
 				{
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index b931bc744fe816d2ce0a958f01cfaf6fc6632afb..415f94df6d7dc1d7ff0cd49184749d441569976a 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.28 1999/01/18 00:09:54 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.29 1999/01/21 16:08:48 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1799,7 +1799,8 @@ ApplyRetrieveRule(Query *parsetree,
 	Query	   *rule_action = NULL;
 	Node	   *rule_qual;
 	List	   *rtable,
-			   *rt;
+			   *rt,
+			   *l;
 	int			nothing,
 				rt_length;
 	int			badsql = FALSE;
@@ -1834,6 +1835,43 @@ ApplyRetrieveRule(Query *parsetree,
 	rtable = nconc(rtable, copyObject(rule_action->rtable));
 	parsetree->rtable = rtable;
 
+	/* FOR UPDATE of view... */
+	foreach (l, parsetree->rowMark)
+	{
+		if (((RowMark*)lfirst(l))->rti == rt_index)
+			break;
+	}
+	if (l != NULL)	/* oh, hell -:) */
+	{
+		RowMark	   *newrm;
+		Index		rti = 1;
+		List	   *l2;
+
+		/* 
+		 * We believe that rt_index is VIEW - nothing should be
+		 * marked for VIEW, but ACL check must be done.
+		 * As for real tables of VIEW - their rows must be marked, but
+		 * we have to skip ACL check for them.
+		 */
+		((RowMark*)lfirst(l))->info &= ~ROW_MARK_FOR_UPDATE;
+		foreach (l2, rule_action->rtable)
+		{
+			/*
+			 * RTable of VIEW has two entries of VIEW itself -
+			 * we use relid to skip them.
+			 */
+			if (relation->rd_id != ((RangeTblEntry*)lfirst(l2))->relid)
+			{
+				newrm = makeNode(RowMark);
+				newrm->rti = rti + rt_length;
+				newrm->info = ROW_MARK_FOR_UPDATE;
+				lnext(l) = lcons(newrm, lnext(l));
+				l = lnext(l);
+			}
+			rti++;
+		}
+	}
+
 	rule_action->rtable = rtable;
 	OffsetVarNodes((Node *) rule_qual,   rt_length, 0);
 	OffsetVarNodes((Node *) rule_action, rt_length, 0);
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 46ff93d060034a9b1ed001ab6d5edc5860b05ae5..a700a52d33d89d126074527492a608b900119e40 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.37 1999/01/17 03:28:37 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.38 1999/01/21 16:08:51 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,6 +63,9 @@
 #include "utils/builtins.h"		/* for ftod() prototype */
 #include "utils/palloc.h"
 
+#ifndef NAN
+#define NAN		(0.0/0.0)
+#endif
 
 #ifndef SHRT_MAX
 #define SHRT_MAX 32767
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 5b9237c5f0ef74c29bc86af0d7db9c947c16316c..6482fd66fbd1a92406c4519568c16ed65f2425d9 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodes.h,v 1.33 1998/12/18 09:09:53 vadim Exp $
+ * $Id: nodes.h,v 1.34 1999/01/21 16:08:53 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -216,7 +216,8 @@ typedef enum NodeTag
 	T_SubSelect,
 	T_JoinUsing,
 	T_CaseExpr,
-	T_CaseWhen
+	T_CaseWhen,
+	T_RowMark
 } NodeTag;
 
 /*
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index d71d8c6b1e5187516c59547b95e54f4e275041bd..0e6c8e5068bc49a3fa1f64da4544c86a0ff5ad21 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.66 1999/01/18 00:10:06 momjian Exp $
+ * $Id: parsenodes.h,v 1.67 1999/01/21 16:08:55 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,7 @@ typedef struct Query
 	List	   *rtable;			/* list of range table entries */
 	List	   *targetList;		/* target list (of TargetEntry) */
 	Node	   *qual;			/* qualifications */
+	List	   *rowMark;		/* list of RowMark entries */
 
 	List	   *groupClause;	/* list of columns to specified in GROUP
 								 * BY */
@@ -608,9 +609,10 @@ typedef struct InsertStmt
 	List	   *groupClause;	/* group by clause */
 	Node	   *havingClause;	/* having conditional-expression */
 	List	   *unionClause;	/* union subselect parameters */
-	bool	   unionall;		/* union without unique sort */
-        /***S*I***/
-        List       *intersectClause;  
+	bool		unionall;		/* union without unique sort */
+	/***S*I***/
+	List	   *intersectClause;  
+	List	   *forUpdate;		/* FOR UPDATE clause */
 } InsertStmt;
 
 /* ----------------------
@@ -651,10 +653,10 @@ typedef struct SelectStmt
 	Node	   *whereClause;	/* qualifications */
 	List	   *groupClause;	/* group by clause */
 	Node	   *havingClause;	/* having conditional-expression */
-        /***S*I***/
-        List       *intersectClause;
-        List       *exceptClause;
-  
+	/***S*I***/
+	List	   *intersectClause;
+	List	   *exceptClause;
+
 	List	   *unionClause;	/* union subselect parameters */
 	List	   *sortClause;		/* sort clause (a list of SortGroupBy's) */
 	char	   *portalname;		/* the portal (cursor) to create */
@@ -958,4 +960,14 @@ typedef struct GroupClause
 	Oid			grpOpoid;		/* the sort operator to use */
 } GroupClause;
 
+#define	ROW_MARK_FOR_UPDATE		(1 << 0)
+#define	ROW_ACL_FOR_UPDATE		(1 << 1)
+
+typedef struct RowMark
+{
+	NodeTag	type;
+	Index	rti;		/* index in Query->rtable */
+	bits8	info;		/* as above */
+} RowMark;
+
 #endif	 /* PARSENODES_H */