From 598e86f3b30bfd343dfa5c3b9a310dbd91a96413 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 26 Nov 1997 01:14:33 +0000
Subject: [PATCH] Cleanup up include files.

---
 src/backend/catalog/heap.c                 |   4 +-
 src/backend/executor/execTuples.c          |   8 +-
 src/backend/parser/analyze.c               |   6 +-
 src/backend/parser/keywords.c              |   6 +-
 src/backend/parser/parse_agg.c             |  19 +-
 src/backend/parser/parse_clause.c          |  32 +-
 src/backend/parser/parse_expr.c            |  24 +-
 src/backend/parser/parse_func.c            |  29 +-
 src/backend/parser/parse_node.c            |  20 +-
 src/backend/parser/parse_oper.c            |  51 +--
 src/backend/parser/parse_relation.c        |  27 +-
 src/backend/parser/parse_target.c          |  29 +-
 src/backend/parser/parse_type.c            |  43 +-
 src/backend/parser/parser.c                |  15 +-
 src/backend/parser/scan.c                  | 468 ++++++++++-----------
 src/backend/parser/scansup.c               |   5 +-
 src/include/access/rtscan.h                |   7 +-
 src/include/access/rtstrat.h               |   6 +-
 src/include/commands/creatinh.h            |   4 +-
 src/include/commands/explain.h             |   5 +-
 src/include/commands/recipe.h              |   4 +-
 src/include/commands/sequence.h            |   2 +
 src/include/commands/trigger.h             |   1 +
 src/include/commands/view.h                |   4 +-
 src/include/executor/execFlatten.h         |   6 +-
 src/include/executor/functions.h           |   7 +-
 src/include/executor/nodeAgg.h             |   6 +-
 src/include/executor/nodeAppend.h          |   6 +-
 src/include/executor/nodeGroup.h           |   6 +-
 src/include/executor/nodeHashjoin.h        |  10 +-
 src/include/executor/nodeIndexscan.h       |  14 +-
 src/include/executor/nodeMaterial.h        |   6 +-
 src/include/executor/nodeMergejoin.h       |   9 +-
 src/include/executor/nodeNestloop.h        |   6 +-
 src/include/executor/nodeResult.h          |   6 +-
 src/include/executor/nodeSeqscan.h         |   6 +-
 src/include/executor/nodeSort.h            |   6 +-
 src/include/executor/nodeTee.h             |   6 +-
 src/include/executor/nodeUnique.h          |   6 +-
 src/include/nodes/readfuncs.h              |   4 +-
 src/include/optimizer/clauseinfo.h         |   5 +-
 src/include/optimizer/cost.h               |   7 +-
 src/include/optimizer/geqo.h               |   6 +-
 src/include/optimizer/geqo_copy.h          |   3 +-
 src/include/optimizer/geqo_gene.h          |   8 +-
 src/include/optimizer/geqo_misc.h          |   6 +-
 src/include/optimizer/geqo_mutation.h      |   3 +-
 src/include/optimizer/geqo_pool.h          |   3 +-
 src/include/optimizer/geqo_recombination.h |   3 +-
 src/include/optimizer/geqo_selection.h     |   3 +-
 src/include/optimizer/joininfo.h           |   6 +-
 src/include/optimizer/keys.h               |   5 +-
 src/include/optimizer/pathnode.h           |   6 +-
 src/include/optimizer/paths.h              |   6 +-
 src/include/optimizer/planmain.h           |   6 +-
 src/include/optimizer/planner.h            |   6 +-
 src/include/optimizer/tlist.h              |   6 +-
 src/include/optimizer/var.h                |   5 +-
 src/include/parser/analyze.h               |   4 +-
 src/include/parser/parse_agg.h             |  25 +-
 src/include/parser/parse_clause.h          |  19 +-
 src/include/parser/parse_expr.h            |  19 +-
 src/include/parser/parse_func.h            |  48 +--
 src/include/parser/parse_node.h            |  25 +-
 src/include/parser/parse_oper.h            |  32 +-
 src/include/parser/parse_relation.h        |  40 +-
 src/include/parser/parse_target.h          |  16 +-
 src/include/parser/parse_type.h            |  34 +-
 src/include/parser/parser.h                |   4 +-
 src/include/parser/scansup.h               |   7 +-
 src/include/rewrite/rewriteDefine.h        |   4 +-
 src/include/rewrite/rewriteHandler.h       |   4 +-
 src/include/rewrite/rewriteManip.h         |   6 +-
 src/include/rewrite/rewriteSupport.h       |   4 +-
 src/include/utils/lselect.h                |   6 +-
 75 files changed, 586 insertions(+), 733 deletions(-)

diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 512e2a0fe31..c7806862ba8 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.34 1997/11/25 21:58:40 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.35 1997/11/26 01:10:46 momjian Exp $
  *
  * INTERFACE ROUTINES
  *		heap_creatr()			- Create an uncataloged heap relation
@@ -1528,7 +1528,7 @@ start:;
 		{
 			if (*cast != 0)
 				elog(WARN, "DEFAULT: const type mismatched");
-			sprintf(cast, ":: %s", get_id_typname(atp->atttypid));
+			sprintf(cast, ":: %s", typeidTypeName(atp->atttypid));
 			goto start;
 		}
 	}
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index d541f29d9ec..8debd9c5c71 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.11 1997/11/25 21:59:16 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.12 1997/11/26 01:10:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -988,7 +988,7 @@ ExecTypeFromTL(List *targetList)
 							   resdom->resno,
 							   resdom->resname,
 			/* fix for SELECT NULL ... */
-						  get_id_typname(restype ? restype : UNKNOWNOID),
+						  typeidTypeName(restype ? restype : UNKNOWNOID),
 							   0,
 							   false);
 
@@ -1021,7 +1021,7 @@ ExecTypeFromTL(List *targetList)
 			TupleDescInitEntry(typeInfo,
 							   fjRes->resno,
 							   fjRes->resname,
-							   get_id_typname(restype),
+							   typeidTypeName(restype),
 							   0,
 							   false);
 /*
@@ -1044,7 +1044,7 @@ ExecTypeFromTL(List *targetList)
 				TupleDescInitEntry(typeInfo,
 								   fjRes->resno,
 								   fjRes->resname,
-								   get_id_typname(restype),
+								   typeidTypeName(restype),
 								   0,
 								   false);
 
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 4a3800a8a4e..30bdd9c0627 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.50 1997/11/25 22:00:27 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.51 1997/11/26 01:11:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,18 +15,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "postgres.h"
 
+#include "postgres.h"
 #include "access/heapam.h"
 #include "nodes/makefuncs.h"
 #include "nodes/memnodes.h"
 #include "nodes/pg_list.h"
 #include "parser/analyze.h"
 #include "parser/parse_agg.h"
+#include "parser/parse_clause.h"
 #include "parser/parse_node.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_target.h"
-#include "parser/parse_clause.h"
 #include "utils/builtins.h"
 #include "utils/mcxt.h"
 
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index 1c4b63c44ef..0e17dc12246 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -7,16 +7,16 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.25 1997/11/25 22:05:32 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.26 1997/11/26 01:11:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <ctype.h>
 #include <string.h>
-#include "postgres.h"
 
-#include "nodes/pg_list.h"
+#include "postgres.h"
 #include "nodes/parsenodes.h"
+#include "nodes/pg_list.h"
 #include "parse.h"
 #include "parser/keywords.h"
 #include "utils/elog.h"
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index b64b92079ef..33e7f677a99 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.1 1997/11/25 22:05:34 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.2 1997/11/26 01:11:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,23 +27,6 @@
 #include "parser/parse_target.h"
 #include "utils/syscache.h"
 
-#ifdef 0
-#include "nodes/nodes.h"
-#include "nodes/params.h"
-#include "parse.h"				/* for AND, OR, etc. */
-#include "catalog/pg_type.h"	/* for INT4OID, etc. */
-#include "catalog/pg_proc.h"
-#include "utils/elog.h"
-#include "utils/builtins.h"		/* namecmp(), textout() */
-#include "utils/lsyscache.h"
-#include "utils/palloc.h"
-#include "utils/mcxt.h"
-#include "utils/acl.h"
-#include "nodes/makefuncs.h"	/* for makeResdom(), etc. */
-#include "commands/sequence.h"
-
-#endif
-
 /*
  * AddAggToParseState -
  *	  add the aggregate to the list of unique aggregates in pstate.
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 8e08e00a2ea..3f419716d80 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -7,49 +7,23 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.1 1997/11/25 22:05:35 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.2 1997/11/26 01:11:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #include "postgres.h"
 #include "access/heapam.h"
+#include "catalog/pg_type.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_expr.h"
 #include "parser/parse_node.h"
 #include "parser/parse_oper.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_target.h"
-#include "catalog/pg_type.h"
-
-#ifdef 0
-#include "nodes/nodes.h"
-#include "nodes/params.h"
-#include "nodes/primnodes.h"
-#include "nodes/parsenodes.h"
-#include "nodes/relation.h"
-#include "parse.h"				/* for AND, OR, etc. */
-#include "catalog/pg_aggregate.h"
-#include "catalog/pg_proc.h"
-#include "utils/elog.h"
-#include "utils/builtins.h"		/* namecmp(), textout() */
-#include "utils/lsyscache.h"
-#include "utils/palloc.h"
-#include "utils/mcxt.h"
-#include "utils/syscache.h"
-#include "utils/acl.h"
-#include "nodes/makefuncs.h"	/* for makeResdom(), etc. */
-#include "nodes/nodeFuncs.h"
-#include "commands/sequence.h"
-
-#include "optimizer/clauses.h"
-
-#include "miscadmin.h"
-
-#include "port-protos.h"		/* strdup() */
-#endif
 
 /*
  * parseFromClause -
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index fe00b2b48ac..5828fbb9740 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.1 1997/11/25 22:05:39 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.2 1997/11/26 01:11:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,34 +21,14 @@
 #include "nodes/nodes.h"
 #include "nodes/params.h"
 #include "nodes/relation.h"
+#include "parse.h"
 #include "parser/parse_expr.h"
 #include "parser/parse_func.h"
 #include "parser/parse_node.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_target.h"
-#include "parse.h"
 #include "utils/builtins.h"
 
-#ifdef 0
-#include "nodes/primnodes.h"
-#include "nodes/parsenodes.h"
-#include "catalog/pg_aggregate.h"
-#include "catalog/pg_proc.h"
-#include "utils/elog.h"
-#include "utils/lsyscache.h"
-#include "utils/palloc.h"
-#include "utils/mcxt.h"
-#include "utils/syscache.h"
-#include "utils/acl.h"
-#include "nodes/nodeFuncs.h"
-#include "commands/sequence.h"
-
-#include "optimizer/clauses.h"
-#include "access/heapam.h"
-
-#include "miscadmin.h"
-#endif
-
 Oid param_type(int t); /* from gram.y */
 
 /*
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index bb2a7773fdd..1583dc56f0c 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -7,14 +7,13 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.1 1997/11/25 22:05:41 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.2 1997/11/26 01:11:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <string.h>
+
 #include "postgres.h"
-#include "fmgr.h"
-#include "miscadmin.h"
 #include "access/genam.h"
 #include "access/heapam.h"
 #include "access/itup.h"
@@ -25,7 +24,9 @@
 #include "catalog/pg_inherits.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_type.h"
+#include "fmgr.h"
 #include "lib/dllist.h"
+#include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/relation.h"
 #include "parser/parse_agg.h"
@@ -41,28 +42,6 @@
 #include "utils/lsyscache.h"
 #include "utils/syscache.h"
 
-#ifdef 0
-#include "utils/datum.h"
-
-#include "utils/elog.h"
-#include "utils/palloc.h"
-
-#include "nodes/pg_list.h"
-#include "nodes/parsenodes.h"
-
-#include "catalog/pg_operator.h"
-#include "catalog/catname.h"
-
-#include "access/skey.h"
-#include "access/tupdesc.h"
-#include "access/htup.h"
-#include "access/genam.h"
-#include "access/itup.h"
-#include "access/tupmacs.h"
-
-#include "storage/buf.h"
-#endif
-
 #define ISCOMPLEX(type) (typeidTypeRelid(type) ? true : false)
 
 #define MAXFARGS 8				/* max # args to a c or postquel function */
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index c06e00888b9..574bce472c2 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.1 1997/11/25 22:05:42 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.2 1997/11/26 01:11:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,33 +15,19 @@
 #include <string.h>
 
 #include "postgres.h"
