diff --git a/doc/TODO b/doc/TODO
index eb6dbb47aec0e4b6865bf75d5dbf896030c381ca..ba31e77e1d911fe68dce52120e2a6bdd44b2194a 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -37,6 +37,7 @@ PARSER
 * Unique index on base column not honored on inserts from inherited table
   INSERT INTO inherit_table (unique_index_col) VALUES (dup) should fail
 *  CREATE TABLE x AS SELECT 1 UNION SELECT 2 fails
+* CREATE TABLE test(col char(2) DEFAULT user) fails in length restriction
 
 VIEWS
 
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 7955fd6bfe8185b537a1cceb171b49667c1747d1..fb98694b18c33ad2b0928c269bc9331131c597fe 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -6,17 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: genam.h,v 1.19 1999/07/15 23:03:33 momjian Exp $
+ * $Id: genam.h,v 1.20 1999/07/16 17:07:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef GENAM_H
 #define GENAM_H
 
-#include "access/sdir.h"
 #include "access/funcindex.h"
-#include "access/relscan.h"
 #include "access/itup.h"
+#include "access/relscan.h"
+#include "access/sdir.h"
 
 /* ----------------
  *		generalized index_ interface routines
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 08739e70ca69bea10784398d62cd12b8445322c9..1dc84bf9e763c012c81d1bac3c8ffdecebe31935 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: hash.h,v 1.26 1999/07/15 23:03:34 momjian Exp $
+ * $Id: hash.h,v 1.27 1999/07/16 17:07:26 momjian Exp $
  *
  * NOTES
  *		modeled after Margo Seltzer's hash implementation for unix.
@@ -16,10 +16,10 @@
 #ifndef HASH_H
 #define HASH_H
 
-#include "access/sdir.h"
 #include "access/funcindex.h"
-#include "access/relscan.h"
 #include "access/itup.h"
+#include "access/relscan.h"
+#include "access/sdir.h"
 #include "utils/int8.h"
 
 /*
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 1071fa6d9cf2e0cb0532e7e2a9e41bca537d8c57..8c1461122fcbf7c239c57b59609b6f185a7af8cb 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heapam.h,v 1.44 1999/07/15 15:20:53 momjian Exp $
+ * $Id: heapam.h,v 1.45 1999/07/16 17:07:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -14,9 +14,9 @@
 #define HEAPAM_H
 
 #include <time.h>
-#include "access/tupmacs.h"
 #include "access/htup.h"
 #include "access/relscan.h"
+#include "access/tupmacs.h"
 #include "storage/block.h"
 #include "utils/rel.h"
 #include "utils/tqual.h"
diff --git a/src/include/access/iqual.h b/src/include/access/iqual.h
index 15e576e65a7fa109116690e87e77f277e2178b83..7e223082c99ef04941ca4903361511bf8b8316c2 100644
--- a/src/include/access/iqual.h
+++ b/src/include/access/iqual.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: iqual.h,v 1.12 1999/07/15 23:03:34 momjian Exp $
+ * $Id: iqual.h,v 1.13 1999/07/16 17:07:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef IQUAL_H
 #define IQUAL_H
 
-#include "access/skey.h"
 #include "access/itup.h"
+#include "access/skey.h"
 
 
 /* ----------------
diff --git a/src/include/access/itup.h b/src/include/access/itup.h
index d324e0c7addcc3b44eb54a1417474d9ae02fb2ea..223c7f2bd2eafbc5d9c98d5af3f106fe0542d50f 100644
--- a/src/include/access/itup.h
+++ b/src/include/access/itup.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itup.h,v 1.19 1999/07/15 23:03:35 momjian Exp $
+ * $Id: itup.h,v 1.20 1999/07/16 17:07:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -14,8 +14,8 @@
 #define ITUP_H
 
 #include "access/ibit.h"
-#include "access/tupmacs.h"
 #include "access/tupdesc.h"
+#include "access/tupmacs.h"
 #include "storage/itemptr.h"
 
 #define MaxIndexAttributeNumber 7
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index f5d50533676a7d7e241d5f30ac842c264a2d0913..5e968e49229a384cb7d78d966b424098760c4208 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -6,17 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nbtree.h,v 1.29 1999/07/15 23:03:35 momjian Exp $
+ * $Id: nbtree.h,v 1.30 1999/07/16 17:07:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef NBTREE_H
 #define NBTREE_H
 
-#include "access/sdir.h"
-#include "access/relscan.h"
 #include "access/funcindex.h"
 #include "access/itup.h"
+#include "access/relscan.h"
+#include "access/sdir.h"
 
 /*
  *	BTPageOpaqueData -- At the end of every page, we store a pointer
diff --git a/src/include/access/rtscan.h b/src/include/access/rtscan.h
index 8ad9943ac06a922b29d2b7c5f4c652046a7b33fe..798e2b2a06645c430093f0e4c9a8d2264167f67b 100644
--- a/src/include/access/rtscan.h
+++ b/src/include/access/rtscan.h
@@ -6,16 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rtscan.h,v 1.7 1999/07/15 23:03:37 momjian Exp $
+ * $Id: rtscan.h,v 1.8 1999/07/16 17:07:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef RTSCAN_H
 #define RTSCAN_H
 
-#include "utils/rel.h"
 #include "storage/block.h"
 #include "storage/off.h"
+#include "utils/rel.h"
 
 void		rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum);
 
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h
index 98e6492440ba988f3519a16ce03c535f6f515ccc..c1b30598b952ba7bf498be9b8b58354a61a5161a 100644
--- a/src/include/access/tupdesc.h
+++ b/src/include/access/tupdesc.h
@@ -6,16 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tupdesc.h,v 1.23 1999/07/15 23:03:38 momjian Exp $
+ * $Id: tupdesc.h,v 1.24 1999/07/16 17:07:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef TUPDESC_H
 #define TUPDESC_H
 
-#include "nodes/pg_list.h"
 #include "access/attnum.h"
 #include "catalog/pg_attribute.h"
+#include "nodes/pg_list.h"
 
 
 typedef struct attrDefault
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 44c9d4b7a6e232547311b8ce962bcafd8ce2e531..f6c918ad01a8f5401dbdb81d2e30fc6713d0f016 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xact.h,v 1.22 1999/07/15 23:03:38 momjian Exp $
+ * $Id: xact.h,v 1.23 1999/07/16 17:07:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef XACT_H
 #define XACT_H
 
-#include "utils/nabstime.h"
 #include "access/transam.h"
+#include "utils/nabstime.h"
 
 /* ----------------
  *		transaction state structure
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index b26e4acc711450ca1a967d54e6269becc97ed6ec..004d2461886f79d407c8cb262095ff9306294e06 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: index.h,v 1.18 1999/07/15 23:03:42 momjian Exp $
+ * $Id: index.h,v 1.19 1999/07/16 17:07:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef INDEX_H
 #define INDEX_H
 
-#include "nodes/execnodes.h"
 #include "access/itup.h"
+#include "nodes/execnodes.h"
 
 extern Form_pg_am AccessMethodObjectIdGetForm(Oid accessMethodObjectId);
 
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 63e1559f44e44bb61999aa39082a458862072f2d..dc50284014ffaa06563e321eaabdee1d951d50d2 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: defrem.h,v 1.16 1999/07/15 23:03:44 momjian Exp $
+ * $Id: defrem.h,v 1.17 1999/07/16 17:07:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef DEFREM_H
 #define DEFREM_H
 
-#include "tcop/dest.h"
 #include "nodes/parsenodes.h"
+#include "tcop/dest.h"
 
 /*
  * prototypes in defind.c
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index 27a7a47d2c0de320043d7eff82df812396b362b8..81157ab86d17574ae48c6a194b9f77376a7aa20f 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -5,15 +5,15 @@
  *
  * Copyright (c) 1994-5, Regents of the University of California
  *
- * $Id: explain.h,v 1.8 1999/02/13 23:21:19 momjian Exp $
+ * $Id: explain.h,v 1.9 1999/07/16 17:07:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXPLAIN_H
 #define EXPLAIN_H
 
-#include "tcop/dest.h"
 #include "nodes/parsenodes.h"
+#include "tcop/dest.h"
 
 extern void ExplainQuery(Query *query, bool verbose, CommandDest dest);
 
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 9b7fff0b249cec5a4ce08bf5c46444dd631049a7..99350d55d1348cae02d58e5715d0941bcab0855b 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -9,8 +9,8 @@
 #ifndef TRIGGER_H
 #define TRIGGER_H
 
-#include "nodes/parsenodes.h"
 #include "nodes/execnodes.h"
+#include "nodes/parsenodes.h"
 
 typedef uint32 TriggerEvent;
 
diff --git a/src/include/executor/execFlatten.h b/src/include/executor/execFlatten.h
index e7df6135d0c3bba96a617dbdbf96e375ebe7c819..1a5d111ef30f63f1634af584c72fa63c26845814 100644
--- a/src/include/executor/execFlatten.h
+++ b/src/include/executor/execFlatten.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execFlatten.h,v 1.9 1999/07/15 15:21:04 momjian Exp $
+ * $Id: execFlatten.h,v 1.10 1999/07/16 17:07:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXECFLATTEN_H
 #define EXECFLATTEN_H
 
-#include "nodes/relation.h"
 #include "nodes/execnodes.h"
+#include "nodes/relation.h"
 
 extern Datum ExecEvalIter(Iter *iterNode, ExprContext *econtext, bool *resultIsNull, bool *iterIsDone);
 
diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h
index 19823ac0e25351094db8db9211679a94e51fc674..046268fe1b6709247092fa5abdbb567f59cbf88f 100644
--- a/src/include/executor/execdesc.h
+++ b/src/include/executor/execdesc.h
@@ -7,16 +7,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execdesc.h,v 1.11 1999/07/15 23:03:47 momjian Exp $
+ * $Id: execdesc.h,v 1.12 1999/07/16 17:07:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXECDESC_H
 #define EXECDESC_H
 
-#include "tcop/dest.h"
-#include "nodes/plannodes.h"
 #include "nodes/parsenodes.h"
+#include "nodes/plannodes.h"
+#include "tcop/dest.h"
 
 /* ----------------
  *		query descriptor:
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index ca2e427e0190e1dcb7c796b7b4aa42e0d28f0701..3b9cf8a8c9a7064699fb19481e924909d1a0f9d3 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -6,20 +6,20 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execnodes.h,v 1.32 1999/07/15 23:03:52 momjian Exp $
+ * $Id: execnodes.h,v 1.33 1999/07/16 17:07:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef EXECNODES_H
 #define EXECNODES_H
 
-#include "nodes/primnodes.h"
-#include "executor/hashjoin.h"
+#include "access/funcindex.h"
 #include "access/relscan.h"
 #include "access/sdir.h"
-#include "nodes/params.h"
+#include "executor/hashjoin.h"
 #include "executor/tuptable.h"
-#include "access/funcindex.h"
+#include "nodes/params.h"
+#include "nodes/primnodes.h"
 
 /* ----------------
  *	  IndexInfo information
diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h
index 39130ef0edf7e0d8a304d7b27818dfdb97dfec9b..f7478a9bf4fe793d2460ffe50976c24605226543 100644
--- a/src/include/nodes/memnodes.h
+++ b/src/include/nodes/memnodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: memnodes.h,v 1.14 1999/07/15 23:03:53 momjian Exp $
+ * $Id: memnodes.h,v 1.15 1999/07/16 17:07:33 momjian Exp $
  *
  * XXX the typedefs in this file are different from the other ???nodes.h;
  *	  they are pointers to structures instead of the structures themselves.
@@ -19,8 +19,8 @@
 #define MEMNODES_H
 
 #include "lib/fstack.h"
-#include "utils/memutils.h"
 #include "nodes/nodes.h"
+#include "utils/memutils.h"
 
 /*
  * MemoryContext
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 5f3fbb36c2a3fc20a274a22561600e954fbd3a5a..397575bdcf8e6882a4db36ffc0ae948c690db651 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -6,16 +6,16 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: primnodes.h,v 1.30 1999/07/15 23:03:56 momjian Exp $
+ * $Id: primnodes.h,v 1.31 1999/07/16 17:07:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PRIMNODES_H
 #define PRIMNODES_H
 
-#include "utils/fcache.h"
 #include "access/attnum.h"
 #include "nodes/pg_list.h"
+#include "utils/fcache.h"
 
 /* ----------------------------------------------------------------
  *						node definitions
diff --git a/src/include/optimizer/_deadcode/xfunc.h b/src/include/optimizer/_deadcode/xfunc.h
index 4ec0c5aabb74845278e4511922dae0b4d58d99ad..d10078a4b18cba91afdae551a03a7772bcb4b2c8 100644
--- a/src/include/optimizer/_deadcode/xfunc.h
+++ b/src/include/optimizer/_deadcode/xfunc.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xfunc.h,v 1.2 1999/07/15 23:03:59 momjian Exp $
+ * $Id: xfunc.h,v 1.3 1999/07/16 17:07:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef XFUNC_H
 #define XFUNC_H
 
-#include "utils/rel.h"
 #include "nodes/relation.h"
+#include "utils/rel.h"
 
 /* command line arg flags */
 #define XFUNC_OFF -1			/* do no optimization of expensive preds */
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index 54733af3e7bf18ba140459957c789b8a2decd798..8e4128b8c60a264401c1abfef9f6e71bcc659095 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: prep.h,v 1.16 1999/07/15 23:03:59 momjian Exp $
+ * $Id: prep.h,v 1.17 1999/07/16 17:07:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PREP_H
 #define PREP_H
 