-#include "fmgr.h"
 #include "access/heapam.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_type.h"
+#include "fmgr.h"
 #include "nodes/makefuncs.h"
 #include "parser/parse_expr.h"
-#include "parser/parse_oper.h"
 #include "parser/parse_node.h"
+#include "parser/parse_oper.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_type.h"
 #include "utils/builtins.h"
 #include "utils/syscache.h"
 
-#ifdef 0
-#include "access/tupmacs.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/acl.h"			/* for ACL_NO_PRIV_WARNING */
-#include "utils/rel.h"			/* Relation stuff */
-
-#include "utils/syscache.h"
-
-#include "nodes/pg_list.h"
-#include "nodes/primnodes.h"
-#include "nodes/parsenodes.h"
-#endif
-
 /*
  * make_parsestate() --
  *	  allocate and initialize a new ParseState.
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index d82a46bc2f1..e3932806f3d 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -7,55 +7,24 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.1 1997/11/25 22:05:43 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.2 1997/11/26 01:11:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <string.h>
+
 #include "postgres.h"
 #include <fmgr.h>
-
-#include <access/heapam.h>
-#include <access/relscan.h>
-#include <catalog/catname.h>
-#include <catalog/pg_operator.h>
-#include <catalog/pg_proc.h>
-#include <catalog/pg_type.h>
-#include <parser/parse_oper.h>
-#include <parser/parse_type.h>
-#include <storage/bufmgr.h>
-#include <utils/syscache.h>
-
-#ifdef 0
-#include "lib/dllist.h"
-#include "utils/datum.h"
-
-#include "utils/builtins.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-
-#include "nodes/pg_list.h"
-#include "nodes/parsenodes.h"
-
-#include "catalog/pg_inherits.h"
+#include "access/heapam.h"
+#include "access/relscan.h"
+#include "catalog/catname.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_proc.h"
-#include "catalog/indexing.h"
-#include "catalog/catname.h"
-
-#include "access/skey.h"
-#include "access/relscan.h"
-#include "access/tupdesc.h"
-#include "access/htup.h"
-#include "access/genam.h"
-#include "access/itup.h"
-#include "access/tupmacs.h"
-#include "storage/buf.h"
-#include "utils/lsyscache.h"
-#include "storage/lmgr.h"
-
-#include "port-protos.h"		/* strdup() */
-#endif
+#include "catalog/pg_type.h"
+#include "parser/parse_oper.h"
+#include "parser/parse_type.h"
+#include "storage/bufmgr.h"
+#include "utils/syscache.h"
 
 Oid
 any_ordering_op(int restype)
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index dd3fa2787a1..7f550c6b85e 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.1 1997/11/25 22:05:45 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.2 1997/11/26 01:11:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -16,28 +16,13 @@
 
 #include "postgres.h"
 #include "access/heapam.h"
-#include <access/htup.h>
-#include <catalog/pg_type.h>
+#include "access/htup.h"
+#include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
-#include <parser/parse_relation.h>
-#include <utils/acl.h>
+#include "parser/parse_relation.h"
+#include "utils/acl.h"
 #include "utils/builtins.h"
-#include <utils/lsyscache.h>
-
-#ifdef 0
-#include "fmgr.h"
-#include "access/tupmacs.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/acl.h"			/* for ACL_NO_PRIV_WARNING */
-
-#include "utils/syscache.h"
-#include "catalog/pg_operator.h"
-
-#include "nodes/pg_list.h"
-#include "nodes/primnodes.h"
-#include "nodes/parsenodes.h"
-#endif
+#include "utils/lsyscache.h"
 
 struct
 {
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index f29aa49d342..e2aff8c87dc 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -7,47 +7,24 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.1 1997/11/25 22:05:47 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.2 1997/11/26 01:11:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #include "postgres.h"
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
 #include "nodes/primnodes.h"
 #include "parser/parse_expr.h"
+#include "parser/parse_node.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_target.h"
-#include "parser/parse_node.h"
 #include "utils/builtins.h"
 
-#ifdef 0
-#include "nodes/nodes.h"
-#include "nodes/params.h"
-#include "nodes/parsenodes.h"
-#include "nodes/relation.h"
-#include "parse.h"				/* for AND, OR, etc. */
-#include "catalog/pg_aggregate.h"
-#include "catalog/pg_proc.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/mcxt.h"
-#include "utils/syscache.h"
-#include "utils/acl.h"
-#include "nodes/nodeFuncs.h"
-#include "commands/sequence.h"
-
-#include "optimizer/clauses.h"
-#include "access/heapam.h"
-
-#include "miscadmin.h"
-
-#include "port-protos.h"		/* strdup() */
-#endif
-
 /*
  * transformTargetList -
  *	  turns a list of ResTarget's into a list of TargetEntry's
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index 67632cdab6f..c20b042de96 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.1 1997/11/25 22:05:51 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.2 1997/11/26 01:11:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,46 +15,11 @@
 #include "postgres.h"
 #include "fmgr.h"
 
-#include <catalog/pg_type.h>
-#include <parser/parse_target.h>
-#include <parser/parse_type.h>
+#include "catalog/pg_type.h"
+#include "parser/parse_target.h"
+#include "parser/parse_type.h"
 #include "utils/syscache.h"
 
-#ifdef 0
-#include "lib/dllist.h"
-#include "utils/datum.h"
-
-#include "utils/builtins.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-
-#include "nodes/pg_list.h"
-#include "nodes/parsenodes.h"
-#include "catalog/catname.h"
-
-#include "catalog/pg_inherits.h"
-#include "catalog/pg_operator.h"
-#include "catalog/pg_proc.h"
-#include "catalog/indexing.h"
-#include "catalog/catname.h"
-
-#include "access/skey.h"
-#include "access/relscan.h"
-#include "access/tupdesc.h"
-#include "access/htup.h"
-#include "access/heapam.h"
-#include "access/genam.h"
-#include "access/itup.h"
-#include "access/tupmacs.h"
-
-#include "storage/buf.h"
-#include "storage/bufmgr.h"
-#include "utils/lsyscache.h"
-#include "storage/lmgr.h"
-
-#include "port-protos.h"		/* strdup() */
-#endif
-
 /* check to see if a type id is valid,
  * returns true if it is. By using this call before calling
  * typeidType or typeidTypeName, more meaningful error messages
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index ea309c3c28e..4bdecfa2124 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.29 1997/11/25 22:05:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.30 1997/11/26 01:11:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,19 +15,10 @@
 
 #include "postgres.h"
 #include "nodes/pg_list.h"
-#include "parser/parser.h"
 #include "parser/analyze.h"
-#include "parser/parse_node.h"
-
-void	init_io();		/* from scan.l */
-void	parser_init(Oid *typev, int nargs); /* from gram.y */
-int 	yyparse();		/* from gram.c */
-
-#ifdef 0
-#include "parser/parse.h"
 #include "parser/gramparse.h"
-#include "utils/palloc.h"
-#endif
+#include "parser/parse_node.h"
+#include "parser/parser.h"
 
 char	   *parseString;		/* the char* which holds the string to be
 								 * parsed */
diff --git a/src/backend/parser/scan.c b/src/backend/parser/scan.c
index fc12bad8998..cc9aaac646b 100644
--- a/src/backend/parser/scan.c
+++ b/src/backend/parser/scan.c
@@ -1,7 +1,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.2 1997/11/17 16:33:21 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.3 1997/11/26 01:11:38 momjian Exp $
  */
 
 #define FLEX_SCANNER
@@ -284,47 +284,46 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
 	*yy_cp = '\0'; \
 	yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 41
-#define YY_END_OF_BUFFER 42
-static yyconst short int yy_acclist[173] =
+#define YY_NUM_RULES 40
+#define YY_END_OF_BUFFER 41
+static yyconst short int yy_acclist[163] =
     {   0,
        10,   10,    6,    6,   24,   24,    9,    9,   18,   18,
-       25,   25,   42,   40,   41,   39,   40,   41,   39,   41,
-       32,   40,   41,   22,   40,   41,   30,   32,   40,   41,
-       15,   40,   41,   30,   40,   41,   30,   32,   40,   41,
-       30,   32,   40,   41,   30,   32,   40,   41,   36,   40,
-       41,16418,   30,   32,   40,   41,   38,   40,   41,   38,
-       40,   41,   38,   40,   41,   38,   40,   41,   10,   41,
-        8,   41,    3,    6,   41,    3,    6,   41,    3,   41,
-        6,   41,   24,   41,   23,   41,    9,   41,   14,   41,
-       18,   41,   16,   41,   41,   41,   25,   41,   26,   41,
-
-       32,   32,   32,   33,   32,   32,   36,16418,    4,   32,
-       32,   28,   32,   38,    7,   38,   13,   10,    6,    6,
-        5,   24,    9,   18,   17,   20,   19,   20,   25,   31,
-       29,   31,   29,   31,   33,   29,    1,   32,   32,   29,
-       31,    4,   32,    4,   32,    4,   32, 8226,   37,16419,
-       38,   12,    5,   11,   21,   31,    2,    4,   32,   31,
-       38,    2,    2,    2, 8227,   37,16419,   27,   38,    2,
-       27,   38
+       25,   25,   41,   39,   40,   38,   39,   40,   38,   40,
+       31,   39,   40,   22,   39,   40,   29,   31,   39,   40,
+       15,   39,   40,   29,   39,   40,   29,   31,   39,   40,
+       29,   31,   39,   40,   29,   31,   39,   40,   35,   39,
+       40,16417,   29,   31,   39,   40,   37,   39,   40,   37,
+       39,   40,   37,   39,   40,   10,   40,    8,   40,    3,
+        6,   40,    3,    6,   40,    3,   40,    6,   40,   24,
+       40,   23,   40,    9,   40,   14,   40,   18,   40,   16,
+       40,   40,   40,   25,   40,   26,   40,   31,   31,   31,
+
+       32,   31,   31,   35,16417,    4,   31,   31,   27,   31,
+       37,    7,   13,   10,    6,    6,    5,   24,    9,   18,
+       17,   20,   19,   20,   25,   30,   28,   30,   28,   30,
+       32,   28,    1,   31,   31,   28,   30,    4,   31,    4,
+       31,    4,   31, 8225,   36,16418,   12,    5,   11,   21,
+       30,    2,    4,   31,   30,    2,    2,    2, 8226,   36,
+    16418,    2
     } ;
 
-static yyconst short int yy_accept[131] =
+static yyconst short int yy_accept[125] =
     {   0,
         1,    1,    1,    2,    3,    4,    5,    6,    7,    8,
         9,   10,   11,   12,   13,   14,   16,   19,   21,   24,
        27,   31,   34,   37,   41,   45,   49,   53,   57,   60,
-       63,   66,   69,   71,   73,   76,   79,   81,   83,   85,
-       87,   89,   91,   93,   95,   96,   97,   99,  101,  102,
-      103,  104,  105,  105,  106,  107,  109,  111,  112,  112,
-      112,  112,  114,  115,  116,  117,  118,  119,  119,  119,
-      120,  121,  121,  121,  122,  123,  124,  124,  124,  125,
-      125,  125,  126,  127,  129,  130,  131,  133,  136,  137,
-      137,  138,  139,  140,  142,  142,  144,  146,  148,  149,
-
-      151,  152,  152,  152,  153,  154,  154,  154,  155,  155,
-      155,  156,  157,  157,  160,  161,  161,  161,  161,  162,
-      163,  164,  165,  166,  166,  168,  170,  171,  173,  173
+       63,   66,   68,   70,   73,   76,   78,   80,   82,   84,
+       86,   88,   90,   92,   93,   94,   96,   98,   99,  100,
+      101,  102,  102,  103,  104,  106,  108,  109,  109,  109,
+      109,  111,  112,  113,  114,  115,  115,  115,  116,  117,
+      117,  117,  118,  119,  120,  120,  120,  121,  121,  121,
+      122,  123,  125,  126,  127,  129,  132,  133,  133,  134,
+      135,  136,  138,  138,  140,  142,  144,  145,  147,  147,
+
+      147,  148,  149,  149,  149,  150,  150,  150,  151,  152,
+      152,  155,  156,  156,  156,  156,  157,  158,  159,  160,
+      160,  162,  163,  163
     } ;
 
 static yyconst int yy_ec[256] =
@@ -337,11 +336,11 @@ static yyconst int yy_ec[256] =
        14,   14,   14,   14,   14,   14,   14,   15,    8,   16,
        16,   16,    4,    4,   17,   18,   17,   17,   19,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
-       17,   17,   20,   17,   17,   17,   17,   21,   22,   17,
-        8,   23,    8,    4,   24,    4,   17,   18,   17,   17,
+       17,   17,   17,   17,   17,   17,   17,   20,   17,   17,
+        8,   21,    8,    4,   17,    4,   17,   18,   17,   17,
 
        19,   17,   17,   17,   17,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,   17,   17,   17,   17,   17,   21,
+       17,   17,   17,   17,   17,   17,   17,   17,   17,   20,
        17,   17,    1,   16,    1,    4,    1,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
@@ -359,153 +358,153 @@ static yyconst int yy_ec[256] =
        17,   17,   17,   17,   17
     } ;
 