-#include "nodes/plannodes.h"
 #include "nodes/parsenodes.h"
+#include "nodes/plannodes.h"
 
 /*
  * prototypes for prepqual.c
diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h
index 5976421735592c1d93f7af56e1f43fe6263c8379..02a1eed11e7060a99cde482cbee5c3dc8797e559 100644
--- a/src/include/parser/parse_coerce.h
+++ b/src/include/parser/parse_coerce.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_coerce.h,v 1.14 1999/07/15 15:21:26 momjian Exp $
+ * $Id: parse_coerce.h,v 1.15 1999/07/16 17:07:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PARSE_COERCE_H
 #define PARSE_COERCE_H
 
-#include "parser/parse_node.h"
 #include "catalog/pg_type.h"
+#include "parser/parse_node.h"
 
 typedef enum CATEGORY
 {
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 63640e53db16fc488b87d40e8c3808889290487a..5584aee242e26b4955bc0b7c90ed23079f985683 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.24 1999/07/15 15:20:47 momjian Exp $
+ * $Id: postgres.h,v 1.25 1999/07/16 17:07:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,9 +40,9 @@
 #include "config.h"
 #endif
 #include "c.h"
-#include "utils/palloc.h"
-#include "utils/mcxt.h"
 #include "utils/elog.h"
+#include "utils/mcxt.h"
+#include "utils/palloc.h"
 
 /* ----------------------------------------------------------------
  *				Section 1:	simple type definitions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 0b496f07bf5284d80864a18a36441b8430f6d045..98d8be3369d01802141091f9eb895d6807d35066 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: buf_internals.h,v 1.30 1999/07/15 23:04:08 momjian Exp $
+ * $Id: buf_internals.h,v 1.31 1999/07/16 17:07:37 momjian Exp $
  *
  * NOTE
  *		If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -17,8 +17,8 @@
 #ifndef BUFMGR_INTERNALS_H
 #define BUFMGR_INTERNALS_H
 
-#include "storage/lmgr.h"
 #include "storage/buf.h"
+#include "storage/lmgr.h"
 
 /* Buf Mgr constants */
 /* in bufmgr.c */
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 87f5be67a9f93b006fbe16f2c56dd9105fba887a..c7688e4ae139a302cf6e95e3f23c37e38021b14c 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -6,19 +6,19 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufpage.h,v 1.25 1999/07/15 23:04:09 momjian Exp $
+ * $Id: bufpage.h,v 1.26 1999/07/16 17:07:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef BUFPAGE_H
 #define BUFPAGE_H
 