-static yyconst int yy_meta[25] =
+static yyconst int yy_meta[22] =
     {   0,
         1,    1,    2,    3,    4,    3,    5,    1,    6,    7,
         7,    8,    3,    9,    3,    3,   10,   10,    9,   10,
-       10,   10,   11,   10
+       11
     } ;
 
-static yyconst short int yy_base[150] =
+static yyconst short int yy_base[142] =
     {   0,
-        0,    0,  395,  394,   21,   34,  376,  358,  345,  333,
-       19,   28,   50,   52,  334,  403,  403,  403,  322,  403,
-       45,  403,  315,  303,   46,   53,   65,   18,    0,  298,
-      282,  193,    0,   67,    0,   76,   62,    0,    0,  403,
-        0,   70,    0,   81,  190,  403,   91,  403,  182,   84,
-       27,  172,   34,  153,   98,    0,  119,  112,  134,    0,
-      147,  144,    0,  403,  129,  403,    0,  136,  139,    0,
-        0,   65,  131,  141,    0,    0,  145,  149,    0,  151,
-      155,  403,  403,  403,  157,  403,  403,  113,  403,  159,
-      403,  119,  152,    0,   88,  172,   77,  165,  403,  187,
-
-       57,  189,  192,  403,  200,  202,  205,  403,  208,  211,
-      403,    0,  171,  214,   56,  217,    0,  211,   44,  221,
-      224,  229,  403,   14,  215,    0,  233,    0,  403,  236,
-      247,  258,  269,  280,  291,  300,  299,  309,  320,  329,
-      336,  347,  358,  368,  379,  384,  387,  388,  390
+        0,    0,  323,  311,   18,   31,  304,  303,  232,  224,
+       18,   29,   46,   49,  221,  401,  401,  401,  204,  401,
+       12,  401,  196,  189,   42,   50,   62,   43,    0,  186,
+      164,    0,   64,    0,   73,   59,    0,    0,  401,    0,
+       67,    0,   78,  154,  401,   88,  401,  144,   81,   18,
+      135,   31,  129,   95,    0,  113,  106,  128,    0,  120,
+      110,    0,  401,  401,    0,  130,  133,    0,    0,   62,
+       85,  135,    0,    0,  139,  143,    0,  145,  149,  401,
+      401,  401,  151,  401,  401,   73,  401,  153,  401,  166,
+      113,    0,   69,  179,   49,  146,  401,  194,  171,  184,
+
+      401,  196,  199,  207,  401,  209,  215,  401,    0,  171,
+      201,   46,  217,    0,  213,  223,  227,  231,  401,   24,
+      221,  235,  401,  240,  251,  262,  273,  284,  295,  304,
+      303,  313,  324,  333,  340,  351,  362,  372,  383,  388,
+      391
     } ;
 
-static yyconst short int yy_def[150] =
+static yyconst short int yy_def[142] =
     {   0,
-      129,    1,  130,  130,  131,  131,  132,  132,  133,  133,
-      134,  134,  135,  135,  129,  129,  129,  129,  136,  129,
-      136,  129,  129,  136,  136,  136,  129,  136,  137,  137,
-      137,  137,  138,  129,  139,  139,  140,   36,  141,  129,
-      142,  129,  143,  129,  144,  129,  129,  129,  136,  136,
-       50,  129,  129,   51,  129,   27,  145,   55,  129,  146,
-      129,  136,  137,  129,  137,  129,  138,  129,  129,  139,
-       36,  140,  140,  140,  141,  142,  129,  129,  143,  129,
-      129,  129,  129,  129,  129,  129,  129,  129,  129,   55,
-      129,   55,   55,   90,  145,  145,   96,   96,  129,  129,
-
-      137,  129,  129,  129,  129,  129,  129,  129,  129,  129,
-      129,   90,  145,   96,  145,  129,  147,  129,  148,  145,
-      145,  129,  129,  129,  100,  149,  129,  149,    0,  129,
-      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
-      129,  129,  129,  129,  129,  129,  129,  129,  129
+      123,    1,  124,  124,  125,  125,  126,  126,  127,  127,
+      128,  128,  129,  129,  123,  123,  123,  123,  130,  123,
+      130,  123,  123,  130,  130,  130,  123,  130,  131,  131,
+      131,  132,  123,  133,  133,  134,   35,  135,  123,  136,
+      123,  137,  123,  138,  123,  123,  123,  130,  130,   49,
+      123,  123,   50,  123,   27,  139,   54,  123,  140,  123,
+      130,  131,  123,  123,  132,  123,  123,  133,   35,  134,
+      134,  134,  135,  136,  123,  123,  137,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,   54,  123,   88,
+       90,   88,  139,  139,   94,   94,  123,  123,  123,  123,
+
+      123,  123,  123,  123,  123,  123,  123,  123,   88,  139,
+       94,  139,  123,  141,  123,  139,  139,  123,  123,  123,
+       98,  123,    0,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123
     } ;
 
-static yyconst short int yy_nxt[428] =
+static yyconst short int yy_nxt[423] =
     {   0,
        16,   17,   18,   19,   20,   21,   22,   23,   24,   24,
        25,   23,   26,   27,   28,   24,   29,   30,   29,   31,
-       32,   29,   16,   29,   36,   44,   36,  125,   54,   37,
-       36,   36,   62,   38,   44,   36,   36,   36,   87,   36,
-       88,   45,   37,   36,   36,   89,   38,   89,   36,   36,
-       45,   47,   47,   47,   47,   51,   55,   63,   52,   56,
-       48,   57,   48,   54,  113,   58,   59,   59,   68,   69,
-       72,   77,   78,   72,   74,   60,   61,   74,   56,   71,
-      119,   71,   80,   81,   72,   71,   71,   82,   71,  114,
-       71,   71,   85,   85,   50,   86,  113,   86,   90,   90,
-
-       91,   92,   90,   92,   90,   90,   92,   92,   93,   94,
-       92,   94,   92,   92,   90,   90,   90,   90,   90,   90,
-       90,   90,   96,   90,   96,   90,   52,   97,   96,   98,
-       90,   96,   90,   96,   96,   59,   59,   68,   69,   72,
-      102,  103,  105,  105,   60,  104,   77,   78,  101,   72,
-      106,  107,   80,   81,   50,  108,  109,  110,   85,   85,
-      100,  111,   90,  112,   90,  112,   87,   90,   90,   90,
-       90,   90,   90,   90,   90,   96,  115,   96,  115,  113,
-       97,   96,   98,  120,   96,   52,   96,   96,  116,  116,
-      102,  103,   50,  102,  103,  104,   84,  117,  104,   66,
-
-      100,  105,  105,  106,  107,  118,  106,  107,  108,  109,
-      110,  108,  109,  110,  111,  121,  122,  111,  116,  116,
-      124,  124,  121,  122,  125,  121,  122,  117,  125,  113,
-      127,  122,  113,  129,  127,  122,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   35,   35,   35,
-       35,   35,   35,   35,   35,   35,   35,   35,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
-       43,   46,   46,   46,   46,   46,   46,   46,   46,   46,
-
-       46,   46,   49,   65,   64,   49,   49,   63,   63,   67,
-       67,   67,   67,   54,   67,   67,   67,   67,   67,   67,
-       70,   70,   70,   70,   70,   53,   70,   70,   70,   70,
-       70,   73,   50,  129,   73,   73,   75,   75,   75,   42,
-       75,   75,   75,   75,   75,   75,   75,   76,   76,   76,
-       76,   42,   76,   76,   76,   76,   76,   76,   79,   79,
-       79,   79,   40,   79,   79,   79,   79,   79,   83,   83,
-       83,   83,   83,   83,   83,   83,   83,   83,   83,   95,
-       40,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       99,   99,   99,  123,  123,  123,  126,  126,  128,  128,
-
-       34,   34,   15,  129,  129,  129,  129,  129,  129,  129,
-      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
-      129,  129,  129,  129,  129,  129,  129
+       16,   35,   50,   35,   43,   51,   36,   35,   35,   85,
+       37,   86,   35,   35,   35,   43,   35,  121,   44,   36,
+       35,   35,   87,   37,   87,   35,   35,   46,   46,   44,
+       46,   46,   54,   53,  110,   55,   47,   61,   56,   47,
+       53,  111,   57,   58,   58,   66,   67,   70,   75,   76,
+       70,   72,   59,   60,   72,   55,   69,  110,   69,   78,
+       79,   70,   69,   69,   80,   69,   51,   69,   69,   83,
+       83,   49,   84,   70,   84,   88,   88,   89,   90,   88,
+
+       90,   88,   88,   90,   90,   91,   92,   90,   92,   90,
+       90,   88,   88,   88,   88,   88,   94,   88,   94,   88,
+       49,   95,   94,   96,  109,   94,  109,   94,   94,   58,
+       58,   66,   67,   98,   99,  100,  102,  102,   59,  101,
+       75,   76,   85,   70,  103,  104,   78,   79,   51,  105,
+      106,  107,   83,   83,   49,  108,   88,  112,   88,  112,
+       82,   88,   88,   88,   88,   88,   88,   88,   88,   90,
+       64,   90,   99,  100,   90,   90,   91,  101,   90,  110,
+       90,   90,   94,  116,   94,   99,  100,   95,   94,   96,
+      101,   94,   63,   94,   94,  113,  113,  102,  102,   53,
+
+      103,  104,  117,  118,  114,  105,   52,   98,  103,  104,
+      106,  107,  115,  105,   49,  108,  106,  107,  113,  113,
+      123,  108,  120,  120,  117,  118,  121,  114,  117,  118,
+       41,  110,  122,  118,  121,  110,  122,  118,   41,  123,
+       32,   32,   32,   32,   32,   32,   32,   32,   32,   32,
+       32,   34,   34,   34,   34,   34,   34,   34,   34,   34,
+       34,   34,   38,   38,   38,   38,   38,   38,   38,   38,
+       38,   38,   38,   40,   40,   40,   40,   40,   40,   40,
+       40,   40,   40,   40,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   45,   45,   45,   45,   45,
+
+       45,   45,   45,   45,   45,   45,   48,   39,   39,   48,
+       48,   62,   62,   65,   65,   65,   65,   33,   65,   65,
+       65,   65,   65,   65,   68,   68,   68,   68,   68,   33,
+       68,   68,   68,   68,   68,   71,  123,  123,   71,   71,
+       73,   73,   73,  123,   73,   73,   73,   73,   73,   73,
+       73,   74,   74,   74,   74,  123,   74,   74,   74,   74,
+       74,   74,   77,   77,   77,   77,  123,   77,   77,   77,
+       77,   77,   81,   81,   81,   81,   81,   81,   81,   81,
+       81,   81,   81,   93,  123,   93,   93,   93,   93,   93,
+       93,   93,   93,   93,   97,   97,   97,  119,  119,  119,
+
+       15,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123
     } ;
 
-static yyconst short int yy_chk[428] =
+static yyconst short int yy_chk[423] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    5,   11,    5,  124,   28,    5,
-        5,    5,   28,    5,   12,    5,    5,    6,   51,    6,
-       51,   11,    6,    6,    6,   53,    6,   53,    6,    6,
-       12,   13,   13,   14,   14,   21,   25,  119,   21,   25,
-       13,   26,   14,   26,  115,   26,   27,   27,   34,   34,
-       37,   42,   42,   72,   37,   27,   27,   72,   27,   36,
-      101,   36,   44,   44,   36,   36,   36,   44,   36,   97,
-       36,   36,   47,   47,   50,   50,   95,   50,   55,   55,
-
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   57,   58,   57,   58,   88,   57,   57,   57,
-       92,   57,   92,   57,   57,   59,   59,   68,   68,   73,
-       69,   69,   74,   74,   59,   69,   77,   77,   65,   74,
-       78,   78,   80,   80,   62,   78,   81,   81,   85,   85,
-       61,   81,   90,   93,   90,   93,   54,   90,   90,   90,
-       90,   90,   90,   90,   90,   96,   98,   96,   98,  113,
-       96,   96,   96,  113,   96,   52,   96,   96,  100,  100,
-      102,  102,   49,  103,  103,  102,   45,  100,  103,   32,
-
-      100,  105,  105,  106,  106,  100,  107,  107,  106,  109,
-      109,  107,  110,  110,  109,  114,  114,  110,  116,  116,
-      118,  118,  120,  120,  118,  121,  121,  116,  125,  120,
-      122,  122,  121,  125,  127,  127,  130,  130,  130,  130,
-      130,  130,  130,  130,  130,  130,  130,  131,  131,  131,
-      131,  131,  131,  131,  131,  131,  131,  131,  132,  132,
-      132,  132,  132,  132,  132,  132,  132,  132,  132,  133,
-      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
-      134,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-
-      135,  135,  136,   31,   30,  136,  136,  137,  137,  138,
-      138,  138,  138,   24,  138,  138,  138,  138,  138,  138,
-      139,  139,  139,  139,  139,   23,  139,  139,  139,  139,
-      139,  140,   19,   15,  140,  140,  141,  141,  141,   10,
-      141,  141,  141,  141,  141,  141,  141,  142,  142,  142,
-      142,    9,  142,  142,  142,  142,  142,  142,  143,  143,
-      143,  143,    8,  143,  143,  143,  143,  143,  144,  144,
-      144,  144,  144,  144,  144,  144,  144,  144,  144,  145,
-        7,  145,  145,  145,  145,  145,  145,  145,  145,  145,
-      146,  146,  146,  147,  147,  147,  148,  148,  149,  149,
-
-        4,    3,  129,  129,  129,  129,  129,  129,  129,  129,
-      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
-      129,  129,  129,  129,  129,  129,  129
+        1,    5,   21,    5,   11,   21,    5,    5,    5,   50,
+        5,   50,    5,    5,    6,   12,    6,  120,   11,    6,
+        6,    6,   52,    6,   52,    6,    6,   13,   13,   12,
+       14,   14,   25,   28,  112,   25,   13,   28,   26,   14,
+       26,   95,   26,   27,   27,   33,   33,   36,   41,   41,
+       70,   36,   27,   27,   70,   27,   35,   93,   35,   43,
+       43,   35,   35,   35,   43,   35,   86,   35,   35,   46,
+       46,   49,   49,   71,   49,   54,   54,   54,   54,   54,
+
+       54,   54,   54,   54,   54,   54,   54,   54,   54,   54,
+       54,   54,   54,   54,   54,   54,   56,   57,   56,   57,
+       61,   56,   56,   56,   91,   56,   91,   56,   56,   58,
+       58,   66,   66,   60,   67,   67,   72,   72,   58,   67,
+       75,   75,   53,   72,   76,   76,   78,   78,   51,   76,
+       79,   79,   83,   83,   48,   79,   88,   96,   88,   96,
+       44,   88,   88,   88,   88,   88,   88,   88,   88,   90,
+       31,   90,   99,   99,   90,   90,   90,   99,   90,  110,
+       90,   90,   94,  110,   94,  100,  100,   94,   94,   94,
+      100,   94,   30,   94,   94,   98,   98,  102,  102,   24,
+
+      103,  103,  111,  111,   98,  103,   23,   98,  104,  104,
+      106,  106,   98,  104,   19,  106,  107,  107,  113,  113,
+       15,  107,  115,  115,  116,  116,  115,  113,  117,  117,
+       10,  116,  118,  118,  121,  117,  122,  122,    9,  121,
+      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
+      124,  125,  125,  125,  125,  125,  125,  125,  125,  125,
+      125,  125,  126,  126,  126,  126,  126,  126,  126,  126,
+      126,  126,  126,  127,  127,  127,  127,  127,  127,  127,
+      127,  127,  127,  127,  128,  128,  128,  128,  128,  128,
+      128,  128,  128,  128,  128,  129,  129,  129,  129,  129,
+
+      129,  129,  129,  129,  129,  129,  130,    8,    7,  130,
+      130,  131,  131,  132,  132,  132,  132,    4,  132,  132,
+      132,  132,  132,  132,  133,  133,  133,  133,  133,    3,
+      133,  133,  133,  133,  133,  134,    0,    0,  134,  134,
+      135,  135,  135,    0,  135,  135,  135,  135,  135,  135,
+      135,  136,  136,  136,  136,    0,  136,  136,  136,  136,
+      136,  136,  137,  137,  137,  137,    0,  137,  137,  137,
+      137,  137,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  139,    0,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  140,  140,  140,  141,  141,  141,
+
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123
     } ;
 
 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
@@ -542,7 +541,7 @@ char *yytext;
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.2 1997/11/17 16:33:21 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.3 1997/11/26 01:11:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -563,12 +562,11 @@ char *yytext;
 #include "parser/gramparse.h"
 #include "parser/keywords.h"
 #include "parser/scansup.h"
-#include "parser/sysfunc.h"
 #include "parse.h"
 #include "utils/builtins.h"
 
 extern char *parseString;
-extern char *parseCh;
+static char *parseCh;
 
 /* some versions of lex define this as a macro */
 #if defined(yywrap)
@@ -641,7 +639,7 @@ char literal[MAX_PARSE_BUFFER];
  * Other embedded escaped characters are matched explicitly and the leading
  *  backslash is dropped from the string. - thomas 1997-09-24
  */
-#line 645 "lex.yy.c"
+#line 643 "lex.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -792,9 +790,9 @@ YY_DECL
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
 
-#line 167 "scan.l"
+#line 164 "scan.l"
 
-#line 798 "lex.yy.c"
+#line 796 "lex.yy.c"
 
 	if ( yy_init )
 		{
@@ -842,14 +840,14 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 130 )
+				if ( yy_current_state >= 124 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			*yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 403 );
+		while ( yy_base[yy_current_state] != 401 );
 
 yy_find_action:
 		yy_current_state = *--yy_state_ptr;