-#include "storage/off.h"
-#include "storage/itemid.h"
-#include "storage/item.h"
 #include "storage/buf.h"
-#include "storage/page.h"
 #include "storage/bufmgr.h"
+#include "storage/item.h"
+#include "storage/itemid.h"
+#include "storage/off.h"
+#include "storage/page.h"
 
 /*
  * a postgres disk page is an abstraction layered on top of a postgres
diff --git a/src/include/storage/itempos.h b/src/include/storage/itempos.h
index 42368ddf5c3eed6816b897721796f36aa59e709e..0134815e9a8faff83b4856eb3996bc1f6a12e388 100644
--- a/src/include/storage/itempos.h
+++ b/src/include/storage/itempos.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itempos.h,v 1.8 1999/07/15 23:04:10 momjian Exp $
+ * $Id: itempos.h,v 1.9 1999/07/16 17:07:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef ITEMPOS_H
 #define ITEMPOS_H
 
-#include "storage/itemid.h"
 #include "storage/buf.h"
+#include "storage/itemid.h"
 
 typedef struct ItemSubpositionData
 {
diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 6d5f1e377e934d3c2d513ba7da1aeca4023d2750..b3b0569b7fbf9b74993003e054a9384510b6b910 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itemptr.h,v 1.12 1999/07/15 23:04:11 momjian Exp $
+ * $Id: itemptr.h,v 1.13 1999/07/16 17:07:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef ITEMPTR_H
 #define ITEMPTR_H
 
-#include "storage/off.h"
 #include "storage/block.h"
+#include "storage/off.h"
 
 /*
  * ItemPointer:
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index fb74629e63761cbfca6fc60ca7344645df10bdbb..87b8538212fcd3f1f42d2aca1b8d57ccb6d4ad1e 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lock.h,v 1.32 1999/07/15 23:04:12 momjian Exp $
+ * $Id: lock.h,v 1.33 1999/07/16 17:07:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef LOCK_H_
 #define LOCK_H_
 
-#include "storage/shmem.h"
 #include "storage/itemptr.h"
+#include "storage/shmem.h"
 #include "storage/sinvaladt.h"
 #include "utils/array.h"
 
diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h
index bb9e004ba261b98aa82dc35200c5973909aa59b3..d73404d1543e8ebfe5a66dc55e9531b0445dd474 100644
--- a/src/include/storage/shmem.h
+++ b/src/include/storage/shmem.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: shmem.h,v 1.19 1999/07/15 23:04:14 momjian Exp $
+ * $Id: shmem.h,v 1.20 1999/07/16 17:07:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef SHMEM_H
 #define SHMEM_H
 
-#include "utils/hsearch.h"
 #include "storage/spin.h"
+#include "utils/hsearch.h"
 
 
 /* The shared memory region can start at a different address
diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h
index 03b2a3a8f5344a00d25ee8eb0ce9a3317424a0cb..4885b7380c808231eedaa75aab39b14a1bcde525 100644
--- a/src/include/storage/sinvaladt.h
+++ b/src/include/storage/sinvaladt.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: sinvaladt.h,v 1.15 1999/07/15 23:04:15 momjian Exp $
+ * $Id: sinvaladt.h,v 1.16 1999/07/16 17:07:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef SINVALADT_H
 #define SINVALADT_H
 
-#include "storage/itemptr.h"
 #include "storage/ipc.h"
+#include "storage/itemptr.h"
 
 /*
  * The structure of the shared cache invaidation segment
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index c1e81abcf55331e68f7f2e191402246ac3f4b3f9..23b300e51f1469737a74a15f616744fcd37c9e37 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -6,15 +6,15 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: smgr.h,v 1.15 1999/07/15 23:04:15 momjian Exp $
+ * $Id: smgr.h,v 1.16 1999/07/16 17:07:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef SMGR_H
 #define SMGR_H
 
-#include "storage/spin.h"
 #include "storage/block.h"
+#include "storage/spin.h"
 #include "utils/rel.h"
 
 #define SM_FAIL			0
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 58dd539b91beb0e65597cd0012c98cba67408594..e6a0b4157d5ea5ce013ed614513925f0975bbd8b 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.83 1999/07/15 23:04:20 momjian Exp $
+ * $Id: builtins.h,v 1.84 1999/07/16 17:07:39 momjian Exp $
  *
  * NOTES
  *	  This should normally only be included by fmgr.h.
@@ -24,11 +24,11 @@
 
 #include "storage/itemptr.h"
 #include "utils/array.h"
-#include "utils/geo_decls.h"
 #include "utils/datetime.h"
-#include "utils/nabstime.h"
-#include "utils/int8.h"
+#include "utils/geo_decls.h"
 #include "utils/inet.h"
+#include "utils/int8.h"
+#include "utils/nabstime.h"
 #include "utils/numeric.h"
 
 /*
diff --git a/src/include/utils/psort.h b/src/include/utils/psort.h
index c3e0295302dc2322f6d6e920ddc736be770130eb..0deac024154413aa0b1799295da2e18adecf76a2 100644
--- a/src/include/utils/psort.h
+++ b/src/include/utils/psort.h
@@ -6,17 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: psort.h,v 1.20 1999/07/15 15:21:42 momjian Exp $
+ * $Id: psort.h,v 1.21 1999/07/16 17:07:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PSORT_H
 #define PSORT_H
 
-#include "storage/fd.h"
 #include "access/relscan.h"
-#include "utils/lselect.h"
 #include "nodes/plannodes.h"
+#include "storage/fd.h"
+#include "utils/lselect.h"
 
 #define MAXTAPES		7		/* See Knuth Fig. 70, p273 */
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 3dba1337beb5060485e616cb5609cdd3a9628f41..c95f51e89d1e523af92d2c3a3ad2f83dc290c392 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -6,17 +6,17 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rel.h,v 1.24 1999/07/15 23:04:23 momjian Exp $
+ * $Id: rel.h,v 1.25 1999/07/16 17:07:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef REL_H
 #define REL_H
 
-#include "catalog/pg_am.h"
-#include "catalog/pg_class.h"
 #include "access/strat.h"
 #include "access/tupdesc.h"
+#include "catalog/pg_am.h"
+#include "catalog/pg_class.h"
 #include "rewrite/prs2lock.h"
 #include "storage/fd.h"
 
diff --git a/src/tools/pginclude/pgnoinclude b/src/tools/pginclude/pgnoinclude
index 35f191fa6a27b586e5b896852dad88ee0d62bd65..73f4578e716b7983547e163b1d2efac32114c80b 100755
--- a/src/tools/pginclude/pgnoinclude
+++ b/src/tools/pginclude/pgnoinclude
@@ -19,6 +19,9 @@ do
 	do
 		[ -s /usr/include/$INCLUDE ] && continue
 		[ "$INCLUDE" = postgres.h ] && continue
+		# preserve configure-specific includes
+		grep -B1 -A1 -q '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' |
+		     egrep -q '^#if|^#else|^#endif' && continue		
 		cat /tmp/$$a |
 		grep -v '^#include[ 	]*[<"]'"$INCLUDE"'[>"]' >/tmp/$$b
 		if [ "$IS_INCLUDE" = "Y" ]