@@ -900,34 +898,34 @@ do_action:	/* This label is used only to access EOF actions. */
 	{ /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 168 "scan.l"
+#line 165 "scan.l"
 { /* ignore */ }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 170 "scan.l"
+#line 167 "scan.l"
 { /* ignore */ }
 	YY_BREAK
 case 3:
-#line 173 "scan.l"
+#line 170 "scan.l"
 case 4:
 YY_RULE_SETUP
-#line 173 "scan.l"
+#line 170 "scan.l"
 { BEGIN(xc); }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 175 "scan.l"
+#line 172 "scan.l"
 { BEGIN(INITIAL); }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 177 "scan.l"
+#line 174 "scan.l"
 { /* ignore */ }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 179 "scan.l"
+#line 176 "scan.l"
 {
 					BEGIN(xb);
 					llen = 0;
@@ -936,7 +934,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 184 "scan.l"
+#line 181 "scan.l"
 {
 					char* endptr;
 
@@ -949,10 +947,10 @@ YY_RULE_SETUP
 				}
 	YY_BREAK
 case 9:
-#line 195 "scan.l"
+#line 192 "scan.l"
 case 10:
 YY_RULE_SETUP
-#line 195 "scan.l"
+#line 192 "scan.l"
 {
 					if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
 						elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@@ -961,16 +959,16 @@ YY_RULE_SETUP
 				}
 	YY_BREAK
 case 11:
-#line 202 "scan.l"
+#line 199 "scan.l"
 case 12:
 YY_RULE_SETUP
-#line 202 "scan.l"
+#line 199 "scan.l"
 {
 				}
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 205 "scan.l"
+#line 202 "scan.l"
 {
 					BEGIN(xh);
 					llen = 0;
@@ -979,7 +977,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 210 "scan.l"
+#line 207 "scan.l"
 {
 					char* endptr;
 
@@ -993,7 +991,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 221 "scan.l"
+#line 218 "scan.l"
 {
 					BEGIN(xq);
 					llen = 0;
@@ -1002,7 +1000,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 226 "scan.l"
+#line 223 "scan.l"
 {
 					BEGIN(INITIAL);
 					yylval.str = pstrdup(scanstr(literal));
@@ -1010,10 +1008,10 @@ YY_RULE_SETUP
 				}
 	YY_BREAK
 case 17:
-#line 232 "scan.l"
+#line 229 "scan.l"
 case 18:
 YY_RULE_SETUP
-#line 232 "scan.l"
+#line 229 "scan.l"
 {
 					if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
 						elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@@ -1023,7 +1021,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 238 "scan.l"
+#line 235 "scan.l"
 {
 					if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
 						elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@@ -1034,7 +1032,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 246 "scan.l"
+#line 243 "scan.l"
 {
 					if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
 						elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@@ -1044,13 +1042,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 252 "scan.l"
+#line 249 "scan.l"
 {
 				}
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 256 "scan.l"
+#line 253 "scan.l"
 {
 					BEGIN(xd);
 					llen = 0;
@@ -1059,7 +1057,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 261 "scan.l"
+#line 258 "scan.l"
 {
 					BEGIN(INITIAL);
 					yylval.str = pstrdup(literal);
@@ -1068,7 +1066,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 266 "scan.l"
+#line 263 "scan.l"
 {
 					if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
 						elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@@ -1078,12 +1076,12 @@ YY_RULE_SETUP
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 274 "scan.l"
+#line 271 "scan.l"
 { /* ignore */ }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 275 "scan.l"
+#line 272 "scan.l"
 {
 					BEGIN(INITIAL);
 					return (yytext[0]);
@@ -1091,46 +1089,38 @@ YY_RULE_SETUP
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 281 "scan.l"
-{
-						yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
-						return (SCONST);
-				}
-	YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 286 "scan.l"
+#line 278 "scan.l"
 { return TYPECAST; }
 	YY_BREAK
-case 29:
+case 28:
 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
 yy_c_buf_p = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 288 "scan.l"
+#line 280 "scan.l"
 {
 					return (yytext[0]);
 				}
 	YY_BREAK
-case 30:
+case 29:
 YY_RULE_SETUP
-#line 291 "scan.l"
+#line 283 "scan.l"
 { 	return (yytext[0]); }
 	YY_BREAK
-case 31:
+case 30:
 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
 yy_c_buf_p = yy_cp -= 2;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 292 "scan.l"
+#line 284 "scan.l"
 {
 					yylval.str = pstrdup((char*)yytext);
 					return (Op);
 				}
 	YY_BREAK
-case 32:
+case 31:
 YY_RULE_SETUP
-#line 296 "scan.l"
+#line 288 "scan.l"
 {
 					if (strcmp((char*)yytext,"!=") == 0)
 						yylval.str = pstrdup("<>"); /* compatability */
@@ -1139,17 +1129,17 @@ YY_RULE_SETUP
 					return (Op);
 				}
 	YY_BREAK
-case 33:
+case 32:
 YY_RULE_SETUP
-#line 303 "scan.l"
+#line 295 "scan.l"
 {
 					yylval.ival = atoi((char*)&yytext[1]);
 					return (PARAM);
 				}
 	YY_BREAK
-case 34:
+case 33:
 YY_RULE_SETUP
-#line 308 "scan.l"
+#line 300 "scan.l"
 {
 					char* endptr;
 
@@ -1161,9 +1151,9 @@ YY_RULE_SETUP
 					return (ICONST);
 				}
 	YY_BREAK
-case 35:
+case 34:
 YY_RULE_SETUP
-#line 318 "scan.l"
+#line 310 "scan.l"
 {
 					char* endptr;
 
@@ -1176,9 +1166,9 @@ YY_RULE_SETUP
 					return (FCONST);
 				}
 	YY_BREAK
-case 36:
+case 35:
 YY_RULE_SETUP
-#line 329 "scan.l"
+#line 321 "scan.l"
 {
 					char* endptr;
 
@@ -1189,9 +1179,9 @@ YY_RULE_SETUP
 					return (ICONST);
 				}
 	YY_BREAK
-case 37:
+case 36:
 YY_RULE_SETUP
-#line 338 "scan.l"
+#line 330 "scan.l"
 {
 					char* endptr;
 
@@ -1203,9 +1193,9 @@ YY_RULE_SETUP
 					return (FCONST);
 				}
 	YY_BREAK
-case 38:
+case 37:
 YY_RULE_SETUP
-#line 348 "scan.l"
+#line 340 "scan.l"
 {
 					int i;
 					ScanKeyword		*keyword;
@@ -1225,22 +1215,22 @@ YY_RULE_SETUP
 					}
 				}
 	YY_BREAK
-case 39:
+case 38:
 YY_RULE_SETUP
-#line 366 "scan.l"
+#line 358 "scan.l"
 { /* ignore */ }
 	YY_BREAK
-case 40:
+case 39:
 YY_RULE_SETUP
-#line 368 "scan.l"
+#line 360 "scan.l"
 { return (yytext[0]); }
 	YY_BREAK
-case 41:
+case 40:
 YY_RULE_SETUP
-#line 370 "scan.l"
+#line 362 "scan.l"
 ECHO;
 	YY_BREAK
-#line 1244 "lex.yy.c"
+#line 1234 "lex.yy.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(xb):
 			case YY_STATE_EOF(xc):
@@ -1535,7 +1525,7 @@ static yy_state_type yy_get_previous_state()
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 130 )
+			if ( yy_current_state >= 124 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1565,11 +1555,11 @@ yy_state_type yy_current_state;
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 130 )
+		if ( yy_current_state >= 124 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 129);
+	yy_is_jam = (yy_current_state == 123);
 	if ( ! yy_is_jam )
 		*yy_state_ptr++ = yy_current_state;
 
@@ -2126,7 +2116,7 @@ int main()
 	return 0;
 	}
 #endif
-#line 370 "scan.l"
+#line 362 "scan.l"
 
 
 void yyerror(char message[])
diff --git a/src/backend/parser/scansup.c b/src/backend/parser/scansup.c
index e50757940aa..84ef988ddb5 100644
--- a/src/backend/parser/scansup.c
+++ b/src/backend/parser/scansup.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.8 1997/11/25 22:05:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.9 1997/11/26 01:11:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,10 +17,11 @@
 
 #include <ctype.h>
 #include <string.h>
+
 #include "postgres.h"
 #include "miscadmin.h"
-#include "utils/elog.h"
 #include "parser/scansup.h"
+#include "utils/elog.h"
 
 /* ----------------
  *		scanstr
diff --git a/src/include/access/rtscan.h b/src/include/access/rtscan.h
index edcd56f75c1..f3b450023a3 100644
--- a/src/include/access/rtscan.h
+++ b/src/include/access/rtscan.h
@@ -6,11 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rtscan.h,v 1.3 1997/09/08 02:34:24 momjian Exp $
+ * $Id: rtscan.h,v 1.4 1997/11/26 01:12:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef RTSCAN_H
+#define RTSCAN_H
+
+#include <utils/rel.h>
+#include <storage/block.h>
+#include <storage/off.h>
 
 void		rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum);
 
diff --git a/src/include/access/rtstrat.h b/src/include/access/rtstrat.h
index 2036ffd6ecd..72d4ceb8253 100644
--- a/src/include/access/rtstrat.h
+++ b/src/include/access/rtstrat.h
@@ -6,11 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rtstrat.h,v 1.4 1997/09/08 21:50:59 momjian Exp $
+ * $Id: rtstrat.h,v 1.5 1997/11/26 01:12:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef RTSTRAT_H
+#define RTSTRAT_H
+
+#include <utils/rel.h>
+#include <access/attnum.h>
 
 extern RegProcedure
 RTMapOperator(Relation r, AttrNumber attnum,
diff --git a/src/include/commands/creatinh.h b/src/include/commands/creatinh.h
index 5ba47f8a03a..21208ad958d 100644
--- a/src/include/commands/creatinh.h
+++ b/src/include/commands/creatinh.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: creatinh.h,v 1.5 1997/11/21 18:12:16 momjian Exp $
+ * $Id: creatinh.h,v 1.6 1997/11/26 01:12:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef CREATINH_H
 #define CREATINH_H
 
+#include "nodes/parsenodes.h"
+
 extern void DefineRelation(CreateStmt *stmt);
 extern void RemoveRelation(char *name);
 
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index b2880868cd2..6b808582a0e 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -5,13 +5,16 @@
  *
  * Copyright (c) 1994-5, Regents of the University of California
  *
- * $Id: explain.h,v 1.5 1997/09/08 21:51:38 momjian Exp $
+ * $Id: explain.h,v 1.6 1997/11/26 01:12:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXPLAIN_H
 #define EXPLAIN_H
 
+#include "tcop/dest.h"
+#include "nodes/parsenodes.h"
+
 extern void ExplainQuery(Query *query, bool verbose, CommandDest dest);
 
 #endif							/* EXPLAIN_H */
diff --git a/src/include/commands/recipe.h b/src/include/commands/recipe.h
index 246cf4eaca8..c90d663295e 100644
--- a/src/include/commands/recipe.h
+++ b/src/include/commands/recipe.h
@@ -5,13 +5,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: recipe.h,v 1.4 1997/09/08 21:51:42 momjian Exp $
+ * $Id: recipe.h,v 1.5 1997/11/26 01:12:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef RECIPE_H
 #define RECIPE_H
 
+#include "nodes/parsenodes.h"
+
 extern void beginRecipe(RecipeStmt *stmt);
 
 #endif							/* RECIPE_H */
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index 92dbd14a8e0..2ffa42639b4 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -9,6 +9,8 @@
 #ifndef SEQUENCE_H
 #define SEQUENCE_H
 
+#include "nodes/parsenodes.h"
+
 /*
  * Columns of a sequnece relation
  */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 6ba0394fdf7..28ae082d687 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -11,6 +11,7 @@
 
 #include "access/tupdesc.h"
 #include "access/htup.h"
+#include "nodes/parsenodes.h"
 #include "utils/rel.h"
 
 typedef uint32 TriggerEvent;
diff --git a/src/include/commands/view.h b/src/include/commands/view.h
index 2fc1bb3b8d3..da1276d9a73 100644
--- a/src/include/commands/view.h
+++ b/src/include/commands/view.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: view.h,v 1.4 1997/09/08 21:51:47 momjian Exp $
+ * $Id: view.h,v 1.5 1997/11/26 01:12:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef VIEW_H
 #define VIEW_H
 
+#include "nodes/parsenodes.h"
+
 extern char *MakeRetrieveViewRuleName(char *view_name);
 extern void DefineView(char *view_name, Query *view_parse);
 extern void RemoveView(char *view_name);
diff --git a/src/include/executor/execFlatten.h b/src/include/executor/execFlatten.h
index 8dc8236e22e..3ecb90810b0 100644
--- a/src/include/executor/execFlatten.h
+++ b/src/include/executor/execFlatten.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execFlatten.h,v 1.5 1997/09/08 21:51:49 momjian Exp $
+ * $Id: execFlatten.h,v 1.6 1997/11/26 01:12:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXECFLATTEN_H
 #define EXECFLATTEN_H
 
+#include "nodes/relation.h"
+#include "nodes/execnodes.h"
+#include "nodes/parsenodes.h"
+
 extern Datum ExecEvalIter(Iter *iterNode, ExprContext *econtext, bool *resultIsNull, bool *iterIsDone);
 
 extern void ExecEvalFjoin(TargetEntry *tlist, ExprContext *econtext, bool *isNullVect, bool *fj_isDone);
diff --git a/src/include/executor/functions.h b/src/include/executor/functions.h
index a1bed2a7385..c6ca0829711 100644
--- a/src/include/executor/functions.h
+++ b/src/include/executor/functions.h
@@ -6,13 +6,18 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: functions.h,v 1.4 1997/09/08 21:51:59 momjian Exp $
+ * $Id: functions.h,v 1.5 1997/11/26 01:12:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef FUNCTIONS_H
 #define FUNCTIONS_H
 
+#include "access/tupdesc.h"
+#include "nodes/parsenodes.h"
+#include "nodes/primnodes.h"
+#include "utils/syscache.h"
+
 extern Datum
 ProjectAttribute(TupleDesc TD, TargetEntry *tlist,
 				 HeapTuple tup, bool *isnullP);
diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h
index c752c6ce176..69f791b9c9a 100644
--- a/src/include/executor/nodeAgg.h
+++ b/src/include/executor/nodeAgg.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeAgg.h,v 1.5 1997/09/08 21:52:01 momjian Exp $
+ * $Id: nodeAgg.h,v 1.6 1997/11/26 01:12:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEAGG_H
 #define NODEAGG_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecAgg(Agg *node);
 extern bool ExecInitAgg(Agg *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsAgg(Agg *node);
diff --git a/src/include/executor/nodeAppend.h b/src/include/executor/nodeAppend.h
index c0aa2d1c753..335cf4a33a8 100644
--- a/src/include/executor/nodeAppend.h
+++ b/src/include/executor/nodeAppend.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeAppend.h,v 1.6 1997/09/08 21:52:02 momjian Exp $
+ * $Id: nodeAppend.h,v 1.7 1997/11/26 01:12:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEAPPEND_H
 #define NODEAPPEND_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern bool ExecInitAppend(Append *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsAppend(Append *node);
 extern TupleTableSlot *ExecProcAppend(Append *node);
diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h
index 294f59103b2..97ded95c947 100644
--- a/src/include/executor/nodeGroup.h
+++ b/src/include/executor/nodeGroup.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeGroup.h,v 1.4 1997/09/08 21:52:02 momjian Exp $
+ * $Id: nodeGroup.h,v 1.5 1997/11/26 01:12:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEGROUP_H
 #define NODEGROUP_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecGroup(Group *node);
 extern bool ExecInitGroup(Group *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsGroup(Group *node);
diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h
index 96ed987718a..3a34a70973d 100644
--- a/src/include/executor/nodeHashjoin.h
+++ b/src/include/executor/nodeHashjoin.h
@@ -6,21 +6,21 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeHashjoin.h,v 1.5 1997/09/08 21:52:05 momjian Exp $
+ * $Id: nodeHashjoin.h,v 1.6 1997/11/26 01:12:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEHASHJOIN_H
 #define NODEHASHJOIN_H
 
-extern TupleTableSlot *ExecHashJoin(HashJoin *node);
+#include "nodes/plannodes.h"
+#include "nodes/execnodes.h"
+#include "utils/syscache.h"
 
+extern TupleTableSlot *ExecHashJoin(HashJoin *node);
 extern bool ExecInitHashJoin(HashJoin *node, EState *estate, Plan *parent);
-
 extern int	ExecCountSlotsHashJoin(HashJoin *node);
-
 extern void ExecEndHashJoin(HashJoin *node);
-
 extern char *
 ExecHashJoinSaveTuple(HeapTuple heapTuple, char *buffer,
 					  File file, char *position);
diff --git a/src/include/executor/nodeIndexscan.h b/src/include/executor/nodeIndexscan.h
index 5b149d8aed8..1e13cc9666b 100644
--- a/src/include/executor/nodeIndexscan.h
+++ b/src/include/executor/nodeIndexscan.h
@@ -6,29 +6,25 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeIndexscan.h,v 1.5 1997/09/08 21:52:06 momjian Exp $
+ * $Id: nodeIndexscan.h,v 1.6 1997/11/26 01:12:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEINDEXSCAN_H
 #define NODEINDEXSCAN_H
 
-extern TupleTableSlot *ExecIndexScan(IndexScan *node);
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
 
+extern TupleTableSlot *ExecIndexScan(IndexScan *node);
 extern void ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent);
-
 extern void ExecEndIndexScan(IndexScan *node);
-
 extern void ExecIndexMarkPos(IndexScan *node);
-
 extern void ExecIndexRestrPos(IndexScan *node);
-
 extern void ExecUpdateIndexScanKeys(IndexScan *node, ExprContext *econtext);
-
 extern bool ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent);
-
 extern int	ExecCountSlotsIndexScan(IndexScan *node);
-
 extern void ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent);
 
 #endif							/* NODEINDEXSCAN_H */
diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h
index 98daa35f319..de010d3ab21 100644
--- a/src/include/executor/nodeMaterial.h
+++ b/src/include/executor/nodeMaterial.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeMaterial.h,v 1.4 1997/09/08 21:52:07 momjian Exp $
+ * $Id: nodeMaterial.h,v 1.5 1997/11/26 01:12:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEMATERIAL_H
 #define NODEMATERIAL_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecMaterial(Material *node);
 extern bool ExecInitMaterial(Material *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsMaterial(Material *node);
diff --git a/src/include/executor/nodeMergejoin.h b/src/include/executor/nodeMergejoin.h
index 96a74e0fc9d..1f8e774c1c5 100644
--- a/src/include/executor/nodeMergejoin.h
+++ b/src/include/executor/nodeMergejoin.h
@@ -6,19 +6,20 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeMergejoin.h,v 1.6 1997/09/08 21:52:09 momjian Exp $
+ * $Id: nodeMergejoin.h,v 1.7 1997/11/26 01:12:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEMERGEJOIN_H
 #define NODEMERGEJOIN_H
 
-extern TupleTableSlot *ExecMergeJoin(MergeJoin *node);
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
 
+extern TupleTableSlot *ExecMergeJoin(MergeJoin *node);
 extern bool ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent);
-
 extern int	ExecCountSlotsMergeJoin(MergeJoin *node);
-
 extern void ExecEndMergeJoin(MergeJoin *node);
 
 #endif							/* NODEMERGEJOIN_H; */
diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h
index 2c4fa13fe1b..ec08d3a9ed8 100644
--- a/src/include/executor/nodeNestloop.h
+++ b/src/include/executor/nodeNestloop.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeNestloop.h,v 1.4 1997/09/08 21:52:10 momjian Exp $
+ * $Id: nodeNestloop.h,v 1.5 1997/11/26 01:12:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODENESTLOOP_H
 #define NODENESTLOOP_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecNestLoop(NestLoop *node, Plan *parent);
 extern bool ExecInitNestLoop(NestLoop *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsNestLoop(NestLoop *node);
diff --git a/src/include/executor/nodeResult.h b/src/include/executor/nodeResult.h
index c66e069f468..e3ebe2241e6 100644
--- a/src/include/executor/nodeResult.h
+++ b/src/include/executor/nodeResult.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeResult.h,v 1.4 1997/09/08 21:52:11 momjian Exp $
+ * $Id: nodeResult.h,v 1.5 1997/11/26 01:12:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODERESULT_H
 #define NODERESULT_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecResult(Result *node);
 extern bool ExecInitResult(Result *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsResult(Result *node);
diff --git a/src/include/executor/nodeSeqscan.h b/src/include/executor/nodeSeqscan.h
index d6afe03ac93..2c980d8eaad 100644
--- a/src/include/executor/nodeSeqscan.h
+++ b/src/include/executor/nodeSeqscan.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeSeqscan.h,v 1.5 1997/09/08 21:52:12 momjian Exp $
+ * $Id: nodeSeqscan.h,v 1.6 1997/11/26 01:13:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODESEQSCAN_H
 #define NODESEQSCAN_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecSeqScan(SeqScan *node);
 extern bool ExecInitSeqScan(SeqScan *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsSeqScan(SeqScan *node);
diff --git a/src/include/executor/nodeSort.h b/src/include/executor/nodeSort.h
index 69b4dbe9a86..a69b15c6751 100644
--- a/src/include/executor/nodeSort.h
+++ b/src/include/executor/nodeSort.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeSort.h,v 1.4 1997/09/08 21:52:12 momjian Exp $
+ * $Id: nodeSort.h,v 1.5 1997/11/26 01:13:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODESORT_H
 #define NODESORT_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecSort(Sort *node);
 extern bool ExecInitSort(Sort *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsSort(Sort *node);
diff --git a/src/include/executor/nodeTee.h b/src/include/executor/nodeTee.h
index c4a603aa3a9..d58b0b1cf6d 100644
--- a/src/include/executor/nodeTee.h
+++ b/src/include/executor/nodeTee.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeTee.h,v 1.4 1997/09/08 21:52:13 momjian Exp $
+ * $Id: nodeTee.h,v 1.5 1997/11/26 01:13:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -13,6 +13,10 @@
 #ifndef NODETEE_H
 #define NODETEE_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecTee(Tee *node, Plan *parent);
 extern bool ExecInitTee(Tee *node, EState *estate, Plan *parent);
 extern void ExecTeeReScan(Tee *node, ExprContext *exprCtxt, Plan *parent);
diff --git a/src/include/executor/nodeUnique.h b/src/include/executor/nodeUnique.h
index 61ab85828cf..65b210c1d27 100644
--- a/src/include/executor/nodeUnique.h
+++ b/src/include/executor/nodeUnique.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeUnique.h,v 1.4 1997/09/08 21:52:14 momjian Exp $
+ * $Id: nodeUnique.h,v 1.5 1997/11/26 01:13:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NODEUNIQUE_H
 #define NODEUNIQUE_H
 
+#include "executor/tuptable.h"
+#include "nodes/execnodes.h"
+#include "nodes/plannodes.h"
+
 extern TupleTableSlot *ExecUnique(Unique *node);
 extern bool ExecInitUnique(Unique *node, EState *estate, Plan *parent);
 extern int	ExecCountSlotsUnique(Unique *node);
diff --git a/src/include/nodes/readfuncs.h b/src/include/nodes/readfuncs.h
index 72007ec9132..f2b24e18ed3 100644
--- a/src/include/nodes/readfuncs.h
+++ b/src/include/nodes/readfuncs.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: readfuncs.h,v 1.4 1997/09/08 02:37:28 momjian Exp $
+ * $Id: readfuncs.h,v 1.5 1997/11/26 01:13:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef READFUNCS_H
 #define READFUNCS_H
 
+#include "nodes/nodes.h"
+
 /*
  * prototypes for functions in read.c (the lisp token parser)
  */
diff --git a/src/include/optimizer/clauseinfo.h b/src/include/optimizer/clauseinfo.h
index 6d1b0b8fbff..a56359df715 100644
--- a/src/include/optimizer/clauseinfo.h
+++ b/src/include/optimizer/clauseinfo.h
@@ -6,13 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: clauseinfo.h,v 1.4 1997/09/08 21:53:03 momjian Exp $
+ * $Id: clauseinfo.h,v 1.5 1997/11/26 01:13:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef CLAUSEINFO_H
 #define CLAUSEINFO_H
 
+#include "nodes/pg_list.h"
+#include "nodes/relation.h"
+
 extern bool valid_or_clause(CInfo *clauseinfo);
 extern List *get_actual_clauses(List *clauseinfo_list);
 extern void
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index 8402e7a2651..cdb02534fc2 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -6,13 +6,18 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: cost.h,v 1.5 1997/09/08 21:53:09 momjian Exp $
+ * $Id: cost.h,v 1.6 1997/11/26 01:13:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef COST_H
 #define COST_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/pg_list.h"
+#include "nodes/relation.h"
+
 /*
  * prototypes for costsize.c--
  *	  routines to compute costs and sizes
diff --git a/src/include/optimizer/geqo.h b/src/include/optimizer/geqo.h
index ef81545f2bf..a653b4d6325 100644
--- a/src/include/optimizer/geqo.h
+++ b/src/include/optimizer/geqo.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo.h,v 1.6 1997/09/08 21:53:10 momjian Exp $
+ * $Id: geqo.h,v 1.7 1997/11/26 01:13:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,6 +21,10 @@
 #ifndef GEQO_H
 #define GEQO_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
+#include "optimizer/geqo_gene.h"
 
 /* GEQO debug flag */
 /*
diff --git a/src/include/optimizer/geqo_copy.h b/src/include/optimizer/geqo_copy.h
index 27c9eaad47b..26730d0bc8b 100644
--- a/src/include/optimizer/geqo_copy.h
+++ b/src/include/optimizer/geqo_copy.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_copy.h,v 1.4 1997/09/08 21:53:10 momjian Exp $
+ * $Id: geqo_copy.h,v 1.5 1997/11/26 01:13:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,6 +21,7 @@
 #ifndef GEQO_COPY_H
 #define GEQO_COPY_H
 
+#include "optimizer/geqo_gene.h"
 
 extern void geqo_copy(Chromosome *chromo1, Chromosome *chromo2, int string_length);
 
diff --git a/src/include/optimizer/geqo_gene.h b/src/include/optimizer/geqo_gene.h
index ade40fa7405..d1f99cced85 100644
--- a/src/include/optimizer/geqo_gene.h
+++ b/src/include/optimizer/geqo_gene.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_gene.h,v 1.4 1997/09/08 21:53:11 momjian Exp $
+ * $Id: geqo_gene.h,v 1.5 1997/11/26 01:13:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,11 +22,13 @@
 #ifndef GEQO_GENE_H
 #define GEQO_GENE_H
 
+#include "nodes/nodes.h"
+#include "nodes/relation.h"
+#include "optimizer/geqo_gene.h"
 
 /* we presume that int instead of Relid
    is o.k. for Gene; so don't change it! */
-typedef
-int Gene;
+typedef int Gene;
 
 typedef struct Chromosome
 {
diff --git a/src/include/optimizer/geqo_misc.h b/src/include/optimizer/geqo_misc.h
index 64b8ddf432f..2a7a801305b 100644
--- a/src/include/optimizer/geqo_misc.h
+++ b/src/include/optimizer/geqo_misc.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_misc.h,v 1.4 1997/09/08 21:53:13 momjian Exp $
+ * $Id: geqo_misc.h,v 1.5 1997/11/26 01:13:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,6 +23,10 @@
 
 #include <stdio.h>
 
+#include "nodes/parsenodes.h"
+#include "optimizer/geqo_gene.h"
+#include "optimizer/geqo_recombination.h"
+
 extern void print_pool(FILE *fp, Pool *pool, int start, int stop);
 extern void print_gen(FILE *fp, Pool *pool, int generation);
 extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene);
diff --git a/src/include/optimizer/geqo_mutation.h b/src/include/optimizer/geqo_mutation.h
index 2a18c8cdfdc..94549a31649 100644
--- a/src/include/optimizer/geqo_mutation.h
+++ b/src/include/optimizer/geqo_mutation.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_mutation.h,v 1.4 1997/09/08 21:53:13 momjian Exp $
+ * $Id: geqo_mutation.h,v 1.5 1997/11/26 01:13:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,6 +21,7 @@
 #ifndef GEQO_MUTATION_H
 #define GEQO_MUTATION_H
 
+#include "optimizer/geqo_gene.h"
 
 extern void geqo_mutation(Gene *tour, int num_gene);
 
diff --git a/src/include/optimizer/geqo_pool.h b/src/include/optimizer/geqo_pool.h
index 3fe9c71bd24..ebc8a3914b0 100644
--- a/src/include/optimizer/geqo_pool.h
+++ b/src/include/optimizer/geqo_pool.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_pool.h,v 1.4 1997/09/08 21:53:15 momjian Exp $
+ * $Id: geqo_pool.h,v 1.5 1997/11/26 01:13:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,6 +22,7 @@
 #ifndef GEQO_POOL_H
 #define GEQO_POOL_H
 
+#include "optimizer/geqo_gene.h"
 
 extern Pool *alloc_pool(int pool_size, int string_length);
 extern void free_pool(Pool *pool);
diff --git a/src/include/optimizer/geqo_recombination.h b/src/include/optimizer/geqo_recombination.h
index eea3c58a9f8..615316f1978 100644
--- a/src/include/optimizer/geqo_recombination.h
+++ b/src/include/optimizer/geqo_recombination.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_recombination.h,v 1.4 1997/09/08 21:53:16 momjian Exp $
+ * $Id: geqo_recombination.h,v 1.5 1997/11/26 01:13:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,6 +23,7 @@
 #ifndef GEQO_RECOMBINATION_H
 #define GEQO_RECOMBINATION_H
 
+#include "optimizer/geqo_gene.h"
 
 extern void init_tour(Gene *tour, int num_gene);
 
diff --git a/src/include/optimizer/geqo_selection.h b/src/include/optimizer/geqo_selection.h
index ea7b26492f8..6a8e0cccffa 100644
--- a/src/include/optimizer/geqo_selection.h
+++ b/src/include/optimizer/geqo_selection.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_selection.h,v 1.4 1997/09/08 21:53:17 momjian Exp $
+ * $Id: geqo_selection.h,v 1.5 1997/11/26 01:13:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,6 +22,7 @@
 #ifndef GEQO_SELECTION_H
 #define GEQO_SELECTION_H
 
+#include "optimizer/geqo_gene.h"
 
 extern void geqo_selection(Chromosome *momma, Chromosome *daddy, Pool *pool, double bias);
 
diff --git a/src/include/optimizer/joininfo.h b/src/include/optimizer/joininfo.h
index b6c43fba8d1..9fdbe231234 100644
--- a/src/include/optimizer/joininfo.h
+++ b/src/include/optimizer/joininfo.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: joininfo.h,v 1.4 1997/09/08 21:53:18 momjian Exp $
+ * $Id: joininfo.h,v 1.5 1997/11/26 01:13:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef JOININFO_H
 #define JOININFO_H
 
+#include "nodes/nodes.h"
+#include "nodes/relation.h"
+#include "nodes/primnodes.h"
+
 extern JInfo *joininfo_member(List *join_relids, List *joininfo_list);
 extern JInfo *find_joininfo_node(Rel *this_rel, List *join_relids);
 extern Var *other_join_clause_var(Var *var, Expr *clause);
diff --git a/src/include/optimizer/keys.h b/src/include/optimizer/keys.h
index 85af02e873a..ea02f5f1307 100644
--- a/src/include/optimizer/keys.h
+++ b/src/include/optimizer/keys.h
@@ -6,13 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: keys.h,v 1.5 1997/09/08 21:53:18 momjian Exp $
+ * $Id: keys.h,v 1.6 1997/11/26 01:13:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef KEYS_H
 #define KEYS_H
 
+#include "nodes/nodes.h"
+#include "nodes/relation.h"
+
 extern bool match_indexkey_operand(int indexkey, Var *operand, Rel *rel);
 extern Var *extract_subkey(JoinKey *jk, int which_subkey);
 extern bool samekeys(List *keys1, List *keys2);
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index ae6848abb57..70225748218 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pathnode.h,v 1.4 1997/09/08 21:53:23 momjian Exp $
+ * $Id: pathnode.h,v 1.5 1997/11/26 01:13:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PATHNODE_H
 #define PATHNODE_H
 
+#include "nodes/nodes.h"
+#include "nodes/relation.h"
+#include "nodes/parsenodes.h"
+
 /*
  * prototypes for pathnode.c
  */
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 61a9cea940f..b7a56ef6536 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -7,13 +7,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: paths.h,v 1.4 1997/09/08 21:53:25 momjian Exp $
+ * $Id: paths.h,v 1.5 1997/11/26 01:13:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PATHS_H
 #define PATHS_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
+
 /*
  * allpaths.h
  */
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 8f2abff9326..6b297b6c1a5 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: planmain.h,v 1.5 1997/09/08 21:53:28 momjian Exp $
+ * $Id: planmain.h,v 1.6 1997/11/26 01:13:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PLANMAIN_H
 #define PLANMAIN_H
 
+#include "nodes/nodes.h"
+#include "nodes/plannodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
 
 /*
  * prototypes for plan/planmain.c
diff --git a/src/include/optimizer/planner.h b/src/include/optimizer/planner.h
index 59bd8738d08..86b3023aa01 100644
--- a/src/include/optimizer/planner.h
+++ b/src/include/optimizer/planner.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: planner.h,v 1.6 1997/11/25 22:06:37 momjian Exp $
+ * $Id: planner.h,v 1.7 1997/11/26 01:13:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -16,7 +16,9 @@
 /*
 */
 
-#include <parser/parse_node.h>
+#include "nodes/parsenodes.h"
+#include "nodes/plannodes.h"
+#include "parser/parse_node.h"
 
 extern Plan *planner(Query *parse);
 extern void pg_checkretval(Oid rettype, QueryTreeList *querytree_list);
diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h
index 318ab74f98f..280e4a47c06 100644
--- a/src/include/optimizer/tlist.h
+++ b/src/include/optimizer/tlist.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tlist.h,v 1.5 1997/09/08 21:53:31 momjian Exp $
+ * $Id: tlist.h,v 1.6 1997/11/26 01:13:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef TLIST_H
 #define TLIST_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
+
 extern int	exec_tlist_length(List *targelist);
 extern TargetEntry *tlistentry_member(Var *var, List *targetlist);
 extern Expr *matching_tlvar(Var *var, List *targetlist);
diff --git a/src/include/optimizer/var.h b/src/include/optimizer/var.h
index ad0dfad36b7..2437b6de1af 100644
--- a/src/include/optimizer/var.h
+++ b/src/include/optimizer/var.h
@@ -6,13 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: var.h,v 1.4 1997/09/08 21:53:31 momjian Exp $
+ * $Id: var.h,v 1.5 1997/11/26 01:13:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef VAR_H
 #define VAR_H
 
+#include "nodes/nodes.h"
+#include "nodes/primnodes.h"
+
 extern List *pull_varnos(Node *me);
 extern bool contain_var_clause(Node *clause);
 extern List *pull_var_clause(Node *clause);
diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h
index a85e2074bbe..b88d80f346f 100644
--- a/src/include/parser/analyze.h
+++ b/src/include/parser/analyze.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: analyze.h,v 1.1 1997/11/25 22:06:47 momjian Exp $
+ * $Id: analyze.h,v 1.2 1997/11/26 01:13:56 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -14,6 +14,6 @@
 
 #include <parser/parse_node.h>
 
-QueryTreeList *parse_analyze(List *pl);
+extern QueryTreeList *parse_analyze(List *pl);
 
 #endif							/* ANALYZE_H */
diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h
index 21ef36248fd..fca928c9eea 100644
--- a/src/include/parser/parse_agg.h
+++ b/src/include/parser/parse_agg.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_agg.h,v 1.1 1997/11/25 22:06:53 momjian Exp $
+ * $Id: parse_agg.h,v 1.2 1997/11/26 01:13:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,21 +18,14 @@
 #include <nodes/primnodes.h>
 #include <parser/parse_node.h>
 
-void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
-
-void finalizeAggregates(ParseState *pstate, Query *qry);
-
-bool contain_agg_clause(Node *clause);
-
-bool exprIsAggOrGroupCol(Node *expr, List *groupClause);
-
-bool tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause);
-
-void parseCheckAggregates(ParseState *pstate, Query *qry);
-
-Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
-
-void agg_error(char *caller, char *aggname, Oid basetypeID);
+extern void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
+extern void finalizeAggregates(ParseState *pstate, Query *qry);
+extern bool contain_agg_clause(Node *clause);
+extern bool exprIsAggOrGroupCol(Node *expr, List *groupClause);
+extern bool tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause);
+extern void parseCheckAggregates(ParseState *pstate, Query *qry);
+extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
+extern void agg_error(char *caller, char *aggname, Oid basetypeID);
 
 #endif							/* PARSE_AGG_H */
 
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index 2c0a5278f60..9c5fed19dd5 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_clause.h,v 1.1 1997/11/25 22:06:54 momjian Exp $
+ * $Id: parse_clause.h,v 1.2 1997/11/26 01:14:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,19 +19,14 @@
 #include <nodes/primnodes.h>
 #include <parser/parse_node.h>
 
-void parseFromClause(ParseState *pstate, List *frmList);
-
-void makeRangeTable(ParseState *pstate, char *relname, List *frmList);
-
-Node *transformWhereClause(ParseState *pstate, Node *a_expr);
-
-TargetEntry *find_targetlist_entry(ParseState *pstate,
+extern void parseFromClause(ParseState *pstate, List *frmList);
+extern void makeRangeTable(ParseState *pstate, char *relname, List *frmList);
+extern Node *transformWhereClause(ParseState *pstate, Node *a_expr);
+extern TargetEntry *find_targetlist_entry(ParseState *pstate,
 			SortGroupBy *sortgroupby, List *tlist);
-
-List *transformGroupClause(ParseState *pstate, List *grouplist,
+extern List *transformGroupClause(ParseState *pstate, List *grouplist,
 			List *targetlist);
-
-List *transformSortClause(ParseState *pstate,
+extern List *transformSortClause(ParseState *pstate,
 					List *orderlist, List *targetlist,
 					char *uniqueFlag);
 
diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h
index e7c4a04b011..4bc1d77b3f6 100644
--- a/src/include/parser/parse_expr.h
+++ b/src/include/parser/parse_expr.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_expr.h,v 1.1 1997/11/25 22:06:55 momjian Exp $
+ * $Id: parse_expr.h,v 1.2 1997/11/26 01:14:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,17 +18,12 @@
 #include <nodes/primnodes.h>
 #include <parser/parse_node.h>
 
-Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
-
-Node *transformIdent(ParseState *pstate, Node *expr, int precedence);
-
-Oid exprType(Node *expr);
-
-Node *handleNestedDots(ParseState *pstate, Attr *attr, int *curr_resno);
-
-Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
-
-Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
+extern Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
+extern Node *transformIdent(ParseState *pstate, Node *expr, int precedence);
+extern Oid exprType(Node *expr);
+extern Node *handleNestedDots(ParseState *pstate, Attr *attr, int *curr_resno);
+extern Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
+extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
 
 #endif							/* PARSE_EXPR_H */
 
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index de8fc66d848..dbda5651a36 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_func.h,v 1.1 1997/11/25 22:06:56 momjian Exp $
+ * $Id: parse_func.h,v 1.2 1997/11/26 01:14:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,56 +42,40 @@ typedef struct _CandidateList
 	struct _CandidateList *next;
 }		   *CandidateList;
 
-Node *ParseFunc(ParseState *pstate, char *funcname, List *fargs,
+extern Node *ParseFunc(ParseState *pstate, char *funcname, List *fargs,
 	int *curr_resno);
-
-Oid funcid_get_rettype(Oid funcid);
-
-CandidateList func_get_candidates(char *funcname, int nargs);
-
-bool can_coerce(int nargs, Oid *input_typeids, Oid *func_typeids);
-
-int match_argtypes(int nargs,
+extern Oid funcid_get_rettype(Oid funcid);
+extern CandidateList func_get_candidates(char *funcname, int nargs);
+extern bool can_coerce(int nargs, Oid *input_typeids, Oid *func_typeids);
+extern int match_argtypes(int nargs,
 				   Oid *input_typeids,
 				   CandidateList function_typeids,
 				   CandidateList *candidates);
-
-Oid * func_select_candidate(int nargs,
+extern Oid * func_select_candidate(int nargs,
 						  Oid *input_typeids,
 						  CandidateList candidates);
-
-bool func_get_detail(char *funcname,
+extern bool func_get_detail(char *funcname,
 					int nargs,
 					Oid *oid_array,
 					Oid *funcid,	/* return value */
 					Oid *rettype,	/* return value */
 					bool *retset,	/* return value */
 					Oid **true_typeids);
-
-Oid ** argtype_inherit(int nargs, Oid *oid_array);
-
-int findsupers(Oid relid, Oid **supervec);
-
-Oid **genxprod(InhPaths *arginh, int nargs);
-
-void make_arguments(int nargs,
+extern Oid ** argtype_inherit(int nargs, Oid *oid_array);
+extern int findsupers(Oid relid, Oid **supervec);
+extern Oid **genxprod(InhPaths *arginh, int nargs);
+extern void make_arguments(int nargs,
 				   List *fargs,
 				   Oid *input_typeids,
 				   Oid *function_typeids);
 
-List *setup_tlist(char *attname, Oid relid);
-
-List *setup_base_tlist(Oid typeid);
-
-Node *ParseComplexProjection(ParseState *pstate,
+extern List *setup_tlist(char *attname, Oid relid);
+extern List *setup_base_tlist(Oid typeid);
+extern Node *ParseComplexProjection(ParseState *pstate,
 						   char *funcname,
 						   Node *first_arg,
 						   bool *attisset);
-	
-void func_error(char *caller, char *funcname, int nargs, Oid *argtypes);
-
-				   
-
+extern void func_error(char *caller, char *funcname, int nargs, Oid *argtypes);
 
 #endif							/* PARSE_FUNC_H */
 
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index bac05cb1506..1eb063b8ee8 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_node.h,v 1.1 1997/11/25 22:06:57 momjian Exp $
+ * $Id: parse_node.h,v 1.2 1997/11/26 01:14:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,27 +41,20 @@ typedef struct ParseState
 	RangeTblEntry *p_target_rangetblentry;
 } ParseState;
 
-ParseState *make_parsestate(void);
-
-Node *make_operand(char *opname,
+extern ParseState *make_parsestate(void);
+extern Node *make_operand(char *opname,
 			 Node *tree,
 			 Oid orig_typeId,
 			 Oid true_typeId);
-
-void disallow_setop(char *op, Type optype, Node *operand);
-
-Expr *make_op(char *opname, Node *ltree, Node *rtree);
-
-Var *make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id);
-
-ArrayRef   *make_array_ref(Node *expr,
+extern void disallow_setop(char *op, Type optype, Node *operand);
+extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
+extern Var *make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id);
+extern ArrayRef   *make_array_ref(Node *expr,
 			   List *indirection);
-
-ArrayRef   *make_array_set(Expr *target_expr,
+extern ArrayRef   *make_array_set(Expr *target_expr,
 						   List *upperIndexpr,
 						   List *lowerIndexpr,
 						   Expr *expr);
-
-Const *make_const(Value *value);
+extern Const *make_const(Value *value);
 			   
 #endif							/* PARSE_NODE_H */
diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h
index c013af628c3..dd32290ddeb 100644
--- a/src/include/parser/parse_oper.h
+++ b/src/include/parser/parse_oper.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_oper.h,v 1.1 1997/11/25 22:06:59 momjian Exp $
+ * $Id: parse_oper.h,v 1.2 1997/11/26 01:14:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,33 +18,23 @@
 
 typedef HeapTuple Operator;
 
-Oid any_ordering_op(int restype);
-
-Oid oprid(Operator op);
-
-int binary_oper_get_candidates(char *opname,
+extern Oid any_ordering_op(int restype);
+extern Oid oprid(Operator op);
+extern int binary_oper_get_candidates(char *opname,
 						   Oid leftTypeId,
 						   Oid rightTypeId,
 						   CandidateList *candidates);
-
-bool equivalentOpersAfterPromotion(CandidateList candidates);
-
-CandidateList binary_oper_select_candidate(Oid arg1,
+extern bool equivalentOpersAfterPromotion(CandidateList candidates);
+extern CandidateList binary_oper_select_candidate(Oid arg1,
 							 Oid arg2,
 							 CandidateList candidates);
-
-Operator oper(char *op, Oid arg1, Oid arg2, bool noWarnings);
-
-int
-unary_oper_get_candidates(char *op,
+extern Operator oper(char *op, Oid arg1, Oid arg2, bool noWarnings);
+extern int unary_oper_get_candidates(char *op,
 						  Oid typeId,
 						  CandidateList *candidates,
 						  char rightleft);
-
-Operator right_oper(char *op, Oid arg);
-						  
-Operator left_oper(char *op, Oid arg);
-
-void op_error(char *op, Oid arg1, Oid arg2);
+extern Operator right_oper(char *op, Oid arg);
+extern Operator left_oper(char *op, Oid arg);
+extern void op_error(char *op, Oid arg1, Oid arg2);
 
 #endif							/* PARSE_OPER_H */
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index ed470822ff5..4dc909e594e 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_relation.h,v 1.1 1997/11/25 22:07:02 momjian Exp $
+ * $Id: parse_relation.h,v 1.2 1997/11/26 01:14:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,37 +20,25 @@
 #include <parser/parse_node.h>
 #include <utils/rel.h>
 
-RangeTblEntry *refnameRangeTableEntry(List *rtable, char *refname);
-
-int refnameRangeTablePosn(List *rtable, char *refname);
-
-RangeTblEntry *colnameRangeTableEntry(ParseState *pstate, char *colname);
-
-RangeTblEntry *addRangeTableEntry(ParseState *pstate,
+extern RangeTblEntry *refnameRangeTableEntry(List *rtable, char *refname);
+extern int refnameRangeTablePosn(List *rtable, char *refname);
+extern RangeTblEntry *colnameRangeTableEntry(ParseState *pstate, char *colname);
+extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
 								   char *relname,
 								   char *refname,
 								   bool inh,
 								   bool inFromCl);
-
-List *expandAll(ParseState *pstate, char *relname, char *refname,
+extern List *expandAll(ParseState *pstate, char *relname, char *refname,
 						int *this_resno);
-
-int attnameAttNum(Relation rd, char *a);
-
-bool attnameIsSet(Relation rd, char *name);
-
-char *attnumAttName(Relation rd, int attrno);
-
-int attnumAttNelems(Relation rd, int attid);
-
-Oid attnameTypeId(Oid relid, char *attrname);
-
-Oid attnumTypeId(Relation rd, int attid);
-
-void handleTargetColname(ParseState *pstate, char **resname,
+extern int attnameAttNum(Relation rd, char *a);
+extern bool attnameIsSet(Relation rd, char *name);
+extern char *attnumAttName(Relation rd, int attrno);
+extern int attnumAttNelems(Relation rd, int attid);
+extern Oid attnameTypeId(Oid relid, char *attrname);
+extern Oid attnumTypeId(Relation rd, int attid);
+extern void handleTargetColname(ParseState *pstate, char **resname,
 					char *refname, char *colname);
-
-void checkTargetTypes(ParseState *pstate, char *target_colname,
+extern void checkTargetTypes(ParseState *pstate, char *target_colname,
 				 char *refname, char *colname);
 
 #endif							/* PARSE_RANGE_H */
diff --git a/src/include/parser/parse_target.h b/src/include/parser/parse_target.h
index c7faa6b3db9..6b7451d565b 100644
--- a/src/include/parser/parse_target.h
+++ b/src/include/parser/parse_target.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_target.h,v 1.1 1997/11/25 22:07:06 momjian Exp $
+ * $Id: parse_target.h,v 1.2 1997/11/26 01:14:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,18 +22,14 @@
 #define EXPR_COLUMN_FIRST	1
 #define EXPR_RELATION_FIRST	2
 
-List *transformTargetList(ParseState *pstate, List *targetlist);
-
-TargetEntry *make_targetlist_expr(ParseState *pstate,
+extern List *transformTargetList(ParseState *pstate, List *targetlist);
+extern TargetEntry *make_targetlist_expr(ParseState *pstate,
 					 char *colname,
 					 Node *expr,
 					 List *arrayRef);
-
-List *expandAllTables(ParseState *pstate);
-
-char *figureColname(Node *expr, Node *resval);
-
-List *makeTargetNames(ParseState *pstate, List *cols);
+extern List *expandAllTables(ParseState *pstate);
+extern char *figureColname(Node *expr, Node *resval);
+extern List *makeTargetNames(ParseState *pstate, List *cols);
 
 #endif							/* PARSE_TARGET_H */
 
diff --git a/src/include/parser/parse_type.h b/src/include/parser/parse_type.h
index 63c38ab98dc..fa2025994c7 100644
--- a/src/include/parser/parse_type.h
+++ b/src/include/parser/parse_type.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_type.h,v 1.1 1997/11/25 22:07:07 momjian Exp $
+ * $Id: parse_type.h,v 1.2 1997/11/26 01:14:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,21 +17,21 @@
 
 typedef HeapTuple Type;
 
-bool typeidIsValid(Oid id);
-Type typeidType(Oid id);
-Type typenameType(char *s);
-char *typeidTypeName(Oid id);
-Oid typeTypeId(Type tp);
-int16 typeLen(Type t);
-bool typeByVal(Type t);
-char *typeTypeName(Type t);
-char typeTypeFlag(Type t);
-char *stringTypeString(Type tp, char *string, int typlen);
-Oid typeidRetoutfunc(Oid type_id);
-Oid typeidTypeRelid(Oid type_id);
-Oid typeTypeRelid(Type typ);
-Oid typeidTypElem(Oid type_id);
-Oid GetArrayElementType(Oid typearray);
-Oid typeidRetinfunc(Oid type_id);
+extern bool typeidIsValid(Oid id);
+extern Type typeidType(Oid id);
+extern Type typenameType(char *s);
+extern char *typeidTypeName(Oid id);
+extern Oid typeTypeId(Type tp);
+extern int16 typeLen(Type t);
+extern bool typeByVal(Type t);
+extern char *typeTypeName(Type t);
+extern char typeTypeFlag(Type t);
+extern char *stringTypeString(Type tp, char *string, int typlen);
+extern Oid typeidRetoutfunc(Oid type_id);
+extern Oid typeidTypeRelid(Oid type_id);
+extern Oid typeTypeRelid(Type typ);
+extern Oid typeidTypElem(Oid type_id);
+extern Oid GetArrayElementType(Oid typearray);
+extern Oid typeidRetinfunc(Oid type_id);
 
 #endif							/* PARSE_TYPE_H */
diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h
index 4362ebb4803..820d7f960aa 100644
--- a/src/include/parser/parser.h
+++ b/src/include/parser/parser.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parser.h,v 1.1 1997/11/25 22:07:08 momjian Exp $
+ * $Id: parser.h,v 1.2 1997/11/26 01:14:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,7 +15,7 @@
 
 #include <parser/parse_node.h>
 
-QueryTreeList *parser(char *str, Oid *typev, int nargs);
+extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
 
 #endif							/* PARSER_H */
 
diff --git a/src/include/parser/scansup.h b/src/include/parser/scansup.h
index 660a63db4ea..9a30962cce2 100644
--- a/src/include/parser/scansup.h
+++ b/src/include/parser/scansup.h
@@ -6,9 +6,14 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: scansup.h,v 1.3 1997/09/08 02:38:16 momjian Exp $
+ * $Id: scansup.h,v 1.4 1997/11/26 01:14:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
+#ifndef SCANSUP_H
+#define SCANSUP_H
+
 extern char *scanstr(char *s);
+
+#endif							/* SCANSUP_H */
diff --git a/src/include/rewrite/rewriteDefine.h b/src/include/rewrite/rewriteDefine.h
index ca72f191059..c002dd58f06 100644
--- a/src/include/rewrite/rewriteDefine.h
+++ b/src/include/rewrite/rewriteDefine.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteDefine.h,v 1.4 1997/09/08 21:54:05 momjian Exp $
+ * $Id: rewriteDefine.h,v 1.5 1997/11/26 01:14:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef REWRITEDEFINE_H
 #define REWRITEDEFINE_H
 
+#include "nodes/parsenodes.h"
+
 extern void DefineQueryRewrite(RuleStmt *args);
 
 #endif							/* REWRITEDEFINE_H */
diff --git a/src/include/rewrite/rewriteHandler.h b/src/include/rewrite/rewriteHandler.h
index 344fd7ae512..e55e2086bcb 100644
--- a/src/include/rewrite/rewriteHandler.h
+++ b/src/include/rewrite/rewriteHandler.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteHandler.h,v 1.4 1997/09/08 21:54:07 momjian Exp $
+ * $Id: rewriteHandler.h,v 1.5 1997/11/26 01:14:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef REWRITEHANDLER_H
 #define REWRITEHANDLER_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
 
 struct _rewrite_meta_knowledge
 {
diff --git a/src/include/rewrite/rewriteManip.h b/src/include/rewrite/rewriteManip.h
index fc8935f1c84..175cdd6ca88 100644
--- a/src/include/rewrite/rewriteManip.h
+++ b/src/include/rewrite/rewriteManip.h
@@ -6,13 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteManip.h,v 1.4 1997/09/08 21:54:09 momjian Exp $
+ * $Id: rewriteManip.h,v 1.5 1997/11/26 01:14:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef REWRITEMANIP_H
 #define REWRITEMANIP_H
 
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "rewrite/rewriteHandler.h"
+
 /* RewriteManip.c */
 void		OffsetVarNodes(Node *node, int offset);
 void		ChangeVarNodes(Node *node, int old_varno, int new_varno);
diff --git a/src/include/rewrite/rewriteSupport.h b/src/include/rewrite/rewriteSupport.h
index e7b910250be..8f89dfaa973 100644
--- a/src/include/rewrite/rewriteSupport.h
+++ b/src/include/rewrite/rewriteSupport.h
@@ -6,13 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteSupport.h,v 1.5 1997/09/08 21:54:11 momjian Exp $
+ * $Id: rewriteSupport.h,v 1.6 1997/11/26 01:14:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef REWRITESUPPORT_H
 #define REWRITESUPPORT_H
 
+#include "access/attnum.h"
+#include "nodes/pg_list.h"
 
 extern int	IsDefinedRewriteRule(char *ruleName);
 
diff --git a/src/include/utils/lselect.h b/src/include/utils/lselect.h
index a820f2ddaf5..05dd1d10cc3 100644
--- a/src/include/utils/lselect.h
+++ b/src/include/utils/lselect.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lselect.h,v 1.7 1997/09/08 21:55:10 momjian Exp $
+ * $Id: lselect.h,v 1.8 1997/11/26 01:14:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -14,7 +14,11 @@
 #define LSELECT_H
 
 #include <stdio.h>
+
+#include "access/skey.h"
+#include "access/tupdesc.h"
 #include "access/htup.h"
+#include "utils/syscache.h"
 
 struct leftist
 {
-- 
GitLab