diff --git a/contrib/cube/buffer.c b/contrib/cube/buffer.c
index 0bcc2d19b57f61ca1ffb35d1cac49d5c7856d8d5..bab7ae303c629980518be73bf6647a9f6a02ee37 100644
--- a/contrib/cube/buffer.c
+++ b/contrib/cube/buffer.c
@@ -4,76 +4,81 @@
 
 #include "utils/elog.h"
 
-static char *       PARSE_BUFFER;
-static char *       PARSE_BUFFER_PTR; 
-static unsigned int PARSE_BUFFER_SIZE; 
+static char *PARSE_BUFFER;
+static char *PARSE_BUFFER_PTR;
+static unsigned int PARSE_BUFFER_SIZE;
 static unsigned int SCANNER_POS;
 
-void         set_parse_buffer( char* s );
-void         reset_parse_buffer( void );
-int          read_parse_buffer( void );
-char *       parse_buffer( void );
-char *       parse_buffer_ptr( void );
-unsigned int parse_buffer_curr_char( void );
-unsigned int parse_buffer_size( void );
-unsigned int parse_buffer_pos( void );
+void		set_parse_buffer(char *s);
+void		reset_parse_buffer(void);
+int			read_parse_buffer(void);
+char	   *parse_buffer(void);
+char	   *parse_buffer_ptr(void);
+unsigned int parse_buffer_curr_char(void);
+unsigned int parse_buffer_size(void);
+unsigned int parse_buffer_pos(void);
 
-extern void cube_flush_scanner_buffer(void); /* defined in cubescan.l */
+extern void cube_flush_scanner_buffer(void);	/* defined in cubescan.l */
 
-void set_parse_buffer( char* s )
+void
+set_parse_buffer(char *s)
 {
-  PARSE_BUFFER = s;
-  PARSE_BUFFER_SIZE = strlen(s);
-  if ( PARSE_BUFFER_SIZE == 0 ) {
-    elog(ERROR, "cube_in: can't parse an empty string");
-  }
-  PARSE_BUFFER_PTR = PARSE_BUFFER;
-  SCANNER_POS = 0;
+	PARSE_BUFFER = s;
+	PARSE_BUFFER_SIZE = strlen(s);
+	if (PARSE_BUFFER_SIZE == 0)
+		elog(ERROR, "cube_in: can't parse an empty string");
+	PARSE_BUFFER_PTR = PARSE_BUFFER;
+	SCANNER_POS = 0;
 }
 
-void reset_parse_buffer( void )
+void
+reset_parse_buffer(void)
 {
-  PARSE_BUFFER_PTR = PARSE_BUFFER;
-  SCANNER_POS = 0;
-  cube_flush_scanner_buffer();
+	PARSE_BUFFER_PTR = PARSE_BUFFER;
+	SCANNER_POS = 0;
+	cube_flush_scanner_buffer();
 }
 
-int read_parse_buffer( void )
+int
+read_parse_buffer(void)
 {
-  int c;
-  /*
-  c = *PARSE_BUFFER_PTR++;
-  SCANNER_POS++;
-  */
-  c = PARSE_BUFFER[SCANNER_POS];
-  if(SCANNER_POS < PARSE_BUFFER_SIZE)
-    SCANNER_POS++;
-  return c;
+	int			c;
+
+	/*
+	 * c = *PARSE_BUFFER_PTR++; SCANNER_POS++;
+	 */
+	c = PARSE_BUFFER[SCANNER_POS];
+	if (SCANNER_POS < PARSE_BUFFER_SIZE)
+		SCANNER_POS++;
+	return c;
 }
 
-char * parse_buffer( void )
+char *
+parse_buffer(void)
 {
-  return PARSE_BUFFER;
+	return PARSE_BUFFER;
 }
 
-unsigned int parse_buffer_curr_char( void )
+unsigned int
+parse_buffer_curr_char(void)
 {
-  return PARSE_BUFFER[SCANNER_POS];
+	return PARSE_BUFFER[SCANNER_POS];
 }
 
-char * parse_buffer_ptr( void )
+char *
+parse_buffer_ptr(void)
 {
-  return PARSE_BUFFER_PTR;
+	return PARSE_BUFFER_PTR;
 }
 
-unsigned int parse_buffer_pos( void )
+unsigned int
+parse_buffer_pos(void)
 {
-  return SCANNER_POS;
+	return SCANNER_POS;
 }
 
-unsigned int parse_buffer_size( void )
+unsigned int
+parse_buffer_size(void)
 {
-  return PARSE_BUFFER_SIZE;
+	return PARSE_BUFFER_SIZE;
 }
-
-
diff --git a/contrib/cube/buffer.h b/contrib/cube/buffer.h
index fd41a7b69b713e2b4dc23716af8905477ff8a379..eef9124dac5eff3cbbc4236b13970b4a6862cf46 100644
--- a/contrib/cube/buffer.h
+++ b/contrib/cube/buffer.h
@@ -1,8 +1,8 @@
-extern void set_parse_buffer( char* s );
-extern void reset_parse_buffer( void );
-extern int read_parse_buffer( void );
-extern char * parse_buffer( void );
-extern char * parse_buffer_ptr( void );
-extern unsigned int parse_buffer_curr_char( void );
-extern unsigned int parse_buffer_pos( void );
-extern unsigned int parse_buffer_size( void );
+extern void set_parse_buffer(char *s);
+extern void reset_parse_buffer(void);
+extern int	read_parse_buffer(void);
+extern char *parse_buffer(void);
+extern char *parse_buffer_ptr(void);
+extern unsigned int parse_buffer_curr_char(void);
+extern unsigned int parse_buffer_pos(void);
+extern unsigned int parse_buffer_size(void);
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 35ac34f0b047322e9b7e26ec0036a192c189f497..4d6169a48020fe9ea42390e4fee2b1ebc123a6f9 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -16,67 +16,67 @@
 
 #include "cubedata.h"
 
-#define max(a,b)        ((a) >  (b) ? (a) : (b))
-#define min(a,b)        ((a) <= (b) ? (a) : (b))
-#define abs(a)          ((a) <  (0) ? (-a) : (a))
+#define max(a,b)		((a) >	(b) ? (a) : (b))
+#define min(a,b)		((a) <= (b) ? (a) : (b))
+#define abs(a)			((a) <	(0) ? (-a) : (a))
 
-extern void  set_parse_buffer(char *str);
-extern int   cube_yyparse();
+extern void set_parse_buffer(char *str);
+extern int	cube_yyparse();
 
 /*
 ** Input/Output routines
 */
-NDBOX *      cube_in(char *str);
-char *       cube_out(NDBOX *cube);
+NDBOX	   *cube_in(char *str);
+char	   *cube_out(NDBOX * cube);
 
 
-/* 
+/*
 ** GiST support methods
 */
-bool             g_cube_consistent(GISTENTRY *entry, NDBOX *query, StrategyNumber strategy); 
-GISTENTRY *      g_cube_compress(GISTENTRY *entry);
-GISTENTRY *      g_cube_decompress(GISTENTRY *entry);
-float *          g_cube_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result);
-GIST_SPLITVEC *  g_cube_picksplit(bytea *entryvec, GIST_SPLITVEC *v);
-bool             g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
-bool             g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
-NDBOX *          g_cube_union(bytea *entryvec, int *sizep);
-NDBOX *          g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep);
-bool *           g_cube_same(NDBOX *b1, NDBOX *b2, bool *result);
+bool		g_cube_consistent(GISTENTRY *entry, NDBOX * query, StrategyNumber strategy);
+GISTENTRY  *g_cube_compress(GISTENTRY *entry);
+GISTENTRY  *g_cube_decompress(GISTENTRY *entry);
+float	   *g_cube_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result);
+GIST_SPLITVEC *g_cube_picksplit(bytea *entryvec, GIST_SPLITVEC *v);
+bool		g_cube_leaf_consistent(NDBOX * key, NDBOX * query, StrategyNumber strategy);
+bool		g_cube_internal_consistent(NDBOX * key, NDBOX * query, StrategyNumber strategy);
+NDBOX	   *g_cube_union(bytea *entryvec, int *sizep);
+NDBOX	   *g_cube_binary_union(NDBOX * r1, NDBOX * r2, int *sizep);
+bool	   *g_cube_same(NDBOX * b1, NDBOX * b2, bool *result);
 
 /*
 ** R-tree suport functions
 */
-bool         cube_same(NDBOX *a, NDBOX *b);
-bool         cube_different(NDBOX *a, NDBOX *b);
-bool         cube_contains(NDBOX *a, NDBOX *b);
-bool         cube_contained (NDBOX *a, NDBOX *b);
-bool         cube_overlap(NDBOX *a, NDBOX *b);
-NDBOX *      cube_union(NDBOX *a, NDBOX *b);
-NDBOX *      cube_inter(NDBOX *a, NDBOX *b);
-float *      cube_size(NDBOX *a);
-void         rt_cube_size(NDBOX *a, float *sz);
+bool		cube_same(NDBOX * a, NDBOX * b);
+bool		cube_different(NDBOX * a, NDBOX * b);
+bool		cube_contains(NDBOX * a, NDBOX * b);
+bool		cube_contained(NDBOX * a, NDBOX * b);
+bool		cube_overlap(NDBOX * a, NDBOX * b);
+NDBOX	   *cube_union(NDBOX * a, NDBOX * b);
+NDBOX	   *cube_inter(NDBOX * a, NDBOX * b);
+float	   *cube_size(NDBOX * a);
+void		rt_cube_size(NDBOX * a, float *sz);
 
 /*
 ** These make no sense for this type, but R-tree wants them
 */
-bool         cube_over_left(NDBOX *a, NDBOX *b);
-bool         cube_over_right(NDBOX *a, NDBOX *b);
-bool         cube_left(NDBOX *a, NDBOX *b);
-bool         cube_right(NDBOX *a, NDBOX *b);
+bool		cube_over_left(NDBOX * a, NDBOX * b);
+bool		cube_over_right(NDBOX * a, NDBOX * b);
+bool		cube_left(NDBOX * a, NDBOX * b);
+bool		cube_right(NDBOX * a, NDBOX * b);
 
 /*
 ** miscellaneous
 */
-bool         cube_lt(NDBOX *a, NDBOX *b);
-bool         cube_gt(NDBOX *a, NDBOX *b);
-float *      cube_distance(NDBOX *a, NDBOX *b);
+bool		cube_lt(NDBOX * a, NDBOX * b);
+bool		cube_gt(NDBOX * a, NDBOX * b);
+float	   *cube_distance(NDBOX * a, NDBOX * b);
 
-/* 
+/*
 ** Auxiliary funxtions
 */
-static       float distance_1D(float a1, float a2, float b1, float b2);
-static       NDBOX *swap_corners (NDBOX *a);
+static float distance_1D(float a1, float a2, float b1, float b2);
+static NDBOX *swap_corners(NDBOX * a);
 
 
 /*****************************************************************************
@@ -88,68 +88,71 @@ static       NDBOX *swap_corners (NDBOX *a);
 NDBOX *
 cube_in(char *str)
 {
-  void * result;
+	void	   *result;
 
-  set_parse_buffer( str );
+	set_parse_buffer(str);
 
-  if ( cube_yyparse(&result) != 0 ) {
-    return NULL;
-  } 
+	if (cube_yyparse(&result) != 0)
+		return NULL;
 
-  return ( (NDBOX *)result );
+	return ((NDBOX *) result);
 }
 
 /*
  * You might have noticed a slight inconsistency between the following
  * declaration and the SQL definition:
- *     CREATE FUNCTION cube_out(opaque) RETURNS opaque ...
+ *	   CREATE FUNCTION cube_out(opaque) RETURNS opaque ...
  * The reason is that the argument pass into cube_out is really just a
  * pointer. POSTGRES thinks all output functions are:
- *     char *out_func(char *);
+ *	   char *out_func(char *);
  */
 char *
-cube_out(NDBOX *cube)
+cube_out(NDBOX * cube)
 {
-    char *result;
-    char *p;
-    int equal = 1;
-    int dim = cube->dim;
-    int i;
-
-    if (cube == NULL)
-	return(NULL);
-
-    p = result = (char *) palloc(100);
-
-    /* while printing the first (LL) corner, check if it is equal
-    to the scond one */
-    p += sprintf(p, "(");
-    for ( i=0; i < dim; i++ ) {
-      p += sprintf(p, "%g", cube->x[i]);
-      p += sprintf(p, ", ");
-      if ( cube->x[i] != cube->x[i+dim] ) {
-	equal = 0;
-      }
-    }
-    p -= 2; /* get rid of the last ", " */
-    p += sprintf(p, ")");
-
-    if ( !equal ) {
-    p += sprintf(p, ",(");
-      for ( i=dim; i < dim * 2; i++ ) {
-	p += sprintf(p, "%g", cube->x[i]);
-	p += sprintf(p, ", ");
-      }
-      p -= 2; 
-      p += sprintf(p, ")");
-    }
-      
-    return(result);
+	char	   *result;
+	char	   *p;
+	int			equal = 1;
+	int			dim = cube->dim;
+	int			i;
+
+	if (cube == NULL)
+		return (NULL);
+
+	p = result = (char *) palloc(100);
+
+	/*
+	 * while printing the first (LL) corner, check if it is equal to the
+	 * scond one
+	 */
+	p += sprintf(p, "(");
+	for (i = 0; i < dim; i++)
+	{
+		p += sprintf(p, "%g", cube->x[i]);
+		p += sprintf(p, ", ");
+		if (cube->x[i] != cube->x[i + dim])
+			equal = 0;
+	}
+	p -= 2;						/* get rid of the last ", " */
+	p += sprintf(p, ")");
+
+	if (!equal)
+	{
+		p += sprintf(p, ",(");
+		for (i = dim; i < dim * 2; i++)
+		{
+			p += sprintf(p, "%g", cube->x[i]);
+			p += sprintf(p, ", ");
+		}
+		p -= 2;
+		p += sprintf(p, ")");
+	}
+
+	return (result);
 }
 
 
 /*****************************************************************************
- *                         GiST functions
+ *						   GiST functions
  *****************************************************************************/
 
 /*
@@ -158,19 +161,20 @@ cube_out(NDBOX *cube)
 ** the predicate x op query == FALSE, where op is the oper
 ** corresponding to strategy in the pg_amop table.
 */
-bool 
+bool
 g_cube_consistent(GISTENTRY *entry,
-	       NDBOX *query,
-	       StrategyNumber strategy)
+				  NDBOX * query,
+				  StrategyNumber strategy)
 {
-    /*
-    ** if entry is not leaf, use g_cube_internal_consistent,
-    ** else use g_cube_leaf_consistent
-    */
-    if (GIST_LEAF(entry))
-      return(g_cube_leaf_consistent((NDBOX *)(entry->pred), query, strategy));
-    else
-      return(g_cube_internal_consistent((NDBOX *)(entry->pred), query, strategy));
+
+	/*
+	 * * if entry is not leaf, use g_cube_internal_consistent, * else use
+	 * g_cube_leaf_consistent
+	 */
+	if (GIST_LEAF(entry))
+		return (g_cube_leaf_consistent((NDBOX *) (entry->pred), query, strategy));
+	else
+		return (g_cube_internal_consistent((NDBOX *) (entry->pred), query, strategy));
 }
 
 
@@ -181,48 +185,55 @@ g_cube_consistent(GISTENTRY *entry,
 NDBOX *
 g_cube_union(bytea *entryvec, int *sizep)
 {
-    int numranges, i;
-    NDBOX *out = (NDBOX *)NULL;
-    NDBOX *tmp;
-
-    /*
-    fprintf(stderr, "union\n");
-    */
-    numranges = (VARSIZE(entryvec) - VARHDRSZ)/sizeof(GISTENTRY); 
-    tmp = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[0]).pred;
-    /*
-    *sizep = sizeof(NDBOX); -- NDBOX has variable size
-    */
-    *sizep = tmp->size;
-
-    for (i = 1; i < numranges; i++) {
-      out = g_cube_binary_union(tmp, (NDBOX *)
-				 (((GISTENTRY *)(VARDATA(entryvec)))[i]).pred,
-				 sizep);
-      /*
-	fprintf(stderr, "\t%s ^ %s -> %s\n", cube_out(tmp), cube_out((NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[i]).pred), cube_out(out));
-      */
-      if (i > 1) pfree(tmp);
-      tmp = out;
-    }
-
-    return(out);
+	int			numranges,
+				i;
+	NDBOX	   *out = (NDBOX *) NULL;
+	NDBOX	   *tmp;
+
+	/*
+	 * fprintf(stderr, "union\n");
+	 */
+	numranges = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+	tmp = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[0]).pred;
+
+	/*
+	 * sizep = sizeof(NDBOX); -- NDBOX has variable size
+	 */
+	*sizep = tmp->size;
+
+	for (i = 1; i < numranges; i++)
+	{
+		out = g_cube_binary_union(tmp, (NDBOX *)
+						   (((GISTENTRY *) (VARDATA(entryvec)))[i]).pred,
+								  sizep);
+
+		/*
+		 * fprintf(stderr, "\t%s ^ %s -> %s\n", cube_out(tmp),
+		 * cube_out((NDBOX *)(((GISTENTRY
+		 * *)(VARDATA(entryvec)))[i]).pred), cube_out(out));
+		 */
+		if (i > 1)
+			pfree(tmp);
+		tmp = out;
+	}
+
+	return (out);
 }
 
 /*
 ** GiST Compress and Decompress methods for boxes
 ** do not do anything.
 */
-GISTENTRY *
+GISTENTRY  *
 g_cube_compress(GISTENTRY *entry)
 {
-    return(entry);
+	return (entry);
 }
 
-GISTENTRY *
+GISTENTRY  *
 g_cube_decompress(GISTENTRY *entry)
 {
-    return(entry);
+	return (entry);
 }
 
 /*
@@ -232,398 +243,448 @@ g_cube_decompress(GISTENTRY *entry)
 float *
 g_cube_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result)
 {
-    Datum ud;
-    float tmp1, tmp2;
-    
-    ud = (Datum)cube_union((NDBOX *)(origentry->pred), (NDBOX *)(newentry->pred));
-    rt_cube_size((NDBOX *)ud, &tmp1);
-    rt_cube_size((NDBOX *)(origentry->pred), &tmp2);
-    *result = tmp1 - tmp2;
-    pfree((char *)ud);
-    /*
-    fprintf(stderr, "penalty\n");
-    fprintf(stderr, "\t%g\n", *result);
-    */
-    return(result);
+	Datum		ud;
+	float		tmp1,
+				tmp2;
+
+	ud = (Datum) cube_union((NDBOX *) (origentry->pred), (NDBOX *) (newentry->pred));
+	rt_cube_size((NDBOX *) ud, &tmp1);
+	rt_cube_size((NDBOX *) (origentry->pred), &tmp2);
+	*result = tmp1 - tmp2;
+	pfree((char *) ud);
+
+	/*
+	 * fprintf(stderr, "penalty\n"); fprintf(stderr, "\t%g\n", *result);
+	 */
+	return (result);
 }
 
 
 
 /*
 ** The GiST PickSplit method for boxes
-** We use Guttman's poly time split algorithm 
+** We use Guttman's poly time split algorithm
 */
 GIST_SPLITVEC *
 g_cube_picksplit(bytea *entryvec,
-	      GIST_SPLITVEC *v)
+				 GIST_SPLITVEC *v)
 {
-    OffsetNumber i, j;
-    NDBOX *datum_alpha, *datum_beta;
-    NDBOX *datum_l, *datum_r;
-    NDBOX *union_d, *union_dl, *union_dr;
-    NDBOX *inter_d;
-    bool firsttime;
-    float size_alpha, size_beta, size_union, size_inter;
-    float size_waste, waste;
-    float size_l, size_r;
-    int nbytes;
-    OffsetNumber seed_1 = 0, seed_2 = 0;
-    OffsetNumber *left, *right;
-    OffsetNumber maxoff;
-
-    /*
-    fprintf(stderr, "picksplit\n");
-    */
-    maxoff = ((VARSIZE(entryvec) - VARHDRSZ)/sizeof(GISTENTRY)) - 2;
-    nbytes =  (maxoff + 2) * sizeof(OffsetNumber);
-    v->spl_left = (OffsetNumber *) palloc(nbytes);
-    v->spl_right = (OffsetNumber *) palloc(nbytes);
-    
-    firsttime = true;
-    waste = 0.0;
-    
-    for (i = FirstOffsetNumber; i < maxoff; i = OffsetNumberNext(i)) {
-	datum_alpha = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[i].pred);
-	for (j = OffsetNumberNext(i); j <= maxoff; j = OffsetNumberNext(j)) {
-	    datum_beta = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[j].pred);
-	    
-	    /* compute the wasted space by unioning these guys */
-	    /* size_waste = size_union - size_inter; */
-	    union_d = (NDBOX *)cube_union(datum_alpha, datum_beta);
-	    rt_cube_size(union_d, &size_union);
-	    inter_d = (NDBOX *)cube_inter(datum_alpha, datum_beta);
-	    rt_cube_size(inter_d, &size_inter);
-	    size_waste = size_union - size_inter;
-	    
-	    pfree(union_d);
-	    
-	    if (inter_d != (NDBOX *) NULL)
-		pfree(inter_d);
-	    
-	    /*
-	     *  are these a more promising split than what we've
-	     *  already seen?
-	     */
-	    
-	    if (size_waste > waste || firsttime) {
-		waste = size_waste;
-		seed_1 = i;
-		seed_2 = j;
-		firsttime = false;
-	    }
-	}
-    }
-    
-    left = v->spl_left;
-    v->spl_nleft = 0;
-    right = v->spl_right;
-    v->spl_nright = 0;
-    
-    datum_alpha = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[seed_1].pred);
-    datum_l = (NDBOX *)cube_union(datum_alpha, datum_alpha);
-    rt_cube_size((NDBOX *)datum_l, &size_l);
-    datum_beta = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[seed_2].pred);;
-    datum_r = (NDBOX *)cube_union(datum_beta, datum_beta);
-    rt_cube_size((NDBOX *)datum_r, &size_r);
-    
-    /*
-     *  Now split up the regions between the two seeds.  An important
-     *  property of this split algorithm is that the split vector v
-     *  has the indices of items to be split in order in its left and
-     *  right vectors.  We exploit this property by doing a merge in
-     *  the code that actually splits the page.
-     *
-     *  For efficiency, we also place the new index tuple in this loop.
-     *  This is handled at the very end, when we have placed all the
-     *  existing tuples and i == maxoff + 1.
-     */
-    
-    maxoff = OffsetNumberNext(maxoff);
-    for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
-	
+	OffsetNumber i,
+				j;
+	NDBOX	   *datum_alpha,
+			   *datum_beta;
+	NDBOX	   *datum_l,
+			   *datum_r;
+	NDBOX	   *union_d,
+			   *union_dl,
+			   *union_dr;
+	NDBOX	   *inter_d;
+	bool		firsttime;
+	float		size_alpha,
+				size_beta,
+				size_union,
+				size_inter;
+	float		size_waste,
+				waste;
+	float		size_l,
+				size_r;
+	int			nbytes;
+	OffsetNumber seed_1 = 0,
+				seed_2 = 0;
+	OffsetNumber *left,
+			   *right;
+	OffsetNumber maxoff;
+
 	/*
-	 *  If we've already decided where to place this item, just
-	 *  put it on the right list.  Otherwise, we need to figure
-	 *  out which page needs the least enlargement in order to
-	 *  store the item.
+	 * fprintf(stderr, "picksplit\n");
 	 */
-	
-	if (i == seed_1) {
-	    *left++ = i;
-	    v->spl_nleft++;
-	    continue;
-	} else if (i == seed_2) {
-	    *right++ = i;
-	    v->spl_nright++;
-	    continue;
+	maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 2;
+	nbytes = (maxoff + 2) * sizeof(OffsetNumber);
+	v->spl_left = (OffsetNumber *) palloc(nbytes);
+	v->spl_right = (OffsetNumber *) palloc(nbytes);
+
+	firsttime = true;
+	waste = 0.0;
+
+	for (i = FirstOffsetNumber; i < maxoff; i = OffsetNumberNext(i))
+	{
+		datum_alpha = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[i].pred);
+		for (j = OffsetNumberNext(i); j <= maxoff; j = OffsetNumberNext(j))
+		{
+			datum_beta = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[j].pred);
+
+			/* compute the wasted space by unioning these guys */
+			/* size_waste = size_union - size_inter; */
+			union_d = (NDBOX *) cube_union(datum_alpha, datum_beta);
+			rt_cube_size(union_d, &size_union);
+			inter_d = (NDBOX *) cube_inter(datum_alpha, datum_beta);
+			rt_cube_size(inter_d, &size_inter);
+			size_waste = size_union - size_inter;
+
+			pfree(union_d);
+
+			if (inter_d != (NDBOX *) NULL)
+				pfree(inter_d);
+
+			/*
+			 * are these a more promising split than what we've already
+			 * seen?
+			 */
+
+			if (size_waste > waste || firsttime)
+			{
+				waste = size_waste;
+				seed_1 = i;
+				seed_2 = j;
+				firsttime = false;
+			}
+		}
 	}
-	
-	/* okay, which page needs least enlargement? */ 
-	datum_alpha = (NDBOX *)(((GISTENTRY *)(VARDATA(entryvec)))[i].pred);
-	union_dl = (NDBOX *)cube_union(datum_l, datum_alpha);
-	union_dr = (NDBOX *)cube_union(datum_r, datum_alpha);
-	rt_cube_size((NDBOX *)union_dl, &size_alpha);
-	rt_cube_size((NDBOX *)union_dr, &size_beta);
-	
-	/* pick which page to add it to */
-	if (size_alpha - size_l < size_beta - size_r) {
-	    pfree(datum_l);
-	    pfree(union_dr);
-	    datum_l = union_dl;
-	    size_l = size_alpha;
-	    *left++ = i;
-	    v->spl_nleft++;
-	} else {
-	    pfree(datum_r);
-	    pfree(union_dl);
-	    datum_r = union_dr;
-	    size_r = size_alpha;
-	    *right++ = i;
-	    v->spl_nright++;
+
+	left = v->spl_left;
+	v->spl_nleft = 0;
+	right = v->spl_right;
+	v->spl_nright = 0;
+
+	datum_alpha = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[seed_1].pred);
+	datum_l = (NDBOX *) cube_union(datum_alpha, datum_alpha);
+	rt_cube_size((NDBOX *) datum_l, &size_l);
+	datum_beta = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[seed_2].pred);;
+	datum_r = (NDBOX *) cube_union(datum_beta, datum_beta);
+	rt_cube_size((NDBOX *) datum_r, &size_r);
+
+	/*
+	 * Now split up the regions between the two seeds.	An important
+	 * property of this split algorithm is that the split vector v has the
+	 * indices of items to be split in order in its left and right
+	 * vectors.  We exploit this property by doing a merge in the code
+	 * that actually splits the page.
+	 *
+	 * For efficiency, we also place the new index tuple in this loop. This
+	 * is handled at the very end, when we have placed all the existing
+	 * tuples and i == maxoff + 1.
+	 */
+
+	maxoff = OffsetNumberNext(maxoff);
+	for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+	{
+
+		/*
+		 * If we've already decided where to place this item, just put it
+		 * on the right list.  Otherwise, we need to figure out which page
+		 * needs the least enlargement in order to store the item.
+		 */
+
+		if (i == seed_1)
+		{
+			*left++ = i;
+			v->spl_nleft++;
+			continue;
+		}
+		else if (i == seed_2)
+		{
+			*right++ = i;
+			v->spl_nright++;
+			continue;
+		}
+
+		/* okay, which page needs least enlargement? */
+		datum_alpha = (NDBOX *) (((GISTENTRY *) (VARDATA(entryvec)))[i].pred);
+		union_dl = (NDBOX *) cube_union(datum_l, datum_alpha);
+		union_dr = (NDBOX *) cube_union(datum_r, datum_alpha);
+		rt_cube_size((NDBOX *) union_dl, &size_alpha);
+		rt_cube_size((NDBOX *) union_dr, &size_beta);
+
+		/* pick which page to add it to */
+		if (size_alpha - size_l < size_beta - size_r)
+		{
+			pfree(datum_l);
+			pfree(union_dr);
+			datum_l = union_dl;
+			size_l = size_alpha;
+			*left++ = i;
+			v->spl_nleft++;
+		}
+		else
+		{
+			pfree(datum_r);
+			pfree(union_dl);
+			datum_r = union_dr;
+			size_r = size_alpha;
+			*right++ = i;
+			v->spl_nright++;
+		}
 	}
-    }
-    *left = *right = FirstOffsetNumber;	/* sentinel value, see dosplit() */
-    
-    v->spl_ldatum = (char *)datum_l;
-    v->spl_rdatum = (char *)datum_r;
+	*left = *right = FirstOffsetNumber; /* sentinel value, see dosplit() */
 
-    return v;
+	v->spl_ldatum = (char *) datum_l;
+	v->spl_rdatum = (char *) datum_r;
+
+	return v;
 }
 
 /*
 ** Equality method
 */
 bool *
-g_cube_same(NDBOX *b1, NDBOX *b2, bool *result)
+g_cube_same(NDBOX * b1, NDBOX * b2, bool *result)
 {
-  if (cube_same(b1, b2))
-    *result = TRUE;
-  else *result = FALSE;
-  /*
-  fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE" ));
-  */
-  return(result);
+	if (cube_same(b1, b2))
+		*result = TRUE;
+	else
+		*result = FALSE;
+
+	/*
+	 * fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE" ));
+	 */
+	return (result);
 }
 
-/* 
+/*
 ** SUPPORT ROUTINES
 */
-bool 
-g_cube_leaf_consistent(NDBOX *key,
-		     NDBOX *query,
-		     StrategyNumber strategy)
+bool
+g_cube_leaf_consistent(NDBOX * key,
+					   NDBOX * query,
+					   StrategyNumber strategy)
 {
-  bool retval;
-
-  /*
-  fprintf(stderr, "leaf_consistent, %d\n", strategy);
-  */
-  switch(strategy) {
-  case RTLeftStrategyNumber:
-    retval = (bool)cube_left(key, query);
-    break;
-  case RTOverLeftStrategyNumber:
-    retval = (bool)cube_over_left(key,query);
-    break;
-  case RTOverlapStrategyNumber:
-    retval = (bool)cube_overlap(key, query);
-    break;
-  case RTOverRightStrategyNumber:
-    retval = (bool)cube_over_right(key, query);
-    break;
-  case RTRightStrategyNumber:
-    retval = (bool)cube_right(key, query);
-    break;
-  case RTSameStrategyNumber:
-    retval = (bool)cube_same(key, query);
-    break;
-  case RTContainsStrategyNumber:
-    retval = (bool)cube_contains(key, query);
-    break;
-  case RTContainedByStrategyNumber:
-    retval = (bool)cube_contained(key,query);
-    break;
-  default:
-    retval = FALSE;
-  }
-  return(retval);
+	bool		retval;
+
+	/*
+	 * fprintf(stderr, "leaf_consistent, %d\n", strategy);
+	 */
+	switch (strategy)
+	{
+		case RTLeftStrategyNumber:
+			retval = (bool) cube_left(key, query);
+			break;
+		case RTOverLeftStrategyNumber:
+			retval = (bool) cube_over_left(key, query);
+			break;
+		case RTOverlapStrategyNumber:
+			retval = (bool) cube_overlap(key, query);
+			break;
+		case RTOverRightStrategyNumber:
+			retval = (bool) cube_over_right(key, query);
+			break;
+		case RTRightStrategyNumber:
+			retval = (bool) cube_right(key, query);
+			break;
+		case RTSameStrategyNumber:
+			retval = (bool) cube_same(key, query);
+			break;
+		case RTContainsStrategyNumber:
+			retval = (bool) cube_contains(key, query);
+			break;
+		case RTContainedByStrategyNumber:
+			retval = (bool) cube_contained(key, query);
+			break;
+		default:
+			retval = FALSE;
+	}
+	return (retval);
 }
 
-bool 
-g_cube_internal_consistent(NDBOX *key,
-			NDBOX *query,
-			StrategyNumber strategy)
+bool
+g_cube_internal_consistent(NDBOX * key,
+						   NDBOX * query,
+						   StrategyNumber strategy)
 {
-  bool retval;
-  
-  /*
-  fprintf(stderr, "internal_consistent, %d\n", strategy);
-  */
-  switch(strategy) {
-  case RTLeftStrategyNumber:
-  case RTOverLeftStrategyNumber:
-    retval = (bool)cube_over_left(key,query);
-    break;
-  case RTOverlapStrategyNumber:
-    retval = (bool)cube_overlap(key, query);
-    break;
-  case RTOverRightStrategyNumber:
-  case RTRightStrategyNumber:
-    retval = (bool)cube_right(key, query);
-    break;
-  case RTSameStrategyNumber:
-  case RTContainsStrategyNumber:
-    retval = (bool)cube_contains(key, query);
-    break;
-  case RTContainedByStrategyNumber:
-    retval = (bool)cube_overlap(key, query);
-    break;
-  default:
-    retval = FALSE;
-    }
-  return(retval);
+	bool		retval;
+
+	/*
+	 * fprintf(stderr, "internal_consistent, %d\n", strategy);
+	 */
+	switch (strategy)
+	{
+		case RTLeftStrategyNumber:
+		case RTOverLeftStrategyNumber:
+			retval = (bool) cube_over_left(key, query);
+			break;
+		case RTOverlapStrategyNumber:
+			retval = (bool) cube_overlap(key, query);
+			break;
+		case RTOverRightStrategyNumber:
+		case RTRightStrategyNumber:
+			retval = (bool) cube_right(key, query);
+			break;
+		case RTSameStrategyNumber:
+		case RTContainsStrategyNumber:
+			retval = (bool) cube_contains(key, query);
+			break;
+		case RTContainedByStrategyNumber:
+			retval = (bool) cube_overlap(key, query);
+			break;
+		default:
+			retval = FALSE;
+	}
+	return (retval);
 }
 
 NDBOX *
-g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep)
+g_cube_binary_union(NDBOX * r1, NDBOX * r2, int *sizep)
 {
-    NDBOX *retval;
+	NDBOX	   *retval;
 
-    retval = cube_union(r1, r2);
-    *sizep = retval->size;
+	retval = cube_union(r1, r2);
+	*sizep = retval->size;
 
-    return (retval);
+	return (retval);
 }
 
 
 /* cube_union */
-NDBOX *cube_union(NDBOX *box_a, NDBOX *box_b)
+NDBOX *
+cube_union(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  NDBOX *result;
-  NDBOX *a = swap_corners(box_a);
-  NDBOX *b = swap_corners(box_b);
-
-  if ( a->dim >= b->dim ) {
-    result = palloc(a->size);
-    result->size = a->size;
-    result->dim = a->dim;
-  }
-  else {
-    result = palloc(b->size);
-    result->size = b->size;
-    result->dim = b->dim;
-  }
-
-  /* swap the box pointers if needed */
-  if ( a->dim < b->dim ) {
-    NDBOX * tmp = b; b = a; a = tmp;
-  }
-
-  /* use the potentially smaller of the two boxes (b) to fill in 
-     the result, padding absent dimensions with zeroes*/
-  for ( i = 0; i < b->dim; i++ ) {
-    result->x[i] = b->x[i];
-    result->x[i + a->dim] = b->x[i + b->dim];
-  }
-  for ( i = b->dim; i < a->dim; i++ ) {
-    result->x[i] = 0;
-    result->x[i + a->dim] = 0;
-  }
-    
-  /* compute the union */
-  for ( i = 0; i < a->dim; i++ ) {
-    result->x[i] = min(a->x[i], result->x[i]);
-  }
-  for ( i = a->dim; i < a->dim * 2; i++ ) {
-    result->x[i] = max(a->x[i], result->x[i]);
-  }
-
-  pfree(a);
-  pfree(b);
-
-  return(result);
+	int			i;
+	NDBOX	   *result;
+	NDBOX	   *a = swap_corners(box_a);
+	NDBOX	   *b = swap_corners(box_b);
+
+	if (a->dim >= b->dim)
+	{
+		result = palloc(a->size);
+		result->size = a->size;
+		result->dim = a->dim;
+	}
+	else
+	{
+		result = palloc(b->size);
+		result->size = b->size;
+		result->dim = b->dim;
+	}
+
+	/* swap the box pointers if needed */
+	if (a->dim < b->dim)
+	{
+		NDBOX	   *tmp = b;
+
+		b = a;
+		a = tmp;
+	}
+
+	/*
+	 * use the potentially smaller of the two boxes (b) to fill in the
+	 * result, padding absent dimensions with zeroes
+	 */
+	for (i = 0; i < b->dim; i++)
+	{
+		result->x[i] = b->x[i];
+		result->x[i + a->dim] = b->x[i + b->dim];
+	}
+	for (i = b->dim; i < a->dim; i++)
+	{
+		result->x[i] = 0;
+		result->x[i + a->dim] = 0;
+	}
+
+	/* compute the union */
+	for (i = 0; i < a->dim; i++)
+		result->x[i] = min(a->x[i], result->x[i]);
+	for (i = a->dim; i < a->dim * 2; i++)
+		result->x[i] = max(a->x[i], result->x[i]);
+
+	pfree(a);
+	pfree(b);
+
+	return (result);
 }
 
 /* cube_inter */
-NDBOX *cube_inter(NDBOX *box_a, NDBOX *box_b)
+NDBOX *
+cube_inter(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  NDBOX * result;
-  NDBOX *a = swap_corners(box_a);
-  NDBOX *b = swap_corners(box_b);
-  
-  if ( a->dim >= b->dim ) {
-    result = palloc(a->size);
-    result->size = a->size;
-    result->dim = a->dim;
-  }
-  else {
-    result = palloc(b->size);
-    result->size = b->size;
-    result->dim = b->dim;
-  }
-
-  /* swap the box pointers if needed */
-  if ( a->dim < b->dim ) {
-    NDBOX * tmp = b; b = a; a = tmp;
-  }
-
-  /* use the potentially  smaller of the two boxes (b) to fill in 
-     the result, padding absent dimensions with zeroes*/
-  for ( i = 0; i < b->dim; i++ ) {
-    result->x[i] = b->x[i];
-    result->x[i + a->dim] = b->x[i + b->dim];
-  }
-  for ( i = b->dim; i < a->dim; i++ ) {
-    result->x[i] = 0;
-    result->x[i + a->dim] = 0;
-  }
-    
-  /* compute the intersection */
-  for ( i = 0; i < a->dim; i++ ) {
-    result->x[i] = max(a->x[i], result->x[i]);
-  }
-  for ( i = a->dim; i < a->dim * 2; i++ ) {
-    result->x[i] = min(a->x[i], result->x[i]);
-  }
-  
-  pfree(a);
-  pfree(b);
-
-  /* Is it OK to return a non-null intersection for non-overlapping boxes? */
-  return(result);
+	int			i;
+	NDBOX	   *result;
+	NDBOX	   *a = swap_corners(box_a);
+	NDBOX	   *b = swap_corners(box_b);
+
+	if (a->dim >= b->dim)
+	{
+		result = palloc(a->size);
+		result->size = a->size;
+		result->dim = a->dim;
+	}
+	else
+	{
+		result = palloc(b->size);
+		result->size = b->size;
+		result->dim = b->dim;
+	}
+
+	/* swap the box pointers if needed */
+	if (a->dim < b->dim)
+	{
+		NDBOX	   *tmp = b;
+
+		b = a;
+		a = tmp;
+	}
+
+	/*
+	 * use the potentially	smaller of the two boxes (b) to fill in the
+	 * result, padding absent dimensions with zeroes
+	 */
+	for (i = 0; i < b->dim; i++)
+	{
+		result->x[i] = b->x[i];
+		result->x[i + a->dim] = b->x[i + b->dim];
+	}
+	for (i = b->dim; i < a->dim; i++)
+	{
+		result->x[i] = 0;
+		result->x[i + a->dim] = 0;
+	}
+
+	/* compute the intersection */
+	for (i = 0; i < a->dim; i++)
+		result->x[i] = max(a->x[i], result->x[i]);
+	for (i = a->dim; i < a->dim * 2; i++)
+		result->x[i] = min(a->x[i], result->x[i]);
+
+	pfree(a);
+	pfree(b);
+
+	/*
+	 * Is it OK to return a non-null intersection for non-overlapping
+	 * boxes?
+	 */
+	return (result);
 }
 
 /* cube_size */
-float *cube_size(NDBOX *a)
+float *
+cube_size(NDBOX * a)
 {
-  int i,j;
-  float *result;
-
-  result = (float *) palloc(sizeof(float));
-  
-  *result = 1.0;
-  for ( i = 0, j = a->dim; i < a->dim; i++,j++ ) {
-    *result=(*result)*abs((a->x[j] - a->x[i]));
-  }
-  
-  return(result);
+	int			i,
+				j;
+	float	   *result;
+
+	result = (float *) palloc(sizeof(float));
+
+	*result = 1.0;
+	for (i = 0, j = a->dim; i < a->dim; i++, j++)
+		*result = (*result) * abs((a->x[j] - a->x[i]));
+
+	return (result);
 }
 
 void
-rt_cube_size(NDBOX *a, float *size)
+rt_cube_size(NDBOX * a, float *size)
 {
-  int i,j;
-  if (a == (NDBOX *) NULL)
-    *size = 0.0;
-  else {
-    *size = 1.0;
-    for ( i = 0, j = a->dim; i < a->dim; i++,j++ ) {
-      *size=(*size)*abs((a->x[j] - a->x[i]));
-    }
-  }
-  return;
+	int			i,
+				j;
+
+	if (a == (NDBOX *) NULL)
+		*size = 0.0;
+	else
+	{
+		*size = 1.0;
+		for (i = 0, j = a->dim; i < a->dim; i++, j++)
+			*size = (*size) * abs((a->x[j] - a->x[i]));
+	}
+	return;
 }
 
 /* The following four methods compare the projections of the boxes
@@ -631,428 +692,489 @@ rt_cube_size(NDBOX *a, float *size)
    larger than 2, but it seems that R-tree requires all its strategies
    map to real functions that return something */
 
-/*  is the right edge of (a) located to the left of 
-    the right edge of (b)? */
-bool cube_over_left(NDBOX *box_a, NDBOX *box_b)
+/*	is the right edge of (a) located to the left of
+	the right edge of (b)? */
+bool
+cube_over_left(NDBOX * box_a, NDBOX * box_b)
 {
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
 
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
 
-  return( a->x[a->dim - 1] <= b->x[b->dim - 1] && !cube_left(a, b) && !cube_right(a, b) );
+	return (a->x[a->dim - 1] <= b->x[b->dim - 1] && !cube_left(a, b) && !cube_right(a, b));
 }
 
-/*  is the left edge of (a) located to the right of 
-    the left edge of (b)? */
-bool cube_over_right(NDBOX *box_a, NDBOX *box_b)
+/*	is the left edge of (a) located to the right of
+	the left edge of (b)? */
+bool
+cube_over_right(NDBOX * box_a, NDBOX * box_b)
 {
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
+	NDBOX	   *a;
+	NDBOX	   *b;
 
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
 
-  return( a->x[a->dim - 1] >= b->x[b->dim - 1] && !cube_left(a, b) && !cube_right(a, b) );
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+
+	return (a->x[a->dim - 1] >= b->x[b->dim - 1] && !cube_left(a, b) && !cube_right(a, b));
 }
 
 
 /* return 'true' if the projection of 'a' is
    entirely on the left of the projection of 'b' */
-bool cube_left(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_left(NDBOX * box_a, NDBOX * box_b)
 {
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
 
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
 
-  return( a->x[a->dim - 1] < b->x[0]);
+	return (a->x[a->dim - 1] < b->x[0]);
 }
 
 /* return 'true' if the projection of 'a' is
    entirely on the right  of the projection of 'b' */
-bool cube_right(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_right(NDBOX * box_a, NDBOX * box_b)
 {
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
+	NDBOX	   *a;
+	NDBOX	   *b;
 
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
 
-  return( a->x[0] > b->x[b->dim - 1]);
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+
+	return (a->x[0] > b->x[b->dim - 1]);
 }
 
 /* make up a metric in which one box will be 'lower' than the other
    -- this can be useful for srting and to determine uniqueness */
-bool cube_lt(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_lt(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  int dim;
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
-
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
-  dim = min(a->dim, b->dim);
-
-  /* if all common dimensions are equal, the cube with more dimensions wins */
-  if ( cube_same(a, b) ) {
-    if (a->dim < b->dim) {
-      return(TRUE);
-    }
-    else {
-      return(FALSE);
-    }
-  }
-
-  /* compare the common dimensions */
-  for ( i = 0; i < dim; i++ ) {
-    if ( a->x[i] > b->x[i] )
-      return(FALSE); 
-    if ( a->x[i] < b->x[i] )
-      return(TRUE); 
-  }
-  for ( i = 0; i < dim; i++ ) {
-    if ( a->x[i + a->dim] > b->x[i + b->dim] )
-      return(FALSE); 
-    if ( a->x[i + a->dim] < b->x[i + b->dim] )
-      return(TRUE); 
-  }
-
-  /* compare extra dimensions to zero */
-  if ( a->dim > b->dim ) {
-    for ( i = dim; i < a->dim; i++ ) {
-      if ( a->x[i] > 0 )
-	return(FALSE); 
-      if ( a->x[i] < 0 )
-	return(TRUE); 
-    }
-    for ( i = 0; i < dim; i++ ) {
-      if ( a->x[i + a->dim] > 0 )
-	return(FALSE); 
-      if ( a->x[i + a->dim] < 0 )
-	return(TRUE); 
-    }
-  }
-  if ( a->dim < b->dim ) {
-    for ( i = dim; i < b->dim; i++ ) {
-      if ( b->x[i] > 0 )
-	return(TRUE); 
-      if ( b->x[i] < 0 )
-	return(FALSE); 
-    }
-    for ( i = 0; i < dim; i++ ) {
-      if ( b->x[i + b->dim] > 0 )
-	return(TRUE); 
-      if ( b->x[i + b->dim] < 0 )
-	return(FALSE);
-    }
-  }
-    
-  return(FALSE);
+	int			i;
+	int			dim;
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
+
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+	dim = min(a->dim, b->dim);
+
+	/*
+	 * if all common dimensions are equal, the cube with more dimensions
+	 * wins
+	 */
+	if (cube_same(a, b))
+	{
+		if (a->dim < b->dim)
+			return (TRUE);
+		else
+			return (FALSE);
+	}
+
+	/* compare the common dimensions */
+	for (i = 0; i < dim; i++)
+	{
+		if (a->x[i] > b->x[i])
+			return (FALSE);
+		if (a->x[i] < b->x[i])
+			return (TRUE);
+	}
+	for (i = 0; i < dim; i++)
+	{
+		if (a->x[i + a->dim] > b->x[i + b->dim])
+			return (FALSE);
+		if (a->x[i + a->dim] < b->x[i + b->dim])
+			return (TRUE);
+	}
+
+	/* compare extra dimensions to zero */
+	if (a->dim > b->dim)
+	{
+		for (i = dim; i < a->dim; i++)
+		{
+			if (a->x[i] > 0)
+				return (FALSE);
+			if (a->x[i] < 0)
+				return (TRUE);
+		}
+		for (i = 0; i < dim; i++)
+		{
+			if (a->x[i + a->dim] > 0)
+				return (FALSE);
+			if (a->x[i + a->dim] < 0)
+				return (TRUE);
+		}
+	}
+	if (a->dim < b->dim)
+	{
+		for (i = dim; i < b->dim; i++)
+		{
+			if (b->x[i] > 0)
+				return (TRUE);
+			if (b->x[i] < 0)
+				return (FALSE);
+		}
+		for (i = 0; i < dim; i++)
+		{
+			if (b->x[i + b->dim] > 0)
+				return (TRUE);
+			if (b->x[i + b->dim] < 0)
+				return (FALSE);
+		}
+	}
+
+	return (FALSE);
 }
 
 
-bool cube_gt(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_gt(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  int dim;
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
-
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
-  dim = min(a->dim, b->dim);
-
-  /* if all common dimensions are equal, the cube with more dimensions wins */
-  if ( cube_same(a, b) ) {
-    if (a->dim > b->dim) {
-      return(TRUE);
-    }
-    else {
-      return(FALSE);
-    }
-  }
-
-  /* compare the common dimensions */
-  for ( i = 0; i < dim; i++ ) {
-    if ( a->x[i] < b->x[i] )
-      return(FALSE); 
-    if ( a->x[i] > b->x[i] )
-      return(TRUE); 
-  }
-  for ( i = 0; i < dim; i++ ) {
-    if ( a->x[i + a->dim] < b->x[i + b->dim] )
-      return(FALSE); 
-    if ( a->x[i + a->dim] > b->x[i + b->dim] )
-      return(TRUE); 
-  }
-
-
-  /* compare extra dimensions to zero */
-  if ( a->dim > b->dim ) {
-    for ( i = dim; i < a->dim; i++ ) {
-      if ( a->x[i] < 0 )
-	return(FALSE); 
-      if ( a->x[i] > 0 )
-	return(TRUE); 
-    }
-    for ( i = 0; i < dim; i++ ) {
-      if ( a->x[i + a->dim] < 0 )
-	return(FALSE); 
-      if ( a->x[i + a->dim] > 0 )
-	return(TRUE); 
-    }
-  }
-  if ( a->dim < b->dim ) {
-    for ( i = dim; i < b->dim; i++ ) {
-      if ( b->x[i] < 0 )
-	return(TRUE); 
-      if ( b->x[i] > 0 )
-	return(FALSE); 
-    }
-    for ( i = 0; i < dim; i++ ) {
-      if ( b->x[i + b->dim] < 0 )
-	return(TRUE); 
-      if ( b->x[i + b->dim] > 0 )
-	return(FALSE);
-    }
-  }
-
-  return(FALSE);
+	int			i;
+	int			dim;
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
+
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+	dim = min(a->dim, b->dim);
+
+	/*
+	 * if all common dimensions are equal, the cube with more dimensions
+	 * wins
+	 */
+	if (cube_same(a, b))
+	{
+		if (a->dim > b->dim)
+			return (TRUE);
+		else
+			return (FALSE);
+	}
+
+	/* compare the common dimensions */
+	for (i = 0; i < dim; i++)
+	{
+		if (a->x[i] < b->x[i])
+			return (FALSE);
+		if (a->x[i] > b->x[i])
+			return (TRUE);
+	}
+	for (i = 0; i < dim; i++)
+	{
+		if (a->x[i + a->dim] < b->x[i + b->dim])
+			return (FALSE);
+		if (a->x[i + a->dim] > b->x[i + b->dim])
+			return (TRUE);
+	}
+
+
+	/* compare extra dimensions to zero */
+	if (a->dim > b->dim)
+	{
+		for (i = dim; i < a->dim; i++)
+		{
+			if (a->x[i] < 0)
+				return (FALSE);
+			if (a->x[i] > 0)
+				return (TRUE);
+		}
+		for (i = 0; i < dim; i++)
+		{
+			if (a->x[i + a->dim] < 0)
+				return (FALSE);
+			if (a->x[i + a->dim] > 0)
+				return (TRUE);
+		}
+	}
+	if (a->dim < b->dim)
+	{
+		for (i = dim; i < b->dim; i++)
+		{
+			if (b->x[i] < 0)
+				return (TRUE);
+			if (b->x[i] > 0)
+				return (FALSE);
+		}
+		for (i = 0; i < dim; i++)
+		{
+			if (b->x[i + b->dim] < 0)
+				return (TRUE);
+			if (b->x[i + b->dim] > 0)
+				return (FALSE);
+		}
+	}
+
+	return (FALSE);
 }
 
 
 /* Equal */
-bool cube_same(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_same(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  NDBOX *a;
-  NDBOX *b;
-  
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
-
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
-
-  /* swap the box pointers if necessary */
-  if ( a->dim < b->dim ) {
-    NDBOX * tmp = b; b = a; a = tmp;
-  }
-
-  for ( i = 0; i < b->dim; i++ ) {
-    if ( a->x[i] != b->x[i] )
-      return(FALSE);
-    if ( a->x[i + a->dim] != b->x[i + b->dim] )
-      return(FALSE);
-  }
-
-  /* all dimensions of (b) are compared to those of (a);
-     instead of those in (a) absent in (b), compare (a) to zero */
-  for ( i = b->dim; i < a->dim; i++ ) {
-     if ( a->x[i] != 0 )
-      return(FALSE);
-     if ( a->x[i + a->dim] != 0 )
-      return(FALSE);
-  }
-
-  pfree(a);
-  pfree(b);
-
-  return(TRUE);
+	int			i;
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
+
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+
+	/* swap the box pointers if necessary */
+	if (a->dim < b->dim)
+	{
+		NDBOX	   *tmp = b;
+
+		b = a;
+		a = tmp;
+	}
+
+	for (i = 0; i < b->dim; i++)
+	{
+		if (a->x[i] != b->x[i])
+			return (FALSE);
+		if (a->x[i + a->dim] != b->x[i + b->dim])
+			return (FALSE);
+	}
+
+	/*
+	 * all dimensions of (b) are compared to those of (a); instead of
+	 * those in (a) absent in (b), compare (a) to zero
+	 */
+	for (i = b->dim; i < a->dim; i++)
+	{
+		if (a->x[i] != 0)
+			return (FALSE);
+		if (a->x[i + a->dim] != 0)
+			return (FALSE);
+	}
+
+	pfree(a);
+	pfree(b);
+
+	return (TRUE);
 }
 
 /* Different */
-bool cube_different(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_different(NDBOX * box_a, NDBOX * box_b)
 {
-  return(!cube_same(box_a, box_b));
+	return (!cube_same(box_a, box_b));
 }
 
 
 /* Contains */
 /* Box(A) CONTAINS Box(B) IFF pt(A) < pt(B) */
-bool cube_contains(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_contains(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  NDBOX *a;
-  NDBOX *b;
-
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
-
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
-
-  if ( a->dim < b->dim ) {
-    /* the further comparisons will make sense if the 
-       excess dimensions of (b) were zeroes */
-    for ( i = a->dim; i < b->dim; i++ ) {
-      if ( b->x[i] != 0 )
-	return(FALSE);
-      if ( b->x[i + b->dim] != 0 )
-	return(FALSE);
-    }
-  }
-
-  /* Can't care less about the excess dimensions of (a), if any */
-  for ( i = 0; i < min(a->dim, b->dim); i++ ) {
-    if ( a->x[i] > b->x[i] )
-      return(FALSE);
-    if ( a->x[i + a->dim] < b->x[i + b->dim] )
-      return(FALSE);
-  }
-
-  pfree(a);
-  pfree(b);
-
-  return(TRUE);
+	int			i;
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
+
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+
+	if (a->dim < b->dim)
+	{
+
+		/*
+		 * the further comparisons will make sense if the excess
+		 * dimensions of (b) were zeroes
+		 */
+		for (i = a->dim; i < b->dim; i++)
+		{
+			if (b->x[i] != 0)
+				return (FALSE);
+			if (b->x[i + b->dim] != 0)
+				return (FALSE);
+		}
+	}
+
+	/* Can't care less about the excess dimensions of (a), if any */
+	for (i = 0; i < min(a->dim, b->dim); i++)
+	{
+		if (a->x[i] > b->x[i])
+			return (FALSE);
+		if (a->x[i + a->dim] < b->x[i + b->dim])
+			return (FALSE);
+	}
+
+	pfree(a);
+	pfree(b);
+
+	return (TRUE);
 }
 
 /* Contained */
 /* Box(A) Contained by Box(B) IFF Box(B) Contains Box(A) */
-bool cube_contained (NDBOX *a, NDBOX *b)
+bool
+cube_contained(NDBOX * a, NDBOX * b)
 {
-  if (cube_contains(b,a) == TRUE)
-    return(TRUE);
-  else
-    return(FALSE);
+	if (cube_contains(b, a) == TRUE)
+		return (TRUE);
+	else
+		return (FALSE);
 }
 
 /* Overlap */
 /* Box(A) Overlap Box(B) IFF (pt(a)LL < pt(B)UR) && (pt(b)LL < pt(a)UR) */
-bool cube_overlap(NDBOX *box_a, NDBOX *box_b)
+bool
+cube_overlap(NDBOX * box_a, NDBOX * box_b)
 {
-  int i;
-  NDBOX *a;
-  NDBOX *b;
-
-  /* This *very bad* error was found in the source: 
-	if ( (a==NULL) || (b=NULL) )
-		return(FALSE);
-  */
-  if ( (box_a==NULL) || (box_b==NULL) )
-    return(FALSE);
-
-  a = swap_corners(box_a);
-  b = swap_corners(box_b);
-
-  /* swap the box pointers if needed */
-  if ( a->dim < b->dim ) {
-    NDBOX * tmp = b; b = a; a = tmp;
-  }
-
-  /* compare within the dimensions of (b) */
-  for ( i = 0; i < b->dim; i++ ) {
-    if ( a->x[i] > b->x[i + b->dim] )
-      return(FALSE);
-    if ( a->x[i + a->dim] < b->x[i] )
-      return(FALSE);
-  }
-
-  /* compare to zero those dimensions in (a) absent in (b) */
-  for ( i = b->dim; i < a->dim; i++ ) {
-     if ( a->x[i] > 0 )
-      return(FALSE);
-     if ( a->x[i + a->dim] < 0 )
-      return(FALSE);
-  }
-
-  pfree(a);
-  pfree(b);
-
-  return(TRUE);
+	int			i;
+	NDBOX	   *a;
+	NDBOX	   *b;
+
+	/*
+	 * This *very bad* error was found in the source: if ( (a==NULL) ||
+	 * (b=NULL) ) return(FALSE);
+	 */
+	if ((box_a == NULL) || (box_b == NULL))
+		return (FALSE);
+
+	a = swap_corners(box_a);
+	b = swap_corners(box_b);
+
+	/* swap the box pointers if needed */
+	if (a->dim < b->dim)
+	{
+		NDBOX	   *tmp = b;
+
+		b = a;
+		a = tmp;
+	}
+
+	/* compare within the dimensions of (b) */
+	for (i = 0; i < b->dim; i++)
+	{
+		if (a->x[i] > b->x[i + b->dim])
+			return (FALSE);
+		if (a->x[i + a->dim] < b->x[i])
+			return (FALSE);
+	}
+
+	/* compare to zero those dimensions in (a) absent in (b) */
+	for (i = b->dim; i < a->dim; i++)
+	{
+		if (a->x[i] > 0)
+			return (FALSE);
+		if (a->x[i + a->dim] < 0)
+			return (FALSE);
+	}
+
+	pfree(a);
+	pfree(b);
+
+	return (TRUE);
 }
 
 
 /* Distance */
 /* The distance is computed as a per axis sum of the squared distances
-   between 1D projections of the boxes onto Cartesian axes. Assuming zero 
-   distance between overlapping projections, this metric coincides with the 
+   between 1D projections of the boxes onto Cartesian axes. Assuming zero
+   distance between overlapping projections, this metric coincides with the
    "common sense" geometric distance */
-float *cube_distance(NDBOX *a, NDBOX *b)
+float *
+cube_distance(NDBOX * a, NDBOX * b)
 {
-  int i;
-  double d, distance;
-  float *result;
-
-  result = (float *) palloc(sizeof(float));
-  
-  /* swap the box pointers if needed */
-  if ( a->dim < b->dim ) {
-    NDBOX * tmp = b; b = a; a = tmp;
-  }
-
-  distance = 0.0;
-  /* compute within the dimensions of (b) */
-  for ( i = 0; i < b->dim; i++ ) {
-    d = distance_1D(a->x[i], a->x[i + a->dim], b->x[i], b->x[i + b->dim]);
-    distance += d*d;
-  }
-
-  /* compute distance to zero for those dimensions in (a) absent in (b) */
-  for ( i = b->dim; i < a->dim; i++ ) {
-    d = distance_1D(a->x[i], a->x[i + a->dim], 0.0, 0.0);
-    distance += d*d;
-  }
-  
-  *result = (float)sqrt(distance);
-
-  return(result);
+	int			i;
+	double		d,
+				distance;
+	float	   *result;
+
+	result = (float *) palloc(sizeof(float));
+
+	/* swap the box pointers if needed */
+	if (a->dim < b->dim)
+	{
+		NDBOX	   *tmp = b;
+
+		b = a;
+		a = tmp;
+	}
+
+	distance = 0.0;
+	/* compute within the dimensions of (b) */
+	for (i = 0; i < b->dim; i++)
+	{
+		d = distance_1D(a->x[i], a->x[i + a->dim], b->x[i], b->x[i + b->dim]);
+		distance += d * d;
+	}
+
+	/* compute distance to zero for those dimensions in (a) absent in (b) */
+	for (i = b->dim; i < a->dim; i++)
+	{
+		d = distance_1D(a->x[i], a->x[i + a->dim], 0.0, 0.0);
+		distance += d * d;
+	}
+
+	*result = (float) sqrt(distance);
+
+	return (result);
 }
 
-static float distance_1D(float a1, float a2, float b1, float b2)
+static float
+distance_1D(float a1, float a2, float b1, float b2)
 {
-  /* interval (a) is entirely on the left of (b) */
-  if( (a1 <= b1) && (a2 <= b1) && (a1 <= b2) && (a2 <= b2) ) {
-    return ( min( b1, b2 ) - max( a1, a2 ) );
-  }
-
-  /* interval (a) is entirely on the right of (b) */
-  if( (a1 > b1) && (a2 > b1) && (a1 > b2) && (a2 > b2) ) {
-    return ( min( a1, a2 ) - max( b1, b2 ) );
-  }
-  
-  /* the rest are all sorts of intersections */
-  return(0.0);
+	/* interval (a) is entirely on the left of (b) */
+	if ((a1 <= b1) && (a2 <= b1) && (a1 <= b2) && (a2 <= b2))
+		return (min(b1, b2) - max(a1, a2));
+
+	/* interval (a) is entirely on the right of (b) */
+	if ((a1 > b1) && (a2 > b1) && (a1 > b2) && (a2 > b2))
+		return (min(a1, a2) - max(b1, b2));
+
+	/* the rest are all sorts of intersections */
+	return (0.0);
 }
 
 /* normalize the box's co-ordinates by placing min(xLL,xUR) to LL
-   and max(xLL,xUR) to UR 
+   and max(xLL,xUR) to UR
 */
-static NDBOX *swap_corners ( NDBOX *a )
+static NDBOX *
+swap_corners(NDBOX * a)
 {
-  int i, j;
-  NDBOX * result;
-  
-  result = palloc(a->size);
-  result->size = a->size;
-  result->dim = a->dim;
-
-  for ( i = 0, j = a->dim; i < a->dim; i++, j++ ) {
-    result->x[i] = min(a->x[i],a->x[j]);
-    result->x[j] = max(a->x[i],a->x[j]);
-  }
-
-  return(result);
+	int			i,
+				j;
+	NDBOX	   *result;
+
+	result = palloc(a->size);
+	result->size = a->size;
+	result->dim = a->dim;
+
+	for (i = 0, j = a->dim; i < a->dim; i++, j++)
+	{
+		result->x[i] = min(a->x[i], a->x[j]);
+		result->x[j] = max(a->x[i], a->x[j]);
+	}
+
+	return (result);
 }
diff --git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h
index 18bb6485464a4f4ee897c410a0098735e3aea6a5..359fab287160596ba34a8ac26e67a92d3c2ddfa3 100644
--- a/contrib/cube/cubedata.h
+++ b/contrib/cube/cubedata.h
@@ -1,5 +1,6 @@
-typedef struct NDBOX {
-  unsigned int size;			/* required to be a Postgres varlena type */
-  unsigned int dim;
-  float x[1];
-} NDBOX;
+typedef struct NDBOX
+{
+	unsigned int size;			/* required to be a Postgres varlena type */
+	unsigned int dim;
+	float		x[1];
+}			NDBOX;
diff --git a/contrib/earthdistance/earthdistance.c b/contrib/earthdistance/earthdistance.c
index 2383256be9b816662580bff03876dce81bd978cf..c1962272f4fb64775e21a858d40f43d9f6dbee02 100644
--- a/contrib/earthdistance/earthdistance.c
+++ b/contrib/earthdistance/earthdistance.c
@@ -9,7 +9,7 @@
 const int	EARTH_RADIUS = 3958.747716;
 const int	TWO_PI = 2.0 * M_PI;
 
-double *geo_distance(Point *pt1, Point *pt2);
+double	   *geo_distance(Point *pt1, Point *pt2);
 
 
 /******************************************************
diff --git a/contrib/findoidjoins/findoidjoins.c b/contrib/findoidjoins/findoidjoins.c
index 7d76bf719fcd84b1fc9f955f579a7d12cb4a75ba..8aabe58672c2290feef15003312aa1264da2d9eb 100644
--- a/contrib/findoidjoins/findoidjoins.c
+++ b/contrib/findoidjoins/findoidjoins.c
@@ -20,7 +20,7 @@ main(int argc, char **argv)
 	char		attname[256];
 	char		typname[256];
 	int			count;
-	char	    optstr[256];
+	char		optstr[256];
 
 	if (argc != 2)
 		halt("Usage:  %s database\n", argv[0]);
diff --git a/contrib/fulltextindex/fti.c b/contrib/fulltextindex/fti.c
index 1f9c398fea5ca2b2aeba035d8182f1d5b51fd557..a797505e7016dbb56b36d90fc99fe769568bdf82 100644
--- a/contrib/fulltextindex/fti.c
+++ b/contrib/fulltextindex/fti.c
@@ -62,11 +62,11 @@ select p.* from product p, title_fti f1, title_fti f2 where
    that can build the final query automatigally?
    */
 
-extern Datum	fti(PG_FUNCTION_ARGS);
-static char	   *breakup(char *, char *);
-static bool		is_stopword(char *);
+extern Datum fti(PG_FUNCTION_ARGS);
+static char *breakup(char *, char *);
+static bool is_stopword(char *);
 
-static bool		new_tuple = false;
+static bool new_tuple = false;
 
 
 /* THIS LIST MUST BE IN SORTED ORDER, A BINARY SEARCH IS USED!!!! */
diff --git a/contrib/lo/lo.c b/contrib/lo/lo.c
index 33fa4cf98dd1d0991406c77d85a64d5bba217d22..1dcdc3585010fb43d8f2d6e889428162f251e56b 100644
--- a/contrib/lo/lo.c
+++ b/contrib/lo/lo.c
@@ -1,7 +1,7 @@
 /*
  *	PostgreSQL type definitions for managed LargeObjects.
  *
- *	$Header: /cvsroot/pgsql/contrib/lo/lo.c,v 1.7 2001/02/10 02:31:25 tgl Exp $
+ *	$Header: /cvsroot/pgsql/contrib/lo/lo.c,v 1.8 2001/03/22 03:59:09 momjian Exp $
  *
  */
 
@@ -36,7 +36,7 @@ Blob	   *lo_in(char *str);	/* Create from String		*/
 char	   *lo_out(Blob * addr);/* Output oid as String		*/
 Oid			lo_oid(Blob * addr);/* Return oid as an oid		*/
 Blob	   *lo(Oid oid);		/* Return Blob based on oid */
-Datum		lo_manage(PG_FUNCTION_ARGS); /* Trigger handler			*/
+Datum		lo_manage(PG_FUNCTION_ARGS);		/* Trigger handler		   */
 
 /*
  * This creates a large object, and sets its OID to the value in the
@@ -69,7 +69,7 @@ lo_in(char *str)
 		 * There is no Oid passed, so create a new one
 		 */
 		oid = DatumGetObjectId(DirectFunctionCall1(lo_creat,
-							   Int32GetDatum(INV_READ | INV_WRITE)));
+								   Int32GetDatum(INV_READ | INV_WRITE)));
 		if (oid == InvalidOid)
 			elog(ERROR, "lo_in: InvalidOid returned from lo_creat");
 	}
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 1eaa73335c08d17552008e3672e162e3ed4f3486..a823c5f50b3992b9d3c40f0046b8c9b24d050c14 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -1,6 +1,6 @@
-/* 
+/*
   oid2name; a postgresql 7.1 (+?) app to map OIDs on the filesystem
-   to table and database names.  
+   to table and database names.
 
   b. palmer, bpalmer@crimelabs.net 1-17-2001
 
@@ -13,433 +13,439 @@
 #include "libpq-fe.h"
 
 /* these are the opts structures for command line params */
-struct options {
-  int getdatabase;
-  int gettable;
-  int getoid;
-  
-  int systables;
-
-  int remotehost;
-  int remoteport;
-  int remoteuser;
-  int remotepass;
-
-  int _oid;
-  char _dbname[128];
-  char _tbname[128];
-
-  char _hostname[128];
-  char _port[6];
-  char _username[128];
-  char _password[128];
+struct options
+{
+	int			getdatabase;
+	int			gettable;
+	int			getoid;
+
+	int			systables;
+
+	int			remotehost;
+	int			remoteport;
+	int			remoteuser;
+	int			remotepass;
+
+	int			_oid;
+	char		_dbname[128];
+	char		_tbname[128];
+
+	char		_hostname[128];
+	char		_port[6];
+	char		_username[128];
+	char		_password[128];
 };
 
 /* function prototypes */
-void get_opts(int, char **, struct options *);
-PGconn *sql_conn(char *, struct options *);
-void sql_exec_error (int);
-int sql_exec(PGconn *, char *, int);
-void sql_exec_dumpdb(PGconn *);
-void sql_exec_dumptable(PGconn *, int);
-void sql_exec_searchtable(PGconn *, char *);
-void sql_exec_searchoid(PGconn *, int);
+void		get_opts(int, char **, struct options *);
+PGconn	   *sql_conn(char *, struct options *);
+void		sql_exec_error(int);
+int			sql_exec(PGconn *, char *, int);
+void		sql_exec_dumpdb(PGconn *);
+void		sql_exec_dumptable(PGconn *, int);
+void		sql_exec_searchtable(PGconn *, char *);
+void		sql_exec_searchoid(PGconn *, int);
 
 /* fuction to parse command line options and check for some usage errors. */
-void get_opts(int argc, char **argv, struct options *my_opts)
+void
+get_opts(int argc, char **argv, struct options * my_opts)
 {
-  char c;
+	char		c;
 
-  /* set the defaults */
-  my_opts->getdatabase = 0;
-  my_opts->gettable = 0;
-  my_opts->getoid = 0;
+	/* set the defaults */
+	my_opts->getdatabase = 0;
+	my_opts->gettable = 0;
+	my_opts->getoid = 0;
 
-  my_opts->systables = 0;
+	my_opts->systables = 0;
 
-  my_opts->remotehost = 0;
-  my_opts->remoteport = 0;
-  my_opts->remoteuser = 0;
-  my_opts->remotepass = 0;
+	my_opts->remotehost = 0;
+	my_opts->remoteport = 0;
+	my_opts->remoteuser = 0;
+	my_opts->remotepass = 0;
 
-  /* get opts */
-  while( (c = getopt(argc, argv, "H:p:U:P:d:t:o:xh?")) != EOF)
-    {
-      switch(c)
+	/* get opts */
+	while ((c = getopt(argc, argv, "H:p:U:P:d:t:o:xh?")) != EOF)
 	{
-	  /* specify the database */
-	case 'd':
-	  my_opts->getdatabase = 1;
-	  sscanf(optarg, "%s", my_opts->_dbname);
-	  break;
-
-	  /* specify the table name */
-	case 't':
-	  /* make sure we set the database first */
-	  if(!my_opts->getdatabase)
-	    {
-	      fprintf(stderr, "Sorry,  but you must specify a database to dump from.\n");
-	      exit(1);
-	    }
-	  /* make sure we don't try to do a -o also */
-	  if(my_opts->getoid)
-	    {
-	      fprintf(stderr, "Sorry, you can only specify either oid or table\n");
-	      exit(1);
-	    }
-
-	  my_opts->gettable = 1;
-	  sscanf(optarg, "%s", my_opts->_tbname);
-
-	  break;
-
-	  /* specify the oid int */
-	case 'o':
-	  /* make sure we set the database first */
-	  if(!my_opts->getdatabase)
-	    {
-	      fprintf(stderr, "Sorry,  but you must specify a database to dump from.\n");
-	      exit(1);
-	    }
-	  /* make sure we don't try to do a -t also */
-	  if(my_opts->gettable)
-	    {
-	      fprintf(stderr, "Sorry, you can only specify either oid or table\n");
-	      exit(1);
-	    }
-
-	  my_opts->getoid = 1;
-	  sscanf(optarg, "%i", &my_opts->_oid);
-
-	  break;
-
-	  /* host to connect to */
-	case 'H':
-	  my_opts->remotehost = 1;
-	  sscanf(optarg, "%s", my_opts->_hostname);
-	  break;
-
-	  /* port to connect to on remote host */
-	case 'p':
-	  my_opts->remoteport = 1;
-	  sscanf(optarg, "%s", my_opts->_port);
-	  break;
-
-	  /* username */
-	case 'U':
-	  my_opts->remoteuser = 1;
-	  sscanf(optarg, "%s", my_opts->_username);
-	  break;
-
-	  /* password */
-	case 'P':
-	  my_opts->remotepass = 1;
-	  sscanf(optarg, "%s", my_opts->_password);
-	  break;
-
-	  /* display system tables */
-	case 'x':
-
-	  my_opts->systables = 1;
-	  break;
-
-	  /* help! (ugly in code for easier editing) */
-	case '?':
-	case 'h':
-	  fprintf(stderr, "\n\
+		switch (c)
+		{
+				/* specify the database */
+			case 'd':
+				my_opts->getdatabase = 1;
+				sscanf(optarg, "%s", my_opts->_dbname);
+				break;
+
+				/* specify the table name */
+			case 't':
+				/* make sure we set the database first */
+				if (!my_opts->getdatabase)
+				{
+					fprintf(stderr, "Sorry,  but you must specify a database to dump from.\n");
+					exit(1);
+				}
+				/* make sure we don't try to do a -o also */
+				if (my_opts->getoid)
+				{
+					fprintf(stderr, "Sorry, you can only specify either oid or table\n");
+					exit(1);
+				}
+
+				my_opts->gettable = 1;
+				sscanf(optarg, "%s", my_opts->_tbname);
+
+				break;
+
+				/* specify the oid int */
+			case 'o':
+				/* make sure we set the database first */
+				if (!my_opts->getdatabase)
+				{
+					fprintf(stderr, "Sorry,  but you must specify a database to dump from.\n");
+					exit(1);
+				}
+				/* make sure we don't try to do a -t also */
+				if (my_opts->gettable)
+				{
+					fprintf(stderr, "Sorry, you can only specify either oid or table\n");
+					exit(1);
+				}
+
+				my_opts->getoid = 1;
+				sscanf(optarg, "%i", &my_opts->_oid);
+
+				break;
+
+				/* host to connect to */
+			case 'H':
+				my_opts->remotehost = 1;
+				sscanf(optarg, "%s", my_opts->_hostname);
+				break;
+
+				/* port to connect to on remote host */
+			case 'p':
+				my_opts->remoteport = 1;
+				sscanf(optarg, "%s", my_opts->_port);
+				break;
+
+				/* username */
+			case 'U':
+				my_opts->remoteuser = 1;
+				sscanf(optarg, "%s", my_opts->_username);
+				break;
+
+				/* password */
+			case 'P':
+				my_opts->remotepass = 1;
+				sscanf(optarg, "%s", my_opts->_password);
+				break;
+
+				/* display system tables */
+			case 'x':
+
+				my_opts->systables = 1;
+				break;
+
+				/* help! (ugly in code for easier editing) */
+			case '?':
+			case 'h':
+				fprintf(stderr, "\n\
 Usage: pg_oid2name [-d database [-x] ] [-t table | -o oid] \n\
-        dafault action        display all databases
+        dafault action        display all databases\n\
         -d database           database to oid2name\n\
         -x                    display system tables\n\
         -t table | -o oid     search for table name (-t) or\n\
-                               oid (-o) in -d database
+                               oid (-o) in -d database\n\
         -H host               connect to remote host\n\
         -p port               host port to connect to\n\
         -U username           username to connect with\n\
         -P password           password for username\n\n\
 ");
-	  exit(1);
-	  break;
+				exit(1);
+				break;
+		}
 	}
-    }
 }
 
 /* establish connection with database. */
-PGconn *sql_conn(char *dbName, struct options *my_opts)
+PGconn *
+sql_conn(char *dbName, struct options * my_opts)
 {
-  char *pghost, *pgport;
-  char *pgoptions, *pgtty;
-  char *pguser, *pgpass;
-
-  PGconn *conn;
-
-  pghost = NULL;
-  pgport = NULL;
-  
-  pgoptions = NULL;           /* special options to start up the backend
-                                 * server */
-  pgtty = NULL;               /* debugging tty for the backend server */
-
-  pguser = NULL;
-  pgpass = NULL;
-
-  /* override the NULLs with the user params if passed */
-  if(my_opts->remotehost)
-    {
-      pghost = (char *) malloc (128);
-      sscanf(my_opts->_hostname, "%s", pghost);
-    }
-    
-  if(my_opts->remoteport)
-    {
-      pgport = (char *) malloc (6);
-      sscanf(my_opts->_port, "%s", pgport);
-    }
-
-  if(my_opts->remoteuser)
-    {
-      pguser = (char *) malloc (128);
-      sscanf(my_opts->_username, "%s", pguser);
-    }
-
-  if(my_opts->remotepass)
-    {
-      pgpass = (char *) malloc (128);
-      sscanf(my_opts->_password, "%s", pgpass);
-    }
-
-  /* login */
-  conn = PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName, pguser, pgpass);
-
-  /* deal with errors */
-  if (PQstatus(conn) == CONNECTION_BAD)
-    {
-      fprintf(stderr, "Connection to database '%s' failed.\n", dbName);
-      fprintf(stderr, "%s", PQerrorMessage(conn));
-      
-      
-      PQfinish(conn);
-      exit(1);
-
-    }
-
-  /* return the conn if good */
-  return conn;
+	char	   *pghost,
+			   *pgport;
+	char	   *pgoptions,
+			   *pgtty;
+	char	   *pguser,
+			   *pgpass;
+
+	PGconn	   *conn;
+
+	pghost = NULL;
+	pgport = NULL;
+
+	pgoptions = NULL;			/* special options to start up the backend
+								 * server */
+	pgtty = NULL;				/* debugging tty for the backend server */
+
+	pguser = NULL;
+	pgpass = NULL;
+
+	/* override the NULLs with the user params if passed */
+	if (my_opts->remotehost)
+	{
+		pghost = (char *) malloc(128);
+		sscanf(my_opts->_hostname, "%s", pghost);
+	}
+
+	if (my_opts->remoteport)
+	{
+		pgport = (char *) malloc(6);
+		sscanf(my_opts->_port, "%s", pgport);
+	}
+
+	if (my_opts->remoteuser)
+	{
+		pguser = (char *) malloc(128);
+		sscanf(my_opts->_username, "%s", pguser);
+	}
+
+	if (my_opts->remotepass)
+	{
+		pgpass = (char *) malloc(128);
+		sscanf(my_opts->_password, "%s", pgpass);
+	}
+
+	/* login */
+	conn = PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName, pguser, pgpass);
+
+	/* deal with errors */
+	if (PQstatus(conn) == CONNECTION_BAD)
+	{
+		fprintf(stderr, "Connection to database '%s' failed.\n", dbName);
+		fprintf(stderr, "%s", PQerrorMessage(conn));
+
+
+		PQfinish(conn);
+		exit(1);
+
+	}
+
+	/* return the conn if good */
+	return conn;
 }
 
 /* If the sql_ command has an error,  this function looks up the error number and prints it out. */
-void sql_exec_error (int error_number)
+void
+sql_exec_error(int error_number)
 {
-  fprintf(stderr, "Error number %i.\n", error_number);
-  switch(error_number)
-    {
-    case 3:
-      fprintf(stderr,  "Error:  PGRES_COPY_OUT\n");
-      break;
-      
-    case 4:
-      fprintf(stderr,  "Error:  PGRES_COPY_IN\n");
-      break;
-      
-    case 5:
-      fprintf(stderr,  "Error:  PGRES_BAD_RESPONCE\n");
-      break;
-      
-    case 6:
-      fprintf(stderr,  "Error:  PGRES_NONFATAL_ERROR\n");
-      break;
-      
-    case 7:
-      fprintf(stderr,  "Error:  PGRES_FATAL_ERROR\n");
-      break;
-    }
+	fprintf(stderr, "Error number %i.\n", error_number);
+	switch (error_number)
+	{
+		case 3:
+			fprintf(stderr, "Error:  PGRES_COPY_OUT\n");
+			break;
+
+		case 4:
+			fprintf(stderr, "Error:  PGRES_COPY_IN\n");
+			break;
+
+		case 5:
+			fprintf(stderr, "Error:  PGRES_BAD_RESPONCE\n");
+			break;
+
+		case 6:
+			fprintf(stderr, "Error:  PGRES_NONFATAL_ERROR\n");
+			break;
+
+		case 7:
+			fprintf(stderr, "Error:  PGRES_FATAL_ERROR\n");
+			break;
+	}
 }
 
 /* actual code to make call to the database and print the output data */
-int sql_exec(PGconn *conn, char *todo, int match)
+int
+sql_exec(PGconn *conn, char *todo, int match)
 {
-  PGresult *res;
-
-  int numbfields;
-  int error_number;
-  int i, len;
-
-  /* make the call */
-  res = PQexec(conn, todo);
-
-  /* check and deal with errors */
-  if (!res || PQresultStatus(res) > 2)
-    {
-      error_number = PQresultStatus(res);
-      fprintf(stderr, "There was an error in the SQL command:\n%s\n", todo);
-      sql_exec_error(error_number);
-      fprintf(stderr,  "PQerrorMessage = %s\n", PQerrorMessage(conn));
-	    
-      PQclear(res);
-      PQfinish(conn);
-      exit(-1);
-    }
-
-  /* get the number of fields */
-  numbfields = PQntuples(res);
-
-  /* if we only expect 1 and there mode than,  return -2 */
-  if(match == 1 && numbfields > 1)
-    return -2;
-
-  /* return -1 if there aren't any returns */
-  if(match == 1 && numbfields < 1)
-    return -1;
-
-  /* for each row,  dump the information */
-  for(i = 0; i < numbfields; i++)
-    {
-      len = strlen(PQgetvalue(res, i, 0));
-
-      fprintf(stdout, "%-6s = %s\n", PQgetvalue(res, i, 0), PQgetvalue(res, i, 1));
-    }
-
-  /* clean the PGconn once done */
-  PQclear(res);
-
-  return 0;
+	PGresult   *res;
+
+	int			numbfields;
+	int			error_number;
+	int			i,
+				len;
+
+	/* make the call */
+	res = PQexec(conn, todo);
+
+	/* check and deal with errors */
+	if (!res || PQresultStatus(res) > 2)
+	{
+		error_number = PQresultStatus(res);
+		fprintf(stderr, "There was an error in the SQL command:\n%s\n", todo);
+		sql_exec_error(error_number);
+		fprintf(stderr, "PQerrorMessage = %s\n", PQerrorMessage(conn));
+
+		PQclear(res);
+		PQfinish(conn);
+		exit(-1);
+	}
+
+	/* get the number of fields */
+	numbfields = PQntuples(res);
+
+	/* if we only expect 1 and there mode than,  return -2 */
+	if (match == 1 && numbfields > 1)
+		return -2;
+
+	/* return -1 if there aren't any returns */
+	if (match == 1 && numbfields < 1)
+		return -1;
+
+	/* for each row,  dump the information */
+	for (i = 0; i < numbfields; i++)
+	{
+		len = strlen(PQgetvalue(res, i, 0));
+
+		fprintf(stdout, "%-6s = %s\n", PQgetvalue(res, i, 0), PQgetvalue(res, i, 1));
+	}
+
+	/* clean the PGconn once done */
+	PQclear(res);
+
+	return 0;
 }
 
 /* dump all databases know by the system table */
-void sql_exec_dumpdb(PGconn *conn)
+void
+sql_exec_dumpdb(PGconn *conn)
 {
-  char *todo;
+	char	   *todo;
 
-  todo = (char *) malloc (1024);
+	todo = (char *) malloc(1024);
 
-  /* get the oid and database name from the system pg_database table */
-  sprintf(todo, "select oid,datname from pg_database");
+	/* get the oid and database name from the system pg_database table */
+	sprintf(todo, "select oid,datname from pg_database");
 
-  sql_exec(conn, todo, 0);
+	sql_exec(conn, todo, 0);
 }
 
 /* display all tables in whatever db we are connected to.  don't display the
    system tables by default */
-void sql_exec_dumptable(PGconn *conn, int systables)
+void
+sql_exec_dumptable(PGconn *conn, int systables)
 {
-  char *todo;
+	char	   *todo;
 
-  todo = (char *) malloc (1024);
+	todo = (char *) malloc(1024);
 
-  /* don't exclude the systables if this is set */
-  if(systables == 1)
-    sprintf(todo, "select relfilenode,relname from pg_class order by relname");
-  else
-    sprintf(todo, "select relfilenode,relname from pg_class where relname not like 'pg_%%' order by relname");
+	/* don't exclude the systables if this is set */
+	if (systables == 1)
+		sprintf(todo, "select relfilenode,relname from pg_class order by relname");
+	else
+		sprintf(todo, "select relfilenode,relname from pg_class where relname not like 'pg_%%' order by relname");
 
-  sql_exec(conn, todo, 0);
+	sql_exec(conn, todo, 0);
 }
 
 /* display the oid for a given tablename for whatever db we are connected
-   to.  do we want to allow %bar% in the search?  Not now. */
-void sql_exec_searchtable(PGconn *conn, char *tablename)
+   to.	do we want to allow %bar% in the search?  Not now. */
+void
+sql_exec_searchtable(PGconn *conn, char *tablename)
 {
-  int returnvalue;
-  char *todo;
-
-  todo = (char *) malloc (1024);
-
-  /* get the oid and tablename where the name matches tablename */
-  sprintf(todo, "select relfilenode,relname from pg_class where relname = '%s'", tablename);
-
-  returnvalue = sql_exec(conn, todo, 1);
-
-  /* deal with the return errors */
-  if(returnvalue == -1)
-    {
-      printf("No tables with that name found\n");
-    }
-  
-  if(returnvalue == -2)
-    {
-      printf("VERY scary:  more than one table with that name found!!\n");
-    }
+	int			returnvalue;
+	char	   *todo;
+
+	todo = (char *) malloc(1024);
+
+	/* get the oid and tablename where the name matches tablename */
+	sprintf(todo, "select relfilenode,relname from pg_class where relname = '%s'", tablename);
+
+	returnvalue = sql_exec(conn, todo, 1);
+
+	/* deal with the return errors */
+	if (returnvalue == -1)
+		printf("No tables with that name found\n");
+
+	if (returnvalue == -2)
+		printf("VERY scary:  more than one table with that name found!!\n");
 }
 
 /* same as above */
-void sql_exec_searchoid(PGconn *conn, int oid)
+void
+sql_exec_searchoid(PGconn *conn, int oid)
 {
-  int returnvalue;
-  char *todo;
+	int			returnvalue;
+	char	   *todo;
+
+	todo = (char *) malloc(1024);
 
-  todo = (char *) malloc (1024);
+	sprintf(todo, "select relfilenode,relname from pg_class where oid = %i", oid);
 
-  sprintf(todo, "select relfilenode,relname from pg_class where oid = %i", oid);
+	returnvalue = sql_exec(conn, todo, 1);
 
-  returnvalue = sql_exec(conn, todo, 1);
+	if (returnvalue == -1)
+		printf("No tables with that oid found\n");
 
-  if(returnvalue == -1)
-    {
-      printf("No tables with that oid found\n");
-    }
-  
-  if(returnvalue == -2)
-    {
-      printf("VERY scary:  more than one table with that oid found!!\n");
-    }
+	if (returnvalue == -2)
+		printf("VERY scary:  more than one table with that oid found!!\n");
 }
 
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
-  struct options *my_opts;
-  PGconn *pgconn;
-
-  my_opts = (struct options *) malloc (sizeof(struct options));
-
-  /* parse the opts */
-  get_opts(argc, argv, my_opts);
-
-  /* display all the tables in the database */
-  if(my_opts->getdatabase & my_opts->gettable)
-    {
-      printf("Oid of table %s from database \"%s\":\n", my_opts->_tbname, my_opts->_dbname);
-      printf("_______________________________\n");
-
-      pgconn = sql_conn(my_opts->_dbname, my_opts);
-      sql_exec_searchtable(pgconn, my_opts->_tbname);
-      PQfinish(pgconn);
-
-      exit(1);
-    }
-  
-  /* search for the tablename of the given OID */
-  if(my_opts->getdatabase & my_opts->getoid)
-    {
-      printf("Tablename of oid %i from database \"%s\":\n", my_opts->_oid, my_opts->_dbname);
-      printf("---------------------------------\n");
-
-      pgconn = sql_conn(my_opts->_dbname, my_opts);
-      sql_exec_searchoid(pgconn, my_opts->_oid);
-      PQfinish(pgconn);
-
-      exit(1);
-    }
-
-  /* search for the oid for the given tablename */
-  if(my_opts->getdatabase)
-    {
-      printf("All tables from database \"%s\":\n", my_opts->_dbname);
-      printf("---------------------------------\n");
-
-      pgconn = sql_conn(my_opts->_dbname, my_opts);
-      sql_exec_dumptable(pgconn, my_opts->systables);
-      PQfinish(pgconn);
-
-      exit(1);
-    }
-
-  /* display all the databases for the server we are connected to.. */
-  printf("All databases:\n");
-  printf("---------------------------------\n");  
-  
-  pgconn = sql_conn("template1", my_opts);
-  sql_exec_dumpdb(pgconn);
-  PQfinish(pgconn);
-
-  exit(0);
+	struct options *my_opts;
+	PGconn	   *pgconn;
+
+	my_opts = (struct options *) malloc(sizeof(struct options));
+
+	/* parse the opts */
+	get_opts(argc, argv, my_opts);
+
+	/* display all the tables in the database */
+	if (my_opts->getdatabase & my_opts->gettable)
+	{
+		printf("Oid of table %s from database \"%s\":\n", my_opts->_tbname, my_opts->_dbname);
+		printf("_______________________________\n");
+
+		pgconn = sql_conn(my_opts->_dbname, my_opts);
+		sql_exec_searchtable(pgconn, my_opts->_tbname);
+		PQfinish(pgconn);
+
+		exit(1);
+	}
+
+	/* search for the tablename of the given OID */
+	if (my_opts->getdatabase & my_opts->getoid)
+	{
+		printf("Tablename of oid %i from database \"%s\":\n", my_opts->_oid, my_opts->_dbname);
+		printf("---------------------------------\n");
+
+		pgconn = sql_conn(my_opts->_dbname, my_opts);
+		sql_exec_searchoid(pgconn, my_opts->_oid);
+		PQfinish(pgconn);
+
+		exit(1);
+	}
+
+	/* search for the oid for the given tablename */
+	if (my_opts->getdatabase)
+	{
+		printf("All tables from database \"%s\":\n", my_opts->_dbname);
+		printf("---------------------------------\n");
+
+		pgconn = sql_conn(my_opts->_dbname, my_opts);
+		sql_exec_dumptable(pgconn, my_opts->systables);
+		PQfinish(pgconn);
+
+		exit(1);
+	}
+
+	/* display all the databases for the server we are connected to.. */
+	printf("All databases:\n");
+	printf("---------------------------------\n");
+
+	pgconn = sql_conn("template1", my_opts);
+	sql_exec_dumpdb(pgconn);
+	PQfinish(pgconn);
+
+	exit(0);
 }
diff --git a/contrib/pg_controldata/pg_controldata.c b/contrib/pg_controldata/pg_controldata.c
index dc666c1fcf29d12952e4a8bc95eef6dc79378523..93fe9a54c9b5cd3596d03df329e7996815302543 100644
--- a/contrib/pg_controldata/pg_controldata.c
+++ b/contrib/pg_controldata/pg_controldata.c
@@ -6,7 +6,7 @@
  * copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
  * licence: BSD
  *
- * $Header: /cvsroot/pgsql/contrib/pg_controldata/Attic/pg_controldata.c,v 1.2 2001/03/13 01:17:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_controldata/Attic/pg_controldata.c,v 1.3 2001/03/22 03:59:09 momjian Exp $
  */
 #include "postgres.h"
 
@@ -24,7 +24,7 @@ dbState(DBState state)
 {
 	switch (state)
 	{
-		case DB_STARTUP:
+			case DB_STARTUP:
 			return "STARTUP";
 		case DB_SHUTDOWNED:
 			return "SHUTDOWNED";
@@ -43,16 +43,17 @@ int
 main()
 {
 	ControlFileData ControlFile;
-	int fd;
-	char ControlFilePath[MAXPGPATH];
-	char *DataDir;
-	crc64 crc;
-	char pgctime_str[32];
-	char ckpttime_str[32];
+	int			fd;
+	char		ControlFilePath[MAXPGPATH];
+	char	   *DataDir;
+	crc64		crc;
+	char		pgctime_str[32];
+	char		ckpttime_str[32];
 
 	DataDir = getenv("PGDATA");
-	if ( DataDir == NULL ) {
-		fprintf(stderr,"PGDATA is not defined\n");
+	if (DataDir == NULL)
+	{
+		fprintf(stderr, "PGDATA is not defined\n");
 		exit(1);
 	}
 
@@ -73,8 +74,8 @@ main()
 
 	/* Check the CRC. */
 	INIT_CRC64(crc);
-	COMP_CRC64(crc, 
-			   (char*) &ControlFile + sizeof(crc64),
+	COMP_CRC64(crc,
+			   (char *) &ControlFile + sizeof(crc64),
 			   sizeof(ControlFileData) - sizeof(crc64));
 	FIN_CRC64(crc);
 
@@ -93,7 +94,7 @@ main()
 		   "Database state:                       %s\n"
 		   "pg_control last modified:             %s\n"
 		   "Current log file id:                  %u\n"
-	       "Next log file segment:                %u\n"
+		   "Next log file segment:                %u\n"
 		   "Latest checkpoint location:           %X/%X\n"
 		   "Prior checkpoint location:            %X/%X\n"
 		   "Latest checkpoint's REDO location:    %X/%X\n"
diff --git a/contrib/pg_dumplo/lo_export.c b/contrib/pg_dumplo/lo_export.c
index 5a2a1614a571106709a770540c82fc92505bafba..6a62c88bc6f91e4c48064f9583020fc50bfb3f75 100644
--- a/contrib/pg_dumplo/lo_export.c
+++ b/contrib/pg_dumplo/lo_export.c
@@ -1,20 +1,20 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.5 2001/01/24 19:42:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.6 2001/03/22 03:59:10 momjian Exp $
  *
  *					Karel Zak 1999-2000
  * -------------------------------------------------------------------------
  */
 
-#include <stdio.h>	
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <errno.h>                            
+#include <errno.h>
 #include <time.h>
 
 #include <libpq-fe.h>
@@ -22,17 +22,17 @@
 
 #include "pg_dumplo.h"
 
-extern int 	errno;        
+extern int	errno;
 
 
-void 
-load_lolist( LODumpMaster *pgLO ) 
+void
+load_lolist(LODumpMaster * pgLO)
 {
-	LOlist		*ll;
-	int		i;
-	int		n;
+	LOlist	   *ll;
+	int			i;
+	int			n;
 
- 	/* ----------
+	/* ----------
 	 * Now find any candidate tables who have columns of type oid.
 	 *
 	 * NOTE: System tables including pg_largeobject will be ignored.
@@ -40,8 +40,8 @@ load_lolist( LODumpMaster *pgLO )
 	 *
 	 * NOTE: the system oid column is ignored, as it has attnum < 1.
 	 * This shouldn't matter for correctness, but it saves time.
- 	 * ----------
- 	 */	
+	 * ----------
+	 */
 	pgLO->res = PQexec(pgLO->conn,
 					   "SELECT c.relname, a.attname "
 					   "FROM pg_class c, pg_attribute a, pg_type t "
@@ -52,43 +52,49 @@ load_lolist( LODumpMaster *pgLO )
 					   "    AND c.relkind = 'r' "
 					   "    AND c.relname NOT LIKE 'pg_%'");
 
-	if (PQresultStatus(pgLO->res) != PGRES_TUPLES_OK) {
+	if (PQresultStatus(pgLO->res) != PGRES_TUPLES_OK)
+	{
 		fprintf(stderr, "%s: Failed to get LO OIDs:\n%s", progname,
 				PQerrorMessage(pgLO->conn));
 		exit(RE_ERROR);
 	}
 
-	if ((n = PQntuples(pgLO->res)) == 0) {
+	if ((n = PQntuples(pgLO->res)) == 0)
+	{
 		fprintf(stderr, "%s: No OID columns in the database.\n", progname);
 		exit(RE_ERROR);
- 	}
-	
+	}
+
 	pgLO->lolist = (LOlist *) malloc((n + 1) * sizeof(LOlist));
-	
-	if (!pgLO->lolist) {
+
+	if (!pgLO->lolist)
+	{
 		fprintf(stderr, "%s: can't allocate memory\n", progname);
 		exit(RE_ERROR);
-  	}
-  	
-	for (i = 0, ll = pgLO->lolist; i < n; i++, ll++) {
+	}
+
+	for (i = 0, ll = pgLO->lolist; i < n; i++, ll++)
+	{
 		ll->lo_table = strdup(PQgetvalue(pgLO->res, i, 0));
-		ll->lo_attr  = strdup(PQgetvalue(pgLO->res, i, 1));
+		ll->lo_attr = strdup(PQgetvalue(pgLO->res, i, 1));
 	}
- 	ll->lo_table = ll->lo_attr = (char *) NULL;
-	
+	ll->lo_table = ll->lo_attr = (char *) NULL;
+
 	PQclear(pgLO->res);
 }
 
-void 
-pglo_export(LODumpMaster *pgLO)
+void
+pglo_export(LODumpMaster * pgLO)
 {
-	LOlist		*ll;
-	int		tuples;
+	LOlist	   *ll;
+	int			tuples;
 	char		path[BUFSIZ],
-			Qbuff[QUERY_BUFSIZ];
-	
-	if (pgLO->action != ACTION_SHOW) {
-		time_t	t;
+				Qbuff[QUERY_BUFSIZ];
+
+	if (pgLO->action != ACTION_SHOW)
+	{
+		time_t		t;
+
 		time(&t);
 		fprintf(pgLO->index, "#\n# This is the PostgreSQL large object dump index\n#\n");
 		fprintf(pgLO->index, "#\tDate:     %s", ctime(&t));
@@ -97,90 +103,102 @@ pglo_export(LODumpMaster *pgLO)
 		fprintf(pgLO->index, "#\tUser:     %s\n", pgLO->user);
 		fprintf(pgLO->index, "#\n# oid\ttable\tattribut\tinfile\n#\n");
 	}
-	
+
 	pgLO->counter = 0;
 
-	for(ll=pgLO->lolist; ll->lo_table != NULL; ll++) {
-		
+	for (ll = pgLO->lolist; ll->lo_table != NULL; ll++)
+	{
+
 		/* ----------
 		 * Query: find the LOs referenced by this column
 		 * ----------
 		 */
 		sprintf(Qbuff, "SELECT DISTINCT l.loid FROM \"%s\" x, pg_largeobject l WHERE x.\"%s\" = l.loid",
 				ll->lo_table, ll->lo_attr);
-		
+
 		/* puts(Qbuff); */
-			
+
 		pgLO->res = PQexec(pgLO->conn, Qbuff);
 
-        if (PQresultStatus(pgLO->res) != PGRES_TUPLES_OK) {
+		if (PQresultStatus(pgLO->res) != PGRES_TUPLES_OK)
+		{
 			fprintf(stderr, "%s: Failed to get LO OIDs:\n%s", progname,
 					PQerrorMessage(pgLO->conn));
-        }
-		else if ((tuples = PQntuples(pgLO->res)) == 0) {
+		}
+		else if ((tuples = PQntuples(pgLO->res)) == 0)
+		{
 			if (!pgLO->quiet && pgLO->action == ACTION_EXPORT_ATTR)
 				printf("%s: no large objects in \"%s\".\"%s\"\n",
-					   progname, ll->lo_table, ll->lo_attr);	
-		} else {
-		
-			int	t;
-			char	*val;
-	
+					   progname, ll->lo_table, ll->lo_attr);
+		}
+		else
+		{
+
+			int			t;
+			char	   *val;
+
 			/* ----------
 			 * Create DIR/FILE
 			 * ----------
 			 */
-			if (pgLO->action != ACTION_SHOW) {
-			
+			if (pgLO->action != ACTION_SHOW)
+			{
+
 				sprintf(path, "%s/%s/%s", pgLO->space, pgLO->db,
 						ll->lo_table);
 
-				if (mkdir(path, DIR_UMASK) == -1) {
-					if (errno != EEXIST) {
+				if (mkdir(path, DIR_UMASK) == -1)
+				{
+					if (errno != EEXIST)
+					{
 						perror(path);
-						exit(RE_ERROR);					
-					}	
+						exit(RE_ERROR);
+					}
 				}
 
 				sprintf(path, "%s/%s/%s/%s", pgLO->space, pgLO->db,
-						ll->lo_table, ll->lo_attr);          
-				
-				if (mkdir(path, DIR_UMASK) == -1) {
-					if (errno != EEXIST) {
+						ll->lo_table, ll->lo_attr);
+
+				if (mkdir(path, DIR_UMASK) == -1)
+				{
+					if (errno != EEXIST)
+					{
 						perror(path);
-						exit(RE_ERROR);					
-					}	
+						exit(RE_ERROR);
+					}
 				}
-				
+
 				if (!pgLO->quiet)
-					printf("dump %s.%s (%d large obj)\n", 
-						ll->lo_table, ll->lo_attr, tuples);
+					printf("dump %s.%s (%d large obj)\n",
+						   ll->lo_table, ll->lo_attr, tuples);
 			}
 
 			pgLO->counter += tuples;
-			
-			for(t=0; t<tuples; t++) {
-				Oid lo;
-				
+
+			for (t = 0; t < tuples; t++)
+			{
+				Oid			lo;
+
 				val = PQgetvalue(pgLO->res, t, 0);
-				
+
 				lo = atooid(val);
-				
-				if (pgLO->action == ACTION_SHOW) {
+
+				if (pgLO->action == ACTION_SHOW)
+				{
 					printf("%s.%s: %u\n", ll->lo_table, ll->lo_attr, lo);
 					continue;
 				}
-				
-				sprintf(path, "%s/%s/%s/%s/%s", pgLO->space, 
-					pgLO->db, ll->lo_table, ll->lo_attr, val);
-				
-				if (lo_export(pgLO->conn, lo, path) < 0) 
+
+				sprintf(path, "%s/%s/%s/%s/%s", pgLO->space,
+						pgLO->db, ll->lo_table, ll->lo_attr, val);
+
+				if (lo_export(pgLO->conn, lo, path) < 0)
 					fprintf(stderr, "%s: lo_export failed:\n%s", progname,
 							PQerrorMessage(pgLO->conn));
-					
-				else 
-					fprintf(pgLO->index, "%s\t%s\t%s\t%s/%s/%s/%s\n", val, 
-						ll->lo_table, ll->lo_attr, pgLO->db, ll->lo_table, ll->lo_attr, val);
+
+				else
+					fprintf(pgLO->index, "%s\t%s\t%s\t%s/%s/%s/%s\n", val,
+							ll->lo_table, ll->lo_attr, pgLO->db, ll->lo_table, ll->lo_attr, val);
 			}
 		}
 
diff --git a/contrib/pg_dumplo/lo_import.c b/contrib/pg_dumplo/lo_import.c
index 996bdf9e27e1f935495d562418a9658b9daf59fb..ff8929d6d6e252eac14a0b0cbfd761eb712b90cf 100644
--- a/contrib/pg_dumplo/lo_import.c
+++ b/contrib/pg_dumplo/lo_import.c
@@ -1,20 +1,20 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.3 2001/01/24 19:42:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
  *
  *					Karel Zak 1999-2000
  * -------------------------------------------------------------------------
  */
 
-#include <stdio.h>	
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <errno.h>                            
+#include <errno.h>
 #include <time.h>
 
 #include <libpq-fe.h>
@@ -22,76 +22,82 @@
 
 #include "pg_dumplo.h"
 
-extern int 	errno;        
+extern int	errno;
 
-void 
-pglo_import(LODumpMaster *pgLO)
+void
+pglo_import(LODumpMaster * pgLO)
 {
 	LOlist		loa;
-	Oid 		new_oid;
-	char		tab[MAX_TABLE_NAME], attr[MAX_ATTR_NAME],
-			path[BUFSIZ], lo_path[BUFSIZ],
-			Qbuff[QUERY_BUFSIZ];
-	
-	while(fgets(Qbuff, QUERY_BUFSIZ, pgLO->index)) {
-		
+	Oid			new_oid;
+	char		tab[MAX_TABLE_NAME],
+				attr[MAX_ATTR_NAME],
+				path[BUFSIZ],
+				lo_path[BUFSIZ],
+				Qbuff[QUERY_BUFSIZ];
+
+	while (fgets(Qbuff, QUERY_BUFSIZ, pgLO->index))
+	{
+
 		if (*Qbuff == '#')
 			continue;
 
-		if (! pgLO->remove && ! pgLO->quiet)
+		if (!pgLO->remove && !pgLO->quiet)
 			printf(Qbuff);
-		
-		sscanf(Qbuff, "%u\t%s\t%s\t%s\n", &loa.lo_oid, tab, attr, path); 
+
+		sscanf(Qbuff, "%u\t%s\t%s\t%s\n", &loa.lo_oid, tab, attr, path);
 		loa.lo_table = tab;
-		loa.lo_attr  = attr;
+		loa.lo_attr = attr;
 
-		sprintf(lo_path, "%s/%s", pgLO->space, path); 
+		sprintf(lo_path, "%s/%s", pgLO->space, path);
 
 		/* ----------
 		 * Import LO
 		 * ----------
 		 */
-		if ((new_oid = lo_import(pgLO->conn, lo_path)) == 0) {
-		
+		if ((new_oid = lo_import(pgLO->conn, lo_path)) == 0)
+		{
+
 			fprintf(stderr, "%s: %s\n", progname, PQerrorMessage(pgLO->conn));
-			
+
 			PQexec(pgLO->conn, "ROLLBACK");
 			fprintf(stderr, "\n%s: ROLLBACK\n", progname);
 			exit(RE_ERROR);
 		}
 
-		if (pgLO->remove) {
+		if (pgLO->remove)
+		{
 			notice(pgLO, FALSE);
-			if (lo_unlink(pgLO->conn, loa.lo_oid) < 0) 
-				fprintf(stderr, "%s: can't remove LO %u:\n%s", 
-					progname, loa.lo_oid, PQerrorMessage(pgLO->conn));
-					
+			if (lo_unlink(pgLO->conn, loa.lo_oid) < 0)
+				fprintf(stderr, "%s: can't remove LO %u:\n%s",
+						progname, loa.lo_oid, PQerrorMessage(pgLO->conn));
+
 			else if (!pgLO->quiet)
-				printf("remove old %u and create new %u\n", 
-					loa.lo_oid, new_oid);	
-			notice(pgLO, TRUE);	
+				printf("remove old %u and create new %u\n",
+					   loa.lo_oid, new_oid);
+			notice(pgLO, TRUE);
 		}
-		
+
 		pgLO->counter++;
-	
+
 		/* ----------
 		 * UPDATE oid in tab
 		 * ----------
 		 */
-		sprintf(Qbuff, "UPDATE \"%s\" SET \"%s\"=%u WHERE \"%s\"=%u", 
+		sprintf(Qbuff, "UPDATE \"%s\" SET \"%s\"=%u WHERE \"%s\"=%u",
 			loa.lo_table, loa.lo_attr, new_oid, loa.lo_attr, loa.lo_oid);
 
-		/*fprintf(stderr, Qbuff);*/
-			
+		/* fprintf(stderr, Qbuff); */
+
 		pgLO->res = PQexec(pgLO->conn, Qbuff);
-	
-		if (PQresultStatus(pgLO->res) != PGRES_COMMAND_OK) {
-			fprintf(stderr, "%s: %s\n",progname, PQerrorMessage(pgLO->conn));
+
+		if (PQresultStatus(pgLO->res) != PGRES_COMMAND_OK)
+		{
+			fprintf(stderr, "%s: %s\n", progname, PQerrorMessage(pgLO->conn));
 			PQclear(pgLO->res);
 			PQexec(pgLO->conn, "ROLLBACK");
 			fprintf(stderr, "\n%s: ROLLBACK\n", progname);
 			exit(RE_ERROR);
-		}	
+		}
 		PQclear(pgLO->res);
-	}	
- }
+	}
+}
diff --git a/contrib/pg_dumplo/main.c b/contrib/pg_dumplo/main.c
index e8ff2f72e095b7e9c063744dfd83af475a9e99f4..3878aeca0273b0e2f3137e98e44cbc9e72ffc263 100644
--- a/contrib/pg_dumplo/main.c
+++ b/contrib/pg_dumplo/main.c
@@ -1,7 +1,7 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.6 2001/02/10 02:31:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.7 2001/03/22 03:59:10 momjian Exp $
  *
  *					Karel Zak 1999-2000
  * -------------------------------------------------------------------------
@@ -12,238 +12,254 @@
 #include "postgres_fe.h"
 #endif
 
-#include <stdio.h>	
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>                            
+#include <errno.h>
 
 #include <libpq-fe.h>
 #include <libpq/libpq-fs.h>
 
-#include "pg_dumplo.h" 
+#include "pg_dumplo.h"
 
 #ifdef HAVE_GETOPT_LONG
-	#include <getopt.h>
-	#define no_argument 0
-	#define required_argument 1
+#include <getopt.h>
+#define no_argument 0
+#define required_argument 1
 #endif
-        
-extern int 	errno;        
 
-char	*progname = NULL;
+extern int	errno;
 
-int main(int argc, char **argv);
+char	   *progname = NULL;
+
+int			main(int argc, char **argv);
 static void usage(void);
-static void parse_lolist (LODumpMaster *pgLO);
-        
+static void parse_lolist(LODumpMaster * pgLO);
+
 
 /*-----
  *	The mother of all C functions
  *-----
  */
-int 
+int
 main(int argc, char **argv)
-{	
-	LODumpMaster	_pgLO, *pgLO = &_pgLO;
-	char		*pwd = NULL;
-
-	pgLO->argv 	= argv;
-	pgLO->argc 	= argc;
-	pgLO->action 	= 0;
-	pgLO->lolist 	= NULL;
-	pgLO->user 	= NULL;
-	pgLO->db	= NULL;
-	pgLO->host	= NULL;
-	pgLO->space	= NULL;
-	pgLO->index	= NULL;
-	pgLO->remove	= FALSE;
-	pgLO->quiet	= FALSE; 
-	pgLO->counter	= 0;
+{
+	LODumpMaster _pgLO,
+			   *pgLO = &_pgLO;
+	char	   *pwd = NULL;
+
+	pgLO->argv = argv;
+	pgLO->argc = argc;
+	pgLO->action = 0;
+	pgLO->lolist = NULL;
+	pgLO->user = NULL;
+	pgLO->db = NULL;
+	pgLO->host = NULL;
+	pgLO->space = NULL;
+	pgLO->index = NULL;
+	pgLO->remove = FALSE;
+	pgLO->quiet = FALSE;
+	pgLO->counter = 0;
 	pgLO->lolist_start = 0;
-	
+
 	progname = argv[0];
 
 	/* ----------
 	 * Parse ARGV
 	 * ----------
 	 */
-	if (argc > 1) {
-      		int	arg;
-      		extern int optind;
-
-#ifdef HAVE_GETOPT_LONG      	
-		int	l_index=0;	
-      		static struct option l_opt[] = {
-      			{ "help",	no_argument, 0, 'h' },		
-			{ "user",	required_argument, 0, 'u' },
-			{ "pwd",	required_argument, 0, 'p' },
-			{ "db",		required_argument, 0, 'd' },
-			{ "host",	required_argument, 0, 'h' },
-			{ "space",	required_argument, 0, 's' },
-			{ "import",	no_argument, 0, 'i' },
-			{ "export",	no_argument, 0, 'e' },
-			{ "remove",	no_argument, 0, 'r' },
-			{ "quiet",	no_argument, 0, 'q' },
-			{ "all",	no_argument, 0, 'a' },
-			{ "show",	no_argument, 0, 'w' },
-			{ NULL, 0, 0, 0 }
-      		};     	
-
-		while((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1) {
+	if (argc > 1)
+	{
+		int			arg;
+		extern int	optind;
+
+#ifdef HAVE_GETOPT_LONG
+		int			l_index = 0;
+		static struct option l_opt[] = {
+			{"help", no_argument, 0, 'h'},
+			{"user", required_argument, 0, 'u'},
+			{"pwd", required_argument, 0, 'p'},
+			{"db", required_argument, 0, 'd'},
+			{"host", required_argument, 0, 'h'},
+			{"space", required_argument, 0, 's'},
+			{"import", no_argument, 0, 'i'},
+			{"export", no_argument, 0, 'e'},
+			{"remove", no_argument, 0, 'r'},
+			{"quiet", no_argument, 0, 'q'},
+			{"all", no_argument, 0, 'a'},
+			{"show", no_argument, 0, 'w'},
+			{NULL, 0, 0, 0}
+		};
+
+		while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
+		{
 #else
-		while((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1) {                
+		while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
+		{
 #endif
-			switch(arg) {
-      			case '?':
-      			case 'h':
-      				usage();
+			switch (arg)
+			{
+				case '?':
+				case 'h':
+					usage();
 					exit(RE_OK);
-        		case 'u':    	
-        			pgLO->user = strdup(optarg);
-        			break;	 
-        		case 't':    	
-        			pgLO->host = strdup(optarg);
-        			break;	 	
-        		case 'p':    	
-        			pwd = strdup(optarg);
-        			break;	          		
-        		case 'd':    	
-        			pgLO->db = strdup(optarg);
-        			break;
-        		case 's':    	
-        			pgLO->space = strdup(optarg);
-        			break;	
-        		case 'i':    	
-        			pgLO->action = ACTION_IMPORT;
-        			break;	
-        		case 'l':
-        			pgLO->action = ACTION_EXPORT_ATTR;
-        			pgLO->lolist_start = optind-1;
-        			parse_lolist (pgLO);
-        			break;
-        		case 'e':	
-        		case 'a':
+				case 'u':
+					pgLO->user = strdup(optarg);
+					break;
+				case 't':
+					pgLO->host = strdup(optarg);
+					break;
+				case 'p':
+					pwd = strdup(optarg);
+					break;
+				case 'd':
+					pgLO->db = strdup(optarg);
+					break;
+				case 's':
+					pgLO->space = strdup(optarg);
+					break;
+				case 'i':
+					pgLO->action = ACTION_IMPORT;
+					break;
+				case 'l':
+					pgLO->action = ACTION_EXPORT_ATTR;
+					pgLO->lolist_start = optind - 1;
+					parse_lolist(pgLO);
+					break;
+				case 'e':
+				case 'a':
 					pgLO->action = ACTION_EXPORT_ALL;
 					break;
 				case 'w':
 					pgLO->action = ACTION_SHOW;
-					break;	
-        		case 'r':
-        			pgLO->remove = TRUE;
-        			break;
-        		case 'q':
-        			pgLO->quiet = TRUE;	
-        			break;
-        		default:
-        			fprintf(stderr, "%s: bad arg -%c\n", progname, arg);
-        			usage();
-        			exit(RE_ERROR);
+					break;
+				case 'r':
+					pgLO->remove = TRUE;
+					break;
+				case 'q':
+					pgLO->quiet = TRUE;
+					break;
+				default:
+					fprintf(stderr, "%s: bad arg -%c\n", progname, arg);
+					usage();
+					exit(RE_ERROR);
 			}
-		}	
-	} else {
+		}
+	}
+	else
+	{
 		usage();
-        	exit(RE_ERROR);
-	}	
+		exit(RE_ERROR);
+	}
 
 	/* ----------
 	 * Check space
 	 * ----------
 	 */
-	if (! pgLO->space && ! pgLO->action == ACTION_SHOW) {
-		if (!(pgLO->space = getenv("PWD"))) {
+	if (!pgLO->space && !pgLO->action == ACTION_SHOW)
+	{
+		if (!(pgLO->space = getenv("PWD")))
+		{
 			fprintf(stderr, "%s: not set space for dump-tree (option '-s' or $PWD).\n", progname);
 			exit(RE_ERROR);
-		}	
+		}
 	}
-	
-	if (!pgLO->action) {
+
+	if (!pgLO->action)
+	{
 		fprintf(stderr, "%s: What do you want - export or import?\n", progname);
 		exit(RE_ERROR);
 	}
-	
+
 	/* ----------
 	 * Make connection
 	 * ----------
 	 */
-	pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db, 
-			pgLO->user, pwd);
-        
-	if (PQstatus(pgLO->conn) == CONNECTION_BAD) {
+	pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
+							  pgLO->user, pwd);
+
+	if (PQstatus(pgLO->conn) == CONNECTION_BAD)
+	{
 		fprintf(stderr, "%s (connection): %s\n", progname, PQerrorMessage(pgLO->conn));
 		exit(RE_ERROR);
-	}  
+	}
 	pgLO->host = PQhost(pgLO->conn) ? PQhost(pgLO->conn) : "localhost";
-	pgLO->db   = PQdb(pgLO->conn); 
-	pgLO->user = PQuser(pgLO->conn);	
-	
-	
+	pgLO->db = PQdb(pgLO->conn);
+	pgLO->user = PQuser(pgLO->conn);
+
+
 	/* ----------
 	 * Init index file
 	 * ----------
 	 */
-	if (pgLO->action != ACTION_SHOW) 
+	if (pgLO->action != ACTION_SHOW)
 		index_file(pgLO);
-	
+
 	PQexec(pgLO->conn, "BEGIN");
 
-	switch(pgLO->action) {
-	
+	switch (pgLO->action)
+	{
+
 		case ACTION_SHOW:
 		case ACTION_EXPORT_ALL:
 			load_lolist(pgLO);
 			/* FALL THROUGH */
-				
+
 		case ACTION_EXPORT_ATTR:
 			pglo_export(pgLO);
-			if (!pgLO->quiet) {
+			if (!pgLO->quiet)
+			{
 				if (pgLO->action == ACTION_SHOW)
 					printf("\nDatabase '%s' contains %d large objects.\n\n", pgLO->db, pgLO->counter);
-				else	
+				else
 					printf("\nExported %d large objects.\n\n", pgLO->counter);
 			}
 			break;
-		
+
 		case ACTION_IMPORT:
 			pglo_import(pgLO);
 			if (!pgLO->quiet)
 				printf("\nImported %d large objects.\n\n", pgLO->counter);
-			break;			
-	}	
+			break;
+	}
 
 	PQexec(pgLO->conn, "COMMIT");
-	PQfinish(pgLO->conn);	
-	
+	PQfinish(pgLO->conn);
+
 	if (pgLO->action != ACTION_SHOW)
 		fclose(pgLO->index);
-	
+
 	exit(RE_OK);
 }
 
 static void
-parse_lolist (LODumpMaster *pgLO)
+parse_lolist(LODumpMaster * pgLO)
 {
-	LOlist		*ll;
-	char		**d, 
-			*loc,
-			buff[MAX_TABLE_NAME + MAX_ATTR_NAME +1];
+	LOlist	   *ll;
+	char	  **d,
+			   *loc,
+				buff[MAX_TABLE_NAME + MAX_ATTR_NAME + 1];
 
 	pgLO->lolist = (LOlist *) malloc(pgLO->argc * sizeof(LOlist));
-	
-	if (! pgLO->lolist) {
+
+	if (!pgLO->lolist)
+	{
 		fprintf(stderr, "%s: can't allocate memory\n", progname);
 		exit(RE_ERROR);
 	}
-	
-	for(	d=pgLO->argv + pgLO->lolist_start, ll=pgLO->lolist; 
-		*d != NULL; 
-		d++, ll++) {
-		
+
+	for (d = pgLO->argv + pgLO->lolist_start, ll = pgLO->lolist;
+		 *d != NULL;
+		 d++, ll++)
+	{
+
 		strncpy(buff, *d, MAX_TABLE_NAME + MAX_ATTR_NAME);
-		
-		if ((loc = strchr(buff, '.')) == NULL) {
+
+		if ((loc = strchr(buff, '.')) == NULL)
+		{
 			fprintf(stderr, "%s: '%s' is bad 'table.attr'\n", progname, buff);
-			exit(RE_ERROR);	
+			exit(RE_ERROR);
 		}
 		*loc = '\0';
 		ll->lo_table = strdup(buff);
@@ -254,55 +270,55 @@ parse_lolist (LODumpMaster *pgLO)
 }
 
 
-static void 
+static void
 usage()
 {
 	printf("\npg_dumplo %s - PostgreSQL large objects dump\n", VERSION);
-        puts("pg_dumplo [option]\n\n"
+	puts("pg_dumplo [option]\n\n"
 
 #ifdef HAVE_GETOPT_LONG
-	
-	"-h --help                    this help\n"	
-	"-u --user=<username>         username for connection to server\n"
-	"-p --password=<password>     password for connection to server\n"	
-	"-d --db=<database>           database name\n"	
-	"-t --host=<hostname>         server hostname\n"		
-	"-s --space=<dir>             directory with dump tree (for export/import)\n"
-	"-i --import                  import large obj dump tree to DB\n"
-        "-e --export                  export (dump) large obj to dump tree\n"
-	"-l <table.attr ...>          dump attribute (columns) with LO to dump tree\n"
-	"-a --all                     dump all LO in DB (default)\n"
-	"-r --remove                  if is set '-i' try remove old LO\n"
-        "-q --quiet                   run quietly\n"
-	"-w --show                    not dump, but show all LO in DB\n" 
-	); /* puts() */ 
+
+		 "-h --help                    this help\n"
+	   "-u --user=<username>         username for connection to server\n"
+	   "-p --password=<password>     password for connection to server\n"
+		 "-d --db=<database>           database name\n"
+		 "-t --host=<hostname>         server hostname\n"
+		 "-s --space=<dir>             directory with dump tree (for export/import)\n"
+		 "-i --import                  import large obj dump tree to DB\n"
+	"-e --export                  export (dump) large obj to dump tree\n"
+		 "-l <table.attr ...>          dump attribute (columns) with LO to dump tree\n"
+		 "-a --all                     dump all LO in DB (default)\n"
+		 "-r --remove                  if is set '-i' try remove old LO\n"
+		 "-q --quiet                   run quietly\n"
+		 "-w --show                    not dump, but show all LO in DB\n"
+		);						/* puts() */
 
 #else
-	"-h                           this help\n"	
-	"-u <username>                username for connection to server\n"
-	"-p <password>                password for connection to server\n"	
-	"-d <database>                database name\n"	
-	"-t <hostname>                server hostname\n"		
-	"-s <dir>                     directory with dump tree (for export/import)\n"
-	"-i                           import large obj dump tree to DB\n"
-        "-e                           export (dump) large obj to dump tree\n"
-	"-l <table.attr ...>          dump attribute (columns) with LO to dump tree\n"
-	"-a                           dump all LO in DB (default)\n"
-	"-r                           if is set '-i' try remove old LO\n"
-	"-q                           run quietly\n" 
-        "-w                           not dump, but show all LO in DB\n"
-	); /* puts() */ 
+		 "-h                           this help\n"
+	   "-u <username>                username for connection to server\n"
+	   "-p <password>                password for connection to server\n"
+		 "-d <database>                database name\n"
+		 "-t <hostname>                server hostname\n"
+		 "-s <dir>                     directory with dump tree (for export/import)\n"
+		 "-i                           import large obj dump tree to DB\n"
+	"-e                           export (dump) large obj to dump tree\n"
+		 "-l <table.attr ...>          dump attribute (columns) with LO to dump tree\n"
+		 "-a                           dump all LO in DB (default)\n"
+		 "-r                           if is set '-i' try remove old LO\n"
+		 "-q                           run quietly\n"
+		 "-w                           not dump, but show all LO in DB\n"
+		);						/* puts() */
 
 #endif
 
 	puts(
-	"Example (dump):   pg_dumplo -d my_db -s /my_dump/dir -l t1.a t1.b t2.a\n"
-	"                  pg_dumplo -a -d my_db -s /my_dump/dir\n"
-	"Example (import): pg_dumplo -i -d my_db -s /my_dump/dir\n"	
-	"Example (show):   pg_dumplo -w -d my_db\n\n"	
-	"Note:  * option '-l' must be last option!\n"	
-	"       * option '-i' without option '-r' make new large obj in DB\n" 
-	"         not rewrite old, the '-i' UPDATE oid numbers in table.attr only!\n"
-	"       * if is not set option -s, the pg_dumplo use $PWD\n" 
-	); /* puts()*/	
+		 "Example (dump):   pg_dumplo -d my_db -s /my_dump/dir -l t1.a t1.b t2.a\n"
+		 "                  pg_dumplo -a -d my_db -s /my_dump/dir\n"
+		 "Example (import): pg_dumplo -i -d my_db -s /my_dump/dir\n"
+		 "Example (show):   pg_dumplo -w -d my_db\n\n"
+		 "Note:  * option '-l' must be last option!\n"
+	"       * option '-i' without option '-r' make new large obj in DB\n"
+		 "         not rewrite old, the '-i' UPDATE oid numbers in table.attr only!\n"
+		 "       * if is not set option -s, the pg_dumplo use $PWD\n"
+		);						/* puts() */
 }
diff --git a/contrib/pg_dumplo/pg_dumplo.h b/contrib/pg_dumplo/pg_dumplo.h
index 7513c71b9baf2382849d61b7dc3f2a20f4abd9eb..3ab25495cb1f2b69903b01e2f3b8d3e863b9bc40 100644
--- a/contrib/pg_dumplo/pg_dumplo.h
+++ b/contrib/pg_dumplo/pg_dumplo.h
@@ -1,7 +1,7 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.3 2001/01/24 19:42:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.4 2001/03/22 03:59:10 momjian Exp $
  *
  *					Karel Zak 1999-2000
  * -------------------------------------------------------------------------
@@ -17,12 +17,12 @@
 /* ----------
  * Define
  * ----------
- */        
+ */
 #define QUERY_BUFSIZ	(8*1024)
 #define DIR_UMASK	0755
 #define FILE_UMASK	0644
 
-#define	TRUE		1
+#define TRUE		1
 #define FALSE		0
 #define RE_OK		0
 #define RE_ERROR	1
@@ -36,44 +36,47 @@
  * LO struct
  * ----------
  */
-typedef struct { 
-	char	*lo_table,
-			*lo_attr;
-	Oid		lo_oid;
-} LOlist;
+typedef struct
+{
+	char	   *lo_table,
+			   *lo_attr;
+	Oid			lo_oid;
+}			LOlist;
 
-typedef struct {
-	int		action;
-	LOlist		*lolist;
-	char		**argv,
-			*user,
-			*db,
-			*host,
-			*space;
-	FILE		*index;
-	int		counter,
-			argc,
-			lolist_start,
-			remove,
-			quiet;
-	PGresult	*res;
-	PGconn		*conn;
-} LODumpMaster;
+typedef struct
+{
+	int			action;
+	LOlist	   *lolist;
+	char	  **argv,
+			   *user,
+			   *db,
+			   *host,
+			   *space;
+	FILE	   *index;
+	int			counter,
+				argc,
+				lolist_start,
+				remove,
+				quiet;
+	PGresult   *res;
+	PGconn	   *conn;
+}			LODumpMaster;
 
-typedef enum {	
+typedef enum
+{
 	ACTION_NONE,
 	ACTION_SHOW,
-	ACTION_EXPORT_ATTR,	
-	ACTION_EXPORT_ALL,	
+	ACTION_EXPORT_ATTR,
+	ACTION_EXPORT_ALL,
 	ACTION_IMPORT
-} PGLODUMP_ACTIONS;
+}			PGLODUMP_ACTIONS;
 
 extern char *progname;
 
-extern void	notice		(LODumpMaster *pgLO, int set);
-extern void	index_file	(LODumpMaster *pgLO);
-extern void	load_lolist	(LODumpMaster *pgLO);
-extern void	pglo_export	(LODumpMaster *pgLO);
-extern void	pglo_import	(LODumpMaster *pgLO);
+extern void notice(LODumpMaster * pgLO, int set);
+extern void index_file(LODumpMaster * pgLO);
+extern void load_lolist(LODumpMaster * pgLO);
+extern void pglo_export(LODumpMaster * pgLO);
+extern void pglo_import(LODumpMaster * pgLO);
 
-#endif /* PG_DUMPLO_H */
+#endif	 /* PG_DUMPLO_H */
diff --git a/contrib/pg_dumplo/utils.c b/contrib/pg_dumplo/utils.c
index dc3f5bbf9a117b7fd346ea2ef4f3dafb4a7825cd..d36ee4be083377dd51908c910130c66239ac1fe6 100644
--- a/contrib/pg_dumplo/utils.c
+++ b/contrib/pg_dumplo/utils.c
@@ -1,20 +1,20 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/utils.c,v 1.3 2001/01/24 19:42:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/utils.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
  *
  *					Karel Zak 1999-2000
  * -------------------------------------------------------------------------
  */
 
-#include <stdio.h>	
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <errno.h>                            
+#include <errno.h>
 #include <time.h>
 
 #include <libpq-fe.h>
@@ -22,65 +22,76 @@
 
 #include "pg_dumplo.h"
 
-extern int 	errno;        
+extern int	errno;
+
+static void Dummy_NoticeProcessor(void *arg, const char *message);
+static void Default_NoticeProcessor(void *arg, const char *message);
 
-static void Dummy_NoticeProcessor(void * arg, const char * message);
-static void Default_NoticeProcessor(void * arg, const char * message);
-    
 
 void
-index_file(LODumpMaster *pgLO)
+index_file(LODumpMaster * pgLO)
 {
-	char	path[BUFSIZ];
+	char		path[BUFSIZ];
 
 	if (pgLO->action == ACTION_SHOW)
 		return;
-	
-	sprintf(path, "%s/%s", pgLO->space, pgLO->db); 
-	
+
+	sprintf(path, "%s/%s", pgLO->space, pgLO->db);
+
 	if (pgLO->action == ACTION_EXPORT_ATTR ||
-	    pgLO->action == ACTION_EXPORT_ALL) {
-	    
-		if (mkdir(path, DIR_UMASK) == -1) {
-			if (errno != EEXIST) {
+		pgLO->action == ACTION_EXPORT_ALL)
+	{
+
+		if (mkdir(path, DIR_UMASK) == -1)
+		{
+			if (errno != EEXIST)
+			{
 				perror(path);
-				exit(RE_ERROR);	
-			}	
+				exit(RE_ERROR);
+			}
 		}
-		
-		sprintf(path, "%s/lo_dump.index", path);          
 
-		if ((pgLO->index = fopen(path, "w")) == NULL) {
+		sprintf(path, "%s/lo_dump.index", path);
+
+		if ((pgLO->index = fopen(path, "w")) == NULL)
+		{
 			perror(path);
 			exit(RE_ERROR);
 		}
-		
-	} else if (pgLO->action != ACTION_NONE ) {
-	
-		sprintf(path, "%s/lo_dump.index", path);          
 
-		if ((pgLO->index = fopen(path, "r")) == NULL) {
+	}
+	else if (pgLO->action != ACTION_NONE)
+	{
+
+		sprintf(path, "%s/lo_dump.index", path);
+
+		if ((pgLO->index = fopen(path, "r")) == NULL)
+		{
 			perror(path);
 			exit(RE_ERROR);
 		}
 	}
 }
 
-static 
-void Dummy_NoticeProcessor(void * arg, const char * message)
+static
+void
+Dummy_NoticeProcessor(void *arg, const char *message)
 {
-    ;
+	;
 }
 
-static 
-void Default_NoticeProcessor(void * arg, const char * message)
+static
+void
+Default_NoticeProcessor(void *arg, const char *message)
 {
-     fprintf(stderr, "%s", message);
+	fprintf(stderr, "%s", message);
 }
 
-void 
-notice(LODumpMaster *pgLO, int set)
-{         
-	if (set)PQsetNoticeProcessor(pgLO->conn, Default_NoticeProcessor, NULL);
-	else	PQsetNoticeProcessor(pgLO->conn, Dummy_NoticeProcessor, NULL);	
+void
+notice(LODumpMaster * pgLO, int set)
+{
+	if (set)
+		PQsetNoticeProcessor(pgLO->conn, Default_NoticeProcessor, NULL);
+	else
+		PQsetNoticeProcessor(pgLO->conn, Dummy_NoticeProcessor, NULL);
 }
diff --git a/contrib/pg_logger/pg_logger.c b/contrib/pg_logger/pg_logger.c
index af56a249c662a0687a9e3d2128c9b0d56a0c4632..cc2fdbed30d2ef544f056723089e3d2d5d3091b0 100644
--- a/contrib/pg_logger/pg_logger.c
+++ b/contrib/pg_logger/pg_logger.c
@@ -2,10 +2,10 @@
  *
  * Copyright 2001 by Nathan Myers <ncm@nospam.cantrip.org>
  * This software is distributed free of charge with no warranty of any kind.
- * You have permission to make copies for any purpose, provided that (1) 
- * this copyright notice is retained unchanged, and (2) you agree to 
- * absolve the author of all responsibility for all consequences arising 
- * from any use.  
+ * You have permission to make copies for any purpose, provided that (1)
+ * this copyright notice is retained unchanged, and (2) you agree to
+ * absolve the author of all responsibility for all consequences arising
+ * from any use.
  */
 
 #include <stdio.h>
@@ -13,73 +13,94 @@
 #include <syslog.h>
 #include <string.h>
 
-struct {
-    const char *tag;
-    int size;
-    int priority;
-} tags[] = {
-    { "",         0,                 LOG_NOTICE },
-    { "emerg:",   sizeof("emerg"),   LOG_EMERG },
-    { "alert:",   sizeof("alert"),   LOG_ALERT },
-    { "crit:",    sizeof("crit"),    LOG_CRIT },
-    { "err:",     sizeof("err"),     LOG_ERR },
-    { "error:",   sizeof("error"),   LOG_ERR },
-    { "warning:", sizeof("warning"), LOG_WARNING },
-    { "notice:",  sizeof("notice"),  LOG_NOTICE },
-    { "info:",    sizeof("info"),    LOG_INFO },
-    { "debug:",   sizeof("debug"),   LOG_DEBUG }
+struct
+{
+	const char *tag;
+	int			size;
+	int			priority;
+}			tags[] =
+
+{
+	{
+		"", 0, LOG_NOTICE
+	},
+	{
+		"emerg:", sizeof("emerg"), LOG_EMERG
+	},
+	{
+		"alert:", sizeof("alert"), LOG_ALERT
+	},
+	{
+		"crit:", sizeof("crit"), LOG_CRIT
+	},
+	{
+		"err:", sizeof("err"), LOG_ERR
+	},
+	{
+		"error:", sizeof("error"), LOG_ERR
+	},
+	{
+		"warning:", sizeof("warning"), LOG_WARNING
+	},
+	{
+		"notice:", sizeof("notice"), LOG_NOTICE
+	},
+	{
+		"info:", sizeof("info"), LOG_INFO
+	},
+	{
+		"debug:", sizeof("debug"), LOG_DEBUG
+	}
 };
 
-int main()
+int
+main()
 {
-    char buf[301];
-    int c;
-    char *pos = buf;
-    const char *colon = 0;
+	char		buf[301];
+	int			c;
+	char	   *pos = buf;
+	const char *colon = 0;
 
 #ifndef DEBUG
-    openlog("postgresql", LOG_CONS, LOG_LOCAL1);
+	openlog("postgresql", LOG_CONS, LOG_LOCAL1);
 #endif
-    while ( (c = getchar()) != EOF) {
-        if (c == '\r') {
-          continue;
-        }
-        if (c == '\n') {
-            int level = sizeof(tags)/sizeof(*tags);
-            char *bol;
+	while ((c = getchar()) != EOF)
+	{
+		if (c == '\r')
+			continue;
+		if (c == '\n')
+		{
+			int			level = sizeof(tags) / sizeof(*tags);
+			char	   *bol;
 
-            if (colon == 0 || (size_t)(colon - buf) > sizeof("warning")) {
-                level = 1;
-            }
-            *pos = 0;
-            while (--level) {
-                if (pos - buf >= tags[level].size
-                    && strncmp(buf, tags[level].tag, tags[level].size) == 0) {
-                    break; 
-                }
-            }
-            bol = buf + tags[level].size;
-            if (bol > buf && *bol == ' ') {
-                ++bol;
-            }
-            if (pos - bol > 0) {
+			if (colon == 0 || (size_t) (colon - buf) > sizeof("warning"))
+				level = 1;
+			*pos = 0;
+			while (--level)
+			{
+				if (pos - buf >= tags[level].size
+				 && strncmp(buf, tags[level].tag, tags[level].size) == 0)
+					break;
+			}
+			bol = buf + tags[level].size;
+			if (bol > buf && *bol == ' ')
+				++bol;
+			if (pos - bol > 0)
+			{
 #ifndef DEBUG
-                syslog(tags[level].priority, "%s", bol);
+				syslog(tags[level].priority, "%s", bol);
 #else
-                printf("%d/%s\n", tags[level].priority, bol);
+				printf("%d/%s\n", tags[level].priority, bol);
 #endif
-            }
-            pos = buf;
-            colon = (char const *)0;
-            continue;
-        }
-        if (c == ':' && !colon) {
-            colon = pos;
-        }
-        if ((size_t)(pos - buf) < sizeof(buf)-1) {
-            *pos++ = c;
-        }
-    }
-    return 0;
+			}
+			pos = buf;
+			colon = (char const *) 0;
+			continue;
+		}
+		if (c == ':' && !colon)
+			colon = pos;
+		if ((size_t) (pos - buf) < sizeof(buf) - 1)
+			*pos++ = c;
+	}
+	return 0;
 }
-
diff --git a/contrib/pg_resetxlog/pg_resetxlog.c b/contrib/pg_resetxlog/pg_resetxlog.c
index 5137cddd9137c85e32a399ddfb6d6ce4753a5b15..848bbb9267418d54ce66e61c008d5f75419dc904 100644
--- a/contrib/pg_resetxlog/pg_resetxlog.c
+++ b/contrib/pg_resetxlog/pg_resetxlog.c
@@ -5,15 +5,15 @@
  *	  Can also rebuild pg_control if needed.
  *
  * The theory of operation is fairly simple:
- *    1. Read the existing pg_control (which will include the last
+ *	  1. Read the existing pg_control (which will include the last
  *		 checkpoint record).  If it is an old format then update to
  *		 current format.
  *	  2. If pg_control is corrupt, attempt to intuit reasonable values,
  *		 by scanning the old xlog if necessary.
  *	  3. Modify pg_control to reflect a "shutdown" state with a checkpoint
- *	     record at the start of xlog.
+ *		 record at the start of xlog.
  *	  4. Flush the existing xlog files and write a new segment with
- *	     just a checkpoint record in it.  The new segment is positioned
+ *		 just a checkpoint record in it.  The new segment is positioned
  *		 just past the end of the old xlog, so that existing LSNs in
  *		 data pages will appear to be "in the past".
  * This is all pretty straightforward except for the intuition part of
@@ -23,7 +23,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.2 2001/03/16 05:08:39 tgl Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.3 2001/03/22 03:59:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,7 +63,7 @@
  * Compute ID and segment from an XLogRecPtr.
  *
  * For XLByteToSeg, do the computation at face value.  For XLByteToPrevSeg,
- * a boundary byte is taken to be in the previous segment.  This is suitable
+ * a boundary byte is taken to be in the previous segment.	This is suitable
  * for deciding which segment to write given a pointer to a record end,
  * for example.
  */
@@ -109,8 +109,9 @@ static char *DataDir;			/* locations of important stuff */
 static char XLogDir[MAXPGPATH];
 static char ControlFilePath[MAXPGPATH];
 
-static ControlFileData ControlFile;	/* pg_control values */
-static uint32 newXlogId, newXlogSeg; /* ID/Segment of new XLOG segment */
+static ControlFileData ControlFile;		/* pg_control values */
+static uint32 newXlogId,
+			newXlogSeg;			/* ID/Segment of new XLOG segment */
 static bool guessed = false;	/* T if we had to guess at any values */
 
 
@@ -139,17 +140,18 @@ XLogFileOpen(uint32 log, uint32 seg)
 static bool
 ReadControlFile(void)
 {
-	int		fd;
-	int		len;
-	char   *buffer;
-	crc64	crc;
+	int			fd;
+	int			len;
+	char	   *buffer;
+	crc64		crc;
 
 	if ((fd = open(ControlFilePath, O_RDONLY)) < 0)
 	{
+
 		/*
-		 * If pg_control is not there at all, or we can't read it,
-		 * the odds are we've been handed a bad DataDir path, so give up.
-		 * User can do "touch pg_control" to force us to proceed.
+		 * If pg_control is not there at all, or we can't read it, the
+		 * odds are we've been handed a bad DataDir path, so give up. User
+		 * can do "touch pg_control" to force us to proceed.
 		 */
 		perror("Failed to open $PGDATA/global/pg_control for reading");
 		if (errno == ENOENT)
@@ -175,7 +177,7 @@ ReadControlFile(void)
 	{
 		/* Seems to be current version --- check the CRC. */
 		INIT_CRC64(crc);
-		COMP_CRC64(crc, 
+		COMP_CRC64(crc,
 				   buffer + sizeof(crc64),
 				   sizeof(ControlFileData) - sizeof(crc64));
 		FIN_CRC64(crc);
@@ -193,6 +195,7 @@ ReadControlFile(void)
 		guessed = true;
 		return true;
 	}
+
 	/*
 	 * Maybe it's a 7.1beta pg_control.
 	 */
@@ -217,75 +220,75 @@ ReadControlFile(void)
 
 typedef struct crc64V0
 {
-	uint32			crc1;
-	uint32			crc2;
-} crc64V0;
+	uint32		crc1;
+	uint32		crc2;
+}			crc64V0;
 
 static uint32 crc_tableV0[] = {
-0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
-0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
-0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
-0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
-0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
-0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
-0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
-0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
-0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
-0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
-0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
-0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
-0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
-0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
-0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
-0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
-0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
-0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
-0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
-0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
-0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
-0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
-0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+	0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+	0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+	0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
+	0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+	0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+	0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+	0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+	0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+	0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+	0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+	0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+	0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+	0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+	0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+	0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+	0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+	0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+	0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
+	0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+	0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+	0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+	0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
+	0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+	0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+	0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+	0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
+	0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+	0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
+	0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+	0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+	0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
 };
 
 #define INIT_CRC64V0(crc)	((crc).crc1 = 0xffffffff, (crc).crc2 = 0xffffffff)
 #define FIN_CRC64V0(crc)	((crc).crc1 ^= 0xffffffff, (crc).crc2 ^= 0xffffffff)
 #define COMP_CRC64V0(crc, data, len)	\
 {\
-        uint32       __c1 = (crc).crc1;\
-        uint32       __c2 = (crc).crc2;\
-        char        *__data = (char *) (data);\
-        uint32       __len = (len);\
+		uint32		 __c1 = (crc).crc1;\
+		uint32		 __c2 = (crc).crc2;\
+		char		*__data = (char *) (data);\
+		uint32		 __len = (len);\
 \
-        while (__len >= 2)\
-        {\
-                __c1 = crc_tableV0[(__c1 ^ *__data++) & 0xff] ^ (__c1 >> 8);\
-                __c2 = crc_tableV0[(__c2 ^ *__data++) & 0xff] ^ (__c2 >> 8);\
-                __len -= 2;\
-        }\
-        if (__len > 0)\
-                __c1 = crc_tableV0[(__c1 ^ *__data++) & 0xff] ^ (__c1 >> 8);\
-        (crc).crc1 = __c1;\
-        (crc).crc2 = __c2;\
+		while (__len >= 2)\
+		{\
+				__c1 = crc_tableV0[(__c1 ^ *__data++) & 0xff] ^ (__c1 >> 8);\
+				__c2 = crc_tableV0[(__c2 ^ *__data++) & 0xff] ^ (__c2 >> 8);\
+				__len -= 2;\
+		}\
+		if (__len > 0)\
+				__c1 = crc_tableV0[(__c1 ^ *__data++) & 0xff] ^ (__c1 >> 8);\
+		(crc).crc1 = __c1;\
+		(crc).crc2 = __c2;\
 }
 
 #define EQ_CRC64V0(c1,c2)  ((c1).crc1 == (c2).crc1 && (c1).crc2 == (c2).crc2)
@@ -295,51 +298,51 @@ static uint32 crc_tableV0[] = {
 
 typedef struct ControlFileDataV0
 {
-	crc64V0			crc;
-	uint32			logId;		/* current log file id */
-	uint32			logSeg;		/* current log file segment (1-based) */
-	XLogRecPtr		checkPoint;	/* last check point record ptr */
-	time_t			time;		/* time stamp of last modification */
-	DBState			state;		/* see enum above */
-	uint32			blcksz;		/* block size for this DB */
-	uint32			relseg_size; /* blocks per segment of large relation */
-	uint32			catalog_version_no;	/* internal version number */
-	char			lc_collate[LOCALE_NAME_BUFLEN_V0];
-	char			lc_ctype[LOCALE_NAME_BUFLEN_V0];
-	char			archdir[MAXPGPATH];	/* where to move offline log files */
-} ControlFileDataV0;
+	crc64V0		crc;
+	uint32		logId;			/* current log file id */
+	uint32		logSeg;			/* current log file segment (1-based) */
+	XLogRecPtr	checkPoint;		/* last check point record ptr */
+	time_t		time;			/* time stamp of last modification */
+	DBState		state;			/* see enum above */
+	uint32		blcksz;			/* block size for this DB */
+	uint32		relseg_size;	/* blocks per segment of large relation */
+	uint32		catalog_version_no;		/* internal version number */
+	char		lc_collate[LOCALE_NAME_BUFLEN_V0];
+	char		lc_ctype[LOCALE_NAME_BUFLEN_V0];
+	char		archdir[MAXPGPATH];		/* where to move offline log files */
+}			ControlFileDataV0;
 
 typedef struct CheckPointV0
 {
-	XLogRecPtr		redo;		/* next RecPtr available when we */
-								/* began to create CheckPoint */
-								/* (i.e. REDO start point) */
-	XLogRecPtr		undo;		/* first record of oldest in-progress */
-								/* transaction when we started */
-								/* (i.e. UNDO end point) */
-	StartUpID		ThisStartUpID;
-	TransactionId	nextXid;
-	Oid				nextOid;
-	bool			Shutdown;
-} CheckPointV0;
+	XLogRecPtr	redo;			/* next RecPtr available when we */
+	/* began to create CheckPoint */
+	/* (i.e. REDO start point) */
+	XLogRecPtr	undo;			/* first record of oldest in-progress */
+	/* transaction when we started */
+	/* (i.e. UNDO end point) */
+	StartUpID	ThisStartUpID;
+	TransactionId nextXid;
+	Oid			nextOid;
+	bool		Shutdown;
+}			CheckPointV0;
 
 typedef struct XLogRecordV0
 {
-	crc64V0			xl_crc;
-	XLogRecPtr		xl_prev;	/* ptr to previous record in log */
-	XLogRecPtr		xl_xact_prev; /* ptr to previous record of this xact */
-	TransactionId	xl_xid;		/* xact id */
-	uint16			xl_len;		/* total len of record *data* */
-	uint8			xl_info;
-	RmgrId			xl_rmid;	/* resource manager inserted this record */
-} XLogRecordV0;
+	crc64V0		xl_crc;
+	XLogRecPtr	xl_prev;		/* ptr to previous record in log */
+	XLogRecPtr	xl_xact_prev;	/* ptr to previous record of this xact */
+	TransactionId xl_xid;		/* xact id */
+	uint16		xl_len;			/* total len of record *data* */
+	uint8		xl_info;
+	RmgrId		xl_rmid;		/* resource manager inserted this record */
+}			XLogRecordV0;
 
 #define SizeOfXLogRecordV0	DOUBLEALIGN(sizeof(XLogRecordV0))
 
 typedef struct XLogContRecordV0
 {
-	uint16			xl_len;		/* len of data left */
-} XLogContRecordV0;
+	uint16		xl_len;			/* len of data left */
+}			XLogContRecordV0;
 
 #define SizeOfXLogContRecordV0	DOUBLEALIGN(sizeof(XLogContRecordV0))
 
@@ -347,16 +350,16 @@ typedef struct XLogContRecordV0
 
 typedef struct XLogPageHeaderDataV0
 {
-	uint32                xlp_magic;
-	uint16                xlp_info;
-} XLogPageHeaderDataV0;
+	uint32		xlp_magic;
+	uint16		xlp_info;
+}			XLogPageHeaderDataV0;
 
 #define SizeOfXLogPHDV0   DOUBLEALIGN(sizeof(XLogPageHeaderDataV0))
 
 typedef XLogPageHeaderDataV0 *XLogPageHeaderV0;
 
 
-static bool RecordIsValidV0(XLogRecordV0 *record);
+static bool RecordIsValidV0(XLogRecordV0 * record);
 static XLogRecordV0 *ReadRecordV0(XLogRecPtr *RecPtr, char *buffer);
 static bool ValidXLOGHeaderV0(XLogPageHeaderV0 hdr);
 
@@ -376,7 +379,7 @@ CheckControlVersion0(char *buffer, int len)
 		return false;
 	/* Check CRC the version-0 way. */
 	INIT_CRC64V0(crc);
-	COMP_CRC64V0(crc, 
+	COMP_CRC64V0(crc,
 				 buffer + sizeof(crc64V0),
 				 sizeof(ControlFileDataV0) - sizeof(crc64V0));
 	FIN_CRC64V0(crc);
@@ -409,12 +412,13 @@ CheckControlVersion0(char *buffer, int len)
 						  (char *) malloc(_INTL_MAXLOGRECSZ));
 	if (record == NULL)
 	{
+
 		/*
 		 * We have to guess at the checkpoint contents.
 		 */
 		guessed = true;
 		ControlFile.checkPointCopy.ThisStartUpID = 0;
-		ControlFile.checkPointCopy.nextXid = (TransactionId) 514; /* XXX */
+		ControlFile.checkPointCopy.nextXid = (TransactionId) 514;		/* XXX */
 		ControlFile.checkPointCopy.nextOid = BootstrapObjectIdData;
 		return true;
 	}
@@ -435,26 +439,26 @@ CheckControlVersion0(char *buffer, int len)
  * We assume all of the record has been read into memory at *record.
  */
 static bool
-RecordIsValidV0(XLogRecordV0 *record)
+RecordIsValidV0(XLogRecordV0 * record)
 {
 	crc64V0		crc;
 	uint32		len = record->xl_len;
 
 	/*
 	 * NB: this code is not right for V0 records containing backup blocks,
-	 * but for now it's only going to be applied to checkpoint records,
-	 * so I'm not going to worry about it...
+	 * but for now it's only going to be applied to checkpoint records, so
+	 * I'm not going to worry about it...
 	 */
 	INIT_CRC64V0(crc);
 	COMP_CRC64V0(crc, XLogRecGetData(record), len);
-	COMP_CRC64V0(crc, (char*) record + sizeof(crc64V0),
+	COMP_CRC64V0(crc, (char *) record + sizeof(crc64V0),
 				 SizeOfXLogRecordV0 - sizeof(crc64V0));
 	FIN_CRC64V0(crc);
 
 	if (!EQ_CRC64V0(record->xl_crc, crc))
 		return false;
 
-	return(true);
+	return (true);
 }
 
 /*
@@ -489,7 +493,7 @@ ReadRecordV0(XLogRecPtr *RecPtr, char *buffer)
 		readFile = XLogFileOpen(readId, readSeg);
 		if (readFile < 0)
 			goto next_record_is_invalid;
-		readOff = (uint32) (-1); /* force read to occur below */
+		readOff = (uint32) (-1);/* force read to occur below */
 	}
 
 	targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / BLCKSZ) * BLCKSZ;
@@ -510,10 +514,13 @@ ReadRecordV0(XLogRecPtr *RecPtr, char *buffer)
 
 	if (record->xl_len == 0)
 		goto next_record_is_invalid;
+
 	/*
-	 * Compute total length of record including any appended backup blocks.
+	 * Compute total length of record including any appended backup
+	 * blocks.
 	 */
 	total_len = SizeOfXLogRecordV0 + record->xl_len;
+
 	/*
 	 * Make sure it will fit in buffer (currently, it is mechanically
 	 * impossible for this test to fail, but it seems like a good idea
@@ -526,7 +533,7 @@ ReadRecordV0(XLogRecPtr *RecPtr, char *buffer)
 	{
 		/* Need to reassemble record */
 		XLogContRecordV0 *contrecord;
-		uint32			gotlen = len;
+		uint32		gotlen = len;
 
 		memcpy(buffer, record, len);
 		record = (XLogRecordV0 *) buffer;
@@ -551,13 +558,13 @@ ReadRecordV0(XLogRecPtr *RecPtr, char *buffer)
 			if (!(((XLogPageHeaderV0) readBuf)->xlp_info & XLP_FIRST_IS_CONTRECORD))
 				goto next_record_is_invalid;
 			contrecord = (XLogContRecordV0 *) ((char *) readBuf + SizeOfXLogPHDV0);
-			if (contrecord->xl_len == 0 || 
+			if (contrecord->xl_len == 0 ||
 				total_len != (contrecord->xl_len + gotlen))
 				goto next_record_is_invalid;
 			len = BLCKSZ - SizeOfXLogPHDV0 - SizeOfXLogContRecordV0;
 			if (contrecord->xl_len > len)
 			{
-				memcpy(buffer, (char *)contrecord + SizeOfXLogContRecordV0, len);
+				memcpy(buffer, (char *) contrecord + SizeOfXLogContRecordV0, len);
 				gotlen += len;
 				buffer += len;
 				continue;
@@ -587,7 +594,7 @@ next_record_is_invalid:;
  * Check whether the xlog header of a page just read in looks valid.
  *
  * This is just a convenience subroutine to avoid duplicated code in
- * ReadRecord.  It's not intended for use from anywhere else.
+ * ReadRecord.	It's not intended for use from anywhere else.
  */
 static bool
 ValidXLOGHeaderV0(XLogPageHeaderV0 hdr)
@@ -610,6 +617,7 @@ GuessControlValues(void)
 {
 #ifdef USE_LOCALE
 	char	   *localeptr;
+
 #endif
 
 	/*
@@ -625,7 +633,7 @@ GuessControlValues(void)
 	ControlFile.checkPointCopy.redo.xrecoff = SizeOfXLogPHD;
 	ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
 	ControlFile.checkPointCopy.ThisStartUpID = 0;
-	ControlFile.checkPointCopy.nextXid = (TransactionId) 514; /* XXX */
+	ControlFile.checkPointCopy.nextXid = (TransactionId) 514;	/* XXX */
 	ControlFile.checkPointCopy.nextOid = BootstrapObjectIdData;
 	ControlFile.checkPointCopy.time = time(NULL);
 
@@ -677,7 +685,7 @@ PrintControlValues(void)
 		   "pg_control version number:            %u\n"
 		   "Catalog version number:               %u\n"
 		   "Current log file id:                  %u\n"
-	       "Next log file segment:                %u\n"
+		   "Next log file segment:                %u\n"
 		   "Latest checkpoint's StartUpID:        %u\n"
 		   "Latest checkpoint's NextXID:          %u\n"
 		   "Latest checkpoint's NextOID:          %u\n"
@@ -707,11 +715,11 @@ static void
 RewriteControlFile(void)
 {
 	int			fd;
-	char		buffer[BLCKSZ];	/* need not be aligned */
+	char		buffer[BLCKSZ]; /* need not be aligned */
 
 	/*
-	 * Adjust fields as needed to force an empty XLOG starting at the
-	 * next available segment.
+	 * Adjust fields as needed to force an empty XLOG starting at the next
+	 * available segment.
 	 */
 	newXlogId = ControlFile.logId;
 	newXlogSeg = ControlFile.logSeg;
@@ -734,17 +742,17 @@ RewriteControlFile(void)
 
 	/* Contents are protected with a CRC */
 	INIT_CRC64(ControlFile.crc);
-	COMP_CRC64(ControlFile.crc, 
-			   (char*) &ControlFile + sizeof(crc64),
+	COMP_CRC64(ControlFile.crc,
+			   (char *) &ControlFile + sizeof(crc64),
 			   sizeof(ControlFileData) - sizeof(crc64));
 	FIN_CRC64(ControlFile.crc);
 
 	/*
-	 * We write out BLCKSZ bytes into pg_control, zero-padding the
-	 * excess over sizeof(ControlFileData).  This reduces the odds
-	 * of premature-EOF errors when reading pg_control.  We'll still
-	 * fail when we check the contents of the file, but hopefully with
-	 * a more specific error than "couldn't read pg_control".
+	 * We write out BLCKSZ bytes into pg_control, zero-padding the excess
+	 * over sizeof(ControlFileData).  This reduces the odds of
+	 * premature-EOF errors when reading pg_control.  We'll still fail
+	 * when we check the contents of the file, but hopefully with a more
+	 * specific error than "couldn't read pg_control".
 	 */
 	if (sizeof(ControlFileData) > BLCKSZ)
 	{
@@ -786,9 +794,9 @@ RewriteControlFile(void)
 static void
 KillExistingXLOG(void)
 {
-	DIR			   *xldir;
-	struct dirent  *xlde;
-	char			path[MAXPGPATH];
+	DIR		   *xldir;
+	struct dirent *xlde;
+	char		path[MAXPGPATH];
 
 	xldir = opendir(XLogDir);
 	if (xldir == NULL)
@@ -803,7 +811,7 @@ KillExistingXLOG(void)
 		if (strlen(xlde->d_name) == 16 &&
 			strspn(xlde->d_name, "0123456789ABCDEF") == 16)
 		{
-			sprintf(path, "%s%c%s",	XLogDir, SEP_CHAR, xlde->d_name);
+			sprintf(path, "%s%c%s", XLogDir, SEP_CHAR, xlde->d_name);
 			if (unlink(path) < 0)
 			{
 				perror(path);
@@ -858,7 +866,7 @@ WriteEmptyXLOG(void)
 
 	INIT_CRC64(crc);
 	COMP_CRC64(crc, &ControlFile.checkPointCopy, sizeof(CheckPoint));
-	COMP_CRC64(crc, (char*) record + sizeof(crc64),
+	COMP_CRC64(crc, (char *) record + sizeof(crc64),
 			   SizeOfXLogRecord - sizeof(crc64));
 	FIN_CRC64(crc);
 	record->xl_crc = crc;
@@ -914,13 +922,13 @@ usage(void)
 
 
 int
-main(int argc, char ** argv)
+main(int argc, char **argv)
 {
-	int		argn;
-	bool	force = false;
-	bool	noupdate = false;
-	int		fd;
-	char	path[MAXPGPATH];
+	int			argn;
+	bool		force = false;
+	bool		noupdate = false;
+	int			fd;
+	char		path[MAXPGPATH];
 
 	for (argn = 1; argn < argc; argn++)
 	{
@@ -934,7 +942,7 @@ main(int argc, char ** argv)
 			usage();
 	}
 
-	if (argn != argc-1)			/* one required non-switch argument */
+	if (argn != argc - 1)		/* one required non-switch argument */
 		usage();
 
 	DataDir = argv[argn++];
@@ -946,7 +954,8 @@ main(int argc, char ** argv)
 
 	/*
 	 * Check for a postmaster lock file --- if there is one, refuse to
-	 * proceed, on grounds we might be interfering with a live installation.
+	 * proceed, on grounds we might be interfering with a live
+	 * installation.
 	 */
 	snprintf(path, MAXPGPATH, "%s%cpostmaster.pid", DataDir, SEP_CHAR);
 
@@ -973,8 +982,8 @@ main(int argc, char ** argv)
 		GuessControlValues();
 
 	/*
-	 * If we had to guess anything, and -f was not given, just print
-	 * the guessed values and exit.  Also print if -n is given.
+	 * If we had to guess anything, and -f was not given, just print the
+	 * guessed values and exit.  Also print if -n is given.
 	 */
 	if ((guessed && !force) || noupdate)
 	{
diff --git a/contrib/pgcrypto/encode.c b/contrib/pgcrypto/encode.c
index 0ad0a8f56ce60ad34b8f8bd64d87c756ecea0fc0..b6db217c836ed3a794de0adb864431ac2533b30c 100644
--- a/contrib/pgcrypto/encode.c
+++ b/contrib/pgcrypto/encode.c
@@ -1,7 +1,7 @@
 /*
  * encode.c
  *		Various data encoding/decoding things.
- * 
+ *
  * Copyright (c) 2001 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: encode.c,v 1.3 2001/02/10 02:31:25 tgl Exp $
+ * $Id: encode.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -43,9 +43,9 @@
 #endif
 
 static pg_coding *
-find_coding(pg_coding *hbuf, text *name, int silent);
+			find_coding(pg_coding * hbuf, text *name, int silent);
 static pg_coding *
-pg_find_coding(pg_coding *res, char *name);
+			pg_find_coding(pg_coding * res, char *name);
 
 
 /* SQL function: encode(bytea, text) returns text */
@@ -54,34 +54,37 @@ PG_FUNCTION_INFO_V1(encode);
 Datum
 encode(PG_FUNCTION_ARGS)
 {
-	text *arg;
-	text *name;
-	uint len, rlen, rlen0;
-	pg_coding *c, cbuf;
-	text *res;
-	
+	text	   *arg;
+	text	   *name;
+	uint		len,
+				rlen,
+				rlen0;
+	pg_coding  *c,
+				cbuf;
+	text	   *res;
+
 	if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
 		PG_RETURN_NULL();
-	
-	name = PG_GETARG_TEXT_P(1);	
-	c = find_coding(&cbuf, name, 0); /* will give error if fails */
+
+	name = PG_GETARG_TEXT_P(1);
+	c = find_coding(&cbuf, name, 0);	/* will give error if fails */
 
 	arg = PG_GETARG_TEXT_P(0);
 	len = VARSIZE(arg) - VARHDRSZ;
-	
+
 	rlen0 = c->encode_len(len);
-	
-	res = (text *)palloc(rlen0 + VARHDRSZ);
-	
+
+	res = (text *) palloc(rlen0 + VARHDRSZ);
+
 	rlen = c->encode(VARDATA(arg), len, VARDATA(res));
 	VARATT_SIZEP(res) = rlen + VARHDRSZ;
 
 	if (rlen > rlen0)
 		elog(FATAL, "pg_encode: overflow, encode estimate too small");
-	
+
 	PG_FREE_IF_COPY(arg, 0);
 	PG_FREE_IF_COPY(name, 1);
-	
+
 	PG_RETURN_TEXT_P(res);
 }
 
@@ -91,54 +94,58 @@ PG_FUNCTION_INFO_V1(decode);
 Datum
 decode(PG_FUNCTION_ARGS)
 {
-	text *arg;
-	text *name;
-	uint len, rlen, rlen0;
-	pg_coding *c, cbuf;
-	text *res;
-	
+	text	   *arg;
+	text	   *name;
+	uint		len,
+				rlen,
+				rlen0;
+	pg_coding  *c,
+				cbuf;
+	text	   *res;
+
 	if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
 		PG_RETURN_NULL();
-	
-	name = PG_GETARG_TEXT_P(1);	
-	c = find_coding(&cbuf, name, 0); /* will give error if fails */
+
+	name = PG_GETARG_TEXT_P(1);
+	c = find_coding(&cbuf, name, 0);	/* will give error if fails */
 
 	arg = PG_GETARG_TEXT_P(0);
 	len = VARSIZE(arg) - VARHDRSZ;
-	
+
 	rlen0 = c->decode_len(len);
-	
-	res = (text *)palloc(rlen0 + VARHDRSZ);
-	
+
+	res = (text *) palloc(rlen0 + VARHDRSZ);
+
 	rlen = c->decode(VARDATA(arg), len, VARDATA(res));
 	VARATT_SIZEP(res) = rlen + VARHDRSZ;
 
 	if (rlen > rlen0)
 		elog(FATAL, "pg_decode: overflow, decode estimate too small");
-	
+
 	PG_FREE_IF_COPY(arg, 0);
 	PG_FREE_IF_COPY(name, 1);
-	
+
 	PG_RETURN_TEXT_P(res);
 }
 
 static pg_coding *
-find_coding(pg_coding *dst, text *name, int silent)
+find_coding(pg_coding * dst, text *name, int silent)
 {
-	pg_coding *p;
-	char buf[NAMEDATALEN];
-	uint len;
-	
+	pg_coding  *p;
+	char		buf[NAMEDATALEN];
+	uint		len;
+
 	len = VARSIZE(name) - VARHDRSZ;
-	if (len >= NAMEDATALEN) {
+	if (len >= NAMEDATALEN)
+	{
 		if (silent)
 			return NULL;
 		elog(ERROR, "Encoding type does not exist (name too long)");
 	}
-		
+
 	memcpy(buf, VARDATA(name), len);
 	buf[len] = 0;
-	
+
 	p = pg_find_coding(dst, buf);
 
 	if (p == NULL && !silent)
@@ -151,21 +158,23 @@ static char *hextbl = "0123456789abcdef";
 uint
 hex_encode(uint8 *src, uint len, uint8 *dst)
 {
-	uint8 *end = src + len;
-	while (src < end) {
+	uint8	   *end = src + len;
+
+	while (src < end)
+	{
 		*dst++ = hextbl[(*src >> 4) & 0xF];
 		*dst++ = hextbl[*src & 0xF];
 		src++;
 	}
-	return len*2;
+	return len * 2;
 }
 
 /* probably should use lookup table */
 static uint8
 get_hex(char c)
 {
-	uint8 res = 0;
-	
+	uint8		res = 0;
+
 	if (c >= '0' && c <= '9')
 		res = c - '0';
 	else if (c >= 'a' && c <= 'f')
@@ -174,19 +183,26 @@ get_hex(char c)
 		res = c - 'A' + 10;
 	else
 		elog(ERROR, "Bad hex code: '%c'", c);
-	
+
 	return res;
 }
 
 uint
 hex_decode(uint8 *src, uint len, uint8 *dst)
 {
-	uint8 *s, *srcend, v1, v2, *p = dst;
-	
+	uint8	   *s,
+			   *srcend,
+				v1,
+				v2,
+			   *p = dst;
+
 	srcend = src + len;
-	s = src; p = dst;
-	while (s < srcend) {
-		if (*s == ' ' || *s == '\n' || *s == '\t' || *s == '\r') {
+	s = src;
+	p = dst;
+	while (s < srcend)
+	{
+		if (*s == ' ' || *s == '\n' || *s == '\t' || *s == '\r')
+		{
 			s++;
 			continue;
 		}
@@ -196,30 +212,36 @@ hex_decode(uint8 *src, uint len, uint8 *dst)
 		v2 = get_hex(*s++);
 		*p++ = v1 | v2;
 	}
-	
+
 	return p - dst;
 }
 
 
 static unsigned char _base64[] =
-	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 uint
 b64_encode(uint8 *src, uint len, uint8 *dst)
 {
-	uint8 *s, *p, *end = src + len, *lend = dst + 76;
-	int pos = 2;
+	uint8	   *s,
+			   *p,
+			   *end = src + len,
+			   *lend = dst + 76;
+	int			pos = 2;
 	unsigned long buf = 0;
 
-	s = src; p = dst;
-	
-	while (s < end) {
+	s = src;
+	p = dst;
+
+	while (s < end)
+	{
 		buf |= *s << (pos << 3);
 		pos--;
 		s++;
-		
+
 		/* write it out */
-		if (pos < 0) {
+		if (pos < 0)
+		{
 			*p++ = _base64[(buf >> 18) & 0x3f];
 			*p++ = _base64[(buf >> 12) & 0x3f];
 			*p++ = _base64[(buf >> 6) & 0x3f];
@@ -228,12 +250,14 @@ b64_encode(uint8 *src, uint len, uint8 *dst)
 			pos = 2;
 			buf = 0;
 		}
-		if (p >= lend) {
+		if (p >= lend)
+		{
 			*p++ = '\n';
 			lend = p + 76;
 		}
 	}
-	if (pos != 2) {
+	if (pos != 2)
+	{
 		*p++ = _base64[(buf >> 18) & 0x3f];
 		*p++ = _base64[(buf >> 12) & 0x3f];
 		*p++ = (pos == 0) ? _base64[(buf >> 6) & 0x3f] : '=';
@@ -247,14 +271,17 @@ b64_encode(uint8 *src, uint len, uint8 *dst)
 uint
 b64_decode(uint8 *src, uint len, uint8 *dst)
 {
-	char *srcend = src + len, *s = src;
-	uint8 *p = dst;
-	char c;
-	uint b = 0;
+	char	   *srcend = src + len,
+			   *s = src;
+	uint8	   *p = dst;
+	char		c;
+	uint		b = 0;
 	unsigned long buf = 0;
-	int pos = 0, end = 0;
-	
-	while (s < srcend) {
+	int			pos = 0,
+				end = 0;
+
+	while (s < srcend)
+	{
 		c = *s++;
 		if (c >= 'A' && c <= 'Z')
 			b = c - 'A';
@@ -266,16 +293,21 @@ b64_decode(uint8 *src, uint len, uint8 *dst)
 			b = 62;
 		else if (c == '/')
 			b = 63;
-		else if (c == '=') {
+		else if (c == '=')
+		{
 			/* end sequence */
-			if (!end) {
-				if (pos == 2) end = 1;
-				else if (pos == 3) end = 2;
+			if (!end)
+			{
+				if (pos == 2)
+					end = 1;
+				else if (pos == 3)
+					end = 2;
 				else
 					elog(ERROR, "base64: unexpected '='");
 			}
 			b = 0;
-		} else if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
+		}
+		else if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
 			continue;
 		else
 			elog(ERROR, "base64: Invalid symbol");
@@ -283,7 +315,8 @@ b64_decode(uint8 *src, uint len, uint8 *dst)
 		/* add it to buffer */
 		buf = (buf << 6) + b;
 		pos++;
-		if (pos == 4) {
+		if (pos == 4)
+		{
 			*p++ = (buf >> 16) & 255;
 			if (end == 0 || end > 1)
 				*p++ = (buf >> 8) & 255;
@@ -326,21 +359,22 @@ b64_dec_len(uint srclen)
 }
 
 static pg_coding
-encoding_list [] = {
-	{ "hex", hex_enc_len, hex_dec_len, hex_encode, hex_decode},
-	{ "base64", b64_enc_len, b64_dec_len, b64_encode, b64_decode},
-	{ NULL, NULL, NULL, NULL, NULL}
+			encoding_list[] = {
+	{"hex", hex_enc_len, hex_dec_len, hex_encode, hex_decode},
+	{"base64", b64_enc_len, b64_dec_len, b64_encode, b64_decode},
+	{NULL, NULL, NULL, NULL, NULL}
 };
 
 
 static pg_coding *
-pg_find_coding(pg_coding *res, char *name)
+pg_find_coding(pg_coding * res, char *name)
 {
-	pg_coding *p;
-	for (p = encoding_list; p->name; p++) {
+	pg_coding  *p;
+
+	for (p = encoding_list; p->name; p++)
+	{
 		if (!strcasecmp(p->name, name))
 			return p;
 	}
 	return NULL;
 }
-
diff --git a/contrib/pgcrypto/encode.h b/contrib/pgcrypto/encode.h
index 33e6508cb1e6d5a725108c2c975410ccfaeb3e75..451e06d75b0afef6a6a732609dba635624904df5 100644
--- a/contrib/pgcrypto/encode.h
+++ b/contrib/pgcrypto/encode.h
@@ -1,7 +1,7 @@
 /*
  * pg_encode.h
  *		encode.c
- * 
+ *
  * Copyright (c) 2001 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,35 +26,35 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: encode.h,v 1.1 2001/01/24 03:46:16 momjian Exp $
+ * $Id: encode.h,v 1.2 2001/03/22 03:59:10 momjian Exp $
  */
 
 #ifndef __PG_ENCODE_H
 #define __PG_ENCODE_H
 
 /* exported functions */
-Datum encode(PG_FUNCTION_ARGS);
-Datum decode(PG_FUNCTION_ARGS);
+Datum		encode(PG_FUNCTION_ARGS);
+Datum		decode(PG_FUNCTION_ARGS);
 
 typedef struct _pg_coding pg_coding;
-struct _pg_coding {
-	char *name;
-	uint (*encode_len)(uint dlen);
-	uint (*decode_len)(uint dlen);
-	uint (*encode)(uint8 *data, uint dlen, uint8 *res);
-	uint (*decode)(uint8 *data, uint dlen, uint8 *res);
+struct _pg_coding
+{
+	char	   *name;
+	uint		(*encode_len) (uint dlen);
+	uint		(*decode_len) (uint dlen);
+	uint		(*encode) (uint8 *data, uint dlen, uint8 *res);
+	uint		(*decode) (uint8 *data, uint dlen, uint8 *res);
 };
 
 /* They are for outside usage in C code, if needed */
-uint hex_encode(uint8 *src, uint len, uint8 *dst);
-uint hex_decode(uint8 *src, uint len, uint8 *dst);
-uint b64_encode(uint8 *src, uint len, uint8 *dst);
-uint b64_decode(uint8 *src, uint len, uint8 *dst);
-
-uint hex_enc_len(uint srclen);
-uint hex_dec_len(uint srclen);
-uint b64_enc_len(uint srclen);
-uint b64_dec_len(uint srclen);
+uint		hex_encode(uint8 *src, uint len, uint8 *dst);
+uint		hex_decode(uint8 *src, uint len, uint8 *dst);
+uint		b64_encode(uint8 *src, uint len, uint8 *dst);
+uint		b64_decode(uint8 *src, uint len, uint8 *dst);
 
-#endif /* __PG_ENCODE_H */
+uint		hex_enc_len(uint srclen);
+uint		hex_dec_len(uint srclen);
+uint		b64_enc_len(uint srclen);
+uint		b64_dec_len(uint srclen);
 
+#endif	 /* __PG_ENCODE_H */
diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c
index 3c6e6fc80b7bb12ed191524444f41673eebe292a..2d4a52717e0228237d20654191cc8adc8efee603 100644
--- a/contrib/pgcrypto/internal.c
+++ b/contrib/pgcrypto/internal.c
@@ -1,7 +1,7 @@
 /*
  * internal.c
  *		Wrapper for builtin functions
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: internal.c,v 1.2 2001/02/10 02:31:25 tgl Exp $
+ * $Id: internal.c,v 1.3 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -49,31 +49,32 @@
 #endif
 
 static uint
-pg_md5_len(pg_digest *h);
+			pg_md5_len(pg_digest * h);
 static uint8 *
-pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf);
+			pg_md5_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf);
 
 static uint
-pg_sha1_len(pg_digest *h);
+			pg_sha1_len(pg_digest * h);
 static uint8 *
-pg_sha1_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf);
+			pg_sha1_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf);
 
 static pg_digest
-int_digest_list [] = {
-	{ "md5", pg_md5_len, pg_md5_digest, {0}},
-	{ "sha1", pg_sha1_len, pg_sha1_digest, {0}},
-	{ NULL, NULL, NULL, {0}}
+			int_digest_list[] = {
+	{"md5", pg_md5_len, pg_md5_digest, {0}},
+	{"sha1", pg_sha1_len, pg_sha1_digest, {0}},
+	{NULL, NULL, NULL, {0}}
 };
 
 static uint
-pg_md5_len(pg_digest *h) {
+pg_md5_len(pg_digest * h)
+{
 	return MD5_DIGEST_LENGTH;
 }
 
 static uint8 *
-pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
+pg_md5_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf)
 {
-	MD5_CTX ctx;
+	MD5_CTX		ctx;
 
 	MD5Init(&ctx);
 	MD5Update(&ctx, src, len);
@@ -83,32 +84,31 @@ pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
 }
 
 static uint
-pg_sha1_len(pg_digest *h) {
+pg_sha1_len(pg_digest * h)
+{
 	return SHA1_DIGEST_LENGTH;
 }
 
 static uint8 *
-pg_sha1_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
+pg_sha1_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf)
 {
-	SHA1_CTX ctx;
+	SHA1_CTX	ctx;
 
 	SHA1Init(&ctx);
 	SHA1Update(&ctx, src, len);
 	SHA1Final(buf, &ctx);
-	
+
 	return buf;
 }
 
 
-pg_digest *
-pg_find_digest(pg_digest *h, char *name)
+pg_digest  *
+pg_find_digest(pg_digest * h, char *name)
 {
-	pg_digest *p;
+	pg_digest  *p;
 
 	for (p = int_digest_list; p->name; p++)
 		if (!strcasecmp(p->name, name))
 			return p;
 	return NULL;
 }
-
-
diff --git a/contrib/pgcrypto/krb.c b/contrib/pgcrypto/krb.c
index 14ac44b29d33bc35d0ccfb77fe54dc0ff3156180..95df07ca27cd801dc7766d933bd4c7575e462c3f 100644
--- a/contrib/pgcrypto/krb.c
+++ b/contrib/pgcrypto/krb.c
@@ -1,7 +1,7 @@
 /*
  * krb.c
  *		Wrapper for Kerberos5 libdes SHA1/MD5.
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,12 +26,12 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * 
+ *
  * NOTES
  *	It is possible that this works with other SHA1/MD5
  *	implementations too.
  *
- * $Id: krb.c,v 1.3 2001/02/20 15:34:14 momjian Exp $
+ * $Id: krb.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -54,31 +54,32 @@
 #endif
 
 static uint
-pg_md5_len(pg_digest *h);
+			pg_md5_len(pg_digest * h);
 static uint8 *
-pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf);
+			pg_md5_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf);
 
 static uint
-pg_sha1_len(pg_digest *h);
+			pg_sha1_len(pg_digest * h);
 static uint8 *
-pg_sha1_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf);
+			pg_sha1_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf);
 
 static pg_digest
-int_digest_list [] = {
-	{ "md5", pg_md5_len, pg_md5_digest, {0}},
-	{ "sha1", pg_sha1_len, pg_sha1_digest, {0}},
-	{ NULL, NULL, NULL, {0}}
+			int_digest_list[] = {
+	{"md5", pg_md5_len, pg_md5_digest, {0}},
+	{"sha1", pg_sha1_len, pg_sha1_digest, {0}},
+	{NULL, NULL, NULL, {0}}
 };
 
 static uint
-pg_md5_len(pg_digest *h) {
+pg_md5_len(pg_digest * h)
+{
 	return MD5_DIGEST_LENGTH;
 }
 
 static uint8 *
-pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
+pg_md5_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf)
 {
-	MD5_CTX ctx;
+	MD5_CTX		ctx;
 
 	MD5Init(&ctx);
 	MD5Update(&ctx, src, len);
@@ -88,32 +89,31 @@ pg_md5_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
 }
 
 static uint
-pg_sha1_len(pg_digest *h) {
+pg_sha1_len(pg_digest * h)
+{
 	return SHA1_DIGEST_LENGTH;
 }
 
 static uint8 *
-pg_sha1_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
+pg_sha1_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf)
 {
-	SHA1_CTX ctx;
+	SHA1_CTX	ctx;
 
 	SHA1Init(&ctx);
 	SHA1Update(&ctx, src, len);
 	SHA1Final(buf, &ctx);
-	
+
 	return buf;
 }
 
 
-pg_digest *
-pg_find_digest(pg_digest *h, char *name)
+pg_digest  *
+pg_find_digest(pg_digest * h, char *name)
 {
-	pg_digest *p;
+	pg_digest  *p;
 
 	for (p = int_digest_list; p->name; p++)
 		if (!strcasecmp(p->name, name))
 			return p;
 	return NULL;
 }
-
-
diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c
index d53872023126750dae06a0ffd83c2561fff3cd15..a5cfae34970332707f431100a5228159d73236a0 100644
--- a/contrib/pgcrypto/md5.c
+++ b/contrib/pgcrypto/md5.c
@@ -1,5 +1,5 @@
-/*	$Id: md5.c,v 1.4 2001/02/10 02:31:25 tgl Exp $	*/
-/*     $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $     */
+/*	$Id: md5.c,v 1.5 2001/03/22 03:59:10 momjian Exp $	*/
+/*	   $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $	   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -9,18 +9,18 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -93,42 +93,43 @@
 /* Integer part of 4294967296 times abs(sin(i)), where i is in radians. */
 static const uint32 T[65] = {
 	0,
-	0xd76aa478, 	0xe8c7b756,	0x242070db,	0xc1bdceee,
-	0xf57c0faf,	0x4787c62a, 	0xa8304613,	0xfd469501,
-	0x698098d8,	0x8b44f7af,	0xffff5bb1,	0x895cd7be,
-	0x6b901122, 	0xfd987193, 	0xa679438e,	0x49b40821,
-
-	0xf61e2562,	0xc040b340, 	0x265e5a51, 	0xe9b6c7aa,
-	0xd62f105d,	0x2441453,	0xd8a1e681,	0xe7d3fbc8,
-	0x21e1cde6,	0xc33707d6, 	0xf4d50d87, 	0x455a14ed,
-	0xa9e3e905,	0xfcefa3f8, 	0x676f02d9, 	0x8d2a4c8a,
-
-	0xfffa3942,	0x8771f681, 	0x6d9d6122, 	0xfde5380c,
-	0xa4beea44, 	0x4bdecfa9, 	0xf6bb4b60, 	0xbebfbc70,
-	0x289b7ec6, 	0xeaa127fa, 	0xd4ef3085,	0x4881d05,
-	0xd9d4d039, 	0xe6db99e5, 	0x1fa27cf8, 	0xc4ac5665,
-
-	0xf4292244, 	0x432aff97, 	0xab9423a7, 	0xfc93a039,
-	0x655b59c3, 	0x8f0ccc92, 	0xffeff47d, 	0x85845dd1,
-	0x6fa87e4f, 	0xfe2ce6e0, 	0xa3014314, 	0x4e0811a1,
-	0xf7537e82, 	0xbd3af235, 	0x2ad7d2bb, 	0xeb86d391,
+	0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
+	0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
+	0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
+	0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
+
+	0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
+	0xd62f105d, 0x2441453, 0xd8a1e681, 0xe7d3fbc8,
+	0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
+	0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
+
+	0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
+	0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
+	0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05,
+	0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
+
+	0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
+	0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
+	0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
+	0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
 };
 
 static const uint8 md5_paddat[MD5_BUFLEN] = {
-	0x80,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,
-	0,	0,	0,	0,	0,	0,	0,	0,	
+	0x80, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
 };
 
-static void md5_calc (uint8 *, md5_ctxt *);
+static void md5_calc(uint8 *, md5_ctxt *);
 
-void md5_init(ctxt)
-	md5_ctxt *ctxt;
+void
+md5_init(ctxt)
+md5_ctxt   *ctxt;
 {
 	ctxt->md5_n = 0;
 	ctxt->md5_i = 0;
@@ -139,56 +140,64 @@ void md5_init(ctxt)
 	bzero(ctxt->md5_buf, sizeof(ctxt->md5_buf));
 }
 
-void md5_loop(ctxt, input, len)
-	md5_ctxt *ctxt;
-	uint8 *input;
-	unsigned int len; /* number of bytes */
+void
+md5_loop(ctxt, input, len)
+md5_ctxt   *ctxt;
+uint8	   *input;
+unsigned int len;				/* number of bytes */
 {
-	unsigned int gap, i;
+	unsigned int gap,
+				i;
 
-	ctxt->md5_n += len * 8; /* byte to bit */
+	ctxt->md5_n += len * 8;		/* byte to bit */
 	gap = MD5_BUFLEN - ctxt->md5_i;
 
-	if (len >= gap) {
-		bcopy((void *)input, (void *)(ctxt->md5_buf + ctxt->md5_i),
-			gap);
+	if (len >= gap)
+	{
+		bcopy((void *) input, (void *) (ctxt->md5_buf + ctxt->md5_i),
+			  gap);
 		md5_calc(ctxt->md5_buf, ctxt);
 
-		for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN) {
-			md5_calc((uint8 *)(input + i), ctxt);
-		}
-		
+		for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN)
+			md5_calc((uint8 *) (input + i), ctxt);
+
 		ctxt->md5_i = len - i;
-		bcopy((void *)(input + i), (void *)ctxt->md5_buf, ctxt->md5_i);
-	} else {
-		bcopy((void *)input, (void *)(ctxt->md5_buf + ctxt->md5_i),
-			len);
+		bcopy((void *) (input + i), (void *) ctxt->md5_buf, ctxt->md5_i);
+	}
+	else
+	{
+		bcopy((void *) input, (void *) (ctxt->md5_buf + ctxt->md5_i),
+			  len);
 		ctxt->md5_i += len;
 	}
 }
 
-void md5_pad(ctxt)
-	md5_ctxt *ctxt;
+void
+md5_pad(ctxt)
+md5_ctxt   *ctxt;
 {
 	unsigned int gap;
 
-	/* Don't count up padding. Keep md5_n. */	
+	/* Don't count up padding. Keep md5_n. */
 	gap = MD5_BUFLEN - ctxt->md5_i;
-	if (gap > 8) {
-		bcopy((void *)md5_paddat,
-		      (void *)(ctxt->md5_buf + ctxt->md5_i),
-		      gap - sizeof(ctxt->md5_n));
-	} else {
+	if (gap > 8)
+	{
+		bcopy((void *) md5_paddat,
+			  (void *) (ctxt->md5_buf + ctxt->md5_i),
+			  gap - sizeof(ctxt->md5_n));
+	}
+	else
+	{
 		/* including gap == 8 */
-		bcopy((void *)md5_paddat, (void *)(ctxt->md5_buf + ctxt->md5_i),
-			gap);
+		bcopy((void *) md5_paddat, (void *) (ctxt->md5_buf + ctxt->md5_i),
+			  gap);
 		md5_calc(ctxt->md5_buf, ctxt);
-		bcopy((void *)(md5_paddat + gap),
-		      (void *)ctxt->md5_buf,
-		      MD5_BUFLEN - sizeof(ctxt->md5_n));
+		bcopy((void *) (md5_paddat + gap),
+			  (void *) ctxt->md5_buf,
+			  MD5_BUFLEN - sizeof(ctxt->md5_n));
 	}
 
-	/* 8 byte word */	
+	/* 8 byte word */
 #if BYTE_ORDER == LITTLE_ENDIAN
 	bcopy(&ctxt->md5_n8[0], &ctxt->md5_buf[56], 8);
 #endif
@@ -206,98 +215,192 @@ void md5_pad(ctxt)
 	md5_calc(ctxt->md5_buf, ctxt);
 }
 
-void md5_result(digest, ctxt)
-	uint8 *digest;
-	md5_ctxt *ctxt;
+void
+md5_result(digest, ctxt)
+uint8	   *digest;
+md5_ctxt   *ctxt;
 {
 	/* 4 byte words */
 #if BYTE_ORDER == LITTLE_ENDIAN
 	bcopy(&ctxt->md5_st8[0], digest, 16);
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	digest[ 0] = ctxt->md5_st8[ 3]; digest[ 1] = ctxt->md5_st8[ 2];
-	digest[ 2] = ctxt->md5_st8[ 1]; digest[ 3] = ctxt->md5_st8[ 0];
-	digest[ 4] = ctxt->md5_st8[ 7]; digest[ 5] = ctxt->md5_st8[ 6];
-	digest[ 6] = ctxt->md5_st8[ 5]; digest[ 7] = ctxt->md5_st8[ 4];
-	digest[ 8] = ctxt->md5_st8[11]; digest[ 9] = ctxt->md5_st8[10];
-	digest[10] = ctxt->md5_st8[ 9]; digest[11] = ctxt->md5_st8[ 8];
-	digest[12] = ctxt->md5_st8[15]; digest[13] = ctxt->md5_st8[14];
-	digest[14] = ctxt->md5_st8[13]; digest[15] = ctxt->md5_st8[12];
+	digest[0] = ctxt->md5_st8[3];
+	digest[1] = ctxt->md5_st8[2];
+	digest[2] = ctxt->md5_st8[1];
+	digest[3] = ctxt->md5_st8[0];
+	digest[4] = ctxt->md5_st8[7];
+	digest[5] = ctxt->md5_st8[6];
+	digest[6] = ctxt->md5_st8[5];
+	digest[7] = ctxt->md5_st8[4];
+	digest[8] = ctxt->md5_st8[11];
+	digest[9] = ctxt->md5_st8[10];
+	digest[10] = ctxt->md5_st8[9];
+	digest[11] = ctxt->md5_st8[8];
+	digest[12] = ctxt->md5_st8[15];
+	digest[13] = ctxt->md5_st8[14];
+	digest[14] = ctxt->md5_st8[13];
+	digest[15] = ctxt->md5_st8[12];
 #endif
 }
 
 #if BYTE_ORDER == BIG_ENDIAN
-uint32 X[16];
+uint32		X[16];
+
 #endif
 
-static void md5_calc(b64, ctxt)
-	uint8 *b64;
-	md5_ctxt *ctxt;
+static void
+md5_calc(b64, ctxt)
+uint8	   *b64;
+md5_ctxt   *ctxt;
 {
-	uint32 A = ctxt->md5_sta;
-	uint32 B = ctxt->md5_stb;
-	uint32 C = ctxt->md5_stc;
-	uint32 D = ctxt->md5_std;
+	uint32		A = ctxt->md5_sta;
+	uint32		B = ctxt->md5_stb;
+	uint32		C = ctxt->md5_stc;
+	uint32		D = ctxt->md5_std;
+
 #if BYTE_ORDER == LITTLE_ENDIAN
-	uint32 *X = (uint32 *)b64;
-#endif	
+	uint32	   *X = (uint32 *) b64;
+
+#endif
 #if BYTE_ORDER == BIG_ENDIAN
 	/* 4 byte words */
 	/* what a brute force but fast! */
-	uint8 *y = (uint8 *)X;
-	y[ 0] = b64[ 3]; y[ 1] = b64[ 2]; y[ 2] = b64[ 1]; y[ 3] = b64[ 0];
-	y[ 4] = b64[ 7]; y[ 5] = b64[ 6]; y[ 6] = b64[ 5]; y[ 7] = b64[ 4];
-	y[ 8] = b64[11]; y[ 9] = b64[10]; y[10] = b64[ 9]; y[11] = b64[ 8];
-	y[12] = b64[15]; y[13] = b64[14]; y[14] = b64[13]; y[15] = b64[12];
-	y[16] = b64[19]; y[17] = b64[18]; y[18] = b64[17]; y[19] = b64[16];
-	y[20] = b64[23]; y[21] = b64[22]; y[22] = b64[21]; y[23] = b64[20];
-	y[24] = b64[27]; y[25] = b64[26]; y[26] = b64[25]; y[27] = b64[24];
-	y[28] = b64[31]; y[29] = b64[30]; y[30] = b64[29]; y[31] = b64[28];
-	y[32] = b64[35]; y[33] = b64[34]; y[34] = b64[33]; y[35] = b64[32];
-	y[36] = b64[39]; y[37] = b64[38]; y[38] = b64[37]; y[39] = b64[36];
-	y[40] = b64[43]; y[41] = b64[42]; y[42] = b64[41]; y[43] = b64[40];
-	y[44] = b64[47]; y[45] = b64[46]; y[46] = b64[45]; y[47] = b64[44];
-	y[48] = b64[51]; y[49] = b64[50]; y[50] = b64[49]; y[51] = b64[48];
-	y[52] = b64[55]; y[53] = b64[54]; y[54] = b64[53]; y[55] = b64[52];
-	y[56] = b64[59]; y[57] = b64[58]; y[58] = b64[57]; y[59] = b64[56];
-	y[60] = b64[63]; y[61] = b64[62]; y[62] = b64[61]; y[63] = b64[60];
+	uint8	   *y = (uint8 *) X;
+
+	y[0] = b64[3];
+	y[1] = b64[2];
+	y[2] = b64[1];
+	y[3] = b64[0];
+	y[4] = b64[7];
+	y[5] = b64[6];
+	y[6] = b64[5];
+	y[7] = b64[4];
+	y[8] = b64[11];
+	y[9] = b64[10];
+	y[10] = b64[9];
+	y[11] = b64[8];
+	y[12] = b64[15];
+	y[13] = b64[14];
+	y[14] = b64[13];
+	y[15] = b64[12];
+	y[16] = b64[19];
+	y[17] = b64[18];
+	y[18] = b64[17];
+	y[19] = b64[16];
+	y[20] = b64[23];
+	y[21] = b64[22];
+	y[22] = b64[21];
+	y[23] = b64[20];
+	y[24] = b64[27];
+	y[25] = b64[26];
+	y[26] = b64[25];
+	y[27] = b64[24];
+	y[28] = b64[31];
+	y[29] = b64[30];
+	y[30] = b64[29];
+	y[31] = b64[28];
+	y[32] = b64[35];
+	y[33] = b64[34];
+	y[34] = b64[33];
+	y[35] = b64[32];
+	y[36] = b64[39];
+	y[37] = b64[38];
+	y[38] = b64[37];
+	y[39] = b64[36];
+	y[40] = b64[43];
+	y[41] = b64[42];
+	y[42] = b64[41];
+	y[43] = b64[40];
+	y[44] = b64[47];
+	y[45] = b64[46];
+	y[46] = b64[45];
+	y[47] = b64[44];
+	y[48] = b64[51];
+	y[49] = b64[50];
+	y[50] = b64[49];
+	y[51] = b64[48];
+	y[52] = b64[55];
+	y[53] = b64[54];
+	y[54] = b64[53];
+	y[55] = b64[52];
+	y[56] = b64[59];
+	y[57] = b64[58];
+	y[58] = b64[57];
+	y[59] = b64[56];
+	y[60] = b64[63];
+	y[61] = b64[62];
+	y[62] = b64[61];
+	y[63] = b64[60];
 #endif
 
-	ROUND1(A, B, C, D,  0, Sa,  1); ROUND1(D, A, B, C,  1, Sb,  2);
-	ROUND1(C, D, A, B,  2, Sc,  3); ROUND1(B, C, D, A,  3, Sd,  4);
-	ROUND1(A, B, C, D,  4, Sa,  5); ROUND1(D, A, B, C,  5, Sb,  6);
-	ROUND1(C, D, A, B,  6, Sc,  7); ROUND1(B, C, D, A,  7, Sd,  8);
-	ROUND1(A, B, C, D,  8, Sa,  9); ROUND1(D, A, B, C,  9, Sb, 10);
-	ROUND1(C, D, A, B, 10, Sc, 11); ROUND1(B, C, D, A, 11, Sd, 12);
-	ROUND1(A, B, C, D, 12, Sa, 13); ROUND1(D, A, B, C, 13, Sb, 14);
-	ROUND1(C, D, A, B, 14, Sc, 15); ROUND1(B, C, D, A, 15, Sd, 16);
-	
-	ROUND2(A, B, C, D,  1, Se, 17); ROUND2(D, A, B, C,  6, Sf, 18);
-	ROUND2(C, D, A, B, 11, Sg, 19); ROUND2(B, C, D, A,  0, Sh, 20);
-	ROUND2(A, B, C, D,  5, Se, 21); ROUND2(D, A, B, C, 10, Sf, 22);
-	ROUND2(C, D, A, B, 15, Sg, 23); ROUND2(B, C, D, A,  4, Sh, 24);
-	ROUND2(A, B, C, D,  9, Se, 25); ROUND2(D, A, B, C, 14, Sf, 26);
-	ROUND2(C, D, A, B,  3, Sg, 27); ROUND2(B, C, D, A,  8, Sh, 28);
-	ROUND2(A, B, C, D, 13, Se, 29); ROUND2(D, A, B, C,  2, Sf, 30);
-	ROUND2(C, D, A, B,  7, Sg, 31); ROUND2(B, C, D, A, 12, Sh, 32);
-
-	ROUND3(A, B, C, D,  5, Si, 33); ROUND3(D, A, B, C,  8, Sj, 34);
-	ROUND3(C, D, A, B, 11, Sk, 35); ROUND3(B, C, D, A, 14, Sl, 36);
-	ROUND3(A, B, C, D,  1, Si, 37); ROUND3(D, A, B, C,  4, Sj, 38);
-	ROUND3(C, D, A, B,  7, Sk, 39); ROUND3(B, C, D, A, 10, Sl, 40);
-	ROUND3(A, B, C, D, 13, Si, 41); ROUND3(D, A, B, C,  0, Sj, 42);
-	ROUND3(C, D, A, B,  3, Sk, 43); ROUND3(B, C, D, A,  6, Sl, 44);
-	ROUND3(A, B, C, D,  9, Si, 45); ROUND3(D, A, B, C, 12, Sj, 46);
-	ROUND3(C, D, A, B, 15, Sk, 47); ROUND3(B, C, D, A,  2, Sl, 48);
-	
-	ROUND4(A, B, C, D,  0, Sm, 49); ROUND4(D, A, B, C,  7, Sn, 50);	
-	ROUND4(C, D, A, B, 14, So, 51); ROUND4(B, C, D, A,  5, Sp, 52);	
-	ROUND4(A, B, C, D, 12, Sm, 53); ROUND4(D, A, B, C,  3, Sn, 54);	
-	ROUND4(C, D, A, B, 10, So, 55); ROUND4(B, C, D, A,  1, Sp, 56);	
-	ROUND4(A, B, C, D,  8, Sm, 57); ROUND4(D, A, B, C, 15, Sn, 58);	
-	ROUND4(C, D, A, B,  6, So, 59); ROUND4(B, C, D, A, 13, Sp, 60);	
-	ROUND4(A, B, C, D,  4, Sm, 61); ROUND4(D, A, B, C, 11, Sn, 62);	
-	ROUND4(C, D, A, B,  2, So, 63); ROUND4(B, C, D, A,  9, Sp, 64);
+	ROUND1(A, B, C, D, 0, Sa, 1);
+	ROUND1(D, A, B, C, 1, Sb, 2);
+	ROUND1(C, D, A, B, 2, Sc, 3);
+	ROUND1(B, C, D, A, 3, Sd, 4);
+	ROUND1(A, B, C, D, 4, Sa, 5);
+	ROUND1(D, A, B, C, 5, Sb, 6);
+	ROUND1(C, D, A, B, 6, Sc, 7);
+	ROUND1(B, C, D, A, 7, Sd, 8);
+	ROUND1(A, B, C, D, 8, Sa, 9);
+	ROUND1(D, A, B, C, 9, Sb, 10);
+	ROUND1(C, D, A, B, 10, Sc, 11);
+	ROUND1(B, C, D, A, 11, Sd, 12);
+	ROUND1(A, B, C, D, 12, Sa, 13);
+	ROUND1(D, A, B, C, 13, Sb, 14);
+	ROUND1(C, D, A, B, 14, Sc, 15);
+	ROUND1(B, C, D, A, 15, Sd, 16);
+
+	ROUND2(A, B, C, D, 1, Se, 17);
+	ROUND2(D, A, B, C, 6, Sf, 18);
+	ROUND2(C, D, A, B, 11, Sg, 19);
+	ROUND2(B, C, D, A, 0, Sh, 20);
+	ROUND2(A, B, C, D, 5, Se, 21);
+	ROUND2(D, A, B, C, 10, Sf, 22);
+	ROUND2(C, D, A, B, 15, Sg, 23);
+	ROUND2(B, C, D, A, 4, Sh, 24);
+	ROUND2(A, B, C, D, 9, Se, 25);
+	ROUND2(D, A, B, C, 14, Sf, 26);
+	ROUND2(C, D, A, B, 3, Sg, 27);
+	ROUND2(B, C, D, A, 8, Sh, 28);
+	ROUND2(A, B, C, D, 13, Se, 29);
+	ROUND2(D, A, B, C, 2, Sf, 30);
+	ROUND2(C, D, A, B, 7, Sg, 31);
+	ROUND2(B, C, D, A, 12, Sh, 32);
+
+	ROUND3(A, B, C, D, 5, Si, 33);
+	ROUND3(D, A, B, C, 8, Sj, 34);
+	ROUND3(C, D, A, B, 11, Sk, 35);
+	ROUND3(B, C, D, A, 14, Sl, 36);
+	ROUND3(A, B, C, D, 1, Si, 37);
+	ROUND3(D, A, B, C, 4, Sj, 38);
+	ROUND3(C, D, A, B, 7, Sk, 39);
+	ROUND3(B, C, D, A, 10, Sl, 40);
+	ROUND3(A, B, C, D, 13, Si, 41);
+	ROUND3(D, A, B, C, 0, Sj, 42);
+	ROUND3(C, D, A, B, 3, Sk, 43);
+	ROUND3(B, C, D, A, 6, Sl, 44);
+	ROUND3(A, B, C, D, 9, Si, 45);
+	ROUND3(D, A, B, C, 12, Sj, 46);
+	ROUND3(C, D, A, B, 15, Sk, 47);
+	ROUND3(B, C, D, A, 2, Sl, 48);
+
+	ROUND4(A, B, C, D, 0, Sm, 49);
+	ROUND4(D, A, B, C, 7, Sn, 50);
+	ROUND4(C, D, A, B, 14, So, 51);
+	ROUND4(B, C, D, A, 5, Sp, 52);
+	ROUND4(A, B, C, D, 12, Sm, 53);
+	ROUND4(D, A, B, C, 3, Sn, 54);
+	ROUND4(C, D, A, B, 10, So, 55);
+	ROUND4(B, C, D, A, 1, Sp, 56);
+	ROUND4(A, B, C, D, 8, Sm, 57);
+	ROUND4(D, A, B, C, 15, Sn, 58);
+	ROUND4(C, D, A, B, 6, So, 59);
+	ROUND4(B, C, D, A, 13, Sp, 60);
+	ROUND4(A, B, C, D, 4, Sm, 61);
+	ROUND4(D, A, B, C, 11, Sn, 62);
+	ROUND4(C, D, A, B, 2, So, 63);
+	ROUND4(B, C, D, A, 9, Sp, 64);
 
 	ctxt->md5_sta += A;
 	ctxt->md5_stb += B;
diff --git a/contrib/pgcrypto/md5.h b/contrib/pgcrypto/md5.h
index b724c34ba0a342483f8ba22307fed47b6830ba17..54ca2558dff0f2e803ff7f2e813008676b502221 100644
--- a/contrib/pgcrypto/md5.h
+++ b/contrib/pgcrypto/md5.h
@@ -1,5 +1,5 @@
-/*	$Id: md5.h,v 1.3 2001/01/09 16:07:13 momjian Exp $	*/
-/*     $KAME: md5.h,v 1.3 2000/02/22 14:01:18 itojun Exp $     */
+/*	$Id: md5.h,v 1.4 2001/03/22 03:59:10 momjian Exp $	*/
+/*	   $KAME: md5.h,v 1.3 2000/02/22 14:01:18 itojun Exp $	   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -9,18 +9,18 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -35,11 +35,13 @@
 
 #define MD5_BUFLEN	64
 
-typedef struct {
-	union {
+typedef struct
+{
+	union
+	{
 		uint32		md5_state32[4];
 		uint8		md5_state8[16];
-	} md5_st;
+	}			md5_st;
 
 #define md5_sta		md5_st.md5_state32[0]
 #define md5_stb		md5_st.md5_state32[1]
@@ -47,21 +49,22 @@ typedef struct {
 #define md5_std		md5_st.md5_state32[3]
 #define md5_st8		md5_st.md5_state8
 
-	union {
+	union
+	{
 		uint64		md5_count64;
 		uint8		md5_count8[8];
-	} md5_count;
+	}			md5_count;
 #define md5_n	md5_count.md5_count64
 #define md5_n8	md5_count.md5_count8
 
-	unsigned int	md5_i;
-	uint8			md5_buf[MD5_BUFLEN];
-} md5_ctxt;
+	unsigned int md5_i;
+	uint8		md5_buf[MD5_BUFLEN];
+}			md5_ctxt;
 
-extern void md5_init (md5_ctxt *);
-extern void md5_loop (md5_ctxt *, uint8 *, unsigned int);
-extern void md5_pad (md5_ctxt *);
-extern void md5_result (uint8 *, md5_ctxt *);
+extern void md5_init(md5_ctxt *);
+extern void md5_loop(md5_ctxt *, uint8 *, unsigned int);
+extern void md5_pad(md5_ctxt *);
+extern void md5_result(uint8 *, md5_ctxt *);
 
 /* compatibility */
 #define MD5_CTX		md5_ctxt
@@ -73,4 +76,4 @@ do {				\
 	md5_result((x), (y));	\
 } while (0)
 
-#endif /* ! _NETINET6_MD5_H_*/
+#endif	 /* ! _NETINET6_MD5_H_ */
diff --git a/contrib/pgcrypto/mhash.c b/contrib/pgcrypto/mhash.c
index 34ac7e9c7ac0073818dc2b0f8de5519ab9b9d289..d6ada96d149eca11499bb42a87770de021f88062 100644
--- a/contrib/pgcrypto/mhash.c
+++ b/contrib/pgcrypto/mhash.c
@@ -1,7 +1,7 @@
 /*
  * mhash.c
  *		Wrapper for mhash library.
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: mhash.c,v 1.2 2001/02/10 02:31:26 tgl Exp $
+ * $Id: mhash.c,v 1.3 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -36,45 +36,50 @@
 #include <mhash.h>
 
 static uint
-pg_mhash_len(pg_digest *hash);
-static uint8 *
-pg_mhash_digest(pg_digest *hash, uint8 *src,
-		uint len, uint8 *buf);
+			pg_mhash_len(pg_digest * hash);
+static uint8 *pg_mhash_digest(pg_digest * hash, uint8 *src,
+				uint len, uint8 *buf);
 
 static uint
-pg_mhash_len(pg_digest *h) {
+pg_mhash_len(pg_digest * h)
+{
 	return mhash_get_block_size(h->misc.code);
 }
 
 static uint8 *
-pg_mhash_digest(pg_digest *h, uint8 *src, uint len, uint8 *dst)
+pg_mhash_digest(pg_digest * h, uint8 *src, uint len, uint8 *dst)
 {
-	uint8 *res;
-	
-	MHASH mh = mhash_init(h->misc.code);
+	uint8	   *res;
+
+	MHASH		mh = mhash_init(h->misc.code);
+
 	mhash(mh, src, len);
 	res = mhash_end(mh);
-	
+
 	memcpy(dst, res, mhash_get_block_size(h->misc.code));
 	mhash_free(res);
-	
+
 	return dst;
 }
 
-pg_digest *
-pg_find_digest(pg_digest *h, char *name)
+pg_digest  *
+pg_find_digest(pg_digest * h, char *name)
 {
-	size_t hnum, i, b;
-	char *mname;
-	
+	size_t		hnum,
+				i,
+				b;
+	char	   *mname;
+
 	hnum = mhash_count();
-	for (i = 0; i <= hnum; i++) {
+	for (i = 0; i <= hnum; i++)
+	{
 		mname = mhash_get_hash_name(i);
 		if (mname == NULL)
 			continue;
 		b = strcasecmp(name, mname);
 		free(mname);
-		if (!b) {
+		if (!b)
+		{
 			h->name = mhash_get_hash_name(i);
 			h->length = pg_mhash_len;
 			h->digest = pg_mhash_digest;
@@ -84,4 +89,3 @@ pg_find_digest(pg_digest *h, char *name)
 	}
 	return NULL;
 }
-
diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c
index 18fb07548877785e614ad37e0fcfa614061c8900..866d26f0ffcf04453c8759ee62ba66ea0fc40508 100644
--- a/contrib/pgcrypto/openssl.c
+++ b/contrib/pgcrypto/openssl.c
@@ -1,7 +1,7 @@
 /*
  * openssl.c
  *		Wrapper for OpenSSL library.
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: openssl.c,v 1.2 2001/02/10 02:31:26 tgl Exp $
+ * $Id: openssl.c,v 1.3 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -36,50 +36,50 @@
 #include <evp.h>
 
 static uint
-pg_ossl_len(pg_digest *h);
+			pg_ossl_len(pg_digest * h);
 static uint8 *
-pg_ossl_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf);
+			pg_ossl_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf);
 
 static uint
-pg_ossl_len(pg_digest *h) {
-	return EVP_MD_size((EVP_MD*)h->misc.ptr);
+pg_ossl_len(pg_digest * h)
+{
+	return EVP_MD_size((EVP_MD *) h->misc.ptr);
 }
 
 static uint8 *
-pg_ossl_digest(pg_digest *h, uint8 *src, uint len, uint8 *buf)
+pg_ossl_digest(pg_digest * h, uint8 *src, uint len, uint8 *buf)
 {
-	EVP_MD *md = (EVP_MD*)h->misc.ptr;
-	EVP_MD_CTX ctx;
+	EVP_MD	   *md = (EVP_MD *) h->misc.ptr;
+	EVP_MD_CTX	ctx;
 
 	EVP_DigestInit(&ctx, md);
 	EVP_DigestUpdate(&ctx, src, len);
 	EVP_DigestFinal(&ctx, buf, NULL);
-	
+
 	return buf;
 }
 
-static int pg_openssl_initialized = 0;
+static int	pg_openssl_initialized = 0;
 
-pg_digest *
-pg_find_digest(pg_digest *h, char *name)
+pg_digest  *
+pg_find_digest(pg_digest * h, char *name)
 {
 	const EVP_MD *md;
 
-	if (!pg_openssl_initialized) {
+	if (!pg_openssl_initialized)
+	{
 		OpenSSL_add_all_digests();
 		pg_openssl_initialized = 1;
 	}
-	
+
 	md = EVP_get_digestbyname(name);
 	if (md == NULL)
 		return NULL;
-	
+
 	h->name = name;
 	h->length = pg_ossl_len;
 	h->digest = pg_ossl_digest;
-	h->misc.ptr = (void*)md;
-	
+	h->misc.ptr = (void *) md;
+
 	return h;
 }
-
-
diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c
index 1feb3e4806aea309dc74e56d32de90963f30cb84..31e5a845bd6686baf4ed77d26653e35f48c950e1 100644
--- a/contrib/pgcrypto/pgcrypto.c
+++ b/contrib/pgcrypto/pgcrypto.c
@@ -1,7 +1,7 @@
 /*
  * pgcrypto.c
  *		Cryptographic digests for PostgreSQL.
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: pgcrypto.c,v 1.6 2001/02/10 02:31:26 tgl Exp $
+ * $Id: pgcrypto.c,v 1.7 2001/03/22 03:59:10 momjian Exp $
  */
 
 #include "postgres.h"
@@ -44,12 +44,12 @@
 
 
 /* exported functions */
-Datum digest(PG_FUNCTION_ARGS);
-Datum digest_exists(PG_FUNCTION_ARGS);
+Datum		digest(PG_FUNCTION_ARGS);
+Datum		digest_exists(PG_FUNCTION_ARGS);
 
 /* private stuff */
 static pg_digest *
-find_digest(pg_digest *hbuf, text *name, int silent);
+			find_digest(pg_digest * hbuf, text *name, int silent);
 
 
 /* SQL function: hash(text, text) returns text */
@@ -58,31 +58,33 @@ PG_FUNCTION_INFO_V1(digest);
 Datum
 digest(PG_FUNCTION_ARGS)
 {
-	text *arg;
-	text *name;
-	uint len, hlen;
-	pg_digest *h, _hbuf;
-	text *res;
-	
+	text	   *arg;
+	text	   *name;
+	uint		len,
+				hlen;
+	pg_digest  *h,
+				_hbuf;
+	text	   *res;
+
 	if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
 		PG_RETURN_NULL();
-	
-	name = PG_GETARG_TEXT_P(1);	
-	h = find_digest(&_hbuf, name, 0); /* will give error if fails */
+
+	name = PG_GETARG_TEXT_P(1);
+	h = find_digest(&_hbuf, name, 0);	/* will give error if fails */
 
 	hlen = h->length(h);
-	
-	res = (text *)palloc(hlen + VARHDRSZ);
+
+	res = (text *) palloc(hlen + VARHDRSZ);
 	VARATT_SIZEP(res) = hlen + VARHDRSZ;
-	
+
 	arg = PG_GETARG_TEXT_P(0);
 	len = VARSIZE(arg) - VARHDRSZ;
-	
+
 	h->digest(h, VARDATA(arg), len, VARDATA(res));
-	
+
 	PG_FREE_IF_COPY(arg, 0);
 	PG_FREE_IF_COPY(name, 1);
-	
+
 	PG_RETURN_TEXT_P(res);
 }
 
@@ -92,16 +94,17 @@ PG_FUNCTION_INFO_V1(digest_exists);
 Datum
 digest_exists(PG_FUNCTION_ARGS)
 {
-	text *name;
-	pg_digest _hbuf, *res;
+	text	   *name;
+	pg_digest	_hbuf,
+			   *res;
 
 	if (PG_ARGISNULL(0))
 		PG_RETURN_NULL();
-	
+
 	name = PG_GETARG_TEXT_P(0);
-	
+
 	res = find_digest(&_hbuf, name, 1);
-	
+
 	PG_FREE_IF_COPY(name, 0);
 
 	if (res != NULL)
@@ -110,26 +113,26 @@ digest_exists(PG_FUNCTION_ARGS)
 }
 
 static pg_digest *
-find_digest(pg_digest *hbuf, text *name, int silent)
+find_digest(pg_digest * hbuf, text *name, int silent)
 {
-	pg_digest *p;
-	char buf[NAMEDATALEN];
-	uint len;
-	
+	pg_digest  *p;
+	char		buf[NAMEDATALEN];
+	uint		len;
+
 	len = VARSIZE(name) - VARHDRSZ;
-	if (len >= NAMEDATALEN) {
+	if (len >= NAMEDATALEN)
+	{
 		if (silent)
 			return NULL;
 		elog(ERROR, "Hash type does not exist (name too long)");
 	}
-		
+
 	memcpy(buf, VARDATA(name), len);
 	buf[len] = 0;
-	
+
 	p = pg_find_digest(hbuf, buf);
 
 	if (p == NULL && !silent)
 		elog(ERROR, "Hash type does not exist: '%s'", buf);
 	return p;
 }
-
diff --git a/contrib/pgcrypto/pgcrypto.h b/contrib/pgcrypto/pgcrypto.h
index 039d6cef79cb684f409bbc5ae849c25753ba2558..1700b89b15840bd839ef136e3a61eeea8ebe0a46 100644
--- a/contrib/pgcrypto/pgcrypto.h
+++ b/contrib/pgcrypto/pgcrypto.h
@@ -1,7 +1,7 @@
 /*
  * pgcrypto.h
  *		Header file for pgcrypto.
- * 
+ *
  * Copyright (c) 2000 Marko Kreen
  * All rights reserved.
  *
@@ -9,15 +9,15 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -26,25 +26,27 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: pgcrypto.h,v 1.2 2001/01/09 16:07:13 momjian Exp $
+ * $Id: pgcrypto.h,v 1.3 2001/03/22 03:59:10 momjian Exp $
  */
 
 #ifndef _PG_CRYPTO_H
 #define _PG_CRYPTO_H
 
 typedef struct _pg_digest pg_digest;
-struct _pg_digest {
-	char *name;
-	uint (*length)(pg_digest *h);
-	uint8 *(*digest)(pg_digest *h, uint8 *data,
-			uint dlen, uint8 *buf);
+struct _pg_digest
+{
+	char	   *name;
+	uint		(*length) (pg_digest * h);
+	uint8	   *(*digest) (pg_digest * h, uint8 *data,
+									   uint dlen, uint8 *buf);
 	/* private */
-	union {
-		uint code;
+	union
+	{
+		uint		code;
 		const void *ptr;
-	} misc;
+	}			misc;
 };
 
-extern pg_digest *pg_find_digest(pg_digest *hbuf, char *name);
+extern pg_digest *pg_find_digest(pg_digest * hbuf, char *name);
 
 #endif
diff --git a/contrib/pgcrypto/sha1.c b/contrib/pgcrypto/sha1.c
index 63c28dc7e945709932647614a52bed1801cc47cb..db9f1a17c60b89bad0ee743954b6feba98a08f47 100644
--- a/contrib/pgcrypto/sha1.c
+++ b/contrib/pgcrypto/sha1.c
@@ -1,5 +1,5 @@
-/*	$Id: sha1.c,v 1.4 2001/02/10 02:31:26 tgl Exp $	*/
-/*     $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $    */
+/*	$Id: sha1.c,v 1.5 2001/03/22 03:59:10 momjian Exp $ */
+/*	   $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -9,18 +9,18 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -41,120 +41,182 @@
 
 /* sanity check */
 #if BYTE_ORDER != BIG_ENDIAN
-# if BYTE_ORDER != LITTLE_ENDIAN
-#  define unsupported 1
-# endif
+#if BYTE_ORDER != LITTLE_ENDIAN
+#define unsupported 1
+#endif
 #endif
 
 #ifndef unsupported
 
 /* constant table */
-static uint32 _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
-#define	K(t)	_K[(t) / 20]
+static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
+
+#define K(t)	_K[(t) / 20]
 
-#define	F0(b, c, d)	(((b) & (c)) | ((~(b)) & (d)))
-#define	F1(b, c, d)	(((b) ^ (c)) ^ (d))
-#define	F2(b, c, d)	(((b) & (c)) | ((b) & (d)) | ((c) & (d)))
-#define	F3(b, c, d)	(((b) ^ (c)) ^ (d))
+#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d)))
+#define F1(b, c, d) (((b) ^ (c)) ^ (d))
+#define F2(b, c, d) (((b) & (c)) | ((b) & (d)) | ((c) & (d)))
+#define F3(b, c, d) (((b) ^ (c)) ^ (d))
 
-#define	S(n, x)		(((x) << (n)) | ((x) >> (32 - n)))
+#define S(n, x)		(((x) << (n)) | ((x) >> (32 - n)))
 
-#define	H(n)	(ctxt->h.b32[(n)])
-#define	COUNT	(ctxt->count)
-#define	BCOUNT	(ctxt->c.b64[0] / 8)
-#define	W(n)	(ctxt->m.b32[(n)])
+#define H(n)	(ctxt->h.b32[(n)])
+#define COUNT	(ctxt->count)
+#define BCOUNT	(ctxt->c.b64[0] / 8)
+#define W(n)	(ctxt->m.b32[(n)])
 
-#define	PUTBYTE(x)	{ \
+#define PUTBYTE(x)	{ \
 	ctxt->m.b8[(COUNT % 64)] = (x);		\
 	COUNT++;				\
 	COUNT %= 64;				\
 	ctxt->c.b64[0] += 8;			\
 	if (COUNT % 64 == 0)			\
 		sha1_step(ctxt);		\
-     }
+	 }
 
-#define	PUTPAD(x)	{ \
+#define PUTPAD(x)	{ \
 	ctxt->m.b8[(COUNT % 64)] = (x);		\
 	COUNT++;				\
 	COUNT %= 64;				\
 	if (COUNT % 64 == 0)			\
 		sha1_step(ctxt);		\
-     }
+	 }
 
-static void sha1_step (struct sha1_ctxt *);
+static void sha1_step(struct sha1_ctxt *);
 
 static void
 sha1_step(ctxt)
-	struct sha1_ctxt *ctxt;
+struct sha1_ctxt *ctxt;
 {
-	uint32	a, b, c, d, e;
-	size_t t, s;
-	uint32	tmp;
+	uint32		a,
+				b,
+				c,
+				d,
+				e;
+	size_t		t,
+				s;
+	uint32		tmp;
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 	struct sha1_ctxt tctxt;
+
 	bcopy(&ctxt->m.b8[0], &tctxt.m.b8[0], 64);
-	ctxt->m.b8[0] = tctxt.m.b8[3]; ctxt->m.b8[1] = tctxt.m.b8[2];
-	ctxt->m.b8[2] = tctxt.m.b8[1]; ctxt->m.b8[3] = tctxt.m.b8[0];
-	ctxt->m.b8[4] = tctxt.m.b8[7]; ctxt->m.b8[5] = tctxt.m.b8[6];
-	ctxt->m.b8[6] = tctxt.m.b8[5]; ctxt->m.b8[7] = tctxt.m.b8[4];
-	ctxt->m.b8[8] = tctxt.m.b8[11]; ctxt->m.b8[9] = tctxt.m.b8[10];
-	ctxt->m.b8[10] = tctxt.m.b8[9]; ctxt->m.b8[11] = tctxt.m.b8[8];
-	ctxt->m.b8[12] = tctxt.m.b8[15]; ctxt->m.b8[13] = tctxt.m.b8[14];
-	ctxt->m.b8[14] = tctxt.m.b8[13]; ctxt->m.b8[15] = tctxt.m.b8[12];
-	ctxt->m.b8[16] = tctxt.m.b8[19]; ctxt->m.b8[17] = tctxt.m.b8[18];
-	ctxt->m.b8[18] = tctxt.m.b8[17]; ctxt->m.b8[19] = tctxt.m.b8[16];
-	ctxt->m.b8[20] = tctxt.m.b8[23]; ctxt->m.b8[21] = tctxt.m.b8[22];
-	ctxt->m.b8[22] = tctxt.m.b8[21]; ctxt->m.b8[23] = tctxt.m.b8[20];
-	ctxt->m.b8[24] = tctxt.m.b8[27]; ctxt->m.b8[25] = tctxt.m.b8[26];
-	ctxt->m.b8[26] = tctxt.m.b8[25]; ctxt->m.b8[27] = tctxt.m.b8[24];
-	ctxt->m.b8[28] = tctxt.m.b8[31]; ctxt->m.b8[29] = tctxt.m.b8[30];
-	ctxt->m.b8[30] = tctxt.m.b8[29]; ctxt->m.b8[31] = tctxt.m.b8[28];
-	ctxt->m.b8[32] = tctxt.m.b8[35]; ctxt->m.b8[33] = tctxt.m.b8[34];
-	ctxt->m.b8[34] = tctxt.m.b8[33]; ctxt->m.b8[35] = tctxt.m.b8[32];
-	ctxt->m.b8[36] = tctxt.m.b8[39]; ctxt->m.b8[37] = tctxt.m.b8[38];
-	ctxt->m.b8[38] = tctxt.m.b8[37]; ctxt->m.b8[39] = tctxt.m.b8[36];
-	ctxt->m.b8[40] = tctxt.m.b8[43]; ctxt->m.b8[41] = tctxt.m.b8[42];
-	ctxt->m.b8[42] = tctxt.m.b8[41]; ctxt->m.b8[43] = tctxt.m.b8[40];
-	ctxt->m.b8[44] = tctxt.m.b8[47]; ctxt->m.b8[45] = tctxt.m.b8[46];
-	ctxt->m.b8[46] = tctxt.m.b8[45]; ctxt->m.b8[47] = tctxt.m.b8[44];
-	ctxt->m.b8[48] = tctxt.m.b8[51]; ctxt->m.b8[49] = tctxt.m.b8[50];
-	ctxt->m.b8[50] = tctxt.m.b8[49]; ctxt->m.b8[51] = tctxt.m.b8[48];
-	ctxt->m.b8[52] = tctxt.m.b8[55]; ctxt->m.b8[53] = tctxt.m.b8[54];
-	ctxt->m.b8[54] = tctxt.m.b8[53]; ctxt->m.b8[55] = tctxt.m.b8[52];
-	ctxt->m.b8[56] = tctxt.m.b8[59]; ctxt->m.b8[57] = tctxt.m.b8[58];
-	ctxt->m.b8[58] = tctxt.m.b8[57]; ctxt->m.b8[59] = tctxt.m.b8[56];
-	ctxt->m.b8[60] = tctxt.m.b8[63]; ctxt->m.b8[61] = tctxt.m.b8[62];
-	ctxt->m.b8[62] = tctxt.m.b8[61]; ctxt->m.b8[63] = tctxt.m.b8[60];
+	ctxt->m.b8[0] = tctxt.m.b8[3];
+	ctxt->m.b8[1] = tctxt.m.b8[2];
+	ctxt->m.b8[2] = tctxt.m.b8[1];
+	ctxt->m.b8[3] = tctxt.m.b8[0];
+	ctxt->m.b8[4] = tctxt.m.b8[7];
+	ctxt->m.b8[5] = tctxt.m.b8[6];
+	ctxt->m.b8[6] = tctxt.m.b8[5];
+	ctxt->m.b8[7] = tctxt.m.b8[4];
+	ctxt->m.b8[8] = tctxt.m.b8[11];
+	ctxt->m.b8[9] = tctxt.m.b8[10];
+	ctxt->m.b8[10] = tctxt.m.b8[9];
+	ctxt->m.b8[11] = tctxt.m.b8[8];
+	ctxt->m.b8[12] = tctxt.m.b8[15];
+	ctxt->m.b8[13] = tctxt.m.b8[14];
+	ctxt->m.b8[14] = tctxt.m.b8[13];
+	ctxt->m.b8[15] = tctxt.m.b8[12];
+	ctxt->m.b8[16] = tctxt.m.b8[19];
+	ctxt->m.b8[17] = tctxt.m.b8[18];
+	ctxt->m.b8[18] = tctxt.m.b8[17];
+	ctxt->m.b8[19] = tctxt.m.b8[16];
+	ctxt->m.b8[20] = tctxt.m.b8[23];
+	ctxt->m.b8[21] = tctxt.m.b8[22];
+	ctxt->m.b8[22] = tctxt.m.b8[21];
+	ctxt->m.b8[23] = tctxt.m.b8[20];
+	ctxt->m.b8[24] = tctxt.m.b8[27];
+	ctxt->m.b8[25] = tctxt.m.b8[26];
+	ctxt->m.b8[26] = tctxt.m.b8[25];
+	ctxt->m.b8[27] = tctxt.m.b8[24];
+	ctxt->m.b8[28] = tctxt.m.b8[31];
+	ctxt->m.b8[29] = tctxt.m.b8[30];
+	ctxt->m.b8[30] = tctxt.m.b8[29];
+	ctxt->m.b8[31] = tctxt.m.b8[28];
+	ctxt->m.b8[32] = tctxt.m.b8[35];
+	ctxt->m.b8[33] = tctxt.m.b8[34];
+	ctxt->m.b8[34] = tctxt.m.b8[33];
+	ctxt->m.b8[35] = tctxt.m.b8[32];
+	ctxt->m.b8[36] = tctxt.m.b8[39];
+	ctxt->m.b8[37] = tctxt.m.b8[38];
+	ctxt->m.b8[38] = tctxt.m.b8[37];
+	ctxt->m.b8[39] = tctxt.m.b8[36];
+	ctxt->m.b8[40] = tctxt.m.b8[43];
+	ctxt->m.b8[41] = tctxt.m.b8[42];
+	ctxt->m.b8[42] = tctxt.m.b8[41];
+	ctxt->m.b8[43] = tctxt.m.b8[40];
+	ctxt->m.b8[44] = tctxt.m.b8[47];
+	ctxt->m.b8[45] = tctxt.m.b8[46];
+	ctxt->m.b8[46] = tctxt.m.b8[45];
+	ctxt->m.b8[47] = tctxt.m.b8[44];
+	ctxt->m.b8[48] = tctxt.m.b8[51];
+	ctxt->m.b8[49] = tctxt.m.b8[50];
+	ctxt->m.b8[50] = tctxt.m.b8[49];
+	ctxt->m.b8[51] = tctxt.m.b8[48];
+	ctxt->m.b8[52] = tctxt.m.b8[55];
+	ctxt->m.b8[53] = tctxt.m.b8[54];
+	ctxt->m.b8[54] = tctxt.m.b8[53];
+	ctxt->m.b8[55] = tctxt.m.b8[52];
+	ctxt->m.b8[56] = tctxt.m.b8[59];
+	ctxt->m.b8[57] = tctxt.m.b8[58];
+	ctxt->m.b8[58] = tctxt.m.b8[57];
+	ctxt->m.b8[59] = tctxt.m.b8[56];
+	ctxt->m.b8[60] = tctxt.m.b8[63];
+	ctxt->m.b8[61] = tctxt.m.b8[62];
+	ctxt->m.b8[62] = tctxt.m.b8[61];
+	ctxt->m.b8[63] = tctxt.m.b8[60];
 #endif
 
-	a = H(0); b = H(1); c = H(2); d = H(3); e = H(4);
+	a = H(0);
+	b = H(1);
+	c = H(2);
+	d = H(3);
+	e = H(4);
 
-	for (t = 0; t < 20; t++) {
+	for (t = 0; t < 20; t++)
+	{
 		s = t & 0x0f;
-		if (t >= 16) {
-			W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ W((s+2) & 0x0f) ^ W(s));
-		}
+		if (t >= 16)
+			W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
 		tmp = S(5, a) + F0(b, c, d) + e + W(s) + K(t);
-		e = d; d = c; c = S(30, b); b = a; a = tmp;
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
 	}
-	for (t = 20; t < 40; t++) {
+	for (t = 20; t < 40; t++)
+	{
 		s = t & 0x0f;
-		W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ W((s+2) & 0x0f) ^ W(s));
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
 		tmp = S(5, a) + F1(b, c, d) + e + W(s) + K(t);
-		e = d; d = c; c = S(30, b); b = a; a = tmp;
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
 	}
-	for (t = 40; t < 60; t++) {
+	for (t = 40; t < 60; t++)
+	{
 		s = t & 0x0f;
-		W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ W((s+2) & 0x0f) ^ W(s));
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
 		tmp = S(5, a) + F2(b, c, d) + e + W(s) + K(t);
-		e = d; d = c; c = S(30, b); b = a; a = tmp;
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
 	}
-	for (t = 60; t < 80; t++) {
+	for (t = 60; t < 80; t++)
+	{
 		s = t & 0x0f;
-		W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ W((s+2) & 0x0f) ^ W(s));
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
 		tmp = S(5, a) + F3(b, c, d) + e + W(s) + K(t);
-		e = d; d = c; c = S(30, b); b = a; a = tmp;
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
 	}
 
 	H(0) = H(0) + a;
@@ -170,7 +232,7 @@ sha1_step(ctxt)
 
 void
 sha1_init(ctxt)
-	struct sha1_ctxt *ctxt;
+struct sha1_ctxt *ctxt;
 {
 	bzero(ctxt, sizeof(struct sha1_ctxt));
 	H(0) = 0x67452301;
@@ -182,55 +244,65 @@ sha1_init(ctxt)
 
 void
 sha1_pad(ctxt)
-	struct sha1_ctxt *ctxt;
+struct sha1_ctxt *ctxt;
 {
-	size_t padlen;		/*pad length in bytes*/
-	size_t padstart;
+	size_t		padlen;			/* pad length in bytes */
+	size_t		padstart;
 
 	PUTPAD(0x80);
 
 	padstart = COUNT % 64;
 	padlen = 64 - padstart;
-	if (padlen < 8) {
+	if (padlen < 8)
+	{
 		bzero(&ctxt->m.b8[padstart], padlen);
 		COUNT += padlen;
 		COUNT %= 64;
 		sha1_step(ctxt);
 		padstart = COUNT % 64;	/* should be 0 */
-		padlen = 64 - padstart;	/* should be 64 */
+		padlen = 64 - padstart; /* should be 64 */
 	}
 	bzero(&ctxt->m.b8[padstart], padlen - 8);
 	COUNT += (padlen - 8);
 	COUNT %= 64;
 #if BYTE_ORDER == BIG_ENDIAN
-	PUTPAD(ctxt->c.b8[0]); PUTPAD(ctxt->c.b8[1]);
-	PUTPAD(ctxt->c.b8[2]); PUTPAD(ctxt->c.b8[3]);
-	PUTPAD(ctxt->c.b8[4]); PUTPAD(ctxt->c.b8[5]);
-	PUTPAD(ctxt->c.b8[6]); PUTPAD(ctxt->c.b8[7]);
+	PUTPAD(ctxt->c.b8[0]);
+	PUTPAD(ctxt->c.b8[1]);
+	PUTPAD(ctxt->c.b8[2]);
+	PUTPAD(ctxt->c.b8[3]);
+	PUTPAD(ctxt->c.b8[4]);
+	PUTPAD(ctxt->c.b8[5]);
+	PUTPAD(ctxt->c.b8[6]);
+	PUTPAD(ctxt->c.b8[7]);
 #else
-	PUTPAD(ctxt->c.b8[7]); PUTPAD(ctxt->c.b8[6]);
-	PUTPAD(ctxt->c.b8[5]); PUTPAD(ctxt->c.b8[4]);
-	PUTPAD(ctxt->c.b8[3]); PUTPAD(ctxt->c.b8[2]);
-	PUTPAD(ctxt->c.b8[1]); PUTPAD(ctxt->c.b8[0]);
+	PUTPAD(ctxt->c.b8[7]);
+	PUTPAD(ctxt->c.b8[6]);
+	PUTPAD(ctxt->c.b8[5]);
+	PUTPAD(ctxt->c.b8[4]);
+	PUTPAD(ctxt->c.b8[3]);
+	PUTPAD(ctxt->c.b8[2]);
+	PUTPAD(ctxt->c.b8[1]);
+	PUTPAD(ctxt->c.b8[0]);
 #endif
 }
 
 void
 sha1_loop(ctxt, input0, len)
-	struct sha1_ctxt *ctxt;
-	const caddr_t input0;
-	size_t len;
+struct sha1_ctxt *ctxt;
+const caddr_t input0;
+size_t		len;
 {
 	const uint8 *input;
-	size_t gaplen;
-	size_t gapstart;
-	size_t off;
-	size_t copysiz;
+	size_t		gaplen;
+	size_t		gapstart;
+	size_t		off;
+	size_t		copysiz;
 
-	input = (const uint8 *)input0;
+	input = (const uint8 *) input0;
 	off = 0;
 
-	while (off < len) {
+	while (off < len)
+	{
 		gapstart = COUNT % 64;
 		gaplen = 64 - gapstart;
 
@@ -247,27 +319,37 @@ sha1_loop(ctxt, input0, len)
 
 void
 sha1_result(ctxt, digest0)
-	struct sha1_ctxt *ctxt;
-	caddr_t digest0;
+struct sha1_ctxt *ctxt;
+caddr_t		digest0;
 {
-	uint8 *digest;
+	uint8	   *digest;
 
-	digest = (uint8 *)digest0;
+	digest = (uint8 *) digest0;
 	sha1_pad(ctxt);
 #if BYTE_ORDER == BIG_ENDIAN
 	bcopy(&ctxt->h.b8[0], digest, 20);
 #else
-	digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2];
-	digest[2] = ctxt->h.b8[1]; digest[3] = ctxt->h.b8[0];
-	digest[4] = ctxt->h.b8[7]; digest[5] = ctxt->h.b8[6];
-	digest[6] = ctxt->h.b8[5]; digest[7] = ctxt->h.b8[4];
-	digest[8] = ctxt->h.b8[11]; digest[9] = ctxt->h.b8[10];
-	digest[10] = ctxt->h.b8[9]; digest[11] = ctxt->h.b8[8];
-	digest[12] = ctxt->h.b8[15]; digest[13] = ctxt->h.b8[14];
-	digest[14] = ctxt->h.b8[13]; digest[15] = ctxt->h.b8[12];
-	digest[16] = ctxt->h.b8[19]; digest[17] = ctxt->h.b8[18];
-	digest[18] = ctxt->h.b8[17]; digest[19] = ctxt->h.b8[16];
+	digest[0] = ctxt->h.b8[3];
+	digest[1] = ctxt->h.b8[2];
+	digest[2] = ctxt->h.b8[1];
+	digest[3] = ctxt->h.b8[0];
+	digest[4] = ctxt->h.b8[7];
+	digest[5] = ctxt->h.b8[6];
+	digest[6] = ctxt->h.b8[5];
+	digest[7] = ctxt->h.b8[4];
+	digest[8] = ctxt->h.b8[11];
+	digest[9] = ctxt->h.b8[10];
+	digest[10] = ctxt->h.b8[9];
+	digest[11] = ctxt->h.b8[8];
+	digest[12] = ctxt->h.b8[15];
+	digest[13] = ctxt->h.b8[14];
+	digest[14] = ctxt->h.b8[13];
+	digest[15] = ctxt->h.b8[12];
+	digest[16] = ctxt->h.b8[19];
+	digest[17] = ctxt->h.b8[18];
+	digest[18] = ctxt->h.b8[17];
+	digest[19] = ctxt->h.b8[16];
 #endif
 }
 
-#endif /*unsupported*/
+#endif	 /* unsupported */
diff --git a/contrib/pgcrypto/sha1.h b/contrib/pgcrypto/sha1.h
index cb08a1af83ebf7fb0dc243d8a61746963d3f7d77..cddc8651e4fa12d53370d942b81a1568a558e345 100644
--- a/contrib/pgcrypto/sha1.h
+++ b/contrib/pgcrypto/sha1.h
@@ -1,5 +1,5 @@
-/*	$Id: sha1.h,v 1.3 2001/01/09 16:07:13 momjian Exp $	*/
-/*     $KAME: sha1.h,v 1.4 2000/02/22 14:01:18 itojun Exp $    */
+/*	$Id: sha1.h,v 1.4 2001/03/22 03:59:10 momjian Exp $ */
+/*	   $KAME: sha1.h,v 1.4 2000/02/22 14:01:18 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -9,18 +9,18 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *	  notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.	IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -38,33 +38,38 @@
 #ifndef _NETINET6_SHA1_H_
 #define _NETINET6_SHA1_H_
 
-struct sha1_ctxt {
-	union {
+struct sha1_ctxt
+{
+	union
+	{
 		uint8		b8[20];
 		uint32		b32[5];
-	} h;
-	union {
+	}			h;
+	union
+	{
 		uint8		b8[8];
 		uint64		b64[1];
-	} c;
-	union {
+	}			c;
+	union
+	{
 		uint8		b8[64];
 		uint32		b32[16];
-	} m;
-	uint8			count;
+	}			m;
+	uint8		count;
 };
 
-extern void sha1_init (struct sha1_ctxt *);
-extern void sha1_pad (struct sha1_ctxt *);
-extern void sha1_loop (struct sha1_ctxt *, const caddr_t, size_t);
-extern void sha1_result (struct sha1_ctxt *, caddr_t);
+extern void sha1_init(struct sha1_ctxt *);
+extern void sha1_pad(struct sha1_ctxt *);
+extern void sha1_loop(struct sha1_ctxt *, const caddr_t, size_t);
+extern void sha1_result(struct sha1_ctxt *, caddr_t);
 
 /* compatibilty with other SHA1 source codes */
 typedef struct sha1_ctxt SHA1_CTX;
+
 #define SHA1Init(x)		sha1_init((x))
-#define SHA1Update(x, y, z)	sha1_loop((x), (y), (z))
+#define SHA1Update(x, y, z) sha1_loop((x), (y), (z))
 #define SHA1Final(x, y)		sha1_result((y), (x))
 
-#define	SHA1_RESULTLEN	(160/8)
+#define SHA1_RESULTLEN	(160/8)
 
-#endif /*_NETINET6_SHA1_H_*/
+#endif	 /* _NETINET6_SHA1_H_ */
diff --git a/contrib/rserv/rserv.c b/contrib/rserv/rserv.c
index 518dd68a539d5488deac454b3ed8a95876145015..4a7d3aed350d5d8a872d9368479b4bab1e00cb6b 100644
--- a/contrib/rserv/rserv.c
+++ b/contrib/rserv/rserv.c
@@ -16,18 +16,20 @@
 PG_FUNCTION_INFO_V1(_rserv_log_);
 PG_FUNCTION_INFO_V1(_rserv_sync_);
 PG_FUNCTION_INFO_V1(_rserv_debug_);
-Datum _rserv_log_(PG_FUNCTION_ARGS);
-Datum _rserv_sync_(PG_FUNCTION_ARGS);
-Datum _rserv_debug_(PG_FUNCTION_ARGS);
+Datum		_rserv_log_(PG_FUNCTION_ARGS);
+Datum		_rserv_sync_(PG_FUNCTION_ARGS);
+Datum		_rserv_debug_(PG_FUNCTION_ARGS);
+
 #else
 HeapTuple	_rserv_log_(void);
 int32		_rserv_sync_(int32);
 int32		_rserv_debug_(int32);
+
 #endif
 
 static int	debug = 0;
 
-static char* OutputValue(char *key, char *buf, int size);
+static char *OutputValue(char *key, char *buf, int size);
 
 #ifdef PG_FUNCTION_INFO_V1
 Datum
@@ -68,7 +70,7 @@ _rserv_log_()
 	nargs = trigger->tgnargs;
 	args = trigger->tgargs;
 
-	if (nargs != 1)			/* odd number of arguments! */
+	if (nargs != 1)				/* odd number of arguments! */
 		elog(ERROR, "_rserv_log_: need in *one* argument");
 
 	keynum = atoi(args[0]);
@@ -79,7 +81,7 @@ _rserv_log_()
 	rel = CurrentTriggerData->tg_relation;
 	tupdesc = rel->rd_att;
 
-	deleted = (TRIGGER_FIRED_BY_DELETE(CurrentTriggerData->tg_event)) ? 
+	deleted = (TRIGGER_FIRED_BY_DELETE(CurrentTriggerData->tg_event)) ?
 		1 : 0;
 
 	if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
@@ -115,7 +117,7 @@ _rserv_log_()
 		if (strcmp(newkey, key) == 0)
 			newkey = NULL;
 		else
-			deleted = 1;	/* old key was deleted */
+			deleted = 1;		/* old key was deleted */
 	}
 
 	if (strpbrk(key, "\\	\n'"))
@@ -124,7 +126,7 @@ _rserv_log_()
 		okey = key;
 
 	sprintf(sql, "update _RSERV_LOG_ set logid = %d, logtime = now(), "
-			"deleted = %d where reloid = %u and key = '%s'", 
+			"deleted = %d where reloid = %u and key = '%s'",
 			GetCurrentTransactionId(), deleted, rel->rd_id, okey);
 
 	if (debug)
@@ -145,7 +147,7 @@ _rserv_log_()
 		sprintf(sql, "insert into _RSERV_LOG_ "
 				"(reloid, logid, logtime, deleted, key) "
 				"values (%u, %d, now(), %d, '%s')",
-				rel->rd_id, GetCurrentTransactionId(), 
+				rel->rd_id, GetCurrentTransactionId(),
 				deleted, okey);
 
 		if (debug)
@@ -169,7 +171,7 @@ _rserv_log_()
 
 		sprintf(sql, "insert into _RSERV_LOG_ "
 				"(reloid, logid, logtime, deleted, key) "
-				"values (%u, %d, now(), 0, '%s')", 
+				"values (%u, %d, now(), 0, '%s')",
 				rel->rd_id, GetCurrentTransactionId(), okey);
 
 		if (debug)
@@ -202,13 +204,14 @@ _rserv_sync_(int32 server)
 #endif
 {
 #ifdef PG_FUNCTION_INFO_V1
-	int32 server = PG_GETARG_INT32(0);
+	int32		server = PG_GETARG_INT32(0);
+
 #endif
-	char	sql[8192];
-	char	buf[8192];
-	char   *active = buf;
-	uint32	xcnt;
-	int		ret;
+	char		sql[8192];
+	char		buf[8192];
+	char	   *active = buf;
+	uint32		xcnt;
+	int			ret;
 
 	if (SerializableSnapshot == NULL)
 		elog(ERROR, "_rserv_sync_: SerializableSnapshot is NULL");
@@ -217,7 +220,7 @@ _rserv_sync_(int32 server)
 	for (xcnt = 0; xcnt < SerializableSnapshot->xcnt; xcnt++)
 	{
 		sprintf(buf + strlen(buf), "%s%u", (xcnt) ? ", " : "",
-			SerializableSnapshot->xip[xcnt]);
+				SerializableSnapshot->xip[xcnt]);
 	}
 
 	if ((ret = SPI_connect()) < 0)
@@ -225,7 +228,7 @@ _rserv_sync_(int32 server)
 
 	sprintf(sql, "insert into _RSERV_SYNC_ "
 			"(server, syncid, synctime, status, minid, maxid, active) "
-			"values (%u, currval('_rserv_sync_seq_'), now(), 0, %d, %d, '%s')", 
+	  "values (%u, currval('_rserv_sync_seq_'), now(), 0, %d, %d, '%s')",
 			server, SerializableSnapshot->xmin, SerializableSnapshot->xmax, active);
 
 	ret = SPI_exec(sql, 0);
@@ -247,18 +250,19 @@ _rserv_debug_(int32 newval)
 #endif
 {
 #ifdef PG_FUNCTION_INFO_V1
-	int32	newval = PG_GETARG_INT32(0);
+	int32		newval = PG_GETARG_INT32(0);
+
 #endif
-	int32	oldval = debug;
+	int32		oldval = debug;
 
 	debug = newval;
 
 	return (oldval);
 }
 
-#define	ExtendBy	1024
+#define ExtendBy	1024
 
-static char*
+static char *
 OutputValue(char *key, char *buf, int size)
 {
 	int			i = 0;
@@ -267,39 +271,45 @@ OutputValue(char *key, char *buf, int size)
 	int			slen = 0;
 
 	size--;
-	for ( ; ; )
+	for (;;)
 	{
 		switch (*key)
 		{
-			case '\\':	subst ="\\\\";
-						slen = 2;
-						break;
-			case '	':	subst = "\\011";
-						slen = 4;
-						break;
-			case '\n':	subst = "\\012";
-						slen = 4;
-						break;
-			case '\'':	subst = "\\047";
-						slen = 4;
-						break;
-			case '\0':	out[i] = 0;
-						return(out);
-			default:	slen = 1;
-						break;
+			case '\\':
+				subst = "\\\\";
+				slen = 2;
+				break;
+			case '	':
+				subst = "\\011";
+				slen = 4;
+				break;
+			case '\n':
+				subst = "\\012";
+				slen = 4;
+				break;
+			case '\'':
+				subst = "\\047";
+				slen = 4;
+				break;
+			case '\0':
+				out[i] = 0;
+				return (out);
+			default:
+				slen = 1;
+				break;
 		}
 
 		if (i + slen >= size)
 		{
 			if (out == buf)
 			{
-				out = (char*) palloc(size + ExtendBy);
+				out = (char *) palloc(size + ExtendBy);
 				strncpy(out, buf, i);
 				size += ExtendBy;
 			}
 			else
 			{
-				out = (char*) repalloc(out, size + ExtendBy);
+				out = (char *) repalloc(out, size + ExtendBy);
 				size += ExtendBy;
 			}
 		}
@@ -314,6 +324,6 @@ OutputValue(char *key, char *buf, int size)
 		key++;
 	}
 
-	return(out);
+	return (out);
 
 }
diff --git a/contrib/seg/buffer.c b/contrib/seg/buffer.c
index f4dfc1edcd30d68a2b17e56628e5d62a7ecf3f1f..baeba5e51529807212bad1a861c399c30ac532f3 100644
--- a/contrib/seg/buffer.c
+++ b/contrib/seg/buffer.c
@@ -4,76 +4,81 @@
 
 #include "utils/elog.h"
 
-static char *       PARSE_BUFFER;
-static char *       PARSE_BUFFER_PTR; 
-static unsigned int PARSE_BUFFER_SIZE; 
+static char *PARSE_BUFFER;
+static char *PARSE_BUFFER_PTR;
+static unsigned int PARSE_BUFFER_SIZE;
 static unsigned int SCANNER_POS;
 
-void         set_parse_buffer( char* s );
-void         reset_parse_buffer( void );
-int          read_parse_buffer( void );
-char *       parse_buffer( void );
-char *       parse_buffer_ptr( void );
-unsigned int parse_buffer_curr_char( void );
-unsigned int parse_buffer_size( void );
-unsigned int parse_buffer_pos( void );
+void		set_parse_buffer(char *s);
+void		reset_parse_buffer(void);
+int			read_parse_buffer(void);
+char	   *parse_buffer(void);
+char	   *parse_buffer_ptr(void);
+unsigned int parse_buffer_curr_char(void);
+unsigned int parse_buffer_size(void);
+unsigned int parse_buffer_pos(void);
 
-extern void seg_flush_scanner_buffer(void); /* defined in segscan.l */
+extern void seg_flush_scanner_buffer(void);		/* defined in segscan.l */
 
-void set_parse_buffer( char* s )
+void
+set_parse_buffer(char *s)
 {
-  PARSE_BUFFER = s;
-  PARSE_BUFFER_SIZE = strlen(s);
-  if ( PARSE_BUFFER_SIZE == 0 ) {
-    elog(ERROR, "seg_in: can't parse an empty string");
-  }
-  PARSE_BUFFER_PTR = PARSE_BUFFER;
-  SCANNER_POS = 0;
+	PARSE_BUFFER = s;
+	PARSE_BUFFER_SIZE = strlen(s);
+	if (PARSE_BUFFER_SIZE == 0)
+		elog(ERROR, "seg_in: can't parse an empty string");
+	PARSE_BUFFER_PTR = PARSE_BUFFER;
+	SCANNER_POS = 0;
 }
 
-void reset_parse_buffer( void )
+void
+reset_parse_buffer(void)
 {
-  PARSE_BUFFER_PTR = PARSE_BUFFER;
-  SCANNER_POS = 0;
-  seg_flush_scanner_buffer();
+	PARSE_BUFFER_PTR = PARSE_BUFFER;
+	SCANNER_POS = 0;
+	seg_flush_scanner_buffer();
 }
 
-int read_parse_buffer( void )
+int
+read_parse_buffer(void)
 {
-  int c;
-  /*
-  c = *PARSE_BUFFER_PTR++;
-  SCANNER_POS++;
-  */
-  c = PARSE_BUFFER[SCANNER_POS];
-  if(SCANNER_POS < PARSE_BUFFER_SIZE)
-    SCANNER_POS++;
-  return c;
+	int			c;
+
+	/*
+	 * c = *PARSE_BUFFER_PTR++; SCANNER_POS++;
+	 */
+	c = PARSE_BUFFER[SCANNER_POS];
+	if (SCANNER_POS < PARSE_BUFFER_SIZE)
+		SCANNER_POS++;
+	return c;
 }
 
-char * parse_buffer( void )
+char *
+parse_buffer(void)
 {
-  return PARSE_BUFFER;
+	return PARSE_BUFFER;
 }
 
-unsigned int parse_buffer_curr_char( void )
+unsigned int
+parse_buffer_curr_char(void)
 {
-  return PARSE_BUFFER[SCANNER_POS];
+	return PARSE_BUFFER[SCANNER_POS];
 }
 
-char * parse_buffer_ptr( void )
+char *
+parse_buffer_ptr(void)
 {
-  return PARSE_BUFFER_PTR;
+	return PARSE_BUFFER_PTR;
 }
 
-unsigned int parse_buffer_pos( void )
+unsigned int
+parse_buffer_pos(void)
 {
-  return SCANNER_POS;
+	return SCANNER_POS;
 }
 
-unsigned int parse_buffer_size( void )
+unsigned int
+parse_buffer_size(void)
 {
-  return PARSE_BUFFER_SIZE;
+	return PARSE_BUFFER_SIZE;
 }
-
-
diff --git a/contrib/seg/buffer.h b/contrib/seg/buffer.h
index fd41a7b69b713e2b4dc23716af8905477ff8a379..eef9124dac5eff3cbbc4236b13970b4a6862cf46 100644
--- a/contrib/seg/buffer.h
+++ b/contrib/seg/buffer.h
@@ -1,8 +1,8 @@
-extern void set_parse_buffer( char* s );
-extern void reset_parse_buffer( void );
-extern int read_parse_buffer( void );
-extern char * parse_buffer( void );
-extern char * parse_buffer_ptr( void );
-extern unsigned int parse_buffer_curr_char( void );
-extern unsigned int parse_buffer_pos( void );
-extern unsigned int parse_buffer_size( void );
+extern void set_parse_buffer(char *s);
+extern void reset_parse_buffer(void);
+extern int	read_parse_buffer(void);
+extern char *parse_buffer(void);
+extern char *parse_buffer_ptr(void);
+extern unsigned int parse_buffer_curr_char(void);
+extern unsigned int parse_buffer_pos(void);
+extern unsigned int parse_buffer_size(void);
diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c
index 1609b42b1eaa11c90dba7e8d197ecc6898edece8..3ed7926389190689ab755e23edbcdee8b9f591b1 100644
--- a/contrib/seg/seg.c
+++ b/contrib/seg/seg.c
@@ -16,79 +16,80 @@
 
 #include "segdata.h"
 
-#define max(a,b)        ((a) >  (b) ? (a) : (b))
-#define min(a,b)        ((a) <= (b) ? (a) : (b))
-#define abs(a)          ((a) <  (0) ? (-a) : (a))
+#define max(a,b)		((a) >	(b) ? (a) : (b))
+#define min(a,b)		((a) <= (b) ? (a) : (b))
+#define abs(a)			((a) <	(0) ? (-a) : (a))
 
-/* 
+/*
 #define GIST_DEBUG
-#define GIST_QUERY_DEBUG 
+#define GIST_QUERY_DEBUG
 */
 
-extern void  set_parse_buffer(char *str);
-extern int   seg_yyparse();
+extern void set_parse_buffer(char *str);
+extern int	seg_yyparse();
+
 /*
-extern int   seg_yydebug;
+extern int	 seg_yydebug;
 */
 
 /*
 ** Input/Output routines
 */
-SEG *        seg_in(char *str);
-char *       seg_out(SEG *seg);
-float32      seg_lower(SEG *seg);
-float32      seg_upper(SEG *seg);
-float32      seg_center(SEG *seg);
+SEG		   *seg_in(char *str);
+char	   *seg_out(SEG * seg);
+float32		seg_lower(SEG * seg);
+float32		seg_upper(SEG * seg);
+float32		seg_center(SEG * seg);
 
-/* 
+/*
 ** GiST support methods
 */
-bool             gseg_consistent(GISTENTRY *entry, SEG *query, StrategyNumber strategy);
-GISTENTRY *      gseg_compress(GISTENTRY *entry);
-GISTENTRY *      gseg_decompress(GISTENTRY *entry);
-float *          gseg_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result);
-GIST_SPLITVEC *  gseg_picksplit(bytea *entryvec, GIST_SPLITVEC *v);
-bool             gseg_leaf_consistent(SEG *key, SEG *query, StrategyNumber strategy);
-bool             gseg_internal_consistent(SEG *key, SEG *query, StrategyNumber strategy);
-SEG *            gseg_union(bytea *entryvec, int *sizep);
-SEG *            gseg_binary_union(SEG *r1, SEG *r2, int *sizep);
-bool *           gseg_same(SEG *b1, SEG *b2, bool *result);
+bool		gseg_consistent(GISTENTRY *entry, SEG * query, StrategyNumber strategy);
+GISTENTRY  *gseg_compress(GISTENTRY *entry);
+GISTENTRY  *gseg_decompress(GISTENTRY *entry);
+float	   *gseg_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result);
+GIST_SPLITVEC *gseg_picksplit(bytea *entryvec, GIST_SPLITVEC *v);
+bool		gseg_leaf_consistent(SEG * key, SEG * query, StrategyNumber strategy);
+bool		gseg_internal_consistent(SEG * key, SEG * query, StrategyNumber strategy);
+SEG		   *gseg_union(bytea *entryvec, int *sizep);
+SEG		   *gseg_binary_union(SEG * r1, SEG * r2, int *sizep);
+bool	   *gseg_same(SEG * b1, SEG * b2, bool *result);
 
 
 /*
 ** R-tree suport functions
 */
-bool     seg_same(SEG *a, SEG *b);
-bool     seg_contains_int(SEG *a, int *b);
-bool     seg_contains_float4(SEG *a, float4 *b);
-bool     seg_contains_float8(SEG *a, float8 *b);
-bool     seg_contains(SEG *a, SEG *b);
-bool     seg_contained(SEG *a, SEG *b);
-bool     seg_overlap(SEG *a, SEG *b);
-bool     seg_left(SEG *a, SEG *b);
-bool     seg_over_left(SEG *a, SEG *b);
-bool     seg_right(SEG *a, SEG *b);
-bool     seg_over_right(SEG *a, SEG *b);
-SEG *    seg_union(SEG *a, SEG *b);
-SEG *    seg_inter(SEG *a, SEG *b);
-void     rt_seg_size(SEG *a, float* sz);
-float *  seg_size(SEG *a);
+bool		seg_same(SEG * a, SEG * b);
+bool		seg_contains_int(SEG * a, int *b);
+bool		seg_contains_float4(SEG * a, float4 *b);
+bool		seg_contains_float8(SEG * a, float8 *b);
+bool		seg_contains(SEG * a, SEG * b);
+bool		seg_contained(SEG * a, SEG * b);
+bool		seg_overlap(SEG * a, SEG * b);
+bool		seg_left(SEG * a, SEG * b);
+bool		seg_over_left(SEG * a, SEG * b);
+bool		seg_right(SEG * a, SEG * b);
+bool		seg_over_right(SEG * a, SEG * b);
+SEG		   *seg_union(SEG * a, SEG * b);
+SEG		   *seg_inter(SEG * a, SEG * b);
+void		rt_seg_size(SEG * a, float *sz);
+float	   *seg_size(SEG * a);
 
 /*
 ** Various operators
 */
-int32    seg_cmp(SEG *a, SEG *b);
-bool     seg_lt(SEG *a, SEG *b);
-bool     seg_le(SEG *a, SEG *b);
-bool     seg_gt(SEG *a, SEG *b);
-bool     seg_ge(SEG *a, SEG *b);
-bool     seg_different(SEG *a, SEG *b);
-
-/* 
+int32		seg_cmp(SEG * a, SEG * b);
+bool		seg_lt(SEG * a, SEG * b);
+bool		seg_le(SEG * a, SEG * b);
+bool		seg_gt(SEG * a, SEG * b);
+bool		seg_ge(SEG * a, SEG * b);
+bool		seg_different(SEG * a, SEG * b);
+
+/*
 ** Auxiliary funxtions
 */
-static int    restore(char *s, float val, int n);
-int    significant_digits (char* s);
+static int	restore(char *s, float val, int n);
+int			significant_digits(char *s);
 
 
 /*****************************************************************************
@@ -98,104 +99,113 @@ int    significant_digits (char* s);
 SEG *
 seg_in(char *str)
 {
-  SEG * result = palloc(sizeof(SEG));
-  set_parse_buffer( str );
-  
-  /*
-  seg_yydebug = 1;
-  */
-  if ( seg_yyparse(result) != 0 ) {
-    pfree ( result );
-    return NULL;
-  }  
-  return ( result );
+	SEG		   *result = palloc(sizeof(SEG));
+
+	set_parse_buffer(str);
+
+	/*
+	 * seg_yydebug = 1;
+	 */
+	if (seg_yyparse(result) != 0)
+	{
+		pfree(result);
+		return NULL;
+	}
+	return (result);
 }
 
 /*
  * You might have noticed a slight inconsistency between the following
  * declaration and the SQL definition:
- *     CREATE FUNCTION seg_out(opaque) RETURNS opaque ...
+ *	   CREATE FUNCTION seg_out(opaque) RETURNS opaque ...
  * The reason is that the argument passed into seg_out is really just a
  * pointer. POSTGRES thinks all output functions are:
- *     char *out_func(char *);
+ *	   char *out_func(char *);
  */
 char *
-seg_out(SEG *seg)
+seg_out(SEG * seg)
 {
-    char *result;
-    char *p;
-
-    if (seg == NULL) return(NULL);
-
-    p = result = (char *) palloc(40);
-
-    if ( seg->l_ext == '>' || seg->l_ext == '<' || seg->l_ext == '~' ) {
-      p += sprintf(p, "%c", seg->l_ext);
-    }
-      
-    if ( seg->lower == seg->upper && seg->l_ext == seg->u_ext ) {
-      /* indicates that this interval was built by seg_in off a single point */
-      p += restore(p, seg->lower, seg->l_sigd);
-    }
-    else {
-      if ( seg->l_ext != '-' ) {
-	/* print the lower boudary if exists */
-	p += restore(p, seg->lower, seg->l_sigd);
-	p += sprintf(p, " ");
-      }
-      p += sprintf(p, "..");
-      if ( seg->u_ext != '-' ) {
-	/* print the upper boudary if exists */
-	p += sprintf(p, " ");
-	if ( seg->u_ext == '>' || seg->u_ext == '<' || seg->l_ext == '~' ) {
-	  p += sprintf(p, "%c", seg->u_ext);
+	char	   *result;
+	char	   *p;
+
+	if (seg == NULL)
+		return (NULL);
+
+	p = result = (char *) palloc(40);
+
+	if (seg->l_ext == '>' || seg->l_ext == '<' || seg->l_ext == '~')
+		p += sprintf(p, "%c", seg->l_ext);
+
+	if (seg->lower == seg->upper && seg->l_ext == seg->u_ext)
+	{
+
+		/*
+		 * indicates that this interval was built by seg_in off a single
+		 * point
+		 */
+		p += restore(p, seg->lower, seg->l_sigd);
+	}
+	else
+	{
+		if (seg->l_ext != '-')
+		{
+			/* print the lower boudary if exists */
+			p += restore(p, seg->lower, seg->l_sigd);
+			p += sprintf(p, " ");
+		}
+		p += sprintf(p, "..");
+		if (seg->u_ext != '-')
+		{
+			/* print the upper boudary if exists */
+			p += sprintf(p, " ");
+			if (seg->u_ext == '>' || seg->u_ext == '<' || seg->l_ext == '~')
+				p += sprintf(p, "%c", seg->u_ext);
+			p += restore(p, seg->upper, seg->u_sigd);
+		}
 	}
-	p += restore(p, seg->upper, seg->u_sigd);
-      }
-    }
 
-    return(result);
+	return (result);
 }
 
 float32
-seg_center(SEG *seg)
+seg_center(SEG * seg)
 {
-        float32 result = (float32) palloc(sizeof(float32data));
+	float32		result = (float32) palloc(sizeof(float32data));
 
-        if (!seg)
-                return (float32) NULL;
+	if (!seg)
+		return (float32) NULL;
 
-        *result = ((float)seg->lower + (float)seg->upper)/2.0;
-        return (result);
+	*result = ((float) seg->lower + (float) seg->upper) / 2.0;
+	return (result);
 }
 
 float32
-seg_lower(SEG *seg)
+seg_lower(SEG * seg)
 {
-        float32 result = (float32) palloc(sizeof(float32data));
+	float32		result = (float32) palloc(sizeof(float32data));
 
-        if (!seg)
-                return (float32) NULL;
+	if (!seg)
+		return (float32) NULL;
 
-        *result = (float)seg->lower;
-        return (result);
+	*result = (float) seg->lower;
+	return (result);
 }
 
 float32
-seg_upper(SEG *seg)
+seg_upper(SEG * seg)
 {
-        float32 result = (float32) palloc(sizeof(float32data));
+	float32		result = (float32) palloc(sizeof(float32data));
 
-        if (!seg)
-                return (float32) NULL;
+	if (!seg)
+		return (float32) NULL;
 
-        *result = (float)seg->upper;
-        return (result);
+	*result = (float) seg->upper;
+	return (result);
 }
 
 
 /*****************************************************************************
- *                         GiST functions
+ *						   GiST functions
  *****************************************************************************/
 
 /*
@@ -204,19 +214,20 @@ seg_upper(SEG *seg)
 ** the predicate x op query == FALSE, where op is the oper
 ** corresponding to strategy in the pg_amop table.
 */
-bool 
+bool
 gseg_consistent(GISTENTRY *entry,
-	       SEG *query,
-	       StrategyNumber strategy)
+				SEG * query,
+				StrategyNumber strategy)
 {
-    /*
-    ** if entry is not leaf, use gseg_internal_consistent,
-    ** else use gseg_leaf_consistent
-    */
-    if (GIST_LEAF(entry))
-      return(gseg_leaf_consistent((SEG *)(entry->pred), query, strategy));
-    else
-      return(gseg_internal_consistent((SEG *)(entry->pred), query, strategy));
+
+	/*
+	 * * if entry is not leaf, use gseg_internal_consistent, * else use
+	 * gseg_leaf_consistent
+	 */
+	if (GIST_LEAF(entry))
+		return (gseg_leaf_consistent((SEG *) (entry->pred), query, strategy));
+	else
+		return (gseg_internal_consistent((SEG *) (entry->pred), query, strategy));
 }
 
 /*
@@ -226,49 +237,54 @@ gseg_consistent(GISTENTRY *entry,
 SEG *
 gseg_union(bytea *entryvec, int *sizep)
 {
-    int numranges, i;
-    SEG *out = (SEG *)NULL;
-    SEG *tmp;
+	int			numranges,
+				i;
+	SEG		   *out = (SEG *) NULL;
+	SEG		   *tmp;
 
 #ifdef GIST_DEBUG
-    fprintf(stderr, "union\n");
+	fprintf(stderr, "union\n");
 #endif
 
-    numranges = (VARSIZE(entryvec) - VARHDRSZ)/sizeof(GISTENTRY); 
-    tmp = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[0]).pred;
-    *sizep = sizeof(SEG);
+	numranges = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+	tmp = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[0]).pred;
+	*sizep = sizeof(SEG);
 
-    for (i = 1; i < numranges; i++) {
-	out = gseg_binary_union(tmp, (SEG *)
-				 (((GISTENTRY *)(VARDATA(entryvec)))[i]).pred,
-				 sizep);
+	for (i = 1; i < numranges; i++)
+	{
+		out = gseg_binary_union(tmp, (SEG *)
+						   (((GISTENTRY *) (VARDATA(entryvec)))[i]).pred,
+								sizep);
 #ifdef GIST_DEBUG
-	/*
-	fprintf(stderr, "\t%s ^ %s -> %s\n", seg_out(tmp), seg_out((SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[i]).pred), seg_out(out));
-	*/
+
+		/*
+		 * fprintf(stderr, "\t%s ^ %s -> %s\n", seg_out(tmp), seg_out((SEG
+		 * *)(((GISTENTRY *)(VARDATA(entryvec)))[i]).pred), seg_out(out));
+		 */
 #endif
 
-	if (i > 1) pfree(tmp);
-	tmp = out;
-    }
+		if (i > 1)
+			pfree(tmp);
+		tmp = out;
+	}
 
-    return(out);
+	return (out);
 }
 
 /*
 ** GiST Compress and Decompress methods for segments
 ** do not do anything.
 */
-GISTENTRY *
+GISTENTRY  *
 gseg_compress(GISTENTRY *entry)
 {
-    return(entry);
+	return (entry);
 }
 
-GISTENTRY *
+GISTENTRY  *
 gseg_decompress(GISTENTRY *entry)
 {
-    return(entry);
+	return (entry);
 }
 
 /*
@@ -278,287 +294,312 @@ gseg_decompress(GISTENTRY *entry)
 float *
 gseg_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result)
 {
-    Datum ud;
-    float tmp1, tmp2;
-    
-    ud = (Datum)seg_union((SEG *)(origentry->pred), (SEG *)(newentry->pred));
-    rt_seg_size((SEG *)ud, &tmp1);
-    rt_seg_size((SEG *)(origentry->pred), &tmp2);
-    *result = tmp1 - tmp2;
-    pfree((char *)ud);
+	Datum		ud;
+	float		tmp1,
+				tmp2;
+
+	ud = (Datum) seg_union((SEG *) (origentry->pred), (SEG *) (newentry->pred));
+	rt_seg_size((SEG *) ud, &tmp1);
+	rt_seg_size((SEG *) (origentry->pred), &tmp2);
+	*result = tmp1 - tmp2;
+	pfree((char *) ud);
 
 #ifdef GIST_DEBUG
-    fprintf(stderr, "penalty\n");
-    fprintf(stderr, "\t%g\n", *result);
+	fprintf(stderr, "penalty\n");
+	fprintf(stderr, "\t%g\n", *result);
 #endif
 
-    return(result);
+	return (result);
 }
 
 
 
 /*
 ** The GiST PickSplit method for segments
-** We use Guttman's poly time split algorithm 
+** We use Guttman's poly time split algorithm
 */
 GIST_SPLITVEC *
 gseg_picksplit(bytea *entryvec,
-	      GIST_SPLITVEC *v)
+			   GIST_SPLITVEC *v)
 {
-    OffsetNumber i, j;
-    SEG *datum_alpha, *datum_beta;
-    SEG *datum_l, *datum_r;
-    SEG *union_d, *union_dl, *union_dr;
-    SEG *inter_d;
-    bool firsttime;
-    float size_alpha, size_beta, size_union, size_inter;
-    float size_waste, waste;
-    float size_l, size_r;
-    int nbytes;
-    OffsetNumber seed_1 = 0, seed_2 = 0;
-    OffsetNumber *left, *right;
-    OffsetNumber maxoff;
+	OffsetNumber i,
+				j;
+	SEG		   *datum_alpha,
+			   *datum_beta;
+	SEG		   *datum_l,
+			   *datum_r;
+	SEG		   *union_d,
+			   *union_dl,
+			   *union_dr;
+	SEG		   *inter_d;
+	bool		firsttime;
+	float		size_alpha,
+				size_beta,
+				size_union,
+				size_inter;
+	float		size_waste,
+				waste;
+	float		size_l,
+				size_r;
+	int			nbytes;
+	OffsetNumber seed_1 = 0,
+				seed_2 = 0;
+	OffsetNumber *left,
+			   *right;
+	OffsetNumber maxoff;
 
 #ifdef GIST_DEBUG
-    fprintf(stderr, "picksplit\n");
+	fprintf(stderr, "picksplit\n");
 #endif
 
-    maxoff = ((VARSIZE(entryvec) - VARHDRSZ)/sizeof(GISTENTRY)) - 2;
-    nbytes =  (maxoff + 2) * sizeof(OffsetNumber);
-    v->spl_left = (OffsetNumber *) palloc(nbytes);
-    v->spl_right = (OffsetNumber *) palloc(nbytes);
-    
-    firsttime = true;
-    waste = 0.0;
-    
-    for (i = FirstOffsetNumber; i < maxoff; i = OffsetNumberNext(i)) {
-	datum_alpha = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[i].pred);
-	for (j = OffsetNumberNext(i); j <= maxoff; j = OffsetNumberNext(j)) {
-	    datum_beta = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[j].pred);
-	    
-	    /* compute the wasted space by unioning these guys */
-	    /* size_waste = size_union - size_inter; */
-	    union_d = (SEG *)seg_union(datum_alpha, datum_beta);
-	    rt_seg_size(union_d, &size_union);
-	    inter_d = (SEG *)seg_inter(datum_alpha, datum_beta);
-	    rt_seg_size(inter_d, &size_inter);
-	    size_waste = size_union - size_inter;
-	    
-	    pfree(union_d);
-	    
-	    if (inter_d != (SEG *) NULL)
-		pfree(inter_d);
-	    
-	    /*
-	     *  are these a more promising split that what we've
-	     *  already seen?
-	     */
-	    
-	    if (size_waste > waste || firsttime) {
-		waste = size_waste;
-		seed_1 = i;
-		seed_2 = j;
-		firsttime = false;
-	    }
+	maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 2;
+	nbytes = (maxoff + 2) * sizeof(OffsetNumber);
+	v->spl_left = (OffsetNumber *) palloc(nbytes);
+	v->spl_right = (OffsetNumber *) palloc(nbytes);
+
+	firsttime = true;
+	waste = 0.0;
+
+	for (i = FirstOffsetNumber; i < maxoff; i = OffsetNumberNext(i))
+	{
+		datum_alpha = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[i].pred);
+		for (j = OffsetNumberNext(i); j <= maxoff; j = OffsetNumberNext(j))
+		{
+			datum_beta = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[j].pred);
+
+			/* compute the wasted space by unioning these guys */
+			/* size_waste = size_union - size_inter; */
+			union_d = (SEG *) seg_union(datum_alpha, datum_beta);
+			rt_seg_size(union_d, &size_union);
+			inter_d = (SEG *) seg_inter(datum_alpha, datum_beta);
+			rt_seg_size(inter_d, &size_inter);
+			size_waste = size_union - size_inter;
+
+			pfree(union_d);
+
+			if (inter_d != (SEG *) NULL)
+				pfree(inter_d);
+
+			/*
+			 * are these a more promising split that what we've already
+			 * seen?
+			 */
+
+			if (size_waste > waste || firsttime)
+			{
+				waste = size_waste;
+				seed_1 = i;
+				seed_2 = j;
+				firsttime = false;
+			}
+		}
 	}
-    }
-    
-    left = v->spl_left;
-    v->spl_nleft = 0;
-    right = v->spl_right;
-    v->spl_nright = 0;
-    
-    datum_alpha = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[seed_1].pred);
-    datum_l = (SEG *)seg_union(datum_alpha, datum_alpha);
-    rt_seg_size((SEG *)datum_l, &size_l);
-    datum_beta = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[seed_2].pred);;
-    datum_r = (SEG *)seg_union(datum_beta, datum_beta);
-    rt_seg_size((SEG *)datum_r, &size_r);
-    
-    /*
-     *  Now split up the regions between the two seeds.  An important
-     *  property of this split algorithm is that the split vector v
-     *  has the indices of items to be split in order in its left and
-     *  right vectors.  We exploit this property by doing a merge in
-     *  the code that actually splits the page.
-     *
-     *  For efficiency, we also place the new index tuple in this loop.
-     *  This is handled at the very end, when we have placed all the
-     *  existing tuples and i == maxoff + 1.
-     */
-    
-    maxoff = OffsetNumberNext(maxoff);
-    for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
-	
+
+	left = v->spl_left;
+	v->spl_nleft = 0;
+	right = v->spl_right;
+	v->spl_nright = 0;
+
+	datum_alpha = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[seed_1].pred);
+	datum_l = (SEG *) seg_union(datum_alpha, datum_alpha);
+	rt_seg_size((SEG *) datum_l, &size_l);
+	datum_beta = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[seed_2].pred);;
+	datum_r = (SEG *) seg_union(datum_beta, datum_beta);
+	rt_seg_size((SEG *) datum_r, &size_r);
+
 	/*
-	 *  If we've already decided where to place this item, just
-	 *  put it on the right list.  Otherwise, we need to figure
-	 *  out which page needs the least enlargement in order to
-	 *  store the item.
+	 * Now split up the regions between the two seeds.	An important
+	 * property of this split algorithm is that the split vector v has the
+	 * indices of items to be split in order in its left and right
+	 * vectors.  We exploit this property by doing a merge in the code
+	 * that actually splits the page.
+	 *
+	 * For efficiency, we also place the new index tuple in this loop. This
+	 * is handled at the very end, when we have placed all the existing
+	 * tuples and i == maxoff + 1.
 	 */
-	
-	if (i == seed_1) {
-	    *left++ = i;
-	    v->spl_nleft++;
-	    continue;
-	} else if (i == seed_2) {
-	    *right++ = i;
-	    v->spl_nright++;
-	    continue;
-	}
-	
-	/* okay, which page needs least enlargement? */ 
-	datum_alpha = (SEG *)(((GISTENTRY *)(VARDATA(entryvec)))[i].pred);
-	union_dl = (SEG *)seg_union(datum_l, datum_alpha);
-	union_dr = (SEG *)seg_union(datum_r, datum_alpha);
-	rt_seg_size((SEG *)union_dl, &size_alpha);
-	rt_seg_size((SEG *)union_dr, &size_beta);
-	
-	/* pick which page to add it to */
-	if (size_alpha - size_l < size_beta - size_r) {
-	    pfree(datum_l);
-	    pfree(union_dr);
-	    datum_l = union_dl;
-	    size_l = size_alpha;
-	    *left++ = i;
-	    v->spl_nleft++;
-	} else {
-	    pfree(datum_r);
-	    pfree(union_dl);
-	    datum_r = union_dr;
-	    size_r = size_alpha;
-	    *right++ = i;
-	    v->spl_nright++;
+
+	maxoff = OffsetNumberNext(maxoff);
+	for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+	{
+
+		/*
+		 * If we've already decided where to place this item, just put it
+		 * on the right list.  Otherwise, we need to figure out which page
+		 * needs the least enlargement in order to store the item.
+		 */
+
+		if (i == seed_1)
+		{
+			*left++ = i;
+			v->spl_nleft++;
+			continue;
+		}
+		else if (i == seed_2)
+		{
+			*right++ = i;
+			v->spl_nright++;
+			continue;
+		}
+
+		/* okay, which page needs least enlargement? */
+		datum_alpha = (SEG *) (((GISTENTRY *) (VARDATA(entryvec)))[i].pred);
+		union_dl = (SEG *) seg_union(datum_l, datum_alpha);
+		union_dr = (SEG *) seg_union(datum_r, datum_alpha);
+		rt_seg_size((SEG *) union_dl, &size_alpha);
+		rt_seg_size((SEG *) union_dr, &size_beta);
+
+		/* pick which page to add it to */
+		if (size_alpha - size_l < size_beta - size_r)
+		{
+			pfree(datum_l);
+			pfree(union_dr);
+			datum_l = union_dl;
+			size_l = size_alpha;
+			*left++ = i;
+			v->spl_nleft++;
+		}
+		else
+		{
+			pfree(datum_r);
+			pfree(union_dl);
+			datum_r = union_dr;
+			size_r = size_alpha;
+			*right++ = i;
+			v->spl_nright++;
+		}
 	}
-    }
-    *left = *right = FirstOffsetNumber;	/* sentinel value, see dosplit() */
-    
-    v->spl_ldatum = (char *)datum_l;
-    v->spl_rdatum = (char *)datum_r;
+	*left = *right = FirstOffsetNumber; /* sentinel value, see dosplit() */
+
+	v->spl_ldatum = (char *) datum_l;
+	v->spl_rdatum = (char *) datum_r;
 
-    return v;
+	return v;
 }
 
 /*
 ** Equality methods
 */
 bool *
-gseg_same(SEG *b1, SEG *b2, bool *result)
+gseg_same(SEG * b1, SEG * b2, bool *result)
 {
-  if (seg_same(b1, b2))
-    *result = TRUE;
-  else *result = FALSE;
+	if (seg_same(b1, b2))
+		*result = TRUE;
+	else
+		*result = FALSE;
 
 #ifdef GIST_DEBUG
-  fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE" ));
+	fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE"));
 #endif
 
-  return(result);
+	return (result);
 }
 
-/* 
+/*
 ** SUPPORT ROUTINES
 */
-bool 
-gseg_leaf_consistent(SEG *key,
-		     SEG *query,
-		     StrategyNumber strategy)
+bool
+gseg_leaf_consistent(SEG * key,
+					 SEG * query,
+					 StrategyNumber strategy)
 {
-    bool retval;
+	bool		retval;
 
 #ifdef GIST_QUERY_DEBUG
-  fprintf(stderr, "leaf_consistent, %d\n", strategy);
+	fprintf(stderr, "leaf_consistent, %d\n", strategy);
 #endif
 
-    switch(strategy) {
-    case RTLeftStrategyNumber:
-      retval = (bool)seg_left(key, query);
-      break;
-    case RTOverLeftStrategyNumber:
-      retval = (bool)seg_over_left(key,query);
-      break;
-    case RTOverlapStrategyNumber:
-      retval = (bool)seg_overlap(key, query);
-      break;
-    case RTOverRightStrategyNumber:
-      retval = (bool)seg_over_right(key, query);
-      break;
-    case RTRightStrategyNumber:
-      retval = (bool)seg_right(key, query);
-      break;
-    case RTSameStrategyNumber:
-      retval = (bool)seg_same(key, query);
-      break;
-    case RTContainsStrategyNumber:
-      retval = (bool)seg_contains(key, query);
-      break;
-    case RTContainedByStrategyNumber:
-      retval = (bool)seg_contained(key,query);
-      break;
-    default:
-      retval = FALSE;
-    }
-    return(retval);
+	switch (strategy)
+	{
+		case RTLeftStrategyNumber:
+			retval = (bool) seg_left(key, query);
+			break;
+		case RTOverLeftStrategyNumber:
+			retval = (bool) seg_over_left(key, query);
+			break;
+		case RTOverlapStrategyNumber:
+			retval = (bool) seg_overlap(key, query);
+			break;
+		case RTOverRightStrategyNumber:
+			retval = (bool) seg_over_right(key, query);
+			break;
+		case RTRightStrategyNumber:
+			retval = (bool) seg_right(key, query);
+			break;
+		case RTSameStrategyNumber:
+			retval = (bool) seg_same(key, query);
+			break;
+		case RTContainsStrategyNumber:
+			retval = (bool) seg_contains(key, query);
+			break;
+		case RTContainedByStrategyNumber:
+			retval = (bool) seg_contained(key, query);
+			break;
+		default:
+			retval = FALSE;
+	}
+	return (retval);
 }
 
-bool 
-gseg_internal_consistent(SEG *key,
-			SEG *query,
-			StrategyNumber strategy)
+bool
+gseg_internal_consistent(SEG * key,
+						 SEG * query,
+						 StrategyNumber strategy)
 {
-    bool retval;
+	bool		retval;
 
 #ifdef GIST_QUERY_DEBUG
-  fprintf(stderr, "internal_consistent, %d\n", strategy);
+	fprintf(stderr, "internal_consistent, %d\n", strategy);
 #endif
 
-    switch(strategy) {
-    case RTLeftStrategyNumber:
-    case RTOverLeftStrategyNumber:
-      retval = (bool)seg_over_left(key,query);
-      break;
-    case RTOverlapStrategyNumber:
-      retval = (bool)seg_overlap(key, query);
-      break;
-    case RTOverRightStrategyNumber:
-    case RTRightStrategyNumber:
-      retval = (bool)seg_right(key, query);
-      break;
-    case RTSameStrategyNumber:
-    case RTContainsStrategyNumber:
-      retval = (bool)seg_contains(key, query);
-      break;
-    case RTContainedByStrategyNumber:
-      retval = (bool)seg_overlap(key, query);
-      break;
-    default:
-      retval = FALSE;
-    }
-    return(retval);
+	switch (strategy)
+	{
+		case RTLeftStrategyNumber:
+		case RTOverLeftStrategyNumber:
+			retval = (bool) seg_over_left(key, query);
+			break;
+		case RTOverlapStrategyNumber:
+			retval = (bool) seg_overlap(key, query);
+			break;
+		case RTOverRightStrategyNumber:
+		case RTRightStrategyNumber:
+			retval = (bool) seg_right(key, query);
+			break;
+		case RTSameStrategyNumber:
+		case RTContainsStrategyNumber:
+			retval = (bool) seg_contains(key, query);
+			break;
+		case RTContainedByStrategyNumber:
+			retval = (bool) seg_overlap(key, query);
+			break;
+		default:
+			retval = FALSE;
+	}
+	return (retval);
 }
 
 SEG *
-gseg_binary_union(SEG *r1, SEG *r2, int *sizep)
+gseg_binary_union(SEG * r1, SEG * r2, int *sizep)
 {
-    SEG *retval;
+	SEG		   *retval;
 
-    retval = seg_union(r1, r2);
-    *sizep = sizeof(SEG);
+	retval = seg_union(r1, r2);
+	*sizep = sizeof(SEG);
 
-    return (retval);
+	return (retval);
 }
 
 
 bool
-seg_contains(SEG *a, SEG *b)
+seg_contains(SEG * a, SEG * b)
 {
-  return ( (a->lower <= b->lower) && (a->upper >= b->upper) );
+	return ((a->lower <= b->lower) && (a->upper >= b->upper));
 }
 
 bool
-seg_contained(SEG *a, SEG *b)
+seg_contained(SEG * a, SEG * b)
 {
-  return ( seg_contains(b, a) );
+	return (seg_contains(b, a));
 }
 
 /*****************************************************************************
@@ -566,209 +607,214 @@ seg_contained(SEG *a, SEG *b)
  *****************************************************************************/
 
 bool
-seg_same(SEG *a, SEG *b)
+seg_same(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) == 0;
+	return seg_cmp(a, b) == 0;
 }
 
-/*  seg_overlap -- does a overlap b?
+/*	seg_overlap -- does a overlap b?
  */
 bool
-seg_overlap(SEG *a, SEG *b)
+seg_overlap(SEG * a, SEG * b)
 {
-  return (
-	  ((a->upper >= b->upper) && (a->lower <= b->upper)) 
-	  ||
-	  ((b->upper >= a->upper) && (b->lower <= a->upper))
-	  );
+	return (
+			((a->upper >= b->upper) && (a->lower <= b->upper))
+			||
+			((b->upper >= a->upper) && (b->lower <= a->upper))
+	);
 }
 
-/*  seg_overleft -- is the right edge of (a) located to the left of the right edge of (b)?
+/*	seg_overleft -- is the right edge of (a) located to the left of the right edge of (b)?
  */
 bool
-seg_over_left(SEG *a, SEG *b)
+seg_over_left(SEG * a, SEG * b)
 {
-        return ( a->upper <= b->upper && !seg_left(a, b) && !seg_right(a, b));
+	return (a->upper <= b->upper && !seg_left(a, b) && !seg_right(a, b));
 }
 
-/*  seg_left -- is (a) entirely on the left of (b)?
+/*	seg_left -- is (a) entirely on the left of (b)?
  */
 bool
-seg_left(SEG *a, SEG *b)
+seg_left(SEG * a, SEG * b)
 {
-        return ( a->upper < b->lower );
+	return (a->upper < b->lower);
 }
 
-/*  seg_right -- is (a) entirely on the right of (b)?
+/*	seg_right -- is (a) entirely on the right of (b)?
  */
 bool
-seg_right(SEG *a, SEG *b)
+seg_right(SEG * a, SEG * b)
 {
-        return ( a->lower > b->upper );
+	return (a->lower > b->upper);
 }
 
-/*  seg_overright -- is the left edge of (a) located to the right of the left edge of (b)?
+/*	seg_overright -- is the left edge of (a) located to the right of the left edge of (b)?
  */
 bool
-seg_over_right(SEG *a, SEG *b)
+seg_over_right(SEG * a, SEG * b)
 {
-        return (a->lower >= b->lower && !seg_left(a, b) && !seg_right(a, b));
+	return (a->lower >= b->lower && !seg_left(a, b) && !seg_right(a, b));
 }
 
 
 SEG *
-seg_union(SEG *a, SEG *b)
+seg_union(SEG * a, SEG * b)
 {
-  SEG *n;
-  
-  n = (SEG *) palloc(sizeof(*n));
-
-  /* take max of upper endpoints */
-  if (a->upper > b->upper)
-  {
-	  n->upper = a->upper;
-	  n->u_sigd = a->u_sigd;
-	  n->u_ext = a->u_ext;
-  }
-  else
-  {
-	  n->upper = b->upper;
-	  n->u_sigd = b->u_sigd;
-	  n->u_ext = b->u_ext;
-  }
-
-  /* take min of lower endpoints */
-  if (a->lower < b->lower)
-  {
-	  n->lower = a->lower;
-	  n->l_sigd = a->l_sigd;
-	  n->l_ext = a->l_ext;
-  }
-  else
-  {
-	  n->lower = b->lower;
-	  n->l_sigd = b->l_sigd;
-	  n->l_ext = b->l_ext;
-  }
-
-  return (n);
+	SEG		   *n;
+
+	n = (SEG *) palloc(sizeof(*n));
+
+	/* take max of upper endpoints */
+	if (a->upper > b->upper)
+	{
+		n->upper = a->upper;
+		n->u_sigd = a->u_sigd;
+		n->u_ext = a->u_ext;
+	}
+	else
+	{
+		n->upper = b->upper;
+		n->u_sigd = b->u_sigd;
+		n->u_ext = b->u_ext;
+	}
+
+	/* take min of lower endpoints */
+	if (a->lower < b->lower)
+	{
+		n->lower = a->lower;
+		n->l_sigd = a->l_sigd;
+		n->l_ext = a->l_ext;
+	}
+	else
+	{
+		n->lower = b->lower;
+		n->l_sigd = b->l_sigd;
+		n->l_ext = b->l_ext;
+	}
+
+	return (n);
 }
 
 
 SEG *
-seg_inter(SEG *a, SEG *b)
+seg_inter(SEG * a, SEG * b)
 {
-  SEG *n;
-  
-  n = (SEG *) palloc(sizeof(*n));
-
-  /* take min of upper endpoints */
-  if (a->upper < b->upper)
-  {
-	  n->upper = a->upper;
-	  n->u_sigd = a->u_sigd;
-	  n->u_ext = a->u_ext;
-  }
-  else
-  {
-	  n->upper = b->upper;
-	  n->u_sigd = b->u_sigd;
-	  n->u_ext = b->u_ext;
-  }
-
-  /* take max of lower endpoints */
-  if (a->lower > b->lower)
-  {
-	  n->lower = a->lower;
-	  n->l_sigd = a->l_sigd;
-	  n->l_ext = a->l_ext;
-  }
-  else
-  {
-	  n->lower = b->lower;
-	  n->l_sigd = b->l_sigd;
-	  n->l_ext = b->l_ext;
-  }
-
-  return (n);
+	SEG		   *n;
+
+	n = (SEG *) palloc(sizeof(*n));
+
+	/* take min of upper endpoints */
+	if (a->upper < b->upper)
+	{
+		n->upper = a->upper;
+		n->u_sigd = a->u_sigd;
+		n->u_ext = a->u_ext;
+	}
+	else
+	{
+		n->upper = b->upper;
+		n->u_sigd = b->u_sigd;
+		n->u_ext = b->u_ext;
+	}
+
+	/* take max of lower endpoints */
+	if (a->lower > b->lower)
+	{
+		n->lower = a->lower;
+		n->l_sigd = a->l_sigd;
+		n->l_ext = a->l_ext;
+	}
+	else
+	{
+		n->lower = b->lower;
+		n->l_sigd = b->l_sigd;
+		n->l_ext = b->l_ext;
+	}
+
+	return (n);
 }
 
 void
-rt_seg_size(SEG *a, float *size)
+rt_seg_size(SEG * a, float *size)
 {
-  if (a == (SEG *) NULL || a->upper <= a->lower)
-    *size = 0.0;
-  else
-    *size = (float) abs(a->upper - a->lower);
-  
-  return;
+	if (a == (SEG *) NULL || a->upper <= a->lower)
+		*size = 0.0;
+	else
+		*size = (float) abs(a->upper - a->lower);
+
+	return;
 }
 
 float *
-seg_size(SEG *a)
+seg_size(SEG * a)
 {
-  float *result;
+	float	   *result;
+
+	result = (float *) palloc(sizeof(float));
 
-  result = (float *) palloc(sizeof(float));
-  
-  *result = (float) abs(a->upper - a->lower);
+	*result = (float) abs(a->upper - a->lower);
 
-  return(result);
+	return (result);
 }
 
 
 /*****************************************************************************
- *                 Miscellaneous operators
+ *				   Miscellaneous operators
  *****************************************************************************/
 int32
-seg_cmp(SEG *a, SEG *b)
+seg_cmp(SEG * a, SEG * b)
 {
+
 	/*
 	 * First compare on lower boundary position
 	 */
-	if ( a->lower < b->lower )
+	if (a->lower < b->lower)
 		return -1;
-	if ( a->lower > b->lower )
+	if (a->lower > b->lower)
 		return 1;
+
 	/*
 	 * a->lower == b->lower, so consider type of boundary.
 	 *
-	 * A '-' lower bound is < any other kind (this could only be relevant
-	 * if -HUGE is used as a regular data value).
-	 * A '<' lower bound is < any other kind except '-'.
-	 * A '>' lower bound is > any other kind.
+	 * A '-' lower bound is < any other kind (this could only be relevant if
+	 * -HUGE is used as a regular data value). A '<' lower bound is < any
+	 * other kind except '-'. A '>' lower bound is > any other kind.
 	 */
-	if ( a->l_ext != b->l_ext )
+	if (a->l_ext != b->l_ext)
 	{
-		if ( a->l_ext == '-')
+		if (a->l_ext == '-')
 			return -1;
-		if ( b->l_ext == '-')
+		if (b->l_ext == '-')
 			return 1;
-		if ( a->l_ext == '<')
+		if (a->l_ext == '<')
 			return -1;
-		if ( b->l_ext == '<')
+		if (b->l_ext == '<')
 			return 1;
-		if ( a->l_ext == '>')
+		if (a->l_ext == '>')
 			return 1;
-		if ( b->l_ext == '>')
+		if (b->l_ext == '>')
 			return -1;
 	}
+
 	/*
 	 * For other boundary types, consider # of significant digits first.
 	 */
-	if ( a->l_sigd < b->l_sigd ) /* (a) is blurred and is likely to include (b) */
+	if (a->l_sigd < b->l_sigd)	/* (a) is blurred and is likely to include
+								 * (b) */
 		return -1;
-	if ( a->l_sigd > b->l_sigd ) /* (a) is less blurred and is likely to be included in (b) */
+	if (a->l_sigd > b->l_sigd)	/* (a) is less blurred and is likely to be
+								 * included in (b) */
 		return 1;
+
 	/*
 	 * For same # of digits, an approximate boundary is more blurred than
 	 * exact.
 	 */
-	if ( a->l_ext != b->l_ext )
+	if (a->l_ext != b->l_ext)
 	{
-		if ( a->l_ext == '~' ) /* (a) is approximate, while (b) is exact */
+		if (a->l_ext == '~')	/* (a) is approximate, while (b) is exact */
 			return -1;
-		if ( b->l_ext == '~' )
+		if (b->l_ext == '~')
 			return 1;
 		/* can't get here unless data is corrupt */
 		elog(ERROR, "seg_cmp: bogus lower boundary types %d %d",
@@ -780,50 +826,54 @@ seg_cmp(SEG *a, SEG *b)
 	/*
 	 * First compare on upper boundary position
 	 */
-	if ( a->upper < b->upper )
+	if (a->upper < b->upper)
 		return -1;
-	if ( a->upper > b->upper )
+	if (a->upper > b->upper)
 		return 1;
+
 	/*
 	 * a->upper == b->upper, so consider type of boundary.
 	 *
-	 * A '-' upper bound is > any other kind (this could only be relevant
-	 * if HUGE is used as a regular data value).
-	 * A '<' upper bound is < any other kind.
-	 * A '>' upper bound is > any other kind except '-'.
+	 * A '-' upper bound is > any other kind (this could only be relevant if
+	 * HUGE is used as a regular data value). A '<' upper bound is < any
+	 * other kind. A '>' upper bound is > any other kind except '-'.
 	 */
-	if ( a->u_ext != b->u_ext )
+	if (a->u_ext != b->u_ext)
 	{
-		if ( a->u_ext == '-')
+		if (a->u_ext == '-')
 			return 1;
-		if ( b->u_ext == '-')
+		if (b->u_ext == '-')
 			return -1;
-		if ( a->u_ext == '<')
+		if (a->u_ext == '<')
 			return -1;
-		if ( b->u_ext == '<')
+		if (b->u_ext == '<')
 			return 1;
-		if ( a->u_ext == '>')
+		if (a->u_ext == '>')
 			return 1;
-		if ( b->u_ext == '>')
+		if (b->u_ext == '>')
 			return -1;
 	}
+
 	/*
 	 * For other boundary types, consider # of significant digits first.
 	 * Note result here is converse of the lower-boundary case.
 	 */
-	if ( a->u_sigd < b->u_sigd ) /* (a) is blurred and is likely to include (b) */
+	if (a->u_sigd < b->u_sigd)	/* (a) is blurred and is likely to include
+								 * (b) */
 		return 1;
-	if ( a->u_sigd > b->u_sigd ) /* (a) is less blurred and is likely to be included in (b) */
+	if (a->u_sigd > b->u_sigd)	/* (a) is less blurred and is likely to be
+								 * included in (b) */
 		return -1;
+
 	/*
 	 * For same # of digits, an approximate boundary is more blurred than
 	 * exact.  Again, result is converse of lower-boundary case.
 	 */
-	if ( a->u_ext != b->u_ext )
+	if (a->u_ext != b->u_ext)
 	{
-		if ( a->u_ext == '~' ) /* (a) is approximate, while (b) is exact */
+		if (a->u_ext == '~')	/* (a) is approximate, while (b) is exact */
 			return 1;
-		if ( b->u_ext == '~' )
+		if (b->u_ext == '~')
 			return -1;
 		/* can't get here unless data is corrupt */
 		elog(ERROR, "seg_cmp: bogus upper boundary types %d %d",
@@ -834,40 +884,40 @@ seg_cmp(SEG *a, SEG *b)
 }
 
 bool
-seg_lt(SEG *a, SEG *b)
+seg_lt(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) < 0;
+	return seg_cmp(a, b) < 0;
 }
 
 bool
-seg_le(SEG *a, SEG *b)
+seg_le(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) <= 0;
+	return seg_cmp(a, b) <= 0;
 }
 
 bool
-seg_gt(SEG *a, SEG *b)
+seg_gt(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) > 0;
+	return seg_cmp(a, b) > 0;
 }
 
 
 bool
-seg_ge(SEG *a, SEG *b)
+seg_ge(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) >= 0;
+	return seg_cmp(a, b) >= 0;
 }
 
 bool
-seg_different(SEG *a, SEG *b)
+seg_different(SEG * a, SEG * b)
 {
-  return seg_cmp(a, b) != 0;
+	return seg_cmp(a, b) != 0;
 }
 
 
 
 /*****************************************************************************
- *                 Auxiliary functions
+ *				   Auxiliary functions
  *****************************************************************************/
 
 /* The purpose of this routine is to print the floating point
@@ -875,126 +925,150 @@ seg_different(SEG *a, SEG *b)
  * is similar to %.ng except it prints 8.00 where %.ng would
  * print 8
  */
-static int restore ( char * result, float val, int n )
+static int
+restore(char *result, float val, int n)
 {
-  static char efmt[8] = {'%', '-', '1', '5', '.', '#', 'e', 0};
-  char buf[25] = {
-    '0', '0', '0', '0', '0',
-    '0', '0', '0', '0', '0',
-    '0', '0', '0', '0', '0',
-    '0', '0', '0', '0', '0',
-    '0', '0', '0', '0', '\0'
-  };
-  char *p;
-  char *mant;
-  int exp;
-  int i, dp, sign;
- 
-  /* put a cap on the number of siugnificant digits to avoid
-     nonsense in the output */
-  n = min(n, FLT_DIG);
-
-  /* remember the sign */
-  sign = ( val < 0 ? 1 : 0 );
-
-  efmt[5] = '0' + (n-1)%10; /* makes %-15.(n-1)e -- this format guarantees that 
-			     the exponent is always present */
-
-  sprintf(result, efmt, val);
-
-  /* trim the spaces left by the %e */
-  for( p = result; *p != ' '; p++ ); *p = '\0';
-
-  /* get the exponent */
-  mant = (char *)strtok( strdup(result), "e" );
-  exp = atoi(strtok( NULL, "e" ));
-
-  if ( exp == 0 ) {
-    /* use the supplied mantyssa with sign */
-    strcpy((char *)index(result, 'e'), "");
-  }
-  else {
-    if ( abs( exp ) <= 4 ) {
-      /* remove the decimal point from the mantyssa and write the digits to the buf array */
-      for( p = result + sign, i = 10, dp = 0; *p != 'e'; p++, i++ ) {
-	buf[i] = *p;
-	if( *p == '.' ) {
-	  dp = i--; /* skip the decimal point */
-	}
-      }
-      if (dp == 0) dp = i--; /* no decimal point was found in the above for() loop */
-  
-      if ( exp > 0 ) {
-	if ( dp - 10 + exp >= n ) { 
-	  /* 
-	     the decimal point is behind the last significant digit;
-	     the digits in between must be converted to the exponent
-	     and the decimal point placed after the first digit
-	   */
-	  exp = dp - 10 + exp - n;
-	  buf[10+n] = '\0'; 
-	  
-	  /* insert the decimal point */
-	  if ( n > 1 ) {
-	    dp = 11;
-	    for ( i = 23; i > dp; i-- ) {
-	      buf[i] = buf[i-1];
-	    }
-	    buf[dp] = '.';
-	  }
-	  
-	  /* adjust the exponent by the number of digits after the decimal point */
-	  if ( n > 1 ) {
-	    sprintf(&buf[11+n], "e%d", exp + n - 1);
-	  }
-	  else {
-	    sprintf(&buf[11], "e%d", exp + n - 1);
-	  }
-	  
-	  if ( sign ) {
-	    buf[9] = '-'; 
-	    strcpy(result, &buf[9]);
-	  }
-	  else {
-	    strcpy(result, &buf[10]);
-	  }
-	}
-	else { /* insert the decimal point */
-	  dp += exp;
-	  for ( i = 23; i > dp; i-- ) {
-	    buf[i] = buf[i-1];
-	  }
-	  buf[11+n] = '\0';
-	  buf[dp] = '.';
-	  if ( sign ) {
-	    buf[9] = '-';
-	    strcpy(result, &buf[9]);
-	  }
-	  else {
-	    strcpy(result, &buf[10]);
-	  }
+	static char efmt[8] = {'%', '-', '1', '5', '.', '#', 'e', 0};
+	char		buf[25] = {
+		'0', '0', '0', '0', '0',
+		'0', '0', '0', '0', '0',
+		'0', '0', '0', '0', '0',
+		'0', '0', '0', '0', '0',
+		'0', '0', '0', '0', '\0'
+	};
+	char	   *p;
+	char	   *mant;
+	int			exp;
+	int			i,
+				dp,
+				sign;
+
+	/*
+	 * put a cap on the number of siugnificant digits to avoid nonsense in
+	 * the output
+	 */
+	n = min(n, FLT_DIG);
+
+	/* remember the sign */
+	sign = (val < 0 ? 1 : 0);
+
+	efmt[5] = '0' + (n - 1) % 10;		/* makes %-15.(n-1)e -- this
+										 * format guarantees that the
+										 * exponent is always present */
+
+	sprintf(result, efmt, val);
+
+	/* trim the spaces left by the %e */
+	for (p = result; *p != ' '; p++);
+	*p = '\0';
+
+	/* get the exponent */
+	mant = (char *) strtok(strdup(result), "e");
+	exp = atoi(strtok(NULL, "e"));
+
+	if (exp == 0)
+	{
+		/* use the supplied mantyssa with sign */
+		strcpy((char *) index(result, 'e'), "");
 	}
-      }
-      else { /* exp <= 0 */
-	dp += exp - 1;
-	buf[10+n] = '\0'; 
-	buf[dp] = '.'; 
-	if ( sign ) {
-	  buf[dp-2] = '-'; 
-	  strcpy(result, &buf[dp-2]);
+	else
+	{
+		if (abs(exp) <= 4)
+		{
+
+			/*
+			 * remove the decimal point from the mantyssa and write the
+			 * digits to the buf array
+			 */
+			for (p = result + sign, i = 10, dp = 0; *p != 'e'; p++, i++)
+			{
+				buf[i] = *p;
+				if (*p == '.')
+				{
+					dp = i--;	/* skip the decimal point */
+				}
+			}
+			if (dp == 0)
+				dp = i--;		/* no decimal point was found in the above
+								 * for() loop */
+
+			if (exp > 0)
+			{
+				if (dp - 10 + exp >= n)
+				{
+
+					/*
+					 * the decimal point is behind the last significant
+					 * digit; the digits in between must be converted to
+					 * the exponent and the decimal point placed after the
+					 * first digit
+					 */
+					exp = dp - 10 + exp - n;
+					buf[10 + n] = '\0';
+
+					/* insert the decimal point */
+					if (n > 1)
+					{
+						dp = 11;
+						for (i = 23; i > dp; i--)
+							buf[i] = buf[i - 1];
+						buf[dp] = '.';
+					}
+
+					/*
+					 * adjust the exponent by the number of digits after
+					 * the decimal point
+					 */
+					if (n > 1)
+						sprintf(&buf[11 + n], "e%d", exp + n - 1);
+					else
+						sprintf(&buf[11], "e%d", exp + n - 1);
+
+					if (sign)
+					{
+						buf[9] = '-';
+						strcpy(result, &buf[9]);
+					}
+					else
+						strcpy(result, &buf[10]);
+				}
+				else
+				{				/* insert the decimal point */
+					dp += exp;
+					for (i = 23; i > dp; i--)
+						buf[i] = buf[i - 1];
+					buf[11 + n] = '\0';
+					buf[dp] = '.';
+					if (sign)
+					{
+						buf[9] = '-';
+						strcpy(result, &buf[9]);
+					}
+					else
+						strcpy(result, &buf[10]);
+				}
+			}
+			else
+			{					/* exp <= 0 */
+				dp += exp - 1;
+				buf[10 + n] = '\0';
+				buf[dp] = '.';
+				if (sign)
+				{
+					buf[dp - 2] = '-';
+					strcpy(result, &buf[dp - 2]);
+				}
+				else
+					strcpy(result, &buf[dp - 1]);
+			}
+		}
+
+		/* do nothing for abs(exp) > 4; %e must be OK */
+		/* just get rid of zeroes after [eE]- and +zeroes after [Ee]. */
+
+		/* ... this is not done yet. */
 	}
-	else {
-	  strcpy(result, &buf[dp-1]);
-	}   
-      }
-    }
-
-    /* do nothing for abs(exp) > 4; %e must be OK */
-    /* just get rid of zeroes after [eE]- and +zeroes after [Ee]. */
-    
-    /* ... this is not done yet. */
-  }
-  return ( strlen ( result ) );
+	return (strlen(result));
 }
 
 
@@ -1003,47 +1077,56 @@ static int restore ( char * result, float val, int n )
 */
 
 bool
-seg_contains_int(SEG *a, int *b)
+seg_contains_int(SEG * a, int *b)
 {
-  return ( (a->lower <= *b) && (a->upper >= *b) );
+	return ((a->lower <= *b) && (a->upper >= *b));
 }
 
 bool
-seg_contains_float4(SEG *a, float4 *b)
+seg_contains_float4(SEG * a, float4 *b)
 {
-  return ( (a->lower <= *b) && (a->upper >= *b) );
+	return ((a->lower <= *b) && (a->upper >= *b));
 }
 
 bool
-seg_contains_float8(SEG *a, float8 *b)
+seg_contains_float8(SEG * a, float8 *b)
 {
-  return ( (a->lower <= *b) && (a->upper >= *b) );
+	return ((a->lower <= *b) && (a->upper >= *b));
 }
 
-/* find out the number of significant digits in a string representing 
+/* find out the number of significant digits in a string representing
  * a floating point number
  */
-int significant_digits ( char* s )
+int
+significant_digits(char *s)
 {
-  char * p = s;
-  int n, c, zeroes;
+	char	   *p = s;
+	int			n,
+				c,
+				zeroes;
 
-  zeroes = 1;
-  /* skip leading zeroes and sign */
-  for ( c = *p; (c == '0' || c == '+' || c == '-') && c != 0; c = *(++p) );
+	zeroes = 1;
+	/* skip leading zeroes and sign */
+	for (c = *p; (c == '0' || c == '+' || c == '-') && c != 0; c = *(++p));
 
-  /* skip decimal point and following zeroes */
-  for ( c = *p; (c == '0' || c == '.' ) && c != 0; c = *(++p) ) {
-    if ( c != '.') zeroes++;
-  }
+	/* skip decimal point and following zeroes */
+	for (c = *p; (c == '0' || c == '.') && c != 0; c = *(++p))
+	{
+		if (c != '.')
+			zeroes++;
+	}
 
-  /* count significant digits (n) */
-  for ( c = *p, n = 0; c != 0; c = *(++p) ) {
-    if ( !( (c >= '0' && c <= '9') || (c == '.') ) ) break;
-    if ( c != '.') n++;
-  }
+	/* count significant digits (n) */
+	for (c = *p, n = 0; c != 0; c = *(++p))
+	{
+		if (!((c >= '0' && c <= '9') || (c == '.')))
+			break;
+		if (c != '.')
+			n++;
+	}
 
-  if (!n) return ( zeroes );
+	if (!n)
+		return (zeroes);
 
-  return( n );
+	return (n);
 }
diff --git a/contrib/seg/segdata.h b/contrib/seg/segdata.h
index 709f576340c0109c2b5cb62c80648e878d21d5e7..773883bbb722d17ca5acf1b8d5d14595c0db280b 100644
--- a/contrib/seg/segdata.h
+++ b/contrib/seg/segdata.h
@@ -1,8 +1,9 @@
-typedef struct SEG {
-  float lower;
-  float upper;
-  char  l_sigd;
-  char  u_sigd;  
-  char  l_ext;
-  char  u_ext;  
-} SEG;
+typedef struct SEG
+{
+	float		lower;
+	float		upper;
+	char		l_sigd;
+	char		u_sigd;
+	char		l_ext;
+	char		u_ext;
+}			SEG;
diff --git a/contrib/soundex/soundex.c b/contrib/soundex/soundex.c
index 5a7e238e3804f611a5c5a1d63a8a1c40d3b3d114..ff1b0f7aecd563709a84ff74916de131478334c1 100644
--- a/contrib/soundex/soundex.c
+++ b/contrib/soundex/soundex.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.10 2001/02/10 02:31:26 tgl Exp $ */
+/* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.11 2001/03/22 03:59:10 momjian Exp $ */
 #include "postgres.h"
 
 #include <ctype.h>
@@ -7,7 +7,7 @@
 #include "utils/builtins.h"
 
 
-Datum text_soundex(PG_FUNCTION_ARGS);
+Datum		text_soundex(PG_FUNCTION_ARGS);
 
 static void soundex(const char *instr, char *outstr);
 
@@ -37,11 +37,12 @@ text_soundex(PG_FUNCTION_ARGS)
 	PG_RETURN_TEXT_P(_textin(outstr));
 }
 
-#endif /* not SOUNDEX_TEST */
+#endif	 /* not SOUNDEX_TEST */
 
 
-/*                                  ABCDEFGHIJKLMNOPQRSTUVWXYZ */
+/*									ABCDEFGHIJKLMNOPQRSTUVWXYZ */
 static const char *soundex_table = "01230120022455012623010202";
+
 #define soundex_code(letter) soundex_table[toupper((unsigned char) (letter)) - 'A']
 
 
@@ -98,7 +99,7 @@ soundex(const char *instr, char *outstr)
 
 #ifdef SOUNDEX_TEST
 int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
 {
 	if (argc < 2)
 	{
@@ -107,11 +108,12 @@ main (int argc, char *argv[])
 	}
 	else
 	{
-		char output[SOUNDEX_LEN + 1];
+		char		output[SOUNDEX_LEN + 1];
 
 		soundex(argv[1], output);
 		printf("soundex(%s) = %s\n", argv[1], output);
 		return 0;
 	}
 }
-#endif /* SOUNDEX_TEST */
+
+#endif	 /* SOUNDEX_TEST */
diff --git a/contrib/spi/insert_username.c b/contrib/spi/insert_username.c
index 3d083bf2f035b800be86c4c3d25dca9bd3392250..0bedaa98aedc9fa749ca82c90000e705135c3475 100644
--- a/contrib/spi/insert_username.c
+++ b/contrib/spi/insert_username.c
@@ -10,7 +10,7 @@
 #include "commands/trigger.h"	/* -"- and triggers */
 #include "miscadmin.h"			/* for GetUserName() */
 
-extern Datum	insert_username(PG_FUNCTION_ARGS);
+extern Datum insert_username(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(insert_username);
 
@@ -65,7 +65,7 @@ insert_username(PG_FUNCTION_ARGS)
 
 	/* create fields containing name */
 	newval = DirectFunctionCall1(textin,
-								 CStringGetDatum(GetUserName(GetUserId())));
+							  CStringGetDatum(GetUserName(GetUserId())));
 
 	/* construct new tuple */
 	rettuple = SPI_modifytuple(rel, rettuple, 1, &attnum, &newval, NULL);
diff --git a/contrib/spi/moddatetime.c b/contrib/spi/moddatetime.c
index 73b151851888d29eb2d2ebdcf00a28dbe012a899..bd45dc72b3d49dae89dd0e8efe9ba24c2cc87c36 100644
--- a/contrib/spi/moddatetime.c
+++ b/contrib/spi/moddatetime.c
@@ -15,7 +15,7 @@ OH, me, I'm Terry Mackintosh <terry@terrym.com>
 #include "executor/spi.h"		/* this is what you need to work with SPI */
 #include "commands/trigger.h"	/* -"- and triggers */
 
-extern Datum	moddatetime(PG_FUNCTION_ARGS);
+extern Datum moddatetime(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(moddatetime);
 
diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c
index 90341e208d244a96ffc6e0a3fd70c8cdf742495e..bc8a1112f4bd186c467f8698487f2131b2405f67 100644
--- a/contrib/spi/timetravel.c
+++ b/contrib/spi/timetravel.c
@@ -373,7 +373,7 @@ set_timetravel(PG_FUNCTION_ARGS)
 	else
 		TTOff = realloc(TTOff, (nTTOff + 1) * sizeof(char *));
 	s = rname = DatumGetCString(DirectFunctionCall1(nameout,
-													NameGetDatum(relname)));
+												 NameGetDatum(relname)));
 	d = TTOff[nTTOff] = malloc(strlen(rname) + 1);
 	while (*s)
 		*d++ = tolower((unsigned char) *s++);
diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c
index 4fdad73e095926d9e6a9e849cd08af93d273f9fd..002c77fb61478522b3f7c487b8197fcf3366a8b5 100644
--- a/contrib/vacuumlo/vacuumlo.c
+++ b/contrib/vacuumlo/vacuumlo.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.8 2001/01/24 19:42:45 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.9 2001/03/22 03:59:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,6 +76,7 @@ vacuumlo(char *database, int verbose)
 		return -1;
 	}
 	PQclear(res);
+
 	/*
 	 * Vacuum the temp table so that planner will generate decent plans
 	 * for the DELETEs below.
@@ -96,13 +97,13 @@ vacuumlo(char *database, int verbose)
 	/*
 	 * Now find any candidate tables who have columns of type oid.
 	 *
-	 * NOTE: the temp table formed above is ignored, because its real
-	 * table name will be pg_something.  Also, pg_largeobject will be
-	 * ignored.  If either of these were scanned, obviously we'd end up
-	 * with nothing to delete...
+	 * NOTE: the temp table formed above is ignored, because its real table
+	 * name will be pg_something.  Also, pg_largeobject will be ignored.
+	 * If either of these were scanned, obviously we'd end up with nothing
+	 * to delete...
 	 *
-	 * NOTE: the system oid column is ignored, as it has attnum < 1.
-	 * This shouldn't matter for correctness, but it saves time.
+	 * NOTE: the system oid column is ignored, as it has attnum < 1. This
+	 * shouldn't matter for correctness, but it saves time.
 	 */
 	buf[0] = '\0';
 	strcat(buf, "SELECT c.relname, a.attname ");
@@ -135,9 +136,9 @@ vacuumlo(char *database, int verbose)
 			fprintf(stdout, "Checking %s in %s\n", field, table);
 
 		/*
-		 * We use a DELETE with implicit join for efficiency.  This
-		 * is a Postgres-ism and not portable to other DBMSs, but
-		 * then this whole program is a Postgres-ism.
+		 * We use a DELETE with implicit join for efficiency.  This is a
+		 * Postgres-ism and not portable to other DBMSs, but then this
+		 * whole program is a Postgres-ism.
 		 */
 		sprintf(buf, "DELETE FROM vacuum_l WHERE lo = \"%s\".\"%s\" ",
 				table, field);
@@ -157,10 +158,10 @@ vacuumlo(char *database, int verbose)
 	PQclear(res);
 
 	/*
-	 * Run the actual deletes in a single transaction.  Note that this
+	 * Run the actual deletes in a single transaction.	Note that this
 	 * would be a bad idea in pre-7.1 Postgres releases (since rolling
-	 * back a table delete used to cause problems), but it should
-	 * be safe now.
+	 * back a table delete used to cause problems), but it should be safe
+	 * now.
 	 */
 	res = PQexec(conn, "begin");
 	PQclear(res);
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 03d180e36fe75fc2895be38ac151db24f75202c2..9bb08054943beac01ebd6cf0bf551e578b33d777 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.69 2001/01/24 19:42:46 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.70 2001/03/22 03:59:11 momjian Exp $
  *
  * NOTES
  *	  The old interface functions have been converted to macros
@@ -306,8 +306,8 @@ nocachegetattr(HeapTuple tuple,
 			int			j;
 
 			/*
-			 * In for(), we test <= and not < because we want to see
-			 * if we can go past it in initializing offsets.
+			 * In for(), we test <= and not < because we want to see if we
+			 * can go past it in initializing offsets.
 			 */
 			for (j = 0; j <= attnum; j++)
 			{
@@ -321,9 +321,9 @@ nocachegetattr(HeapTuple tuple,
 	}
 
 	/*
-	 * If slow is false, and we got here, we know that we have a tuple with
-	 * no nulls or varlenas before the target attribute. If possible, we
-	 * also want to initialize the remainder of the attribute cached
+	 * If slow is false, and we got here, we know that we have a tuple
+	 * with no nulls or varlenas before the target attribute. If possible,
+	 * we also want to initialize the remainder of the attribute cached
 	 * offset values.
 	 */
 	if (!slow)
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index e503d9b888d0f2ece68510decae60effe48516cb..da8129f307f5d3f82cba3fd07bb320048b2e251a 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.52 2001/02/22 21:48:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.53 2001/03/22 03:59:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,9 +45,11 @@ index_formtuple(TupleDesc tupleDescriptor,
 	bool		hasnull = false;
 	uint16		tupmask = 0;
 	int			numberOfAttributes = tupleDescriptor->natts;
+
 #ifdef TOAST_INDEX_HACK
 	Datum		untoasted_value[INDEX_MAX_KEYS];
 	bool		untoasted_free[INDEX_MAX_KEYS];
+
 #endif
 
 	if (numberOfAttributes > INDEX_MAX_KEYS)
@@ -57,7 +59,7 @@ index_formtuple(TupleDesc tupleDescriptor,
 #ifdef TOAST_INDEX_HACK
 	for (i = 0; i < numberOfAttributes; i++)
 	{
-		Form_pg_attribute  att = tupleDescriptor->attrs[i];
+		Form_pg_attribute att = tupleDescriptor->attrs[i];
 
 		untoasted_value[i] = value[i];
 		untoasted_free[i] = false;
@@ -73,20 +75,20 @@ index_formtuple(TupleDesc tupleDescriptor,
 		if (VARATT_IS_EXTERNAL(value[i]))
 		{
 			untoasted_value[i] = PointerGetDatum(
-				heap_tuple_fetch_attr(
-					(varattrib *) DatumGetPointer(value[i])));
+												 heap_tuple_fetch_attr(
+							   (varattrib *) DatumGetPointer(value[i])));
 			untoasted_free[i] = true;
 		}
 
 		/*
-		 * If value is above size target, and is of a compressible datatype,
-		 * try to compress it in-line.
+		 * If value is above size target, and is of a compressible
+		 * datatype, try to compress it in-line.
 		 */
 		if (VARATT_SIZE(untoasted_value[i]) > TOAST_INDEX_TARGET &&
 			!VARATT_IS_EXTENDED(untoasted_value[i]) &&
 			(att->attstorage == 'x' || att->attstorage == 'm'))
 		{
-			Datum	cvalue = toast_compress_datum(untoasted_value[i]);
+			Datum		cvalue = toast_compress_datum(untoasted_value[i]);
 
 			if (DatumGetPointer(cvalue) != NULL)
 			{
@@ -146,8 +148,8 @@ index_formtuple(TupleDesc tupleDescriptor,
 	/*
 	 * We do this because DataFill wants to initialize a "tupmask" which
 	 * is used for HeapTuples, but we want an indextuple infomask.	The
-	 * only relevant info is the "has variable attributes" field.
-	 * We have already set the hasnull bit above.
+	 * only relevant info is the "has variable attributes" field. We have
+	 * already set the hasnull bit above.
 	 */
 
 	if (tupmask & HEAP_HASVARLENA)
@@ -315,9 +317,9 @@ nocache_index_getattr(IndexTuple tup,
 	}
 
 	/*
-	 * If slow is false, and we got here, we know that we have a tuple with
-	 * no nulls or varlenas before the target attribute. If possible, we
-	 * also want to initialize the remainder of the attribute cached
+	 * If slow is false, and we got here, we know that we have a tuple
+	 * with no nulls or varlenas before the target attribute. If possible,
+	 * we also want to initialize the remainder of the attribute cached
 	 * offset values.
 	 */
 	if (!slow)
@@ -391,9 +393,7 @@ nocache_index_getattr(IndexTuple tup,
 				usecache = false;
 			}
 			else
-			{
 				off += att[i]->attlen;
-			}
 		}
 
 		off = att_align(off, att[attnum]->attlen, att[attnum]->attalign);
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 4f47ef0d451003637d657e5f0ac6aba269e1ac6f..d44bfe973e040d25bad6a40e5da49717ceb03e75 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.57 2001/01/24 19:42:47 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.58 2001/03/22 03:59:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,7 @@ getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
 
 	*typOutput = pt->typoutput;
 	*typElem = pt->typelem;
-	*typIsVarlena = (! pt->typbyval) && (pt->typlen == -1);
+	*typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
 	ReleaseSysCache(typeTuple);
 	return OidIsValid(*typOutput);
 }
@@ -200,9 +200,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
 			continue;
 		if (OidIsValid(thisState->typoutput))
 		{
+
 			/*
-			 * If we have a toasted datum, forcibly detoast it here to avoid
-			 * memory leakage inside the type's output routine.
+			 * If we have a toasted datum, forcibly detoast it here to
+			 * avoid memory leakage inside the type's output routine.
 			 */
 			if (thisState->typisvarlena)
 				attr = PointerGetDatum(PG_DETOAST_DATUM(origattr));
@@ -210,9 +211,9 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
 				attr = origattr;
 
 			outputstr = DatumGetCString(FunctionCall3(&thisState->finfo,
-										attr,
-										ObjectIdGetDatum(thisState->typelem),
-										Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
+													  attr,
+									ObjectIdGetDatum(thisState->typelem),
+						  Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
 
 			pq_sendcountedtext(&buf, outputstr, strlen(outputstr));
 
@@ -308,9 +309,10 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
 		if (getTypeOutputInfo(typeinfo->attrs[i]->atttypid,
 							  &typoutput, &typelem, &typisvarlena))
 		{
+
 			/*
-			 * If we have a toasted datum, forcibly detoast it here to avoid
-			 * memory leakage inside the type's output routine.
+			 * If we have a toasted datum, forcibly detoast it here to
+			 * avoid memory leakage inside the type's output routine.
 			 */
 			if (typisvarlena)
 				attr = PointerGetDatum(PG_DETOAST_DATUM(origattr));
@@ -318,9 +320,9 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
 				attr = origattr;
 
 			value = DatumGetCString(OidFunctionCall3(typoutput,
-									attr,
-									ObjectIdGetDatum(typelem),
-									Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
+													 attr,
+											   ObjectIdGetDatum(typelem),
+						  Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
 
 			printatt((unsigned) i + 1, typeinfo->attrs[i], value);
 
@@ -405,6 +407,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
 		/* send # of bytes, and opaque data */
 		if (thisState->typisvarlena)
 		{
+
 			/*
 			 * If we have a toasted datum, must detoast before sending.
 			 */
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 86bc1a56f82dbf7f7f2188f52d593bce8aed84f4..e07c6296d15abf14681d816e3c4be2efdd77bdab 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.71 2001/01/24 19:42:47 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.72 2001/03/22 03:59:11 momjian Exp $
  *
  * NOTES
  *	  some of the executor utility code such as "ExecTypeFromTL" should be
@@ -242,9 +242,9 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
 		/*
 		 * We do not need to check every single field here, and in fact
 		 * some fields such as attdispersion probably shouldn't be
-		 * compared.  We can also disregard attnum (it was used to
-		 * place the row in the attrs array) and everything derived
-		 * from the column datatype.
+		 * compared.  We can also disregard attnum (it was used to place
+		 * the row in the attrs array) and everything derived from the
+		 * column datatype.
 		 */
 		if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0)
 			return false;
@@ -276,8 +276,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
 
 			/*
 			 * We can't assume that the items are always read from the
-			 * system catalogs in the same order; so use the adnum field to
-			 * identify the matching item to compare.
+			 * system catalogs in the same order; so use the adnum field
+			 * to identify the matching item to compare.
 			 */
 			for (j = 0; j < n; defval2++, j++)
 			{
@@ -298,9 +298,9 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
 			ConstrCheck *check2 = constr2->check;
 
 			/*
-			 * Similarly, don't assume that the checks are always read
-			 * in the same order; match them up by name and contents.
-			 * (The name *should* be unique, but...)
+			 * Similarly, don't assume that the checks are always read in
+			 * the same order; match them up by name and contents. (The
+			 * name *should* be unique, but...)
 			 */
 			for (j = 0; j < n; check2++, j++)
 			{
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 9e3f935bd67985239881ba1db0d0b0bb4d9b89d2..1c5577b88a066a1ecebfd6ce317147efc28d489c 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.71 2001/03/07 21:20:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.72 2001/03/22 03:59:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,61 +25,62 @@
 
 #include "access/xlogutils.h"
 
-/* result's status */ 
+/* result's status */
 #define INSERTED	0x01
 #define SPLITED		0x02
 
 /* non-export function prototypes */
-static void gistdoinsert(Relation r, 
-			IndexTuple itup,
-			InsertIndexResult *res,
-			GISTSTATE *GISTstate);
-static int gistlayerinsert( Relation r, BlockNumber blkno,
-			IndexTuple **itup,
-			int *len,
-			InsertIndexResult *res,
-			GISTSTATE *giststate );
-static OffsetNumber gistwritebuffer( Relation r, 
-			Page page, 
-			IndexTuple *itup, 
-			int len, 
-			OffsetNumber off,
-			GISTSTATE *giststate );
-static int gistnospace( Page page,
-			IndexTuple *itvec, int len );
-static IndexTuple * gistreadbuffer( Relation r, 
-			Buffer buffer, int *len );
-static IndexTuple * gistjoinvector( 
-			IndexTuple *itvec, int *len, 
-			IndexTuple *additvec, int addlen );
-static IndexTuple gistunion( Relation r, IndexTuple *itvec, 
-			int len, GISTSTATE *giststate );
-static IndexTuple gistgetadjusted( Relation r, 
-			IndexTuple oldtup, 
-			IndexTuple addtup, 
-			GISTSTATE *giststate );
-static IndexTuple * gistSplit(Relation r,
-			Buffer buffer,
-			IndexTuple *itup,
-			int *len,
-			GISTSTATE *giststate,
-			InsertIndexResult *res);
-static void gistnewroot(GISTSTATE *giststate, Relation r, 
+static void gistdoinsert(Relation r,
+			 IndexTuple itup,
+			 InsertIndexResult *res,
+			 GISTSTATE *GISTstate);
+static int gistlayerinsert(Relation r, BlockNumber blkno,
+				IndexTuple **itup,
+				int *len,
+				InsertIndexResult *res,
+				GISTSTATE *giststate);
+static OffsetNumber gistwritebuffer(Relation r,
+				Page page,
+				IndexTuple *itup,
+				int len,
+				OffsetNumber off,
+				GISTSTATE *giststate);
+static int gistnospace(Page page,
+			IndexTuple *itvec, int len);
+static IndexTuple *gistreadbuffer(Relation r,
+			   Buffer buffer, int *len);
+static IndexTuple *gistjoinvector(
+			   IndexTuple *itvec, int *len,
+			   IndexTuple *additvec, int addlen);
+static IndexTuple gistunion(Relation r, IndexTuple *itvec,
+		  int len, GISTSTATE *giststate);
+static IndexTuple gistgetadjusted(Relation r,
+				IndexTuple oldtup,
+				IndexTuple addtup,
+				GISTSTATE *giststate);
+static IndexTuple *gistSplit(Relation r,
+		  Buffer buffer,
+		  IndexTuple *itup,
+		  int *len,
+		  GISTSTATE *giststate,
+		  InsertIndexResult *res);
+static void gistnewroot(GISTSTATE *giststate, Relation r,
 			IndexTuple *itup, int len);
 static void GISTInitBuffer(Buffer b, uint32 f);
-static OffsetNumber gistchoose(Relation r, Page p, 
-			IndexTuple it,
-			GISTSTATE *giststate);
-static IndexTuple gist_tuple_replacekey(Relation r, 
-			GISTENTRY entry, IndexTuple t);
-static void gistcentryinit(GISTSTATE *giststate, 
-			GISTENTRY *e, char *pr,
-			Relation r, Page pg, 
-			OffsetNumber o, int b, bool l);
+static OffsetNumber gistchoose(Relation r, Page p,
+		   IndexTuple it,
+		   GISTSTATE *giststate);
+static IndexTuple gist_tuple_replacekey(Relation r,
+					  GISTENTRY entry, IndexTuple t);
+static void gistcentryinit(GISTSTATE *giststate,
+			   GISTENTRY *e, char *pr,
+			   Relation r, Page pg,
+			   OffsetNumber o, int b, bool l);
 
 #undef GISTDEBUG
 #ifdef GISTDEBUG
 static void gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber coff);
+
 #endif
 
 /*
@@ -88,12 +89,14 @@ static void gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber c
 Datum
 gistbuild(PG_FUNCTION_ARGS)
 {
-	Relation		heap = (Relation) PG_GETARG_POINTER(0);
-	Relation		index = (Relation) PG_GETARG_POINTER(1);
-	IndexInfo	   *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node		   *oldPred = (Node *) PG_GETARG_POINTER(3);
+	Relation	heap = (Relation) PG_GETARG_POINTER(0);
+	Relation	index = (Relation) PG_GETARG_POINTER(1);
+	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
+	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	IndexStrategy	istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+
 #endif
 	HeapScanDesc hscan;
 	HeapTuple	htup;
@@ -105,9 +108,11 @@ gistbuild(PG_FUNCTION_ARGS)
 	int			nhtups,
 				nitups;
 	Node	   *pred = indexInfo->ii_Predicate;
+
 #ifndef OMIT_PARTIAL_INDEX
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
+
 #endif
 	ExprContext *econtext;
 	GISTSTATE	giststate;
@@ -181,6 +186,7 @@ gistbuild(PG_FUNCTION_ARGS)
 		nhtups++;
 
 #ifndef OMIT_PARTIAL_INDEX
+
 		/*
 		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
 		 * this tuple if it was already in the existing partial index
@@ -262,9 +268,7 @@ gistbuild(PG_FUNCTION_ARGS)
 
 #ifndef OMIT_PARTIAL_INDEX
 	if (pred != NULL || oldPred != NULL)
-	{
 		ExecDropTupleTable(tupleTable, true);
-	}
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
 
@@ -297,7 +301,7 @@ gistbuild(PG_FUNCTION_ARGS)
 	}
 
 #ifdef GISTDEBUG
-gist_dumptree(index, 0, GISTP_ROOT, 0);
+	gist_dumptree(index, 0, GISTP_ROOT, 0);
 #endif
 
 	PG_RETURN_VOID();
@@ -312,12 +316,14 @@ gist_dumptree(index, 0, GISTP_ROOT, 0);
 Datum
 gistinsert(PG_FUNCTION_ARGS)
 {
-	Relation		r = (Relation) PG_GETARG_POINTER(0);
-	Datum		   *datum = (Datum *) PG_GETARG_POINTER(1);
-	char		   *nulls = (char *) PG_GETARG_POINTER(2);
-	ItemPointer		ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+	Relation	r = (Relation) PG_GETARG_POINTER(0);
+	Datum	   *datum = (Datum *) PG_GETARG_POINTER(1);
+	char	   *nulls = (char *) PG_GETARG_POINTER(2);
+	ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	Relation		heapRel = (Relation) PG_GETARG_POINTER(4);
+	Relation	heapRel = (Relation) PG_GETARG_POINTER(4);
+
 #endif
 	InsertIndexResult res;
 	IndexTuple	itup;
@@ -380,7 +386,7 @@ gistPageAddItem(GISTSTATE *giststate,
 {
 	GISTENTRY	tmpcentry;
 	IndexTuple	itup = (IndexTuple) item;
-	OffsetNumber    retval;
+	OffsetNumber retval;
 
 	/*
 	 * recompress the item given that we now know the exact page and
@@ -394,7 +400,7 @@ gistPageAddItem(GISTSTATE *giststate,
 				   offsetNumber, dentry->bytes, FALSE);
 	*newtup = gist_tuple_replacekey(r, tmpcentry, itup);
 	retval = PageAddItem(page, (Item) *newtup, IndexTupleSize(*newtup),
-						offsetNumber, flags);
+						 offsetNumber, flags);
 	if (retval == InvalidOffsetNumber)
 		elog(ERROR, "gist: failed to add index item to %s",
 			 RelationGetRelationName(r));
@@ -405,189 +411,213 @@ gistPageAddItem(GISTSTATE *giststate,
 	return (retval);
 }
 
-static void 
-gistdoinsert( Relation r, 
-		IndexTuple itup, 
-		InsertIndexResult *res, 
-		GISTSTATE *giststate ) {
+static void
+gistdoinsert(Relation r,
+			 IndexTuple itup,
+			 InsertIndexResult *res,
+			 GISTSTATE *giststate)
+{
 	IndexTuple *instup;
-	int i,ret,len = 1;
+	int			i,
+				ret,
+				len = 1;
+
+	instup = (IndexTuple *) palloc(sizeof(IndexTuple));
+	instup[0] = (IndexTuple) palloc(IndexTupleSize(itup));
+	memcpy(instup[0], itup, IndexTupleSize(itup));
 
-	instup = ( IndexTuple* ) palloc( sizeof(IndexTuple) );
-	instup[0] = ( IndexTuple ) palloc( IndexTupleSize( itup ) );
-	memcpy( instup[0], itup, IndexTupleSize( itup ) );
- 
 	ret = gistlayerinsert(r, GISTP_ROOT, &instup, &len, res, giststate);
-	if ( ret & SPLITED )
-		gistnewroot( giststate, r, instup, len );
+	if (ret & SPLITED)
+		gistnewroot(giststate, r, instup, len);
 
-	for(i=0;i<len;i++)
-		pfree( instup[i] );
-	pfree( instup );
+	for (i = 0; i < len; i++)
+		pfree(instup[i]);
+	pfree(instup);
 }
 
 static int
-gistlayerinsert( Relation r, BlockNumber blkno, 
-			 IndexTuple **itup,       /* in - out, has compressed entry */
-			 int *len    ,           /* in - out */
-			 InsertIndexResult *res, /* out */
-			 GISTSTATE *giststate ) {
-	Buffer	buffer;
-	Page	page;
-	OffsetNumber    child;
-	int ret;
+gistlayerinsert(Relation r, BlockNumber blkno,
+				IndexTuple **itup,		/* in - out, has compressed entry */
+				int *len,		/* in - out */
+				InsertIndexResult *res, /* out */
+				GISTSTATE *giststate)
+{
+	Buffer		buffer;
+	Page		page;
+	OffsetNumber child;
+	int			ret;
 	GISTPageOpaque opaque;
 
 	buffer = ReadBuffer(r, blkno);
 	page = (Page) BufferGetPage(buffer);
 	opaque = (GISTPageOpaque) PageGetSpecialPointer(page);
 
-	if (!(opaque->flags & F_LEAF)) {
+	if (!(opaque->flags & F_LEAF))
+	{
 		/* internal page, so we must walk on tree */
 		/* len IS equial 1 */
-		ItemId iid;
+		ItemId		iid;
 		BlockNumber nblkno;
 		ItemPointerData oldtid;
-		IndexTuple oldtup;
-	
-		child = gistchoose( r, page, *(*itup), giststate );
+		IndexTuple	oldtup;
+
+		child = gistchoose(r, page, *(*itup), giststate);
 		iid = PageGetItemId(page, child);
 		oldtup = (IndexTuple) PageGetItem(page, iid);
 		nblkno = ItemPointerGetBlockNumber(&(oldtup->t_tid));
 
-		/* 
-		 * After this call:
-		 * 1. if child page was splited, then itup contains
-		 * keys for each page
-		 * 2. if  child page wasn't splited, then itup contains
-		 * additional for adjustement of current key 
+		/*
+		 * After this call: 1. if child page was splited, then itup
+		 * contains keys for each page 2. if  child page wasn't splited,
+		 * then itup contains additional for adjustement of current key
 		 */
-		ret = gistlayerinsert( r, nblkno, itup, len, res, giststate );
+		ret = gistlayerinsert(r, nblkno, itup, len, res, giststate);
 
 		/* nothing inserted in child */
-		if ( ! (ret & INSERTED) ) {
+		if (!(ret & INSERTED))
+		{
 			ReleaseBuffer(buffer);
-			return 0x00;	
+			return 0x00;
 		}
 
-		/* child does not splited */ 
-		if ( ! (ret & SPLITED) ) {
-			IndexTuple newtup = gistgetadjusted( r, oldtup, (*itup)[0], giststate ); 
-			if ( ! newtup ) {
+		/* child does not splited */
+		if (!(ret & SPLITED))
+		{
+			IndexTuple	newtup = gistgetadjusted(r, oldtup, (*itup)[0], giststate);
+
+			if (!newtup)
+			{
 				/* not need to update key */
 				ReleaseBuffer(buffer);
 				return 0x00;
 			}
 
-			pfree( (*itup)[0] ); /* !!! */
+			pfree((*itup)[0]);	/* !!! */
 			(*itup)[0] = newtup;
 		}
 
-		/* key is modified, so old version must be deleted */ 
+		/* key is modified, so old version must be deleted */
 		ItemPointerSet(&oldtid, blkno, child);
 		DirectFunctionCall2(gistdelete,
-			PointerGetDatum(r),
-			PointerGetDatum(&oldtid));
+							PointerGetDatum(r),
+							PointerGetDatum(&oldtid));
 	}
 
-	ret = INSERTED; 
+	ret = INSERTED;
 
-	if (  gistnospace(page, (*itup), *len) ) {
+	if (gistnospace(page, (*itup), *len))
+	{
 		/* no space for insertion */
 		IndexTuple *itvec;
-		int tlen;
+		int			tlen;
 
 		ret |= SPLITED;
-		itvec = gistreadbuffer( r, buffer, &tlen );
-		itvec = gistjoinvector( itvec, &tlen, (*itup), *len ); 
-		pfree( (*itup) );
-		(*itup) = gistSplit( r, buffer, itvec, &tlen, giststate, 
-			(opaque->flags & F_LEAF) ? res : NULL ); /*res only for inserting in leaf*/
-		ReleaseBuffer( buffer );
-		pfree( itvec );
-		*len = tlen;   /* now tlen >= 2 */
-	} else {
+		itvec = gistreadbuffer(r, buffer, &tlen);
+		itvec = gistjoinvector(itvec, &tlen, (*itup), *len);
+		pfree((*itup));
+		(*itup) = gistSplit(r, buffer, itvec, &tlen, giststate,
+							(opaque->flags & F_LEAF) ? res : NULL);		/* res only for
+																		 * inserting in leaf */
+		ReleaseBuffer(buffer);
+		pfree(itvec);
+		*len = tlen;			/* now tlen >= 2 */
+	}
+	else
+	{
 		/* enogth space */
-		OffsetNumber off, l;
+		OffsetNumber off,
+					l;
 
-		off = ( PageIsEmpty(page) ) ? 
-				FirstOffsetNumber
+		off = (PageIsEmpty(page)) ?
+			FirstOffsetNumber
 			:
-				OffsetNumberNext(PageGetMaxOffsetNumber(page));
-		l = gistwritebuffer( r, page, (*itup), *len, off, giststate );
+			OffsetNumberNext(PageGetMaxOffsetNumber(page));
+		l = gistwritebuffer(r, page, (*itup), *len, off, giststate);
 		WriteBuffer(buffer);
 
-		/* set res if insert into leaf page, in
-                this case, len = 1 always */
-		if ( res && (opaque->flags & F_LEAF) )
+		/*
+		 * set res if insert into leaf page, in this case, len = 1 always
+		 */
+		if (res && (opaque->flags & F_LEAF))
 			ItemPointerSet(&((*res)->pointerData), blkno, l);
 
-		if ( *len > 1 ) { /* previos insert ret & SPLITED != 0 */ 
-			int i;
-			/* child was splited, so we must form union
-			 * for insertion in parent */
-			IndexTuple newtup = gistunion(r, (*itup), *len, giststate);
-			for(i=0; i<*len; i++)
-				pfree( (*itup)[i] );
+		if (*len > 1)
+		{						/* previos insert ret & SPLITED != 0 */
+			int			i;
+
+			/*
+			 * child was splited, so we must form union for insertion in
+			 * parent
+			 */
+			IndexTuple	newtup = gistunion(r, (*itup), *len, giststate);
+
+			for (i = 0; i < *len; i++)
+				pfree((*itup)[i]);
 			(*itup)[0] = newtup;
 			*len = 1;
 		}
 	}
-	
-	return ret; 
-}    
 
-/* 
+	return ret;
+}
+
+/*
  * Write itup vector to page, has no control of free space
  */
 static OffsetNumber
-gistwritebuffer( Relation r, Page page, IndexTuple *itup, 
-		int len, OffsetNumber off, GISTSTATE *giststate) {
+gistwritebuffer(Relation r, Page page, IndexTuple *itup,
+				int len, OffsetNumber off, GISTSTATE *giststate)
+{
 	OffsetNumber l = InvalidOffsetNumber;
-	int i;
-	GISTENTRY       tmpdentry;
-	IndexTuple newtup;
-		
-	for(i=0; i<len; i++) { 
-		l = gistPageAddItem(giststate, r, page, 
-			(Item) itup[i], IndexTupleSize(itup[i]),   
-			off, LP_USED, &tmpdentry, &newtup);
-		off = OffsetNumberNext( off );
+	int			i;
+	GISTENTRY	tmpdentry;
+	IndexTuple	newtup;
+
+	for (i = 0; i < len; i++)
+	{
+		l = gistPageAddItem(giststate, r, page,
+							(Item) itup[i], IndexTupleSize(itup[i]),
+							off, LP_USED, &tmpdentry, &newtup);
+		off = OffsetNumberNext(off);
 		if (tmpdentry.pred != (((char *) itup[i]) + sizeof(IndexTupleData)) && tmpdentry.pred)
 			pfree(tmpdentry.pred);
 		if (itup[i] != newtup)
 			pfree(newtup);
 	}
-	return l; 
+	return l;
 }
 
 /*
  * Check space for itup vector on page
  */
-static int 
-gistnospace( Page page, IndexTuple *itvec, int len ) {
-	int size = 0;
-	int i;
-	for(i=0; i<len; i++) 
-		size += IndexTupleSize( itvec[i] )+4; /* ??? */
+static int
+gistnospace(Page page, IndexTuple *itvec, int len)
+{
+	int			size = 0;
+	int			i;
 
-	return  (PageGetFreeSpace(page) < size);
-} 
+	for (i = 0; i < len; i++)
+		size += IndexTupleSize(itvec[i]) + 4;	/* ??? */
+
+	return (PageGetFreeSpace(page) < size);
+}
 
 /*
  * Read buffer into itup vector
  */
 static IndexTuple *
-gistreadbuffer( Relation r, Buffer buffer, int *len /*out*/) {
-	OffsetNumber i, maxoff;
-	IndexTuple   *itvec;
-	Page p = (Page) BufferGetPage(buffer);
+gistreadbuffer(Relation r, Buffer buffer, int *len /* out */ )
+{
+	OffsetNumber i,
+				maxoff;
+	IndexTuple *itvec;
+	Page		p = (Page) BufferGetPage(buffer);
 
-	*len=0;
+	*len = 0;
 	maxoff = PageGetMaxOffsetNumber(p);
-	itvec = palloc( sizeof(IndexTuple) * maxoff );
-	for(i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
-		itvec[ (*len)++ ] = (IndexTuple) PageGetItem(p, PageGetItemId(p, i));
+	itvec = palloc(sizeof(IndexTuple) * maxoff);
+	for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+		itvec[(*len)++] = (IndexTuple) PageGetItem(p, PageGetItemId(p, i));
 
 	return itvec;
 }
@@ -596,9 +626,10 @@ gistreadbuffer( Relation r, Buffer buffer, int *len /*out*/) {
  * join two vectors into one
  */
 static IndexTuple *
-gistjoinvector( IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen ) {
-	itvec = (IndexTuple*) repalloc( (void*)itvec, sizeof(IndexTuple) * ( (*len) + addlen ) );
-	memmove( &itvec[*len], additvec, sizeof(IndexTuple) * addlen );
+gistjoinvector(IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
+{
+	itvec = (IndexTuple *) repalloc((void *) itvec, sizeof(IndexTuple) * ((*len) + addlen));
+	memmove(&itvec[*len], additvec, sizeof(IndexTuple) * addlen);
 	*len += addlen;
 	return itvec;
 }
@@ -607,115 +638,124 @@ gistjoinvector( IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen )
  * return union of itup vector
  */
 static IndexTuple
-gistunion( Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate ) {
-	bytea   *evec;
-	char 	*datum;
-	int 	datumsize, i;
-	GISTENTRY centry;
-	char isnull;
-	IndexTuple newtup;
+gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate)
+{
+	bytea	   *evec;
+	char	   *datum;
+	int			datumsize,
+				i;
+	GISTENTRY	centry;
+	char		isnull;
+	IndexTuple	newtup;
 
 	evec = (bytea *) palloc(len * sizeof(GISTENTRY) + VARHDRSZ);
 	VARATT_SIZEP(evec) = len * sizeof(GISTENTRY) + VARHDRSZ;
 
-	for ( i = 0 ; i< len ; i++ ) 
+	for (i = 0; i < len; i++)
 		gistdentryinit(giststate, &((GISTENTRY *) VARDATA(evec))[i],
-			(char*) itvec[i] + sizeof(IndexTupleData), 
-			(Relation)NULL, (Page)NULL, (OffsetNumber)NULL,
-			IndexTupleSize((IndexTuple)itvec[i]) - sizeof(IndexTupleData), FALSE);
+					   (char *) itvec[i] + sizeof(IndexTupleData),
+					   (Relation) NULL, (Page) NULL, (OffsetNumber) NULL,
+					   IndexTupleSize((IndexTuple) itvec[i]) - sizeof(IndexTupleData), FALSE);
 
 	datum = (char *)
 		DatumGetPointer(FunctionCall2(&giststate->unionFn,
-			PointerGetDatum(evec),
-			PointerGetDatum(&datumsize)));
+									  PointerGetDatum(evec),
+									  PointerGetDatum(&datumsize)));
+
+	for (i = 0; i < len; i++)
+		if (((GISTENTRY *) VARDATA(evec))[i].pred &&
+			((GISTENTRY *) VARDATA(evec))[i].pred !=
+			((char *) (itvec[i]) + sizeof(IndexTupleData)))
+			pfree(((GISTENTRY *) VARDATA(evec))[i].pred);
 
-	for ( i = 0 ; i< len ; i++ )
-		if ( ((GISTENTRY *) VARDATA(evec))[i].pred &&
-		   ((GISTENTRY *) VARDATA(evec))[i].pred != 
-		   ((char*)( itvec[i] )+ sizeof(IndexTupleData)) )
-			pfree( ((GISTENTRY *) VARDATA(evec))[i].pred ); 
-	     
-	pfree( evec );
+	pfree(evec);
 
-	gistcentryinit(giststate, &centry, datum, 
-		(Relation)NULL, (Page)NULL, (OffsetNumber)NULL,
-		datumsize, FALSE);
+	gistcentryinit(giststate, &centry, datum,
+				   (Relation) NULL, (Page) NULL, (OffsetNumber) NULL,
+				   datumsize, FALSE);
 
 	isnull = (centry.pred) ? ' ' : 'n';
-	newtup = (IndexTuple) index_formtuple( r->rd_att, (Datum *) &centry.pred, &isnull );
+	newtup = (IndexTuple) index_formtuple(r->rd_att, (Datum *) &centry.pred, &isnull);
 	if (centry.pred != datum)
-		pfree( datum );
+		pfree(datum);
 
 	return newtup;
-} 
+}
 
 /*
  * Forms union of oldtup and addtup, if union == oldtup then return NULL
  */
 static IndexTuple
-gistgetadjusted( Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate ) {
-	bytea   *evec;
-	char 	*datum;
-	int 	datumsize;
-	bool    result;
-	char 	isnull;
-	GISTENTRY centry, *ev0p, *ev1p;
-	IndexTuple newtup = NULL;
-	
+gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
+{
+	bytea	   *evec;
+	char	   *datum;
+	int			datumsize;
+	bool		result;
+	char		isnull;
+	GISTENTRY	centry,
+			   *ev0p,
+			   *ev1p;
+	IndexTuple	newtup = NULL;
+
 	evec = (bytea *) palloc(2 * sizeof(GISTENTRY) + VARHDRSZ);
 	VARATT_SIZEP(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ;
 
 	gistdentryinit(giststate, &((GISTENTRY *) VARDATA(evec))[0],
-		(char*) oldtup + sizeof(IndexTupleData), (Relation) NULL, 
-		(Page) NULL, (OffsetNumber) 0,
-		IndexTupleSize((IndexTuple)oldtup) - sizeof(IndexTupleData), FALSE);
+			   (char *) oldtup + sizeof(IndexTupleData), (Relation) NULL,
+				   (Page) NULL, (OffsetNumber) 0,
+	IndexTupleSize((IndexTuple) oldtup) - sizeof(IndexTupleData), FALSE);
 	ev0p = &((GISTENTRY *) VARDATA(evec))[0];
 
 	gistdentryinit(giststate, &((GISTENTRY *) VARDATA(evec))[1],
-		(char*) addtup + sizeof(IndexTupleData), (Relation) NULL,
-		(Page) NULL, (OffsetNumber) 0,
-		IndexTupleSize((IndexTuple)addtup) - sizeof(IndexTupleData), FALSE);
+			   (char *) addtup + sizeof(IndexTupleData), (Relation) NULL,
+				   (Page) NULL, (OffsetNumber) 0,
+	IndexTupleSize((IndexTuple) addtup) - sizeof(IndexTupleData), FALSE);
 	ev1p = &((GISTENTRY *) VARDATA(evec))[1];
 
 	datum = (char *)
 		DatumGetPointer(FunctionCall2(&giststate->unionFn,
-			PointerGetDatum(evec),
-			PointerGetDatum(&datumsize)));
+									  PointerGetDatum(evec),
+									  PointerGetDatum(&datumsize)));
 
-	if ( ! ( ev0p->pred && ev1p->pred ) ) {
-		result = ( ev0p->pred == NULL && ev1p->pred == NULL );
-	} else {
+	if (!(ev0p->pred && ev1p->pred))
+		result = (ev0p->pred == NULL && ev1p->pred == NULL);
+	else
+	{
 		FunctionCall3(&giststate->equalFn,
-			PointerGetDatum(ev0p->pred),
-			PointerGetDatum(datum),
-			PointerGetDatum(&result));
+					  PointerGetDatum(ev0p->pred),
+					  PointerGetDatum(datum),
+					  PointerGetDatum(&result));
 	}
 
-	if ( result ) {
+	if (result)
+	{
 		/* not need to update key */
-		pfree( datum );
-	} else {
+		pfree(datum);
+	}
+	else
+	{
 		gistcentryinit(giststate, &centry, datum, ev0p->rel, ev0p->page,
-			ev0p->offset, datumsize, FALSE);
+					   ev0p->offset, datumsize, FALSE);
 
 		isnull = (centry.pred) ? ' ' : 'n';
-		newtup = (IndexTuple) index_formtuple( r->rd_att, (Datum *) &centry.pred, &isnull );
-		newtup->t_tid = oldtup->t_tid; 
+		newtup = (IndexTuple) index_formtuple(r->rd_att, (Datum *) &centry.pred, &isnull);
+		newtup->t_tid = oldtup->t_tid;
 		if (centry.pred != datum)
-			pfree( datum );
+			pfree(datum);
 	}
 
-	if ( ev0p->pred && 
-	     ev0p->pred != (char*) oldtup + sizeof(IndexTupleData)  ) 
-		pfree( ev0p->pred ); 
-	if ( ev1p->pred && 
-	     ev1p->pred != (char*) addtup + sizeof(IndexTupleData)  ) 
-		pfree( ev1p->pred ); 
-	pfree( evec );
+	if (ev0p->pred &&
+		ev0p->pred != (char *) oldtup + sizeof(IndexTupleData))
+		pfree(ev0p->pred);
+	if (ev1p->pred &&
+		ev1p->pred != (char *) addtup + sizeof(IndexTupleData))
+		pfree(ev1p->pred);
+	pfree(evec);
 
-	return newtup;	
+	return newtup;
 }
- 
+
 /*
  *	gistSplit -- split a page in the tree.
  */
@@ -728,19 +768,27 @@ gistSplit(Relation r,
 		  InsertIndexResult *res)
 {
 	Page		p;
-	Buffer		leftbuf, rightbuf;
-	Page		left, right;
-	OffsetNumber 	*spl_left, *spl_right;
-	IndexTuple	*lvectup, *rvectup, *newtup;
-	int leftoff, rightoff;
-	BlockNumber lbknum, rbknum;
+	Buffer		leftbuf,
+				rightbuf;
+	Page		left,
+				right;
+	OffsetNumber *spl_left,
+			   *spl_right;
+	IndexTuple *lvectup,
+			   *rvectup,
+			   *newtup;
+	int			leftoff,
+				rightoff;
+	BlockNumber lbknum,
+				rbknum;
 	GISTPageOpaque opaque;
-	char	   isnull;
+	char		isnull;
 	GIST_SPLITVEC v;
 	bytea	   *entryvec;
 	bool	   *decompvec;
 	GISTENTRY	tmpentry;
-	int i, nlen;
+	int			i,
+				nlen;
 
 	p = (Page) BufferGetPage(buffer);
 	opaque = (GISTPageOpaque) PageGetSpecialPointer(p);
@@ -773,17 +821,17 @@ gistSplit(Relation r,
 	right = (Page) BufferGetPage(rightbuf);
 
 	/* generate the item array */
-	entryvec = (bytea *) palloc(VARHDRSZ + (*len+1) * sizeof(GISTENTRY));
-	decompvec = (bool *) palloc(VARHDRSZ + (*len+1) * sizeof(bool));
-	VARATT_SIZEP(entryvec) = (*len+1) * sizeof(GISTENTRY) + VARHDRSZ;
+	entryvec = (bytea *) palloc(VARHDRSZ + (*len + 1) * sizeof(GISTENTRY));
+	decompvec = (bool *) palloc(VARHDRSZ + (*len + 1) * sizeof(bool));
+	VARATT_SIZEP(entryvec) = (*len + 1) * sizeof(GISTENTRY) + VARHDRSZ;
 	for (i = 1; i <= *len; i++)
 	{
 		gistdentryinit(giststate, &((GISTENTRY *) VARDATA(entryvec))[i],
-					   (((char *) itup[i-1]) + sizeof(IndexTupleData)),
+					   (((char *) itup[i - 1]) + sizeof(IndexTupleData)),
 					   r, p, i,
-				 IndexTupleSize(itup[i-1]) - sizeof(IndexTupleData), FALSE);
+			IndexTupleSize(itup[i - 1]) - sizeof(IndexTupleData), FALSE);
 		if ((char *) (((GISTENTRY *) VARDATA(entryvec))[i].pred)
-			== (((char *) itup[i-1]) + sizeof(IndexTupleData)))
+			== (((char *) itup[i - 1]) + sizeof(IndexTupleData)))
 			decompvec[i] = FALSE;
 		else
 			decompvec[i] = TRUE;
@@ -791,8 +839,8 @@ gistSplit(Relation r,
 
 	/* now let the user-defined picksplit function set up the split vector */
 	FunctionCall2(&giststate->picksplitFn,
-		PointerGetDatum(entryvec),
-		PointerGetDatum(&v));
+				  PointerGetDatum(entryvec),
+				  PointerGetDatum(&v));
 
 	/* clean up the entry vector: its preds need to be deleted, too */
 	for (i = 1; i <= *len; i++)
@@ -801,35 +849,43 @@ gistSplit(Relation r,
 	pfree(entryvec);
 	pfree(decompvec);
 
-	spl_left = v.spl_left; spl_right = v.spl_right;
-	
+	spl_left = v.spl_left;
+	spl_right = v.spl_right;
+
 	/* form left and right vector */
-	lvectup = (IndexTuple*) palloc( sizeof( IndexTuple )*v.spl_nleft );
-	rvectup = (IndexTuple*) palloc( sizeof( IndexTuple )*v.spl_nright );
+	lvectup = (IndexTuple *) palloc(sizeof(IndexTuple) * v.spl_nleft);
+	rvectup = (IndexTuple *) palloc(sizeof(IndexTuple) * v.spl_nright);
 	leftoff = rightoff = 0;
-	for( i=1; i <= *len; i++ ) {
-		if (i == *(spl_left) || ( i==*len && *(spl_left) != FirstOffsetNumber ) ) {
-			lvectup[ leftoff++ ] = itup[ i-1 ];
+	for (i = 1; i <= *len; i++)
+	{
+		if (i == *(spl_left) || (i == *len && *(spl_left) != FirstOffsetNumber))
+		{
+			lvectup[leftoff++] = itup[i - 1];
 			spl_left++;
-		} else { 
-			rvectup[ rightoff++ ] = itup[ i-1 ];
+		}
+		else
+		{
+			rvectup[rightoff++] = itup[i - 1];
 			spl_right++;
 		}
 	}
 
 	/* write on disk (may be need another split) */
-	if ( gistnospace(right, rvectup, v.spl_nright) ) {
+	if (gistnospace(right, rvectup, v.spl_nright))
+	{
 		nlen = v.spl_nright;
-		newtup = gistSplit(r, rightbuf, rvectup, &nlen, giststate, 
-			( res && rvectup[ nlen-1 ] == itup[ *len - 1 ] ) ? res : NULL );
-		ReleaseBuffer( rightbuf );
-	} else {
+		newtup = gistSplit(r, rightbuf, rvectup, &nlen, giststate,
+			  (res && rvectup[nlen - 1] == itup[*len - 1]) ? res : NULL);
+		ReleaseBuffer(rightbuf);
+	}
+	else
+	{
 		OffsetNumber l;
-	
-		l = gistwritebuffer( r, right, rvectup, v.spl_nright, FirstOffsetNumber, giststate );
+
+		l = gistwritebuffer(r, right, rvectup, v.spl_nright, FirstOffsetNumber, giststate);
 		WriteBuffer(rightbuf);
 
-		if ( res )
+		if (res)
 			ItemPointerSet(&((*res)->pointerData), rbknum, l);
 		gistcentryinit(giststate, &tmpentry, v.spl_rdatum, (Relation) NULL,
 					   (Page) NULL, (OffsetNumber) 0,
@@ -839,32 +895,35 @@ gistSplit(Relation r,
 		v.spl_rdatum = tmpentry.pred;
 
 		nlen = 1;
-		newtup = (IndexTuple*) palloc( sizeof(IndexTuple) * 1);
-		isnull = ( v.spl_rdatum ) ? ' ' : 'n';
+		newtup = (IndexTuple *) palloc(sizeof(IndexTuple) * 1);
+		isnull = (v.spl_rdatum) ? ' ' : 'n';
 		newtup[0] = (IndexTuple) index_formtuple(r->rd_att, (Datum *) &(v.spl_rdatum), &isnull);
 		ItemPointerSet(&(newtup[0]->t_tid), rbknum, 1);
 	}
 
-	if ( gistnospace(left, lvectup, v.spl_nleft) ) {
-		int llen = v.spl_nleft;
+	if (gistnospace(left, lvectup, v.spl_nleft))
+	{
+		int			llen = v.spl_nleft;
 		IndexTuple *lntup;
 
-		lntup = gistSplit(r, leftbuf, lvectup, &llen, giststate, 
-			( res && lvectup[ llen-1 ] == itup[ *len - 1 ] ) ? res : NULL );
-		ReleaseBuffer( leftbuf );
+		lntup = gistSplit(r, leftbuf, lvectup, &llen, giststate,
+			  (res && lvectup[llen - 1] == itup[*len - 1]) ? res : NULL);
+		ReleaseBuffer(leftbuf);
 
-		newtup = gistjoinvector( newtup, &nlen, lntup, llen );
-		pfree( lntup ); 
-	} else {
+		newtup = gistjoinvector(newtup, &nlen, lntup, llen);
+		pfree(lntup);
+	}
+	else
+	{
 		OffsetNumber l;
-	
-		l = gistwritebuffer( r, left, lvectup, v.spl_nleft, FirstOffsetNumber, giststate );
-		if ( BufferGetBlockNumber(buffer) != GISTP_ROOT)
+
+		l = gistwritebuffer(r, left, lvectup, v.spl_nleft, FirstOffsetNumber, giststate);
+		if (BufferGetBlockNumber(buffer) != GISTP_ROOT)
 			PageRestoreTempPage(left, p);
 
 		WriteBuffer(leftbuf);
 
-		if ( res )
+		if (res)
 			ItemPointerSet(&((*res)->pointerData), lbknum, l);
 		gistcentryinit(giststate, &tmpentry, v.spl_ldatum, (Relation) NULL,
 					   (Page) NULL, (OffsetNumber) 0,
@@ -874,10 +933,10 @@ gistSplit(Relation r,
 		v.spl_ldatum = tmpentry.pred;
 
 		nlen += 1;
-		newtup = (IndexTuple*) repalloc( (void*)newtup, sizeof(IndexTuple) * nlen);
-		isnull = ( v.spl_ldatum ) ? ' ' : 'n';
-		newtup[nlen-1] = (IndexTuple) index_formtuple(r->rd_att, (Datum *) &(v.spl_ldatum), &isnull);
-		ItemPointerSet(&(newtup[nlen-1]->t_tid), lbknum, 1);
+		newtup = (IndexTuple *) repalloc((void *) newtup, sizeof(IndexTuple) * nlen);
+		isnull = (v.spl_ldatum) ? ' ' : 'n';
+		newtup[nlen - 1] = (IndexTuple) index_formtuple(r->rd_att, (Datum *) &(v.spl_ldatum), &isnull);
+		ItemPointerSet(&(newtup[nlen - 1]->t_tid), lbknum, 1);
 	}
 
 
@@ -885,10 +944,10 @@ gistSplit(Relation r,
 	gistadjscans(r, GISTOP_SPLIT, BufferGetBlockNumber(buffer), FirstOffsetNumber);
 
 	/* !!! pfree */
-	pfree( rvectup );
-	pfree( lvectup );
-	pfree( v.spl_left );
-	pfree( v.spl_right );
+	pfree(rvectup);
+	pfree(lvectup);
+	pfree(v.spl_left);
+	pfree(v.spl_right);
 
 	*len = nlen;
 	return newtup;
@@ -903,8 +962,8 @@ gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple *itup, int len)
 	b = ReadBuffer(r, GISTP_ROOT);
 	GISTInitBuffer(b, 0);
 	p = BufferGetPage(b);
-	
-	gistwritebuffer( r, p, itup, len, FirstOffsetNumber, giststate );
+
+	gistwritebuffer(r, p, itup, len, FirstOffsetNumber, giststate);
 	WriteBuffer(b);
 }
 
@@ -1000,8 +1059,8 @@ gistfreestack(GISTSTACK *s)
 Datum
 gistdelete(PG_FUNCTION_ARGS)
 {
-	Relation		r = (Relation) PG_GETARG_POINTER(0);
-	ItemPointer		tid = (ItemPointer) PG_GETARG_POINTER(1);
+	Relation	r = (Relation) PG_GETARG_POINTER(0);
+	ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
 	BlockNumber blkno;
 	OffsetNumber offnum;
 	Buffer		buf;
@@ -1101,7 +1160,7 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
 	char	   *datum = (((char *) t) + sizeof(IndexTupleData));
 
 	/* if new entry fits in index tuple, copy it in */
-	if ((Size) entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData) || (Size) entry.bytes == 0 )
+	if ((Size) entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData) || (Size) entry.bytes == 0)
 	{
 		memcpy(datum, entry.pred, entry.bytes);
 		/* clear out old size */
@@ -1116,9 +1175,9 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
 		/* generate a new index tuple for the compressed entry */
 		TupleDesc	tupDesc = r->rd_att;
 		IndexTuple	newtup;
-		char	   isnull;
+		char		isnull;
 
-		isnull = ( entry.pred ) ? ' ' : 'n';
+		isnull = (entry.pred) ? ' ' : 'n';
 		newtup = (IndexTuple) index_formtuple(tupDesc,
 											  (Datum *) &(entry.pred),
 											  &isnull);
@@ -1181,38 +1240,40 @@ gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber coff)
 	Page		page;
 	GISTPageOpaque opaque;
 	IndexTuple	which;
-	ItemId          iid;
-	OffsetNumber i,maxoff;
-	BlockNumber	cblk;
-	char	*pred;
+	ItemId		iid;
+	OffsetNumber i,
+				maxoff;
+	BlockNumber cblk;
+	char	   *pred;
 
-	pred  = (char*) palloc( sizeof(char)*level+1 );
+	pred = (char *) palloc(sizeof(char) * level + 1);
 	MemSet(pred, '\t', level);
-	pred[level]='\0';
+	pred[level] = '\0';
 
 	buffer = ReadBuffer(r, blk);
 	page = (Page) BufferGetPage(buffer);
 	opaque = (GISTPageOpaque) PageGetSpecialPointer(page);
-	
-	maxoff = PageGetMaxOffsetNumber( page );
-	
-	elog(NOTICE,"%sPage: %d %s blk: %d maxoff: %d free: %d", pred, coff, ( opaque->flags & F_LEAF ) ? "LEAF" : "INTE", (int)blk, (int)maxoff, PageGetFreeSpace(page));
-	
-	for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
+
+	maxoff = PageGetMaxOffsetNumber(page);
+
+	elog(NOTICE, "%sPage: %d %s blk: %d maxoff: %d free: %d", pred, coff, (opaque->flags & F_LEAF) ? "LEAF" : "INTE", (int) blk, (int) maxoff, PageGetFreeSpace(page));
+
+	for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+	{
 		iid = PageGetItemId(page, i);
 		which = (IndexTuple) PageGetItem(page, iid);
 		cblk = ItemPointerGetBlockNumber(&(which->t_tid));
-#ifdef PRINTTUPLE		
-		elog(NOTICE,"%s  Tuple. blk: %d size: %d", pred, (int)cblk, IndexTupleSize( which ) );
-#endif 
-	
-		if ( ! ( opaque->flags & F_LEAF ) ) { 
-			gist_dumptree( r, level+1, cblk, i );
-		}
+#ifdef PRINTTUPLE
+		elog(NOTICE, "%s  Tuple. blk: %d size: %d", pred, (int) cblk, IndexTupleSize(which));
+#endif
+
+		if (!(opaque->flags & F_LEAF))
+			gist_dumptree(r, level + 1, cblk, i);
 	}
 	ReleaseBuffer(buffer);
 	pfree(pred);
 }
+
 #endif	 /* defined GISTDEBUG */
 
 void
@@ -1220,15 +1281,14 @@ gist_redo(XLogRecPtr lsn, XLogRecord *record)
 {
 	elog(STOP, "gist_redo: unimplemented");
 }
- 
+
 void
 gist_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 	elog(STOP, "gist_undo: unimplemented");
 }
- 
+
 void
-gist_desc(char *buf, uint8 xl_info, char* rec)
+gist_desc(char *buf, uint8 xl_info, char *rec)
 {
 }
-
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index f7b49430d07936683eeca20a03b06f167489d726..8f3b5dd475c96ce0c1b4cacddb51d0ceeae2264b 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -32,8 +32,8 @@ static bool gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc,
 Datum
 gistgettuple(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc		s = (IndexScanDesc) PG_GETARG_POINTER(0);
-	ScanDirection		dir = (ScanDirection) PG_GETARG_INT32(1);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
 	RetrieveIndexResult res;
 
 	/* if we have it cached in the scan desc, just return the value */
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index d37a8c077631bb941ba31447da9981c023db5ea5..ba21fee3c33ea834a7856dcfe0b4416cde6d387c 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -72,9 +72,9 @@ gistbeginscan(PG_FUNCTION_ARGS)
 Datum
 gistrescan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
-	bool			fromEnd = PG_GETARG_BOOL(1);
-	ScanKey			key = (ScanKey) PG_GETARG_POINTER(2);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	bool		fromEnd = PG_GETARG_BOOL(1);
+	ScanKey		key = (ScanKey) PG_GETARG_POINTER(2);
 	GISTScanOpaque p;
 	int			i;
 
@@ -160,7 +160,7 @@ gistrescan(PG_FUNCTION_ARGS)
 Datum
 gistmarkpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
 	GISTScanOpaque p;
 	GISTSTACK  *o,
 			   *n,
@@ -196,7 +196,7 @@ gistmarkpos(PG_FUNCTION_ARGS)
 Datum
 gistrestrpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
 	GISTScanOpaque p;
 	GISTSTACK  *o,
 			   *n,
@@ -232,8 +232,8 @@ gistrestrpos(PG_FUNCTION_ARGS)
 Datum
 gistendscan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
-	GISTScanOpaque	p;
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	GISTScanOpaque p;
 
 	p = (GISTScanOpaque) s->opaque;
 
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 44a8b225e8f42d886078d9e9f6afe7409f297b9d..aa76ba232a05c21da94012fbefbc287924aa154f 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.49 2001/02/22 21:48:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.50 2001/03/22 03:59:12 momjian Exp $
  *
  * NOTES
  *	  This file contains only the public interface routines.
@@ -41,12 +41,14 @@ bool		BuildingHash = false;
 Datum
 hashbuild(PG_FUNCTION_ARGS)
 {
-	Relation		heap = (Relation) PG_GETARG_POINTER(0);
-	Relation		index = (Relation) PG_GETARG_POINTER(1);
-	IndexInfo	   *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node		   *oldPred = (Node *) PG_GETARG_POINTER(3);
+	Relation	heap = (Relation) PG_GETARG_POINTER(0);
+	Relation	index = (Relation) PG_GETARG_POINTER(1);
+	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
+	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	IndexStrategy	istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+
 #endif
 	HeapScanDesc hscan;
 	HeapTuple	htup;
@@ -59,9 +61,11 @@ hashbuild(PG_FUNCTION_ARGS)
 				nitups;
 	HashItem	hitem;
 	Node	   *pred = indexInfo->ii_Predicate;
+
 #ifndef OMIT_PARTIAL_INDEX
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
+
 #endif
 	ExprContext *econtext;
 	InsertIndexResult res = NULL;
@@ -117,6 +121,7 @@ hashbuild(PG_FUNCTION_ARGS)
 		nhtups++;
 
 #ifndef OMIT_PARTIAL_INDEX
+
 		/*
 		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
 		 * this tuple if it was already in the existing partial index
@@ -191,9 +196,7 @@ hashbuild(PG_FUNCTION_ARGS)
 
 #ifndef OMIT_PARTIAL_INDEX
 	if (pred != NULL || oldPred != NULL)
-	{
 		ExecDropTupleTable(tupleTable, true);
-	}
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
 
@@ -241,12 +244,14 @@ hashbuild(PG_FUNCTION_ARGS)
 Datum
 hashinsert(PG_FUNCTION_ARGS)
 {
-	Relation		rel = (Relation) PG_GETARG_POINTER(0);
-	Datum		   *datum = (Datum *) PG_GETARG_POINTER(1);
-	char		   *nulls = (char *) PG_GETARG_POINTER(2);
-	ItemPointer		ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+	Relation	rel = (Relation) PG_GETARG_POINTER(0);
+	Datum	   *datum = (Datum *) PG_GETARG_POINTER(1);
+	char	   *nulls = (char *) PG_GETARG_POINTER(2);
+	ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	Relation		heapRel = (Relation) PG_GETARG_POINTER(4);
+	Relation	heapRel = (Relation) PG_GETARG_POINTER(4);
+
 #endif
 	InsertIndexResult res;
 	HashItem	hitem;
@@ -276,8 +281,8 @@ hashinsert(PG_FUNCTION_ARGS)
 Datum
 hashgettuple(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc		scan = (IndexScanDesc) PG_GETARG_POINTER(0);
-	ScanDirection		dir = (ScanDirection) PG_GETARG_INT32(1);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
 	RetrieveIndexResult res;
 
 	/*
@@ -326,11 +331,13 @@ hashbeginscan(PG_FUNCTION_ARGS)
 Datum
 hashrescan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+
 #ifdef NOT_USED					/* XXX surely it's wrong to ignore this? */
-	bool			fromEnd = PG_GETARG_BOOL(1);
+	bool		fromEnd = PG_GETARG_BOOL(1);
+
 #endif
-	ScanKey			scankey = (ScanKey) PG_GETARG_POINTER(2);
+	ScanKey		scankey = (ScanKey) PG_GETARG_POINTER(2);
 	ItemPointer iptr;
 	HashScanOpaque so;
 
@@ -367,7 +374,7 @@ hashrescan(PG_FUNCTION_ARGS)
 Datum
 hashendscan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	HashScanOpaque so;
 
@@ -405,7 +412,7 @@ hashendscan(PG_FUNCTION_ARGS)
 Datum
 hashmarkpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	HashScanOpaque so;
 
@@ -437,7 +444,7 @@ hashmarkpos(PG_FUNCTION_ARGS)
 Datum
 hashrestrpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	HashScanOpaque so;
 
@@ -468,8 +475,8 @@ hashrestrpos(PG_FUNCTION_ARGS)
 Datum
 hashdelete(PG_FUNCTION_ARGS)
 {
-	Relation		rel = (Relation) PG_GETARG_POINTER(0);
-	ItemPointer		tid = (ItemPointer) PG_GETARG_POINTER(1);
+	Relation	rel = (Relation) PG_GETARG_POINTER(0);
+	ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
 
 	/* adjust any active scans that will be affected by this deletion */
 	_hash_adjscans(rel, tid);
@@ -491,8 +498,8 @@ hash_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 	elog(STOP, "hash_undo: unimplemented");
 }
- 
+
 void
-hash_desc(char *buf, uint8 xl_info, char* rec)
+hash_desc(char *buf, uint8 xl_info, char *rec)
 {
 }
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index 30defc1a57b03bc5502aea9d70fe3f7fc0c28f3b..4cb157c702c15f3183b537f7fcf9d44d02f2aa9e 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.29 2001/01/24 19:42:47 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.30 2001/03/22 03:59:13 momjian Exp $
  *
  * NOTES
  *	  These functions are stored in pg_amproc.	For each operator class
@@ -25,32 +25,32 @@
 Datum
 hashchar(PG_FUNCTION_ARGS)
 {
-	PG_RETURN_UINT32(~ ((uint32) PG_GETARG_CHAR(0)));
+	PG_RETURN_UINT32(~((uint32) PG_GETARG_CHAR(0)));
 }
 
 Datum
 hashint2(PG_FUNCTION_ARGS)
 {
-	PG_RETURN_UINT32(~ ((uint32) PG_GETARG_INT16(0)));
+	PG_RETURN_UINT32(~((uint32) PG_GETARG_INT16(0)));
 }
 
 Datum
 hashint4(PG_FUNCTION_ARGS)
 {
-	PG_RETURN_UINT32(~ PG_GETARG_UINT32(0));
+	PG_RETURN_UINT32(~PG_GETARG_UINT32(0));
 }
 
 Datum
 hashint8(PG_FUNCTION_ARGS)
 {
 	/* we just use the low 32 bits... */
-	PG_RETURN_UINT32(~ ((uint32) PG_GETARG_INT64(0)));
+	PG_RETURN_UINT32(~((uint32) PG_GETARG_INT64(0)));
 }
 
 Datum
 hashoid(PG_FUNCTION_ARGS)
 {
-	PG_RETURN_UINT32(~ ((uint32) PG_GETARG_OID(0)));
+	PG_RETURN_UINT32(~((uint32) PG_GETARG_OID(0)));
 }
 
 Datum
@@ -93,7 +93,7 @@ hashint2vector(PG_FUNCTION_ARGS)
 Datum
 hashname(PG_FUNCTION_ARGS)
 {
-	char	   *key = NameStr(* PG_GETARG_NAME(0));
+	char	   *key = NameStr(*PG_GETARG_NAME(0));
 
 	return hash_any((char *) key, NAMEDATALEN);
 }
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 9748daa194ddf308e653a44cf9e8121b64fa9e10..b55717744c18daeaf1cf5508cb1aac9af446e924 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,14 +8,14 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.110 2001/01/24 19:42:47 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.111 2001/03/22 03:59:13 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
  *		heapgettup		- fetch next heap tuple from a scan
  *		heap_open		- open a heap relation by relationId
  *		heap_openr		- open a heap relation by name
- *		heap_open[r]_nofail	- same, but return NULL on failure instead of elog
+ *		heap_open[r]_nofail - same, but return NULL on failure instead of elog
  *		heap_close		- close a heap relation
  *		heap_beginscan	- begin relation scan
  *		heap_rescan		- restart a relation scan
@@ -88,16 +88,16 @@
 
 #include "access/xlogutils.h"
 
-XLogRecPtr	log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from, 
-							Buffer newbuf, HeapTuple newtup);
-XLogRecPtr	log_heap_clean(Relation reln, Buffer buffer,
-							char *unused, int unlen);
+XLogRecPtr log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from,
+			  Buffer newbuf, HeapTuple newtup);
+XLogRecPtr log_heap_clean(Relation reln, Buffer buffer,
+			   char *unused, int unlen);
 
 /* comments are in heap_update */
-static xl_heaptid	_locked_tuple_;
+static xl_heaptid _locked_tuple_;
 static void _heap_unlock_tuple(void *data);
-static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf, 
-			ItemPointerData from, Buffer newbuf, HeapTuple newtup, bool move);
+static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
+	   ItemPointerData from, Buffer newbuf, HeapTuple newtup, bool move);
 
 
 /* ----------------------------------------------------------------
@@ -249,7 +249,7 @@ heapgettup(Relation relation,
 	OffsetNumber lineoff;
 	int			linesleft;
 	ItemPointer tid = (tuple->t_data == NULL) ?
-		(ItemPointer) NULL : &(tuple->t_self);
+	(ItemPointer) NULL : &(tuple->t_self);
 
 	/* ----------------
 	 *	increment access statistics
@@ -286,7 +286,7 @@ heapgettup(Relation relation,
 
 	if (!ItemPointerIsValid(tid))
 		Assert(!PointerIsValid(tid));
-    
+
 	tuple->t_tableOid = relation->rd_id;
 
 	/* ----------------
@@ -538,9 +538,9 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
 			 (
 			  (tupleDesc)->attrs[(attnum) - 1]->attcacheoff >= 0 ?
 			  (
-				fetchatt((tupleDesc)->attrs[(attnum) - 1],
-						 (char *) (tup)->t_data + (tup)->t_data->t_hoff +
-							(tupleDesc)->attrs[(attnum) - 1]->attcacheoff)
+			   fetchatt((tupleDesc)->attrs[(attnum) - 1],
+						(char *) (tup)->t_data + (tup)->t_data->t_hoff +
+						(tupleDesc)->attrs[(attnum) - 1]->attcacheoff)
 			   )
 			  :
 			  nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
@@ -564,7 +564,8 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
 			 )
 	);
 }
-#endif /* defined(DISABLE_COMPLEX_MACRO)*/
+
+#endif	 /* defined(DISABLE_COMPLEX_MACRO) */
 
 
 /* ----------------------------------------------------------------
@@ -791,8 +792,8 @@ heap_beginscan(Relation relation,
 	scan->rs_nkeys = (short) nkeys;
 
 	/*
-	 * we do this here instead of in initscan() because heap_rescan
-	 * also calls initscan() and we don't want to allocate memory again
+	 * we do this here instead of in initscan() because heap_rescan also
+	 * calls initscan() and we don't want to allocate memory again
 	 */
 	if (nkeys)
 		scan->rs_key = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
@@ -1316,7 +1317,7 @@ heap_get_latest_tid(Relation relation,
 Oid
 heap_insert(Relation relation, HeapTuple tup)
 {
-	Buffer buffer;
+	Buffer		buffer;
 
 	/* increment access statistics */
 	IncrHeapAccessStat(local_insert);
@@ -1350,7 +1351,7 @@ heap_insert(Relation relation, HeapTuple tup)
 	 * toasted attributes from some other relation, invoke the toaster.
 	 * ----------
 	 */
-    if (HeapTupleHasExtended(tup) ||
+	if (HeapTupleHasExtended(tup) ||
 		(MAXALIGN(tup->t_len) > TOAST_TUPLE_THRESHOLD))
 		heap_tuple_toast_attrs(relation, tup, NULL);
 #endif
@@ -1364,17 +1365,17 @@ heap_insert(Relation relation, HeapTuple tup)
 
 	/* XLOG stuff */
 	{
-		xl_heap_insert	xlrec;
-		xl_heap_header	xlhdr;
-		XLogRecPtr		recptr;
-		XLogRecData		rdata[3];
-		Page			page = BufferGetPage(buffer);
-		uint8			info = XLOG_HEAP_INSERT;
+		xl_heap_insert xlrec;
+		xl_heap_header xlhdr;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[3];
+		Page		page = BufferGetPage(buffer);
+		uint8		info = XLOG_HEAP_INSERT;
 
 		xlrec.target.node = relation->rd_node;
 		xlrec.target.tid = tup->t_self;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfHeapInsert;
 		rdata[0].next = &(rdata[1]);
 
@@ -1383,12 +1384,12 @@ heap_insert(Relation relation, HeapTuple tup)
 		xlhdr.t_hoff = tup->t_data->t_hoff;
 		xlhdr.mask = tup->t_data->t_infomask;
 		rdata[1].buffer = buffer;
-		rdata[1].data = (char*)&xlhdr;
+		rdata[1].data = (char *) &xlhdr;
 		rdata[1].len = SizeOfHeapHeader;
 		rdata[1].next = &(rdata[2]);
 
 		rdata[2].buffer = buffer;
-		rdata[2].data = (char*) tup->t_data + offsetof(HeapTupleHeaderData, t_bits);
+		rdata[2].data = (char *) tup->t_data + offsetof(HeapTupleHeaderData, t_bits);
 		rdata[2].len = tup->t_len - offsetof(HeapTupleHeaderData, t_bits);
 		rdata[2].next = NULL;
 
@@ -1411,10 +1412,10 @@ heap_insert(Relation relation, HeapTuple tup)
 	WriteBuffer(buffer);
 
 	/*
-	 * If tuple is cachable, mark it for rollback from the caches
-	 * in case we abort.  Note it is OK to do this after WriteBuffer
-	 * releases the buffer, because the "tup" data structure is all
-	 * in local memory, not in the shared buffer.
+	 * If tuple is cachable, mark it for rollback from the caches in case
+	 * we abort.  Note it is OK to do this after WriteBuffer releases the
+	 * buffer, because the "tup" data structure is all in local memory,
+	 * not in the shared buffer.
 	 */
 	RelationMark4RollbackHeapTuple(relation, tup);
 
@@ -1513,14 +1514,14 @@ l1:
 							 HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
 	/* XLOG stuff */
 	{
-		xl_heap_delete	xlrec;
-		XLogRecPtr		recptr;
-		XLogRecData		rdata[2];
+		xl_heap_delete xlrec;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[2];
 
 		xlrec.target.node = relation->rd_node;
 		xlrec.target.tid = tp.t_self;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfHeapDelete;
 		rdata[0].next = &(rdata[1]);
 
@@ -1551,9 +1552,10 @@ l1:
 #endif
 
 	/*
-	 * Mark tuple for invalidation from system caches at next command boundary.
-	 * We have to do this before WriteBuffer because we need to look at the
-	 * contents of the tuple, so we need to hold our refcount on the buffer.
+	 * Mark tuple for invalidation from system caches at next command
+	 * boundary. We have to do this before WriteBuffer because we need to
+	 * look at the contents of the tuple, so we need to hold our refcount
+	 * on the buffer.
 	 */
 	RelationInvalidateHeapTuple(relation, &tp);
 
@@ -1567,7 +1569,7 @@ l1:
  *
  * This routine may be used to delete a tuple when concurrent updates of
  * the target tuple are not expected (for example, because we have a lock
- * on the relation associated with the tuple).  Any failure is reported
+ * on the relation associated with the tuple).	Any failure is reported
  * via elog().
  */
 void
@@ -1636,6 +1638,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
 	oldtup.t_data = (HeapTupleHeader) PageGetItem(dp, lp);
 	oldtup.t_len = ItemIdGetLength(lp);
 	oldtup.t_self = *otid;
+
 	/*
 	 * Note: beyond this point, use oldtup not otid to refer to old tuple.
 	 * otid may very well point at newtup->t_self, which we will overwrite
@@ -1701,23 +1704,24 @@ l2:
 
 	/*
 	 * If the toaster needs to be activated, OR if the new tuple will not
-	 * fit on the same page as the old, then we need to release the context
-	 * lock (but not the pin!) on the old tuple's buffer while we are off
-	 * doing TOAST and/or table-file-extension work.  We must mark the old
-	 * tuple to show that it's already being updated, else other processes
-	 * may try to update it themselves. To avoid second XLOG log record,
-	 * we use xact mgr hook to unlock old tuple without reading log if xact
-	 * will abort before update is logged. In the event of crash prio logging,
-	 * TQUAL routines will see HEAP_XMAX_UNLOGGED flag...
+	 * fit on the same page as the old, then we need to release the
+	 * context lock (but not the pin!) on the old tuple's buffer while we
+	 * are off doing TOAST and/or table-file-extension work.  We must mark
+	 * the old tuple to show that it's already being updated, else other
+	 * processes may try to update it themselves. To avoid second XLOG log
+	 * record, we use xact mgr hook to unlock old tuple without reading
+	 * log if xact will abort before update is logged. In the event of
+	 * crash prio logging, TQUAL routines will see HEAP_XMAX_UNLOGGED
+	 * flag...
 	 *
-	 * NOTE: this trick is useless currently but saved for future
-	 * when we'll implement UNDO and will re-use transaction IDs
-	 * after postmaster startup.
+	 * NOTE: this trick is useless currently but saved for future when we'll
+	 * implement UNDO and will re-use transaction IDs after postmaster
+	 * startup.
 	 *
 	 * We need to invoke the toaster if there are already any toasted values
 	 * present, or if the new tuple is over-threshold.
 	 */
-	need_toast = (HeapTupleHasExtended(&oldtup) || 
+	need_toast = (HeapTupleHasExtended(&oldtup) ||
 				  HeapTupleHasExtended(newtup) ||
 				  (MAXALIGN(newtup->t_len) > TOAST_TUPLE_THRESHOLD));
 
@@ -1726,7 +1730,7 @@ l2:
 	{
 		_locked_tuple_.node = relation->rd_node;
 		_locked_tuple_.tid = oldtup.t_self;
-		XactPushRollback(_heap_unlock_tuple, (void*) &_locked_tuple_);
+		XactPushRollback(_heap_unlock_tuple, (void *) &_locked_tuple_);
 
 		TransactionIdStore(GetCurrentTransactionId(),
 						   &(oldtup.t_data->t_xmax));
@@ -1762,7 +1766,7 @@ l2:
 	/* NO ELOG(ERROR) from here till changes are logged */
 	START_CRIT_SECTION();
 
-	RelationPutHeapTuple(relation, newbuf, newtup);	/* insert new tuple */
+	RelationPutHeapTuple(relation, newbuf, newtup);		/* insert new tuple */
 
 	if (already_marked)
 	{
@@ -1784,7 +1788,7 @@ l2:
 
 	/* XLOG stuff */
 	{
-		XLogRecPtr	recptr = log_heap_update(relation, buffer, oldtup.t_self, 
+		XLogRecPtr	recptr = log_heap_update(relation, buffer, oldtup.t_self,
 											 newbuf, newtup, false);
 
 		if (newbuf != buffer)
@@ -1814,10 +1818,10 @@ l2:
 	WriteBuffer(buffer);
 
 	/*
-	 * If new tuple is cachable, mark it for rollback from the caches
-	 * in case we abort.  Note it is OK to do this after WriteBuffer
-	 * releases the buffer, because the "newtup" data structure is all
-	 * in local memory, not in the shared buffer.
+	 * If new tuple is cachable, mark it for rollback from the caches in
+	 * case we abort.  Note it is OK to do this after WriteBuffer releases
+	 * the buffer, because the "newtup" data structure is all in local
+	 * memory, not in the shared buffer.
 	 */
 	RelationMark4RollbackHeapTuple(relation, newtup);
 
@@ -1829,7 +1833,7 @@ l2:
  *
  * This routine may be used to update a tuple when concurrent updates of
  * the target tuple are not expected (for example, because we have a lock
- * on the relation associated with the tuple).  Any failure is reported
+ * on the relation associated with the tuple).	Any failure is reported
  * via elog().
  */
 void
@@ -2129,14 +2133,14 @@ heap_restrpos(HeapScanDesc scan)
 XLogRecPtr
 log_heap_clean(Relation reln, Buffer buffer, char *unused, int unlen)
 {
-	xl_heap_clean	xlrec;
-	XLogRecPtr		recptr;
-	XLogRecData		rdata[3];
+	xl_heap_clean xlrec;
+	XLogRecPtr	recptr;
+	XLogRecData rdata[3];
 
 	xlrec.node = reln->rd_node;
 	xlrec.block = BufferGetBlockNumber(buffer);
 	rdata[0].buffer = InvalidBuffer;
-	rdata[0].data = (char*)&xlrec;
+	rdata[0].data = (char *) &xlrec;
 	rdata[0].len = SizeOfHeapClean;
 	rdata[0].next = &(rdata[1]);
 
@@ -2157,27 +2161,27 @@ log_heap_clean(Relation reln, Buffer buffer, char *unused, int unlen)
 
 	recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_CLEAN, rdata);
 
-	return(recptr);
+	return (recptr);
 }
 
 static XLogRecPtr
-log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from, 
+log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
 				Buffer newbuf, HeapTuple newtup, bool move)
 {
-	char			tbuf[MAXALIGN(sizeof(xl_heap_header)) + 2 * sizeof(TransactionId)];
-	xl_heap_update	xlrec;
-	xl_heap_header *xlhdr = (xl_heap_header*) tbuf;
-	int				hsize = SizeOfHeapHeader;
-	XLogRecPtr		recptr;
-	XLogRecData		rdata[4];
-	Page			page = BufferGetPage(newbuf);
-	uint8			info = (move) ? XLOG_HEAP_MOVE : XLOG_HEAP_UPDATE;
+	char		tbuf[MAXALIGN(sizeof(xl_heap_header)) + 2 * sizeof(TransactionId)];
+	xl_heap_update xlrec;
+	xl_heap_header *xlhdr = (xl_heap_header *) tbuf;
+	int			hsize = SizeOfHeapHeader;
+	XLogRecPtr	recptr;
+	XLogRecData rdata[4];
+	Page		page = BufferGetPage(newbuf);
+	uint8		info = (move) ? XLOG_HEAP_MOVE : XLOG_HEAP_UPDATE;
 
 	xlrec.target.node = reln->rd_node;
 	xlrec.target.tid = from;
 	xlrec.newtid = newtup->t_self;
 	rdata[0].buffer = InvalidBuffer;
-	rdata[0].data = (char*)&xlrec;
+	rdata[0].data = (char *) &xlrec;
 	rdata[0].len = SizeOfHeapUpdate;
 	rdata[0].next = &(rdata[1]);
 
@@ -2190,9 +2194,9 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
 	xlhdr->t_natts = newtup->t_data->t_natts;
 	xlhdr->t_hoff = newtup->t_data->t_hoff;
 	xlhdr->mask = newtup->t_data->t_infomask;
-	if (move)	/* remember xmin & xmax */
+	if (move)					/* remember xmin & xmax */
 	{
-		TransactionId	xmax;
+		TransactionId xmax;
 
 		if (newtup->t_data->t_infomask & HEAP_XMAX_INVALID ||
 			newtup->t_data->t_infomask & HEAP_MARKED_FOR_UPDATE)
@@ -2200,17 +2204,17 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
 		else
 			xmax = newtup->t_data->t_xmax;
 		memcpy(tbuf + hsize, &xmax, sizeof(TransactionId));
-		memcpy(tbuf + hsize + sizeof(TransactionId), 
-				&(newtup->t_data->t_xmin), sizeof(TransactionId));
+		memcpy(tbuf + hsize + sizeof(TransactionId),
+			   &(newtup->t_data->t_xmin), sizeof(TransactionId));
 		hsize += (2 * sizeof(TransactionId));
 	}
 	rdata[2].buffer = newbuf;
-	rdata[2].data = (char*)xlhdr;
+	rdata[2].data = (char *) xlhdr;
 	rdata[2].len = hsize;
 	rdata[2].next = &(rdata[3]);
 
 	rdata[3].buffer = newbuf;
-	rdata[3].data = (char*) newtup->t_data + offsetof(HeapTupleHeaderData, t_bits);
+	rdata[3].data = (char *) newtup->t_data + offsetof(HeapTupleHeaderData, t_bits);
 	rdata[3].len = newtup->t_len - offsetof(HeapTupleHeaderData, t_bits);
 	rdata[3].next = NULL;
 
@@ -2224,23 +2228,23 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
 
 	recptr = XLogInsert(RM_HEAP_ID, info, rdata);
 
-	return(recptr);
+	return (recptr);
 }
 
 XLogRecPtr
-log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from, 
-				Buffer newbuf, HeapTuple newtup)
+log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from,
+			  Buffer newbuf, HeapTuple newtup)
 {
-	return(log_heap_update(reln, oldbuf, from, newbuf, newtup, true));
+	return (log_heap_update(reln, oldbuf, from, newbuf, newtup, true));
 }
 
 static void
 heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_heap_clean  *xlrec = (xl_heap_clean*) XLogRecGetData(record);
-	Relation		reln;
-	Buffer			buffer;
-	Page			page;
+	xl_heap_clean *xlrec = (xl_heap_clean *) XLogRecGetData(record);
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
 
 	if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
 		return;
@@ -2266,15 +2270,15 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
 
 	if (record->xl_len > SizeOfHeapClean)
 	{
-		char			unbuf[BLCKSZ];
-		OffsetNumber   *unused = (OffsetNumber*)unbuf;
-		char		   *unend;
-		ItemId			lp;
+		char		unbuf[BLCKSZ];
+		OffsetNumber *unused = (OffsetNumber *) unbuf;
+		char	   *unend;
+		ItemId		lp;
 
-		memcpy(unbuf, (char*)xlrec + SizeOfHeapClean, record->xl_len - SizeOfHeapClean);
+		memcpy(unbuf, (char *) xlrec + SizeOfHeapClean, record->xl_len - SizeOfHeapClean);
 		unend = unbuf + (record->xl_len - SizeOfHeapClean);
 
-		while((char*)unused < unend)
+		while ((char *) unused < unend)
 		{
 			lp = ((PageHeader) page)->pd_linp + *unused;
 			lp->lp_flags &= ~LP_USED;
@@ -2289,13 +2293,13 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
 static void
 heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_heap_delete *xlrec = (xl_heap_delete*) XLogRecGetData(record);
-	Relation		reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
-	Buffer			buffer;
-	Page			page;
-	OffsetNumber	offnum;
-	ItemId			lp = NULL;
-	HeapTupleHeader	htup;
+	xl_heap_delete *xlrec = (xl_heap_delete *) XLogRecGetData(record);
+	Relation	reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+	Buffer		buffer;
+	Page		page;
+	OffsetNumber offnum;
+	ItemId		lp = NULL;
+	HeapTupleHeader htup;
 
 	if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
 		return;
@@ -2303,7 +2307,7 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 	if (!RelationIsValid(reln))
 		return;
 
-	buffer = XLogReadBuffer(false, reln, 
+	buffer = XLogReadBuffer(false, reln,
 						ItemPointerGetBlockNumber(&(xlrec->target.tid)));
 	if (!BufferIsValid(buffer))
 		elog(STOP, "heap_delete_%sdo: no block", (redo) ? "re" : "un");
@@ -2320,7 +2324,8 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 			return;
 		}
 	}
-	else if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied ?! */
+	else if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied
+												 * ?! */
 		elog(STOP, "heap_delete_undo: bad page LSN");
 
 	offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
@@ -2337,7 +2342,7 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 		htup->t_xmax = record->xl_xid;
 		htup->t_cmax = FirstCommandId;
 		htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
-								HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
+							  HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
 		PageSetLSN(page, lsn);
 		PageSetSUI(page, ThisStartUpID);
 		UnlockAndWriteBuffer(buffer);
@@ -2350,12 +2355,12 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 static void
 heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_heap_insert *xlrec = (xl_heap_insert*) XLogRecGetData(record);
-	Relation		reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
-	Buffer			buffer;
-	Page			page;
-	OffsetNumber	offnum;
-	HeapTupleHeader	htup;
+	xl_heap_insert *xlrec = (xl_heap_insert *) XLogRecGetData(record);
+	Relation	reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+	Buffer		buffer;
+	Page		page;
+	OffsetNumber offnum;
+	HeapTupleHeader htup;
 
 	if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
 		return;
@@ -2363,7 +2368,7 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 	if (!RelationIsValid(reln))
 		return;
 
-	buffer = XLogReadBuffer((redo) ? true : false, reln, 
+	buffer = XLogReadBuffer((redo) ? true : false, reln,
 						ItemPointerGetBlockNumber(&(xlrec->target.tid)));
 	if (!BufferIsValid(buffer))
 		return;
@@ -2375,9 +2380,9 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 
 	if (redo)
 	{
-		char			tbuf[MaxTupleSize];
-		xl_heap_header	xlhdr;
-		uint32			newlen;
+		char		tbuf[MaxTupleSize];
+		xl_heap_header xlhdr;
+		uint32		newlen;
 
 		if (record->xl_info & XLOG_HEAP_INIT_PAGE)
 		{
@@ -2396,9 +2401,9 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 			elog(STOP, "heap_insert_redo: invalid max offset number");
 
 		newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
-		memcpy((char*)&xlhdr, (char*)xlrec + SizeOfHeapInsert, SizeOfHeapHeader);
-		memcpy(tbuf + offsetof(HeapTupleHeaderData, t_bits), 
-			(char*)xlrec + SizeOfHeapInsert + SizeOfHeapHeader, newlen);
+		memcpy((char *) &xlhdr, (char *) xlrec + SizeOfHeapInsert, SizeOfHeapHeader);
+		memcpy(tbuf + offsetof(HeapTupleHeaderData, t_bits),
+		   (char *) xlrec + SizeOfHeapInsert + SizeOfHeapHeader, newlen);
 		newlen += offsetof(HeapTupleHeaderData, t_bits);
 		htup = (HeapTupleHeader) tbuf;
 		htup->t_oid = xlhdr.t_oid;
@@ -2408,19 +2413,20 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 		htup->t_cmin = FirstCommandId;
 		htup->t_xmax = htup->t_cmax = 0;
 		htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
-		
-		offnum = PageAddItem(page, (Item)htup, newlen, offnum, 
-							LP_USED | OverwritePageMode);
+
+		offnum = PageAddItem(page, (Item) htup, newlen, offnum,
+							 LP_USED | OverwritePageMode);
 		if (offnum == InvalidOffsetNumber)
 			elog(STOP, "heap_insert_redo: failed to add tuple");
 		PageSetLSN(page, lsn);
-		PageSetSUI(page, ThisStartUpID);	/* prev sui */
+		PageSetSUI(page, ThisStartUpID);		/* prev sui */
 		UnlockAndWriteBuffer(buffer);
 		return;
 	}
 
 	/* undo insert */
-	if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied ?! */
+	if (XLByteLT(PageGetLSN(page), lsn))		/* changes are not applied
+												 * ?! */
 		elog(STOP, "heap_insert_undo: bad page LSN");
 
 	elog(STOP, "heap_insert_undo: unimplemented");
@@ -2432,16 +2438,16 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 static void
 heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
 {
-	xl_heap_update *xlrec = (xl_heap_update*) XLogRecGetData(record);
-	Relation		reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
-	Buffer			buffer;
-	bool			samepage = 
-		(ItemPointerGetBlockNumber(&(xlrec->newtid)) == 
-		ItemPointerGetBlockNumber(&(xlrec->target.tid)));
-	Page			page;
-	OffsetNumber	offnum;
-	ItemId			lp = NULL;
-	HeapTupleHeader	htup;
+	xl_heap_update *xlrec = (xl_heap_update *) XLogRecGetData(record);
+	Relation	reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+	Buffer		buffer;
+	bool		samepage =
+	(ItemPointerGetBlockNumber(&(xlrec->newtid)) ==
+	 ItemPointerGetBlockNumber(&(xlrec->target.tid)));
+	Page		page;
+	OffsetNumber offnum;
+	ItemId		lp = NULL;
+	HeapTupleHeader htup;
 
 	if (!RelationIsValid(reln))
 		return;
@@ -2451,7 +2457,7 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
 
 	/* Deal with old tuple version */
 
-	buffer = XLogReadBuffer(false, reln, 
+	buffer = XLogReadBuffer(false, reln,
 						ItemPointerGetBlockNumber(&(xlrec->target.tid)));
 	if (!BufferIsValid(buffer))
 		elog(STOP, "heap_update_%sdo: no block", (redo) ? "re" : "un");
@@ -2470,7 +2476,8 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
 			goto newt;
 		}
 	}
-	else if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied ?! */
+	else if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied
+												 * ?! */
 		elog(STOP, "heap_update_undo: bad old tuple page LSN");
 
 	offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
@@ -2487,7 +2494,7 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
 		if (move)
 		{
 			TransactionIdStore(record->xl_xid, (TransactionId *) &(htup->t_cmin));
-			htup->t_infomask &= 
+			htup->t_infomask &=
 				~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_IN);
 			htup->t_infomask |= HEAP_MOVED_OFF;
 		}
@@ -2496,7 +2503,7 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
 			htup->t_xmax = record->xl_xid;
 			htup->t_cmax = FirstCommandId;
 			htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
-								HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
+							 HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
 		}
 		if (samepage)
 			goto newsame;
@@ -2514,11 +2521,11 @@ newt:;
 
 	if (redo &&
 		((record->xl_info & XLR_BKP_BLOCK_2) ||
-		((record->xl_info & XLR_BKP_BLOCK_1) && samepage)))
+		 ((record->xl_info & XLR_BKP_BLOCK_1) && samepage)))
 		return;
 
-	buffer = XLogReadBuffer((redo) ? true : false, reln, 
-					ItemPointerGetBlockNumber(&(xlrec->newtid)));
+	buffer = XLogReadBuffer((redo) ? true : false, reln,
+							ItemPointerGetBlockNumber(&(xlrec->newtid)));
 	if (!BufferIsValid(buffer))
 		return;
 
@@ -2531,10 +2538,10 @@ newsame:;
 
 	if (redo)
 	{
-		char			tbuf[MaxTupleSize];
-		xl_heap_header	xlhdr;
-		int				hsize;
-		uint32			newlen;
+		char		tbuf[MaxTupleSize];
+		xl_heap_header xlhdr;
+		int			hsize;
+		uint32		newlen;
 
 		if (record->xl_info & XLOG_HEAP_INIT_PAGE)
 		{
@@ -2557,9 +2564,9 @@ newsame:;
 			hsize += (2 * sizeof(TransactionId));
 
 		newlen = record->xl_len - hsize;
-		memcpy((char*)&xlhdr, (char*)xlrec + SizeOfHeapUpdate, SizeOfHeapHeader);
-		memcpy(tbuf + offsetof(HeapTupleHeaderData, t_bits), 
-			(char*)xlrec + hsize, newlen);
+		memcpy((char *) &xlhdr, (char *) xlrec + SizeOfHeapUpdate, SizeOfHeapHeader);
+		memcpy(tbuf + offsetof(HeapTupleHeaderData, t_bits),
+			   (char *) xlrec + hsize, newlen);
 		newlen += offsetof(HeapTupleHeaderData, t_bits);
 		htup = (HeapTupleHeader) tbuf;
 		htup->t_oid = xlhdr.t_oid;
@@ -2568,13 +2575,13 @@ newsame:;
 		if (move)
 		{
 			hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
-			memcpy(&(htup->t_xmax), (char*)xlrec + hsize, sizeof(TransactionId));
-			memcpy(&(htup->t_xmin), 
-				(char*)xlrec + hsize + sizeof(TransactionId), sizeof(TransactionId));
+			memcpy(&(htup->t_xmax), (char *) xlrec + hsize, sizeof(TransactionId));
+			memcpy(&(htup->t_xmin),
+				   (char *) xlrec + hsize + sizeof(TransactionId), sizeof(TransactionId));
 			TransactionIdStore(record->xl_xid, (TransactionId *) &(htup->t_cmin));
 			htup->t_infomask = xlhdr.mask;
-			htup->t_infomask &= ~(HEAP_XMIN_COMMITTED | 
-						HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
+			htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
+								  HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
 			htup->t_infomask |= HEAP_MOVED_IN;
 		}
 		else
@@ -2584,19 +2591,20 @@ newsame:;
 			htup->t_xmax = htup->t_cmax = 0;
 			htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
 		}
-		
-		offnum = PageAddItem(page, (Item)htup, newlen, offnum,
-							LP_USED | OverwritePageMode);
+
+		offnum = PageAddItem(page, (Item) htup, newlen, offnum,
+							 LP_USED | OverwritePageMode);
 		if (offnum == InvalidOffsetNumber)
 			elog(STOP, "heap_update_redo: failed to add tuple");
 		PageSetLSN(page, lsn);
-		PageSetSUI(page, ThisStartUpID);	/* prev sui */
+		PageSetSUI(page, ThisStartUpID);		/* prev sui */
 		UnlockAndWriteBuffer(buffer);
 		return;
 	}
 
 	/* undo */
-	if (XLByteLT(PageGetLSN(page), lsn))	/* changes are not applied ?! */
+	if (XLByteLT(PageGetLSN(page), lsn))		/* changes are not applied
+												 * ?! */
 		elog(STOP, "heap_update_undo: bad new tuple page LSN");
 
 	elog(STOP, "heap_update_undo: unimplemented");
@@ -2606,19 +2614,19 @@ newsame:;
 static void
 _heap_unlock_tuple(void *data)
 {
-	xl_heaptid	   *xltid = (xl_heaptid*) data;
-	Relation		reln = XLogOpenRelation(false, RM_HEAP_ID, xltid->node);
-	Buffer			buffer;
-	Page			page;
-	OffsetNumber	offnum;
-	ItemId			lp;
-	HeapTupleHeader	htup;
+	xl_heaptid *xltid = (xl_heaptid *) data;
+	Relation	reln = XLogOpenRelation(false, RM_HEAP_ID, xltid->node);
+	Buffer		buffer;
+	Page		page;
+	OffsetNumber offnum;
+	ItemId		lp;
+	HeapTupleHeader htup;
 
 	if (!RelationIsValid(reln))
 		elog(STOP, "_heap_unlock_tuple: can't open relation");
 
-	buffer = XLogReadBuffer(false, reln, 
-						ItemPointerGetBlockNumber(&(xltid->tid)));
+	buffer = XLogReadBuffer(false, reln,
+							ItemPointerGetBlockNumber(&(xltid->tid)));
 	if (!BufferIsValid(buffer))
 		elog(STOP, "_heap_unlock_tuple: can't read buffer");
 
@@ -2636,8 +2644,8 @@ _heap_unlock_tuple(void *data)
 
 	htup = (HeapTupleHeader) PageGetItem(page, lp);
 
-	if (htup->t_xmax != GetCurrentTransactionId() || 
-			htup->t_cmax != GetCurrentCommandId())
+	if (htup->t_xmax != GetCurrentTransactionId() ||
+		htup->t_cmax != GetCurrentCommandId())
 		elog(STOP, "_heap_unlock_tuple: invalid xmax/cmax in rollback");
 	htup->t_infomask &= ~HEAP_XMAX_UNLOGGED;
 	htup->t_infomask |= HEAP_XMAX_INVALID;
@@ -2645,9 +2653,10 @@ _heap_unlock_tuple(void *data)
 	return;
 }
 
-void heap_redo(XLogRecPtr lsn, XLogRecord *record)
+void
+heap_redo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	info &= XLOG_HEAP_OPMASK;
 	if (info == XLOG_HEAP_INSERT)
@@ -2664,9 +2673,10 @@ void heap_redo(XLogRecPtr lsn, XLogRecord *record)
 		elog(STOP, "heap_redo: unknown op code %u", info);
 }
 
-void heap_undo(XLogRecPtr lsn, XLogRecord *record)
+void
+heap_undo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	info &= XLOG_HEAP_OPMASK;
 	if (info == XLOG_HEAP_INSERT)
@@ -2687,46 +2697,50 @@ static void
 out_target(char *buf, xl_heaptid *target)
 {
 	sprintf(buf + strlen(buf), "node %u/%u; tid %u/%u",
-		target->node.tblNode, target->node.relNode,
-		ItemPointerGetBlockNumber(&(target->tid)), 
-		ItemPointerGetOffsetNumber(&(target->tid)));
+			target->node.tblNode, target->node.relNode,
+			ItemPointerGetBlockNumber(&(target->tid)),
+			ItemPointerGetOffsetNumber(&(target->tid)));
 }
- 
+
 void
-heap_desc(char *buf, uint8 xl_info, char* rec)
+heap_desc(char *buf, uint8 xl_info, char *rec)
 {
-	uint8	info = xl_info & ~XLR_INFO_MASK;
+	uint8		info = xl_info & ~XLR_INFO_MASK;
 
 	info &= XLOG_HEAP_OPMASK;
 	if (info == XLOG_HEAP_INSERT)
 	{
-		xl_heap_insert	*xlrec = (xl_heap_insert*) rec;
+		xl_heap_insert *xlrec = (xl_heap_insert *) rec;
+
 		strcat(buf, "insert: ");
 		out_target(buf, &(xlrec->target));
 	}
 	else if (info == XLOG_HEAP_DELETE)
 	{
-		xl_heap_delete	*xlrec = (xl_heap_delete*) rec;
+		xl_heap_delete *xlrec = (xl_heap_delete *) rec;
+
 		strcat(buf, "delete: ");
 		out_target(buf, &(xlrec->target));
 	}
 	else if (info == XLOG_HEAP_UPDATE || info == XLOG_HEAP_MOVE)
 	{
-		xl_heap_update	*xlrec = (xl_heap_update*) rec;
+		xl_heap_update *xlrec = (xl_heap_update *) rec;
+
 		if (info == XLOG_HEAP_UPDATE)
 			strcat(buf, "update: ");
 		else
 			strcat(buf, "move: ");
 		out_target(buf, &(xlrec->target));
 		sprintf(buf + strlen(buf), "; new %u/%u",
-			ItemPointerGetBlockNumber(&(xlrec->newtid)), 
-			ItemPointerGetOffsetNumber(&(xlrec->newtid)));
+				ItemPointerGetBlockNumber(&(xlrec->newtid)),
+				ItemPointerGetOffsetNumber(&(xlrec->newtid)));
 	}
 	else if (info == XLOG_HEAP_CLEAN)
 	{
-		xl_heap_clean	*xlrec = (xl_heap_clean*) rec;
+		xl_heap_clean *xlrec = (xl_heap_clean *) rec;
+
 		sprintf(buf + strlen(buf), "clean: node %u/%u; blk %u",
-			xlrec->node.tblNode, xlrec->node.relNode, xlrec->block);
+				xlrec->node.tblNode, xlrec->node.relNode, xlrec->block);
 	}
 	else
 		strcat(buf, "UNKNOWN");
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 64e7262e86889525ad104df3194df81173ad5d0c..94dedbf87b90fce87f3db64c27a22c61bb8ac659 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Id: hio.c,v 1.35 2001/01/24 19:42:48 momjian Exp $
+ *	  $Id: hio.c,v 1.36 2001/03/22 03:59:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
 #include "access/hio.h"
 
 /*
- * RelationPutHeapTuple	- place tuple at specified page
+ * RelationPutHeapTuple - place tuple at specified page
  *
  * !!! ELOG(ERROR) IS DISALLOWED HERE !!!
  *
@@ -69,7 +69,7 @@ RelationPutHeapTuple(Relation relation,
  *
  * Returns (locked) buffer with free space >= given len.
  *
- * Note that we use LockPage to lock relation for extension. We can 
+ * Note that we use LockPage to lock relation for extension. We can
  * do this as long as in all other places we use page-level locking
  * for indices only. Alternatively, we could define pseudo-table as
  * we do for transactions with XactLockTable.
@@ -92,7 +92,7 @@ RelationGetBufferForTuple(Relation relation, Size len)
 	 */
 	if (len > MaxTupleSize)
 		elog(ERROR, "Tuple is too big: size %lu, max size %ld",
-			 (unsigned long)len, MaxTupleSize);
+			 (unsigned long) len, MaxTupleSize);
 
 	if (!relation->rd_myxactonly)
 		LockPage(relation, 0, ExclusiveLock);
@@ -140,13 +140,13 @@ RelationGetBufferForTuple(Relation relation, Size len)
 		{
 			/* We should not get here given the test at the top */
 			elog(STOP, "Tuple is too big: size %lu",
-				(unsigned long)len);
+				 (unsigned long) len);
 		}
 	}
 
 	if (!relation->rd_myxactonly)
 		UnlockPage(relation, 0, ExclusiveLock);
 
-	return(buffer);
+	return (buffer);
 
 }
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index a3cf6ae7116a7e4dc11eb40752e1dfe74efc9c9f..d0e60681e7793cd424a6abfbf762afa00b7dc819 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.17 2001/02/15 20:57:01 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.18 2001/03/22 03:59:13 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -41,12 +41,12 @@
 
 #undef TOAST_DEBUG
 
-static void			toast_delete(Relation rel, HeapTuple oldtup);
-static void			toast_delete_datum(Relation rel, Datum value);
-static void			toast_insert_or_update(Relation rel, HeapTuple newtup,
-								HeapTuple oldtup);
-static Datum		toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value);
-static varattrib   *toast_fetch_datum(varattrib *attr);
+static void toast_delete(Relation rel, HeapTuple oldtup);
+static void toast_delete_datum(Relation rel, Datum value);
+static void toast_insert_or_update(Relation rel, HeapTuple newtup,
+					   HeapTuple oldtup);
+static Datum toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value);
+static varattrib *toast_fetch_datum(varattrib *attr);
 
 
 /* ----------
@@ -70,14 +70,14 @@ heap_tuple_toast_attrs(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 /* ----------
  * heap_tuple_fetch_attr -
  *
- *	Public entry point to get back a toasted value 
+ *	Public entry point to get back a toasted value
  *	external storage (possibly still in compressed format).
  * ----------
  */
-varattrib *
+varattrib  *
 heap_tuple_fetch_attr(varattrib *attr)
 {
-	varattrib	*result;
+	varattrib  *result;
 
 	if (VARATT_IS_EXTERNAL(attr))
 	{
@@ -94,7 +94,7 @@ heap_tuple_fetch_attr(varattrib *attr)
 		 * ----------
 		 */
 		result = attr;
-    }
+	}
 
 	return result;
 }
@@ -107,10 +107,10 @@ heap_tuple_fetch_attr(varattrib *attr)
  *	or external storage.
  * ----------
  */
-varattrib *
+varattrib  *
 heap_tuple_untoast_attr(varattrib *attr)
 {
-	varattrib	*result;
+	varattrib  *result;
 
 	if (VARATT_IS_EXTERNAL(attr))
 	{
@@ -121,14 +121,14 @@ heap_tuple_untoast_attr(varattrib *attr)
 			 * Fetch it from the toast heap and decompress.
 			 * ----------
 			 */
-			varattrib *tmp;
+			varattrib  *tmp;
 
 			tmp = toast_fetch_datum(attr);
-			result = (varattrib *)palloc(attr->va_content.va_external.va_rawsize
-								+ VARHDRSZ);
+			result = (varattrib *) palloc(attr->va_content.va_external.va_rawsize
+										  + VARHDRSZ);
 			VARATT_SIZEP(result) = attr->va_content.va_external.va_rawsize
-								+ VARHDRSZ;
-			pglz_decompress((PGLZ_Header *)tmp, VARATT_DATA(result));
+				+ VARHDRSZ;
+			pglz_decompress((PGLZ_Header *) tmp, VARATT_DATA(result));
 
 			pfree(tmp);
 		}
@@ -147,11 +147,11 @@ heap_tuple_untoast_attr(varattrib *attr)
 		 * This is a compressed value inside of the main tuple
 		 * ----------
 		 */
-		result = (varattrib *)palloc(attr->va_content.va_compressed.va_rawsize
-							+ VARHDRSZ);
+		result = (varattrib *) palloc(attr->va_content.va_compressed.va_rawsize
+									  + VARHDRSZ);
 		VARATT_SIZEP(result) = attr->va_content.va_compressed.va_rawsize
-							+ VARHDRSZ;
-		pglz_decompress((PGLZ_Header *)attr, VARATT_DATA(result));
+			+ VARHDRSZ;
+		pglz_decompress((PGLZ_Header *) attr, VARATT_DATA(result));
 	}
 	else
 		/* ----------
@@ -173,21 +173,21 @@ heap_tuple_untoast_attr(varattrib *attr)
 static void
 toast_delete(Relation rel, HeapTuple oldtup)
 {
-	TupleDesc			tupleDesc;
-	Form_pg_attribute  *att;
-	int					numAttrs;
-	int					i;
-	Datum				value;
-	bool				isnull;
+	TupleDesc	tupleDesc;
+	Form_pg_attribute *att;
+	int			numAttrs;
+	int			i;
+	Datum		value;
+	bool		isnull;
 
 	/* ----------
 	 * Get the tuple descriptor, the number of and attribute
 	 * descriptors.
 	 * ----------
 	 */
-	tupleDesc	= rel->rd_att;
-	numAttrs	= tupleDesc->natts;
-	att			= tupleDesc->attrs;
+	tupleDesc = rel->rd_att;
+	numAttrs = tupleDesc->natts;
+	att = tupleDesc->attrs;
 
 	/* ----------
 	 * Check for external stored attributes and delete them
@@ -216,35 +216,35 @@ toast_delete(Relation rel, HeapTuple oldtup)
 static void
 toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 {
-	TupleDesc			tupleDesc;
-	Form_pg_attribute  *att;
-	int					numAttrs;
-	int					i;
-	bool				old_isnull;
-	bool				new_isnull;
-
-	bool				need_change = false;
-	bool				need_free   = false;
-	bool				need_delold = false;
-	bool				has_nulls   = false;
-
-	Size				maxDataLen;
-
-	char				toast_action[MaxHeapAttributeNumber];
-	char				toast_nulls[MaxHeapAttributeNumber];
-	Datum				toast_values[MaxHeapAttributeNumber];
-	int32				toast_sizes[MaxHeapAttributeNumber];
-	bool				toast_free[MaxHeapAttributeNumber];
-	bool				toast_delold[MaxHeapAttributeNumber];
+	TupleDesc	tupleDesc;
+	Form_pg_attribute *att;
+	int			numAttrs;
+	int			i;
+	bool		old_isnull;
+	bool		new_isnull;
+
+	bool		need_change = false;
+	bool		need_free = false;
+	bool		need_delold = false;
+	bool		has_nulls = false;
+
+	Size		maxDataLen;
+
+	char		toast_action[MaxHeapAttributeNumber];
+	char		toast_nulls[MaxHeapAttributeNumber];
+	Datum		toast_values[MaxHeapAttributeNumber];
+	int32		toast_sizes[MaxHeapAttributeNumber];
+	bool		toast_free[MaxHeapAttributeNumber];
+	bool		toast_delold[MaxHeapAttributeNumber];
 
 	/* ----------
 	 * Get the tuple descriptor, the number of and attribute
 	 * descriptors and the location of the tuple values.
 	 * ----------
 	 */
-	tupleDesc	= rel->rd_att;
-	numAttrs	= tupleDesc->natts;
-	att			= tupleDesc->attrs;
+	tupleDesc = rel->rd_att;
+	numAttrs = tupleDesc->natts;
+	att = tupleDesc->attrs;
 
 	/* ----------
 	 * Then collect information about the values given
@@ -255,14 +255,14 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 *		'x'		incompressible, but OK to move off
 	 * ----------
 	 */
-	memset(toast_action,    ' ', numAttrs * sizeof(char));
-	memset(toast_nulls,     ' ', numAttrs * sizeof(char));
-	memset(toast_free,      0,   numAttrs * sizeof(bool));
-	memset(toast_delold,    0,   numAttrs * sizeof(bool));
+	memset(toast_action, ' ', numAttrs * sizeof(char));
+	memset(toast_nulls, ' ', numAttrs * sizeof(char));
+	memset(toast_free, 0, numAttrs * sizeof(bool));
+	memset(toast_delold, 0, numAttrs * sizeof(bool));
 	for (i = 0; i < numAttrs; i++)
 	{
-		varattrib	   *old_value;
-		varattrib	   *new_value;
+		varattrib  *old_value;
+		varattrib  *new_value;
 
 		if (oldtup != NULL)
 		{
@@ -270,25 +270,25 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			 * For UPDATE get the old and new values of this attribute
 			 * ----------
 			 */
-			old_value = (varattrib *)DatumGetPointer(
-						heap_getattr(oldtup, i + 1, tupleDesc, &old_isnull));
-			toast_values[i] = 
-						heap_getattr(newtup, i + 1, tupleDesc, &new_isnull);
-			new_value = (varattrib *)DatumGetPointer(toast_values[i]);
+			old_value = (varattrib *) DatumGetPointer(
+					heap_getattr(oldtup, i + 1, tupleDesc, &old_isnull));
+			toast_values[i] =
+				heap_getattr(newtup, i + 1, tupleDesc, &new_isnull);
+			new_value = (varattrib *) DatumGetPointer(toast_values[i]);
 
 			/* ----------
 			 * If the old value is an external stored one, check if it
 			 * has changed so we have to delete it later.
 			 * ----------
 			 */
-			if (!old_isnull && att[i]->attlen == -1 && 
-						VARATT_IS_EXTERNAL(old_value))
+			if (!old_isnull && att[i]->attlen == -1 &&
+				VARATT_IS_EXTERNAL(old_value))
 			{
 				if (new_isnull || !VARATT_IS_EXTERNAL(new_value) ||
-						old_value->va_content.va_external.va_rowid !=
-						new_value->va_content.va_external.va_rowid ||
-						old_value->va_content.va_external.va_attno !=
-						new_value->va_content.va_external.va_attno)
+					old_value->va_content.va_external.va_rowid !=
+					new_value->va_content.va_external.va_rowid ||
+					old_value->va_content.va_external.va_attno !=
+					new_value->va_content.va_external.va_attno)
 				{
 					/* ----------
 					 * The old external store value isn't needed any
@@ -318,8 +318,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			 * For INSERT simply get the new value
 			 * ----------
 			 */
-			toast_values[i] = 
-						heap_getattr(newtup, i + 1, tupleDesc, &new_isnull);
+			toast_values[i] =
+				heap_getattr(newtup, i + 1, tupleDesc, &new_isnull);
 		}
 
 		/* ----------
@@ -356,7 +356,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			if (VARATT_IS_EXTERNAL(DatumGetPointer(toast_values[i])))
 			{
 				toast_values[i] = PointerGetDatum(heap_tuple_untoast_attr(
-					(varattrib *)DatumGetPointer(toast_values[i])));
+						(varattrib *) DatumGetPointer(toast_values[i])));
 				toast_free[i] = true;
 				need_change = true;
 				need_free = true;
@@ -366,7 +366,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			 * Remember the size of this attribute
 			 * ----------
 			 */
-			toast_sizes[i]  = VARATT_SIZE(DatumGetPointer(toast_values[i]));
+			toast_sizes[i] = VARATT_SIZE(DatumGetPointer(toast_values[i]));
 		}
 		else
 		{
@@ -375,7 +375,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			 * ----------
 			 */
 			toast_action[i] = 'p';
-			toast_sizes[i]  = att[i]->attlen;
+			toast_sizes[i] = att[i]->attlen;
 		}
 	}
 
@@ -384,7 +384,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 *
 	 *	1: Inline compress attributes with attstorage 'x'
 	 *	2: Store attributes with attstorage 'x' or 'e' external
-	 *  3: Inline compress attributes with attstorage 'm'
+	 *	3: Inline compress attributes with attstorage 'm'
 	 *	4: Store attributes with attstorage 'm' external
 	 * ----------
 	 */
@@ -398,12 +398,12 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 * ----------
 	 */
 	while (MAXALIGN(ComputeDataSize(tupleDesc, toast_values, toast_nulls)) >
-				maxDataLen)
+		   maxDataLen)
 	{
-		int		biggest_attno = -1;
-		int32	biggest_size  = MAXALIGN(sizeof(varattrib));
-		Datum	old_value;
-		Datum	new_value;
+		int			biggest_attno = -1;
+		int32		biggest_size = MAXALIGN(sizeof(varattrib));
+		Datum		old_value;
+		Datum		new_value;
 
 		/* ----------
 		 * Search for the biggest yet uncompressed internal attribute
@@ -420,7 +420,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			if (toast_sizes[i] > biggest_size)
 			{
 				biggest_attno = i;
-				biggest_size  = toast_sizes[i];
+				biggest_size = toast_sizes[i];
 			}
 		}
 
@@ -431,24 +431,28 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 		 * Attempt to compress it inline
 		 * ----------
 		 */
-		i					= biggest_attno;
-		old_value			= toast_values[i];
-		new_value			= toast_compress_datum(old_value);
+		i = biggest_attno;
+		old_value = toast_values[i];
+		new_value = toast_compress_datum(old_value);
 
 		if (DatumGetPointer(new_value) != NULL)
 		{
 			/* successful compression */
 			if (toast_free[i])
 				pfree(DatumGetPointer(old_value));
-			toast_values[i]	= new_value;
-			toast_free[i]	= true;
-			toast_sizes[i]	= VARATT_SIZE(toast_values[i]);
-			need_change		= true;
-			need_free		= true;
+			toast_values[i] = new_value;
+			toast_free[i] = true;
+			toast_sizes[i] = VARATT_SIZE(toast_values[i]);
+			need_change = true;
+			need_free = true;
 		}
 		else
 		{
-			/* incompressible data, ignore on subsequent compression passes */
+
+			/*
+			 * incompressible data, ignore on subsequent compression
+			 * passes
+			 */
 			toast_action[i] = 'x';
 		}
 	}
@@ -459,11 +463,11 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 * ----------
 	 */
 	while (MAXALIGN(ComputeDataSize(tupleDesc, toast_values, toast_nulls)) >
-				maxDataLen && rel->rd_rel->reltoastrelid != InvalidOid)
+		   maxDataLen && rel->rd_rel->reltoastrelid != InvalidOid)
 	{
-		int		biggest_attno = -1;
-		int32	biggest_size  = MAXALIGN(sizeof(varattrib));
-		Datum	old_value;
+		int			biggest_attno = -1;
+		int32		biggest_size = MAXALIGN(sizeof(varattrib));
+		Datum		old_value;
 
 		/* ----------
 		 * Search for the biggest yet inlined attribute with
@@ -481,7 +485,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			if (toast_sizes[i] > biggest_size)
 			{
 				biggest_attno = i;
-				biggest_size  = toast_sizes[i];
+				biggest_size = toast_sizes[i];
 			}
 		}
 
@@ -492,21 +496,21 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 		 * Store this external
 		 * ----------
 		 */
-		i					= biggest_attno;
-		old_value			= toast_values[i];
-		toast_action[i]		= 'p';
-		toast_values[i]		= toast_save_datum(rel,
-									newtup->t_data->t_oid,
-									i + 1,
-									toast_values[i]);
+		i = biggest_attno;
+		old_value = toast_values[i];
+		toast_action[i] = 'p';
+		toast_values[i] = toast_save_datum(rel,
+										   newtup->t_data->t_oid,
+										   i + 1,
+										   toast_values[i]);
 		if (toast_free[i])
 			pfree(DatumGetPointer(old_value));
 
-		toast_free[i]		= true;
-		toast_sizes[i]		= VARATT_SIZE(toast_values[i]);
+		toast_free[i] = true;
+		toast_sizes[i] = VARATT_SIZE(toast_values[i]);
 
 		need_change = true;
-		need_free   = true;
+		need_free = true;
 	}
 
 	/* ----------
@@ -515,12 +519,12 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 * ----------
 	 */
 	while (MAXALIGN(ComputeDataSize(tupleDesc, toast_values, toast_nulls)) >
-				maxDataLen)
+		   maxDataLen)
 	{
-		int		biggest_attno = -1;
-		int32	biggest_size  = MAXALIGN(sizeof(varattrib));
-		Datum	old_value;
-		Datum	new_value;
+		int			biggest_attno = -1;
+		int32		biggest_size = MAXALIGN(sizeof(varattrib));
+		Datum		old_value;
+		Datum		new_value;
 
 		/* ----------
 		 * Search for the biggest yet uncompressed internal attribute
@@ -537,7 +541,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			if (toast_sizes[i] > biggest_size)
 			{
 				biggest_attno = i;
-				biggest_size  = toast_sizes[i];
+				biggest_size = toast_sizes[i];
 			}
 		}
 
@@ -548,24 +552,28 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 		 * Attempt to compress it inline
 		 * ----------
 		 */
-		i					= biggest_attno;
-		old_value			= toast_values[i];
-		new_value			= toast_compress_datum(old_value);
+		i = biggest_attno;
+		old_value = toast_values[i];
+		new_value = toast_compress_datum(old_value);
 
 		if (DatumGetPointer(new_value) != NULL)
 		{
 			/* successful compression */
 			if (toast_free[i])
 				pfree(DatumGetPointer(old_value));
-			toast_values[i]	= new_value;
-			toast_free[i]	= true;
-			toast_sizes[i]	= VARATT_SIZE(toast_values[i]);
-			need_change		= true;
-			need_free		= true;
+			toast_values[i] = new_value;
+			toast_free[i] = true;
+			toast_sizes[i] = VARATT_SIZE(toast_values[i]);
+			need_change = true;
+			need_free = true;
 		}
 		else
 		{
-			/* incompressible data, ignore on subsequent compression passes */
+
+			/*
+			 * incompressible data, ignore on subsequent compression
+			 * passes
+			 */
 			toast_action[i] = 'x';
 		}
 	}
@@ -575,11 +583,11 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 * ----------
 	 */
 	while (MAXALIGN(ComputeDataSize(tupleDesc, toast_values, toast_nulls)) >
-				maxDataLen && rel->rd_rel->reltoastrelid != InvalidOid)
+		   maxDataLen && rel->rd_rel->reltoastrelid != InvalidOid)
 	{
-		int		biggest_attno = -1;
-		int32	biggest_size  = MAXALIGN(sizeof(varattrib));
-		Datum	old_value;
+		int			biggest_attno = -1;
+		int32		biggest_size = MAXALIGN(sizeof(varattrib));
+		Datum		old_value;
 
 		/* ----------
 		 * Search for the biggest yet inlined attribute with
@@ -597,7 +605,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 			if (toast_sizes[i] > biggest_size)
 			{
 				biggest_attno = i;
-				biggest_size  = toast_sizes[i];
+				biggest_size = toast_sizes[i];
 			}
 		}
 
@@ -608,21 +616,21 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 		 * Store this external
 		 * ----------
 		 */
-		i					= biggest_attno;
-		old_value			= toast_values[i];
-		toast_action[i]		= 'p';
-		toast_values[i]		= toast_save_datum(rel,
-									newtup->t_data->t_oid,
-									i + 1,
-									toast_values[i]);
+		i = biggest_attno;
+		old_value = toast_values[i];
+		toast_action[i] = 'p';
+		toast_values[i] = toast_save_datum(rel,
+										   newtup->t_data->t_oid,
+										   i + 1,
+										   toast_values[i]);
 		if (toast_free[i])
 			pfree(DatumGetPointer(old_value));
 
-		toast_free[i]		= true;
-		toast_sizes[i]		= VARATT_SIZE(toast_values[i]);
+		toast_free[i] = true;
+		toast_sizes[i] = VARATT_SIZE(toast_values[i]);
 
 		need_change = true;
-		need_free   = true;
+		need_free = true;
 	}
 
 	/* ----------
@@ -632,10 +640,10 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 	 */
 	if (need_change)
 	{
-		char		   *new_data;
-		int32			new_len;
-		MemoryContext	oldcxt;
-		HeapTupleHeader	olddata;
+		char	   *new_data;
+		int32		new_len;
+		MemoryContext oldcxt;
+		HeapTupleHeader olddata;
 
 		/* ----------
 		 * Calculate the new size of the tuple
@@ -662,24 +670,24 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 		 * ----------
 		 */
 		memcpy(new_data, newtup->t_data, newtup->t_data->t_hoff);
-		newtup->t_data = (HeapTupleHeader)new_data;
+		newtup->t_data = (HeapTupleHeader) new_data;
 		newtup->t_len = new_len;
 
-		DataFill((char *)(MAXALIGN((long)new_data +
-						offsetof(HeapTupleHeaderData, t_bits) + 
-						((has_nulls) ? BITMAPLEN(numAttrs) : 0))),
-				tupleDesc,
-				toast_values,
-				toast_nulls,
-				&(newtup->t_data->t_infomask),
-				has_nulls ? newtup->t_data->t_bits : NULL);
+		DataFill((char *) (MAXALIGN((long) new_data +
+								  offsetof(HeapTupleHeaderData, t_bits) +
+							   ((has_nulls) ? BITMAPLEN(numAttrs) : 0))),
+				 tupleDesc,
+				 toast_values,
+				 toast_nulls,
+				 &(newtup->t_data->t_infomask),
+				 has_nulls ? newtup->t_data->t_bits : NULL);
 
 		/* ----------
 		 * In the case we modified a previously modified tuple again,
 		 * free the memory from the previous run
 		 * ----------
 		 */
-		if ((char *)olddata != ((char *)newtup + HEAPTUPLESIZE))
+		if ((char *) olddata != ((char *) newtup + HEAPTUPLESIZE))
 			pfree(olddata);
 
 		/* ----------
@@ -723,7 +731,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
 Datum
 toast_compress_datum(Datum value)
 {
-	varattrib	   *tmp;
+	varattrib  *tmp;
 
 	tmp = (varattrib *) palloc(sizeof(PGLZ_Header) + VARATT_SIZE(value));
 	pglz_compress(VARATT_DATA(value), VARATT_SIZE(value) - VARHDRSZ,
@@ -754,45 +762,45 @@ toast_compress_datum(Datum value)
 static Datum
 toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
 {
-	Relation			toastrel;
-	Relation			toastidx;
-	HeapTuple			toasttup;
-	InsertIndexResult	idxres;
-	TupleDesc			toasttupDesc;
-	Datum				t_values[3];
-	char				t_nulls[3];
-	varattrib		   *result;
-	char				chunk_data[VARHDRSZ + TOAST_MAX_CHUNK_SIZE];
-	int32				chunk_size;
-	int32				chunk_seq = 0;
-	char			   *data_p;
-	int32				data_todo;
+	Relation	toastrel;
+	Relation	toastidx;
+	HeapTuple	toasttup;
+	InsertIndexResult idxres;
+	TupleDesc	toasttupDesc;
+	Datum		t_values[3];
+	char		t_nulls[3];
+	varattrib  *result;
+	char		chunk_data[VARHDRSZ + TOAST_MAX_CHUNK_SIZE];
+	int32		chunk_size;
+	int32		chunk_seq = 0;
+	char	   *data_p;
+	int32		data_todo;
 
 	/* ----------
 	 * Create the varattrib reference
 	 * ----------
 	 */
-	result = (varattrib *)palloc(sizeof(varattrib));
+	result = (varattrib *) palloc(sizeof(varattrib));
 
-	result->va_header	= sizeof(varattrib) | VARATT_FLAG_EXTERNAL;
+	result->va_header = sizeof(varattrib) | VARATT_FLAG_EXTERNAL;
 	if (VARATT_IS_COMPRESSED(value))
 	{
 		result->va_header |= VARATT_FLAG_COMPRESSED;
-		result->va_content.va_external.va_rawsize = 
-					((varattrib *)value)->va_content.va_compressed.va_rawsize;
+		result->va_content.va_external.va_rawsize =
+			((varattrib *) value)->va_content.va_compressed.va_rawsize;
 	}
 	else
 		result->va_content.va_external.va_rawsize = VARATT_SIZE(value);
-					
-	result->va_content.va_external.va_extsize		= 
-					VARATT_SIZE(value) - VARHDRSZ;
-	result->va_content.va_external.va_valueid		= newoid();
-	result->va_content.va_external.va_toastrelid	= 
-					rel->rd_rel->reltoastrelid;
-	result->va_content.va_external.va_toastidxid	= 
-					rel->rd_rel->reltoastidxid;
-	result->va_content.va_external.va_rowid			= mainoid;
-	result->va_content.va_external.va_attno			= attno;
+
+	result->va_content.va_external.va_extsize =
+		VARATT_SIZE(value) - VARHDRSZ;
+	result->va_content.va_external.va_valueid = newoid();
+	result->va_content.va_external.va_toastrelid =
+		rel->rd_rel->reltoastrelid;
+	result->va_content.va_external.va_toastidxid =
+		rel->rd_rel->reltoastidxid;
+	result->va_content.va_external.va_rowid = mainoid;
+	result->va_content.va_external.va_attno = attno;
 
 	/* ----------
 	 * Initialize constant parts of the tuple data
@@ -808,8 +816,8 @@ toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
 	 * Get the data to process
 	 * ----------
 	 */
-	data_p		= VARATT_DATA(value);
-	data_todo	= VARATT_SIZE(value) - VARHDRSZ;
+	data_p = VARATT_DATA(value);
+	data_todo = VARATT_SIZE(value) - VARHDRSZ;
 
 	/* ----------
 	 * Open the toast relation
@@ -818,9 +826,9 @@ toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
 	toastrel = heap_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
 	toasttupDesc = toastrel->rd_att;
 	toastidx = index_open(rel->rd_rel->reltoastidxid);
-	
+
 	/* ----------
-	 * Split up the item into chunks 
+	 * Split up the item into chunks
 	 * ----------
 	 */
 	while (data_todo > 0)
@@ -848,8 +856,8 @@ toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
 		 */
 		heap_insert(toastrel, toasttup);
 		idxres = index_insert(toastidx, t_values, t_nulls,
-						&(toasttup->t_self),
-						toastrel);
+							  &(toasttup->t_self),
+							  toastrel);
 		if (idxres == NULL)
 			elog(ERROR, "Failed to insert index entry for TOAST tuple");
 
@@ -888,14 +896,14 @@ toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
 static void
 toast_delete_datum(Relation rel, Datum value)
 {
-	register varattrib	   *attr = (varattrib *)value;
-	Relation				toastrel;
-	Relation				toastidx;
-	ScanKeyData				toastkey;
-	IndexScanDesc			toastscan;
-	HeapTupleData			toasttup;
-	RetrieveIndexResult		indexRes;
-	Buffer					buffer;
+	register varattrib *attr = (varattrib *) value;
+	Relation	toastrel;
+	Relation	toastidx;
+	ScanKeyData toastkey;
+	IndexScanDesc toastscan;
+	HeapTupleData toasttup;
+	RetrieveIndexResult indexRes;
+	Buffer		buffer;
 
 	if (!VARATT_IS_EXTERNAL(attr))
 		return;
@@ -904,8 +912,8 @@ toast_delete_datum(Relation rel, Datum value)
 	 * Open the toast relation and it's index
 	 * ----------
 	 */
-	toastrel	= heap_open(attr->va_content.va_external.va_toastrelid,
-					RowExclusiveLock);
+	toastrel = heap_open(attr->va_content.va_external.va_toastrelid,
+						 RowExclusiveLock);
 	toastidx = index_open(attr->va_content.va_external.va_toastidxid);
 
 	/* ----------
@@ -913,10 +921,10 @@ toast_delete_datum(Relation rel, Datum value)
 	 * ----------
 	 */
 	ScanKeyEntryInitialize(&toastkey,
-					(bits16) 0, 
-					(AttrNumber) 1, 
-					(RegProcedure) F_OIDEQ, 
-					ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
+						   (bits16) 0,
+						   (AttrNumber) 1,
+						   (RegProcedure) F_OIDEQ,
+			  ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
 
 	/* ----------
 	 * Read the chunks by index
@@ -961,36 +969,36 @@ toast_delete_datum(Relation rel, Datum value)
 static varattrib *
 toast_fetch_datum(varattrib *attr)
 {
-	Relation				toastrel;
-	Relation				toastidx;
-	ScanKeyData				toastkey;
-	IndexScanDesc			toastscan;
-	HeapTupleData			toasttup;
-	HeapTuple				ttup;
-	TupleDesc				toasttupDesc;
-	RetrieveIndexResult		indexRes;
-	Buffer					buffer;
-
-	varattrib			   *result;
-	int32					ressize;
-	int32					residx;
-	int						numchunks;
-	Pointer					chunk;
-	bool					isnull;
-	int32					chunksize;
-
-	char				   *chunks_found;
-	char				   *chunks_expected;
+	Relation	toastrel;
+	Relation	toastidx;
+	ScanKeyData toastkey;
+	IndexScanDesc toastscan;
+	HeapTupleData toasttup;
+	HeapTuple	ttup;
+	TupleDesc	toasttupDesc;
+	RetrieveIndexResult indexRes;
+	Buffer		buffer;
+
+	varattrib  *result;
+	int32		ressize;
+	int32		residx;
+	int			numchunks;
+	Pointer		chunk;
+	bool		isnull;
+	int32		chunksize;
+
+	char	   *chunks_found;
+	char	   *chunks_expected;
 
 	ressize = attr->va_content.va_external.va_extsize;
-    numchunks = ((ressize - 1) / TOAST_MAX_CHUNK_SIZE) + 1;
+	numchunks = ((ressize - 1) / TOAST_MAX_CHUNK_SIZE) + 1;
 
-	chunks_found    = palloc(numchunks);
+	chunks_found = palloc(numchunks);
 	chunks_expected = palloc(numchunks);
-	memset(chunks_found,    0, numchunks);
+	memset(chunks_found, 0, numchunks);
 	memset(chunks_expected, 1, numchunks);
 
-	result = (varattrib *)palloc(ressize + VARHDRSZ);
+	result = (varattrib *) palloc(ressize + VARHDRSZ);
 	VARATT_SIZEP(result) = ressize + VARHDRSZ;
 	if (VARATT_IS_COMPRESSED(attr))
 		VARATT_SIZEP(result) |= VARATT_FLAG_COMPRESSED;
@@ -999,8 +1007,8 @@ toast_fetch_datum(varattrib *attr)
 	 * Open the toast relation and it's index
 	 * ----------
 	 */
-	toastrel	= heap_open(attr->va_content.va_external.va_toastrelid,
-					AccessShareLock);
+	toastrel = heap_open(attr->va_content.va_external.va_toastrelid,
+						 AccessShareLock);
 	toasttupDesc = toastrel->rd_att;
 	toastidx = index_open(attr->va_content.va_external.va_toastidxid);
 
@@ -1009,10 +1017,10 @@ toast_fetch_datum(varattrib *attr)
 	 * ----------
 	 */
 	ScanKeyEntryInitialize(&toastkey,
-					(bits16) 0, 
-					(AttrNumber) 1, 
-					(RegProcedure) F_OIDEQ, 
-					ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
+						   (bits16) 0,
+						   (AttrNumber) 1,
+						   (RegProcedure) F_OIDEQ,
+			  ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
 
 	/* ----------
 	 * Read the chunks by index
@@ -1049,7 +1057,7 @@ toast_fetch_datum(varattrib *attr)
 			elog(ERROR, "unexpected chunk number %d for toast value %d",
 				 residx,
 				 attr->va_content.va_external.va_valueid);
-		if (residx < numchunks-1)
+		if (residx < numchunks - 1)
 		{
 			if (chunksize != TOAST_MAX_CHUNK_SIZE)
 				elog(ERROR, "unexpected chunk size %d in chunk %d for toast value %d",
@@ -1072,7 +1080,7 @@ toast_fetch_datum(varattrib *attr)
 		 * Copy the data into proper place in our result
 		 * ----------
 		 */
-		memcpy(((char *)VARATT_DATA(result)) + residx * TOAST_MAX_CHUNK_SIZE,
+		memcpy(((char *) VARATT_DATA(result)) + residx * TOAST_MAX_CHUNK_SIZE,
 			   VARATT_DATA(chunk),
 			   chunksize);
 
@@ -1085,7 +1093,7 @@ toast_fetch_datum(varattrib *attr)
 	 */
 	if (memcmp(chunks_found, chunks_expected, numchunks) != 0)
 		elog(ERROR, "not all toast chunks found for value %d",
-						attr->va_content.va_external.va_valueid);
+			 attr->va_content.va_external.va_valueid);
 	pfree(chunks_expected);
 	pfree(chunks_found);
 
diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c
index 1cc2c42c01c38cdd464e90bafeb2387749e8b166..3b01639206842c18ed41bab52633eb92da33311a 100644
--- a/src/backend/access/index/istrat.c
+++ b/src/backend/access/index/istrat.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.48 2001/01/24 19:42:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.49 2001/03/22 03:59:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -239,8 +239,8 @@ StrategyTermEvaluate(StrategyTerm term,
 				break;
 
 			case SK_NEGATE:
-				result = ! DatumGetBool(FunctionCall2(&entry->sk_func,
-													  left, right));
+				result = !DatumGetBool(FunctionCall2(&entry->sk_func,
+													 left, right));
 				break;
 
 			case SK_COMMUTE:
@@ -249,8 +249,8 @@ StrategyTermEvaluate(StrategyTerm term,
 				break;
 
 			case SK_NEGATE | SK_COMMUTE:
-				result = ! DatumGetBool(FunctionCall2(&entry->sk_func,
-													  right, left));
+				result = !DatumGetBool(FunctionCall2(&entry->sk_func,
+													 right, left));
 				break;
 
 			default:
@@ -263,6 +263,7 @@ StrategyTermEvaluate(StrategyTerm term,
 
 	return result;
 }
+
 #endif
 
 /* ----------------
@@ -465,6 +466,7 @@ RelationInvokeStrategy(Relation relation,
 
 
 }
+
 #endif
 
 /* ----------------
@@ -519,7 +521,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
 
 	if (!RegProcedureIsValid(entry->sk_procedure))
 		elog(ERROR,
-			 "OperatorRelationFillScanKeyEntry: no procedure for operator %u",
+		"OperatorRelationFillScanKeyEntry: no procedure for operator %u",
 			 operatorObjectId);
 
 	fmgr_info(entry->sk_procedure, &entry->sk_func);
@@ -597,9 +599,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
 	}
 
 	if (cachesearch)
-	{
 		ReleaseSysCache(tuple);
-	}
 	else
 	{
 		heap_endscan(scan);
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c
index 435a7f72dde871bdf066272f9daf88d6db1ac823..fc85906d9b2b426dbf1d3c46dd54b0b407cfdd5c 100644
--- a/src/backend/access/nbtree/nbtcompare.c
+++ b/src/backend/access/nbtree/nbtcompare.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.40 2001/01/24 19:42:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.41 2001/03/22 03:59:14 momjian Exp $
  *
  * NOTES
  *
@@ -150,8 +150,8 @@ btoidvectorcmp(PG_FUNCTION_ARGS)
 Datum
 btabstimecmp(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	a = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	b = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime a = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime b = PG_GETARG_ABSOLUTETIME(1);
 
 	if (AbsoluteTimeIsBefore(a, b))
 		PG_RETURN_INT32(-1);
@@ -236,9 +236,10 @@ bttextcmp(PG_FUNCTION_ARGS)
 
 	if (res == 0 && VARSIZE(a) != VARSIZE(b))
 	{
+
 		/*
-		 * The two strings are the same in the first len bytes,
-		 * and they are of different lengths.
+		 * The two strings are the same in the first len bytes, and they
+		 * are of different lengths.
 		 */
 		if (VARSIZE(a) < VARSIZE(b))
 			res = -1;
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 325e585e3cc28a35b218db176353acaaab3c4739..f2112de6777d72b1714789ef059ee03f9e953a58 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.81 2001/02/07 23:35:33 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.82 2001/03/22 03:59:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,23 +23,23 @@
 typedef struct
 {
 	/* context data for _bt_checksplitloc */
-	Size	newitemsz;			/* size of new item to be inserted */
-	bool	non_leaf;			/* T if splitting an internal node */
+	Size		newitemsz;		/* size of new item to be inserted */
+	bool		non_leaf;		/* T if splitting an internal node */
 
-	bool	have_split;			/* found a valid split? */
+	bool		have_split;		/* found a valid split? */
 
 	/* these fields valid only if have_split is true */
-	bool	newitemonleft;		/* new item on left or right of best split */
+	bool		newitemonleft;	/* new item on left or right of best split */
 	OffsetNumber firstright;	/* best split point */
-	int		best_delta;			/* best size delta so far */
+	int			best_delta;		/* best size delta so far */
 } FindSplitData;
 
 extern bool FixBTree;
 
-Buffer _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release);
+Buffer		_bt_fixroot(Relation rel, Buffer oldrootbuf, bool release);
 static void _bt_fixtree(Relation rel, BlockNumber blkno);
-static void _bt_fixbranch(Relation rel, BlockNumber lblkno, 
-				BlockNumber rblkno, BTStack true_stack);
+static void _bt_fixbranch(Relation rel, BlockNumber lblkno,
+			  BlockNumber rblkno, BTStack true_stack);
 static void _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit);
 static void _bt_fixup(Relation rel, Buffer buf);
 static OffsetNumber _bt_getoff(Page page, BlockNumber blkno);
@@ -47,34 +47,34 @@ static OffsetNumber _bt_getoff(Page page, BlockNumber blkno);
 static Buffer _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
 
 static TransactionId _bt_check_unique(Relation rel, BTItem btitem,
-									  Relation heapRel, Buffer buf,
-									  ScanKey itup_scankey);
+				 Relation heapRel, Buffer buf,
+				 ScanKey itup_scankey);
 static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf,
-										BTStack stack,
-										int keysz, ScanKey scankey,
-										BTItem btitem,
-										OffsetNumber afteritem);
-static void _bt_insertuple(Relation rel, Buffer buf, 
-						Size itemsz, BTItem btitem, OffsetNumber newitemoff);
+			   BTStack stack,
+			   int keysz, ScanKey scankey,
+			   BTItem btitem,
+			   OffsetNumber afteritem);
+static void _bt_insertuple(Relation rel, Buffer buf,
+			   Size itemsz, BTItem btitem, OffsetNumber newitemoff);
 static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
-						OffsetNumber newitemoff, Size newitemsz,
-						BTItem newitem, bool newitemonleft,
-						OffsetNumber *itup_off, BlockNumber *itup_blkno);
+		  OffsetNumber newitemoff, Size newitemsz,
+		  BTItem newitem, bool newitemonleft,
+		  OffsetNumber *itup_off, BlockNumber *itup_blkno);
 static OffsetNumber _bt_findsplitloc(Relation rel, Page page,
-									 OffsetNumber newitemoff,
-									 Size newitemsz,
-									 bool *newitemonleft);
+				 OffsetNumber newitemoff,
+				 Size newitemsz,
+				 bool *newitemonleft);
 static void _bt_checksplitloc(FindSplitData *state, OffsetNumber firstright,
-							  int leftfree, int rightfree,
-							  bool newitemonleft, Size firstrightitemsz);
+				  int leftfree, int rightfree,
+				  bool newitemonleft, Size firstrightitemsz);
 static Buffer _bt_getstackbuf(Relation rel, BTStack stack, int access);
 static void _bt_pgaddtup(Relation rel, Page page,
-						 Size itemsize, BTItem btitem,
-						 OffsetNumber itup_off, const char *where);
+			 Size itemsize, BTItem btitem,
+			 OffsetNumber itup_off, const char *where);
 static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
-						int keysz, ScanKey scankey);
+			int keysz, ScanKey scankey);
 
-static Relation		_xlheapRel;	/* temporary hack */
+static Relation _xlheapRel;		/* temporary hack */
 
 /*
  *	_bt_doinsert() -- Handle insertion of a single btitem in the tree.
@@ -114,8 +114,8 @@ top:
 	buf = _bt_moveright(rel, buf, natts, itup_scankey, BT_WRITE);
 
 	/*
-	 * If we're not allowing duplicates, make sure the key isn't
-	 * already in the index.  XXX this belongs somewhere else, likely
+	 * If we're not allowing duplicates, make sure the key isn't already
+	 * in the index.  XXX this belongs somewhere else, likely
 	 */
 	if (index_is_unique)
 	{
@@ -134,7 +134,7 @@ top:
 		}
 	}
 
-	_xlheapRel = heapRel;	/* temporary hack */
+	_xlheapRel = heapRel;		/* temporary hack */
 
 	/* do the insertion */
 	res = _bt_insertonpg(rel, buf, stack, natts, itup_scankey, btitem, 0);
@@ -150,7 +150,7 @@ top:
  *	_bt_check_unique() -- Check for violation of unique index constraint
  *
  * Returns NullTransactionId if there is no conflict, else an xact ID we
- * must wait for to see if it commits a conflicting tuple.  If an actual
+ * must wait for to see if it commits a conflicting tuple.	If an actual
  * conflict is detected, no return --- just elog().
  */
 static TransactionId
@@ -171,8 +171,8 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
 	maxoff = PageGetMaxOffsetNumber(page);
 
 	/*
-	 * Find first item >= proposed new item.  Note we could also get
-	 * a pointer to end-of-page here.
+	 * Find first item >= proposed new item.  Note we could also get a
+	 * pointer to end-of-page here.
 	 */
 	offset = _bt_binsrch(rel, buf, natts, itup_scankey);
 
@@ -187,24 +187,24 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
 		BlockNumber nblkno;
 
 		/*
-		 * _bt_compare returns 0 for (1,NULL) and (1,NULL) - this's
-		 * how we handling NULLs - and so we must not use _bt_compare
-		 * in real comparison, but only for ordering/finding items on
-		 * pages. - vadim 03/24/97
+		 * _bt_compare returns 0 for (1,NULL) and (1,NULL) - this's how we
+		 * handling NULLs - and so we must not use _bt_compare in real
+		 * comparison, but only for ordering/finding items on pages. -
+		 * vadim 03/24/97
 		 *
-		 * make sure the offset points to an actual key
-		 * before trying to compare it...
+		 * make sure the offset points to an actual key before trying to
+		 * compare it...
 		 */
 		if (offset <= maxoff)
 		{
-			if (! _bt_isequal(itupdesc, page, offset, natts, itup_scankey))
+			if (!_bt_isequal(itupdesc, page, offset, natts, itup_scankey))
 				break;			/* we're past all the equal tuples */
 
 			/*
-			 * Have to check is inserted heap tuple deleted one (i.e.
-			 * just moved to another place by vacuum)!  We only need to
-			 * do this once, but don't want to do it at all unless
-			 * we see equal tuples, so as not to slow down unequal case.
+			 * Have to check is inserted heap tuple deleted one (i.e. just
+			 * moved to another place by vacuum)!  We only need to do this
+			 * once, but don't want to do it at all unless we see equal
+			 * tuples, so as not to slow down unequal case.
 			 */
 			if (chtup)
 			{
@@ -220,11 +220,11 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
 			cbti = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
 			htup.t_self = cbti->bti_itup.t_tid;
 			heap_fetch(heapRel, SnapshotDirty, &htup, &buffer);
-			if (htup.t_data != NULL)		/* it is a duplicate */
+			if (htup.t_data != NULL)	/* it is a duplicate */
 			{
 				TransactionId xwait =
-					(TransactionIdIsValid(SnapshotDirty->xmin)) ?
-					SnapshotDirty->xmin : SnapshotDirty->xmax;
+				(TransactionIdIsValid(SnapshotDirty->xmin)) ?
+				SnapshotDirty->xmin : SnapshotDirty->xmax;
 
 				/*
 				 * If this tuple is being updated by other transaction
@@ -238,6 +238,7 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
 					/* Tell _bt_doinsert to wait... */
 					return xwait;
 				}
+
 				/*
 				 * Otherwise we have a definite conflict.
 				 */
@@ -304,7 +305,7 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
  *		NOTE: if the new key is equal to one or more existing keys, we can
  *		legitimately place it anywhere in the series of equal keys --- in fact,
  *		if the new key is equal to the page's "high key" we can place it on
- *		the next page.  If it is equal to the high key, and there's not room
+ *		the next page.	If it is equal to the high key, and there's not room
  *		to insert the new tuple on the current page without splitting, then
  *		we can move right hoping to find more free space and avoid a split.
  *		(We should not move right indefinitely, however, since that leads to
@@ -358,16 +359,14 @@ _bt_insertonpg(Relation rel,
 	 */
 	if (itemsz > (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
 		elog(ERROR, "btree: index item size %lu exceeds maximum %lu",
-			 (unsigned long)itemsz,
-			 (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
+			 (unsigned long) itemsz,
+			 (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData));
 
 	/*
 	 * Determine exactly where new item will go.
 	 */
 	if (afteritem > 0)
-	{
 		newitemoff = afteritem + 1;
-	}
 	else
 	{
 		/*----------
@@ -383,12 +382,12 @@ _bt_insertonpg(Relation rel,
 		 * on every insert.  We implement "get tired" as a random choice,
 		 * since stopping after scanning a fixed number of pages wouldn't work
 		 * well (we'd never reach the right-hand side of previously split
-		 * pages).  Currently the probability of moving right is set at 0.99,
+		 * pages).	Currently the probability of moving right is set at 0.99,
 		 * which may seem too high to change the behavior much, but it does an
 		 * excellent job of preventing O(N^2) behavior with many equal keys.
 		 *----------
 		 */
-		bool	movedright = false;
+		bool		movedright = false;
 
 		while (PageGetFreeSpace(page) < itemsz &&
 			   !P_RIGHTMOST(lpageop) &&
@@ -396,7 +395,7 @@ _bt_insertonpg(Relation rel,
 			   random() > (MAX_RANDOM_VALUE / 100))
 		{
 			/* step right one page */
-			BlockNumber		rblkno = lpageop->btpo_next;
+			BlockNumber rblkno = lpageop->btpo_next;
 
 			_bt_relbuf(rel, buf, BT_WRITE);
 			buf = _bt_getbuf(rel, rblkno, BT_WRITE);
@@ -404,10 +403,11 @@ _bt_insertonpg(Relation rel,
 			lpageop = (BTPageOpaque) PageGetSpecialPointer(page);
 			movedright = true;
 		}
+
 		/*
-		 * Now we are on the right page, so find the insert position.
-		 * If we moved right at all, we know we should insert at the
-		 * start of the page, else must find the position by searching.
+		 * Now we are on the right page, so find the insert position. If
+		 * we moved right at all, we know we should insert at the start of
+		 * the page, else must find the position by searching.
 		 */
 		if (movedright)
 			newitemoff = P_FIRSTDATAKEY(lpageop);
@@ -418,9 +418,9 @@ _bt_insertonpg(Relation rel,
 	/*
 	 * Do we need to split the page to fit the item on it?
 	 *
-	 * Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its
-	 * result, so this comparison is correct even though we appear to
-	 * be accounting only for the item and not for its line pointer.
+	 * Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its result,
+	 * so this comparison is correct even though we appear to be
+	 * accounting only for the item and not for its line pointer.
 	 */
 	if (PageGetFreeSpace(page) < itemsz)
 	{
@@ -468,7 +468,7 @@ _bt_insertonpg(Relation rel,
 
 		if (is_root)
 		{
-			Buffer	rootbuf;
+			Buffer		rootbuf;
 
 			Assert(stack == (BTStack) NULL);
 			/* create a new root node and release the split buffers */
@@ -481,7 +481,7 @@ _bt_insertonpg(Relation rel,
 		{
 			InsertIndexResult newres;
 			BTItem		new_item;
-			BTStackData	fakestack;
+			BTStackData fakestack;
 			BTItem		ritem;
 			Buffer		pbuf;
 
@@ -489,10 +489,11 @@ _bt_insertonpg(Relation rel,
 			if (stack == (BTStack) NULL)
 			{
 				elog(DEBUG, "btree: concurrent ROOT page split");
+
 				/*
 				 * If root page splitter failed to create new root page
-				 * then old root' btpo_parent still points to metapage.
-				 * We have to fix root page in this case.
+				 * then old root' btpo_parent still points to metapage. We
+				 * have to fix root page in this case.
 				 */
 				if (BTreeInvalidParent(lpageop))
 				{
@@ -531,9 +532,9 @@ _bt_insertonpg(Relation rel,
 			 * item! We want to find parent pointing to where we are,
 			 * right ?	  - vadim 05/27/97
 			 *
-			 * Interestingly, this means we didn't *really* need to stack
-			 * the parent key at all; all we really care about is the
-			 * saved block and offset as a starting point for our search...
+			 * Interestingly, this means we didn't *really* need to stack the
+			 * parent key at all; all we really care about is the saved
+			 * block and offset as a starting point for our search...
 			 */
 			ItemPointerSet(&(stack->bts_btitem.bti_itup.t_tid),
 						   bknum, P_HIKEY);
@@ -583,25 +584,26 @@ formres:;
 }
 
 static void
-_bt_insertuple(Relation rel, Buffer buf, 
-				Size itemsz, BTItem btitem, OffsetNumber newitemoff)
+_bt_insertuple(Relation rel, Buffer buf,
+			   Size itemsz, BTItem btitem, OffsetNumber newitemoff)
 {
-	Page			page = BufferGetPage(buf);
-	BTPageOpaque	pageop = (BTPageOpaque) PageGetSpecialPointer(page);
+	Page		page = BufferGetPage(buf);
+	BTPageOpaque pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
 	START_CRIT_SECTION();
 	_bt_pgaddtup(rel, page, itemsz, btitem, newitemoff, "page");
 	/* XLOG stuff */
 	{
-		xl_btree_insert		xlrec;
-		uint8				flag = XLOG_BTREE_INSERT;
-		XLogRecPtr			recptr;
-		XLogRecData			rdata[2];
-		BTItemData			truncitem;
-			xlrec.target.node = rel->rd_node;
+		xl_btree_insert xlrec;
+		uint8		flag = XLOG_BTREE_INSERT;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[2];
+		BTItemData	truncitem;
+
+		xlrec.target.node = rel->rd_node;
 		ItemPointerSet(&(xlrec.target.tid), BufferGetBlockNumber(buf), newitemoff);
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfBtreeInsert;
 		rdata[0].next = &(rdata[1]);
 
@@ -610,14 +612,14 @@ _bt_insertuple(Relation rel, Buffer buf,
 		{
 			truncitem = *btitem;
 			truncitem.bti_itup.t_info = sizeof(BTItemData);
-			rdata[1].data = (char*)&truncitem;
+			rdata[1].data = (char *) &truncitem;
 			rdata[1].len = sizeof(BTItemData);
 		}
 		else
 		{
-			rdata[1].data = (char*)btitem;
-			rdata[1].len = IndexTupleDSize(btitem->bti_itup) + 
-						(sizeof(BTItemData) - sizeof(IndexTupleData));
+			rdata[1].data = (char *) btitem;
+			rdata[1].len = IndexTupleDSize(btitem->bti_itup) +
+				(sizeof(BTItemData) - sizeof(IndexTupleData));
 		}
 		rdata[1].buffer = buf;
 		rdata[1].next = NULL;
@@ -700,8 +702,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
 
 	/*
 	 * If the page we're splitting is not the rightmost page at its level
-	 * in the tree, then the first entry on the page is the high key
-	 * for the page.  We need to copy that to the right half.  Otherwise
+	 * in the tree, then the first entry on the page is the high key for
+	 * the page.  We need to copy that to the right half.  Otherwise
 	 * (meaning the rightmost page case), all the items on the right half
 	 * will be user data.
 	 */
@@ -779,13 +781,13 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
 		if (i < firstright)
 		{
 			_bt_pgaddtup(rel, leftpage, itemsz, item, leftoff,
-							 "left sibling");
+						 "left sibling");
 			leftoff = OffsetNumberNext(leftoff);
 		}
 		else
 		{
 			_bt_pgaddtup(rel, rightpage, itemsz, item, rightoff,
-							 "right sibling");
+						 "right sibling");
 			rightoff = OffsetNumberNext(rightoff);
 		}
 	}
@@ -812,11 +814,11 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
 	}
 
 	/*
-	 * We have to grab the right sibling (if any) and fix the prev
-	 * pointer there. We are guaranteed that this is deadlock-free
-	 * since no other writer will be holding a lock on that page
-	 * and trying to move left, and all readers release locks on a page
-	 * before trying to fetch its neighbors.
+	 * We have to grab the right sibling (if any) and fix the prev pointer
+	 * there. We are guaranteed that this is deadlock-free since no other
+	 * writer will be holding a lock on that page and trying to move left,
+	 * and all readers release locks on a page before trying to fetch its
+	 * neighbors.
 	 */
 
 	if (!P_RIGHTMOST(ropaque))
@@ -834,12 +836,12 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
 	 */
 	START_CRIT_SECTION();
 	{
-		xl_btree_split	xlrec;
-		int				flag = (newitemonleft) ? 
-								XLOG_BTREE_SPLEFT : XLOG_BTREE_SPLIT;
-		BlockNumber		blkno;
-		XLogRecPtr		recptr;
-		XLogRecData		rdata[4];
+		xl_btree_split xlrec;
+		int			flag = (newitemonleft) ?
+		XLOG_BTREE_SPLEFT : XLOG_BTREE_SPLIT;
+		BlockNumber blkno;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[4];
 
 		xlrec.target.node = rel->rd_node;
 		ItemPointerSet(&(xlrec.target.tid), *itup_blkno, *itup_off);
@@ -856,31 +858,33 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
 		BlockIdSet(&(xlrec.parentblk), lopaque->btpo_parent);
 		BlockIdSet(&(xlrec.leftblk), lopaque->btpo_prev);
 		BlockIdSet(&(xlrec.rightblk), ropaque->btpo_next);
-		/* 
-		 * Dirrect access to page is not good but faster - we should 
+
+		/*
+		 * Dirrect access to page is not good but faster - we should
 		 * implement some new func in page API.
 		 */
-		xlrec.leftlen = ((PageHeader)leftpage)->pd_special -
-							((PageHeader)leftpage)->pd_upper;
+		xlrec.leftlen = ((PageHeader) leftpage)->pd_special -
+			((PageHeader) leftpage)->pd_upper;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfBtreeSplit;
 		rdata[0].next = &(rdata[1]);
 
 		rdata[1].buffer = InvalidBuffer;
-		rdata[1].data = (char*)leftpage + ((PageHeader)leftpage)->pd_upper;
+		rdata[1].data = (char *) leftpage + ((PageHeader) leftpage)->pd_upper;
 		rdata[1].len = xlrec.leftlen;
 		rdata[1].next = &(rdata[2]);
 
 		rdata[2].buffer = InvalidBuffer;
-		rdata[2].data = (char*)rightpage + ((PageHeader)rightpage)->pd_upper;
-		rdata[2].len = ((PageHeader)rightpage)->pd_special -
-							((PageHeader)rightpage)->pd_upper;
+		rdata[2].data = (char *) rightpage + ((PageHeader) rightpage)->pd_upper;
+		rdata[2].len = ((PageHeader) rightpage)->pd_special -
+			((PageHeader) rightpage)->pd_upper;
 		rdata[2].next = NULL;
 
 		if (!P_RIGHTMOST(ropaque))
 		{
-			BTPageOpaque	sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
+			BTPageOpaque sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
+
 			sopaque->btpo_prev = BufferGetBlockNumber(rbuf);
 
 			rdata[2].next = &(rdata[3]);
@@ -942,7 +946,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
  *
  * We return the index of the first existing tuple that should go on the
  * righthand page, plus a boolean indicating whether the new tuple goes on
- * the left or right page.  The bool is necessary to disambiguate the case
+ * the left or right page.	The bool is necessary to disambiguate the case
  * where firstright == newitemoff.
  */
 static OffsetNumber
@@ -968,23 +972,23 @@ _bt_findsplitloc(Relation rel,
 	/* Passed-in newitemsz is MAXALIGNED but does not include line pointer */
 	newitemsz += sizeof(ItemIdData);
 	state.newitemsz = newitemsz;
-	state.non_leaf = ! P_ISLEAF(opaque);
+	state.non_leaf = !P_ISLEAF(opaque);
 	state.have_split = false;
 
 	/* Total free space available on a btree page, after fixed overhead */
 	leftspace = rightspace =
 		PageGetPageSize(page) - sizeof(PageHeaderData) -
 		MAXALIGN(sizeof(BTPageOpaqueData))
-		+ sizeof(ItemIdData);
+		+sizeof(ItemIdData);
 
 	/*
-	 * Finding the best possible split would require checking all the possible
-	 * split points, because of the high-key and left-key special cases.
-	 * That's probably more work than it's worth; instead, stop as soon as
-	 * we find a "good-enough" split, where good-enough is defined as an
-	 * imbalance in free space of no more than pagesize/16 (arbitrary...)
-	 * This should let us stop near the middle on most pages, instead of
-	 * plowing to the end.
+	 * Finding the best possible split would require checking all the
+	 * possible split points, because of the high-key and left-key special
+	 * cases. That's probably more work than it's worth; instead, stop as
+	 * soon as we find a "good-enough" split, where good-enough is defined
+	 * as an imbalance in free space of no more than pagesize/16
+	 * (arbitrary...) This should let us stop near the middle on most
+	 * pages, instead of plowing to the end.
 	 */
 	goodenough = leftspace / 16;
 
@@ -1024,6 +1028,7 @@ _bt_findsplitloc(Relation rel,
 		 */
 		leftfree = leftspace - dataitemstoleft - (int) itemsz;
 		rightfree = rightspace - (dataitemtotal - dataitemstoleft);
+
 		/*
 		 * Will the new item go to left or right of split?
 		 */
@@ -1051,10 +1056,10 @@ _bt_findsplitloc(Relation rel,
 	}
 
 	/*
-	 * I believe it is not possible to fail to find a feasible split,
-	 * but just in case ...
+	 * I believe it is not possible to fail to find a feasible split, but
+	 * just in case ...
 	 */
-	if (! state.have_split)
+	if (!state.have_split)
 		elog(FATAL, "_bt_findsplitloc: can't find a feasible split point for %s",
 			 RelationGetRelationName(rel));
 
@@ -1071,6 +1076,7 @@ _bt_checksplitloc(FindSplitData *state, OffsetNumber firstright,
 				  int leftfree, int rightfree,
 				  bool newitemonleft, Size firstrightitemsz)
 {
+
 	/*
 	 * Account for the new item on whichever side it is to be put.
 	 */
@@ -1078,19 +1084,21 @@ _bt_checksplitloc(FindSplitData *state, OffsetNumber firstright,
 		leftfree -= (int) state->newitemsz;
 	else
 		rightfree -= (int) state->newitemsz;
+
 	/*
-	 * If we are not on the leaf level, we will be able to discard the
-	 * key data from the first item that winds up on the right page.
+	 * If we are not on the leaf level, we will be able to discard the key
+	 * data from the first item that winds up on the right page.
 	 */
 	if (state->non_leaf)
 		rightfree += (int) firstrightitemsz -
 			(int) (MAXALIGN(sizeof(BTItemData)) + sizeof(ItemIdData));
+
 	/*
 	 * If feasible split point, remember best delta.
 	 */
 	if (leftfree >= 0 && rightfree >= 0)
 	{
-		int		delta = leftfree - rightfree;
+		int			delta = leftfree - rightfree;
 
 		if (delta < 0)
 			delta = -delta;
@@ -1134,10 +1142,11 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
 	maxoff = PageGetMaxOffsetNumber(page);
 
 	start = stack->bts_offset;
+
 	/*
-	 * _bt_insertonpg set bts_offset to InvalidOffsetNumber in the
-	 * case of concurrent ROOT page split.  Also, watch out for
-	 * possibility that page has a high key now when it didn't before.
+	 * _bt_insertonpg set bts_offset to InvalidOffsetNumber in the case of
+	 * concurrent ROOT page split.	Also, watch out for possibility that
+	 * page has a high key now when it didn't before.
 	 */
 	if (start < P_FIRSTDATAKEY(opaque))
 		start = P_FIRSTDATAKEY(opaque);
@@ -1159,11 +1168,15 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
 				return buf;
 			}
 		}
-		/* by here, the item we're looking for moved right at least one page */
+
+		/*
+		 * by here, the item we're looking for moved right at least one
+		 * page
+		 */
 		if (P_RIGHTMOST(opaque))
 		{
 			_bt_relbuf(rel, buf, access);
-			return(InvalidBuffer);
+			return (InvalidBuffer);
 		}
 
 		blkno = opaque->btpo_next;
@@ -1190,27 +1203,27 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
  *
  *		On entry, lbuf (the old root) and rbuf (its new peer) are write-
  *		locked. On exit, a new root page exists with entries for the
- *		two new children, metapage is updated and unlocked/unpinned. 
- *      The new root buffer is returned to caller which has to unlock/unpin
- *      lbuf, rbuf & rootbuf.
+ *		two new children, metapage is updated and unlocked/unpinned.
+ *		The new root buffer is returned to caller which has to unlock/unpin
+ *		lbuf, rbuf & rootbuf.
  */
 static Buffer
 _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 {
-	Buffer			rootbuf;
-	Page			lpage,
-					rpage,
-					rootpage;
-	BlockNumber		lbkno,
-					rbkno;
-	BlockNumber		rootblknum;
-	BTPageOpaque	rootopaque;
-	ItemId			itemid;
-	BTItem			item;
-	Size			itemsz;
-	BTItem			new_item;
-	Buffer			metabuf;
-	Page			metapg;
+	Buffer		rootbuf;
+	Page		lpage,
+				rpage,
+				rootpage;
+	BlockNumber lbkno,
+				rbkno;
+	BlockNumber rootblknum;
+	BTPageOpaque rootopaque;
+	ItemId		itemid;
+	BTItem		item;
+	Size		itemsz;
+	BTItem		new_item;
+	Buffer		metabuf;
+	Page		metapg;
 	BTMetaPageData *metad;
 
 	/* get a new root page */
@@ -1236,9 +1249,9 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 	rpage = BufferGetPage(rbuf);
 
 	/*
-	 * Make sure pages in old root level have valid parent links --- we will
-	 * need this in _bt_insertonpg() if a concurrent root split happens (see
-	 * README).
+	 * Make sure pages in old root level have valid parent links --- we
+	 * will need this in _bt_insertonpg() if a concurrent root split
+	 * happens (see README).
 	 */
 	((BTPageOpaque) PageGetSpecialPointer(lpage))->btpo_parent =
 		((BTPageOpaque) PageGetSpecialPointer(rpage))->btpo_parent =
@@ -1264,8 +1277,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 	pfree(new_item);
 
 	/*
-	 * Create downlink item for right page.  The key for it is obtained from
-	 * the "high key" position in the left page.
+	 * Create downlink item for right page.  The key for it is obtained
+	 * from the "high key" position in the left page.
 	 */
 	itemid = PageGetItemId(lpage, P_HIKEY);
 	itemsz = ItemIdGetLength(itemid);
@@ -1285,26 +1298,26 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 
 	/* XLOG stuff */
 	{
-		xl_btree_newroot	xlrec;
-		XLogRecPtr			recptr;
-		XLogRecData			rdata[2];
+		xl_btree_newroot xlrec;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[2];
 
 		xlrec.node = rel->rd_node;
 		xlrec.level = metad->btm_level;
 		BlockIdSet(&(xlrec.rootblk), rootblknum);
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfBtreeNewroot;
 		rdata[0].next = &(rdata[1]);
 
-		/* 
-		 * Dirrect access to page is not good but faster - we should 
+		/*
+		 * Dirrect access to page is not good but faster - we should
 		 * implement some new func in page API.
 		 */
 		rdata[1].buffer = InvalidBuffer;
-		rdata[1].data = (char*)rootpage + ((PageHeader) rootpage)->pd_upper;
-		rdata[1].len = ((PageHeader)rootpage)->pd_special - 
-							((PageHeader)rootpage)->pd_upper;
+		rdata[1].data = (char *) rootpage + ((PageHeader) rootpage)->pd_upper;
+		rdata[1].len = ((PageHeader) rootpage)->pd_special -
+			((PageHeader) rootpage)->pd_upper;
 		rdata[1].next = NULL;
 
 		recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, rdata);
@@ -1325,7 +1338,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 	/* write and let go of metapage buffer */
 	_bt_wrtbuf(rel, metabuf);
 
-	return(rootbuf);
+	return (rootbuf);
 }
 
 /*
@@ -1339,24 +1352,31 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
 Buffer
 _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 {
-	Buffer			rootbuf;
-	BlockNumber		rootblk;
-	Page			rootpage;
-	XLogRecPtr		rootLSN;
-	Page			oldrootpage = BufferGetPage(oldrootbuf);
-	BTPageOpaque	oldrootopaque = (BTPageOpaque)
-						PageGetSpecialPointer(oldrootpage);
-	Buffer			buf, leftbuf, rightbuf;
-	Page			page, leftpage, rightpage;
-	BTPageOpaque	opaque, leftopaque, rightopaque;
-	OffsetNumber	newitemoff;
-	BTItem			btitem, ritem;
-	Size			itemsz;
-
-	if (! P_LEFTMOST(oldrootopaque) || P_RIGHTMOST(oldrootopaque))
+	Buffer		rootbuf;
+	BlockNumber rootblk;
+	Page		rootpage;
+	XLogRecPtr	rootLSN;
+	Page		oldrootpage = BufferGetPage(oldrootbuf);
+	BTPageOpaque oldrootopaque = (BTPageOpaque)
+	PageGetSpecialPointer(oldrootpage);
+	Buffer		buf,
+				leftbuf,
+				rightbuf;
+	Page		page,
+				leftpage,
+				rightpage;
+	BTPageOpaque opaque,
+				leftopaque,
+				rightopaque;
+	OffsetNumber newitemoff;
+	BTItem		btitem,
+				ritem;
+	Size		itemsz;
+
+	if (!P_LEFTMOST(oldrootopaque) || P_RIGHTMOST(oldrootopaque))
 		elog(ERROR, "bt_fixroot: not valid old root page");
 
-	/* Read right neighbor and create new root page*/
+	/* Read right neighbor and create new root page */
 	leftbuf = _bt_getbuf(rel, oldrootopaque->btpo_next, BT_WRITE);
 	leftpage = BufferGetPage(leftbuf);
 	leftopaque = (BTPageOpaque) PageGetSpecialPointer(leftpage);
@@ -1377,26 +1397,26 @@ _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 	 *
 	 * If concurrent process will split one of pages on this level then it
 	 * will see either btpo_parent == metablock or btpo_parent == rootblk.
-	 * In first case it will give up its locks and walk to the leftmost page
-	 * (oldrootbuf) in _bt_fixup() - ie it will wait for us and let us
-	 * continue. In second case it will try to lock rootbuf keeping its locks
-	 * on buffers we already passed, also waiting for us. If we'll have to
-	 * unlock rootbuf (split it) and that process will have to split page
-	 * of new level we created (level of rootbuf) then it will wait while
-	 * we create upper level. Etc.
+	 * In first case it will give up its locks and walk to the leftmost
+	 * page (oldrootbuf) in _bt_fixup() - ie it will wait for us and let
+	 * us continue. In second case it will try to lock rootbuf keeping its
+	 * locks on buffers we already passed, also waiting for us. If we'll
+	 * have to unlock rootbuf (split it) and that process will have to
+	 * split page of new level we created (level of rootbuf) then it will
+	 * wait while we create upper level. Etc.
 	 */
-	while(! P_RIGHTMOST(leftopaque))
+	while (!P_RIGHTMOST(leftopaque))
 	{
 		rightbuf = _bt_getbuf(rel, leftopaque->btpo_next, BT_WRITE);
 		rightpage = BufferGetPage(rightbuf);
 		rightopaque = (BTPageOpaque) PageGetSpecialPointer(rightpage);
 
 		/*
-		 * Update LSN & StartUpID of child page buffer to ensure that
-		 * it will be written on disk after flushing log record for new
-		 * root creation. Unfortunately, for the moment (?) we do not
-		 * log this operation and so possibly break our rule to log entire
-		 * page content on first after checkpoint modification.
+		 * Update LSN & StartUpID of child page buffer to ensure that it
+		 * will be written on disk after flushing log record for new root
+		 * creation. Unfortunately, for the moment (?) we do not log this
+		 * operation and so possibly break our rule to log entire page
+		 * content on first after checkpoint modification.
 		 */
 		HOLD_INTERRUPTS();
 		rightopaque->btpo_parent = rootblk;
@@ -1416,17 +1436,17 @@ _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 
 		if (PageGetFreeSpace(page) < itemsz)
 		{
-			Buffer			newbuf;
-			OffsetNumber	firstright;
-			OffsetNumber	itup_off;
-			BlockNumber		itup_blkno;
-			bool			newitemonleft;
+			Buffer		newbuf;
+			OffsetNumber firstright;
+			OffsetNumber itup_off;
+			BlockNumber itup_blkno;
+			bool		newitemonleft;
 
 			firstright = _bt_findsplitloc(rel, page,
-							newitemoff, itemsz, &newitemonleft);
+									 newitemoff, itemsz, &newitemonleft);
 			newbuf = _bt_split(rel, buf, firstright,
-						newitemoff, itemsz, btitem, newitemonleft,
-						&itup_off, &itup_blkno);
+							   newitemoff, itemsz, btitem, newitemonleft,
+							   &itup_off, &itup_blkno);
 			/* Keep lock on new "root" buffer ! */
 			if (buf != rootbuf)
 				_bt_relbuf(rel, buf, BT_WRITE);
@@ -1450,10 +1470,10 @@ _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 
 	/*
 	 * Here we hold locks on old root buffer, new root buffer we've
-	 * created with _bt_newroot() - rootbuf, - and buf we've used
-	 * for last insert ops - buf. If rootbuf != buf then we have to
-	 * create at least one more level. And if "release" is TRUE
-	 * then we give up oldrootbuf.
+	 * created with _bt_newroot() - rootbuf, - and buf we've used for last
+	 * insert ops - buf. If rootbuf != buf then we have to create at least
+	 * one more level. And if "release" is TRUE then we give up
+	 * oldrootbuf.
 	 */
 	if (release)
 		_bt_wrtbuf(rel, oldrootbuf);
@@ -1461,10 +1481,10 @@ _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 	if (rootbuf != buf)
 	{
 		_bt_wrtbuf(rel, buf);
-		return(_bt_fixroot(rel, rootbuf, true));
+		return (_bt_fixroot(rel, rootbuf, true));
 	}
 
-	return(rootbuf);
+	return (rootbuf);
 }
 
 /*
@@ -1474,17 +1494,17 @@ _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release)
 static void
 _bt_fixtree(Relation rel, BlockNumber blkno)
 {
-	Buffer			buf;
-	Page			page;
-	BTPageOpaque	opaque;
-	BlockNumber		pblkno;
+	Buffer		buf;
+	Page		page;
+	BTPageOpaque opaque;
+	BlockNumber pblkno;
 
-	for ( ; ; )
+	for (;;)
 	{
 		buf = _bt_getbuf(rel, blkno, BT_READ);
 		page = BufferGetPage(buf);
 		opaque = (BTPageOpaque) PageGetSpecialPointer(page);
-		if (! P_LEFTMOST(opaque) || P_ISLEAF(opaque))
+		if (!P_LEFTMOST(opaque) || P_ISLEAF(opaque))
 			elog(ERROR, "bt_fixtree[%s]: invalid start page (need to recreate index)", RelationGetRelationName(rel));
 		pblkno = opaque->btpo_parent;
 
@@ -1534,25 +1554,26 @@ _bt_fixtree(Relation rel, BlockNumber blkno)
 static void
 _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 {
-	BlockNumber		blkno = BufferGetBlockNumber(buf);
-	Page			page;
-	BTPageOpaque	opaque;
-	BlockNumber		cblkno[3];
-	OffsetNumber	coff[3];
-	Buffer			cbuf[3];
-	Page			cpage[3];
-	BTPageOpaque	copaque[3];
-	BTItem			btitem;
-	int				cidx, i;
-	bool			goodbye = false;
-	char			tbuf[BLCKSZ];
+	BlockNumber blkno = BufferGetBlockNumber(buf);
+	Page		page;
+	BTPageOpaque opaque;
+	BlockNumber cblkno[3];
+	OffsetNumber coff[3];
+	Buffer		cbuf[3];
+	Page		cpage[3];
+	BTPageOpaque copaque[3];
+	BTItem		btitem;
+	int			cidx,
+				i;
+	bool		goodbye = false;
+	char		tbuf[BLCKSZ];
 
 	page = BufferGetPage(buf);
 	/* copy page to temp storage */
 	memmove(tbuf, page, PageGetPageSize(page));
 	_bt_relbuf(rel, buf, BT_READ);
 
-	page = (Page)tbuf;
+	page = (Page) tbuf;
 	opaque = (BTPageOpaque) PageGetSpecialPointer(page);
 
 	/* Initialize first child data */
@@ -1564,20 +1585,21 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 	cbuf[0] = _bt_getbuf(rel, cblkno[0], BT_READ);
 	cpage[0] = BufferGetPage(cbuf[0]);
 	copaque[0] = (BTPageOpaque) PageGetSpecialPointer(cpage[0]);
-	if (P_LEFTMOST(opaque) && ! P_LEFTMOST(copaque[0]))
+	if (P_LEFTMOST(opaque) && !P_LEFTMOST(copaque[0]))
 		elog(ERROR, "bt_fixtlevel[%s]: non-leftmost child page of leftmost parent (need to recreate index)", RelationGetRelationName(rel));
 	/* caller should take care and avoid this */
 	if (P_RIGHTMOST(copaque[0]))
 		elog(ERROR, "bt_fixtlevel[%s]: invalid start child (need to recreate index)", RelationGetRelationName(rel));
 
-	for ( ; ; )
+	for (;;)
 	{
+
 		/*
-		 * Read up to 2 more child pages and look for pointers
-		 * to them in *saved* parent page
+		 * Read up to 2 more child pages and look for pointers to them in
+		 * *saved* parent page
 		 */
 		coff[1] = coff[2] = InvalidOffsetNumber;
-		for (cidx = 0; cidx < 2; )
+		for (cidx = 0; cidx < 2;)
 		{
 			cidx++;
 			cblkno[cidx] = (copaque[cidx - 1])->btpo_next;
@@ -1609,20 +1631,20 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 		if (coff[1] == InvalidOffsetNumber ||
 			(cidx == 2 && coff[2] == InvalidOffsetNumber))
 		{
-			Buffer			newbuf;
-			Page			newpage;
-			BTPageOpaque	newopaque;
-			BTItem			ritem;
-			Size			itemsz;
-			OffsetNumber	newitemoff;
-			BlockNumber		parblk[3];
-			BTStackData		stack;
+			Buffer		newbuf;
+			Page		newpage;
+			BTPageOpaque newopaque;
+			BTItem		ritem;
+			Size		itemsz;
+			OffsetNumber newitemoff;
+			BlockNumber parblk[3];
+			BTStackData stack;
 
 			stack.bts_parent = NULL;
 			stack.bts_blkno = blkno;
 			stack.bts_offset = InvalidOffsetNumber;
 			ItemPointerSet(&(stack.bts_btitem.bti_itup.t_tid),
-							cblkno[0], P_HIKEY);
+						   cblkno[0], P_HIKEY);
 
 			buf = _bt_getstackbuf(rel, &stack, BT_WRITE);
 			if (buf == InvalidBuffer)
@@ -1644,19 +1666,19 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 				if (coff[i] != InvalidOffsetNumber)
 				{
 					if (parblk[i] == parblk[i - 1] &&
-								coff[i] != coff[i - 1] + 1)
+						coff[i] != coff[i - 1] + 1)
 						elog(ERROR, "bt_fixlevel[%s]: invalid item order(2) (need to recreate index)", RelationGetRelationName(rel));
 					continue;
 				}
 				/* Have to check next page ? */
-				if ((! P_RIGHTMOST(opaque)) &&
-					coff[i - 1] == PageGetMaxOffsetNumber(page))	/* yes */
+				if ((!P_RIGHTMOST(opaque)) &&
+					coff[i - 1] == PageGetMaxOffsetNumber(page))		/* yes */
 				{
 					newbuf = _bt_getbuf(rel, opaque->btpo_next, BT_WRITE);
 					newpage = BufferGetPage(newbuf);
 					newopaque = (BTPageOpaque) PageGetSpecialPointer(newpage);
 					coff[i] = _bt_getoff(newpage, cblkno[i]);
-					if (coff[i] != InvalidOffsetNumber)	/* found ! */
+					if (coff[i] != InvalidOffsetNumber) /* found ! */
 					{
 						if (coff[i] != P_FIRSTDATAKEY(newopaque))
 							elog(ERROR, "bt_fixlevel[%s]: invalid item order(3) (need to recreate index)", RelationGetRelationName(rel));
@@ -1673,7 +1695,7 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 				}
 				/* insert pointer */
 				ritem = (BTItem) PageGetItem(cpage[i - 1],
-									PageGetItemId(cpage[i - 1], P_HIKEY));
+								   PageGetItemId(cpage[i - 1], P_HIKEY));
 				btitem = _bt_formitem(&(ritem->bti_itup));
 				ItemPointerSet(&(btitem->bti_itup.t_tid), cblkno[i], P_HIKEY);
 				itemsz = IndexTupleDSize(btitem->bti_itup)
@@ -1684,16 +1706,16 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 
 				if (PageGetFreeSpace(page) < itemsz)
 				{
-					OffsetNumber	firstright;
-					OffsetNumber	itup_off;
-					BlockNumber		itup_blkno;
-					bool			newitemonleft;
+					OffsetNumber firstright;
+					OffsetNumber itup_off;
+					BlockNumber itup_blkno;
+					bool		newitemonleft;
 
 					firstright = _bt_findsplitloc(rel, page,
-									newitemoff, itemsz, &newitemonleft);
+									 newitemoff, itemsz, &newitemonleft);
 					newbuf = _bt_split(rel, buf, firstright,
-								newitemoff, itemsz, btitem, newitemonleft,
-								&itup_off, &itup_blkno);
+							   newitemoff, itemsz, btitem, newitemonleft,
+									   &itup_off, &itup_blkno);
 					/* what buffer we need in ? */
 					if (newitemonleft)
 						_bt_relbuf(rel, newbuf, BT_WRITE);
@@ -1720,7 +1742,7 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
 			/* copy page with pointer to cblkno[cidx] to temp storage */
 			memmove(tbuf, page, PageGetPageSize(page));
 			_bt_relbuf(rel, buf, BT_WRITE);
-			page = (Page)tbuf;
+			page = (Page) tbuf;
 			opaque = (BTPageOpaque) PageGetSpecialPointer(page);
 		}
 
@@ -1760,18 +1782,19 @@ _bt_fixlevel(Relation rel, Buffer buf, BlockNumber limit)
  * but it doesn't guarantee full consistency of tree.)
  */
 static void
-_bt_fixbranch(Relation rel, BlockNumber lblkno, 
-				BlockNumber rblkno, BTStack true_stack)
+_bt_fixbranch(Relation rel, BlockNumber lblkno,
+			  BlockNumber rblkno, BTStack true_stack)
 {
-	BlockNumber		blkno = true_stack->bts_blkno;
-	BTStackData		stack;
-	BTPageOpaque	opaque;
-	Buffer			buf, rbuf;
-	Page			page;
-	OffsetNumber	offnum;
+	BlockNumber blkno = true_stack->bts_blkno;
+	BTStackData stack;
+	BTPageOpaque opaque;
+	Buffer		buf,
+				rbuf;
+	Page		page;
+	OffsetNumber offnum;
 
 	true_stack = true_stack->bts_parent;
-	for ( ; ; )
+	for (;;)
 	{
 		buf = _bt_getbuf(rel, blkno, BT_READ);
 
@@ -1779,8 +1802,8 @@ _bt_fixbranch(Relation rel, BlockNumber lblkno,
 		_bt_fixlevel(rel, buf, rblkno);
 
 		/*
-		 * Here parent level should have pointers for both
-		 * lblkno and rblkno and we have to find them.
+		 * Here parent level should have pointers for both lblkno and
+		 * rblkno and we have to find them.
 		 */
 		stack.bts_parent = NULL;
 		stack.bts_blkno = blkno;
@@ -1792,7 +1815,7 @@ _bt_fixbranch(Relation rel, BlockNumber lblkno,
 		page = BufferGetPage(buf);
 		offnum = _bt_getoff(page, rblkno);
 
-		if (offnum != InvalidOffsetNumber)	/* right pointer found */
+		if (offnum != InvalidOffsetNumber)		/* right pointer found */
 		{
 			if (offnum <= stack.bts_offset)
 				elog(ERROR, "bt_fixbranch[%s]: invalid item order (need to recreate index)", RelationGetRelationName(rel));
@@ -1829,10 +1852,10 @@ _bt_fixbranch(Relation rel, BlockNumber lblkno,
 		}
 
 		/*
-		 * Well, we are on the level that was root or unexistent when
-		 * we started traversing tree down. If btpo_parent is updated
-		 * then we'll use it to continue, else we'll fix/restore upper
-		 * levels entirely.
+		 * Well, we are on the level that was root or unexistent when we
+		 * started traversing tree down. If btpo_parent is updated then
+		 * we'll use it to continue, else we'll fix/restore upper levels
+		 * entirely.
 		 */
 		if (!BTreeInvalidParent(opaque))
 		{
@@ -1874,18 +1897,18 @@ _bt_fixbranch(Relation rel, BlockNumber lblkno,
 static void
 _bt_fixup(Relation rel, Buffer buf)
 {
-	Page			page;
-	BTPageOpaque	opaque;
-	BlockNumber		blkno;
+	Page		page;
+	BTPageOpaque opaque;
+	BlockNumber blkno;
 
-	for ( ; ; )
+	for (;;)
 	{
 		page = BufferGetPage(buf);
 		opaque = (BTPageOpaque) PageGetSpecialPointer(page);
+
 		/*
-		 * If someone else already created parent pages
-		 * then it's time for _bt_fixtree() to check upper
-		 * levels and fix them, if required.
+		 * If someone else already created parent pages then it's time for
+		 * _bt_fixtree() to check upper levels and fix them, if required.
 		 */
 		if (!BTreeInvalidParent(opaque))
 		{
@@ -1904,13 +1927,12 @@ _bt_fixup(Relation rel, Buffer buf)
 	}
 
 	/*
-	 * Ok, we are on the leftmost page, it's write locked
-	 * by us and its btpo_parent points to meta page - time
-	 * for _bt_fixroot().
+	 * Ok, we are on the leftmost page, it's write locked by us and its
+	 * btpo_parent points to meta page - time for _bt_fixroot().
 	 */
 	elog(NOTICE, "bt_fixup[%s]: fixing root page", RelationGetRelationName(rel));
-	 buf = _bt_fixroot(rel, buf, true);
-	 _bt_relbuf(rel, buf, BT_WRITE);
+	buf = _bt_fixroot(rel, buf, true);
+	_bt_relbuf(rel, buf, BT_WRITE);
 
 	return;
 }
@@ -1918,23 +1940,23 @@ _bt_fixup(Relation rel, Buffer buf)
 static OffsetNumber
 _bt_getoff(Page page, BlockNumber blkno)
 {
-	BTPageOpaque	opaque = (BTPageOpaque) PageGetSpecialPointer(page);
-	OffsetNumber	maxoff = PageGetMaxOffsetNumber(page);
-	OffsetNumber	offnum = P_FIRSTDATAKEY(opaque);
-	BlockNumber		curblkno;
-	ItemId			itemid;
-	BTItem			item;
-
-	for ( ; offnum <= maxoff; offnum++)
+	BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
+	OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
+	OffsetNumber offnum = P_FIRSTDATAKEY(opaque);
+	BlockNumber curblkno;
+	ItemId		itemid;
+	BTItem		item;
+
+	for (; offnum <= maxoff; offnum++)
 	{
 		itemid = PageGetItemId(page, offnum);
 		item = (BTItem) PageGetItem(page, itemid);
 		curblkno = ItemPointerGetBlockNumber(&(item->bti_itup.t_tid));
 		if (curblkno == blkno)
-			return(offnum);
+			return (offnum);
 	}
 
-	return(InvalidOffsetNumber);
+	return (InvalidOffsetNumber);
 }
 
 /*
@@ -1961,9 +1983,9 @@ _bt_pgaddtup(Relation rel,
 			 const char *where)
 {
 	BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
-	BTItemData truncitem;
+	BTItemData	truncitem;
 
-	if (! P_ISLEAF(opaque) && itup_off == P_FIRSTDATAKEY(opaque))
+	if (!P_ISLEAF(opaque) && itup_off == P_FIRSTDATAKEY(opaque))
 	{
 		memcpy(&truncitem, btitem, sizeof(BTItemData));
 		truncitem.bti_itup.t_info = sizeof(BTItemData);
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 4c854fe79134377f012d85648ec9f1117c779e4e..460d6c834c179fe652b2c37b9ceed0d86763a11e 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.50 2001/02/07 23:35:33 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.51 2001/03/22 03:59:14 momjian Exp $
  *
  *	NOTES
  *	   Postgres btree pages look like ordinary relation pages.	The opaque
@@ -28,7 +28,7 @@
 #include "miscadmin.h"
 #include "storage/lmgr.h"
 
-extern bool FixBTree;	/* comments in nbtree.c */
+extern bool FixBTree;			/* comments in nbtree.c */
 extern Buffer _bt_fixroot(Relation rel, Buffer oldrootbuf, bool release);
 
 /*
@@ -100,7 +100,7 @@ _bt_metapinit(Relation rel)
  *
  *		The access type parameter (BT_READ or BT_WRITE) controls whether
  *		a new root page will be created or not.  If access = BT_READ,
- *		and no root page exists, we just return InvalidBuffer.  For
+ *		and no root page exists, we just return InvalidBuffer.	For
  *		BT_WRITE, we try to create the root page if it doesn't exist.
  *		NOTE that the returned root page will have only a read lock set
  *		on it even if access = BT_WRITE!
@@ -178,20 +178,20 @@ _bt_getroot(Relation rel, int access)
 
 			/* XLOG stuff */
 			{
-				xl_btree_newroot	xlrec;
-				XLogRecPtr			recptr;
-				XLogRecData			rdata;
+				xl_btree_newroot xlrec;
+				XLogRecPtr	recptr;
+				XLogRecData rdata;
 
 				xlrec.node = rel->rd_node;
 				xlrec.level = 1;
 				BlockIdSet(&(xlrec.rootblk), rootblkno);
 				rdata.buffer = InvalidBuffer;
-				rdata.data = (char*)&xlrec;
+				rdata.data = (char *) &xlrec;
 				rdata.len = SizeOfBtreeNewroot;
 				rdata.next = NULL;
 
 				recptr = XLogInsert(RM_BTREE_ID,
-							XLOG_BTREE_NEWROOT|XLOG_BTREE_LEAF, &rdata);
+						   XLOG_BTREE_NEWROOT | XLOG_BTREE_LEAF, &rdata);
 
 				PageSetLSN(rootpage, recptr);
 				PageSetSUI(rootpage, ThisStartUpID);
@@ -212,6 +212,7 @@ _bt_getroot(Relation rel, int access)
 		}
 		else
 		{
+
 			/*
 			 * Metadata initialized by someone else.  In order to
 			 * guarantee no deadlocks, we have to release the metadata
@@ -232,30 +233,31 @@ _bt_getroot(Relation rel, int access)
 	/*
 	 * Race condition:	If the root page split between the time we looked
 	 * at the metadata page and got the root buffer, then we got the wrong
-	 * buffer.  Release it and try again.
+	 * buffer.	Release it and try again.
 	 */
 	rootpage = BufferGetPage(rootbuf);
 	rootopaque = (BTPageOpaque) PageGetSpecialPointer(rootpage);
 
-	if (! P_ISROOT(rootopaque))
+	if (!P_ISROOT(rootopaque))
 	{
+
 		/*
-		 * It happened, but if root page splitter failed to create
-		 * new root page then we'll go in loop trying to call
-		 * _bt_getroot again and again.
+		 * It happened, but if root page splitter failed to create new
+		 * root page then we'll go in loop trying to call _bt_getroot
+		 * again and again.
 		 */
 		if (FixBTree)
 		{
-			Buffer	newrootbuf;
+			Buffer		newrootbuf;
 
-check_parent:;
-			if (BTreeInvalidParent(rootopaque))	/* unupdated! */
+	check_parent:;
+			if (BTreeInvalidParent(rootopaque)) /* unupdated! */
 			{
 				LockBuffer(rootbuf, BUFFER_LOCK_UNLOCK);
 				LockBuffer(rootbuf, BT_WRITE);
 
 				/* handle concurrent fix of root page */
-				if (BTreeInvalidParent(rootopaque))	/* unupdated! */
+				if (BTreeInvalidParent(rootopaque))		/* unupdated! */
 				{
 					elog(NOTICE, "bt_getroot[%s]: fixing root page", RelationGetRelationName(rel));
 					newrootbuf = _bt_fixroot(rel, rootbuf, true);
@@ -266,20 +268,22 @@ check_parent:;
 					rootopaque = (BTPageOpaque) PageGetSpecialPointer(rootpage);
 					/* New root might be splitted while changing lock */
 					if (P_ISROOT(rootopaque))
-						return(rootbuf);
+						return (rootbuf);
 					/* rootbuf is read locked */
 					goto check_parent;
 				}
-				else	/* someone else already fixed root */
+				else
+/* someone else already fixed root */
 				{
 					LockBuffer(rootbuf, BUFFER_LOCK_UNLOCK);
 					LockBuffer(rootbuf, BT_READ);
 				}
 			}
+
 			/*
-			 * Ok, here we have old root page with btpo_parent pointing
-			 * to upper level - check parent page because of there is
-			 * good chance that parent is root page.
+			 * Ok, here we have old root page with btpo_parent pointing to
+			 * upper level - check parent page because of there is good
+			 * chance that parent is root page.
 			 */
 			newrootbuf = _bt_getbuf(rel, rootopaque->btpo_parent, BT_READ);
 			_bt_relbuf(rel, rootbuf, BT_READ);
@@ -287,7 +291,7 @@ check_parent:;
 			rootpage = BufferGetPage(rootbuf);
 			rootopaque = (BTPageOpaque) PageGetSpecialPointer(rootpage);
 			if (P_ISROOT(rootopaque))
-				return(rootbuf);
+				return (rootbuf);
 			/* no luck -:( */
 		}
 
@@ -366,7 +370,7 @@ _bt_relbuf(Relation rel, Buffer buf, int access)
  *		and a pin on the buffer.
  *
  * NOTE: actually, the buffer manager just marks the shared buffer page
- * dirty here, the real I/O happens later.  Since we can't persuade the
+ * dirty here, the real I/O happens later.	Since we can't persuade the
  * Unix kernel to schedule disk writes in a particular order, there's not
  * much point in worrying about this.  The most we can say is that all the
  * writes will occur before commit.
@@ -468,14 +472,14 @@ _bt_pagedel(Relation rel, ItemPointer tid)
 	PageIndexTupleDelete(page, offno);
 	/* XLOG stuff */
 	{
-		xl_btree_delete	xlrec;
-		XLogRecPtr		recptr;
-		XLogRecData		rdata[2];
+		xl_btree_delete xlrec;
+		XLogRecPtr	recptr;
+		XLogRecData rdata[2];
 
 		xlrec.target.node = rel->rd_node;
 		xlrec.target.tid = *tid;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = SizeOfBtreeDelete;
 		rdata[0].next = &(rdata[1]);
 
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index f02dfcbd128b57f7702f4c85efc07f98479b7a7a..97d99da4fde7bbbfe009c7c7baf04dc557390cd9 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.78 2001/02/07 23:35:33 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.79 2001/03/22 03:59:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,8 @@
 
 bool		BuildingBtree = false;		/* see comment in btbuild() */
 bool		FastBuild = true;	/* use sort/build instead */
-								/* of insertion build */
+
+ /* of insertion build */
 
 
 /*
@@ -52,12 +53,14 @@ static void _bt_restscan(IndexScanDesc scan);
 Datum
 btbuild(PG_FUNCTION_ARGS)
 {
-	Relation		heap = (Relation) PG_GETARG_POINTER(0);
-	Relation		index = (Relation) PG_GETARG_POINTER(1);
-	IndexInfo	   *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node		   *oldPred = (Node *) PG_GETARG_POINTER(3);
+	Relation	heap = (Relation) PG_GETARG_POINTER(0);
+	Relation	index = (Relation) PG_GETARG_POINTER(1);
+	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
+	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	IndexStrategy	istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+
 #endif
 	HeapScanDesc hscan;
 	HeapTuple	htup;
@@ -69,9 +72,11 @@ btbuild(PG_FUNCTION_ARGS)
 	int			nhtups,
 				nitups;
 	Node	   *pred = indexInfo->ii_Predicate;
+
 #ifndef OMIT_PARTIAL_INDEX
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
+
 #endif
 	ExprContext *econtext;
 	InsertIndexResult res = NULL;
@@ -79,15 +84,16 @@ btbuild(PG_FUNCTION_ARGS)
 	BTItem		btitem;
 	bool		usefast;
 	Snapshot	snapshot;
-	TransactionId	XmaxRecent;
+	TransactionId XmaxRecent;
+
 	/*
-	 * spool2 is needed only when the index is an unique index.
-	 * Dead tuples are put into spool2 instead of spool in
-	 * order to avoid uniqueness check.
+	 * spool2 is needed only when the index is an unique index. Dead
+	 * tuples are put into spool2 instead of spool in order to avoid
+	 * uniqueness check.
 	 */
-	BTSpool		*spool2 = NULL;
+	BTSpool    *spool2 = NULL;
 	bool		tupleIsAlive;
-	int		dead_count;
+	int			dead_count;
 
 	/* note that this is a new btree */
 	BuildingBtree = true;
@@ -103,7 +109,7 @@ btbuild(PG_FUNCTION_ARGS)
 #ifdef BTREE_BUILD_STATS
 	if (Show_btree_build_stats)
 		ResetUsage();
-#endif /* BTREE_BUILD_STATS */
+#endif	 /* BTREE_BUILD_STATS */
 
 	/* initialize the btree index metadata page (if this is a new index) */
 	if (oldPred == NULL)
@@ -155,10 +161,10 @@ btbuild(PG_FUNCTION_ARGS)
 	if (usefast)
 	{
 		spool = _bt_spoolinit(index, indexInfo->ii_Unique);
+
 		/*
-	 	 * Different from spool,the uniqueness isn't checked
-		 * for spool2.
-	 	 */
+		 * Different from spool,the uniqueness isn't checked for spool2.
+		 */
 		if (indexInfo->ii_Unique)
 			spool2 = _bt_spoolinit(index, false);
 	}
@@ -187,12 +193,13 @@ btbuild(PG_FUNCTION_ARGS)
 		}
 		else
 			tupleIsAlive = true;
-		
+
 		MemoryContextReset(econtext->ecxt_per_tuple_memory);
 
 		nhtups++;
 
 #ifndef OMIT_PARTIAL_INDEX
+
 		/*
 		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
 		 * this tuple if it was already in the existing partial index
@@ -253,8 +260,7 @@ btbuild(PG_FUNCTION_ARGS)
 		 * btree pages - NULLs greater NOT_NULLs and NULL = NULL is TRUE.
 		 * Sure, it's just rule for placing/finding items and no more -
 		 * keytest'll return FALSE for a = 5 for items having 'a' isNULL.
-		 * Look at _bt_compare for how it works.
-		 *				 - vadim 03/23/97
+		 * Look at _bt_compare for how it works. - vadim 03/23/97
 		 *
 		 * if (itup->t_info & INDEX_NULL_MASK) { pfree(itup); continue; }
 		 */
@@ -271,7 +277,8 @@ btbuild(PG_FUNCTION_ARGS)
 		{
 			if (tupleIsAlive || !spool2)
 				_bt_spool(btitem, spool);
-			else /* dead tuples are put into spool2 */
+			else
+/* dead tuples are put into spool2 */
 			{
 				dead_count++;
 				_bt_spool(btitem, spool2);
@@ -288,7 +295,7 @@ btbuild(PG_FUNCTION_ARGS)
 
 	/* okay, all heap tuples are indexed */
 	heap_endscan(hscan);
-	if (spool2 && !dead_count) /* spool2 was found to be unnecessary */
+	if (spool2 && !dead_count)	/* spool2 was found to be unnecessary */
 	{
 		_bt_spooldestroy(spool2);
 		spool2 = NULL;
@@ -296,9 +303,7 @@ btbuild(PG_FUNCTION_ARGS)
 
 #ifndef OMIT_PARTIAL_INDEX
 	if (pred != NULL || oldPred != NULL)
-	{
 		ExecDropTupleTable(tupleTable, true);
-	}
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
 
@@ -322,7 +327,7 @@ btbuild(PG_FUNCTION_ARGS)
 		ShowUsage();
 		ResetUsage();
 	}
-#endif /* BTREE_BUILD_STATS */
+#endif	 /* BTREE_BUILD_STATS */
 
 	/*
 	 * Since we just counted the tuples in the heap, we update its stats
@@ -368,11 +373,11 @@ btbuild(PG_FUNCTION_ARGS)
 Datum
 btinsert(PG_FUNCTION_ARGS)
 {
-	Relation		rel = (Relation) PG_GETARG_POINTER(0);
-	Datum		   *datum = (Datum *) PG_GETARG_POINTER(1);
-	char		   *nulls = (char *) PG_GETARG_POINTER(2);
-	ItemPointer		ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
-	Relation		heapRel = (Relation) PG_GETARG_POINTER(4);
+	Relation	rel = (Relation) PG_GETARG_POINTER(0);
+	Datum	   *datum = (Datum *) PG_GETARG_POINTER(1);
+	char	   *nulls = (char *) PG_GETARG_POINTER(2);
+	ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+	Relation	heapRel = (Relation) PG_GETARG_POINTER(4);
 	InsertIndexResult res;
 	BTItem		btitem;
 	IndexTuple	itup;
@@ -396,8 +401,8 @@ btinsert(PG_FUNCTION_ARGS)
 Datum
 btgettuple(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc		scan = (IndexScanDesc) PG_GETARG_POINTER(0);
-	ScanDirection		dir = (ScanDirection) PG_GETARG_INT32(1);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
 	RetrieveIndexResult res;
 
 	/*
@@ -408,10 +413,11 @@ btgettuple(PG_FUNCTION_ARGS)
 
 	if (ItemPointerIsValid(&(scan->currentItemData)))
 	{
+
 		/*
 		 * Restore scan position using heap TID returned by previous call
-		 * to btgettuple(). _bt_restscan() re-grabs the read lock on
-		 * the buffer, too.
+		 * to btgettuple(). _bt_restscan() re-grabs the read lock on the
+		 * buffer, too.
 		 */
 		_bt_restscan(scan);
 		res = _bt_next(scan, dir);
@@ -421,8 +427,8 @@ btgettuple(PG_FUNCTION_ARGS)
 
 	/*
 	 * Save heap TID to use it in _bt_restscan.  Then release the read
-	 * lock on the buffer so that we aren't blocking other backends.
-	 * NOTE: we do keep the pin on the buffer!
+	 * lock on the buffer so that we aren't blocking other backends. NOTE:
+	 * we do keep the pin on the buffer!
 	 */
 	if (res)
 	{
@@ -461,11 +467,13 @@ btbeginscan(PG_FUNCTION_ARGS)
 Datum
 btrescan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+
 #ifdef NOT_USED					/* XXX surely it's wrong to ignore this? */
-	bool			fromEnd = PG_GETARG_BOOL(1);
+	bool		fromEnd = PG_GETARG_BOOL(1);
+
 #endif
-	ScanKey			scankey = (ScanKey) PG_GETARG_POINTER(2);
+	ScanKey		scankey = (ScanKey) PG_GETARG_POINTER(2);
 	ItemPointer iptr;
 	BTScanOpaque so;
 
@@ -540,7 +548,7 @@ btmovescan(IndexScanDesc scan, Datum v)
 Datum
 btendscan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	BTScanOpaque so;
 
@@ -578,7 +586,7 @@ btendscan(PG_FUNCTION_ARGS)
 Datum
 btmarkpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	BTScanOpaque so;
 
@@ -610,7 +618,7 @@ btmarkpos(PG_FUNCTION_ARGS)
 Datum
 btrestrpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
 	ItemPointer iptr;
 	BTScanOpaque so;
 
@@ -640,8 +648,8 @@ btrestrpos(PG_FUNCTION_ARGS)
 Datum
 btdelete(PG_FUNCTION_ARGS)
 {
-	Relation		rel = (Relation) PG_GETARG_POINTER(0);
-	ItemPointer		tid = (ItemPointer) PG_GETARG_POINTER(1);
+	Relation	rel = (Relation) PG_GETARG_POINTER(0);
+	ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
 
 	/* adjust any active scans that will be affected by this deletion */
 	_bt_adjscans(rel, tid);
@@ -671,8 +679,8 @@ _bt_restscan(IndexScanDesc scan)
 	BlockNumber blkno;
 
 	/*
-	 * Get back the read lock we were holding on the buffer.
-	 * (We still have a reference-count pin on it, though.)
+	 * Get back the read lock we were holding on the buffer. (We still
+	 * have a reference-count pin on it, though.)
 	 */
 	LockBuffer(buf, BT_READ);
 
@@ -689,13 +697,13 @@ _bt_restscan(IndexScanDesc scan)
 	if (!ItemPointerIsValid(&target))
 	{
 		ItemPointerSetOffsetNumber(current,
-								   OffsetNumberPrev(P_FIRSTDATAKEY(opaque)));
+							   OffsetNumberPrev(P_FIRSTDATAKEY(opaque)));
 		return;
 	}
 
 	/*
-	 * The item we were on may have moved right due to insertions.
-	 * Find it again.
+	 * The item we were on may have moved right due to insertions. Find it
+	 * again.
 	 */
 	for (;;)
 	{
@@ -717,7 +725,8 @@ _bt_restscan(IndexScanDesc scan)
 		}
 
 		/*
-		 * By here, the item we're looking for moved right at least one page
+		 * By here, the item we're looking for moved right at least one
+		 * page
 		 */
 		if (P_RIGHTMOST(opaque))
 			elog(FATAL, "_bt_restscan: my bits moved right off the end of the world!"
@@ -742,14 +751,14 @@ _bt_restore_page(Page page, char *from, int len)
 	Size		itemsz;
 	char	   *end = from + len;
 
-	for ( ;	from < end; )
+	for (; from < end;)
 	{
 		memcpy(&btdata, from, sizeof(BTItemData));
 		itemsz = IndexTupleDSize(btdata.bti_itup) +
-					(sizeof(BTItemData) - sizeof(IndexTupleData));
+			(sizeof(BTItemData) - sizeof(IndexTupleData));
 		itemsz = MAXALIGN(itemsz);
 		if (PageAddItem(page, (Item) from, itemsz,
-				FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
+					  FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
 			elog(STOP, "_bt_restore_page: can't add item to page");
 		from += itemsz;
 	}
@@ -758,20 +767,20 @@ _bt_restore_page(Page page, char *from, int len)
 static void
 btree_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_btree_delete	   *xlrec;
-	Relation			reln;
-	Buffer				buffer;
-	Page				page;
+	xl_btree_delete *xlrec;
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
 
 	if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
 		return;
 
-	xlrec = (xl_btree_delete*) XLogRecGetData(record);
+	xlrec = (xl_btree_delete *) XLogRecGetData(record);
 	reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
 	if (!RelationIsValid(reln))
 		return;
-	buffer = XLogReadBuffer(false, reln, 
-				ItemPointerGetBlockNumber(&(xlrec->target.tid)));
+	buffer = XLogReadBuffer(false, reln,
+						ItemPointerGetBlockNumber(&(xlrec->target.tid)));
 	if (!BufferIsValid(buffer))
 		elog(STOP, "btree_delete_redo: block unfound");
 	page = (Page) BufferGetPage(buffer);
@@ -796,21 +805,21 @@ btree_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 static void
 btree_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_btree_insert	   *xlrec;
-	Relation			reln;
-	Buffer				buffer;
-	Page				page;
-	BTPageOpaque		pageop;
+	xl_btree_insert *xlrec;
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
+	BTPageOpaque pageop;
 
 	if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
 		return;
 
-	xlrec = (xl_btree_insert*) XLogRecGetData(record);
+	xlrec = (xl_btree_insert *) XLogRecGetData(record);
 	reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
 	if (!RelationIsValid(reln))
 		return;
-	buffer = XLogReadBuffer(false, reln, 
-				ItemPointerGetBlockNumber(&(xlrec->target.tid)));
+	buffer = XLogReadBuffer(false, reln,
+						ItemPointerGetBlockNumber(&(xlrec->target.tid)));
 	if (!BufferIsValid(buffer))
 		elog(STOP, "btree_insert_%sdo: block unfound", (redo) ? "re" : "un");
 	page = (Page) BufferGetPage(buffer);
@@ -825,11 +834,11 @@ btree_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 			UnlockAndReleaseBuffer(buffer);
 			return;
 		}
-		if (PageAddItem(page, (Item)((char*)xlrec + SizeOfBtreeInsert),
-					record->xl_len - SizeOfBtreeInsert,
-					ItemPointerGetOffsetNumber(&(xlrec->target.tid)),	
-					LP_USED) == InvalidOffsetNumber)
-				elog(STOP, "btree_insert_redo: failed to add item");
+		if (PageAddItem(page, (Item) ((char *) xlrec + SizeOfBtreeInsert),
+						record->xl_len - SizeOfBtreeInsert,
+						ItemPointerGetOffsetNumber(&(xlrec->target.tid)),
+						LP_USED) == InvalidOffsetNumber)
+			elog(STOP, "btree_insert_redo: failed to add item");
 
 		PageSetLSN(page, lsn);
 		PageSetSUI(page, ThisStartUpID);
@@ -840,7 +849,7 @@ btree_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 		if (XLByteLT(PageGetLSN(page), lsn))
 			elog(STOP, "btree_insert_undo: bad page LSN");
 
-		if (! P_ISLEAF(pageop))
+		if (!P_ISLEAF(pageop))
 		{
 			UnlockAndReleaseBuffer(buffer);
 			return;
@@ -855,14 +864,14 @@ btree_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
 static void
 btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_btree_split	   *xlrec = (xl_btree_split*) XLogRecGetData(record);
-	Relation			reln;
-	BlockNumber			blkno;
-	Buffer				buffer;
-	Page				page;
-	BTPageOpaque		pageop;
-	char			   *op = (redo) ? "redo" : "undo";
-	bool				isleaf = (record->xl_info & XLOG_BTREE_LEAF);
+	xl_btree_split *xlrec = (xl_btree_split *) XLogRecGetData(record);
+	Relation	reln;
+	BlockNumber blkno;
+	Buffer		buffer;
+	Page		page;
+	BTPageOpaque pageop;
+	char	   *op = (redo) ? "redo" : "undo";
+	bool		isleaf = (record->xl_info & XLOG_BTREE_LEAF);
 
 	reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
 	if (!RelationIsValid(reln))
@@ -870,7 +879,7 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 
 	/* Left (original) sibling */
 	blkno = (onleft) ? ItemPointerGetBlockNumber(&(xlrec->target.tid)) :
-					BlockIdGetBlockNumber(&(xlrec->otherblk));
+		BlockIdGetBlockNumber(&(xlrec->otherblk));
 	buffer = XLogReadBuffer(false, reln, blkno);
 	if (!BufferIsValid(buffer))
 		elog(STOP, "btree_split_%s: lost left sibling", op);
@@ -892,13 +901,14 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 			pageop->btpo_next = ItemPointerGetBlockNumber(&(xlrec->target.tid));
 		pageop->btpo_flags = (isleaf) ? BTP_LEAF : 0;
 
-		_bt_restore_page(page, (char*)xlrec + SizeOfBtreeSplit, xlrec->leftlen);
+		_bt_restore_page(page, (char *) xlrec + SizeOfBtreeSplit, xlrec->leftlen);
 
 		PageSetLSN(page, lsn);
 		PageSetSUI(page, ThisStartUpID);
 		UnlockAndWriteBuffer(buffer);
 	}
-	else	/* undo */
+	else
+/* undo */
 	{
 		if (XLByteLT(PageGetLSN(page), lsn))
 			elog(STOP, "btree_split_undo: bad left sibling LSN");
@@ -906,8 +916,8 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 	}
 
 	/* Right (new) sibling */
-	blkno = (onleft) ? BlockIdGetBlockNumber(&(xlrec->otherblk)) : 
-					ItemPointerGetBlockNumber(&(xlrec->target.tid));
+	blkno = (onleft) ? BlockIdGetBlockNumber(&(xlrec->otherblk)) :
+		ItemPointerGetBlockNumber(&(xlrec->target.tid));
 	buffer = XLogReadBuffer((redo) ? true : false, reln, blkno);
 	if (!BufferIsValid(buffer))
 		elog(STOP, "btree_split_%s: lost right sibling", op);
@@ -922,21 +932,22 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 	if (redo)
 	{
 		pageop->btpo_parent = BlockIdGetBlockNumber(&(xlrec->parentblk));
-		pageop->btpo_prev = (onleft) ? 
-				ItemPointerGetBlockNumber(&(xlrec->target.tid)) :
-				BlockIdGetBlockNumber(&(xlrec->otherblk));
+		pageop->btpo_prev = (onleft) ?
+			ItemPointerGetBlockNumber(&(xlrec->target.tid)) :
+			BlockIdGetBlockNumber(&(xlrec->otherblk));
 		pageop->btpo_next = BlockIdGetBlockNumber(&(xlrec->rightblk));
 		pageop->btpo_flags = (isleaf) ? BTP_LEAF : 0;
 
 		_bt_restore_page(page,
-				(char*)xlrec + SizeOfBtreeSplit + xlrec->leftlen,
-				record->xl_len - SizeOfBtreeSplit - xlrec->leftlen);
+					  (char *) xlrec + SizeOfBtreeSplit + xlrec->leftlen,
+					 record->xl_len - SizeOfBtreeSplit - xlrec->leftlen);
 
 		PageSetLSN(page, lsn);
 		PageSetSUI(page, ThisStartUpID);
 		UnlockAndWriteBuffer(buffer);
 	}
-	else	/* undo */
+	else
+/* undo */
 	{
 		if (XLByteLT(PageGetLSN(page), lsn))
 			elog(STOP, "btree_split_undo: bad right sibling LSN");
@@ -965,9 +976,9 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 		return;
 	}
 	pageop = (BTPageOpaque) PageGetSpecialPointer(page);
-	pageop->btpo_prev = (onleft) ? 
-			BlockIdGetBlockNumber(&(xlrec->otherblk)) :
-			ItemPointerGetBlockNumber(&(xlrec->target.tid));
+	pageop->btpo_prev = (onleft) ?
+		BlockIdGetBlockNumber(&(xlrec->otherblk)) :
+		ItemPointerGetBlockNumber(&(xlrec->target.tid));
 
 	PageSetLSN(page, lsn);
 	PageSetSUI(page, ThisStartUpID);
@@ -977,14 +988,14 @@ btree_xlog_split(bool redo, bool onleft, XLogRecPtr lsn, XLogRecord *record)
 static void
 btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
 {
-	xl_btree_newroot   *xlrec = (xl_btree_newroot*) XLogRecGetData(record);
-	Relation			reln;
-	Buffer				buffer;
-	Page				page;
-	BTPageOpaque		pageop;
-	Buffer				metabuf;
-	Page				metapg;
-	BTMetaPageData		md;
+	xl_btree_newroot *xlrec = (xl_btree_newroot *) XLogRecGetData(record);
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
+	BTPageOpaque pageop;
+	Buffer		metabuf;
+	Page		metapg;
+	BTMetaPageData md;
 
 	if (!redo)
 		return;
@@ -1011,8 +1022,8 @@ btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
 
 	if (record->xl_len > SizeOfBtreeNewroot)
 		_bt_restore_page(page,
-				(char*)xlrec + SizeOfBtreeNewroot,
-				record->xl_len - SizeOfBtreeNewroot);
+						 (char *) xlrec + SizeOfBtreeNewroot,
+						 record->xl_len - SizeOfBtreeNewroot);
 
 	PageSetLSN(page, lsn);
 	PageSetSUI(page, ThisStartUpID);
@@ -1037,7 +1048,7 @@ btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
 void
 btree_redo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	info &= ~XLOG_BTREE_LEAF;
 	if (info == XLOG_BTREE_DELETE)
@@ -1045,9 +1056,9 @@ btree_redo(XLogRecPtr lsn, XLogRecord *record)
 	else if (info == XLOG_BTREE_INSERT)
 		btree_xlog_insert(true, lsn, record);
 	else if (info == XLOG_BTREE_SPLIT)
-		btree_xlog_split(true, false, lsn, record);	/* new item on the right */
+		btree_xlog_split(true, false, lsn, record);		/* new item on the right */
 	else if (info == XLOG_BTREE_SPLEFT)
-		btree_xlog_split(true, true, lsn, record);	/* new item on the left */
+		btree_xlog_split(true, true, lsn, record);		/* new item on the left */
 	else if (info == XLOG_BTREE_NEWROOT)
 		btree_xlog_newroot(true, lsn, record);
 	else
@@ -1057,7 +1068,7 @@ btree_redo(XLogRecPtr lsn, XLogRecord *record)
 void
 btree_undo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	info &= ~XLOG_BTREE_LEAF;
 	if (info == XLOG_BTREE_DELETE)
@@ -1065,9 +1076,9 @@ btree_undo(XLogRecPtr lsn, XLogRecord *record)
 	else if (info == XLOG_BTREE_INSERT)
 		btree_xlog_insert(false, lsn, record);
 	else if (info == XLOG_BTREE_SPLIT)
-		btree_xlog_split(false, false, lsn, record);/* new item on the right */
+		btree_xlog_split(false, false, lsn, record);	/* new item on the right */
 	else if (info == XLOG_BTREE_SPLEFT)
-		btree_xlog_split(false, true, lsn, record);	/* new item on the left */
+		btree_xlog_split(false, true, lsn, record);		/* new item on the left */
 	else if (info == XLOG_BTREE_NEWROOT)
 		btree_xlog_newroot(false, lsn, record);
 	else
@@ -1078,45 +1089,49 @@ static void
 out_target(char *buf, xl_btreetid *target)
 {
 	sprintf(buf + strlen(buf), "node %u/%u; tid %u/%u",
-		target->node.tblNode, target->node.relNode,
-		ItemPointerGetBlockNumber(&(target->tid)), 
-		ItemPointerGetOffsetNumber(&(target->tid)));
+			target->node.tblNode, target->node.relNode,
+			ItemPointerGetBlockNumber(&(target->tid)),
+			ItemPointerGetOffsetNumber(&(target->tid)));
 }
- 
+
 void
-btree_desc(char *buf, uint8 xl_info, char* rec)
+btree_desc(char *buf, uint8 xl_info, char *rec)
 {
-	uint8	info = xl_info & ~XLR_INFO_MASK;
+	uint8		info = xl_info & ~XLR_INFO_MASK;
 
 	info &= ~XLOG_BTREE_LEAF;
 	if (info == XLOG_BTREE_INSERT)
 	{
-		xl_btree_insert	*xlrec = (xl_btree_insert*) rec;
+		xl_btree_insert *xlrec = (xl_btree_insert *) rec;
+
 		strcat(buf, "insert: ");
 		out_target(buf, &(xlrec->target));
 	}
 	else if (info == XLOG_BTREE_DELETE)
 	{
-		xl_btree_delete	*xlrec = (xl_btree_delete*) rec;
+		xl_btree_delete *xlrec = (xl_btree_delete *) rec;
+
 		strcat(buf, "delete: ");
 		out_target(buf, &(xlrec->target));
 	}
 	else if (info == XLOG_BTREE_SPLIT || info == XLOG_BTREE_SPLEFT)
 	{
-		xl_btree_split	*xlrec = (xl_btree_split*) rec;
-		sprintf(buf + strlen(buf), "split(%s): ", 
-			(info == XLOG_BTREE_SPLIT) ? "right" : "left");
+		xl_btree_split *xlrec = (xl_btree_split *) rec;
+
+		sprintf(buf + strlen(buf), "split(%s): ",
+				(info == XLOG_BTREE_SPLIT) ? "right" : "left");
 		out_target(buf, &(xlrec->target));
 		sprintf(buf + strlen(buf), "; oth %u; rgh %u",
-			BlockIdGetBlockNumber(&xlrec->otherblk),
-			BlockIdGetBlockNumber(&xlrec->rightblk));
+				BlockIdGetBlockNumber(&xlrec->otherblk),
+				BlockIdGetBlockNumber(&xlrec->rightblk));
 	}
 	else if (info == XLOG_BTREE_NEWROOT)
 	{
-		xl_btree_newroot	*xlrec = (xl_btree_newroot*) rec;
+		xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
+
 		sprintf(buf + strlen(buf), "root: node %u/%u; blk %u",
-			xlrec->node.tblNode, xlrec->node.relNode,
-			BlockIdGetBlockNumber(&xlrec->rootblk));
+				xlrec->node.tblNode, xlrec->node.relNode,
+				BlockIdGetBlockNumber(&xlrec->rootblk));
 	}
 	else
 		strcat(buf, "UNKNOWN");
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 6f41ab9c847e6ff5faa83f2ffade653b325d81bf..d8b8e0682a09f6391bb32f848a361b5466b85b9b 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.63 2001/01/24 19:42:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.64 2001/03/22 03:59:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -32,20 +32,20 @@ static RetrieveIndexResult _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
  *
  * NOTE that the returned buffer is read-locked regardless of the access
  * parameter.  However, access = BT_WRITE will allow an empty root page
- * to be created and returned.  When access = BT_READ, an empty index
+ * to be created and returned.	When access = BT_READ, an empty index
  * will result in *bufP being set to InvalidBuffer.
  */
 BTStack
 _bt_search(Relation rel, int keysz, ScanKey scankey,
 		   Buffer *bufP, int access)
 {
-	BTStack stack_in = NULL;
+	BTStack		stack_in = NULL;
 
 	/* Get the root page to start with */
 	*bufP = _bt_getroot(rel, access);
 
 	/* If index is empty and access = BT_READ, no root page is created. */
-	if (! BufferIsValid(*bufP))
+	if (!BufferIsValid(*bufP))
 		return (BTStack) NULL;
 
 	/* Loop iterates once per level descended in the tree */
@@ -79,13 +79,13 @@ _bt_search(Relation rel, int keysz, ScanKey scankey,
 		par_blkno = BufferGetBlockNumber(*bufP);
 
 		/*
-		 * We need to save the bit image of the index entry we chose in the
-		 * parent page on a stack. In case we split the tree, we'll use this
-		 * bit image to figure out what our real parent page is, in case the
-		 * parent splits while we're working lower in the tree.  See the paper
-		 * by Lehman and Yao for how this is detected and handled. (We use the
-		 * child link to disambiguate duplicate keys in the index -- Lehman
-		 * and Yao disallow duplicate keys.)
+		 * We need to save the bit image of the index entry we chose in
+		 * the parent page on a stack. In case we split the tree, we'll
+		 * use this bit image to figure out what our real parent page is,
+		 * in case the parent splits while we're working lower in the
+		 * tree.  See the paper by Lehman and Yao for how this is detected
+		 * and handled. (We use the child link to disambiguate duplicate
+		 * keys in the index -- Lehman and Yao disallow duplicate keys.)
 		 */
 		new_stack = (BTStack) palloc(sizeof(BTStackData));
 		new_stack->bts_blkno = par_blkno;
@@ -98,9 +98,9 @@ _bt_search(Relation rel, int keysz, ScanKey scankey,
 		*bufP = _bt_getbuf(rel, blkno, BT_READ);
 
 		/*
-		 * Race -- the page we just grabbed may have split since we read its
-		 * pointer in the parent.  If it has, we may need to move right to its
-		 * new sibling.  Do that.
+		 * Race -- the page we just grabbed may have split since we read
+		 * its pointer in the parent.  If it has, we may need to move
+		 * right to its new sibling.  Do that.
 		 */
 		*bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ);
 
@@ -127,7 +127,7 @@ _bt_search(Relation rel, int keysz, ScanKey scankey,
  *
  *		On entry, we have the buffer pinned and a lock of the proper type.
  *		If we move right, we release the buffer and lock and acquire the
- *		same on the right sibling.  Return value is the buffer we stop at.
+ *		same on the right sibling.	Return value is the buffer we stop at.
  */
 Buffer
 _bt_moveright(Relation rel,
@@ -153,7 +153,7 @@ _bt_moveright(Relation rel,
 		   _bt_compare(rel, keysz, scankey, page, P_HIKEY) > 0)
 	{
 		/* step right one page */
-		BlockNumber		rblkno = opaque->btpo_next;
+		BlockNumber rblkno = opaque->btpo_next;
 
 		_bt_relbuf(rel, buf, access);
 		buf = _bt_getbuf(rel, rblkno, access);
@@ -184,7 +184,7 @@ _bt_moveright(Relation rel,
  * find all leaf keys >= given scankey.
  *
  * This procedure is not responsible for walking right, it just examines
- * the given page.  _bt_binsrch() has no lock or refcount side effects
+ * the given page.	_bt_binsrch() has no lock or refcount side effects
  * on the buffer.
  */
 OffsetNumber
@@ -299,7 +299,7 @@ _bt_compare(Relation rel,
 	 * Force result ">" if target item is first data item on an internal
 	 * page --- see NOTE above.
 	 */
-	if (! P_ISLEAF(opaque) && offnum == P_FIRSTDATAKEY(opaque))
+	if (!P_ISLEAF(opaque) && offnum == P_FIRSTDATAKEY(opaque))
 		return 1;
 
 	btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
@@ -327,7 +327,7 @@ _bt_compare(Relation rel,
 		datum = index_getattr(itup, entry->sk_attno, itupdesc, &isNull);
 
 		/* see comments about NULLs handling in btbuild */
-		if (entry->sk_flags & SK_ISNULL)	/* key is NULL */
+		if (entry->sk_flags & SK_ISNULL)		/* key is NULL */
 		{
 			if (isNull)
 				result = 0;		/* NULL "=" NULL */
@@ -458,10 +458,10 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 	_bt_orderkeys(rel, so);
 
 	/*
-	 * Quit now if _bt_orderkeys() discovered that the scan keys can
-	 * never be satisfied (eg, x == 1 AND x > 2).
+	 * Quit now if _bt_orderkeys() discovered that the scan keys can never
+	 * be satisfied (eg, x == 1 AND x > 2).
 	 */
-	if (! so->qual_ok)
+	if (!so->qual_ok)
 		return (RetrieveIndexResult) NULL;
 
 	/*
@@ -484,17 +484,16 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 				break;
 			strat = _bt_getstrat(rel, attno,
 								 so->keyData[i].sk_procedure);
+
 			/*
 			 * Can we use this key as a starting boundary for this attr?
 			 *
-			 * We can use multiple keys if they look like, say, = >= =
-			 * but we have to stop after accepting a > or < boundary.
+			 * We can use multiple keys if they look like, say, = >= = but we
+			 * have to stop after accepting a > or < boundary.
 			 */
 			if (strat == strat_total ||
 				strat == BTEqualStrategyNumber)
-			{
 				nKeyIs[keysCount++] = i;
-			}
 			else if (ScanDirectionIsBackward(dir) &&
 					 (strat == BTLessStrategyNumber ||
 					  strat == BTLessEqualStrategyNumber))
@@ -536,7 +535,11 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 	for (i = 0; i < keysCount; i++)
 	{
 		j = nKeyIs[i];
-		/* _bt_orderkeys disallows it, but it's place to add some code later */
+
+		/*
+		 * _bt_orderkeys disallows it, but it's place to add some code
+		 * later
+		 */
 		if (so->keyData[j].sk_flags & SK_ISNULL)
 		{
 			pfree(nKeyIs);
@@ -562,7 +565,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 	/* don't need to keep the stack around... */
 	_bt_freestack(stack);
 
-	if (! BufferIsValid(buf))
+	if (!BufferIsValid(buf))
 	{
 		/* Only get here if index is completely empty */
 		ItemPointerSetInvalid(current);
@@ -601,6 +604,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 	switch (strat_total)
 	{
 		case BTLessStrategyNumber:
+
 			/*
 			 * Back up one to arrive at last item < scankey
 			 */
@@ -612,6 +616,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 			break;
 
 		case BTLessEqualStrategyNumber:
+
 			/*
 			 * We need to find the last item <= scankey, so step forward
 			 * till we find one > scankey, then step back one.
@@ -645,9 +650,10 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 			break;
 
 		case BTEqualStrategyNumber:
+
 			/*
-			 * Make sure we are on the first equal item; might have to step
-			 * forward if currently at end of page.
+			 * Make sure we are on the first equal item; might have to
+			 * step forward if currently at end of page.
 			 */
 			if (offnum > PageGetMaxOffsetNumber(page))
 			{
@@ -661,7 +667,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 			}
 			result = _bt_compare(rel, keysCount, scankeys, page, offnum);
 			if (result != 0)
-				goto nomatches;	/* no equal items! */
+				goto nomatches; /* no equal items! */
+
 			/*
 			 * If a backward scan was specified, need to start with last
 			 * equal item not first one.
@@ -685,6 +692,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 			break;
 
 		case BTGreaterEqualStrategyNumber:
+
 			/*
 			 * We want the first item >= scankey, which is where we are...
 			 * unless we're not anywhere at all...
@@ -700,9 +708,10 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
 			break;
 
 		case BTGreaterStrategyNumber:
+
 			/*
-			 * We want the first item > scankey, so make sure we are on
-			 * an item and then step over any equal items.
+			 * We want the first item > scankey, so make sure we are on an
+			 * item and then step over any equal items.
 			 */
 			if (offnum > PageGetMaxOffsetNumber(page))
 			{
@@ -850,11 +859,12 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
 				*bufP = _bt_getbuf(rel, blkno, BT_READ);
 				page = BufferGetPage(*bufP);
 				opaque = (BTPageOpaque) PageGetSpecialPointer(page);
+
 				/*
 				 * If the adjacent page just split, then we have to walk
-				 * right to find the block that's now adjacent to where
-				 * we were.  Because pages only split right, we don't have
-				 * to worry about this failing to terminate.
+				 * right to find the block that's now adjacent to where we
+				 * were.  Because pages only split right, we don't have to
+				 * worry about this failing to terminate.
 				 */
 				while (opaque->btpo_next != obknum)
 				{
@@ -912,12 +922,12 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
 
 	/*
 	 * Scan down to the leftmost or rightmost leaf page.  This is a
-	 * simplified version of _bt_search().  We don't maintain a stack
+	 * simplified version of _bt_search().	We don't maintain a stack
 	 * since we know we won't need it.
 	 */
 	buf = _bt_getroot(rel, BT_READ);
 
-	if (! BufferIsValid(buf))
+	if (!BufferIsValid(buf))
 	{
 		/* empty index... */
 		ItemPointerSetInvalid(current);
@@ -981,7 +991,8 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
 		Assert(P_RIGHTMOST(opaque));
 
 		start = PageGetMaxOffsetNumber(page);
-		if (start < P_FIRSTDATAKEY(opaque))	/* watch out for empty page */
+		if (start < P_FIRSTDATAKEY(opaque))		/* watch out for empty
+												 * page */
 			start = P_FIRSTDATAKEY(opaque);
 	}
 	else
@@ -995,8 +1006,8 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
 	so->btso_curbuf = buf;
 
 	/*
-	 * Left/rightmost page could be empty due to deletions,
-	 * if so step till we find a nonempty page.
+	 * Left/rightmost page could be empty due to deletions, if so step
+	 * till we find a nonempty page.
 	 */
 	if (start > maxoff)
 	{
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index e9224a485afe0937d24391c024bf8416637742e2..2aca6bf7cfc5bc47042dbe0a67211278e34f28b3 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -6,7 +6,7 @@
  *
  * We use tuplesort.c to sort the given index tuples into order.
  * Then we scan the index tuples in order and build the btree pages
- * for each level.  We load source tuples into leaf-level pages.
+ * for each level.	We load source tuples into leaf-level pages.
  * Whenever we fill a page at one level, we add a link to it to its
  * parent level (starting a new parent level if necessary).  When
  * done, we write out each final page on each level, adding it to
@@ -35,7 +35,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.59 2001/01/24 19:42:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.60 2001/03/22 03:59:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,7 +57,7 @@ struct BTSpool
 };
 
 /*
- * Status record for a btree page being built.  We have one of these
+ * Status record for a btree page being built.	We have one of these
  * for each active tree level.
  *
  * The reason we need to store a copy of the minimum key is that we'll
@@ -73,11 +73,13 @@ typedef struct BTPageState
 {
 	Buffer		btps_buf;		/* current buffer & page */
 	Page		btps_page;
-	BTItem		btps_minkey;	/* copy of minimum key (first item) on page */
+	BTItem		btps_minkey;	/* copy of minimum key (first item) on
+								 * page */
 	OffsetNumber btps_lastoff;	/* last item offset loaded */
 	int			btps_level;		/* tree level (0 = leaf) */
-	Size		btps_full;		/* "full" if less than this much free space */
-	struct BTPageState *btps_next; /* link to parent level, if any */
+	Size		btps_full;		/* "full" if less than this much free
+								 * space */
+	struct BTPageState *btps_next;		/* link to parent level, if any */
 } BTPageState;
 
 
@@ -92,7 +94,7 @@ static void _bt_blnewpage(Relation index, Buffer *buf, Page *page, int flags);
 static BTPageState *_bt_pagestate(Relation index, int flags, int level);
 static void _bt_slideleft(Relation index, Buffer buf, Page page);
 static void _bt_sortaddtup(Page page, Size itemsize,
-						   BTItem btitem, OffsetNumber itup_off);
+			   BTItem btitem, OffsetNumber itup_off);
 static void _bt_buildadd(Relation index, BTPageState *state, BTItem bti);
 static void _bt_uppershutdown(Relation index, BTPageState *state);
 static void _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2);
@@ -162,7 +164,7 @@ _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2)
 		ShowUsage();
 		ResetUsage();
 	}
-#endif /* BTREE_BUILD_STATS */
+#endif	 /* BTREE_BUILD_STATS */
 	tuplesort_performsort(btspool->sortstate);
 
 	if (btspool2)
@@ -269,9 +271,9 @@ _bt_sortaddtup(Page page,
 			   OffsetNumber itup_off)
 {
 	BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
-	BTItemData truncitem;
+	BTItemData	truncitem;
 
-	if (! P_ISLEAF(opaque) && itup_off == P_FIRSTKEY)
+	if (!P_ISLEAF(opaque) && itup_off == P_FIRSTKEY)
 	{
 		memcpy(&truncitem, btitem, sizeof(BTItemData));
 		truncitem.bti_itup.t_info = sizeof(BTItemData);
@@ -290,7 +292,7 @@ _bt_sortaddtup(Page page,
  * We must be careful to observe the page layout conventions of nbtsearch.c:
  * - rightmost pages start data items at P_HIKEY instead of at P_FIRSTKEY.
  * - on non-leaf pages, the key portion of the first item need not be
- *   stored, we should store only the link.
+ *	 stored, we should store only the link.
  *
  * A leaf page being built looks like:
  *
@@ -347,11 +349,12 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 	 */
 	if (btisz > (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
 		elog(ERROR, "btree: index item size %lu exceeds maximum %ld",
-			 (unsigned long)btisz,
-			 (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
+			 (unsigned long) btisz,
+			 (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData));
 
 	if (pgspc < btisz || pgspc < state->btps_full)
 	{
+
 		/*
 		 * Item won't fit on this page, or we feel the page is full enough
 		 * already.  Finish off the page and write it out.
@@ -388,9 +391,9 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 		((PageHeader) opage)->pd_lower -= sizeof(ItemIdData);
 
 		/*
-		 * Link the old buffer into its parent, using its minimum key.
-		 * If we don't have a parent, we have to create one;
-		 * this adds a new btree level.
+		 * Link the old buffer into its parent, using its minimum key. If
+		 * we don't have a parent, we have to create one; this adds a new
+		 * btree level.
 		 */
 		if (state->btps_next == (BTPageState *) NULL)
 		{
@@ -405,8 +408,8 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 
 		/*
 		 * Save a copy of the minimum key for the new page.  We have to
-		 * copy it off the old page, not the new one, in case we are
-		 * not at leaf level.
+		 * copy it off the old page, not the new one, in case we are not
+		 * at leaf level.
 		 */
 		state->btps_minkey = _bt_formitem(&(obti->bti_itup));
 
@@ -414,13 +417,13 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 		 * Set the sibling links for both pages, and parent links too.
 		 *
 		 * It's not necessary to set the parent link at all, because it's
-		 * only used for handling concurrent root splits, but we may as well
-		 * do it as a debugging aid.  Note we set new page's link as well
-		 * as old's, because if the new page turns out to be the last of
-		 * the level, _bt_uppershutdown won't change it.  The links may be
-		 * out of date by the time the build finishes, but that's OK; they
-		 * need only point to a left-sibling of the true parent.  See the
-		 * README file for more info.
+		 * only used for handling concurrent root splits, but we may as
+		 * well do it as a debugging aid.  Note we set new page's link as
+		 * well as old's, because if the new page turns out to be the last
+		 * of the level, _bt_uppershutdown won't change it.  The links may
+		 * be out of date by the time the build finishes, but that's OK;
+		 * they need only point to a left-sibling of the true parent.  See
+		 * the README file for more info.
 		 */
 		{
 			BTPageOpaque oopaque = (BTPageOpaque) PageGetSpecialPointer(opage);
@@ -434,7 +437,7 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 		}
 
 		/*
-		 * Write out the old page.  We never want to see it again, so we
+		 * Write out the old page.	We never want to see it again, so we
 		 * can give up our lock (if we had one; most likely BuildingBtree
 		 * is set, so we aren't locking).
 		 */
@@ -449,8 +452,8 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
 	/*
 	 * If the new item is the first for its page, stash a copy for later.
 	 * Note this will only happen for the first item on a level; on later
-	 * pages, the first item for a page is copied from the prior page
-	 * in the code above.
+	 * pages, the first item for a page is copied from the prior page in
+	 * the code above.
 	 */
 	if (last_off == P_HIKEY)
 	{
@@ -493,8 +496,8 @@ _bt_uppershutdown(Relation index, BTPageState *state)
 		 *
 		 * If we're at the top, it's the root, so attach it to the metapage.
 		 * Otherwise, add an entry for it to its parent using its minimum
-		 * key.  This may cause the last page of the parent level to split,
-		 * but that's not a problem -- we haven't gotten to it yet.
+		 * key.  This may cause the last page of the parent level to
+		 * split, but that's not a problem -- we haven't gotten to it yet.
 		 */
 		if (s->btps_next == (BTPageState *) NULL)
 		{
@@ -513,7 +516,7 @@ _bt_uppershutdown(Relation index, BTPageState *state)
 
 		/*
 		 * This is the rightmost page, so the ItemId array needs to be
-		 * slid back one slot.  Then we can dump out the page.
+		 * slid back one slot.	Then we can dump out the page.
 		 */
 		_bt_slideleft(index, s->btps_buf, s->btps_page);
 		_bt_wrtbuf(index, s->btps_buf);
@@ -529,22 +532,29 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
 {
 	BTPageState *state = NULL;
 	bool		merge = (btspool2 != NULL);
-	BTItem		bti, bti2 = NULL;
-	bool		should_free, should_free2, load1;
+	BTItem		bti,
+				bti2 = NULL;
+	bool		should_free,
+				should_free2,
+				load1;
 	TupleDesc	tupdes = RelationGetDescr(index);
-	int		i, keysz = RelationGetNumberOfAttributes(index);
+	int			i,
+				keysz = RelationGetNumberOfAttributes(index);
 	ScanKey		indexScanKey = NULL;
 
 	if (merge)
 	{
+
 		/*
-	 	 * Another BTSpool for dead tuples exists.
-	 	 * Now we have to merge btspool and btspool2.
-	 	 */
-		ScanKey	entry;
-		Datum	attrDatum1, attrDatum2;
-		bool	isFirstNull, isSecondNull;
-		int32	compare;
+		 * Another BTSpool for dead tuples exists. Now we have to merge
+		 * btspool and btspool2.
+		 */
+		ScanKey		entry;
+		Datum		attrDatum1,
+					attrDatum2;
+		bool		isFirstNull,
+					isSecondNull;
+		int32		compare;
 
 		/* the preparation of merge */
 		bti = (BTItem) tuplesort_getindextuple(btspool->sortstate, true, &should_free);
@@ -552,7 +562,7 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
 		indexScanKey = _bt_mkscankey_nodata(index);
 		for (;;)
 		{
-			load1 = true; /* load BTSpool next ? */
+			load1 = true;		/* load BTSpool next ? */
 			if (NULL == bti2)
 			{
 				if (NULL == bti)
@@ -564,8 +574,8 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
 				for (i = 1; i <= keysz; i++)
 				{
 					entry = indexScanKey + i - 1;
-					attrDatum1 = index_getattr((IndexTuple)bti, i, tupdes, &isFirstNull);
-					attrDatum2 = index_getattr((IndexTuple)bti2, i, tupdes, &isSecondNull);
+					attrDatum1 = index_getattr((IndexTuple) bti, i, tupdes, &isFirstNull);
+					attrDatum2 = index_getattr((IndexTuple) bti2, i, tupdes, &isSecondNull);
 					if (isFirstNull)
 					{
 						if (!isSecondNull)
@@ -586,7 +596,7 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
 						}
 						else if (compare < 0)
 							break;
-					}	
+					}
 				}
 			}
 			else
@@ -613,7 +623,8 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
 		}
 		_bt_freeskey(indexScanKey);
 	}
-	else	/* merge is unnecessary */
+	else
+/* merge is unnecessary */
 	{
 		while (bti = (BTItem) tuplesort_getindextuple(btspool->sortstate, true, &should_free), bti != (BTItem) NULL)
 		{
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 507205f2be781ad0d619710051a01c4c3bf613d0..2a37147d68ec75ba7fe7e954162a2745fe6fd148 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.42 2001/01/24 19:42:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.43 2001/03/22 03:59:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ _bt_freestack(BTStack stack)
  * Construct a BTItem from a plain IndexTuple.
  *
  * This is now useless code, since a BTItem *is* an index tuple with
- * no extra stuff.  We hang onto it for the moment to preserve the
+ * no extra stuff.	We hang onto it for the moment to preserve the
  * notational distinction, in case we want to add some extra stuff
  * again someday.
  */
@@ -165,7 +165,7 @@ _bt_formitem(IndexTuple itup)
  * are "x = 1 AND y < 4 AND z < 5", then _bt_checkkeys will reject a tuple
  * (1,2,7), but we must continue the scan in case there are tuples (1,3,z).
  * But once we reach tuples like (1,4,z) we can stop scanning because no
- * later tuples could match.  This is reflected by setting 
+ * later tuples could match.  This is reflected by setting
  * so->numberOfRequiredKeys to the number of leading keys that must be
  * matched to continue the scan.  numberOfRequiredKeys is equal to the
  * number of leading "=" keys plus the key(s) for the first non "="
@@ -178,7 +178,7 @@ _bt_formitem(IndexTuple itup)
  *
  * XXX this routine is one of many places that fail to handle SK_COMMUTE
  * scankeys properly.  Currently, the planner is careful never to generate
- * any indexquals that would require SK_COMMUTE to be set.  Someday we ought
+ * any indexquals that would require SK_COMMUTE to be set.	Someday we ought
  * to try to fix this, though it's not real critical as long as indexable
  * operators all have commutators...
  *
@@ -191,7 +191,7 @@ _bt_formitem(IndexTuple itup)
 void
 _bt_orderkeys(Relation relation, BTScanOpaque so)
 {
-	ScanKeyData	xform[BTMaxStrategyNumber];
+	ScanKeyData xform[BTMaxStrategyNumber];
 	bool		init[BTMaxStrategyNumber];
 	uint16		numberOfKeys = so->numberOfKeys;
 	ScanKey		key;
@@ -240,14 +240,14 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 	/*
 	 * Initialize for processing of keys for attr 1.
 	 *
-	 * xform[i] holds a copy of the current scan key of strategy type i+1,
-	 * if any; init[i] is TRUE if we have found such a key for this attr.
+	 * xform[i] holds a copy of the current scan key of strategy type i+1, if
+	 * any; init[i] is TRUE if we have found such a key for this attr.
 	 */
 	attno = 1;
 	map = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(relation),
 									  BTMaxStrategyNumber,
 									  attno);
-	MemSet(xform, 0, sizeof(xform)); /* not really necessary */
+	MemSet(xform, 0, sizeof(xform));	/* not really necessary */
 	MemSet(init, 0, sizeof(init));
 
 	/*
@@ -255,7 +255,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 	 * pass to handle after-last-key processing.  Actual exit from the
 	 * loop is at the "break" statement below.
 	 */
-	for (i = 0; ; cur++, i++)
+	for (i = 0;; cur++, i++)
 	{
 		if (i < numberOfKeys)
 		{
@@ -263,7 +263,9 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 			if (cur->sk_flags & SK_ISNULL)
 			{
 				so->qual_ok = false;
-				/* Quit processing so we don't try to invoke comparison
+
+				/*
+				 * Quit processing so we don't try to invoke comparison
 				 * routines on NULLs.
 				 */
 				return;
@@ -271,8 +273,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 		}
 
 		/*
-		 * If we are at the end of the keys for a particular attr,
-		 * finish up processing and emit the cleaned-up keys.
+		 * If we are at the end of the keys for a particular attr, finish
+		 * up processing and emit the cleaned-up keys.
 		 */
 		if (i == numberOfKeys || cur->sk_attno != attno)
 		{
@@ -296,7 +298,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 				eq = &xform[BTEqualStrategyNumber - 1];
 				for (j = BTMaxStrategyNumber; --j >= 0;)
 				{
-					if (! init[j] ||
+					if (!init[j] ||
 						j == (BTEqualStrategyNumber - 1))
 						continue;
 					chk = &xform[j];
@@ -313,6 +315,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 			}
 			else
 			{
+
 				/*
 				 * No "=" for this key, so we're done with required keys
 				 */
@@ -355,8 +358,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 			 * Emit the cleaned-up keys back into the key[] array in the
 			 * correct order.  Note we are overwriting our input here!
 			 * It's OK because (a) xform[] is a physical copy of the keys
-			 * we want, (b) we cannot emit more keys than we input, so
-			 * we won't overwrite as-yet-unprocessed keys.
+			 * we want, (b) we cannot emit more keys than we input, so we
+			 * won't overwrite as-yet-unprocessed keys.
 			 */
 			for (j = BTMaxStrategyNumber; --j >= 0;)
 			{
@@ -383,7 +386,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 			map = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(relation),
 											  BTMaxStrategyNumber,
 											  attno);
-			MemSet(xform, 0, sizeof(xform)); /* not really necessary */
+			MemSet(xform, 0, sizeof(xform));	/* not really necessary */
 			MemSet(init, 0, sizeof(init));
 		}
 
@@ -409,7 +412,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
 			if (DatumGetBool(test))
 				xform[j].sk_argument = cur->sk_argument;
 			else if (j == (BTEqualStrategyNumber - 1))
-				so->qual_ok = false; /* key == a && key == b, but a != b */
+				so->qual_ok = false;	/* key == a && key == b, but a !=
+										 * b */
 		}
 		else
 		{
@@ -473,16 +477,18 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple,
 
 		if (isNull)
 		{
+
 			/*
 			 * Since NULLs are sorted after non-NULLs, we know we have
 			 * reached the upper limit of the range of values for this
-			 * index attr.  On a forward scan, we can stop if this qual
-			 * is one of the "must match" subset.  On a backward scan,
+			 * index attr.	On a forward scan, we can stop if this qual is
+			 * one of the "must match" subset.	On a backward scan,
 			 * however, we should keep going.
 			 */
 			if (keysok < so->numberOfRequiredKeys &&
 				ScanDirectionIsForward(dir))
 				*continuescan = false;
+
 			/*
 			 * In any case, this indextuple doesn't match the qual.
 			 */
@@ -498,9 +504,10 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple,
 
 		if (DatumGetBool(test) == !!(key->sk_flags & SK_NEGATE))
 		{
+
 			/*
-			 * Tuple fails this qual.  If it's a required qual, then
-			 * we can conclude no further tuples will pass, either.
+			 * Tuple fails this qual.  If it's a required qual, then we
+			 * can conclude no further tuples will pass, either.
 			 */
 			if (keysok < so->numberOfRequiredKeys)
 				*continuescan = false;
diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c
index df0f5e9c80e6cca2c763b112febaf4b329c27292..c8fa6b18d684054e051cf86edd3a2da66d1db357 100644
--- a/src/backend/access/rtree/rtget.c
+++ b/src/backend/access/rtree/rtget.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.24 2001/01/24 19:42:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.25 2001/03/22 03:59:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,8 +30,8 @@ static ItemPointer rtheapptr(Relation r, ItemPointer itemp);
 Datum
 rtgettuple(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc		s = (IndexScanDesc) PG_GETARG_POINTER(0);
-	ScanDirection		dir = (ScanDirection) PG_GETARG_INT32(1);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
 	RetrieveIndexResult res;
 
 	/* if we have it cached in the scan desc, just return the value */
diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c
index fd610caebe1768eb083480954608f6c85612a06b..400be10ccb3ded1ed9aa23d9bbfc7f0557747b20 100644
--- a/src/backend/access/rtree/rtproc.c
+++ b/src/backend/access/rtree/rtproc.c
@@ -6,7 +6,7 @@
  * NOTE: for largely-historical reasons, the intersection functions should
  * return a NULL pointer (*not* an SQL null value) to indicate "no
  * intersection".  The size functions must be prepared to accept such
- * a pointer and return 0.  This convention means that only pass-by-reference
+ * a pointer and return 0.	This convention means that only pass-by-reference
  * data types can be used as the output of the union and intersection
  * routines, but that's not a big problem.
  *
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.31 2001/01/24 19:42:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.32 2001/03/22 03:59:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,6 +70,7 @@ Datum
 rt_box_size(PG_FUNCTION_ARGS)
 {
 	BOX		   *a = PG_GETARG_BOX_P(0);
+
 	/* NB: size is an output argument */
 	float	   *size = (float *) PG_GETARG_POINTER(1);
 
@@ -98,8 +99,8 @@ rt_bigbox_size(PG_FUNCTION_ARGS)
 Datum
 rt_poly_union(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *a = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *b = PG_GETARG_POLYGON_P(1);
+	POLYGON    *a = PG_GETARG_POLYGON_P(0);
+	POLYGON    *b = PG_GETARG_POLYGON_P(1);
 	POLYGON    *p;
 
 	p = (POLYGON *) palloc(sizeof(POLYGON));
@@ -122,8 +123,8 @@ rt_poly_union(PG_FUNCTION_ARGS)
 Datum
 rt_poly_inter(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *a = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *b = PG_GETARG_POLYGON_P(1);
+	POLYGON    *a = PG_GETARG_POLYGON_P(0);
+	POLYGON    *b = PG_GETARG_POLYGON_P(1);
 	POLYGON    *p;
 
 	p = (POLYGON *) palloc(sizeof(POLYGON));
@@ -155,13 +156,15 @@ Datum
 rt_poly_size(PG_FUNCTION_ARGS)
 {
 	Pointer		aptr = PG_GETARG_POINTER(0);
+
 	/* NB: size is an output argument */
 	float	   *size = (float *) PG_GETARG_POINTER(1);
-	POLYGON	   *a;
+	POLYGON    *a;
 	double		xdim,
 				ydim;
 
-	/* Can't just use GETARG because of possibility that input is NULL;
+	/*
+	 * Can't just use GETARG because of possibility that input is NULL;
 	 * since POLYGON is toastable, GETARG will try to inspect its value
 	 */
 	if (aptr == NULL)
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index 45382d5ef3cd441dce716e91e109dd0d2a1f5a07..3752a59e99a3259dcef8feb7660927baf8308a4a 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.60 2001/03/07 21:20:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.61 2001/03/22 03:59:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,12 +68,12 @@ static InsertIndexResult rtdoinsert(Relation r, IndexTuple itup,
 static void rttighten(Relation r, RTSTACK *stk, Datum datum, int att_size,
 		  RTSTATE *rtstate);
 static InsertIndexResult rtdosplit(Relation r, Buffer buffer, RTSTACK *stack,
-		IndexTuple itup, RTSTATE *rtstate);
+		  IndexTuple itup, RTSTATE *rtstate);
 static void rtintinsert(Relation r, RTSTACK *stk, IndexTuple ltup,
 			IndexTuple rtup, RTSTATE *rtstate);
 static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
 static void rtpicksplit(Relation r, Page page, SPLITVEC *v, IndexTuple itup,
-		  RTSTATE *rtstate);
+			RTSTATE *rtstate);
 static void RTInitBuffer(Buffer b, uint32 f);
 static OffsetNumber choose(Relation r, Page p, IndexTuple it,
 	   RTSTATE *rtstate);
@@ -84,12 +84,14 @@ static void initRtstate(RTSTATE *rtstate, Relation index);
 Datum
 rtbuild(PG_FUNCTION_ARGS)
 {
-	Relation		heap = (Relation) PG_GETARG_POINTER(0);
-	Relation		index = (Relation) PG_GETARG_POINTER(1);
-	IndexInfo	   *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node		   *oldPred = (Node *) PG_GETARG_POINTER(3);
+	Relation	heap = (Relation) PG_GETARG_POINTER(0);
+	Relation	index = (Relation) PG_GETARG_POINTER(1);
+	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
+	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	IndexStrategy	istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
+
 #endif
 	HeapScanDesc hscan;
 	HeapTuple	htup;
@@ -101,9 +103,11 @@ rtbuild(PG_FUNCTION_ARGS)
 	int			nhtups,
 				nitups;
 	Node	   *pred = indexInfo->ii_Predicate;
+
 #ifndef OMIT_PARTIAL_INDEX
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
+
 #endif
 	ExprContext *econtext;
 	InsertIndexResult res = NULL;
@@ -171,6 +175,7 @@ rtbuild(PG_FUNCTION_ARGS)
 		nhtups++;
 
 #ifndef OMIT_PARTIAL_INDEX
+
 		/*
 		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
 		 * this tuple if it was already in the existing partial index
@@ -232,9 +237,7 @@ rtbuild(PG_FUNCTION_ARGS)
 
 #ifndef OMIT_PARTIAL_INDEX
 	if (pred != NULL || oldPred != NULL)
-	{
 		ExecDropTupleTable(tupleTable, true);
-	}
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
 
@@ -278,12 +281,14 @@ rtbuild(PG_FUNCTION_ARGS)
 Datum
 rtinsert(PG_FUNCTION_ARGS)
 {
-	Relation		r = (Relation) PG_GETARG_POINTER(0);
-	Datum		   *datum = (Datum *) PG_GETARG_POINTER(1);
-	char		   *nulls = (char *) PG_GETARG_POINTER(2);
-	ItemPointer		ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+	Relation	r = (Relation) PG_GETARG_POINTER(0);
+	Datum	   *datum = (Datum *) PG_GETARG_POINTER(1);
+	char	   *nulls = (char *) PG_GETARG_POINTER(2);
+	ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
-	Relation		heapRel = (Relation) PG_GETARG_POINTER(4);
+	Relation	heapRel = (Relation) PG_GETARG_POINTER(4);
+
 #endif
 	InsertIndexResult res;
 	IndexTuple	itup;
@@ -412,7 +417,7 @@ rttighten(Relation r,
 	p = BufferGetPage(b);
 
 	oldud = IndexTupleGetDatum(PageGetItem(p,
-										   PageGetItemId(p, stk->rts_child)));
+									  PageGetItemId(p, stk->rts_child)));
 
 	FunctionCall2(&rtstate->sizeFn, oldud,
 				  PointerGetDatum(&old_size));
@@ -564,7 +569,7 @@ rtdosplit(Relation r,
 	res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
 
 	/* now insert the new index tuple */
-	if (*spl_left == maxoff+1)
+	if (*spl_left == maxoff + 1)
 	{
 		if (PageAddItem(left, (Item) itup, IndexTupleSize(itup),
 						leftoff, LP_USED) == InvalidOffsetNumber)
@@ -576,7 +581,7 @@ rtdosplit(Relation r,
 	}
 	else
 	{
-		Assert(*spl_right == maxoff+1);
+		Assert(*spl_right == maxoff + 1);
 		if (PageAddItem(right, (Item) itup, IndexTupleSize(itup),
 						rightoff, LP_USED) == InvalidOffsetNumber)
 			elog(ERROR, "rtdosplit: failed to add index item to %s",
@@ -665,10 +670,10 @@ rtintinsert(Relation r,
 	old = (IndexTuple) PageGetItem(p, PageGetItemId(p, stk->rts_child));
 
 	/*
-	 * This is a hack.	Right now, we force rtree internal keys to be constant
-	 * size. To fix this, need delete the old key and add both left and
-	 * right for the two new pages.  The insertion of left may force a
-	 * split if the new left key is bigger than the old key.
+	 * This is a hack.	Right now, we force rtree internal keys to be
+	 * constant size. To fix this, need delete the old key and add both
+	 * left and right for the two new pages.  The insertion of left may
+	 * force a split if the new left key is bigger than the old key.
 	 */
 
 	if (IndexTupleSize(old) != IndexTupleSize(ltup))
@@ -734,7 +739,7 @@ rtnewroot(Relation r, IndexTuple lt, IndexTuple rt)
  * We return two vectors of index item numbers, one for the items to be
  * put on the left page, one for the items to be put on the right page.
  * In addition, the item to be added (itup) is listed in the appropriate
- * vector.  It is represented by item number N+1 (N = # of items on page).
+ * vector.	It is represented by item number N+1 (N = # of items on page).
  *
  * Both vectors appear in sequence order with a terminating sentinel value
  * of InvalidOffsetNumber.
@@ -747,9 +752,9 @@ rtnewroot(Relation r, IndexTuple lt, IndexTuple rt)
  *
  * We must also deal with a consideration not found in Guttman's algorithm:
  * variable-length data.  In particular, the incoming item might be
- * large enough that not just any split will work.  In the worst case,
+ * large enough that not just any split will work.	In the worst case,
  * our "split" may have to be the new item on one page and all the existing
- * items on the other.  Short of that, we have to take care that we do not
+ * items on the other.	Short of that, we have to take care that we do not
  * make a split that leaves both pages too full for the new item.
  */
 static void
@@ -794,9 +799,10 @@ rtpicksplit(Relation r,
 				right_avail_space;
 
 	/*
-	 * First, make sure the new item is not so large that we can't possibly
-	 * fit it on a page, even by itself.  (It's sufficient to make this test
-	 * here, since any oversize tuple must lead to a page split attempt.)
+	 * First, make sure the new item is not so large that we can't
+	 * possibly fit it on a page, even by itself.  (It's sufficient to
+	 * make this test here, since any oversize tuple must lead to a page
+	 * split attempt.)
 	 */
 	newitemsz = IndexTupleTotalSize(itup);
 	if (newitemsz > RTPageAvailSpace)
@@ -804,7 +810,8 @@ rtpicksplit(Relation r,
 			 (unsigned long) newitemsz, (unsigned long) RTPageAvailSpace);
 
 	maxoff = PageGetMaxOffsetNumber(page);
-	newitemoff = OffsetNumberNext(maxoff); /* phony index for new item */
+	newitemoff = OffsetNumberNext(maxoff);		/* phony index for new
+												 * item */
 
 	/* Make arrays big enough for worst case, including sentinel */
 	nbytes = (maxoff + 2) * sizeof(OffsetNumber);
@@ -827,8 +834,8 @@ rtpicksplit(Relation r,
 			item_2_sz = IndexTupleTotalSize(item_2);
 
 			/*
-			 * Ignore seed pairs that don't leave room for the new item
-			 * on either split page.
+			 * Ignore seed pairs that don't leave room for the new item on
+			 * either split page.
 			 */
 			if (newitemsz + item_1_sz > RTPageAvailSpace &&
 				newitemsz + item_2_sz > RTPageAvailSpace)
@@ -841,8 +848,10 @@ rtpicksplit(Relation r,
 						  PointerGetDatum(&size_union));
 			inter_d = FunctionCall2(&rtstate->interFn,
 									datum_alpha, datum_beta);
-			/* The interFn may return a NULL pointer (not an SQL null!)
-			 * to indicate no intersection.  sizeFn must cope with this.
+
+			/*
+			 * The interFn may return a NULL pointer (not an SQL null!) to
+			 * indicate no intersection.  sizeFn must cope with this.
 			 */
 			FunctionCall2(&rtstate->sizeFn, inter_d,
 						  PointerGetDatum(&size_inter));
@@ -869,6 +878,7 @@ rtpicksplit(Relation r,
 
 	if (firsttime)
 	{
+
 		/*
 		 * There is no possible split except to put the new item on its
 		 * own page.  Since we still have to compute the union rectangles,
@@ -916,14 +926,14 @@ rtpicksplit(Relation r,
 
 	for (i = FirstOffsetNumber; i <= newitemoff; i = OffsetNumberNext(i))
 	{
-		bool	left_feasible,
-				right_feasible,
-				choose_left;
+		bool		left_feasible,
+					right_feasible,
+					choose_left;
 
 		/*
 		 * If we've already decided where to place this item, just put it
-		 * on the correct list.  Otherwise, we need to figure out which page
-		 * needs the least enlargement in order to store the item.
+		 * on the correct list.  Otherwise, we need to figure out which
+		 * page needs the least enlargement in order to store the item.
 		 */
 
 		if (i == seed_1)
@@ -961,12 +971,13 @@ rtpicksplit(Relation r,
 					  PointerGetDatum(&size_beta));
 
 		/*
-		 * We prefer the page that shows smaller enlargement of its union area
-		 * (Guttman's algorithm), but we must take care that at least one page
-		 * will still have room for the new item after this one is added.
+		 * We prefer the page that shows smaller enlargement of its union
+		 * area (Guttman's algorithm), but we must take care that at least
+		 * one page will still have room for the new item after this one
+		 * is added.
 		 *
-		 * (We know that all the old items together can fit on one page,
-		 * so we need not worry about any other problem than failing to fit
+		 * (We know that all the old items together can fit on one page, so
+		 * we need not worry about any other problem than failing to fit
 		 * the new item.)
 		 */
 		left_feasible = (left_avail_space >= item_1_sz &&
@@ -987,7 +998,7 @@ rtpicksplit(Relation r,
 		else
 		{
 			elog(ERROR, "rtpicksplit: failed to find a workable page split");
-			choose_left = false; /* keep compiler quiet */
+			choose_left = false;/* keep compiler quiet */
 		}
 
 		if (choose_left)
@@ -1012,7 +1023,7 @@ rtpicksplit(Relation r,
 		}
 	}
 
-	*left = *right = InvalidOffsetNumber; /* add ending sentinels */
+	*left = *right = InvalidOffsetNumber;		/* add ending sentinels */
 
 	v->spl_ldatum = datum_l;
 	v->spl_rdatum = datum_r;
@@ -1096,8 +1107,8 @@ freestack(RTSTACK *s)
 Datum
 rtdelete(PG_FUNCTION_ARGS)
 {
-	Relation		r = (Relation) PG_GETARG_POINTER(0);
-	ItemPointer		tid = (ItemPointer) PG_GETARG_POINTER(1);
+	Relation	r = (Relation) PG_GETARG_POINTER(0);
+	ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
 	BlockNumber blkno;
 	OffsetNumber offnum;
 	Buffer		buf;
@@ -1203,14 +1214,14 @@ rtree_redo(XLogRecPtr lsn, XLogRecord *record)
 {
 	elog(STOP, "rtree_redo: unimplemented");
 }
- 
+
 void
 rtree_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 	elog(STOP, "rtree_undo: unimplemented");
 }
- 
+
 void
-rtree_desc(char *buf, uint8 xl_info, char* rec)
+rtree_desc(char *buf, uint8 xl_info, char *rec)
 {
 }
diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c
index 605d51b5d330a0b8a5767c5bac41bb02baf69b49..f3e6d52fe67314abb06c34e929f90cce963c94b7 100644
--- a/src/backend/access/rtree/rtscan.c
+++ b/src/backend/access/rtree/rtscan.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.35 2001/01/24 19:42:50 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.36 2001/03/22 03:59:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -75,9 +75,9 @@ rtbeginscan(PG_FUNCTION_ARGS)
 Datum
 rtrescan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
-	bool			fromEnd = PG_GETARG_BOOL(1);
-	ScanKey			key = (ScanKey) PG_GETARG_POINTER(2);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	bool		fromEnd = PG_GETARG_BOOL(1);
+	ScanKey		key = (ScanKey) PG_GETARG_POINTER(2);
 	RTreeScanOpaque p;
 	RegProcedure internal_proc;
 	int			i;
@@ -162,7 +162,7 @@ rtrescan(PG_FUNCTION_ARGS)
 Datum
 rtmarkpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
 	RTreeScanOpaque p;
 	RTSTACK    *o,
 			   *n,
@@ -198,7 +198,7 @@ rtmarkpos(PG_FUNCTION_ARGS)
 Datum
 rtrestrpos(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
 	RTreeScanOpaque p;
 	RTSTACK    *o,
 			   *n,
@@ -234,7 +234,7 @@ rtrestrpos(PG_FUNCTION_ARGS)
 Datum
 rtendscan(PG_FUNCTION_ARGS)
 {
-	IndexScanDesc	s = (IndexScanDesc) PG_GETARG_POINTER(0);
+	IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
 	RTreeScanOpaque p;
 
 	p = (RTreeScanOpaque) s->opaque;
diff --git a/src/backend/access/transam/rmgr.c b/src/backend/access/transam/rmgr.c
index b25db74da8cb493c74a9c19e906dd97102988997..625b0db32023cd3e91a26f29774f3f9931a726b9 100644
--- a/src/backend/access/transam/rmgr.c
+++ b/src/backend/access/transam/rmgr.c
@@ -9,21 +9,21 @@
 #include "storage/smgr.h"
 #include "commands/sequence.h"
 
-RmgrData   RmgrTable[] = {
-{"XLOG", xlog_redo, xlog_undo, xlog_desc},
-{"Transaction", xact_redo, xact_undo, xact_desc},
-{"Storage", smgr_redo, smgr_undo, smgr_desc},
-{"Reserved 3", NULL, NULL, NULL},
-{"Reserved 4", NULL, NULL, NULL},
-{"Reserved 5", NULL, NULL, NULL},
-{"Reserved 6", NULL, NULL, NULL},
-{"Reserved 7", NULL, NULL, NULL},
-{"Reserved 8", NULL, NULL, NULL},
-{"Reserved 9", NULL, NULL, NULL},
-{"Heap", heap_redo, heap_undo, heap_desc},
-{"Btree", btree_redo, btree_undo, btree_desc},
-{"Hash", hash_redo, hash_undo, hash_desc},
-{"Rtree", rtree_redo, rtree_undo, rtree_desc},
-{"Gist", gist_redo, gist_undo, gist_desc},
-{"Sequence", seq_redo, seq_undo, seq_desc}
+RmgrData	RmgrTable[] = {
+	{"XLOG", xlog_redo, xlog_undo, xlog_desc},
+	{"Transaction", xact_redo, xact_undo, xact_desc},
+	{"Storage", smgr_redo, smgr_undo, smgr_desc},
+	{"Reserved 3", NULL, NULL, NULL},
+	{"Reserved 4", NULL, NULL, NULL},
+	{"Reserved 5", NULL, NULL, NULL},
+	{"Reserved 6", NULL, NULL, NULL},
+	{"Reserved 7", NULL, NULL, NULL},
+	{"Reserved 8", NULL, NULL, NULL},
+	{"Reserved 9", NULL, NULL, NULL},
+	{"Heap", heap_redo, heap_undo, heap_desc},
+	{"Btree", btree_redo, btree_undo, btree_desc},
+	{"Hash", hash_redo, hash_undo, hash_desc},
+	{"Rtree", rtree_redo, rtree_undo, rtree_desc},
+	{"Gist", gist_redo, gist_undo, gist_desc},
+	{"Sequence", seq_redo, seq_undo, seq_desc}
 };
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 642890579261bab492869afa82b2eeab73c26808..29e72e84175cd1c7f62e8037d0519f9448eaa4bb 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.41 2001/03/18 20:18:59 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.42 2001/03/22 03:59:17 momjian Exp $
  *
  * NOTES
  *	  This file contains the high level access-method interface to the
@@ -427,8 +427,8 @@ InitializeTransactionLog(void)
 		TransactionLogUpdate(AmiTransactionId, XID_COMMIT);
 		TransactionIdStore(AmiTransactionId, &cachedTestXid);
 		cachedTestXidStatus = XID_COMMIT;
-		Assert(!IsUnderPostmaster && 
-				ShmemVariableCache->nextXid <= FirstTransactionId);
+		Assert(!IsUnderPostmaster &&
+			   ShmemVariableCache->nextXid <= FirstTransactionId);
 		ShmemVariableCache->nextXid = FirstTransactionId;
 	}
 	else if (RecoveryCheckingEnabled())
diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c
index e4ff7979cf9034abc9eadf2c48b999d88e3dc4d9..c433506eae65b5d462a5e4180509ba71b4a93e47 100644
--- a/src/backend/access/transam/transsup.c
+++ b/src/backend/access/transam/transsup.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.28 2001/01/24 19:42:51 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.29 2001/03/22 03:59:17 momjian Exp $
  *
  * NOTES
  *	  This file contains support functions for the high
@@ -186,7 +186,7 @@ TransBlockGetXidStatus(Block tblock,
 	bits8		bit2;
 	BitIndex	offset;
 
-	tblock = (Block) ((char*) tblock + sizeof(XLogRecPtr));
+	tblock = (Block) ((char *) tblock + sizeof(XLogRecPtr));
 
 	/* ----------------
 	 *	calculate the index into the transaction data where
@@ -229,7 +229,7 @@ TransBlockSetXidStatus(Block tblock,
 	Index		index;
 	BitIndex	offset;
 
-	tblock = (Block) ((char*) tblock + sizeof(XLogRecPtr));
+	tblock = (Block) ((char *) tblock + sizeof(XLogRecPtr));
 
 	/* ----------------
 	 *	calculate the index into the transaction data where
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index d6097b2567c2e8061528e72534ee3a026ce99f69..34c607eab9f3cd547dc279622c33a1c48348cbc9 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -6,7 +6,7 @@
  * Copyright (c) 2000, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.37 2001/03/18 20:18:59 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.38 2001/03/22 03:59:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,8 +23,8 @@
 #define VAR_OID_PREFETCH		8192
 
 /* Spinlocks for serializing generation of XIDs and OIDs, respectively */
-SPINLOCK XidGenLockId;
-SPINLOCK OidGenLockId;
+SPINLOCK	XidGenLockId;
+SPINLOCK	OidGenLockId;
 
 /* pointer to "variable cache" in shared memory (set up by shmem.c) */
 VariableCache ShmemVariableCache = NULL;
@@ -32,9 +32,10 @@ VariableCache ShmemVariableCache = NULL;
 void
 GetNewTransactionId(TransactionId *xid)
 {
+
 	/*
-	 * During bootstrap initialization, we return the special
-	 * bootstrap transaction id.
+	 * During bootstrap initialization, we return the special bootstrap
+	 * transaction id.
 	 */
 	if (AMI_OVERRIDE)
 	{
@@ -60,9 +61,10 @@ GetNewTransactionId(TransactionId *xid)
 void
 ReadNewTransactionId(TransactionId *xid)
 {
+
 	/*
-	 * During bootstrap initialization, we return the special
-	 * bootstrap transaction id.
+	 * During bootstrap initialization, we return the special bootstrap
+	 * transaction id.
 	 */
 	if (AMI_OVERRIDE)
 	{
@@ -80,7 +82,7 @@ ReadNewTransactionId(TransactionId *xid)
  * ----------------------------------------------------------------
  */
 
-static Oid lastSeenOid = InvalidOid;
+static Oid	lastSeenOid = InvalidOid;
 
 void
 GetNewObjectId(Oid *oid_return)
@@ -119,10 +121,10 @@ CheckMaxObjectId(Oid assigned_oid)
 	}
 
 	/* If we are in the logged oid range, just bump nextOid up */
-	if (assigned_oid <= ShmemVariableCache->nextOid + 
-						ShmemVariableCache->oidCount - 1)
+	if (assigned_oid <= ShmemVariableCache->nextOid +
+		ShmemVariableCache->oidCount - 1)
 	{
-		ShmemVariableCache->oidCount -= 
+		ShmemVariableCache->oidCount -=
 			assigned_oid - ShmemVariableCache->nextOid + 1;
 		ShmemVariableCache->nextOid = assigned_oid + 1;
 		SpinRelease(OidGenLockId);
@@ -130,10 +132,9 @@ CheckMaxObjectId(Oid assigned_oid)
 	}
 
 	/*
-	 * We have exceeded the logged oid range.
-	 * We should lock the database and kill all other backends
-	 * but we are loading oid's that we can not guarantee are unique
-	 * anyway, so we must rely on the user.
+	 * We have exceeded the logged oid range. We should lock the database
+	 * and kill all other backends but we are loading oid's that we can
+	 * not guarantee are unique anyway, so we must rely on the user.
 	 */
 
 	XLogPutNextOid(assigned_oid + VAR_OID_PREFETCH);
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 1331c8e9834c4749c9f9c62d5fec1d1165cb8d13..6a8e6c0639f9926c1b0e63d6c2137b9213fda5af 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.99 2001/03/13 01:17:05 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.100 2001/03/22 03:59:18 momjian Exp $
  *
  * NOTES
  *		Transaction aborts can now occur two ways:
@@ -222,9 +222,10 @@ int			DefaultXactIsoLevel = XACT_READ_COMMITTED;
 int			XactIsoLevel;
 
 int			CommitDelay = 0;	/* precommit delay in microseconds */
-int			CommitSiblings = 5;	/* number of concurrent xacts needed to sleep */
+int			CommitSiblings = 5; /* number of concurrent xacts needed to
+								 * sleep */
 
-static void (*_RollbackFunc)(void*) = NULL;
+static void (*_RollbackFunc) (void *) = NULL;
 static void *_RollbackData = NULL;
 
 /* ----------------
@@ -666,39 +667,40 @@ RecordTransactionCommit()
 
 	if (MyLastRecPtr.xrecoff != 0)
 	{
-		XLogRecData		rdata;
-		xl_xact_commit	xlrec;
-		XLogRecPtr		recptr;
+		XLogRecData rdata;
+		xl_xact_commit xlrec;
+		XLogRecPtr	recptr;
 
 		BufmgrCommit();
 
 		xlrec.xtime = time(NULL);
 		rdata.buffer = InvalidBuffer;
-		rdata.data = (char *)(&xlrec);
+		rdata.data = (char *) (&xlrec);
 		rdata.len = SizeOfXactCommit;
 		rdata.next = NULL;
 
 		START_CRIT_SECTION();
+
 		/*
 		 * SHOULD SAVE ARRAY OF RELFILENODE-s TO DROP
 		 */
 		recptr = XLogInsert(RM_XACT_ID, XLOG_XACT_COMMIT, &rdata);
 
-		/* 
-		 * Sleep before commit! So we can flush more than one
-		 * commit records per single fsync.  (The idea is some other
-		 * backend may do the XLogFlush while we're sleeping.  This
-		 * needs work still, because on most Unixen, the minimum
-		 * select() delay is 10msec or more, which is way too long.)
+		/*
+		 * Sleep before commit! So we can flush more than one commit
+		 * records per single fsync.  (The idea is some other backend may
+		 * do the XLogFlush while we're sleeping.  This needs work still,
+		 * because on most Unixen, the minimum select() delay is 10msec or
+		 * more, which is way too long.)
 		 *
-		 * We do not sleep if enableFsync is not turned on, nor if there
-		 * are fewer than CommitSiblings other backends with active
+		 * We do not sleep if enableFsync is not turned on, nor if there are
+		 * fewer than CommitSiblings other backends with active
 		 * transactions.
 		 */
 		if (CommitDelay > 0 && enableFsync &&
 			CountActiveBackends() >= CommitSiblings)
 		{
-			struct timeval	delay;
+			struct timeval delay;
 
 			delay.tv_sec = 0;
 			delay.tv_usec = CommitDelay;
@@ -812,13 +814,13 @@ RecordTransactionAbort(void)
 	 */
 	if (MyLastRecPtr.xrecoff != 0 && !TransactionIdDidCommit(xid))
 	{
-		XLogRecData		rdata;
-		xl_xact_abort	xlrec;
-		XLogRecPtr		recptr;
+		XLogRecData rdata;
+		xl_xact_abort xlrec;
+		XLogRecPtr	recptr;
 
 		xlrec.xtime = time(NULL);
 		rdata.buffer = InvalidBuffer;
-		rdata.data = (char *)(&xlrec);
+		rdata.data = (char *) (&xlrec);
 		rdata.len = SizeOfXactAbort;
 		rdata.next = NULL;
 
@@ -879,7 +881,7 @@ AtAbort_Memory(void)
 {
 	/* ----------------
 	 *	Make sure we are in a valid context (not a child of
-	 *	TransactionCommandContext...).  Note that it is possible
+	 *	TransactionCommandContext...).	Note that it is possible
 	 *	for this code to be called when we aren't in a transaction
 	 *	at all; go directly to TopMemoryContext in that case.
 	 * ----------------
@@ -896,9 +898,7 @@ AtAbort_Memory(void)
 		MemoryContextResetAndDeleteChildren(TransactionCommandContext);
 	}
 	else
-	{
 		MemoryContextSwitchTo(TopMemoryContext);
-	}
 }
 
 
@@ -1021,6 +1021,7 @@ CurrentXactInProgress(void)
 {
 	return CurrentTransactionState->state == TRANS_INPROGRESS;
 }
+
 #endif
 
 /* --------------------------------
@@ -1106,7 +1107,7 @@ CommitTransaction(void)
 	AtCommit_Memory();
 	AtEOXact_Files();
 
-	SharedBufferChanged = false; /* safest place to do it */
+	SharedBufferChanged = false;/* safest place to do it */
 
 	/* ----------------
 	 *	done with commit processing, set current transaction
@@ -1143,15 +1144,16 @@ AbortTransaction(void)
 
 	/*
 	 * Release any spinlocks or buffer context locks we might be holding
-	 * as quickly as possible.  (Real locks, however, must be held till
-	 * we finish aborting.)  Releasing spinlocks is critical since we
-	 * might try to grab them again while cleaning up!
+	 * as quickly as possible.	(Real locks, however, must be held till we
+	 * finish aborting.)  Releasing spinlocks is critical since we might
+	 * try to grab them again while cleaning up!
 	 */
 	ProcReleaseSpins(NULL);
 	UnlockBuffers();
+
 	/*
-	 * Also clean up any open wait for lock, since the lock manager
-	 * will choke if we try to wait for another lock before doing this.
+	 * Also clean up any open wait for lock, since the lock manager will
+	 * choke if we try to wait for another lock before doing this.
 	 */
 	LockWaitCancel();
 
@@ -1203,7 +1205,7 @@ AbortTransaction(void)
 	AtEOXact_Files();
 	AtAbort_Locks();
 
-	SharedBufferChanged = false; /* safest place to do it */
+	SharedBufferChanged = false;/* safest place to do it */
 
 	/* ----------------
 	 *	State remains TRANS_ABORT until CleanupTransaction().
@@ -1327,8 +1329,8 @@ StartTransactionCommand(void)
 	}
 
 	/*
-	 * We must switch to TransactionCommandContext before returning.
-	 * This is already done if we called StartTransaction, otherwise not.
+	 * We must switch to TransactionCommandContext before returning. This
+	 * is already done if we called StartTransaction, otherwise not.
 	 */
 	Assert(TransactionCommandContext != NULL);
 	MemoryContextSwitchTo(TransactionCommandContext);
@@ -1757,7 +1759,7 @@ IsTransactionBlock(void)
 void
 xact_redo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	if (info == XLOG_XACT_COMMIT)
 	{
@@ -1765,9 +1767,7 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
 		/* SHOULD REMOVE FILES OF ALL DROPPED RELATIONS */
 	}
 	else if (info == XLOG_XACT_ABORT)
-	{
 		TransactionIdAbort(record->xl_xid);
-	}
 	else
 		elog(STOP, "xact_redo: unknown op code %u", info);
 }
@@ -1775,43 +1775,43 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
 void
 xact_undo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
-	if (info == XLOG_XACT_COMMIT)	/* shouldn't be called by XLOG */
+	if (info == XLOG_XACT_COMMIT)		/* shouldn't be called by XLOG */
 		elog(STOP, "xact_undo: can't undo committed xaction");
 	else if (info != XLOG_XACT_ABORT)
 		elog(STOP, "xact_redo: unknown op code %u", info);
 }
- 
+
 void
-xact_desc(char *buf, uint8 xl_info, char* rec)
+xact_desc(char *buf, uint8 xl_info, char *rec)
 {
-	uint8	info = xl_info & ~XLR_INFO_MASK;
+	uint8		info = xl_info & ~XLR_INFO_MASK;
 
 	if (info == XLOG_XACT_COMMIT)
 	{
-		xl_xact_commit	*xlrec = (xl_xact_commit*) rec;
-		struct tm	    *tm = localtime(&xlrec->xtime);
+		xl_xact_commit *xlrec = (xl_xact_commit *) rec;
+		struct tm  *tm = localtime(&xlrec->xtime);
 
 		sprintf(buf + strlen(buf), "commit: %04u-%02u-%02u %02u:%02u:%02u",
-			tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-			tm->tm_hour, tm->tm_min, tm->tm_sec);
+				tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+				tm->tm_hour, tm->tm_min, tm->tm_sec);
 	}
 	else if (info == XLOG_XACT_ABORT)
 	{
-		xl_xact_abort	*xlrec = (xl_xact_abort*) rec;
-		struct tm	    *tm = localtime(&xlrec->xtime);
+		xl_xact_abort *xlrec = (xl_xact_abort *) rec;
+		struct tm  *tm = localtime(&xlrec->xtime);
 
 		sprintf(buf + strlen(buf), "abort: %04u-%02u-%02u %02u:%02u:%02u",
-			tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-			tm->tm_hour, tm->tm_min, tm->tm_sec);
+				tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+				tm->tm_hour, tm->tm_min, tm->tm_sec);
 	}
 	else
 		strcat(buf, "UNKNOWN");
 }
 
 void
-XactPushRollback(void (*func) (void *), void* data)
+			XactPushRollback(void (*func) (void *), void *data)
 {
 #ifdef XLOG_II
 	if (_RollbackFunc != NULL)
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
index 6ee28d1a2b058faa4e1890d21a68da425b698a61..624d6da850c88f2df23ecccf690b73802957206a 100644
--- a/src/backend/access/transam/xid.c
+++ b/src/backend/access/transam/xid.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Id: xid.c,v 1.29 2001/01/24 19:42:51 momjian Exp $
+ *	$Id: xid.c,v 1.30 2001/03/22 03:59:18 momjian Exp $
  *
  * OLD COMMENTS
  * XXX WARNING
@@ -26,8 +26,8 @@
 /*
  * TransactionId is typedef'd as uint32, so...
  */
-#define PG_GETARG_TRANSACTIONID(n)  PG_GETARG_UINT32(n)
-#define PG_RETURN_TRANSACTIONID(x)  PG_RETURN_UINT32(x)
+#define PG_GETARG_TRANSACTIONID(n)	PG_GETARG_UINT32(n)
+#define PG_RETURN_TRANSACTIONID(x)	PG_RETURN_UINT32(x)
 
 
 extern TransactionId NullTransactionId;
@@ -49,6 +49,7 @@ Datum
 xidout(PG_FUNCTION_ARGS)
 {
 	TransactionId transactionId = PG_GETARG_TRANSACTIONID(0);
+
 	/* maximum 32 bit unsigned integer representation takes 10 chars */
 	char	   *representation = palloc(11);
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9994025dd69dd45b215e93200ab0bf2a487f61d3..59d783264bbc78b911e19c9aa99d68713af18f22 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.62 2001/03/18 20:18:59 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.63 2001/03/22 03:59:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,57 +45,60 @@
 /*
  * This chunk of hackery attempts to determine which file sync methods
  * are available on the current platform, and to choose an appropriate
- * default method.  We assume that fsync() is always available, and that
+ * default method.	We assume that fsync() is always available, and that
  * configure determined whether fdatasync() is.
  */
 #define SYNC_METHOD_FSYNC		0
 #define SYNC_METHOD_FDATASYNC	1
-#define SYNC_METHOD_OPEN		2 /* used for both O_SYNC and O_DSYNC */
+#define SYNC_METHOD_OPEN		2		/* used for both O_SYNC and
+										 * O_DSYNC */
 
 #if defined(O_SYNC)
-# define OPEN_SYNC_FLAG		O_SYNC
+#define OPEN_SYNC_FLAG	   O_SYNC
 #else
-# if defined(O_FSYNC)
-#  define OPEN_SYNC_FLAG	O_FSYNC
-# endif
+#if defined(O_FSYNC)
+#define OPEN_SYNC_FLAG	  O_FSYNC
+#endif
 #endif
 
 #if defined(OPEN_SYNC_FLAG)
-# if defined(O_DSYNC) && (O_DSYNC != OPEN_SYNC_FLAG)
-#  define OPEN_DATASYNC_FLAG	O_DSYNC
-# endif
+#if defined(O_DSYNC) && (O_DSYNC != OPEN_SYNC_FLAG)
+#define OPEN_DATASYNC_FLAG	  O_DSYNC
+#endif
 #endif
 
 #if defined(OPEN_DATASYNC_FLAG)
-# define DEFAULT_SYNC_METHOD_STR	"open_datasync"
-# define DEFAULT_SYNC_METHOD		SYNC_METHOD_OPEN
-# define DEFAULT_SYNC_FLAGBIT		OPEN_DATASYNC_FLAG
+#define DEFAULT_SYNC_METHOD_STR    "open_datasync"
+#define DEFAULT_SYNC_METHOD		   SYNC_METHOD_OPEN
+#define DEFAULT_SYNC_FLAGBIT	   OPEN_DATASYNC_FLAG
 #else
-# if defined(HAVE_FDATASYNC)
-#  define DEFAULT_SYNC_METHOD_STR	"fdatasync"
-#  define DEFAULT_SYNC_METHOD		SYNC_METHOD_FDATASYNC
-#  define DEFAULT_SYNC_FLAGBIT		0
-# else
-#  define DEFAULT_SYNC_METHOD_STR	"fsync"
-#  define DEFAULT_SYNC_METHOD		SYNC_METHOD_FSYNC
-#  define DEFAULT_SYNC_FLAGBIT		0
-# endif
+#if defined(HAVE_FDATASYNC)
+#define DEFAULT_SYNC_METHOD_STR   "fdatasync"
+#define DEFAULT_SYNC_METHOD		  SYNC_METHOD_FDATASYNC
+#define DEFAULT_SYNC_FLAGBIT	  0
+#else
+#define DEFAULT_SYNC_METHOD_STR   "fsync"
+#define DEFAULT_SYNC_METHOD		  SYNC_METHOD_FSYNC
+#define DEFAULT_SYNC_FLAGBIT	  0
+#endif
 #endif
 
 
 /* Max time to wait to acquire XLog activity locks */
-#define XLOG_LOCK_TIMEOUT			(5*60*1000000) /* 5 minutes */
+#define XLOG_LOCK_TIMEOUT			(5*60*1000000)		/* 5 minutes */
 /* Max time to wait to acquire checkpoint lock */
-#define CHECKPOINT_LOCK_TIMEOUT		(20*60*1000000) /* 20 minutes */
+#define CHECKPOINT_LOCK_TIMEOUT		(20*60*1000000)		/* 20 minutes */
 
 /* User-settable parameters */
 int			CheckPointSegments = 3;
 int			XLOGbuffers = 8;
-int			XLOGfiles = 0;	/* how many files to pre-allocate during ckpt */
+int			XLOGfiles = 0;		/* how many files to pre-allocate during
+								 * ckpt */
 int			XLOG_DEBUG = 0;
 char	   *XLOG_sync_method = NULL;
 const char	XLOG_sync_method_default[] = DEFAULT_SYNC_METHOD_STR;
-char		XLOG_archive_dir[MAXPGPATH]; /* null string means delete 'em */
+char		XLOG_archive_dir[MAXPGPATH];		/* null string means
+												 * delete 'em */
 
 /* these are derived from XLOG_sync_method by assign_xlog_sync_method */
 static int	sync_method = DEFAULT_SYNC_METHOD;
@@ -135,7 +138,7 @@ static XLogRecPtr ProcLastRecPtr = {0, 0};
 /*
  * RedoRecPtr is this backend's local copy of the REDO record pointer
  * (which is almost but not quite the same as a pointer to the most recent
- * CHECKPOINT record).  We update this from the shared-memory copy,
+ * CHECKPOINT record).	We update this from the shared-memory copy,
  * XLogCtl->Insert.RedoRecPtr, whenever we can safely do so (ie, when we
  * hold the Insert spinlock).  See XLogInsert for details.
  */
@@ -164,12 +167,12 @@ SPINLOCK	ControlFileLockId;
  *
  * XLogCtl->LogwrtResult and XLogCtl->Write.LogwrtResult are both "always
  * right", since both are updated by a write or flush operation before
- * it releases logwrt_lck.  The point of keeping XLogCtl->Write.LogwrtResult
+ * it releases logwrt_lck.	The point of keeping XLogCtl->Write.LogwrtResult
  * is that it can be examined/modified by code that already holds logwrt_lck
  * without needing to grab info_lck as well.
  *
  * XLogCtl->Insert.LogwrtResult may lag behind the reality of the other two,
- * but is updated when convenient.  Again, it exists for the convenience of
+ * but is updated when convenient.	Again, it exists for the convenience of
  * code that is already holding insert_lck but not the other locks.
  *
  * The unshared LogwrtResult may lag behind any or all of these, and again
@@ -187,25 +190,25 @@ typedef struct XLogwrtRqst
 {
 	XLogRecPtr	Write;			/* last byte + 1 to write out */
 	XLogRecPtr	Flush;			/* last byte + 1 to flush */
-} XLogwrtRqst;
+}			XLogwrtRqst;
 
 typedef struct XLogwrtResult
 {
 	XLogRecPtr	Write;			/* last byte + 1 written out */
 	XLogRecPtr	Flush;			/* last byte + 1 flushed */
-} XLogwrtResult;
+}			XLogwrtResult;
 
 /*
  * Shared state data for XLogInsert.
  */
 typedef struct XLogCtlInsert
 {
-	XLogwrtResult	LogwrtResult;	/* a recent value of LogwrtResult */
-	XLogRecPtr		PrevRecord;		/* start of previously-inserted record */
-	uint16			curridx;		/* current block index in cache */
-	XLogPageHeader	currpage;		/* points to header of block in cache */
-	char		   *currpos;		/* current insertion point in cache */
-	XLogRecPtr		RedoRecPtr;		/* current redo point for insertions */
+	XLogwrtResult LogwrtResult; /* a recent value of LogwrtResult */
+	XLogRecPtr	PrevRecord;		/* start of previously-inserted record */
+	uint16		curridx;		/* current block index in cache */
+	XLogPageHeader currpage;	/* points to header of block in cache */
+	char	   *currpos;		/* current insertion point in cache */
+	XLogRecPtr	RedoRecPtr;		/* current redo point for insertions */
 } XLogCtlInsert;
 
 /*
@@ -213,8 +216,8 @@ typedef struct XLogCtlInsert
  */
 typedef struct XLogCtlWrite
 {
-	XLogwrtResult	LogwrtResult;	/* current value of LogwrtResult */
-	uint16			curridx;		/* cache index of next block to write */
+	XLogwrtResult LogwrtResult; /* current value of LogwrtResult */
+	uint16		curridx;		/* cache index of next block to write */
 } XLogCtlWrite;
 
 /*
@@ -223,30 +226,31 @@ typedef struct XLogCtlWrite
 typedef struct XLogCtlData
 {
 	/* Protected by insert_lck: */
-	XLogCtlInsert	Insert;
+	XLogCtlInsert Insert;
 	/* Protected by info_lck: */
-	XLogwrtRqst		LogwrtRqst;
-	XLogwrtResult	LogwrtResult;
+	XLogwrtRqst LogwrtRqst;
+	XLogwrtResult LogwrtResult;
 	/* Protected by logwrt_lck: */
-	XLogCtlWrite	Write;
+	XLogCtlWrite Write;
+
 	/*
 	 * These values do not change after startup, although the pointed-to
-	 * pages and xlblocks values certainly do.  Permission to read/write
+	 * pages and xlblocks values certainly do.	Permission to read/write
 	 * the pages and xlblocks values depends on insert_lck and logwrt_lck.
 	 */
-	char		   *pages;			/* buffers for unwritten XLOG pages */
-	XLogRecPtr	   *xlblocks;		/* 1st byte ptr-s + BLCKSZ */
-	uint32			XLogCacheByte;	/* # bytes in xlog buffers */
-	uint32			XLogCacheBlck;	/* highest allocated xlog buffer index */
-	StartUpID		ThisStartUpID;
+	char	   *pages;			/* buffers for unwritten XLOG pages */
+	XLogRecPtr *xlblocks;		/* 1st byte ptr-s + BLCKSZ */
+	uint32		XLogCacheByte;	/* # bytes in xlog buffers */
+	uint32		XLogCacheBlck;	/* highest allocated xlog buffer index */
+	StartUpID	ThisStartUpID;
 
 	/* This value is not protected by *any* spinlock... */
-	XLogRecPtr		RedoRecPtr;		/* see SetRedoRecPtr/GetRedoRecPtr */
+	XLogRecPtr	RedoRecPtr;		/* see SetRedoRecPtr/GetRedoRecPtr */
 
-	slock_t			insert_lck;		/* XLogInsert lock */
-	slock_t			info_lck;		/* locks shared LogwrtRqst/LogwrtResult */
-	slock_t			logwrt_lck;		/* XLogWrite/XLogFlush lock */
-	slock_t			chkp_lck;		/* checkpoint lock */
+	slock_t		insert_lck;		/* XLogInsert lock */
+	slock_t		info_lck;		/* locks shared LogwrtRqst/LogwrtResult */
+	slock_t		logwrt_lck;		/* XLogWrite/XLogFlush lock */
+	slock_t		chkp_lck;		/* checkpoint lock */
 } XLogCtlData;
 
 static XLogCtlData *XLogCtl = NULL;
@@ -271,7 +275,7 @@ static ControlFileData *ControlFile = NULL;
 	( \
 	  (recptr).xlogid = XLogCtl->xlblocks[curridx].xlogid, \
 	  (recptr).xrecoff = \
-	  	XLogCtl->xlblocks[curridx].xrecoff - INSERT_FREESPACE(Insert) \
+		XLogCtl->xlblocks[curridx].xrecoff - INSERT_FREESPACE(Insert) \
 	)
 
 
@@ -303,7 +307,7 @@ static ControlFileData *ControlFile = NULL;
  * Compute ID and segment from an XLogRecPtr.
  *
  * For XLByteToSeg, do the computation at face value.  For XLByteToPrevSeg,
- * a boundary byte is taken to be in the previous segment.  This is suitable
+ * a boundary byte is taken to be in the previous segment.	This is suitable
  * for deciding which segment to write given a pointer to a record end,
  * for example.
  */
@@ -354,8 +358,8 @@ static ControlFileData *ControlFile = NULL;
 
 
 /* File path names */
-static char		XLogDir[MAXPGPATH];
-static char		ControlFilePath[MAXPGPATH];
+static char XLogDir[MAXPGPATH];
+static char ControlFilePath[MAXPGPATH];
 
 /*
  * Private, possibly out-of-date copy of shared LogwrtResult.
@@ -384,8 +388,10 @@ static int	readFile = -1;
 static uint32 readId = 0;
 static uint32 readSeg = 0;
 static uint32 readOff = 0;
+
 /* Buffer for currently read page (BLCKSZ bytes) */
 static char *readBuf = NULL;
+
 /* State information for XLOG reading */
 static XLogRecPtr ReadRecPtr;
 static XLogRecPtr EndRecPtr;
@@ -397,16 +403,16 @@ static bool InRedo = false;
 
 static bool AdvanceXLInsertBuffer(void);
 static void XLogWrite(XLogwrtRqst WriteRqst);
-static int	XLogFileInit(uint32 log, uint32 seg,
-						 bool *use_existent, bool use_lock);
+static int XLogFileInit(uint32 log, uint32 seg,
+			 bool *use_existent, bool use_lock);
 static int	XLogFileOpen(uint32 log, uint32 seg, bool econt);
 static void PreallocXlogFiles(XLogRecPtr endptr);
 static void MoveOfflineLogs(uint32 log, uint32 seg);
 static XLogRecord *ReadRecord(XLogRecPtr *RecPtr, int emode, char *buffer);
 static bool ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI);
 static XLogRecord *ReadCheckpointRecord(XLogRecPtr RecPtr,
-										const char *whichChkpt,
-										char *buffer);
+					 const char *whichChkpt,
+					 char *buffer);
 static void WriteControlFile(void);
 static void ReadControlFile(void);
 static char *str_time(time_t tnow);
@@ -432,44 +438,44 @@ static void issue_xlog_fsync(void);
 XLogRecPtr
 XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata)
 {
-	XLogCtlInsert  *Insert = &XLogCtl->Insert;
-	XLogRecord	   *record;
+	XLogCtlInsert *Insert = &XLogCtl->Insert;
+	XLogRecord *record;
 	XLogContRecord *contrecord;
-	XLogRecPtr		RecPtr;
-	XLogRecPtr		WriteRqst;
-	uint32			freespace;
-	uint16			curridx;
-	XLogRecData	   *rdt;
-	Buffer			dtbuf[XLR_MAX_BKP_BLOCKS];
-	bool			dtbuf_bkp[XLR_MAX_BKP_BLOCKS];
-	BkpBlock		dtbuf_xlg[XLR_MAX_BKP_BLOCKS];
-	XLogRecPtr		dtbuf_lsn[XLR_MAX_BKP_BLOCKS];
-	XLogRecData		dtbuf_rdt[2 * XLR_MAX_BKP_BLOCKS];
-	crc64			rdata_crc;
-	uint32			len,
-					write_len;
-	unsigned		i;
-	bool			do_logwrt;
-	bool			updrqst;
-	bool			no_tran = (rmid == RM_XLOG_ID) ? true : false;
+	XLogRecPtr	RecPtr;
+	XLogRecPtr	WriteRqst;
+	uint32		freespace;
+	uint16		curridx;
+	XLogRecData *rdt;
+	Buffer		dtbuf[XLR_MAX_BKP_BLOCKS];
+	bool		dtbuf_bkp[XLR_MAX_BKP_BLOCKS];
+	BkpBlock	dtbuf_xlg[XLR_MAX_BKP_BLOCKS];
+	XLogRecPtr	dtbuf_lsn[XLR_MAX_BKP_BLOCKS];
+	XLogRecData dtbuf_rdt[2 * XLR_MAX_BKP_BLOCKS];
+	crc64		rdata_crc;
+	uint32		len,
+				write_len;
+	unsigned	i;
+	bool		do_logwrt;
+	bool		updrqst;
+	bool		no_tran = (rmid == RM_XLOG_ID) ? true : false;
 
 	if (info & XLR_INFO_MASK)
 	{
 		if ((info & XLR_INFO_MASK) != XLOG_NO_TRAN)
-			elog(STOP, "XLogInsert: invalid info mask %02X", 
+			elog(STOP, "XLogInsert: invalid info mask %02X",
 				 (info & XLR_INFO_MASK));
 		no_tran = true;
 		info &= ~XLR_INFO_MASK;
 	}
 
 	/*
-	 * In bootstrap mode, we don't actually log anything but XLOG resources;
-	 * return a phony record pointer.
+	 * In bootstrap mode, we don't actually log anything but XLOG
+	 * resources; return a phony record pointer.
 	 */
 	if (IsBootstrapProcessingMode() && rmid != RM_XLOG_ID)
 	{
 		RecPtr.xlogid = 0;
-		RecPtr.xrecoff = SizeOfXLogPHD;	/* start of 1st checkpoint record */
+		RecPtr.xrecoff = SizeOfXLogPHD; /* start of 1st checkpoint record */
 		return (RecPtr);
 	}
 
@@ -479,16 +485,17 @@ XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata)
 	 * header isn't added into the CRC yet since we don't know the final
 	 * length or info bits quite yet.
 	 *
-	 * We may have to loop back to here if a race condition is detected below.
-	 * We could prevent the race by doing all this work while holding the
-	 * insert spinlock, but it seems better to avoid doing CRC calculations
-	 * while holding the lock.  This means we have to be careful about
-	 * modifying the rdata list until we know we aren't going to loop back
-	 * again.  The only change we allow ourselves to make earlier is to set
-	 * rdt->data = NULL in list items we have decided we will have to back
-	 * up the whole buffer for.  This is OK because we will certainly decide
-	 * the same thing again for those items if we do it over; doing it here
-	 * saves an extra pass over the list later.
+	 * We may have to loop back to here if a race condition is detected
+	 * below. We could prevent the race by doing all this work while
+	 * holding the insert spinlock, but it seems better to avoid doing CRC
+	 * calculations while holding the lock.  This means we have to be
+	 * careful about modifying the rdata list until we know we aren't
+	 * going to loop back again.  The only change we allow ourselves to
+	 * make earlier is to set rdt->data = NULL in list items we have
+	 * decided we will have to back up the whole buffer for.  This is OK
+	 * because we will certainly decide the same thing again for those
+	 * items if we do it over; doing it here saves an extra pass over the
+	 * list later.
 	 */
 begin:;
 	for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
@@ -499,7 +506,7 @@ begin:;
 
 	INIT_CRC64(rdata_crc);
 	len = 0;
-	for (rdt = rdata; ; )
+	for (rdt = rdata;;)
 	{
 		if (rdt->buffer == InvalidBuffer)
 		{
@@ -528,13 +535,14 @@ begin:;
 				{
 					/* OK, put it in this slot */
 					dtbuf[i] = rdt->buffer;
+
 					/*
 					 * XXX We assume page LSN is first data on page
 					 */
-					dtbuf_lsn[i] = *((XLogRecPtr*)BufferGetBlock(rdt->buffer));
+					dtbuf_lsn[i] = *((XLogRecPtr *) BufferGetBlock(rdt->buffer));
 					if (XLByteLE(dtbuf_lsn[i], RedoRecPtr))
 					{
-						crc64	dtcrc;
+						crc64		dtcrc;
 
 						dtbuf_bkp[i] = true;
 						rdt->data = NULL;
@@ -545,7 +553,7 @@ begin:;
 						dtbuf_xlg[i].node = BufferGetFileNode(dtbuf[i]);
 						dtbuf_xlg[i].block = BufferGetBlockNumber(dtbuf[i]);
 						COMP_CRC64(dtcrc,
-								   (char*) &(dtbuf_xlg[i]) + sizeof(crc64),
+								(char *) &(dtbuf_xlg[i]) + sizeof(crc64),
 								   sizeof(BkpBlock) - sizeof(crc64));
 						FIN_CRC64(dtcrc);
 						dtbuf_xlg[i].crc = dtcrc;
@@ -571,7 +579,7 @@ begin:;
 	/*
 	 * NOTE: the test for len == 0 here is somewhat fishy, since in theory
 	 * all of the rmgr data might have been suppressed in favor of backup
-	 * blocks.  Currently, all callers of XLogInsert provide at least some
+	 * blocks.	Currently, all callers of XLogInsert provide at least some
 	 * not-in-a-buffer data and so len == 0 should never happen, but that
 	 * may not be true forever.  If you need to remove the len == 0 check,
 	 * also remove the check for xl_len == 0 in ReadRecord, below.
@@ -589,16 +597,16 @@ begin:;
 		/* try to update LogwrtResult while waiting for insert lock */
 		if (!TAS(&(XLogCtl->info_lck)))
 		{
-			XLogwrtRqst	LogwrtRqst;
+			XLogwrtRqst LogwrtRqst;
 
 			LogwrtRqst = XLogCtl->LogwrtRqst;
 			LogwrtResult = XLogCtl->LogwrtResult;
 			S_UNLOCK(&(XLogCtl->info_lck));
 
 			/*
-			 * If cache is half filled then try to acquire logwrt lock
-			 * and do LOGWRT work, but only once per XLogInsert call.
-			 * Ignore any fractional blocks in performing this check.
+			 * If cache is half filled then try to acquire logwrt lock and
+			 * do LOGWRT work, but only once per XLogInsert call. Ignore
+			 * any fractional blocks in performing this check.
 			 */
 			LogwrtRqst.Write.xrecoff -= LogwrtRqst.Write.xrecoff % BLCKSZ;
 			if (do_logwrt &&
@@ -625,8 +633,9 @@ begin:;
 
 	/*
 	 * Check to see if my RedoRecPtr is out of date.  If so, may have to
-	 * go back and recompute everything.  This can only happen just after a
-	 * checkpoint, so it's better to be slow in this case and fast otherwise.
+	 * go back and recompute everything.  This can only happen just after
+	 * a checkpoint, so it's better to be slow in this case and fast
+	 * otherwise.
 	 */
 	if (!XLByteEQ(RedoRecPtr, Insert->RedoRecPtr))
 	{
@@ -640,9 +649,10 @@ begin:;
 			if (dtbuf_bkp[i] == false &&
 				XLByteLE(dtbuf_lsn[i], RedoRecPtr))
 			{
+
 				/*
-				 * Oops, this buffer now needs to be backed up, but we didn't
-				 * think so above.  Start over.
+				 * Oops, this buffer now needs to be backed up, but we
+				 * didn't think so above.  Start over.
 				 */
 				S_UNLOCK(&(XLogCtl->insert_lck));
 				END_CRIT_SECTION();
@@ -658,8 +668,9 @@ begin:;
 	 * this loop, write_len includes the backup block data.
 	 *
 	 * Also set the appropriate info bits to show which buffers were backed
-	 * up.  The i'th XLR_SET_BKP_BLOCK bit corresponds to the i'th distinct
-	 * buffer value (ignoring InvalidBuffer) appearing in the rdata list.
+	 * up.	The i'th XLR_SET_BKP_BLOCK bit corresponds to the i'th
+	 * distinct buffer value (ignoring InvalidBuffer) appearing in the
+	 * rdata list.
 	 */
 	write_len = len;
 	for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
@@ -671,13 +682,13 @@ begin:;
 
 		rdt->next = &(dtbuf_rdt[2 * i]);
 
-		dtbuf_rdt[2 * i].data = (char*) &(dtbuf_xlg[i]);
+		dtbuf_rdt[2 * i].data = (char *) &(dtbuf_xlg[i]);
 		dtbuf_rdt[2 * i].len = sizeof(BkpBlock);
 		write_len += sizeof(BkpBlock);
 
 		rdt = dtbuf_rdt[2 * i].next = &(dtbuf_rdt[2 * i + 1]);
 
-		dtbuf_rdt[2 * i + 1].data = (char*) BufferGetBlock(dtbuf[i]);
+		dtbuf_rdt[2 * i + 1].data = (char *) BufferGetBlock(dtbuf[i]);
 		dtbuf_rdt[2 * i + 1].len = BLCKSZ;
 		write_len += BLCKSZ;
 		dtbuf_rdt[2 * i + 1].next = NULL;
@@ -711,7 +722,7 @@ begin:;
 	record->xl_rmid = rmid;
 
 	/* Now we can finish computing the main CRC */
-	COMP_CRC64(rdata_crc, (char*) record + sizeof(crc64),
+	COMP_CRC64(rdata_crc, (char *) record + sizeof(crc64),
 			   SizeOfXLogRecord - sizeof(crc64));
 	FIN_CRC64(rdata_crc);
 	record->xl_crc = rdata_crc;
@@ -729,7 +740,7 @@ begin:;
 
 	if (XLOG_DEBUG)
 	{
-		char	buf[8192];
+		char		buf[8192];
 
 		sprintf(buf, "INSERT @ %u/%u: ", RecPtr.xlogid, RecPtr.xrecoff);
 		xlog_outrec(buf, record);
@@ -791,18 +802,19 @@ begin:;
 
 	/* Ensure next record will be properly aligned */
 	Insert->currpos = (char *) Insert->currpage +
-			MAXALIGN(Insert->currpos - (char *) Insert->currpage);
+		MAXALIGN(Insert->currpos - (char *) Insert->currpage);
 	freespace = INSERT_FREESPACE(Insert);
 
 	/*
-	 * The recptr I return is the beginning of the *next* record.
-	 * This will be stored as LSN for changed data pages...
+	 * The recptr I return is the beginning of the *next* record. This
+	 * will be stored as LSN for changed data pages...
 	 */
 	INSERT_RECPTR(RecPtr, Insert, curridx);
 
 	/* Need to update shared LogwrtRqst if some block was filled up */
 	if (freespace < SizeOfXLogRecord)
-		updrqst = true;	/* curridx is filled and available for writing out */
+		updrqst = true;			/* curridx is filled and available for
+								 * writing out */
 	else
 		curridx = PrevBufIdx(curridx);
 	WriteRqst = XLogCtl->xlblocks[curridx];
@@ -850,9 +862,9 @@ AdvanceXLInsertBuffer(void)
 		LogwrtResult = Insert->LogwrtResult;
 
 	/*
-	 * Get ending-offset of the buffer page we need to replace (this may be
-	 * zero if the buffer hasn't been used yet).  Fall through if it's already
-	 * written out.
+	 * Get ending-offset of the buffer page we need to replace (this may
+	 * be zero if the buffer hasn't been used yet).  Fall through if it's
+	 * already written out.
 	 */
 	OldPageRqstPtr = XLogCtl->xlblocks[nextidx];
 	if (!XLByteLE(OldPageRqstPtr, LogwrtResult.Write))
@@ -870,7 +882,7 @@ AdvanceXLInsertBuffer(void)
 			{
 				if (XLByteLT(XLogCtl->LogwrtRqst.Write, FinishedPageRqstPtr))
 					XLogCtl->LogwrtRqst.Write = FinishedPageRqstPtr;
-				update_needed = false; /* Did the shared-request update */
+				update_needed = false;	/* Did the shared-request update */
 				LogwrtResult = XLogCtl->LogwrtResult;
 				S_UNLOCK(&(XLogCtl->info_lck));
 
@@ -883,8 +895,8 @@ AdvanceXLInsertBuffer(void)
 			}
 
 			/*
-			 * LogwrtResult lock is busy or we know the page is still dirty.
-			 * Try to acquire logwrt lock and write full blocks.
+			 * LogwrtResult lock is busy or we know the page is still
+			 * dirty. Try to acquire logwrt lock and write full blocks.
 			 */
 			if (!TAS(&(XLogCtl->logwrt_lck)))
 			{
@@ -896,9 +908,10 @@ AdvanceXLInsertBuffer(void)
 					Insert->LogwrtResult = LogwrtResult;
 					break;
 				}
+
 				/*
-				 * Have to write buffers while holding insert lock.
-				 * This is not good, so only write as much as we absolutely
+				 * Have to write buffers while holding insert lock. This
+				 * is not good, so only write as much as we absolutely
 				 * must.
 				 */
 				WriteRqst.Write = OldPageRqstPtr;
@@ -933,14 +946,15 @@ AdvanceXLInsertBuffer(void)
 	}
 	Insert->curridx = nextidx;
 	Insert->currpage = (XLogPageHeader) (XLogCtl->pages + nextidx * BLCKSZ);
-	Insert->currpos = ((char*) Insert->currpage) + SizeOfXLogPHD;
+	Insert->currpos = ((char *) Insert->currpage) + SizeOfXLogPHD;
+
 	/*
-	 * Be sure to re-zero the buffer so that bytes beyond what we've written
-	 * will look like zeroes and not valid XLOG records...
+	 * Be sure to re-zero the buffer so that bytes beyond what we've
+	 * written will look like zeroes and not valid XLOG records...
 	 */
-	MemSet((char*) Insert->currpage, 0, BLCKSZ);
+	MemSet((char *) Insert->currpage, 0, BLCKSZ);
 	Insert->currpage->xlp_magic = XLOG_PAGE_MAGIC;
-	/* Insert->currpage->xlp_info = 0; */	/* done by memset */
+	/* Insert->currpage->xlp_info = 0; *//* done by memset */
 	Insert->currpage->xlp_sui = ThisStartUpID;
 
 	return update_needed;
@@ -959,11 +973,15 @@ XLogWrite(XLogwrtRqst WriteRqst)
 	bool		ispartialpage;
 	bool		use_existent;
 
-	/* Update local LogwrtResult (caller probably did this already, but...) */
+	/*
+	 * Update local LogwrtResult (caller probably did this already,
+	 * but...)
+	 */
 	LogwrtResult = Write->LogwrtResult;
 
 	while (XLByteLT(LogwrtResult.Write, WriteRqst.Write))
 	{
+
 		/*
 		 * Make sure we're not ahead of the insert process.  This could
 		 * happen if we're passed a bogus WriteRqst.Write that is past the
@@ -979,6 +997,7 @@ XLogWrite(XLogwrtRqst WriteRqst)
 
 		if (!XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
 		{
+
 			/*
 			 * Switch to new logfile segment.
 			 */
@@ -1011,11 +1030,12 @@ XLogWrite(XLogwrtRqst WriteRqst)
 				ControlFile->logSeg = openLogSeg + 1;
 				ControlFile->time = time(NULL);
 				UpdateControlFile();
+
 				/*
-				 * Signal postmaster to start a checkpoint if it's been too
-				 * long since the last one.  (We look at local copy of
-				 * RedoRecPtr which might be a little out of date, but should
-				 * be close enough for this purpose.)
+				 * Signal postmaster to start a checkpoint if it's been
+				 * too long since the last one.  (We look at local copy of
+				 * RedoRecPtr which might be a little out of date, but
+				 * should be close enough for this purpose.)
 				 */
 				if (IsUnderPostmaster &&
 					(openLogId != RedoRecPtr.xlogid ||
@@ -1056,14 +1076,14 @@ XLogWrite(XLogwrtRqst WriteRqst)
 		/*
 		 * If we just wrote the whole last page of a logfile segment,
 		 * fsync the segment immediately.  This avoids having to go back
-		 * and re-open prior segments when an fsync request comes along later.
-		 * Doing it here ensures that one and only one backend will perform
-		 * this fsync.
+		 * and re-open prior segments when an fsync request comes along
+		 * later. Doing it here ensures that one and only one backend will
+		 * perform this fsync.
 		 */
 		if (openLogOff >= XLogSegSize && !ispartialpage)
 		{
 			issue_xlog_fsync();
-			LogwrtResult.Flush = LogwrtResult.Write; /* end of current page */
+			LogwrtResult.Flush = LogwrtResult.Write;	/* end of current page */
 		}
 
 		if (ispartialpage)
@@ -1081,15 +1101,16 @@ XLogWrite(XLogwrtRqst WriteRqst)
 	if (XLByteLT(LogwrtResult.Flush, WriteRqst.Flush) &&
 		XLByteLT(LogwrtResult.Flush, LogwrtResult.Write))
 	{
+
 		/*
-		 * Could get here without iterating above loop, in which case
-		 * we might have no open file or the wrong one.  However, we do
-		 * not need to fsync more than one file.
+		 * Could get here without iterating above loop, in which case we
+		 * might have no open file or the wrong one.  However, we do not
+		 * need to fsync more than one file.
 		 */
 		if (sync_method != SYNC_METHOD_OPEN)
 		{
 			if (openLogFile >= 0 &&
-				!XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
+			 !XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
 			{
 				if (close(openLogFile) != 0)
 					elog(STOP, "close(logfile %u seg %u) failed: %m",
@@ -1110,8 +1131,8 @@ XLogWrite(XLogwrtRqst WriteRqst)
 	/*
 	 * Update shared-memory status
 	 *
-	 * We make sure that the shared 'request' values do not fall behind
-	 * the 'result' values.  This is not absolutely essential, but it saves
+	 * We make sure that the shared 'request' values do not fall behind the
+	 * 'result' values.  This is not absolutely essential, but it saves
 	 * some code in a couple of places.
 	 */
 	S_LOCK(&(XLogCtl->info_lck));
@@ -1163,8 +1184,9 @@ XLogFlush(XLogRecPtr record)
 	 * Since fsync is usually a horribly expensive operation, we try to
 	 * piggyback as much data as we can on each fsync: if we see any more
 	 * data entered into the xlog buffer, we'll write and fsync that too,
-	 * so that the final value of LogwrtResult.Flush is as large as possible.
-	 * This gives us some chance of avoiding another fsync immediately after.
+	 * so that the final value of LogwrtResult.Flush is as large as
+	 * possible. This gives us some chance of avoiding another fsync
+	 * immediately after.
 	 */
 
 	/* initialize to given target; may increase below */
@@ -1192,9 +1214,7 @@ XLogFlush(XLogRecPtr record)
 			uint32		freespace = INSERT_FREESPACE(Insert);
 
 			if (freespace < SizeOfXLogRecord)	/* buffer is full */
-			{
 				WriteRqstPtr = XLogCtl->xlblocks[Insert->curridx];
-			}
 			else
 			{
 				WriteRqstPtr = XLogCtl->xlblocks[Insert->curridx];
@@ -1232,7 +1252,7 @@ XLogFlush(XLogRecPtr record)
  * log, seg: identify segment to be created/opened.
  *
  * *use_existent: if TRUE, OK to use a pre-existing file (else, any
- * pre-existing file will be deleted).  On return, TRUE if a pre-existing
+ * pre-existing file will be deleted).	On return, TRUE if a pre-existing
  * file was used.
  *
  * use_lock: if TRUE, acquire ControlFileLock spinlock while moving file into
@@ -1257,7 +1277,8 @@ XLogFileInit(uint32 log, uint32 seg,
 	XLogFileName(path, log, seg);
 
 	/*
-	 * Try to use existent file (checkpoint maker may have created it already)
+	 * Try to use existent file (checkpoint maker may have created it
+	 * already)
 	 */
 	if (*use_existent)
 	{
@@ -1270,14 +1291,14 @@ XLogFileInit(uint32 log, uint32 seg,
 					 log, seg);
 		}
 		else
-			return(fd);
+			return (fd);
 	}
 
 	/*
-	 * Initialize an empty (all zeroes) segment.  NOTE: it is possible that
-	 * another process is doing the same thing.  If so, we will end up
-	 * pre-creating an extra log segment.  That seems OK, and better than
-	 * holding the spinlock throughout this lengthy process.
+	 * Initialize an empty (all zeroes) segment.  NOTE: it is possible
+	 * that another process is doing the same thing.  If so, we will end
+	 * up pre-creating an extra log segment.  That seems OK, and better
+	 * than holding the spinlock throughout this lengthy process.
 	 */
 	snprintf(tmppath, MAXPGPATH, "%s%cxlogtemp.%d",
 			 XLogDir, SEP_CHAR, (int) getpid());
@@ -1291,10 +1312,10 @@ XLogFileInit(uint32 log, uint32 seg,
 		elog(STOP, "InitCreate(%s) failed: %m", tmppath);
 
 	/*
-	 * Zero-fill the file.  We have to do this the hard way to ensure that
+	 * Zero-fill the file.	We have to do this the hard way to ensure that
 	 * all the file space has really been allocated --- on platforms that
 	 * allow "holes" in files, just seeking to the end doesn't allocate
-	 * intermediate space.  This way, we know that we have all the space
+	 * intermediate space.	This way, we know that we have all the space
 	 * and (after the fsync below) that all the indirect blocks are down
 	 * on disk.  Therefore, fdatasync(2) or O_DSYNC will be sufficient to
 	 * sync future writes to the log file.
@@ -1304,9 +1325,12 @@ XLogFileInit(uint32 log, uint32 seg,
 	{
 		if ((int) write(fd, zbuffer, sizeof(zbuffer)) != (int) sizeof(zbuffer))
 		{
-			int		save_errno = errno;
+			int			save_errno = errno;
 
-			/* If we fail to make the file, delete it to release disk space */
+			/*
+			 * If we fail to make the file, delete it to release disk
+			 * space
+			 */
 			unlink(tmppath);
 			errno = save_errno;
 
@@ -1336,10 +1360,8 @@ XLogFileInit(uint32 log, uint32 seg,
 	targseg = seg;
 	strcpy(targpath, path);
 
-	if (! *use_existent)
-	{
+	if (!*use_existent)
 		unlink(targpath);
-	}
 	else
 	{
 		while ((fd = BasicOpenFile(targpath, O_RDWR | PG_BINARY,
@@ -1451,10 +1473,10 @@ PreallocXlogFiles(XLogRecPtr endptr)
 static void
 MoveOfflineLogs(uint32 log, uint32 seg)
 {
-	DIR			   *xldir;
-	struct dirent  *xlde;
-	char			lastoff[32];
-	char			path[MAXPGPATH];
+	DIR		   *xldir;
+	struct dirent *xlde;
+	char		lastoff[32];
+	char		path[MAXPGPATH];
 
 	Assert(XLOG_archive_dir[0] == 0);	/* ! implemented yet */
 
@@ -1471,9 +1493,9 @@ MoveOfflineLogs(uint32 log, uint32 seg)
 			strspn(xlde->d_name, "0123456789ABCDEF") == 16 &&
 			strcmp(xlde->d_name, lastoff) <= 0)
 		{
-			elog(LOG, "MoveOfflineLogs: %s %s", (XLOG_archive_dir[0]) ? 
+			elog(LOG, "MoveOfflineLogs: %s %s", (XLOG_archive_dir[0]) ?
 				 "archive" : "remove", xlde->d_name);
-			sprintf(path, "%s%c%s",	XLogDir, SEP_CHAR, xlde->d_name);
+			sprintf(path, "%s%c%s", XLogDir, SEP_CHAR, xlde->d_name);
 			if (XLOG_archive_dir[0] == 0)
 				unlink(path);
 		}
@@ -1499,13 +1521,13 @@ RestoreBkpBlocks(XLogRecord *record, XLogRecPtr lsn)
 	char	   *blk;
 	int			i;
 
-	blk = (char*)XLogRecGetData(record) + record->xl_len;
+	blk = (char *) XLogRecGetData(record) + record->xl_len;
 	for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
 	{
 		if (!(record->xl_info & XLR_SET_BKP_BLOCK(i)))
 			continue;
 
-		memcpy((char*)&bkpb, blk, sizeof(BkpBlock));
+		memcpy((char *) &bkpb, blk, sizeof(BkpBlock));
 		blk += sizeof(BkpBlock);
 
 		reln = XLogOpenRelation(true, record->xl_rmid, bkpb.node);
@@ -1516,7 +1538,7 @@ RestoreBkpBlocks(XLogRecord *record, XLogRecPtr lsn)
 			if (BufferIsValid(buffer))
 			{
 				page = (Page) BufferGetPage(buffer);
-				memcpy((char*)page, blk, BLCKSZ);
+				memcpy((char *) page, blk, BLCKSZ);
 				PageSetLSN(page, lsn);
 				PageSetSUI(page, ThisStartUpID);
 				UnlockAndWriteBuffer(buffer);
@@ -1546,7 +1568,7 @@ RecordIsValid(XLogRecord *record, XLogRecPtr recptr, int emode)
 	/* Check CRC of rmgr data and record header */
 	INIT_CRC64(crc);
 	COMP_CRC64(crc, XLogRecGetData(record), len);
-	COMP_CRC64(crc, (char*) record + sizeof(crc64),
+	COMP_CRC64(crc, (char *) record + sizeof(crc64),
 			   SizeOfXLogRecord - sizeof(crc64));
 	FIN_CRC64(crc);
 
@@ -1554,11 +1576,11 @@ RecordIsValid(XLogRecord *record, XLogRecPtr recptr, int emode)
 	{
 		elog(emode, "ReadRecord: bad rmgr data CRC in record at %u/%u",
 			 recptr.xlogid, recptr.xrecoff);
-		return(false);
+		return (false);
 	}
 
 	/* Check CRCs of backup blocks, if any */
-	blk = (char*)XLogRecGetData(record) + len;
+	blk = (char *) XLogRecGetData(record) + len;
 	for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
 	{
 		if (!(record->xl_info & XLR_SET_BKP_BLOCK(i)))
@@ -1569,18 +1591,19 @@ RecordIsValid(XLogRecord *record, XLogRecPtr recptr, int emode)
 		COMP_CRC64(crc, blk + sizeof(crc64),
 				   sizeof(BkpBlock) - sizeof(crc64));
 		FIN_CRC64(crc);
-		memcpy((char*)&cbuf, blk, sizeof(crc64)); /* don't assume alignment */
+		memcpy((char *) &cbuf, blk, sizeof(crc64));		/* don't assume
+														 * alignment */
 
 		if (!EQ_CRC64(cbuf, crc))
 		{
 			elog(emode, "ReadRecord: bad bkp block %d CRC in record at %u/%u",
 				 i + 1, recptr.xlogid, recptr.xrecoff);
-			return(false);
+			return (false);
 		}
 		blk += sizeof(BkpBlock) + BLCKSZ;
 	}
 
-	return(true);
+	return (true);
 }
 
 /*
@@ -1609,13 +1632,14 @@ ReadRecord(XLogRecPtr *RecPtr, int emode, char *buffer)
 
 	if (readBuf == NULL)
 	{
+
 		/*
 		 * First time through, permanently allocate readBuf.  We do it
 		 * this way, rather than just making a static array, for two
-		 * reasons: (1) no need to waste the storage in most instantiations
-		 * of the backend; (2) a static char array isn't guaranteed to
-		 * have any particular alignment, whereas malloc() will provide
-		 * MAXALIGN'd storage.
+		 * reasons: (1) no need to waste the storage in most
+		 * instantiations of the backend; (2) a static char array isn't
+		 * guaranteed to have any particular alignment, whereas malloc()
+		 * will provide MAXALIGN'd storage.
 		 */
 		readBuf = (char *) malloc(BLCKSZ);
 		Assert(readBuf != NULL);
@@ -1656,7 +1680,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode, char *buffer)
 		readFile = XLogFileOpen(readId, readSeg, (emode == LOG));
 		if (readFile < 0)
 			goto next_record_is_invalid;
-		readOff = (uint32) (-1); /* force read to occur below */
+		readOff = (uint32) (-1);/* force read to occur below */
 	}
 
 	targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / BLCKSZ) * BLCKSZ;
@@ -1688,9 +1712,10 @@ ReadRecord(XLogRecPtr *RecPtr, int emode, char *buffer)
 	record = (XLogRecord *) ((char *) readBuf + RecPtr->xrecoff % BLCKSZ);
 
 got_record:;
+
 	/*
-	 * Currently, xl_len == 0 must be bad data, but that might not be
-	 * true forever.  See note in XLogInsert.
+	 * Currently, xl_len == 0 must be bad data, but that might not be true
+	 * forever.  See note in XLogInsert.
 	 */
 	if (record->xl_len == 0)
 	{
@@ -1698,8 +1723,10 @@ got_record:;
 			 RecPtr->xlogid, RecPtr->xrecoff);
 		goto next_record_is_invalid;
 	}
+
 	/*
-	 * Compute total length of record including any appended backup blocks.
+	 * Compute total length of record including any appended backup
+	 * blocks.
 	 */
 	total_len = SizeOfXLogRecord + record->xl_len;
 	for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
@@ -1708,6 +1735,7 @@ got_record:;
 			continue;
 		total_len += sizeof(BkpBlock) + BLCKSZ;
 	}
+
 	/*
 	 * Make sure it will fit in buffer (currently, it is mechanically
 	 * impossible for this test to fail, but it seems like a good idea
@@ -1731,7 +1759,7 @@ got_record:;
 	{
 		/* Need to reassemble record */
 		XLogContRecord *contrecord;
-		uint32			gotlen = len;
+		uint32		gotlen = len;
 
 		memcpy(buffer, record, len);
 		record = (XLogRecord *) buffer;
@@ -1764,7 +1792,7 @@ got_record:;
 				goto next_record_is_invalid;
 			}
 			contrecord = (XLogContRecord *) ((char *) readBuf + SizeOfXLogPHD);
-			if (contrecord->xl_rem_len == 0 || 
+			if (contrecord->xl_rem_len == 0 ||
 				total_len != (contrecord->xl_rem_len + gotlen))
 			{
 				elog(emode, "ReadRecord: invalid cont-record len %u in logfile %u seg %u off %u",
@@ -1774,7 +1802,7 @@ got_record:;
 			len = BLCKSZ - SizeOfXLogPHD - SizeOfXLogContRecord;
 			if (contrecord->xl_rem_len > len)
 			{
-				memcpy(buffer, (char *)contrecord + SizeOfXLogContRecord, len);
+				memcpy(buffer, (char *) contrecord + SizeOfXLogContRecord, len);
 				gotlen += len;
 				buffer += len;
 				continue;
@@ -1788,12 +1816,12 @@ got_record:;
 		if (BLCKSZ - SizeOfXLogRecord >= SizeOfXLogPHD +
 			SizeOfXLogContRecord + MAXALIGN(contrecord->xl_rem_len))
 		{
-			nextRecord = (XLogRecord *) ((char *) contrecord + 
+			nextRecord = (XLogRecord *) ((char *) contrecord +
 				SizeOfXLogContRecord + MAXALIGN(contrecord->xl_rem_len));
 		}
 		EndRecPtr.xlogid = readId;
 		EndRecPtr.xrecoff = readSeg * XLogSegSize + readOff +
-			SizeOfXLogPHD + SizeOfXLogContRecord + 
+			SizeOfXLogPHD + SizeOfXLogContRecord +
 			MAXALIGN(contrecord->xl_rem_len);
 		ReadRecPtr = *RecPtr;
 		return record;
@@ -1822,7 +1850,7 @@ next_record_is_invalid:;
  * Check whether the xlog header of a page just read in looks valid.
  *
  * This is just a convenience subroutine to avoid duplicated code in
- * ReadRecord.  It's not intended for use from anywhere else.
+ * ReadRecord.	It's not intended for use from anywhere else.
  */
 static bool
 ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
@@ -1839,14 +1867,16 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
 			 hdr->xlp_info, readId, readSeg, readOff);
 		return false;
 	}
+
 	/*
-	 * We disbelieve a SUI less than the previous page's SUI, or more
-	 * than a few counts greater.  In theory as many as 512 shutdown
-	 * checkpoint records could appear on a 32K-sized xlog page, so
-	 * that's the most differential there could legitimately be.
+	 * We disbelieve a SUI less than the previous page's SUI, or more than
+	 * a few counts greater.  In theory as many as 512 shutdown checkpoint
+	 * records could appear on a 32K-sized xlog page, so that's the most
+	 * differential there could legitimately be.
 	 *
 	 * Note this check can only be applied when we are reading the next page
-	 * in sequence, so ReadRecord passes a flag indicating whether to check.
+	 * in sequence, so ReadRecord passes a flag indicating whether to
+	 * check.
 	 */
 	if (checkSUI)
 	{
@@ -1866,7 +1896,7 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
  * I/O routines for pg_control
  *
  * *ControlFile is a buffer in shared memory that holds an image of the
- * contents of pg_control.  WriteControlFile() initializes pg_control
+ * contents of pg_control.	WriteControlFile() initializes pg_control
  * given a preloaded buffer, ReadControlFile() loads the buffer from
  * the pg_control file (during postmaster or standalone-backend startup),
  * and UpdateControlFile() rewrites pg_control after we modify xlog state.
@@ -1890,9 +1920,11 @@ static void
 WriteControlFile(void)
 {
 	int			fd;
-	char		buffer[BLCKSZ];	/* need not be aligned */
+	char		buffer[BLCKSZ]; /* need not be aligned */
+
 #ifdef USE_LOCALE
 	char	   *localeptr;
+
 #endif
 
 	/*
@@ -1911,16 +1943,17 @@ WriteControlFile(void)
 	if (!localeptr)
 		elog(STOP, "Invalid LC_CTYPE setting");
 	StrNCpy(ControlFile->lc_ctype, localeptr, LOCALE_NAME_BUFLEN);
+
 	/*
 	 * Issue warning notice if initdb'ing in a locale that will not permit
-	 * LIKE index optimization.  This is not a clean place to do it, but
-	 * I don't see a better place either...
+	 * LIKE index optimization.  This is not a clean place to do it, but I
+	 * don't see a better place either...
 	 */
 	if (!locale_is_like_safe())
 		elog(NOTICE, "Initializing database with %s collation order."
 			 "\n\tThis locale setting will prevent use of index optimization for"
 			 "\n\tLIKE and regexp searches.  If you are concerned about speed of"
-			 "\n\tsuch queries, you may wish to set LC_COLLATE to \"C\" and"
+		  "\n\tsuch queries, you may wish to set LC_COLLATE to \"C\" and"
 			 "\n\tre-initdb.  For more information see the Administrator's Guide.",
 			 ControlFile->lc_collate);
 #else
@@ -1930,17 +1963,17 @@ WriteControlFile(void)
 
 	/* Contents are protected with a CRC */
 	INIT_CRC64(ControlFile->crc);
-	COMP_CRC64(ControlFile->crc, 
-			   (char*) ControlFile + sizeof(crc64),
+	COMP_CRC64(ControlFile->crc,
+			   (char *) ControlFile + sizeof(crc64),
 			   sizeof(ControlFileData) - sizeof(crc64));
 	FIN_CRC64(ControlFile->crc);
 
 	/*
-	 * We write out BLCKSZ bytes into pg_control, zero-padding the
-	 * excess over sizeof(ControlFileData).  This reduces the odds
-	 * of premature-EOF errors when reading pg_control.  We'll still
-	 * fail when we check the contents of the file, but hopefully with
-	 * a more specific error than "couldn't read pg_control".
+	 * We write out BLCKSZ bytes into pg_control, zero-padding the excess
+	 * over sizeof(ControlFileData).  This reduces the odds of
+	 * premature-EOF errors when reading pg_control.  We'll still fail
+	 * when we check the contents of the file, but hopefully with a more
+	 * specific error than "couldn't read pg_control".
 	 */
 	if (sizeof(ControlFileData) > BLCKSZ)
 		elog(STOP, "sizeof(ControlFileData) is too large ... fix xlog.c");
@@ -1993,8 +2026,8 @@ ReadControlFile(void)
 
 	/* Now check the CRC. */
 	INIT_CRC64(crc);
-	COMP_CRC64(crc, 
-			   (char*) ControlFile + sizeof(crc64),
+	COMP_CRC64(crc,
+			   (char *) ControlFile + sizeof(crc64),
 			   sizeof(ControlFileData) - sizeof(crc64));
 	FIN_CRC64(crc);
 
@@ -2002,14 +2035,15 @@ ReadControlFile(void)
 		elog(STOP, "Invalid CRC in control file");
 
 	/*
-	 * Do compatibility checking immediately.  We do this here for 2 reasons:
+	 * Do compatibility checking immediately.  We do this here for 2
+	 * reasons:
 	 *
-	 * (1) if the database isn't compatible with the backend executable,
-	 * we want to abort before we can possibly do any damage;
+	 * (1) if the database isn't compatible with the backend executable, we
+	 * want to abort before we can possibly do any damage;
 	 *
 	 * (2) this code is executed in the postmaster, so the setlocale() will
 	 * propagate to forked backends, which aren't going to read this file
-	 * for themselves.  (These locale settings are considered critical
+	 * for themselves.	(These locale settings are considered critical
 	 * compatibility items because they can affect sort order of indexes.)
 	 */
 	if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
@@ -2042,8 +2076,8 @@ UpdateControlFile(void)
 	int			fd;
 
 	INIT_CRC64(ControlFile->crc);
-	COMP_CRC64(ControlFile->crc, 
-			   (char*) ControlFile + sizeof(crc64),
+	COMP_CRC64(ControlFile->crc,
+			   (char *) ControlFile + sizeof(crc64),
 			   sizeof(ControlFileData) - sizeof(crc64));
 	FIN_CRC64(ControlFile->crc);
 
@@ -2096,6 +2130,7 @@ XLOGShmemInit(void)
 	Assert(!found);
 
 	memset(XLogCtl, 0, sizeof(XLogCtlData));
+
 	/*
 	 * Since XLogCtlData contains XLogRecPtr fields, its sizeof should be
 	 * a multiple of the alignment for same, so no extra alignment padding
@@ -2104,9 +2139,10 @@ XLOGShmemInit(void)
 	XLogCtl->xlblocks = (XLogRecPtr *)
 		(((char *) XLogCtl) + sizeof(XLogCtlData));
 	memset(XLogCtl->xlblocks, 0, sizeof(XLogRecPtr) * XLOGbuffers);
+
 	/*
-	 * Here, on the other hand, we must MAXALIGN to ensure the page buffers
-	 * have worst-case alignment.
+	 * Here, on the other hand, we must MAXALIGN to ensure the page
+	 * buffers have worst-case alignment.
 	 */
 	XLogCtl->pages =
 		((char *) XLogCtl) + MAXALIGN(sizeof(XLogCtlData) +
@@ -2114,8 +2150,8 @@ XLOGShmemInit(void)
 	memset(XLogCtl->pages, 0, BLCKSZ * XLOGbuffers);
 
 	/*
-	 * Do basic initialization of XLogCtl shared data.
-	 * (StartupXLOG will fill in additional info.)
+	 * Do basic initialization of XLogCtl shared data. (StartupXLOG will
+	 * fill in additional info.)
 	 */
 	XLogCtl->XLogCacheByte = BLCKSZ * XLOGbuffers;
 	XLogCtl->XLogCacheBlck = XLOGbuffers - 1;
@@ -2145,7 +2181,7 @@ BootStrapXLOG(void)
 	char	   *buffer;
 	XLogPageHeader page;
 	XLogRecord *record;
-	bool        use_existent;
+	bool		use_existent;
 	crc64		crc;
 
 	/* Use malloc() to ensure buffer is MAXALIGNED */
@@ -2180,7 +2216,7 @@ BootStrapXLOG(void)
 
 	INIT_CRC64(crc);
 	COMP_CRC64(crc, &checkPoint, sizeof(checkPoint));
-	COMP_CRC64(crc, (char*) record + sizeof(crc64),
+	COMP_CRC64(crc, (char *) record + sizeof(crc64),
 			   SizeOfXLogRecord - sizeof(crc64));
 	FIN_CRC64(crc);
 	record->xl_crc = crc;
@@ -2246,8 +2282,8 @@ StartupXLOG(void)
 	/*
 	 * Read control file and check XLOG status looks valid.
 	 *
-	 * Note: in most control paths, *ControlFile is already valid and we
-	 * need not do ReadControlFile() here, but might as well do it to be sure.
+	 * Note: in most control paths, *ControlFile is already valid and we need
+	 * not do ReadControlFile() here, but might as well do it to be sure.
 	 */
 	ReadControlFile();
 
@@ -2297,9 +2333,7 @@ StartupXLOG(void)
 			InRecovery = true;	/* force recovery even if SHUTDOWNED */
 		}
 		else
-		{
 			elog(STOP, "Unable to locate a valid CheckPoint record");
-		}
 	}
 	LastRec = RecPtr = checkPointLoc;
 	memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
@@ -2320,7 +2354,7 @@ StartupXLOG(void)
 	ShmemVariableCache->oidCount = 0;
 
 	ThisStartUpID = checkPoint.ThisStartUpID;
-	RedoRecPtr = XLogCtl->Insert.RedoRecPtr = 
+	RedoRecPtr = XLogCtl->Insert.RedoRecPtr =
 		XLogCtl->RedoRecPtr = checkPoint.redo;
 
 	if (XLByteLT(RecPtr, checkPoint.redo))
@@ -2328,7 +2362,7 @@ StartupXLOG(void)
 	if (checkPoint.undo.xrecoff == 0)
 		checkPoint.undo = RecPtr;
 
-	if (XLByteLT(checkPoint.undo, RecPtr) || 
+	if (XLByteLT(checkPoint.undo, RecPtr) ||
 		XLByteLT(checkPoint.redo, RecPtr))
 	{
 		if (wasShutdown)
@@ -2336,9 +2370,7 @@ StartupXLOG(void)
 		InRecovery = true;
 	}
 	else if (ControlFile->state != DB_SHUTDOWNED)
-	{
 		InRecovery = true;
-	}
 
 	/* REDO */
 	if (InRecovery)
@@ -2355,7 +2387,8 @@ StartupXLOG(void)
 		/* Is REDO required ? */
 		if (XLByteLT(checkPoint.redo, RecPtr))
 			record = ReadRecord(&(checkPoint.redo), STOP, buffer);
-		else	/* read past CheckPoint record */
+		else
+/* read past CheckPoint record */
 			record = ReadRecord(NULL, LOG, buffer);
 
 		if (record != NULL)
@@ -2369,15 +2402,15 @@ StartupXLOG(void)
 					ShmemVariableCache->nextXid = record->xl_xid + 1;
 				if (XLOG_DEBUG)
 				{
-					char	buf[8192];
+					char		buf[8192];
 
-					sprintf(buf, "REDO @ %u/%u; LSN %u/%u: ", 
-						ReadRecPtr.xlogid, ReadRecPtr.xrecoff,
-						EndRecPtr.xlogid, EndRecPtr.xrecoff);
+					sprintf(buf, "REDO @ %u/%u; LSN %u/%u: ",
+							ReadRecPtr.xlogid, ReadRecPtr.xrecoff,
+							EndRecPtr.xlogid, EndRecPtr.xrecoff);
 					xlog_outrec(buf, record);
 					strcat(buf, " - ");
-					RmgrTable[record->xl_rmid].rm_desc(buf, 
-						record->xl_info, XLogRecGetData(record));
+					RmgrTable[record->xl_rmid].rm_desc(buf,
+								record->xl_info, XLogRecGetData(record));
 					fprintf(stderr, "%s\n", buf);
 				}
 
@@ -2411,8 +2444,11 @@ StartupXLOG(void)
 	XLogCtl->xlblocks[0].xrecoff =
 		((EndOfLog.xrecoff - 1) / BLCKSZ + 1) * BLCKSZ;
 	Insert = &XLogCtl->Insert;
-	/* Tricky point here: readBuf contains the *last* block that the LastRec
-	 * record spans, not the one it starts in, which is what we want.
+
+	/*
+	 * Tricky point here: readBuf contains the *last* block that the
+	 * LastRec record spans, not the one it starts in, which is what we
+	 * want.
 	 */
 	Assert(readOff == (XLogCtl->xlblocks[0].xrecoff - BLCKSZ) % XLogSegSize);
 	memcpy((char *) Insert->currpage, readBuf, BLCKSZ);
@@ -2458,6 +2494,7 @@ StartupXLOG(void)
 
 	if (InRecovery)
 	{
+
 		/*
 		 * In case we had to use the secondary checkpoint, make sure that
 		 * it will still be shown as the secondary checkpoint after this
@@ -2554,7 +2591,7 @@ SetThisStartUpID(void)
 
 /*
  * CheckPoint process called by postmaster saves copy of new RedoRecPtr
- * in shmem (using SetRedoRecPtr).  When checkpointer completes, postmaster
+ * in shmem (using SetRedoRecPtr).	When checkpointer completes, postmaster
  * calls GetRedoRecPtr to update its own copy of RedoRecPtr, so that
  * subsequently-spawned backends will start out with a reasonably up-to-date
  * local RedoRecPtr.  Since these operations are not protected by any spinlock
@@ -2605,7 +2642,7 @@ CreateCheckPoint(bool shutdown)
 	CheckPoint	checkPoint;
 	XLogRecPtr	recptr;
 	XLogCtlInsert *Insert = &XLogCtl->Insert;
-	XLogRecData	rdata;
+	XLogRecData rdata;
 	uint32		freespace;
 	uint32		_logId;
 	uint32		_logSeg;
@@ -2613,7 +2650,7 @@ CreateCheckPoint(bool shutdown)
 
 	if (MyLastRecPtr.xrecoff != 0)
 		elog(ERROR, "CreateCheckPoint: cannot be called inside transaction block");
- 
+
 	START_CRIT_SECTION();
 
 	/* Grab lock, using larger than normal sleep between tries (1 sec) */
@@ -2639,17 +2676,17 @@ CreateCheckPoint(bool shutdown)
 	/*
 	 * If this isn't a shutdown, and we have not inserted any XLOG records
 	 * since the start of the last checkpoint, skip the checkpoint.  The
-	 * idea here is to avoid inserting duplicate checkpoints when the system
-	 * is idle.  That wastes log space, and more importantly it exposes us to
-	 * possible loss of both current and previous checkpoint records if the
-	 * machine crashes just as we're writing the update.  (Perhaps it'd make
-	 * even more sense to checkpoint only when the previous checkpoint record
-	 * is in a different xlog page?)
+	 * idea here is to avoid inserting duplicate checkpoints when the
+	 * system is idle.	That wastes log space, and more importantly it
+	 * exposes us to possible loss of both current and previous checkpoint
+	 * records if the machine crashes just as we're writing the update.
+	 * (Perhaps it'd make even more sense to checkpoint only when the
+	 * previous checkpoint record is in a different xlog page?)
 	 *
 	 * We have to make two tests to determine that nothing has happened since
-	 * the start of the last checkpoint: current insertion point must match
-	 * the end of the last checkpoint record, and its redo pointer must point
-	 * to itself.
+	 * the start of the last checkpoint: current insertion point must
+	 * match the end of the last checkpoint record, and its redo pointer
+	 * must point to itself.
 	 */
 	if (!shutdown)
 	{
@@ -2677,7 +2714,7 @@ CreateCheckPoint(bool shutdown)
 	 * NB: this is NOT necessarily where the checkpoint record itself will
 	 * be, since other backends may insert more XLOG records while we're
 	 * off doing the buffer flush work.  Those XLOG records are logically
-	 * after the checkpoint, even though physically before it.  Got that?
+	 * after the checkpoint, even though physically before it.	Got that?
 	 */
 	freespace = INSERT_FREESPACE(Insert);
 	if (freespace < SizeOfXLogRecord)
@@ -2687,16 +2724,18 @@ CreateCheckPoint(bool shutdown)
 		freespace = BLCKSZ - SizeOfXLogPHD;
 	}
 	INSERT_RECPTR(checkPoint.redo, Insert, Insert->curridx);
+
 	/*
 	 * Here we update the shared RedoRecPtr for future XLogInsert calls;
 	 * this must be done while holding the insert lock.
 	 */
 	RedoRecPtr = XLogCtl->Insert.RedoRecPtr = checkPoint.redo;
+
 	/*
-	 * Get UNDO record ptr - this is oldest of PROC->logRec values.
-	 * We do this while holding insert lock to ensure that we won't miss
-	 * any about-to-commit transactions (UNDO must include all xacts that
-	 * have commits after REDO point).
+	 * Get UNDO record ptr - this is oldest of PROC->logRec values. We do
+	 * this while holding insert lock to ensure that we won't miss any
+	 * about-to-commit transactions (UNDO must include all xacts that have
+	 * commits after REDO point).
 	 */
 	checkPoint.undo = GetUndoRecPtr();
 
@@ -2720,8 +2759,8 @@ CreateCheckPoint(bool shutdown)
 	SpinRelease(OidGenLockId);
 
 	/*
-	 * Having constructed the checkpoint record, ensure all shmem disk buffers
-	 * are flushed to disk.
+	 * Having constructed the checkpoint record, ensure all shmem disk
+	 * buffers are flushed to disk.
 	 */
 	FlushBufferPool();
 
@@ -2729,7 +2768,7 @@ CreateCheckPoint(bool shutdown)
 	 * Now insert the checkpoint record into XLOG.
 	 */
 	rdata.buffer = InvalidBuffer;
-	rdata.data = (char *)(&checkPoint);
+	rdata.data = (char *) (&checkPoint);
 	rdata.len = sizeof(checkPoint);
 	rdata.next = NULL;
 
@@ -2748,11 +2787,11 @@ CreateCheckPoint(bool shutdown)
 		elog(STOP, "XLog concurrent activity while data base is shutting down");
 
 	/*
-	 * Remember location of prior checkpoint's earliest info.
-	 * Oldest item is redo or undo, whichever is older; but watch out
-	 * for case that undo = 0.
+	 * Remember location of prior checkpoint's earliest info. Oldest item
+	 * is redo or undo, whichever is older; but watch out for case that
+	 * undo = 0.
 	 */
-	if (ControlFile->checkPointCopy.undo.xrecoff != 0 && 
+	if (ControlFile->checkPointCopy.undo.xrecoff != 0 &&
 		XLByteLT(ControlFile->checkPointCopy.undo,
 				 ControlFile->checkPointCopy.redo))
 		XLByteToSeg(ControlFile->checkPointCopy.undo, _logId, _logSeg);
@@ -2801,10 +2840,10 @@ CreateCheckPoint(bool shutdown)
 void
 XLogPutNextOid(Oid nextOid)
 {
-	XLogRecData		rdata;
+	XLogRecData rdata;
 
 	rdata.buffer = InvalidBuffer;
-	rdata.data = (char *)(&nextOid);
+	rdata.data = (char *) (&nextOid);
 	rdata.len = sizeof(Oid);
 	rdata.next = NULL;
 	(void) XLogInsert(RM_XLOG_ID, XLOG_NEXTOID, &rdata);
@@ -2816,11 +2855,11 @@ XLogPutNextOid(Oid nextOid)
 void
 xlog_redo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8	info = record->xl_info & ~XLR_INFO_MASK;
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
 	if (info == XLOG_NEXTOID)
 	{
-		Oid		nextOid;
+		Oid			nextOid;
 
 		memcpy(&nextOid, XLogRecGetData(record), sizeof(Oid));
 		if (ShmemVariableCache->nextOid < nextOid)
@@ -2846,9 +2885,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
 		memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
 		/* In an ONLINE checkpoint, treat the counters like NEXTOID */
 		if (ShmemVariableCache->nextXid < checkPoint.nextXid)
-		{
 			ShmemVariableCache->nextXid = checkPoint.nextXid;
-		}
 		if (ShmemVariableCache->nextOid < checkPoint.nextOid)
 		{
 			ShmemVariableCache->nextOid = checkPoint.nextOid;
@@ -2856,32 +2893,33 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
 		}
 	}
 }
- 
+
 void
 xlog_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 }
- 
+
 void
-xlog_desc(char *buf, uint8 xl_info, char* rec)
+xlog_desc(char *buf, uint8 xl_info, char *rec)
 {
-	uint8	info = xl_info & ~XLR_INFO_MASK;
+	uint8		info = xl_info & ~XLR_INFO_MASK;
 
 	if (info == XLOG_CHECKPOINT_SHUTDOWN ||
 		info == XLOG_CHECKPOINT_ONLINE)
 	{
-		CheckPoint	*checkpoint = (CheckPoint*) rec;
+		CheckPoint *checkpoint = (CheckPoint *) rec;
+
 		sprintf(buf + strlen(buf), "checkpoint: redo %u/%u; undo %u/%u; "
-		"sui %u; xid %u; oid %u; %s",
-			checkpoint->redo.xlogid, checkpoint->redo.xrecoff,
-			checkpoint->undo.xlogid, checkpoint->undo.xrecoff,
-			checkpoint->ThisStartUpID, checkpoint->nextXid, 
-			checkpoint->nextOid,
-			(info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online");
+				"sui %u; xid %u; oid %u; %s",
+				checkpoint->redo.xlogid, checkpoint->redo.xrecoff,
+				checkpoint->undo.xlogid, checkpoint->undo.xrecoff,
+				checkpoint->ThisStartUpID, checkpoint->nextXid,
+				checkpoint->nextOid,
+			 (info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online");
 	}
 	else if (info == XLOG_NEXTOID)
 	{
-		Oid		nextOid;
+		Oid			nextOid;
 
 		memcpy(&nextOid, rec, sizeof(Oid));
 		sprintf(buf + strlen(buf), "nextOid: %u", nextOid);
@@ -2893,13 +2931,13 @@ xlog_desc(char *buf, uint8 xl_info, char* rec)
 static void
 xlog_outrec(char *buf, XLogRecord *record)
 {
-	int		bkpb;
-	int		i;
+	int			bkpb;
+	int			i;
 
 	sprintf(buf + strlen(buf), "prev %u/%u; xprev %u/%u; xid %u",
-		record->xl_prev.xlogid, record->xl_prev.xrecoff,
-		record->xl_xact_prev.xlogid, record->xl_xact_prev.xrecoff,
-		record->xl_xid);
+			record->xl_prev.xlogid, record->xl_prev.xrecoff,
+			record->xl_xact_prev.xlogid, record->xl_xact_prev.xrecoff,
+			record->xl_xid);
 
 	for (i = 0, bkpb = 0; i < XLR_MAX_BKP_BLOCKS; i++)
 	{
@@ -2912,7 +2950,7 @@ xlog_outrec(char *buf, XLogRecord *record)
 		sprintf(buf + strlen(buf), "; bkpb %d", bkpb);
 
 	sprintf(buf + strlen(buf), ": %s",
-		RmgrTable[record->xl_rmid].rm_name);
+			RmgrTable[record->xl_rmid].rm_name);
 }
 
 
@@ -2923,15 +2961,19 @@ xlog_outrec(char *buf, XLogRecord *record)
 bool
 check_xlog_sync_method(const char *method)
 {
-	if (strcasecmp(method, "fsync") == 0) return true;
+	if (strcasecmp(method, "fsync") == 0)
+		return true;
 #ifdef HAVE_FDATASYNC
-	if (strcasecmp(method, "fdatasync") == 0) return true;
+	if (strcasecmp(method, "fdatasync") == 0)
+		return true;
 #endif
 #ifdef OPEN_SYNC_FLAG
-	if (strcasecmp(method, "open_sync") == 0) return true;
+	if (strcasecmp(method, "open_sync") == 0)
+		return true;
 #endif
 #ifdef OPEN_DATASYNC_FLAG
-	if (strcasecmp(method, "open_datasync") == 0) return true;
+	if (strcasecmp(method, "open_datasync") == 0)
+		return true;
 #endif
 	return false;
 }
@@ -2939,8 +2981,8 @@ check_xlog_sync_method(const char *method)
 void
 assign_xlog_sync_method(const char *method)
 {
-	int		new_sync_method;
-	int		new_sync_bit;
+	int			new_sync_method;
+	int			new_sync_bit;
 
 	if (strcasecmp(method, "fsync") == 0)
 	{
@@ -2978,11 +3020,12 @@ assign_xlog_sync_method(const char *method)
 
 	if (sync_method != new_sync_method || open_sync_bit != new_sync_bit)
 	{
+
 		/*
-		 * To ensure that no blocks escape unsynced, force an fsync on
-		 * the currently open log segment (if any).  Also, if the open
-		 * flag is changing, close the log file so it will be reopened
-		 * (with new flag bit) at next use.
+		 * To ensure that no blocks escape unsynced, force an fsync on the
+		 * currently open log segment (if any).  Also, if the open flag is
+		 * changing, close the log file so it will be reopened (with new
+		 * flag bit) at next use.
 		 */
 		if (openLogFile >= 0)
 		{
@@ -3011,7 +3054,7 @@ issue_xlog_fsync(void)
 {
 	switch (sync_method)
 	{
-		case SYNC_METHOD_FSYNC:
+			case SYNC_METHOD_FSYNC:
 			if (pg_fsync(openLogFile) != 0)
 				elog(STOP, "fsync(logfile %u seg %u) failed: %m",
 					 openLogId, openLogSeg);
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 8b80c326cab077aa3fa1c3b5fbd69665efe3a134..a3f440ca5f943203d14af045be96479b902f3339 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlogutils.c,v 1.14 2001/03/13 01:17:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlogutils.c,v 1.15 2001/03/22 03:59:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,26 +37,26 @@
  * xaction/command and return
  *
  * - -1 if not
- * - 0  if there is no tuple at all
- * - 1  if yes
+ * - 0	if there is no tuple at all
+ * - 1	if yes
  */
 int
-XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr, 
-					TransactionId xid, CommandId cid)
+XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr,
+				   TransactionId xid, CommandId cid)
 {
-	Relation		reln;
-	Buffer			buffer;
-	Page			page;
-	ItemId			lp;
-	HeapTupleHeader	htup;
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
+	ItemId		lp;
+	HeapTupleHeader htup;
 
 	reln = XLogOpenRelation(false, RM_HEAP_ID, hnode);
 	if (!RelationIsValid(reln))
-		return(0);
+		return (0);
 
 	buffer = ReadBuffer(reln, ItemPointerGetBlockNumber(iptr));
 	if (!BufferIsValid(buffer))
-		return(0);
+		return (0);
 
 	LockBuffer(buffer, BUFFER_LOCK_SHARE);
 	page = (Page) BufferGetPage(buffer);
@@ -64,13 +64,13 @@ XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr,
 		ItemPointerGetOffsetNumber(iptr) > PageGetMaxOffsetNumber(page))
 	{
 		UnlockAndReleaseBuffer(buffer);
-		return(0);
+		return (0);
 	}
 	lp = PageGetItemId(page, ItemPointerGetOffsetNumber(iptr));
 	if (!ItemIdIsUsed(lp) || ItemIdDeleted(lp))
 	{
 		UnlockAndReleaseBuffer(buffer);
-		return(0);
+		return (0);
 	}
 
 	htup = (HeapTupleHeader) PageGetItem(page, lp);
@@ -79,11 +79,11 @@ XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr,
 	if (htup->t_xmin != xid || htup->t_cmin != cid)
 	{
 		UnlockAndReleaseBuffer(buffer);
-		return(-1);
+		return (-1);
 	}
 
 	UnlockAndReleaseBuffer(buffer);
-	return(1);
+	return (1);
 }
 
 /*
@@ -95,19 +95,19 @@ XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr,
 bool
 XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr)
 {
-	Relation		reln;
-	Buffer			buffer;
-	Page			page;
-	ItemId			lp;
-	HeapTupleHeader	htup;
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
+	ItemId		lp;
+	HeapTupleHeader htup;
 
 	reln = XLogOpenRelation(false, RM_HEAP_ID, hnode);
 	if (!RelationIsValid(reln))
-		return(false);
+		return (false);
 
 	buffer = ReadBuffer(reln, ItemPointerGetBlockNumber(iptr));
 	if (!BufferIsValid(buffer))
-		return(false);
+		return (false);
 
 	LockBuffer(buffer, BUFFER_LOCK_SHARE);
 	page = (Page) BufferGetPage(buffer);
@@ -115,21 +115,21 @@ XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr)
 		ItemPointerGetOffsetNumber(iptr) > PageGetMaxOffsetNumber(page))
 	{
 		UnlockAndReleaseBuffer(buffer);
-		return(false);
+		return (false);
 	}
 
 	if (PageGetSUI(page) != ThisStartUpID)
 	{
 		Assert(PageGetSUI(page) < ThisStartUpID);
 		UnlockAndReleaseBuffer(buffer);
-		return(true);
+		return (true);
 	}
 
 	lp = PageGetItemId(page, ItemPointerGetOffsetNumber(iptr));
 	if (!ItemIdIsUsed(lp) || ItemIdDeleted(lp))
 	{
 		UnlockAndReleaseBuffer(buffer);
-		return(false);
+		return (false);
 	}
 
 	htup = (HeapTupleHeader) PageGetItem(page, lp);
@@ -140,22 +140,22 @@ XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr)
 	{
 		if (htup->t_infomask & HEAP_XMIN_INVALID ||
 			(htup->t_infomask & HEAP_MOVED_IN &&
-			TransactionIdDidAbort((TransactionId)htup->t_cmin)) ||
+			 TransactionIdDidAbort((TransactionId) htup->t_cmin)) ||
 			TransactionIdDidAbort(htup->t_xmin))
 		{
 			UnlockAndReleaseBuffer(buffer);
-			return(false);
+			return (false);
 		}
 	}
 
 	UnlockAndReleaseBuffer(buffer);
-	return(true);
+	return (true);
 }
 
 /*
  * Open pg_log in recovery
  */
-extern Relation	LogRelation;	/* pg_log relation */
+extern Relation LogRelation;	/* pg_log relation */
 
 void
 XLogOpenLogRelation(void)
@@ -189,32 +189,32 @@ XLogOpenLogRelation(void)
 Buffer
 XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno)
 {
-	BlockNumber	lastblock = RelationGetNumberOfBlocks(reln);
+	BlockNumber lastblock = RelationGetNumberOfBlocks(reln);
 	Buffer		buffer;
 
 	if (blkno >= lastblock)
 	{
 		buffer = InvalidBuffer;
-		if (extend)		/* we do this in recovery only - no locks */
+		if (extend)				/* we do this in recovery only - no locks */
 		{
 			Assert(InRecovery);
 			while (lastblock <= blkno)
 			{
 				if (buffer != InvalidBuffer)
-                                        ReleaseBuffer(buffer); /* must be WriteBuffer()? */
+					ReleaseBuffer(buffer);		/* must be WriteBuffer()? */
 				buffer = ReadBuffer(reln, P_NEW);
 				lastblock++;
 			}
 		}
 		if (buffer != InvalidBuffer)
 			LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
-		return(buffer);
+		return (buffer);
 	}
 
 	buffer = ReadBuffer(reln, blkno);
 	if (buffer != InvalidBuffer)
 		LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
-	return(buffer);
+	return (buffer);
 }
 
 /*
@@ -223,32 +223,33 @@ XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno)
 
 typedef struct XLogRelDesc
 {
-	RelationData			reldata;
-	struct XLogRelDesc	   *lessRecently;
-	struct XLogRelDesc	   *moreRecently;
+	RelationData reldata;
+	struct XLogRelDesc *lessRecently;
+	struct XLogRelDesc *moreRecently;
 } XLogRelDesc;
 
 typedef struct XLogRelCacheEntry
 {
-	RelFileNode		rnode;
-	XLogRelDesc	   *rdesc;
+	RelFileNode rnode;
+	XLogRelDesc *rdesc;
 } XLogRelCacheEntry;
 
-static HTAB				   *_xlrelcache;
-static XLogRelDesc		   *_xlrelarr = NULL;
-static Form_pg_class		_xlpgcarr = NULL;
-static int					_xlast = 0;
-static int					_xlcnt = 0;
-#define	_XLOG_RELCACHESIZE	512
+static HTAB *_xlrelcache;
+static XLogRelDesc *_xlrelarr = NULL;
+static Form_pg_class _xlpgcarr = NULL;
+static int	_xlast = 0;
+static int	_xlcnt = 0;
+
+#define _XLOG_RELCACHESIZE	512
 
 static void
 _xl_init_rel_cache(void)
 {
-	HASHCTL			ctl;
+	HASHCTL		ctl;
 
 	_xlcnt = _XLOG_RELCACHESIZE;
 	_xlast = 0;
-	_xlrelarr = (XLogRelDesc*) malloc(sizeof(XLogRelDesc) * _xlcnt);
+	_xlrelarr = (XLogRelDesc *) malloc(sizeof(XLogRelDesc) * _xlcnt);
 	memset(_xlrelarr, 0, sizeof(XLogRelDesc) * _xlcnt);
 	_xlpgcarr = (Form_pg_class) malloc(sizeof(FormData_pg_class) * _xlcnt);
 	memset(_xlpgcarr, 0, sizeof(FormData_pg_class) * _xlcnt);
@@ -258,26 +259,26 @@ _xl_init_rel_cache(void)
 
 	memset(&ctl, 0, (int) sizeof(ctl));
 	ctl.keysize = sizeof(RelFileNode);
-	ctl.datasize = sizeof(XLogRelDesc*);
+	ctl.datasize = sizeof(XLogRelDesc *);
 	ctl.hash = tag_hash;
 
 	_xlrelcache = hash_create(_XLOG_RELCACHESIZE, &ctl,
-								HASH_ELEM | HASH_FUNCTION);
+							  HASH_ELEM | HASH_FUNCTION);
 }
 
 static void
 _xl_remove_hash_entry(XLogRelDesc **edata, Datum dummy)
 {
-	XLogRelCacheEntry	   *hentry;
-	bool					found;
-	XLogRelDesc			   *rdesc = *edata;
-	Form_pg_class			tpgc = rdesc->reldata.rd_rel;
+	XLogRelCacheEntry *hentry;
+	bool		found;
+	XLogRelDesc *rdesc = *edata;
+	Form_pg_class tpgc = rdesc->reldata.rd_rel;
 
 	rdesc->lessRecently->moreRecently = rdesc->moreRecently;
 	rdesc->moreRecently->lessRecently = rdesc->lessRecently;
 
-	hentry = (XLogRelCacheEntry*) hash_search(_xlrelcache, 
-		(char*)&(rdesc->reldata.rd_node), HASH_REMOVE, &found);
+	hentry = (XLogRelCacheEntry *) hash_search(_xlrelcache,
+				(char *) &(rdesc->reldata.rd_node), HASH_REMOVE, &found);
 
 	if (hentry == NULL)
 		elog(STOP, "_xl_remove_hash_entry: can't delete from cache");
@@ -294,16 +295,16 @@ _xl_remove_hash_entry(XLogRelDesc **edata, Datum dummy)
 	return;
 }
 
-static XLogRelDesc*
+static XLogRelDesc *
 _xl_new_reldesc(void)
 {
-	XLogRelDesc	   *res;
+	XLogRelDesc *res;
 
 	_xlast++;
 	if (_xlast < _xlcnt)
 	{
 		_xlrelarr[_xlast].reldata.rd_rel = &(_xlpgcarr[_xlast]);
-		return(&(_xlrelarr[_xlast]));
+		return (&(_xlrelarr[_xlast]));
 	}
 
 	/* reuse */
@@ -312,7 +313,7 @@ _xl_new_reldesc(void)
 	_xl_remove_hash_entry(&res, 0);
 
 	_xlast--;
-	return(res);
+	return (res);
 }
 
 
@@ -344,12 +345,12 @@ XLogCloseRelationCache(void)
 Relation
 XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
 {
-	XLogRelDesc			   *res;
-	XLogRelCacheEntry	   *hentry;
-	bool					found;
+	XLogRelDesc *res;
+	XLogRelCacheEntry *hentry;
+	bool		found;
 
-	hentry = (XLogRelCacheEntry*) 
-			hash_search(_xlrelcache, (char*)&rnode, HASH_FIND, &found);
+	hentry = (XLogRelCacheEntry *)
+		hash_search(_xlrelcache, (char *) &rnode, HASH_FIND, &found);
 
 	if (hentry == NULL)
 		elog(STOP, "XLogOpenRelation: error in cache");
@@ -372,8 +373,8 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
 		res->reldata.rd_lockInfo.lockRelId.relId = rnode.relNode;
 		res->reldata.rd_node = rnode;
 
-		hentry = (XLogRelCacheEntry*) 
-			hash_search(_xlrelcache, (char*)&rnode, HASH_ENTER, &found);
+		hentry = (XLogRelCacheEntry *)
+			hash_search(_xlrelcache, (char *) &rnode, HASH_ENTER, &found);
 
 		if (hentry == NULL)
 			elog(STOP, "XLogOpenRelation: can't insert into cache");
@@ -385,7 +386,7 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
 
 		res->reldata.rd_fd = -1;
 		res->reldata.rd_fd = smgropen(DEFAULT_SMGR, &(res->reldata),
-									  true /* allow failure */);
+									  true /* allow failure */ );
 	}
 
 	res->moreRecently = &(_xlrelarr[0]);
@@ -393,8 +394,8 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
 	_xlrelarr[0].lessRecently = res;
 	res->lessRecently->moreRecently = res;
 
-	if (res->reldata.rd_fd < 0)		/* file doesn't exist */
-		return(NULL);
+	if (res->reldata.rd_fd < 0) /* file doesn't exist */
+		return (NULL);
 
-	return(&(res->reldata));
+	return (&(res->reldata));
 }
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index b9bb36bc0ca65d532c9320332bc4e81bde6a382d..bfc4cc2a4545697e2898d181594bebd636f33c0c 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.46 2001/01/24 19:42:51 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.47 2001/03/22 03:59:18 momjian Exp $
  *
  * NOTES
  *	  See acl.h.
@@ -34,7 +34,7 @@
 #include "utils/syscache.h"
 
 static int32 aclcheck(char *relname, Acl *acl, AclId id,
-					  AclIdType idtype, AclMode mode);
+		 AclIdType idtype, AclMode mode);
 
 /* warning messages, now more explicit. */
 /* MUST correspond to the order of the ACLCHK_* result codes in acl.h. */
@@ -59,7 +59,7 @@ dumpacl(Acl *acl)
 	for (i = 0; i < ACL_NUM(acl); ++i)
 		elog(DEBUG, "	acl[%d]: %s", i,
 			 DatumGetCString(DirectFunctionCall1(aclitemout,
-												 PointerGetDatum(aip + i))));
+											 PointerGetDatum(aip + i))));
 }
 
 #endif
@@ -250,8 +250,8 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
 				num;
 
 	/*
-	 * If ACL is null, default to "OK" --- this should not happen,
-	 * since caller should have inserted appropriate default
+	 * If ACL is null, default to "OK" --- this should not happen, since
+	 * caller should have inserted appropriate default
 	 */
 	if (!acl)
 	{
@@ -265,8 +265,8 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
 	/*
 	 * We'll treat the empty ACL like that, too, although this is more
 	 * like an error (i.e., you manually blew away your ACL array) -- the
-	 * system never creates an empty ACL, since there must always be
-	 * a "world" entry in the first slot.
+	 * system never creates an empty ACL, since there must always be a
+	 * "world" entry in the first slot.
 	 */
 	if (num < 1)
 	{
@@ -352,7 +352,7 @@ pg_aclcheck(char *relname, Oid userid, AclMode mode)
 {
 	int32		result;
 	HeapTuple	tuple;
-	char       *usename;
+	char	   *usename;
 	Datum		aclDatum;
 	bool		isNull;
 	Acl		   *acl;
@@ -439,7 +439,7 @@ pg_ownercheck(Oid userid,
 {
 	HeapTuple	tuple;
 	AclId		owner_id;
-	char       *usename;
+	char	   *usename;
 
 	tuple = SearchSysCache(SHADOWSYSID,
 						   ObjectIdGetDatum(userid),
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index 0952a079f777d1ba449c8cd3107b43f96470f718..7d10bdea7a771e848e82efd71d1afe2c952992c7 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.39 2001/01/24 19:42:51 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.40 2001/03/22 03:59:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -105,7 +105,7 @@ relpath_blind(const char *dbname, const char *relname,
 	return path;
 }
 
-#else	/* ! OLD_FILE_NAMING */
+#else							/* ! OLD_FILE_NAMING */
 
 /*
  * relpath			- construct path to a relation's file
@@ -118,7 +118,7 @@ relpath(RelFileNode rnode)
 {
 	char	   *path;
 
-	if (rnode.tblNode == (Oid) 0)	/* "global tablespace" */
+	if (rnode.tblNode == (Oid) 0)		/* "global tablespace" */
 	{
 		/* Shared system relations live in {datadir}/global */
 		path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1);
@@ -127,8 +127,8 @@ relpath(RelFileNode rnode)
 	else
 	{
 		path = (char *) palloc(strlen(DataDir) + 6 + 2 * sizeof(NameData) + 3);
-		sprintf(path, "%s%cbase%c%u%c%u", DataDir, SEP_CHAR, SEP_CHAR, 
-			rnode.tblNode, SEP_CHAR, rnode.relNode);
+		sprintf(path, "%s%cbase%c%u%c%u", DataDir, SEP_CHAR, SEP_CHAR,
+				rnode.tblNode, SEP_CHAR, rnode.relNode);
 	}
 	return path;
 }
@@ -144,7 +144,7 @@ GetDatabasePath(Oid tblNode)
 {
 	char	   *path;
 
-	if (tblNode == (Oid) 0)	/* "global tablespace" */
+	if (tblNode == (Oid) 0)		/* "global tablespace" */
 	{
 		/* Shared system relations live in {datadir}/global */
 		path = (char *) palloc(strlen(DataDir) + 8);
@@ -158,7 +158,7 @@ GetDatabasePath(Oid tblNode)
 	return path;
 }
 
-#endif	/* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 
 /*
  * IsSystemRelationName
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index f0aa9042e02b6ddd10c8fdf8174b41b606b260a0..34a22412c39a8748628861f2814efec9ad59c579 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.160 2001/02/14 21:34:59 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.161 2001/03/22 03:59:19 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -68,7 +68,7 @@
 
 
 static void AddNewRelationTuple(Relation pg_class_desc,
-					Relation new_rel_desc, Oid new_rel_oid, Oid new_type_oid,
+				Relation new_rel_desc, Oid new_rel_oid, Oid new_type_oid,
 					int natts, char relkind, char *temp_relname);
 static void DeleteAttributeTuples(Relation rel);
 static void DeleteRelationTuple(Relation rel);
@@ -76,7 +76,7 @@ static void DeleteTypeTuple(Relation rel);
 static void RelationRemoveIndexes(Relation relation);
 static void RelationRemoveInheritance(Relation relation);
 static void AddNewRelationType(char *typeName, Oid new_rel_oid,
-							   Oid new_type_oid);
+				   Oid new_type_oid);
 static void StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin,
 				 bool updatePgAttribute);
 static void StoreRelCheck(Relation rel, char *ccname, char *ccbin);
@@ -178,13 +178,13 @@ heap_create(char *relname,
 {
 	static unsigned int uniqueId = 0;
 
-	Oid				relid;
-	Relation		rel;
-	bool			nailme = false;
-	int				natts = tupDesc->natts;
-	int				i;
-	MemoryContext	oldcxt;
-	Oid				tblNode = MyDatabaseId;
+	Oid			relid;
+	Relation	rel;
+	bool		nailme = false;
+	int			natts = tupDesc->natts;
+	int			i;
+	MemoryContext oldcxt;
+	Oid			tblNode = MyDatabaseId;
 
 	/* ----------------
 	 *	sanity checks
@@ -270,7 +270,11 @@ heap_create(char *relname,
 
 	if (istemp)
 	{
-		/* replace relname of caller with a unique name for a temp relation */
+
+		/*
+		 * replace relname of caller with a unique name for a temp
+		 * relation
+		 */
 		snprintf(relname, NAMEDATALEN, "pg_temp.%d.%u",
 				 (int) MyProcPid, uniqueId++);
 	}
@@ -738,6 +742,7 @@ AddNewRelationTuple(Relation pg_class_desc,
 static void
 AddNewRelationType(char *typeName, Oid new_rel_oid, Oid new_type_oid)
 {
+
 	/*
 	 * The sizes are set to oid size because it makes implementing sets
 	 * MUCH easier, and no one (we hope) uses these fields to figure out
@@ -1025,9 +1030,7 @@ RelationRemoveInheritance(Relation relation)
 						  &entry);
 
 	while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
-	{
 		simple_heap_delete(catalogRelation, &tuple->t_self);
-	}
 
 	heap_endscan(scan);
 	heap_close(catalogRelation, RowExclusiveLock);
@@ -1152,8 +1155,8 @@ RelationTruncateIndexes(Oid heapId)
 		/*
 		 * We have to re-open the heap rel each time through this loop
 		 * because index_build will close it again.  We need grab no lock,
-		 * however, because we assume heap_truncate is holding an exclusive
-		 * lock on the heap rel.
+		 * however, because we assume heap_truncate is holding an
+		 * exclusive lock on the heap rel.
 		 */
 		heapRelation = heap_open(heapId, NoLock);
 
@@ -1164,8 +1167,8 @@ RelationTruncateIndexes(Oid heapId)
 		LockRelation(currentIndex, AccessExclusiveLock);
 
 		/*
-		 * Drop any buffers associated with this index.	If they're
-		 * dirty, they're just dropped without bothering to flush to disk.
+		 * Drop any buffers associated with this index. If they're dirty,
+		 * they're just dropped without bothering to flush to disk.
 		 */
 		DropRelationBuffers(currentIndex);
 
@@ -1177,6 +1180,7 @@ RelationTruncateIndexes(Oid heapId)
 		InitIndexStrategy(indexInfo->ii_NumIndexAttrs,
 						  currentIndex, accessMethodId);
 		index_build(heapRelation, currentIndex, indexInfo, NULL);
+
 		/*
 		 * index_build will close both the heap and index relations (but
 		 * not give up the locks we hold on them).
@@ -1514,7 +1518,7 @@ heap_drop_with_catalog(const char *relname,
 
 	if (has_toasttable)
 	{
-		char	toast_relname[NAMEDATALEN];
+		char		toast_relname[NAMEDATALEN];
 
 		sprintf(toast_relname, "pg_toast_%u", rid);
 		heap_drop_with_catalog(toast_relname, true);
@@ -1553,16 +1557,16 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin,
 	 * deparse it
 	 */
 	adsrc = deparse_expression(expr,
-							   deparse_context_for(RelationGetRelationName(rel),
-												   RelationGetRelid(rel)),
+						deparse_context_for(RelationGetRelationName(rel),
+											RelationGetRelid(rel)),
 							   false);
 
 	values[Anum_pg_attrdef_adrelid - 1] = RelationGetRelid(rel);
 	values[Anum_pg_attrdef_adnum - 1] = attnum;
 	values[Anum_pg_attrdef_adbin - 1] = DirectFunctionCall1(textin,
-													CStringGetDatum(adbin));
+												 CStringGetDatum(adbin));
 	values[Anum_pg_attrdef_adsrc - 1] = DirectFunctionCall1(textin,
-													CStringGetDatum(adsrc));
+												 CStringGetDatum(adsrc));
 	adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
 	tuple = heap_formtuple(adrel->rd_att, values, nulls);
 	heap_insert(adrel, tuple);
@@ -1631,17 +1635,17 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
 	 * deparse it
 	 */
 	ccsrc = deparse_expression(expr,
-							   deparse_context_for(RelationGetRelationName(rel),
-												   RelationGetRelid(rel)),
+						deparse_context_for(RelationGetRelationName(rel),
+											RelationGetRelid(rel)),
 							   false);
 
 	values[Anum_pg_relcheck_rcrelid - 1] = RelationGetRelid(rel);
 	values[Anum_pg_relcheck_rcname - 1] = DirectFunctionCall1(namein,
-													CStringGetDatum(ccname));
+												CStringGetDatum(ccname));
 	values[Anum_pg_relcheck_rcbin - 1] = DirectFunctionCall1(textin,
-													CStringGetDatum(ccbin));
+												 CStringGetDatum(ccbin));
 	values[Anum_pg_relcheck_rcsrc - 1] = DirectFunctionCall1(textin,
-													CStringGetDatum(ccsrc));
+												 CStringGetDatum(ccsrc));
 	rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock);
 	tuple = heap_formtuple(rcrel->rd_att, values, nulls);
 	heap_insert(rcrel, tuple);
@@ -1981,9 +1985,7 @@ RemoveAttrDefault(Relation rel)
 	adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key);
 
 	while (HeapTupleIsValid(tup = heap_getnext(adscan, 0)))
-	{
 		simple_heap_delete(adrel, &tup->t_self);
-	}
 
 	heap_endscan(adscan);
 	heap_close(adrel, RowExclusiveLock);
@@ -2005,9 +2007,7 @@ RemoveRelCheck(Relation rel)
 	rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key);
 
 	while (HeapTupleIsValid(tup = heap_getnext(rcscan, 0)))
-	{
 		simple_heap_delete(rcrel, &tup->t_self);
-	}
 
 	heap_endscan(rcscan);
 	heap_close(rcrel, RowExclusiveLock);
@@ -2044,9 +2044,7 @@ RemoveStatistics(Relation rel)
 	scan = heap_beginscan(pgstatistic, false, SnapshotNow, 1, &key);
 
 	while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
-	{
 		simple_heap_delete(pgstatistic, &tuple->t_self);
-	}
 
 	heap_endscan(scan);
 	heap_close(pgstatistic, RowExclusiveLock);
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 6dd28ed02cbf7f6fb07c54659399153975cfe745..103c4ccc01628ba76cf3269a93484dab53414790 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.142 2001/02/23 09:31:52 inoue Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.143 2001/03/22 03:59:19 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -63,19 +63,19 @@ static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName,
 				   bool istemp);
 static TupleDesc BuildFuncTupleDesc(Oid funcOid);
 static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
-										  int numatts, AttrNumber *attNums);
+						 int numatts, AttrNumber *attNums);
 static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
 static Oid	UpdateRelationRelation(Relation indexRelation, char *temp_relname);
 static void InitializeAttributeOids(Relation indexRelation,
 						int numatts, Oid indexoid);
 static void AppendAttributeTuples(Relation indexRelation, int numatts);
 static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
-								IndexInfo *indexInfo,
-								Oid *classOids,
-								bool islossy, bool primary);
+					IndexInfo *indexInfo,
+					Oid *classOids,
+					bool islossy, bool primary);
 static void DefaultBuild(Relation heapRelation, Relation indexRelation,
-						 IndexInfo *indexInfo, Node *oldPred,
-						 IndexStrategy indexStrategy);
+			 IndexInfo *indexInfo, Node *oldPred,
+			 IndexStrategy indexStrategy);
 static Oid	IndexGetRelation(Oid indexId);
 static bool activate_index(Oid indexId, bool activate, bool inplace);
 
@@ -301,7 +301,8 @@ ConstructTupleDescriptor(Relation heapRelation,
 		memcpy(to, from, ATTRIBUTE_TUPLE_SIZE);
 
 		/*
-		 * Fix the stuff that should not be the same as the underlying attr
+		 * Fix the stuff that should not be the same as the underlying
+		 * attr
 		 */
 		to->attnum = i + 1;
 
@@ -311,9 +312,9 @@ ConstructTupleDescriptor(Relation heapRelation,
 		to->attcacheoff = -1;
 
 		/*
-		 * We do not yet have the correct relation OID for the index,
-		 * so just set it invalid for now.  InitializeAttributeOids()
-		 * will fix it later.
+		 * We do not yet have the correct relation OID for the index, so
+		 * just set it invalid for now.  InitializeAttributeOids() will
+		 * fix it later.
 		 */
 		to->attrelid = InvalidOid;
 	}
@@ -331,7 +332,7 @@ ConstructTupleDescriptor(Relation heapRelation,
  * typically CacheMemoryContext).
  *
  * There was a note here about adding indexing, but I don't see a need
- * for it.  There are so few tuples in pg_am that an indexscan would
+ * for it.	There are so few tuples in pg_am that an indexscan would
  * surely be slower.
  * ----------------------------------------------------------------
  */
@@ -394,7 +395,7 @@ static void
 ConstructIndexReldesc(Relation indexRelation, Oid amoid)
 {
 	indexRelation->rd_am = AccessMethodObjectIdGetForm(amoid,
-													   CacheMemoryContext);
+													 CacheMemoryContext);
 
 	/* ----------------
 	 *	 XXX missing the initialization of some other fields
@@ -625,12 +626,12 @@ UpdateIndexRelation(Oid indexoid,
 	{
 		predString = nodeToString(indexInfo->ii_Predicate);
 		predText = DatumGetTextP(DirectFunctionCall1(textin,
-											CStringGetDatum(predString)));
+										   CStringGetDatum(predString)));
 		pfree(predString);
 	}
 	else
 		predText = DatumGetTextP(DirectFunctionCall1(textin,
-													 CStringGetDatum("")));
+												   CStringGetDatum("")));
 
 	predLen = VARSIZE(predText);
 	itupLen = predLen + sizeof(FormData_pg_index);
@@ -646,7 +647,7 @@ UpdateIndexRelation(Oid indexoid,
 	indexForm->indproc = indexInfo->ii_FuncOid;
 	indexForm->indisclustered = false;
 	indexForm->indislossy = islossy;
-	indexForm->indhaskeytype = true; /* not actually used anymore */
+	indexForm->indhaskeytype = true;	/* not actually used anymore */
 	indexForm->indisunique = indexInfo->ii_Unique;
 	indexForm->indisprimary = primary;
 	memcpy((char *) &indexForm->indpred, (char *) predText, predLen);
@@ -747,12 +748,12 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
 	{
 		predString = nodeToString(newPred);
 		predText = DatumGetTextP(DirectFunctionCall1(textin,
-											CStringGetDatum(predString)));
+										   CStringGetDatum(predString)));
 		pfree(predString);
 	}
 	else
 		predText = DatumGetTextP(DirectFunctionCall1(textin,
-													 CStringGetDatum("")));
+												   CStringGetDatum("")));
 
 	/* open the index system catalog relation */
 	pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
@@ -911,15 +912,15 @@ index_create(char *heapRelationName,
 	else
 		indexTupDesc = ConstructTupleDescriptor(heapRelation,
 												indexInfo->ii_NumKeyAttrs,
-												indexInfo->ii_KeyAttrNumbers);
+										   indexInfo->ii_KeyAttrNumbers);
 
 	if (istemp)
 	{
 		/* save user relation name because heap_create changes it */
-		temp_relname = pstrdup(indexRelationName);	/* save original value */
+		temp_relname = pstrdup(indexRelationName);		/* save original value */
 		indexRelationName = palloc(NAMEDATALEN);
-		strcpy(indexRelationName, temp_relname);	/* heap_create will
-													 * change this */
+		strcpy(indexRelationName, temp_relname);		/* heap_create will
+														 * change this */
 	}
 
 	/* ----------------
@@ -1008,9 +1009,7 @@ index_create(char *heapRelationName,
 		/* XXX shouldn't we close the heap and index rels here? */
 	}
 	else
-	{
 		index_build(heapRelation, indexRelation, indexInfo, NULL);
-	}
 }
 
 /* ----------------------------------------------------------------
@@ -1081,12 +1080,12 @@ index_drop(Oid indexId)
 	heap_freetuple(tuple);
 
 	/*
-	 * Update the pg_class tuple for the owning relation.  We are presently
-	 * too lazy to attempt to compute the new correct value of relhasindex
-	 * (the next VACUUM will fix it if necessary).  But we must send out a
-	 * shared-cache-inval notice on the owning relation to ensure other
-	 * backends update their relcache lists of indexes.  So, unconditionally
-	 * do setRelhasindex(true).
+	 * Update the pg_class tuple for the owning relation.  We are
+	 * presently too lazy to attempt to compute the new correct value of
+	 * relhasindex (the next VACUUM will fix it if necessary).	But we
+	 * must send out a shared-cache-inval notice on the owning relation to
+	 * ensure other backends update their relcache lists of indexes.  So,
+	 * unconditionally do setRelhasindex(true).
 	 */
 	setRelhasindex(heapId, true);
 
@@ -1160,11 +1159,11 @@ index_drop(Oid indexId)
  *
  * IndexInfo stores the information about the index that's needed by
  * FormIndexDatum, which is used for both index_build() and later insertion
- * of individual index tuples.  Normally we build an IndexInfo for an index
+ * of individual index tuples.	Normally we build an IndexInfo for an index
  * just once per command, and then use it for (potentially) many tuples.
  * ----------------
  */
-IndexInfo *
+IndexInfo  *
 BuildIndexInfo(HeapTuple indexTuple)
 {
 	Form_pg_index indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -1199,7 +1198,7 @@ BuildIndexInfo(HeapTuple indexTuple)
 	{
 		ii->ii_NumIndexAttrs = 1;
 		/* Do a lookup on the function, too */
-		fmgr_info(indexStruct->indproc, & ii->ii_FuncInfo);
+		fmgr_info(indexStruct->indproc, &ii->ii_FuncInfo);
 	}
 	else
 		ii->ii_NumIndexAttrs = numKeys;
@@ -1213,7 +1212,7 @@ BuildIndexInfo(HeapTuple indexTuple)
 		char	   *predString;
 
 		predString = DatumGetCString(DirectFunctionCall1(textout,
-									 PointerGetDatum(&indexStruct->indpred)));
+								PointerGetDatum(&indexStruct->indpred)));
 		ii->ii_Predicate = stringToNode(predString);
 		pfree(predString);
 	}
@@ -1262,8 +1261,8 @@ FormIndexDatum(IndexInfo *indexInfo,
 		 *	Functional index --- compute the single index attribute
 		 * ----------------
 		 */
-		FunctionCallInfoData	fcinfo;
-		bool					anynull = false;
+		FunctionCallInfoData fcinfo;
+		bool		anynull = false;
 
 		MemSet(&fcinfo, 0, sizeof(fcinfo));
 		fcinfo.flinfo = &indexInfo->ii_FuncInfo;
@@ -1326,8 +1325,8 @@ LockClassinfoForUpdate(Oid relid, HeapTuple rtup,
 	Relation	relationRelation;
 
 	/*
-	 * NOTE: get and hold RowExclusiveLock on pg_class, because caller will
-	 * probably modify the rel's pg_class tuple later on.
+	 * NOTE: get and hold RowExclusiveLock on pg_class, because caller
+	 * will probably modify the rel's pg_class tuple later on.
 	 */
 	relationRelation = heap_openr(RelationRelationName, RowExclusiveLock);
 	classTuple = SearchSysCache(RELOID, PointerGetDatum(relid),
@@ -1342,7 +1341,7 @@ LockClassinfoForUpdate(Oid relid, HeapTuple rtup,
 
 	while (1)
 	{
-		ItemPointerData	tidsave;
+		ItemPointerData tidsave;
 
 		ItemPointerCopy(&(rtup->t_self), &tidsave);
 		test = heap_mark4update(relationRelation, rtup, buffer);
@@ -1393,7 +1392,7 @@ IndexesAreActive(Oid relid, bool confirmCommitted)
 	if (!LockClassinfoForUpdate(relid, &tuple, &buffer, confirmCommitted))
 		elog(ERROR, "IndexesAreActive couldn't lock %u", relid);
 	if (((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_RELATION &&
-		((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
+	  ((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
 		elog(ERROR, "relation %u isn't an indexable relation", relid);
 	isactive = ((Form_pg_class) GETSTRUCT(&tuple))->relhasindex;
 	ReleaseBuffer(buffer);
@@ -1438,7 +1437,7 @@ setRelhasindex(Oid relid, bool hasindex)
 	if (!IsIgnoringSystemIndexes())
 #else
 	if (!IsIgnoringSystemIndexes() && (!IsReindexProcessing() || pg_class->rd_rel->relhasindex))
-#endif /* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 	{
 		tuple = SearchSysCacheCopy(RELOID,
 								   ObjectIdGetDatum(relid),
@@ -1513,18 +1512,19 @@ setRelhasindex(Oid relid, bool hasindex)
 void
 setNewRelfilenode(Relation relation)
 {
-	Relation	pg_class, idescs[Num_pg_class_indices];
-	Oid		newrelfilenode;
+	Relation	pg_class,
+				idescs[Num_pg_class_indices];
+	Oid			newrelfilenode;
 	bool		in_place_update = false;
-	HeapTupleData 	lockTupleData;
-	HeapTuple 	classTuple = NULL;
+	HeapTupleData lockTupleData;
+	HeapTuple	classTuple = NULL;
 	Buffer		buffer;
-	RelationData	workrel;
-	
+	RelationData workrel;
+
 	Assert(!IsSystemRelationName(NameStr(relation->rd_rel->relname)) || relation->rd_rel->relkind == RELKIND_INDEX);
 
 	pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
-	 /* Fetch and lock the classTuple associated with this relation */
+	/* Fetch and lock the classTuple associated with this relation */
 	if (!LockClassinfoForUpdate(relation->rd_id, &lockTupleData, &buffer, true))
 		elog(ERROR, "setNewRelfilenode impossible to lock class tuple");
 	if (IsIgnoringSystemIndexes())
@@ -1567,7 +1567,7 @@ setNewRelfilenode(Relation relation)
 	if (!in_place_update && pg_class->rd_rel->relhasindex)
 	{
 		CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices,
-							   idescs);
+						   idescs);
 		CatalogIndexInsert(idescs, Num_pg_class_indices, pg_class, classTuple);
 		CatalogCloseIndices(Num_pg_class_indices, idescs);
 	}
@@ -1577,7 +1577,8 @@ setNewRelfilenode(Relation relation)
 	/* Make sure the relfilenode change */
 	CommandCounterIncrement();
 }
-#endif /* OLD_FILE_NAMING */
+
+#endif	 /* OLD_FILE_NAMING */
 
 /* ----------------
  *		UpdateStats
@@ -1639,7 +1640,7 @@ UpdateStats(Oid relid, long reltuples)
 	in_place_upd = (IsReindexProcessing() || IsBootstrapProcessingMode());
 #else
 	in_place_upd = (IsIgnoringSystemIndexes() || IsReindexProcessing());
-#endif /* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 
 	if (!in_place_upd)
 	{
@@ -1713,9 +1714,10 @@ UpdateStats(Oid relid, long reltuples)
 	 */
 	if (in_place_upd)
 	{
+
 		/*
 		 * At bootstrap time, we don't need to worry about concurrency or
-		 * visibility of changes, so we cheat.  Also cheat if REINDEX.
+		 * visibility of changes, so we cheat.	Also cheat if REINDEX.
 		 */
 		rd_rel = (Form_pg_class) GETSTRUCT(tuple);
 		LockBuffer(pg_class_scan->rs_cbuf, BUFFER_LOCK_EXCLUSIVE);
@@ -1777,7 +1779,7 @@ DefaultBuild(Relation heapRelation,
 			 Relation indexRelation,
 			 IndexInfo *indexInfo,
 			 Node *oldPred,
-			 IndexStrategy indexStrategy) /* not used */
+			 IndexStrategy indexStrategy)		/* not used */
 {
 	HeapScanDesc scan;
 	HeapTuple	heapTuple;
@@ -1787,9 +1789,11 @@ DefaultBuild(Relation heapRelation,
 	long		reltuples,
 				indtuples;
 	Node	   *predicate = indexInfo->ii_Predicate;
+
 #ifndef OMIT_PARTIAL_INDEX
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
+
 #endif
 	ExprContext *econtext;
 	InsertIndexResult insertResult;
@@ -1855,6 +1859,7 @@ DefaultBuild(Relation heapRelation,
 		reltuples++;
 
 #ifndef OMIT_PARTIAL_INDEX
+
 		/*
 		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
 		 * this tuple if it was already in the existing partial index
@@ -1906,9 +1911,7 @@ DefaultBuild(Relation heapRelation,
 
 #ifndef OMIT_PARTIAL_INDEX
 	if (predicate != NULL || oldPred != NULL)
-	{
 		ExecDropTupleTable(tupleTable, true);
-	}
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
 
@@ -1972,7 +1975,7 @@ index_build(Relation heapRelation,
 						 PointerGetDatum(indexRelation),
 						 PointerGetDatum(indexInfo),
 						 PointerGetDatum(oldPred),
-						 PointerGetDatum(RelationGetIndexStrategy(indexRelation)));
+			   PointerGetDatum(RelationGetIndexStrategy(indexRelation)));
 	else
 		DefaultBuild(heapRelation,
 					 indexRelation,
@@ -2087,21 +2090,22 @@ reindex_index(Oid indexId, bool force, bool inplace)
 
 #ifndef OLD_FILE_NAMING
 	if (!inplace)
-        {
-                inplace = IsSharedSystemRelationName(NameStr(iRel->rd_rel->relname));
+	{
+		inplace = IsSharedSystemRelationName(NameStr(iRel->rd_rel->relname));
 		if (!inplace)
 			setNewRelfilenode(iRel);
 	}
-#endif /* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 	/* Obtain exclusive lock on it, just to be sure */
 	LockRelation(iRel, AccessExclusiveLock);
 
 	if (inplace)
 	{
+
 		/*
-	 	 * Release any buffers associated with this index.	If they're dirty,
-	 	 * they're just dropped without bothering to flush to disk.
-	 	 */
+		 * Release any buffers associated with this index.	If they're
+		 * dirty, they're just dropped without bothering to flush to disk.
+		 */
 		DropRelationBuffers(iRel);
 
 		/* Now truncate the actual data and set blocks to zero */
@@ -2115,7 +2119,7 @@ reindex_index(Oid indexId, bool force, bool inplace)
 
 	/*
 	 * index_build will close both the heap and index relations (but not
-	 * give up the locks we hold on them).  So we're done.
+	 * give up the locks we hold on them).	So we're done.
 	 */
 
 	SetReindexProcessing(old);
@@ -2164,31 +2168,37 @@ reindex_relation(Oid relid, bool force)
 	bool		old,
 				reindexed;
 
-	bool	deactivate_needed, overwrite, upd_pg_class_inplace;
+	bool		deactivate_needed,
+				overwrite,
+				upd_pg_class_inplace;
+
 #ifdef OLD_FILE_NAMING
-	overwrite = upd_pg_class_inplace = deactivate_needed = true;	
+	overwrite = upd_pg_class_inplace = deactivate_needed = true;
 #else
-	Relation rel;
-	overwrite = upd_pg_class_inplace = deactivate_needed = false;	
+	Relation	rel;
+
+	overwrite = upd_pg_class_inplace = deactivate_needed = false;
+
 	/*
- 	 * avoid heap_update() pg_class tuples while processing
- 	 * reindex for pg_class. 
- 	 */
+	 * avoid heap_update() pg_class tuples while processing reindex for
+	 * pg_class.
+	 */
 	if (IsIgnoringSystemIndexes())
 		upd_pg_class_inplace = true;
+
 	/*
 	 * ignore the indexes of the target system relation while processing
 	 * reindex.
-	 */ 
+	 */
 	rel = RelationIdGetRelation(relid);
 	if (!IsIgnoringSystemIndexes() && IsSystemRelationName(NameStr(rel->rd_rel->relname)))
 		deactivate_needed = true;
-#ifndef	ENABLE_REINDEX_NAILED_RELATIONS
-	/* 
- 	 * nailed relations are never updated.
- 	 * We couldn't keep the consistency between the relation
- 	 * descriptors and pg_class tuples.
- 	 */
+#ifndef ENABLE_REINDEX_NAILED_RELATIONS
+
+	/*
+	 * nailed relations are never updated. We couldn't keep the
+	 * consistency between the relation descriptors and pg_class tuples.
+	 */
 	if (rel->rd_isnailed)
 	{
 		if (IsIgnoringSystemIndexes())
@@ -2199,10 +2209,11 @@ reindex_relation(Oid relid, bool force)
 		else
 			elog(ERROR, "the target relation %u is nailed", relid);
 	}
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+#endif	 /* ENABLE_REINDEX_NAILED_RELATIONS */
+
 	/*
-	 * Shared system indexes must be overwritten because it's
-	 * impossible to update pg_class tuples of all databases.
+	 * Shared system indexes must be overwritten because it's impossible
+	 * to update pg_class tuples of all databases.
 	 */
 	if (IsSharedSystemRelationName(NameStr(rel->rd_rel->relname)))
 	{
@@ -2215,7 +2226,7 @@ reindex_relation(Oid relid, bool force)
 			elog(ERROR, "the target relation %u is shared", relid);
 	}
 	RelationClose(rel);
-#endif /* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 	old = SetReindexProcessing(true);
 	if (deactivate_needed)
 	{
@@ -2252,24 +2263,27 @@ reindex_relation(Oid relid, bool force)
 	heap_endscan(scan);
 	heap_close(indexRelation, AccessShareLock);
 	if (reindexed)
-	/*
-	 * Ok,we could use the reindexed indexes of the target
-	 * system relation now.
-	 */
-	{ 
+
+		/*
+		 * Ok,we could use the reindexed indexes of the target system
+		 * relation now.
+		 */
+	{
 		if (deactivate_needed)
 		{
 			if (!overwrite && relid == RelOid_pg_class)
 			{
-				/* 
-				 * For pg_class, relhasindex should be set
-				 * to true here in place.
+
+				/*
+				 * For pg_class, relhasindex should be set to true here in
+				 * place.
 				 */
 				setRelhasindex(relid, true);
 				CommandCounterIncrement();
-				/* 
-				 * However the following setRelhasindex()
-				 * is needed to keep consistency with WAL.
+
+				/*
+				 * However the following setRelhasindex() is needed to
+				 * keep consistency with WAL.
 				 */
 			}
 			setRelhasindex(relid, true);
diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c
index 51337004cbe6d9b3ff65a518a3732969b4ffdb79..8261e9dcfcb63f82720bddbe0025b59e2cb17936 100644
--- a/src/backend/catalog/indexing.c
+++ b/src/backend/catalog/indexing.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.76 2001/01/24 19:42:51 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.77 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ CatalogCloseIndices(int nIndices, Relation *idescs)
  * NOTE: since this routine looks up all the pg_index data on each call,
  * it's relatively inefficient for inserting a large number of tuples into
  * the same catalog.  We use it only for inserting one or a few tuples
- * in a given command.  See ExecOpenIndices() and related routines if you
+ * in a given command.	See ExecOpenIndices() and related routines if you
  * are inserting tuples in bulk.
  *
  * NOTE: we do not bother to handle partial indices.  Nor do we try to
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index e9a0450a7a15673c8074b3fd5268076e3622df93..7157ffb2c98ca1b64f56a6690b85565d98ece71c 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.37 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.38 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ AggregateCreate(char *aggName,
 	Datum		values[Natts_pg_aggregate];
 	Form_pg_proc proc;
 	Oid			transfn;
-	Oid			finalfn = InvalidOid; /* can be omitted */
+	Oid			finalfn = InvalidOid;	/* can be omitted */
 	Oid			basetype;
 	Oid			transtype;
 	Oid			finaltype;
@@ -79,8 +79,8 @@ AggregateCreate(char *aggName,
 
 	/*
 	 * Handle the aggregate's base type (input data type).  This can be
-	 * specified as 'ANY' for a data-independent transition function,
-	 * such as COUNT(*).
+	 * specified as 'ANY' for a data-independent transition function, such
+	 * as COUNT(*).
 	 */
 	basetype = GetSysCacheOid(TYPENAME,
 							  PointerGetDatum(aggbasetypeName),
@@ -118,9 +118,7 @@ AggregateCreate(char *aggName,
 		nargs = 2;
 	}
 	else
-	{
 		nargs = 1;
-	}
 	tup = SearchSysCache(PROCNAME,
 						 PointerGetDatum(aggtransfnName),
 						 Int32GetDatum(nargs),
@@ -134,16 +132,17 @@ AggregateCreate(char *aggName,
 	if (proc->prorettype != transtype)
 		elog(ERROR, "AggregateCreate: return type of '%s' is not '%s'",
 			 aggtransfnName, aggtranstypeName);
+
 	/*
-	 * If the transfn is strict and the initval is NULL, make sure
-	 * input type and transtype are the same (or at least binary-
-	 * compatible), so that it's OK to use the first input value
-	 * as the initial transValue.
+	 * If the transfn is strict and the initval is NULL, make sure input
+	 * type and transtype are the same (or at least binary- compatible),
+	 * so that it's OK to use the first input value as the initial
+	 * transValue.
 	 */
 	if (proc->proisstrict && agginitval == NULL)
 	{
 		if (basetype != transtype &&
-			! IS_BINARY_COMPATIBLE(basetype, transtype))
+			!IS_BINARY_COMPATIBLE(basetype, transtype))
 			elog(ERROR, "AggregateCreate: must not omit initval when transfn is strict and transtype is not compatible with input type");
 	}
 	ReleaseSysCache(tup);
@@ -168,6 +167,7 @@ AggregateCreate(char *aggName,
 	}
 	else
 	{
+
 		/*
 		 * If no finalfn, aggregate result type is type of the state value
 		 */
diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c
index 688b96ed84b8c50a6f33234d1f890c9c9370e4e2..2becb34929ffed59ed899acbba69ab69417bbd3c 100644
--- a/src/backend/catalog/pg_largeobject.c
+++ b/src/backend/catalog/pg_largeobject.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.7 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.8 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,7 @@ LargeObjectCreate(Oid loid)
 	 */
 	for (i = 0; i < Natts_pg_largeobject; i++)
 	{
-		values[i] = (Datum)NULL;
+		values[i] = (Datum) NULL;
 		nulls[i] = ' ';
 	}
 
@@ -60,7 +60,7 @@ LargeObjectCreate(Oid loid)
 	values[i++] = Int32GetDatum(0);
 	values[i++] = DirectFunctionCall1(byteain,
 									  CStringGetDatum(""));
-	
+
 	ntup = heap_formtuple(pg_largeobject->rd_att, values, nulls);
 
 	/*
@@ -77,7 +77,7 @@ LargeObjectCreate(Oid loid)
 		CatalogIndexInsert(idescs, Num_pg_largeobject_indices, pg_largeobject, ntup);
 		CatalogCloseIndices(Num_pg_largeobject_indices, idescs);
 	}
-	
+
 	heap_close(pg_largeobject, RowExclusiveLock);
 
 	heap_freetuple(ntup);
@@ -91,9 +91,9 @@ LargeObjectDrop(Oid loid)
 	bool		found = false;
 	Relation	pg_largeobject;
 	Relation	pg_lo_idx;
-	ScanKeyData	skey[1];
+	ScanKeyData skey[1];
 	IndexScanDesc sd;
-	RetrieveIndexResult	indexRes;
+	RetrieveIndexResult indexRes;
 	HeapTupleData tuple;
 	Buffer		buffer;
 
@@ -139,9 +139,9 @@ LargeObjectExists(Oid loid)
 	bool		retval = false;
 	Relation	pg_largeobject;
 	Relation	pg_lo_idx;
-	ScanKeyData	skey[1];
+	ScanKeyData skey[1];
 	IndexScanDesc sd;
-	RetrieveIndexResult	indexRes;
+	RetrieveIndexResult indexRes;
 	HeapTupleData tuple;
 	Buffer		buffer;
 
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index d98347834144a545356e8854948754bedd3305ed..25ecf12f3b6d7a60a0b8b44162b80436dfc187a2 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.55 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.56 2001/03/22 03:59:20 momjian Exp $
  *
  * NOTES
  *	  these routines moved here from commands/define.c and somewhat cleaned up.
@@ -263,7 +263,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
 	values[i++] = NameGetDatum(&oname);
 	values[i++] = Int32GetDatum(GetUserId());
 	values[i++] = UInt16GetDatum(0);
-	values[i++] = CharGetDatum('b'); /* assume it's binary */
+	values[i++] = CharGetDatum('b');	/* assume it's binary */
 	values[i++] = BoolGetDatum(false);
 	values[i++] = BoolGetDatum(false);
 	values[i++] = ObjectIdGetDatum(leftObjectId);		/* <-- left oid */
@@ -595,7 +595,7 @@ OperatorDef(char *operatorName,
 	 */
 	if (restrictionName)
 	{							/* optional */
-		Oid		restOid;
+		Oid			restOid;
 
 		MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
 		typeId[0] = OIDOID;		/* operator OID */
@@ -623,7 +623,7 @@ OperatorDef(char *operatorName,
 	 */
 	if (joinName)
 	{							/* optional */
-		Oid		joinOid;
+		Oid			joinOid;
 
 		MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
 		typeId[0] = OIDOID;		/* operator OID */
@@ -745,7 +745,7 @@ OperatorDef(char *operatorName,
 											  otherRightTypeName);
 				if (!OidIsValid(other_oid))
 					elog(ERROR,
-						 "OperatorDef: can't create operator shell \"%s\"",
+					   "OperatorDef: can't create operator shell \"%s\"",
 						 name[j]);
 				values[i++] = ObjectIdGetDatum(other_oid);
 			}
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index e9918baebcdf7352da8fde73356df3ef7ac8135d..0872eb6e9771af997358732b0063fd0ad32b4155 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.53 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.54 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -156,7 +156,7 @@ ProcedureCreate(char *procedureName,
 			text	   *prosrctext;
 
 			prosrctext = DatumGetTextP(DirectFunctionCall1(textin,
-													CStringGetDatum(prosrc)));
+											   CStringGetDatum(prosrc)));
 			retval = GetSysCacheOid(PROSRC,
 									PointerGetDatum(prosrctext),
 									0, 0, 0);
@@ -237,18 +237,18 @@ ProcedureCreate(char *procedureName,
 			prosrc = procedureName;
 		if (fmgr_internal_function(prosrc) == InvalidOid)
 			elog(ERROR,
-				 "ProcedureCreate: there is no builtin function named \"%s\"",
+			"ProcedureCreate: there is no builtin function named \"%s\"",
 				 prosrc);
 	}
 
 	/*
 	 * If this is a dynamically loadable procedure, make sure that the
 	 * library file exists, is loadable, and contains the specified link
-	 * symbol.  Also check for a valid function information record.
+	 * symbol.	Also check for a valid function information record.
 	 *
 	 * We used to perform these checks only when the function was first
-	 * called, but it seems friendlier to verify the library's validity
-	 * at CREATE FUNCTION time.
+	 * called, but it seems friendlier to verify the library's validity at
+	 * CREATE FUNCTION time.
 	 */
 
 	if (languageObjectId == ClanguageId)
@@ -355,7 +355,8 @@ checkretval(Oid rettype, List *queryTreeList)
 	tlist = parse->targetList;
 
 	/*
-	 * The last query must be a SELECT if and only if there is a return type.
+	 * The last query must be a SELECT if and only if there is a return
+	 * type.
 	 */
 	if (rettype == InvalidOid)
 	{
@@ -375,8 +376,8 @@ checkretval(Oid rettype, List *queryTreeList)
 	tlistlen = ExecCleanTargetListLength(tlist);
 
 	/*
-	 * For base-type returns, the target list should have exactly one entry,
-	 * and its type should agree with what the user declared.
+	 * For base-type returns, the target list should have exactly one
+	 * entry, and its type should agree with what the user declared.
 	 */
 	typerelid = typeidTypeRelid(rettype);
 	if (typerelid == InvalidOid)
@@ -388,7 +389,7 @@ checkretval(Oid rettype, List *queryTreeList)
 		resnode = (Resdom *) ((TargetEntry *) lfirst(tlist))->resdom;
 		if (resnode->restype != rettype)
 			elog(ERROR, "return type mismatch in function: declared to return %s, returns %s",
-				 typeidTypeName(rettype), typeidTypeName(resnode->restype));
+			  typeidTypeName(rettype), typeidTypeName(resnode->restype));
 
 		return;
 	}
@@ -397,8 +398,8 @@ checkretval(Oid rettype, List *queryTreeList)
 	 * If the target list is of length 1, and the type of the varnode in
 	 * the target list is the same as the declared return type, this is
 	 * okay.  This can happen, for example, where the body of the function
-	 * is 'SELECT (x = func2())', where func2 has the same return type
-	 * as the function that's calling it.
+	 * is 'SELECT (x = func2())', where func2 has the same return type as
+	 * the function that's calling it.
 	 */
 	if (tlistlen == 1)
 	{
@@ -408,10 +409,10 @@ checkretval(Oid rettype, List *queryTreeList)
 	}
 
 	/*
-	 * By here, the procedure returns a tuple or set of tuples.  This part of
-	 * the typechecking is a hack. We look up the relation that is the
-	 * declared return type, and be sure that attributes 1 .. n in the target
-	 * list match the declared types.
+	 * By here, the procedure returns a tuple or set of tuples.  This part
+	 * of the typechecking is a hack. We look up the relation that is the
+	 * declared return type, and be sure that attributes 1 .. n in the
+	 * target list match the declared types.
 	 */
 	reln = heap_open(typerelid, AccessShareLock);
 	relid = reln->rd_id;
@@ -436,7 +437,7 @@ checkretval(Oid rettype, List *queryTreeList)
 				 typeidTypeName(rettype),
 				 typeidTypeName(tletype),
 				 typeidTypeName(reln->rd_att->attrs[i]->atttypid),
-				 i+1);
+				 i + 1);
 		i++;
 	}
 
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 714ea737aecb9f0866d780febd2edec8943154c1..0fbadb55b2d2da68abcb626faad02850a843322f 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.59 2001/02/12 20:07:21 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.60 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -171,24 +171,24 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
 	 */
 	i = 0;
 	namestrcpy(&name, typeName);
-	values[i++] = NameGetDatum(&name);			/* 1 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 2 */
-	values[i++] = Int16GetDatum(0);				/* 3 */
-	values[i++] = Int16GetDatum(0);				/* 4 */
-	values[i++] = BoolGetDatum(false);			/* 5 */
-	values[i++] = CharGetDatum(0);				/* 6 */
-	values[i++] = BoolGetDatum(false);			/* 7 */
-	values[i++] = CharGetDatum(0);				/* 8 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 9 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 10 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 11 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 12 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 13 */
-	values[i++] = ObjectIdGetDatum(InvalidOid);	/* 14 */
-	values[i++] = CharGetDatum('i');			/* 15 */
-	values[i++] = CharGetDatum('p');			/* 16 */
+	values[i++] = NameGetDatum(&name);	/* 1 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 2 */
+	values[i++] = Int16GetDatum(0);		/* 3 */
+	values[i++] = Int16GetDatum(0);		/* 4 */
+	values[i++] = BoolGetDatum(false);	/* 5 */
+	values[i++] = CharGetDatum(0);		/* 6 */
+	values[i++] = BoolGetDatum(false);	/* 7 */
+	values[i++] = CharGetDatum(0);		/* 8 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 9 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 10 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 11 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 12 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 13 */
+	values[i++] = ObjectIdGetDatum(InvalidOid); /* 14 */
+	values[i++] = CharGetDatum('i');	/* 15 */
+	values[i++] = CharGetDatum('p');	/* 16 */
 	values[i++] = DirectFunctionCall1(textin,
-									  CStringGetDatum(typeName));	/* 17 */
+									  CStringGetDatum(typeName));		/* 17 */
 
 	/* ----------------
 	 *	create a new type tuple with FormHeapTuple
@@ -368,16 +368,16 @@ TypeCreate(char *typeName,
 	 */
 	i = 0;
 	namestrcpy(&name, typeName);
-	values[i++] = NameGetDatum(&name);			/* 1 */
+	values[i++] = NameGetDatum(&name);	/* 1 */
 	values[i++] = Int32GetDatum(GetUserId());	/* 2 */
 	values[i++] = Int16GetDatum(internalSize);	/* 3 */
 	values[i++] = Int16GetDatum(externalSize);	/* 4 */
 	values[i++] = BoolGetDatum(passedByValue);	/* 5 */
 	values[i++] = CharGetDatum(typeType);		/* 6 */
-	values[i++] = BoolGetDatum(true);			/* 7 */
+	values[i++] = BoolGetDatum(true);	/* 7 */
 	values[i++] = CharGetDatum(typDelim);		/* 8 */
 	values[i++] = ObjectIdGetDatum(typeType == 'c' ? relationOid : InvalidOid); /* 9 */
-	values[i++] = ObjectIdGetDatum(elementObjectId); /* 10 */
+	values[i++] = ObjectIdGetDatum(elementObjectId);	/* 10 */
 
 	procs[0] = inputProcedure;
 	procs[1] = outputProcedure;
@@ -386,7 +386,7 @@ TypeCreate(char *typeName,
 
 	for (j = 0; j < 4; ++j)
 	{
-		Oid		procOid;
+		Oid			procOid;
 
 		procname = procs[j];
 
@@ -438,27 +438,27 @@ TypeCreate(char *typeName,
 				func_error("TypeCreate", procname, 1, argList, NULL);
 		}
 
-		values[i++] = ObjectIdGetDatum(procOid);	/* 11 - 14 */
+		values[i++] = ObjectIdGetDatum(procOid);		/* 11 - 14 */
 	}
 
 	/* ----------------
 	 * set default alignment
 	 * ----------------
 	 */
-	values[i++] = CharGetDatum(alignment);	/* 15 */
+	values[i++] = CharGetDatum(alignment);		/* 15 */
 
 	/* ----------------
 	 *	set default storage for TOAST
 	 * ----------------
 	 */
-	values[i++] = CharGetDatum(storage);	/* 16 */
+	values[i++] = CharGetDatum(storage);		/* 16 */
 
 	/* ----------------
 	 *	initialize the default value for this type.
 	 * ----------------
 	 */
-	values[i] = DirectFunctionCall1(textin,	/* 17 */
-				CStringGetDatum(defaultTypeValue ? defaultTypeValue : "-"));
+	values[i] = DirectFunctionCall1(textin,		/* 17 */
+			 CStringGetDatum(defaultTypeValue ? defaultTypeValue : "-"));
 
 	/* ----------------
 	 *	open pg_type and begin a scan for the type name.
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 4db0068da82fefdda1384acac22e8029a417b8e7..f4e056bd0a7e64d40785518683fe82e01228d9ea 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.14 2001/02/16 03:16:58 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.15 2001/03/22 03:59:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -86,9 +86,10 @@ analyze_rel(Oid relid, List *anal_cols2, int MESSAGE_LEVEL)
 		CommitTransactionCommand();
 		return;
 	}
+
 	/*
-	 * We can VACUUM ANALYZE any table except pg_statistic.
-	 * see update_relstats
+	 * We can VACUUM ANALYZE any table except pg_statistic. see
+	 * update_relstats
 	 */
 	if (strcmp(NameStr(((Form_pg_class) GETSTRUCT(tuple))->relname),
 			   StatisticRelationName) == 0)
@@ -104,10 +105,12 @@ analyze_rel(Oid relid, List *anal_cols2, int MESSAGE_LEVEL)
 	if (!pg_ownercheck(GetUserId(), RelationGetRelationName(onerel),
 					   RELNAME))
 	{
-		/* we already did an elog during vacuum
-		elog(NOTICE, "Skipping \"%s\" --- only table owner can VACUUM it",
-			 RelationGetRelationName(onerel));
-		*/
+
+		/*
+		 * we already did an elog during vacuum elog(NOTICE, "Skipping
+		 * \"%s\" --- only table owner can VACUUM it",
+		 * RelationGetRelationName(onerel));
+		 */
 		heap_close(onerel, NoLock);
 		CommitTransactionCommand();
 		return;
@@ -136,7 +139,7 @@ analyze_rel(Oid relid, List *anal_cols2, int MESSAGE_LEVEL)
 				if (namestrcmp(&(attr[i]->attname), col) == 0)
 					break;
 			}
-			if (i < attr_cnt)		/* found */
+			if (i < attr_cnt)	/* found */
 				attnums[tcnt++] = i;
 			else
 			{
@@ -295,15 +298,16 @@ attr_stats(Relation onerel, int attr_cnt, VacAttrStats *vacattrstats, HeapTuple
 		stats->nonnull_cnt++;
 
 		/*
-		 * If the value is toasted, detoast it to avoid repeated detoastings
-		 * and resultant memory leakage inside the comparison routines.
+		 * If the value is toasted, detoast it to avoid repeated
+		 * detoastings and resultant memory leakage inside the comparison
+		 * routines.
 		 */
 		if (!stats->attr->attbyval && stats->attr->attlen == -1)
 			value = PointerGetDatum(PG_DETOAST_DATUM(origvalue));
 		else
 			value = origvalue;
 
-		if (! stats->initialized)
+		if (!stats->initialized)
 		{
 			bucketcpy(stats->attr, value, &stats->best, &stats->best_len);
 			/* best_cnt gets incremented below */
@@ -433,7 +437,7 @@ bucketcpy(Form_pg_attribute attr, Datum value, Datum *bucket, int *bucket_len)
  *		Of course, this only works for fixed-size never-null columns, but
  *		dispersion is.
  *
- *		pg_statistic rows are just added normally.  This means that
+ *		pg_statistic rows are just added normally.	This means that
  *		pg_statistic will probably contain some deleted rows at the
  *		completion of a vacuum cycle, unless it happens to get vacuumed last.
  *
@@ -467,7 +471,7 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
 		VacAttrStats *stats;
 
 		attp = (Form_pg_attribute) GETSTRUCT(atup);
-		if (attp->attnum <= 0)		/* skip system attributes for now */
+		if (attp->attnum <= 0)	/* skip system attributes for now */
 			continue;
 
 		for (i = 0; i < natts; i++)
@@ -476,47 +480,45 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
 				break;
 		}
 		if (i >= natts)
-			continue;		/* skip attr if no stats collected */
+			continue;			/* skip attr if no stats collected */
 		stats = &(vacattrstats[i]);
 
 		if (VacAttrStatsEqValid(stats))
 		{
-			float4	selratio;	/* average ratio of rows selected
-								 * for a random constant */
+			float4		selratio;		/* average ratio of rows selected
+										 * for a random constant */
 
 			/* Compute dispersion */
 			if (stats->nonnull_cnt == 0 && stats->null_cnt == 0)
 			{
 
 				/*
-				 * empty relation, so put a dummy value in
-				 * attdispersion
+				 * empty relation, so put a dummy value in attdispersion
 				 */
 				selratio = 0;
 			}
 			else if (stats->null_cnt <= 1 && stats->best_cnt == 1)
 			{
+
 				/*
-				 * looks like we have a unique-key attribute --- flag
-				 * this with special -1.0 flag value.
+				 * looks like we have a unique-key attribute --- flag this
+				 * with special -1.0 flag value.
 				 *
-				 * The correct dispersion is 1.0/numberOfRows, but since
-				 * the relation row count can get updated without
-				 * recomputing dispersion, we want to store a
-				 * "symbolic" value and figure 1.0/numberOfRows on the
-				 * fly.
+				 * The correct dispersion is 1.0/numberOfRows, but since the
+				 * relation row count can get updated without recomputing
+				 * dispersion, we want to store a "symbolic" value and
+				 * figure 1.0/numberOfRows on the fly.
 				 */
 				selratio = -1;
 			}
 			else
 			{
 				if (VacAttrStatsLtGtValid(stats) &&
-				stats->min_cnt + stats->max_cnt == stats->nonnull_cnt)
+					stats->min_cnt + stats->max_cnt == stats->nonnull_cnt)
 				{
 
 					/*
-					 * exact result when there are just 1 or 2
-					 * values...
+					 * exact result when there are just 1 or 2 values...
 					 */
 					double		min_cnt_d = stats->min_cnt,
 								max_cnt_d = stats->max_cnt,
@@ -552,12 +554,12 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
 
 			/*
 			 * Create pg_statistic tuples for the relation, if we have
-			 * gathered the right data.  del_stats() previously
-			 * deleted all the pg_statistic tuples for the rel, so we
-			 * just have to insert new ones here.
+			 * gathered the right data.  del_stats() previously deleted
+			 * all the pg_statistic tuples for the rel, so we just have to
+			 * insert new ones here.
 			 *
-			 * Note analyze_rel() has seen to it that we won't come here
-			 * when vacuuming pg_statistic itself.
+			 * Note analyze_rel() has seen to it that we won't come here when
+			 * vacuuming pg_statistic itself.
 			 */
 			if (VacAttrStatsLtGtValid(stats) && stats->initialized)
 			{
@@ -567,7 +569,7 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
 				char	   *out_string;
 				double		best_cnt_d = stats->best_cnt,
 							null_cnt_d = stats->null_cnt,
-							nonnull_cnt_d = stats->nonnull_cnt;		/* prevent overflow */
+							nonnull_cnt_d = stats->nonnull_cnt; /* prevent overflow */
 				Datum		values[Natts_pg_statistic];
 				char		nulls[Natts_pg_statistic];
 				Relation	irelations[Num_pg_statistic_indices];
@@ -585,31 +587,31 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
 				 * ----------------
 				 */
 				i = 0;
-				values[i++] = ObjectIdGetDatum(relid);		/* starelid */
-				values[i++] = Int16GetDatum(attp->attnum);	/* staattnum */
-				values[i++] = ObjectIdGetDatum(stats->op_cmplt); /* staop */
-				values[i++] = Float4GetDatum(nullratio);	/* stanullfrac */
-				values[i++] = Float4GetDatum(bestratio);	/* stacommonfrac */
+				values[i++] = ObjectIdGetDatum(relid);	/* starelid */
+				values[i++] = Int16GetDatum(attp->attnum);		/* staattnum */
+				values[i++] = ObjectIdGetDatum(stats->op_cmplt);		/* staop */
+				values[i++] = Float4GetDatum(nullratio);		/* stanullfrac */
+				values[i++] = Float4GetDatum(bestratio);		/* stacommonfrac */
 				out_string = DatumGetCString(FunctionCall3(&out_function,
-											 stats->best,
-											 ObjectIdGetDatum(stats->typelem),
-											 Int32GetDatum(stats->attr->atttypmod)));
-				values[i++] = DirectFunctionCall1(textin,	/* stacommonval */
-												  CStringGetDatum(out_string));
+														   stats->best,
+										ObjectIdGetDatum(stats->typelem),
+								 Int32GetDatum(stats->attr->atttypmod)));
+				values[i++] = DirectFunctionCall1(textin,		/* stacommonval */
+											CStringGetDatum(out_string));
 				pfree(out_string);
 				out_string = DatumGetCString(FunctionCall3(&out_function,
-											 stats->min,
-											 ObjectIdGetDatum(stats->typelem),
-											 Int32GetDatum(stats->attr->atttypmod)));
-				values[i++] = DirectFunctionCall1(textin,	/* staloval */
-												  CStringGetDatum(out_string));
+														   stats->min,
+										ObjectIdGetDatum(stats->typelem),
+								 Int32GetDatum(stats->attr->atttypmod)));
+				values[i++] = DirectFunctionCall1(textin,		/* staloval */
+											CStringGetDatum(out_string));
 				pfree(out_string);
 				out_string = DatumGetCString(FunctionCall3(&out_function,
-											 stats->max,
-											 ObjectIdGetDatum(stats->typelem),
-											 Int32GetDatum(stats->attr->atttypmod)));
-				values[i++] = DirectFunctionCall1(textin,	/* stahival */
-												  CStringGetDatum(out_string));
+														   stats->max,
+										ObjectIdGetDatum(stats->typelem),
+								 Int32GetDatum(stats->attr->atttypmod)));
+				values[i++] = DirectFunctionCall1(textin,		/* stahival */
+											CStringGetDatum(out_string));
 				pfree(out_string);
 
 				stup = heap_formtuple(sd->rd_att, values, nulls);
@@ -682,6 +684,3 @@ del_stats(Oid relid, int attcnt, int *attnums)
 	 */
 	heap_close(pgstatistic, NoLock);
 }
-
-
-
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 134f3b7af0e811f350618a0367e60e696b0c4a7e..1eb29dcc99a624b7aed0e7dbf065b631da1e4886 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.76 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.77 2001/03/22 03:59:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -130,7 +130,7 @@ static void NotifyMyFrontEnd(char *relname, int32 listenerPID);
 static int	AsyncExistsPendingNotify(char *relname);
 static void ClearPendingNotifies(void);
 
-bool Trace_notify = false;
+bool		Trace_notify = false;
 
 
 /*
@@ -161,6 +161,7 @@ Async_Notify(char *relname)
 	/* no point in making duplicate entries in the list ... */
 	if (!AsyncExistsPendingNotify(relname))
 	{
+
 		/*
 		 * We allocate list memory from the global malloc pool to ensure
 		 * that it will live until we want to use it.  This is probably
@@ -349,9 +350,7 @@ Async_UnlistenAll()
 	sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
 
 	while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
-	{
 		simple_heap_delete(lRel, &lTuple->t_self);
-	}
 
 	heap_endscan(sRel);
 	heap_close(lRel, AccessExclusiveLock);
@@ -499,6 +498,7 @@ AtCommit_Notify()
 				 */
 				if (kill(listenerPID, SIGUSR2) < 0)
 				{
+
 					/*
 					 * Get rid of pg_listener entry if it refers to a PID
 					 * that no longer exists.  Presumably, that backend
@@ -794,7 +794,7 @@ ProcessIncomingNotify(void)
 
 			if (Trace_notify)
 				elog(DEBUG, "ProcessIncomingNotify: received %s from %d",
-					relname, (int) sourcePID);
+					 relname, (int) sourcePID);
 
 			NotifyMyFrontEnd(relname, sourcePID);
 			/* Rewrite the tuple with 0 in notification column */
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 76f805ca86c7c12f1b1061a280a6530c243808e2..826407c8eb6c8c83a4bb78dd3a53f4343775e26a 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.64 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.65 2001/03/22 03:59:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@
 #include "utils/temprel.h"
 
 
-static Oid copy_heap(Oid OIDOldHeap, char *NewName, bool istemp);
+static Oid	copy_heap(Oid OIDOldHeap, char *NewName, bool istemp);
 static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap, char *NewIndexName);
 static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
 
@@ -75,8 +75,8 @@ cluster(char *oldrelname, char *oldindexname)
 	StrNCpy(saveoldindexname, oldindexname, NAMEDATALEN);
 
 	/*
-	 * We grab exclusive access to the target rel and index for the duration
-	 * of the transaction.
+	 * We grab exclusive access to the target rel and index for the
+	 * duration of the transaction.
 	 */
 	OldHeap = heap_openr(saveoldrelname, AccessExclusiveLock);
 	OIDOldHeap = RelationGetRelid(OldHeap);
@@ -154,8 +154,8 @@ copy_heap(Oid OIDOldHeap, char *NewName, bool istemp)
 	OldHeapDesc = RelationGetDescr(OldHeap);
 
 	/*
-	 * Need to make a copy of the tuple descriptor,
-	 * since heap_create_with_catalog modifies it.
+	 * Need to make a copy of the tuple descriptor, since
+	 * heap_create_with_catalog modifies it.
 	 */
 	tupdesc = CreateTupleDescCopyConstr(OldHeapDesc);
 
@@ -164,16 +164,15 @@ copy_heap(Oid OIDOldHeap, char *NewName, bool istemp)
 										  allowSystemTableMods);
 
 	/*
-	 * Advance command counter so that the newly-created
-	 * relation's catalog tuples will be visible to heap_open.
+	 * Advance command counter so that the newly-created relation's
+	 * catalog tuples will be visible to heap_open.
 	 */
 	CommandCounterIncrement();
 
 	/*
-	 * If necessary, create a TOAST table for the new relation.
-	 * Note that AlterTableCreateToastTable ends with
-	 * CommandCounterIncrement(), so that the TOAST table will
-	 * be visible for insertion.
+	 * If necessary, create a TOAST table for the new relation. Note that
+	 * AlterTableCreateToastTable ends with CommandCounterIncrement(), so
+	 * that the TOAST table will be visible for insertion.
 	 */
 	AlterTableCreateToastTable(NewName, true);
 
@@ -198,12 +197,12 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap, char *NewIndexName)
 
 	/*
 	 * Create a new index like the old one.  To do this I get the info
-	 * from pg_index, and add a new index with a temporary name (that
-	 * will be changed later).
+	 * from pg_index, and add a new index with a temporary name (that will
+	 * be changed later).
 	 *
-	 * NOTE: index_create will cause the new index to be a temp relation
-	 * if its parent table is, so we don't need to do anything special
-	 * for the temp-table case here.
+	 * NOTE: index_create will cause the new index to be a temp relation if
+	 * its parent table is, so we don't need to do anything special for
+	 * the temp-table case here.
 	 */
 	Old_pg_index_Tuple = SearchSysCache(INDEXRELID,
 										ObjectIdGetDatum(OIDOldIndex),
@@ -214,7 +213,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap, char *NewIndexName)
 	indexInfo = BuildIndexInfo(Old_pg_index_Tuple);
 
 	Old_pg_index_relation_Tuple = SearchSysCache(RELOID,
-												 ObjectIdGetDatum(OIDOldIndex),
+										   ObjectIdGetDatum(OIDOldIndex),
 												 0, 0, 0);
 	Assert(Old_pg_index_relation_Tuple);
 	Old_pg_index_relation_Form = (Form_pg_class) GETSTRUCT(Old_pg_index_relation_Tuple);
@@ -266,13 +265,15 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
 		LocalHeapTuple.t_datamcxt = NULL;
 		LocalHeapTuple.t_data = NULL;
 		heap_fetch(LocalOldHeap, SnapshotNow, &LocalHeapTuple, &LocalBuffer);
-		if (LocalHeapTuple.t_data != NULL) {
+		if (LocalHeapTuple.t_data != NULL)
+		{
+
 			/*
 			 * We must copy the tuple because heap_insert() will overwrite
 			 * the commit-status fields of the tuple it's handed, and the
 			 * retrieved tuple will actually be in a disk buffer!  Thus,
-			 * the source relation would get trashed, which is bad news
-			 * if we abort later on.  (This was a bug in releases thru 7.0)
+			 * the source relation would get trashed, which is bad news if
+			 * we abort later on.  (This was a bug in releases thru 7.0)
 			 */
 			HeapTuple	copiedTuple = heap_copytuple(&LocalHeapTuple);
 
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 8a3be15a052d063527c7923d7e980184b64b0ff4..49d1edf4c4b8fd7a6650cbc5902f7b070ef04913 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.122 2001/02/27 22:07:34 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.123 2001/03/22 03:59:21 momjian Exp $
  *
  * NOTES
  *	  The PerformAddAttribute() code, like most of the relation
@@ -173,29 +173,29 @@ PerformPortalFetch(char *name,
 	 *	at the end of the available tuples in that direction.  If so, do
 	 *	nothing.  (This check exists because not all plan node types are
 	 *	robust about being called again if they've already returned NULL
-	 *	once.)  If it's OK to do the fetch, call the executor.  Then,
+	 *	once.)	If it's OK to do the fetch, call the executor.  Then,
 	 *	update the atStart/atEnd state depending on the number of tuples
 	 *	that were retrieved.
 	 * ----------------
 	 */
 	if (forward)
 	{
-		if (! portal->atEnd)
+		if (!portal->atEnd)
 		{
 			ExecutorRun(queryDesc, estate, EXEC_FOR, (long) count);
 			if (estate->es_processed > 0)
-				portal->atStart = false; /* OK to back up now */
+				portal->atStart = false;		/* OK to back up now */
 			if (count <= 0 || (int) estate->es_processed < count)
-				portal->atEnd = true; /* we retrieved 'em all */
+				portal->atEnd = true;	/* we retrieved 'em all */
 		}
 	}
 	else
 	{
-		if (! portal->atStart)
+		if (!portal->atStart)
 		{
 			ExecutorRun(queryDesc, estate, EXEC_BACK, (long) count);
 			if (estate->es_processed > 0)
-				portal->atEnd = false; /* OK to go forward now */
+				portal->atEnd = false;	/* OK to go forward now */
 			if (count <= 0 || (int) estate->es_processed < count)
 				portal->atStart = true; /* we retrieved 'em all */
 		}
@@ -502,8 +502,8 @@ AlterTableAddColumn(const char *relationName,
 	heap_close(rel, NoLock);
 
 	/*
-	 * Automatically create the secondary relation for TOAST
-	 * if it formerly had no such but now has toastable attributes.
+	 * Automatically create the secondary relation for TOAST if it
+	 * formerly had no such but now has toastable attributes.
 	 */
 	CommandCounterIncrement();
 	AlterTableCreateToastTable(relationName, true);
@@ -842,7 +842,7 @@ RemoveColumnReferences(Oid reloid, int attnum, bool checkonly, HeapTuple reltup)
 
 		relcheck = (Form_pg_relcheck) GETSTRUCT(htup);
 		ccbin = DatumGetCString(DirectFunctionCall1(textout,
-										PointerGetDatum(&relcheck->rcbin)));
+									 PointerGetDatum(&relcheck->rcbin)));
 		node = stringToNode(ccbin);
 		pfree(ccbin);
 		if (find_attribute_in_node(node, attnum))
@@ -890,7 +890,7 @@ RemoveColumnReferences(Oid reloid, int attnum, bool checkonly, HeapTuple reltup)
 				else
 				{
 					htup = SearchSysCache(RELOID,
-										  ObjectIdGetDatum(index->indexrelid),
+									 ObjectIdGetDatum(index->indexrelid),
 										  0, 0, 0);
 					RemoveIndex(NameStr(((Form_pg_class) GETSTRUCT(htup))->relname));
 					ReleaseSysCache(htup);
@@ -1106,339 +1106,361 @@ AlterTableAddConstraint(char *relationName,
 #endif
 
 	/* Disallow ADD CONSTRAINT on views, indexes, sequences, etc */
-	if (! is_relation(relationName))
+	if (!is_relation(relationName))
 		elog(ERROR, "ALTER TABLE ADD CONSTRAINT: %s is not a table",
 			 relationName);
 
 	switch (nodeTag(newConstraint))
 	{
 		case T_Constraint:
-		{
-			Constraint *constr = (Constraint *) newConstraint;
-
-			switch (constr->contype)
 			{
-				case CONSTR_CHECK:
+				Constraint *constr = (Constraint *) newConstraint;
+
+				switch (constr->contype)
 				{
-					ParseState *pstate;
-					bool successful = true;
-					HeapScanDesc scan;
-					ExprContext *econtext;
-					TupleTableSlot *slot;
-					HeapTuple tuple;
-					RangeTblEntry *rte;
-					List       *qual;
-					List       *constlist;
-					Relation	rel;
-					Node *expr;
-					char *name;
-
-					if (constr->name)
-						name = constr->name;
-					else
-						name = "<unnamed>";
-
-					constlist = makeList1(constr);
-
-					rel = heap_openr(relationName, AccessExclusiveLock);
-
-					/* make sure it is not a view */
-					if (rel->rd_rel->relkind == RELKIND_VIEW)
-						elog(ERROR, "ALTER TABLE: cannot add constraint to a view");
-
-					/*
-					 * Scan all of the rows, looking for a false match
-					 */
-					scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
-					AssertState(scan != NULL);
-
-					/*
-					 * We need to make a parse state and range table to allow
-					 * us to transformExpr and fix_opids to get a version of
-					 * the expression we can pass to ExecQual
-					 */
-					pstate = make_parsestate(NULL);
-					rte = addRangeTableEntry(pstate, relationName, NULL,
-											 false, true);
-					addRTEtoQuery(pstate, rte, true, true);
-
-					/* Convert the A_EXPR in raw_expr into an EXPR */
-					expr = transformExpr(pstate, constr->raw_expr,
-										 EXPR_COLUMN_FIRST);
-
-					/*
-					 * Make sure it yields a boolean result.
-					 */
-					if (exprType(expr) != BOOLOID)
-						elog(ERROR, "CHECK '%s' does not yield boolean result",
-							 name);
-
-					/*
-					 * Make sure no outside relations are referred to.
-					 */
-					if (length(pstate->p_rtable) != 1)
-						elog(ERROR, "Only relation '%s' can be referenced in CHECK",
-							 relationName);
-
-					/*
-					 * Might as well try to reduce any constant expressions.
-					 */
-					expr = eval_const_expressions(expr);
-
-					/* And fix the opids */
-					fix_opids(expr);
-
-					qual = makeList1(expr);
-
-					/* Make tuple slot to hold tuples */
-					slot = MakeTupleTableSlot();
-					ExecSetSlotDescriptor(slot, RelationGetDescr(rel), false);
-					/* Make an expression context for ExecQual */
-					econtext = MakeExprContext(slot, CurrentMemoryContext);
-
-					/*
-					 * Scan through the rows now, checking the expression
-					 * at each row.
-					 */
-					while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
-					{
-						ExecStoreTuple(tuple, slot, InvalidBuffer, false);
-						if (!ExecQual(qual, econtext, true))
+					case CONSTR_CHECK:
 						{
-							successful=false;
-							break;
-						}
-						ResetExprContext(econtext);
-					}
+							ParseState *pstate;
+							bool		successful = true;
+							HeapScanDesc scan;
+							ExprContext *econtext;
+							TupleTableSlot *slot;
+							HeapTuple	tuple;
+							RangeTblEntry *rte;
+							List	   *qual;
+							List	   *constlist;
+							Relation	rel;
+							Node	   *expr;
+							char	   *name;
+
+							if (constr->name)
+								name = constr->name;
+							else
+								name = "<unnamed>";
+
+							constlist = makeList1(constr);
+
+							rel = heap_openr(relationName, AccessExclusiveLock);
+
+							/* make sure it is not a view */
+							if (rel->rd_rel->relkind == RELKIND_VIEW)
+								elog(ERROR, "ALTER TABLE: cannot add constraint to a view");
+
+							/*
+							 * Scan all of the rows, looking for a false
+							 * match
+							 */
+							scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
+							AssertState(scan != NULL);
+
+							/*
+							 * We need to make a parse state and range
+							 * table to allow us to transformExpr and
+							 * fix_opids to get a version of the
+							 * expression we can pass to ExecQual
+							 */
+							pstate = make_parsestate(NULL);
+							rte = addRangeTableEntry(pstate, relationName, NULL,
+													 false, true);
+							addRTEtoQuery(pstate, rte, true, true);
+
+							/* Convert the A_EXPR in raw_expr into an EXPR */
+							expr = transformExpr(pstate, constr->raw_expr,
+												 EXPR_COLUMN_FIRST);
+
+							/*
+							 * Make sure it yields a boolean result.
+							 */
+							if (exprType(expr) != BOOLOID)
+								elog(ERROR, "CHECK '%s' does not yield boolean result",
+									 name);
+
+							/*
+							 * Make sure no outside relations are referred
+							 * to.
+							 */
+							if (length(pstate->p_rtable) != 1)
+								elog(ERROR, "Only relation '%s' can be referenced in CHECK",
+									 relationName);
+
+							/*
+							 * Might as well try to reduce any constant
+							 * expressions.
+							 */
+							expr = eval_const_expressions(expr);
+
+							/* And fix the opids */
+							fix_opids(expr);
+
+							qual = makeList1(expr);
+
+							/* Make tuple slot to hold tuples */
+							slot = MakeTupleTableSlot();
+							ExecSetSlotDescriptor(slot, RelationGetDescr(rel), false);
+							/* Make an expression context for ExecQual */
+							econtext = MakeExprContext(slot, CurrentMemoryContext);
+
+							/*
+							 * Scan through the rows now, checking the
+							 * expression at each row.
+							 */
+							while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
+							{
+								ExecStoreTuple(tuple, slot, InvalidBuffer, false);
+								if (!ExecQual(qual, econtext, true))
+								{
+									successful = false;
+									break;
+								}
+								ResetExprContext(econtext);
+							}
 
-					FreeExprContext(econtext);
-					pfree(slot);
+							FreeExprContext(econtext);
+							pfree(slot);
 
-					heap_endscan(scan);
+							heap_endscan(scan);
 
-					if (!successful)
-					{
-						heap_close(rel, NoLock);
-						elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name);
-					}
-					/*
-					 * Call AddRelationRawConstraints to do the real adding --
-					 * It duplicates some of the above, but does not check the
-					 * validity of the constraint against tuples already in
-					 * the table.
-					 */
-					AddRelationRawConstraints(rel, NIL, constlist);
-					heap_close(rel, NoLock);
-					pfree(constlist);
-
-					break;
+							if (!successful)
+							{
+								heap_close(rel, NoLock);
+								elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name);
+							}
+
+							/*
+							 * Call AddRelationRawConstraints to do the
+							 * real adding -- It duplicates some of the
+							 * above, but does not check the validity of
+							 * the constraint against tuples already in
+							 * the table.
+							 */
+							AddRelationRawConstraints(rel, NIL, constlist);
+							heap_close(rel, NoLock);
+							pfree(constlist);
+
+							break;
+						}
+					default:
+						elog(ERROR, "ALTER TABLE / ADD CONSTRAINT is not implemented for that constraint type.");
 				}
-				default:
-					elog(ERROR, "ALTER TABLE / ADD CONSTRAINT is not implemented for that constraint type.");
+				break;
 			}
-			break;
-		}
 		case T_FkConstraint:
-		{
-			FkConstraint *fkconstraint = (FkConstraint *) newConstraint;
-			Relation	rel, pkrel;
-			HeapScanDesc scan;
-			HeapTuple	tuple;
-			Trigger		trig;
-			List	   *list;
-			int			count;
-			List       *indexoidlist,
-				*indexoidscan;
-			Form_pg_attribute *rel_attrs = NULL;
-			int			i;
-			bool		found = false;
-
-			if (is_temp_rel_name(fkconstraint->pktable_name) &&
-				!is_temp_rel_name(relationName))
-				elog(ERROR, "ALTER TABLE / ADD CONSTRAINT: Unable to reference temporary table from permanent table constraint.");
-
-			/*
-			 * Grab an exclusive lock on the pk table, so that someone
-			 * doesn't delete rows out from under us.
-			 */
-
-			pkrel = heap_openr(fkconstraint->pktable_name, AccessExclusiveLock);
-			if (pkrel->rd_rel->relkind != RELKIND_RELATION)
-				elog(ERROR, "referenced table \"%s\" not a relation",
-					 fkconstraint->pktable_name);
-
-			/*
-			 * Grab an exclusive lock on the fk table, and then scan
-			 * through each tuple, calling the RI_FKey_Match_Ins
-			 * (insert trigger) as if that tuple had just been
-			 * inserted.  If any of those fail, it should elog(ERROR)
-			 * and that's that.
-			 */
-			rel = heap_openr(relationName, AccessExclusiveLock);
-			if (rel->rd_rel->relkind != RELKIND_RELATION)
-				elog(ERROR, "referencing table \"%s\" not a relation",
-					 relationName);
-
-			/* First we check for limited correctness of the constraint */
-
-			rel_attrs = pkrel->rd_att->attrs;
-			indexoidlist = RelationGetIndexList(pkrel);
-
-			foreach(indexoidscan, indexoidlist)
 			{
-				Oid             indexoid = lfirsti(indexoidscan);
-				HeapTuple       indexTuple;
-				Form_pg_index	indexStruct;
-
-				indexTuple = SearchSysCache(INDEXRELID,
-											ObjectIdGetDatum(indexoid),
-											0, 0, 0);
-				if (!HeapTupleIsValid(indexTuple))
-					elog(ERROR, "transformFkeyGetPrimaryKey: index %u not found",
-						 indexoid);
-				indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
-
-				if (indexStruct->indisunique)
+				FkConstraint *fkconstraint = (FkConstraint *) newConstraint;
+				Relation	rel,
+							pkrel;
+				HeapScanDesc scan;
+				HeapTuple	tuple;
+				Trigger		trig;
+				List	   *list;
+				int			count;
+				List	   *indexoidlist,
+						   *indexoidscan;
+				Form_pg_attribute *rel_attrs = NULL;
+				int			i;
+				bool		found = false;
+
+				if (is_temp_rel_name(fkconstraint->pktable_name) &&
+					!is_temp_rel_name(relationName))
+					elog(ERROR, "ALTER TABLE / ADD CONSTRAINT: Unable to reference temporary table from permanent table constraint.");
+
+				/*
+				 * Grab an exclusive lock on the pk table, so that someone
+				 * doesn't delete rows out from under us.
+				 */
+
+				pkrel = heap_openr(fkconstraint->pktable_name, AccessExclusiveLock);
+				if (pkrel->rd_rel->relkind != RELKIND_RELATION)
+					elog(ERROR, "referenced table \"%s\" not a relation",
+						 fkconstraint->pktable_name);
+
+				/*
+				 * Grab an exclusive lock on the fk table, and then scan
+				 * through each tuple, calling the RI_FKey_Match_Ins
+				 * (insert trigger) as if that tuple had just been
+				 * inserted.  If any of those fail, it should elog(ERROR)
+				 * and that's that.
+				 */
+				rel = heap_openr(relationName, AccessExclusiveLock);
+				if (rel->rd_rel->relkind != RELKIND_RELATION)
+					elog(ERROR, "referencing table \"%s\" not a relation",
+						 relationName);
+
+				/*
+				 * First we check for limited correctness of the
+				 * constraint
+				 */
+
+				rel_attrs = pkrel->rd_att->attrs;
+				indexoidlist = RelationGetIndexList(pkrel);
+
+				foreach(indexoidscan, indexoidlist)
 				{
-					List	   *attrl;
-
-					/* Make sure this index has the same number of keys -- It obviously
-					 * won't match otherwise. */
-					for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++);
-					if (i!=length(fkconstraint->pk_attrs))
-						found=false;
-					else {
-						/* go through the fkconstraint->pk_attrs list */
-						foreach(attrl, fkconstraint->pk_attrs)
-						{
-							Ident *attr=lfirst(attrl);
+					Oid			indexoid = lfirsti(indexoidscan);
+					HeapTuple	indexTuple;
+					Form_pg_index indexStruct;
+
+					indexTuple = SearchSysCache(INDEXRELID,
+											  ObjectIdGetDatum(indexoid),
+												0, 0, 0);
+					if (!HeapTupleIsValid(indexTuple))
+						elog(ERROR, "transformFkeyGetPrimaryKey: index %u not found",
+							 indexoid);
+					indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
+
+					if (indexStruct->indisunique)
+					{
+						List	   *attrl;
+
+						/*
+						 * Make sure this index has the same number of
+						 * keys -- It obviously won't match otherwise.
+						 */
+						for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++);
+						if (i != length(fkconstraint->pk_attrs))
 							found = false;
-							for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++)
+						else
+						{
+							/* go through the fkconstraint->pk_attrs list */
+							foreach(attrl, fkconstraint->pk_attrs)
 							{
-								int pkattno = indexStruct->indkey[i];
-								if (pkattno>0)
+								Ident	   *attr = lfirst(attrl);
+
+								found = false;
+								for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++)
 								{
-									char *name = NameStr(rel_attrs[pkattno-1]->attname);
-									if (strcmp(name, attr->name)==0)
+									int			pkattno = indexStruct->indkey[i];
+
+									if (pkattno > 0)
 									{
-										found = true;
-										break;
+										char	   *name = NameStr(rel_attrs[pkattno - 1]->attname);
+
+										if (strcmp(name, attr->name) == 0)
+										{
+											found = true;
+											break;
+										}
 									}
 								}
+								if (!found)
+									break;
 							}
-							if (!found)
-								break;
 						}
 					}
+					ReleaseSysCache(indexTuple);
+					if (found)
+						break;
 				}
-				ReleaseSysCache(indexTuple);
-				if (found)
-					break;
-			}
 
-			if (!found)
-				elog(ERROR, "UNIQUE constraint matching given keys for referenced table \"%s\" not found",
-					 fkconstraint->pktable_name);
+				if (!found)
+					elog(ERROR, "UNIQUE constraint matching given keys for referenced table \"%s\" not found",
+						 fkconstraint->pktable_name);
 
-			freeList(indexoidlist);
-			heap_close(pkrel, NoLock);
+				freeList(indexoidlist);
+				heap_close(pkrel, NoLock);
 
-			rel_attrs = rel->rd_att->attrs;
-			if (fkconstraint->fk_attrs!=NIL) {
-				List *fkattrs;
-				Ident *fkattr;
+				rel_attrs = rel->rd_att->attrs;
+				if (fkconstraint->fk_attrs != NIL)
+				{
+					List	   *fkattrs;
+					Ident	   *fkattr;
 
-				found = false;
-				foreach(fkattrs, fkconstraint->fk_attrs) {
-					int count;
 					found = false;
-					fkattr=lfirst(fkattrs);
-					for (count = 0; count < rel->rd_att->natts; count++) {
-						char *name = NameStr(rel->rd_att->attrs[count]->attname);
-						if (strcmp(name, fkattr->name)==0) {
-							found = true;
-							break;
+					foreach(fkattrs, fkconstraint->fk_attrs)
+					{
+						int			count;
+
+						found = false;
+						fkattr = lfirst(fkattrs);
+						for (count = 0; count < rel->rd_att->natts; count++)
+						{
+							char	   *name = NameStr(rel->rd_att->attrs[count]->attname);
+
+							if (strcmp(name, fkattr->name) == 0)
+							{
+								found = true;
+								break;
+							}
 						}
+						if (!found)
+							break;
 					}
 					if (!found)
-						break;
+						elog(ERROR, "columns referenced in foreign key constraint not found.");
 				}
-				if (!found)
-					elog(ERROR, "columns referenced in foreign key constraint not found.");
-			}
 
-			trig.tgoid = 0;
-			if (fkconstraint->constr_name)
-				trig.tgname = fkconstraint->constr_name;
-			else
-				trig.tgname = "<unknown>";
-			trig.tgfoid = 0;
-			trig.tgtype = 0;
-			trig.tgenabled = TRUE;
-			trig.tgisconstraint = TRUE;
-			trig.tginitdeferred = FALSE;
-			trig.tgdeferrable = FALSE;
-
-			trig.tgargs = (char **) palloc(
-				sizeof(char *) * (4 + length(fkconstraint->fk_attrs)
-								  + length(fkconstraint->pk_attrs)));
-
-			if (fkconstraint->constr_name)
-				trig.tgargs[0] = fkconstraint->constr_name;
-			else
-				trig.tgargs[0] = "<unknown>";
-			trig.tgargs[1] = (char *) relationName;
-			trig.tgargs[2] = fkconstraint->pktable_name;
-			trig.tgargs[3] = fkconstraint->match_type;
-			count = 4;
-			foreach(list, fkconstraint->fk_attrs)
+				trig.tgoid = 0;
+				if (fkconstraint->constr_name)
+					trig.tgname = fkconstraint->constr_name;
+				else
+					trig.tgname = "<unknown>";
+				trig.tgfoid = 0;
+				trig.tgtype = 0;
+				trig.tgenabled = TRUE;
+				trig.tgisconstraint = TRUE;
+				trig.tginitdeferred = FALSE;
+				trig.tgdeferrable = FALSE;
+
+				trig.tgargs = (char **) palloc(
+					 sizeof(char *) * (4 + length(fkconstraint->fk_attrs)
+									   + length(fkconstraint->pk_attrs)));
+
+				if (fkconstraint->constr_name)
+					trig.tgargs[0] = fkconstraint->constr_name;
+				else
+					trig.tgargs[0] = "<unknown>";
+				trig.tgargs[1] = (char *) relationName;
+				trig.tgargs[2] = fkconstraint->pktable_name;
+				trig.tgargs[3] = fkconstraint->match_type;
+				count = 4;
+				foreach(list, fkconstraint->fk_attrs)
 				{
 					Ident	   *fk_at = lfirst(list);
 
 					trig.tgargs[count] = fk_at->name;
-					count+=2;
+					count += 2;
 				}
-			count = 5;
-			foreach(list, fkconstraint->pk_attrs)
+				count = 5;
+				foreach(list, fkconstraint->pk_attrs)
 				{
 					Ident	   *pk_at = lfirst(list);
 
 					trig.tgargs[count] = pk_at->name;
-					count+=2;
+					count += 2;
 				}
-			trig.tgnargs = count-1;
+				trig.tgnargs = count - 1;
 
-			scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
-			AssertState(scan != NULL);
+				scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
+				AssertState(scan != NULL);
 
-			while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
-			{
-				/* Make a call to the check function */
-				/* No parameters are passed, but we do set a context */
-				FunctionCallInfoData	fcinfo;
-				TriggerData				trigdata;
+				while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
+				{
+					/* Make a call to the check function */
+					/* No parameters are passed, but we do set a context */
+					FunctionCallInfoData fcinfo;
+					TriggerData trigdata;
 
-				MemSet(&fcinfo, 0, sizeof(fcinfo));
-				/* We assume RI_FKey_check_ins won't look at flinfo... */
+					MemSet(&fcinfo, 0, sizeof(fcinfo));
+					/* We assume RI_FKey_check_ins won't look at flinfo... */
 
-				trigdata.type = T_TriggerData;
-				trigdata.tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
-				trigdata.tg_relation = rel;
-				trigdata.tg_trigtuple = tuple;
-				trigdata.tg_newtuple = NULL;
-				trigdata.tg_trigger = &trig;
+					trigdata.type = T_TriggerData;
+					trigdata.tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
+					trigdata.tg_relation = rel;
+					trigdata.tg_trigtuple = tuple;
+					trigdata.tg_newtuple = NULL;
+					trigdata.tg_trigger = &trig;
 
-				fcinfo.context = (Node *) &trigdata;
+					fcinfo.context = (Node *) &trigdata;
 
-				RI_FKey_check_ins(&fcinfo);
-			}
-			heap_endscan(scan);
-			heap_close(rel, NoLock);		/* close rel but keep
-											 * lock! */
+					RI_FKey_check_ins(&fcinfo);
+				}
+				heap_endscan(scan);
+				heap_close(rel, NoLock);		/* close rel but keep
+												 * lock! */
 
-			pfree(trig.tgargs);
-			break;
-		}
+				pfree(trig.tgargs);
+				break;
+			}
 		default:
 			elog(ERROR, "ALTER TABLE / ADD CONSTRAINT unable to determine type of constraint passed");
 	}
@@ -1464,15 +1486,15 @@ AlterTableDropConstraint(const char *relationName,
 void
 AlterTableOwner(const char *relationName, const char *newOwnerName)
 {
-	Relation 	class_rel;
-	HeapTuple 	tuple;
+	Relation	class_rel;
+	HeapTuple	tuple;
 	int32		newOwnerSysid;
 	Relation	idescs[Num_pg_class_indices];
 
 	/*
 	 * first check that we are a superuser
 	 */
-	if (! superuser())
+	if (!superuser())
 		elog(ERROR, "ALTER TABLE: permission denied");
 
 	/*
@@ -1537,21 +1559,21 @@ AlterTableOwner(const char *relationName, const char *newOwnerName)
 void
 AlterTableCreateToastTable(const char *relationName, bool silent)
 {
-	Relation			rel;
-	Oid					myrelid;
-	HeapTuple			reltup;
-	HeapTupleData		classtuple;
-	TupleDesc			tupdesc;
-	Relation			class_rel;
-	Buffer				buffer;
-	Relation			ridescs[Num_pg_class_indices];
-	Oid					toast_relid;
-	Oid					toast_idxid;
-	char				toast_relname[NAMEDATALEN + 1];
-	char				toast_idxname[NAMEDATALEN + 1];
-	Relation			toast_idxrel;
-	IndexInfo		   *indexInfo;
-	Oid					classObjectId[1];
+	Relation	rel;
+	Oid			myrelid;
+	HeapTuple	reltup;
+	HeapTupleData classtuple;
+	TupleDesc	tupdesc;
+	Relation	class_rel;
+	Buffer		buffer;
+	Relation	ridescs[Num_pg_class_indices];
+	Oid			toast_relid;
+	Oid			toast_idxid;
+	char		toast_relname[NAMEDATALEN + 1];
+	char		toast_idxname[NAMEDATALEN + 1];
+	Relation	toast_idxrel;
+	IndexInfo  *indexInfo;
+	Oid			classObjectId[1];
 
 	/*
 	 * permissions checking.  XXX exactly what is appropriate here?
@@ -1618,7 +1640,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
 	/*
 	 * Check to see whether the table actually needs a TOAST table.
 	 */
-	if (! needs_toast_table(rel))
+	if (!needs_toast_table(rel))
 	{
 		if (silent)
 		{
@@ -1652,10 +1674,11 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
 					   "chunk_data",
 					   BYTEAOID,
 					   -1, 0, false);
+
 	/*
-	 * Ensure that the toast table doesn't itself get toasted,
-	 * or we'll be toast :-(.  This is essential for chunk_data because
-	 * type bytea is toastable; hit the other two just to be sure.
+	 * Ensure that the toast table doesn't itself get toasted, or we'll be
+	 * toast :-(.  This is essential for chunk_data because type bytea is
+	 * toastable; hit the other two just to be sure.
 	 */
 	tupdesc->attrs[0]->attstorage = 'p';
 	tupdesc->attrs[1]->attstorage = 'p';
@@ -1733,7 +1756,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
 }
 
 /*
- * Check to see whether the table needs a TOAST table.  It does only if
+ * Check to see whether the table needs a TOAST table.	It does only if
  * (1) there are any toastable attributes, and (2) the maximum length
  * of a tuple could exceed TOAST_TUPLE_THRESHOLD.  (We don't want to
  * create a toast table for something like "f1 varchar(20)".)
@@ -1745,7 +1768,7 @@ needs_toast_table(Relation rel)
 	bool		maxlength_unknown = false;
 	bool		has_toastable_attrs = false;
 	TupleDesc	tupdesc;
-	Form_pg_attribute  *att;
+	Form_pg_attribute *att;
 	int32		tuple_length;
 	int			i;
 
@@ -1762,8 +1785,8 @@ needs_toast_table(Relation rel)
 		}
 		else
 		{
-			int32	maxlen = type_maximum_size(att[i]->atttypid,
-											   att[i]->atttypmod);
+			int32		maxlen = type_maximum_size(att[i]->atttypid,
+												   att[i]->atttypmod);
 
 			if (maxlen < 0)
 				maxlength_unknown = true;
@@ -1798,7 +1821,7 @@ LockTableCommand(LockStmt *lockstmt)
 	rel = heap_openr(lockstmt->relname, NoLock);
 
 	if (rel->rd_rel->relkind != RELKIND_RELATION)
-			elog(ERROR, "LOCK TABLE: %s is not a table", lockstmt->relname);
+		elog(ERROR, "LOCK TABLE: %s is not a table", lockstmt->relname);
 
 	if (lockstmt->mode == AccessShareLock)
 		aclresult = pg_aclcheck(lockstmt->relname, GetUserId(), ACL_RD);
@@ -1817,9 +1840,9 @@ LockTableCommand(LockStmt *lockstmt)
 static bool
 is_relation(char *name)
 {
-	Relation rel = heap_openr(name, NoLock);
+	Relation	rel = heap_openr(name, NoLock);
 
-	bool retval = (rel->rd_rel->relkind == RELKIND_RELATION);
+	bool		retval = (rel->rd_rel->relkind == RELKIND_RELATION);
 
 	heap_close(rel, NoLock);
 
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 46e8b8057ec7bf0dd6f3af198276c29e338c1cea..06397ab323fbaf6b39b1011315e8ce8bd0de3e9e 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
  * Copyright (c) 1999, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.26 2001/01/23 04:32:21 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.27 2001/03/22 03:59:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ static void CommentAggregate(char *aggregate, List *arguments, char *comment);
 static void CommentProc(char *function, List *arguments, char *comment);
 static void CommentOperator(char *opname, List *arguments, char *comment);
 static void CommentTrigger(char *trigger, char *relation, char *comments);
-static void	CreateComments(Oid oid, char *comment);
+static void CreateComments(Oid oid, char *comment);
 
 /*------------------------------------------------------------------
  * CommentObject --
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index b518ef572e131a03283a3c83dd67b2a8a4b4ef30..f586869b078aa9f7ce54f9d2c8fcb53c6b565c89 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.134 2001/03/14 21:47:50 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.135 2001/03/22 03:59:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,6 +76,7 @@ static StringInfoData attribute_buf;
 #ifdef MULTIBYTE
 static int	client_encoding;
 static int	server_encoding;
+
 #endif
 
 
@@ -285,6 +286,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
 		elog(ERROR, "You must have Postgres superuser privilege to do a COPY "
 			 "directly to or from a file.  Anyone can COPY to stdout or "
 			 "from stdin.  Psql's \\copy command also works for anyone.");
+
 	/*
 	 * This restriction is unfortunate, but necessary until the frontend
 	 * COPY protocol is redesigned to be binary-safe...
@@ -344,8 +346,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
 			mode_t		oumask; /* Pre-existing umask value */
 
 			/*
-			 * Prevent write to relative path ... too easy to shoot oneself
-			 * in the foot by overwriting a database file ...
+			 * Prevent write to relative path ... too easy to shoot
+			 * oneself in the foot by overwriting a database file ...
 			 */
 			if (filename[0] != '/')
 				elog(ERROR, "Relative path not allowed for server side"
@@ -408,7 +410,10 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 	attr_count = rel->rd_att->natts;
 	attr = rel->rd_att->attrs;
 
-	/* For binary copy we really only need isvarlena, but compute it all... */
+	/*
+	 * For binary copy we really only need isvarlena, but compute it
+	 * all...
+	 */
 	out_functions = (FmgrInfo *) palloc(attr_count * sizeof(FmgrInfo));
 	elements = (Oid *) palloc(attr_count * sizeof(Oid));
 	isvarlena = (bool *) palloc(attr_count * sizeof(bool));
@@ -417,7 +422,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 		Oid			out_func_oid;
 
 		if (!getTypeOutputInfo(attr[i]->atttypid,
-							   &out_func_oid, &elements[i], &isvarlena[i]))
+							 &out_func_oid, &elements[i], &isvarlena[i]))
 			elog(ERROR, "COPY: couldn't lookup info for type %u",
 				 attr[i]->atttypid);
 		fmgr_info(out_func_oid, &out_functions[i]);
@@ -454,7 +459,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 		if (binary)
 		{
 			/* Binary per-tuple header */
-			int16	fld_count = attr_count;
+			int16		fld_count = attr_count;
 
 			CopySendData(&fld_count, sizeof(int16), fp);
 			/* Send OID if wanted --- note fld_count doesn't include it */
@@ -471,7 +476,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 			if (oids)
 			{
 				string = DatumGetCString(DirectFunctionCall1(oidout,
-									ObjectIdGetDatum(tuple->t_data->t_oid)));
+								ObjectIdGetDatum(tuple->t_data->t_oid)));
 				CopySendString(string, fp);
 				pfree(string);
 				need_delim = true;
@@ -497,20 +502,22 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 			{
 				if (!binary)
 				{
-					CopySendString(null_print, fp);	/* null indicator */
+					CopySendString(null_print, fp);		/* null indicator */
 				}
 				else
 				{
-					fld_size = 0; /* null marker */
+					fld_size = 0;		/* null marker */
 					CopySendData(&fld_size, sizeof(int16), fp);
 				}
 			}
 			else
 			{
+
 				/*
-				 * If we have a toasted datum, forcibly detoast it to avoid
-				 * memory leakage inside the type's output routine (or
-				 * for binary case, becase we must output untoasted value).
+				 * If we have a toasted datum, forcibly detoast it to
+				 * avoid memory leakage inside the type's output routine
+				 * (or for binary case, becase we must output untoasted
+				 * value).
 				 */
 				if (isvarlena[i])
 					value = PointerGetDatum(PG_DETOAST_DATUM(origvalue));
@@ -520,9 +527,9 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 				if (!binary)
 				{
 					string = DatumGetCString(FunctionCall3(&out_functions[i],
-										value,
-										ObjectIdGetDatum(elements[i]),
-										Int32GetDatum(attr[i]->atttypmod)));
+														   value,
+										   ObjectIdGetDatum(elements[i]),
+									 Int32GetDatum(attr[i]->atttypmod)));
 					CopyAttributeOut(fp, string, delim);
 					pfree(string);
 				}
@@ -552,8 +559,9 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 						Datum		datumBuf;
 
 						/*
-						 * We need this horsing around because we don't know
-						 * how shorter data values are aligned within a Datum.
+						 * We need this horsing around because we don't
+						 * know how shorter data values are aligned within
+						 * a Datum.
 						 */
 						store_att_byval(&datumBuf, value, fld_size);
 						CopySendData(&datumBuf,
@@ -577,7 +585,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp,
 	if (binary)
 	{
 		/* Generate trailer for a binary copy */
-		int16	fld_count = -1;
+		int16		fld_count = -1;
 
 		CopySendData(&fld_count, sizeof(int16), fp);
 	}
@@ -609,7 +617,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 	int			done = 0;
 	char	   *string;
 	ResultRelInfo *resultRelInfo;
-	EState	   *estate = CreateExecutorState();	/* for ExecConstraints() */
+	EState	   *estate = CreateExecutorState(); /* for ExecConstraints() */
 	TupleTable	tupleTable;
 	TupleTableSlot *slot;
 	Oid			loaded_oid = InvalidOid;
@@ -622,11 +630,11 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 
 	/*
 	 * We need a ResultRelInfo so we can use the regular executor's
-	 * index-entry-making machinery.  (There used to be a huge amount
-	 * of code here that basically duplicated execUtils.c ...)
+	 * index-entry-making machinery.  (There used to be a huge amount of
+	 * code here that basically duplicated execUtils.c ...)
 	 */
 	resultRelInfo = makeNode(ResultRelInfo);
-	resultRelInfo->ri_RangeTableIndex = 1; /* dummy */
+	resultRelInfo->ri_RangeTableIndex = 1;		/* dummy */
 	resultRelInfo->ri_RelationDesc = rel;
 
 	ExecOpenIndices(resultRelInfo);
@@ -673,7 +681,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 		if (CopyGetEof(fp))
 			elog(ERROR, "COPY BINARY: bogus file header (missing flags)");
 		file_has_oids = (tmp & (1 << 16)) != 0;
-		tmp &= ~ (1 << 16);
+		tmp &= ~(1 << 16);
 		if ((tmp >> 16) != 0)
 			elog(ERROR, "COPY BINARY: unrecognized critical flags in header");
 		/* Header extension length */
@@ -727,7 +735,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 				else
 				{
 					loaded_oid = DatumGetObjectId(DirectFunctionCall1(oidin,
-												  CStringGetDatum(string)));
+											   CStringGetDatum(string)));
 					if (loaded_oid == InvalidOid)
 						elog(ERROR, "COPY TEXT: Invalid Oid");
 				}
@@ -747,8 +755,8 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 				{
 					values[i] = FunctionCall3(&in_functions[i],
 											  CStringGetDatum(string),
-											  ObjectIdGetDatum(elements[i]),
-											  Int32GetDatum(attr[i]->atttypmod));
+										   ObjectIdGetDatum(elements[i]),
+									  Int32GetDatum(attr[i]->atttypmod));
 					nulls[i] = ' ';
 				}
 			}
@@ -757,8 +765,8 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 		}
 		else
 		{						/* binary */
-			int16	fld_count,
-					fld_size;
+			int16		fld_count,
+						fld_size;
 
 			CopyGetData(&fld_count, sizeof(int16), fp);
 			if (CopyGetEof(fp) ||
@@ -791,15 +799,15 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 					if (CopyGetEof(fp))
 						elog(ERROR, "COPY BINARY: unexpected EOF");
 					if (fld_size == 0)
-						continue; /* it's NULL; nulls[i] already set */
+						continue;		/* it's NULL; nulls[i] already set */
 					if (fld_size != attr[i]->attlen)
 						elog(ERROR, "COPY BINARY: sizeof(field %d) is %d, expected %d",
-							 i+1, (int) fld_size, (int) attr[i]->attlen);
+						   i + 1, (int) fld_size, (int) attr[i]->attlen);
 					if (fld_size == -1)
 					{
 						/* varlena field */
-						int32	varlena_size;
-						Pointer	varlena_ptr;
+						int32		varlena_size;
+						Pointer		varlena_ptr;
 
 						CopyGetData(&varlena_size, sizeof(int32), fp);
 						if (CopyGetEof(fp))
@@ -818,7 +826,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 					else if (!attr[i]->attbyval)
 					{
 						/* fixed-length pass-by-reference */
-						Pointer	refval_ptr;
+						Pointer		refval_ptr;
 
 						Assert(fld_size > 0);
 						refval_ptr = (Pointer) palloc(fld_size);
@@ -833,8 +841,9 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 						Datum		datumBuf;
 
 						/*
-						 * We need this horsing around because we don't know
-						 * how shorter data values are aligned within a Datum.
+						 * We need this horsing around because we don't
+						 * know how shorter data values are aligned within
+						 * a Datum.
 						 */
 						Assert(fld_size > 0 && fld_size <= sizeof(Datum));
 						CopyGetData(&datumBuf, fld_size, fp);
@@ -1163,6 +1172,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
 	char	   *string_start;
 	int			mblen;
 	int			i;
+
 #endif
 
 #ifdef MULTIBYTE
@@ -1182,7 +1192,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
 #endif
 
 #ifdef MULTIBYTE
-	for (; (mblen = (server_encoding == client_encoding? 1 : pg_encoding_mblen(client_encoding, string))) &&
+	for (; (mblen = (server_encoding == client_encoding ? 1 : pg_encoding_mblen(client_encoding, string))) &&
 		 ((c = *string) != '\0'); string += mblen)
 #else
 	for (; (c = *string) != '\0'; string++)
@@ -1199,7 +1209,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
 	}
 
 #ifdef MULTIBYTE
-	if (client_encoding != server_encoding)	
+	if (client_encoding != server_encoding)
 		pfree(string_start);	/* pfree pg_server_to_client result */
 #endif
 }
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c
index a043cf0b8e0a0c57844e9a63f2e341f42bb92ec9..c4a5eaa00e9629d2cd42a77a4ca42482f0ed1879 100644
--- a/src/backend/commands/creatinh.c
+++ b/src/backend/commands/creatinh.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.72 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.73 2001/03/22 03:59:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@
 static int checkAttrExists(const char *attributeName,
 				const char *attributeType, List *schema);
 static List *MergeAttributes(List *schema, List *supers, bool istemp,
-							 List **supOids, List **supconstr);
+				List **supOids, List **supconstr);
 static void StoreCatalogInheritance(Oid relationId, List *supers);
 static void setRelhassubclassInRelation(Oid relationId, bool relhassubclass);
 
@@ -150,10 +150,10 @@ DefineRelation(CreateStmt *stmt, char relkind)
 	CommandCounterIncrement();
 
 	/*
-	 * Open the new relation and acquire exclusive lock on it.  This isn't
+	 * Open the new relation and acquire exclusive lock on it.	This isn't
 	 * really necessary for locking out other backends (since they can't
-	 * see the new rel anyway until we commit), but it keeps the lock manager
-	 * from complaining about deadlock risks.
+	 * see the new rel anyway until we commit), but it keeps the lock
+	 * manager from complaining about deadlock risks.
 	 */
 	rel = heap_openr(relname, AccessExclusiveLock);
 
@@ -242,7 +242,7 @@ TruncateRelation(char *name)
  * Varattnos of pg_relcheck.rcbin should be rewritten when
  * subclasses inherit the constraints from the super class.
  * Note that these functions rewrite varattnos while walking
- * through a node tree. 
+ * through a node tree.
  */
 static bool
 change_varattnos_walker(Node *node, const AttrNumber *newattno)
@@ -251,15 +251,15 @@ change_varattnos_walker(Node *node, const AttrNumber *newattno)
 		return false;
 	if (IsA(node, Var))
 	{
-		Var	*var = (Var *) node;
+		Var		   *var = (Var *) node;
 
 		if (var->varlevelsup == 0 && var->varno == 1)
 		{
+
 			/*
-			 * ??? the following may be a problem when the
-			 * node is multiply referenced though
-			 * stringToNode() doesn't create such a node
-			 * currently. 
+			 * ??? the following may be a problem when the node is
+			 * multiply referenced though stringToNode() doesn't create
+			 * such a node currently.
 			 */
 			Assert(newattno[var->varattno - 1] > 0);
 			var->varattno = newattno[var->varattno - 1];
@@ -373,9 +373,12 @@ MergeAttributes(List *schema, List *supers, bool istemp,
 		AttrNumber	attrno;
 		TupleDesc	tupleDesc;
 		TupleConstr *constr;
-		AttrNumber	*newattno, *partialAttidx;
-		Node		*expr;
-		int		i, attidx, attno_exist;
+		AttrNumber *newattno,
+				   *partialAttidx;
+		Node	   *expr;
+		int			i,
+					attidx,
+					attno_exist;
 
 		relation = heap_openr(name, AccessShareLock);
 
@@ -385,7 +388,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
 		if (!istemp && is_temp_rel_name(name))
 			elog(ERROR, "CREATE TABLE: cannot inherit from temp relation \"%s\"", name);
 
-		/* We should have an UNDER permission flag for this, but for now,
+		/*
+		 * We should have an UNDER permission flag for this, but for now,
 		 * demand that creator of a child table own the parent.
 		 */
 		if (!pg_ownercheck(GetUserId(), name, RELNAME))
@@ -397,14 +401,15 @@ MergeAttributes(List *schema, List *supers, bool istemp,
 		/* allocate a new attribute number table and initialize */
 		newattno = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber));
 		for (i = 0; i < tupleDesc->natts; i++)
-			newattno [i] = 0;
+			newattno[i] = 0;
+
 		/*
-		 * searching and storing order are different.
-		 * another table is needed.
-		 */ 
+		 * searching and storing order are different. another table is
+		 * needed.
+		 */
 		partialAttidx = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber));
 		for (i = 0; i < tupleDesc->natts; i++)
-			partialAttidx [i] = 0;
+			partialAttidx[i] = 0;
 		constr = tupleDesc->constr;
 
 		attidx = 0;
@@ -577,9 +582,9 @@ StoreCatalogInheritance(Oid relationId, List *supers)
 		Datum		datum[Natts_pg_inherits];
 		char		nullarr[Natts_pg_inherits];
 
-		datum[0] = ObjectIdGetDatum(relationId);	/* inhrel */
-		datum[1] = ObjectIdGetDatum(entryOid);		/* inhparent */
-		datum[2] = Int16GetDatum(seqNumber);		/* inhseqno */
+		datum[0] = ObjectIdGetDatum(relationId);		/* inhrel */
+		datum[1] = ObjectIdGetDatum(entryOid);	/* inhparent */
+		datum[2] = Int16GetDatum(seqNumber);	/* inhseqno */
 
 		nullarr[0] = ' ';
 		nullarr[1] = ' ';
@@ -730,7 +735,7 @@ checkAttrExists(const char *attributeName, const char *attributeType,
 				List *schema)
 {
 	List	   *s;
-	int	i = 0;
+	int			i = 0;
 
 	foreach(s, schema)
 	{
@@ -756,9 +761,9 @@ checkAttrExists(const char *attributeName, const char *attributeType,
 static void
 setRelhassubclassInRelation(Oid relationId, bool relhassubclass)
 {
-	Relation		relationRelation;
-	HeapTuple       tuple;
-	Relation        idescs[Num_pg_class_indices];
+	Relation	relationRelation;
+	HeapTuple	tuple;
+	Relation	idescs[Num_pg_class_indices];
 
 	/*
 	 * Fetch a modifiable copy of the tuple, modify it, update pg_class.
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index c450f1b400a9586b8b51a11f7aab03f38f3c8b42..cd409781b2bd238c1ce726776b2c5e12cffe9c69 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.73 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.74 2001/03/22 03:59:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,8 +36,8 @@
 
 /* non-export function prototypes */
 static bool get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP,
-						int *encodingP, bool *dbIsTemplateP,
-						Oid *dbLastSysOidP, char *dbpath);
+			int *encodingP, bool *dbIsTemplateP,
+			Oid *dbLastSysOidP, char *dbpath);
 static bool get_user_info(Oid use_sysid, bool *use_super, bool *use_createdb);
 static char *resolve_alt_dbpath(const char *dbpath, Oid dboid);
 static bool remove_dbdirs(const char *real_loc, const char *altloc);
@@ -82,12 +82,12 @@ createdb(const char *dbname, const char *dbpath,
 		elog(ERROR, "CREATE DATABASE: may not be called in a transaction block");
 
 	/*
-	 * Check for db name conflict.  There is a race condition here, since
+	 * Check for db name conflict.	There is a race condition here, since
 	 * another backend could create the same DB name before we commit.
-	 * However, holding an exclusive lock on pg_database for the whole time
-	 * we are copying the source database doesn't seem like a good idea,
-	 * so accept possibility of race to create.  We will check again after
-	 * we grab the exclusive lock.
+	 * However, holding an exclusive lock on pg_database for the whole
+	 * time we are copying the source database doesn't seem like a good
+	 * idea, so accept possibility of race to create.  We will check again
+	 * after we grab the exclusive lock.
 	 */
 	if (get_db_info(dbname, NULL, NULL, NULL, NULL, NULL, NULL))
 		elog(ERROR, "CREATE DATABASE: database \"%s\" already exists", dbname);
@@ -96,15 +96,16 @@ createdb(const char *dbname, const char *dbpath,
 	 * Lookup database (template) to be cloned.
 	 */
 	if (!dbtemplate)
-		dbtemplate = "template1"; /* Default template database name */
+		dbtemplate = "template1";		/* Default template database name */
 
 	if (!get_db_info(dbtemplate, &src_dboid, &src_owner, &src_encoding,
 					 &src_istemplate, &src_lastsysoid, src_dbpath))
 		elog(ERROR, "CREATE DATABASE: template \"%s\" does not exist",
 			 dbtemplate);
+
 	/*
-	 * Permission check: to copy a DB that's not marked datistemplate,
-	 * you must be superuser or the owner thereof.
+	 * Permission check: to copy a DB that's not marked datistemplate, you
+	 * must be superuser or the owner thereof.
 	 */
 	if (!src_istemplate)
 	{
@@ -112,6 +113,7 @@ createdb(const char *dbname, const char *dbpath,
 			elog(ERROR, "CREATE DATABASE: permission to copy \"%s\" denied",
 				 dbtemplate);
 	}
+
 	/*
 	 * Determine physical path of source database
 	 */
@@ -133,14 +135,16 @@ createdb(const char *dbname, const char *dbpath,
 	if (encoding < 0)
 		encoding = src_encoding;
 
-	/* 
-	 * Preassign OID for pg_database tuple, so that we can compute db path.
+	/*
+	 * Preassign OID for pg_database tuple, so that we can compute db
+	 * path.
 	 */
 	dboid = newoid();
 
 	/*
-	 * Compute nominal location (where we will try to access the database),
-	 * and resolve alternate physical location if one is specified.
+	 * Compute nominal location (where we will try to access the
+	 * database), and resolve alternate physical location if one is
+	 * specified.
 	 */
 	nominal_loc = GetDatabasePath(dboid);
 	alt_loc = resolve_alt_dbpath(dbpath, dboid);
@@ -155,8 +159,8 @@ createdb(const char *dbname, const char *dbpath,
 
 	/*
 	 * Force dirty buffers out to disk, to ensure source database is
-	 * up-to-date for the copy.  (We really only need to flush buffers
-	 * for the source database...)
+	 * up-to-date for the copy.  (We really only need to flush buffers for
+	 * the source database...)
 	 */
 	BufferSync();
 
@@ -231,7 +235,8 @@ createdb(const char *dbname, const char *dbpath,
 
 	tuple = heap_formtuple(pg_database_dsc, new_record, new_record_nulls);
 
-	tuple->t_data->t_oid = dboid;	/* override heap_insert's OID selection */
+	tuple->t_data->t_oid = dboid;		/* override heap_insert's OID
+										 * selection */
 
 	heap_insert(pg_database_rel, tuple);
 
@@ -273,9 +278,9 @@ dropdb(const char *dbname)
 	bool		db_istemplate;
 	bool		use_super;
 	Oid			db_id;
-	char       *alt_loc;
-	char       *nominal_loc;
-	char        dbpath[MAXPGPATH];
+	char	   *alt_loc;
+	char	   *nominal_loc;
+	char		dbpath[MAXPGPATH];
 	Relation	pgdbrel;
 	HeapScanDesc pgdbscan;
 	ScanKeyData key;
@@ -311,8 +316,8 @@ dropdb(const char *dbname)
 		elog(ERROR, "DROP DATABASE: permission denied");
 
 	/*
-	 * Disallow dropping a DB that is marked istemplate.  This is just
-	 * to prevent people from accidentally dropping template0 or template1;
+	 * Disallow dropping a DB that is marked istemplate.  This is just to
+	 * prevent people from accidentally dropping template0 or template1;
 	 * they can do so if they're really determined ...
 	 */
 	if (db_istemplate)
@@ -338,6 +343,7 @@ dropdb(const char *dbname)
 	tup = heap_getnext(pgdbscan, 0);
 	if (!HeapTupleIsValid(tup))
 	{
+
 		/*
 		 * This error should never come up since the existence of the
 		 * database is checked earlier
@@ -437,7 +443,7 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP,
 		{
 			tmptext = DatumGetTextP(heap_getattr(tuple,
 												 Anum_pg_database_datpath,
-												 RelationGetDescr(relation),
+											  RelationGetDescr(relation),
 												 &isnull));
 			if (!isnull)
 			{
@@ -481,11 +487,11 @@ get_user_info(Oid use_sysid, bool *use_super, bool *use_createdb)
 
 
 static char *
-resolve_alt_dbpath(const char * dbpath, Oid dboid)
+resolve_alt_dbpath(const char *dbpath, Oid dboid)
 {
-	const char * prefix;
-	char * ret;
-	size_t len;
+	const char *prefix;
+	char	   *ret;
+	size_t		len;
 
 	if (dbpath == NULL || dbpath[0] == '\0')
 		return NULL;
@@ -502,7 +508,8 @@ resolve_alt_dbpath(const char * dbpath, Oid dboid)
 	else
 	{
 		/* must be environment variable */
-		char * var = getenv(dbpath);
+		char	   *var = getenv(dbpath);
+
 		if (!var)
 			elog(ERROR, "Postmaster environment variable '%s' not set", dbpath);
 		if (var[0] != '/')
@@ -519,11 +526,11 @@ resolve_alt_dbpath(const char * dbpath, Oid dboid)
 
 
 static bool
-remove_dbdirs(const char * nominal_loc, const char * alt_loc)
+remove_dbdirs(const char *nominal_loc, const char *alt_loc)
 {
-	const char   *target_dir;
-	char buf[MAXPGPATH + 100];
-	bool success = true;
+	const char *target_dir;
+	char		buf[MAXPGPATH + 100];
+	bool		success = true;
 
 	target_dir = alt_loc ? alt_loc : nominal_loc;
 
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index 4f5f8a47f64edfdbccf109795fd70051b577ecda..c8a2726a8f7a8b0317c437623b87d5db6ed3e5ed 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.52 2001/02/12 20:07:21 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.53 2001/03/22 03:59:22 momjian Exp $
  *
  * DESCRIPTION
  *	  The "DefineFoo" routines take the parse tree and pick out the
@@ -70,7 +70,7 @@ case_translate_language_name(const char *input, char *output)
 --------------------------------------------------------------------------*/
 	int			i;
 
-	for (i = 0; i < NAMEDATALEN-1 && input[i]; ++i)
+	for (i = 0; i < NAMEDATALEN - 1 && input[i]; ++i)
 		output[i] = tolower((unsigned char) input[i]);
 
 	output[i] = '\0';
@@ -110,12 +110,12 @@ compute_full_attributes(List *parameters,
   Note: currently, only two of these parameters actually do anything:
 
   * canCache means the optimizer's constant-folder is allowed to
-    pre-evaluate the function when all its inputs are constants.
+	pre-evaluate the function when all its inputs are constants.
 
   * isStrict means the function should not be called when any NULL
-    inputs are present; instead a NULL result value should be assumed.
+	inputs are present; instead a NULL result value should be assumed.
 
-  The other four parameters are not used anywhere.  They used to be
+  The other four parameters are not used anywhere.	They used to be
   used in the "expensive functions" optimizer, but that's been dead code
   for a long time.
 
@@ -217,21 +217,26 @@ void
 CreateFunction(ProcedureStmt *stmt, CommandDest dest)
 {
 	char	   *probin_str;
+
 	/* pathname of executable file that executes this function, if any */
 
 	char	   *prosrc_str;
+
 	/* SQL that executes this function, if any */
 
 	char	   *prorettype;
+
 	/* Type of return value (or member of set of values) from function */
 
 	char		languageName[NAMEDATALEN];
+
 	/*
-	 * name of language of function, with case adjusted: "C",
-	 * "internal", "sql", etc.
+	 * name of language of function, with case adjusted: "C", "internal",
+	 * "sql", etc.
 	 */
 
 	bool		returnsSet;
+
 	/* The function returns a set of values, as opposed to a singleton. */
 
 	/*
@@ -257,7 +262,7 @@ CreateFunction(ProcedureStmt *stmt, CommandDest dest)
 		if (!superuser())
 			elog(ERROR,
 				 "Only users with Postgres superuser privilege are "
-				 "permitted to create a function in the '%s' language.\n\t"
+			   "permitted to create a function in the '%s' language.\n\t"
 				 "Others may use the 'sql' language "
 				 "or the created procedural languages.",
 				 languageName);
@@ -380,14 +385,14 @@ DefineOperator(char *oprName,
 		{
 			typeName1 = defGetString(defel);
 			if (IsA(defel->arg, TypeName)
-				&& ((TypeName *) defel->arg)->setof)
+				&&((TypeName *) defel->arg)->setof)
 				elog(ERROR, "setof type not implemented for leftarg");
 		}
 		else if (strcasecmp(defel->defname, "rightarg") == 0)
 		{
 			typeName2 = defGetString(defel);
 			if (IsA(defel->arg, TypeName)
-				&& ((TypeName *) defel->arg)->setof)
+				&&((TypeName *) defel->arg)->setof)
 				elog(ERROR, "setof type not implemented for rightarg");
 		}
 		else if (strcasecmp(defel->defname, "procedure") == 0)
@@ -478,8 +483,8 @@ DefineAggregate(char *aggName, List *parameters)
 		DefElem    *defel = (DefElem *) lfirst(pl);
 
 		/*
-		 * sfunc1, stype1, and initcond1 are accepted as obsolete spellings
-		 * for sfunc, stype, initcond.
+		 * sfunc1, stype1, and initcond1 are accepted as obsolete
+		 * spellings for sfunc, stype, initcond.
 		 */
 		if (strcasecmp(defel->defname, "sfunc") == 0)
 			transfuncName = defGetString(defel);
@@ -515,12 +520,12 @@ DefineAggregate(char *aggName, List *parameters)
 	/*
 	 * Most of the argument-checking is done inside of AggregateCreate
 	 */
-	AggregateCreate(aggName,		/* aggregate name */
-					transfuncName,	/* step function name */
-					finalfuncName,	/* final function name */
-					baseType,		/* type of data being aggregated */
-					transType,		/* transition data type */
-					initval);		/* initial condition */
+	AggregateCreate(aggName,	/* aggregate name */
+					transfuncName,		/* step function name */
+					finalfuncName,		/* final function name */
+					baseType,	/* type of data being aggregated */
+					transType,	/* transition data type */
+					initval);	/* initial condition */
 }
 
 /*
@@ -543,13 +548,13 @@ DefineType(char *typeName, List *parameters)
 	char		delimiter = DEFAULT_TYPDELIM;
 	char	   *shadow_type;
 	List	   *pl;
-	char		alignment = 'i'; /* default alignment */
+	char		alignment = 'i';/* default alignment */
 	char		storage = 'p';	/* default storage in TOAST */
 
 	/*
-	 * Type names must be one character shorter than other names,
-	 * allowing room to create the corresponding array type name with
-	 * prepended "_".
+	 * Type names must be one character shorter than other names, allowing
+	 * room to create the corresponding array type name with prepended
+	 * "_".
 	 */
 	if (strlen(typeName) > (NAMEDATALEN - 2))
 	{
@@ -692,14 +697,16 @@ defGetString(DefElem *def)
 	switch (nodeTag(def->arg))
 	{
 		case T_Integer:
-		{
-			char *str = palloc(32);
+			{
+				char	   *str = palloc(32);
 
-			snprintf(str, 32, "%ld", (long) intVal(def->arg));
-			return str;
-		}
+				snprintf(str, 32, "%ld", (long) intVal(def->arg));
+				return str;
+			}
 		case T_Float:
-			/* T_Float values are kept in string form, so this type cheat
+
+			/*
+			 * T_Float values are kept in string form, so this type cheat
 			 * works (and doesn't risk losing precision)
 			 */
 			return strVal(def->arg);
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 31f24d88a6fda2a350dc72c8f581c1ec07c6f297..672ec54cb029d283447ff9cbcd0c0a6ee64b4ffa 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994-5, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.64 2001/01/27 01:41:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.65 2001/03/22 03:59:22 momjian Exp $
  *
  */
 
@@ -271,7 +271,7 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
 								 stringStringInfo(rte->relname));
 				if (strcmp(rte->eref->relname, rte->relname) != 0)
 					appendStringInfo(str, " %s",
-									 stringStringInfo(rte->eref->relname));
+								   stringStringInfo(rte->eref->relname));
 			}
 			break;
 		case T_SubqueryScan:
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 6497da615b8425f0360086607f8207bbca17d702..2d3e70c427b046f49ac3167a8ba197ed1ebd92f9 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.45 2001/02/23 09:26:14 inoue Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.46 2001/03/22 03:59:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,15 +49,15 @@ static void CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid);
 static void CheckPredExpr(Node *predicate, List *rangeTable, Oid baseRelOid);
 static void CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid);
 static void FuncIndexArgs(IndexInfo *indexInfo, Oid *classOidP,
-						  IndexElem *funcIndex,
-						  Oid relId,
-						  char *accessMethodName, Oid accessMethodId);
+			  IndexElem *funcIndex,
+			  Oid relId,
+			  char *accessMethodName, Oid accessMethodId);
 static void NormIndexAttrs(IndexInfo *indexInfo, Oid *classOidP,
-						   List *attList,
-						   Oid relId,
-						   char *accessMethodName, Oid accessMethodId);
-static Oid	GetAttrOpClass(IndexElem *attribute, Oid attrType,
-						   char *accessMethodName, Oid accessMethodId);
+			   List *attList,
+			   Oid relId,
+			   char *accessMethodName, Oid accessMethodId);
+static Oid GetAttrOpClass(IndexElem *attribute, Oid attrType,
+			   char *accessMethodName, Oid accessMethodId);
 static char *GetDefaultOpClass(Oid atttypid);
 
 /*
@@ -118,9 +118,9 @@ DefineIndex(char *heapRelationName,
 			 accessMethodName);
 
 	/*
-	 * XXX Hardwired hacks to check for limitations on supported index types.
-	 * We really ought to be learning this info from entries in the pg_am
-	 * table, instead of having it wired in here!
+	 * XXX Hardwired hacks to check for limitations on supported index
+	 * types. We really ought to be learning this info from entries in the
+	 * pg_am table, instead of having it wired in here!
 	 */
 	if (unique && accessMethodId != BTREE_AM_OID)
 		elog(ERROR, "DefineIndex: unique indices are only available with the btree access method");
@@ -161,7 +161,8 @@ DefineIndex(char *heapRelationName,
 		elog(ERROR, "Existing indexes are inactive. REINDEX first");
 
 	/*
-	 * Prepare arguments for index_create, primarily an IndexInfo structure
+	 * Prepare arguments for index_create, primarily an IndexInfo
+	 * structure
 	 */
 	indexInfo = makeNode(IndexInfo);
 	indexInfo->ii_Predicate = (Node *) cnfPred;
@@ -207,7 +208,7 @@ DefineIndex(char *heapRelationName,
 
 	/*
 	 * We update the relation's pg_class tuple even if it already has
-	 * relhasindex = true.  This is needed to cause a shared-cache-inval
+	 * relhasindex = true.	This is needed to cause a shared-cache-inval
 	 * message to be sent for the pg_class tuple, which will cause other
 	 * backends to flush their relcache entries and in particular their
 	 * cached lists of the indexes for this relation.
@@ -415,8 +416,8 @@ FuncIndexArgs(IndexInfo *indexInfo,
 	 * has exact-match or binary-compatible input types.
 	 * ----------------
 	 */
-	if (! func_get_detail(funcIndex->name, nargs, argTypes,
-						  &funcid, &rettype, &retset, &true_typeids))
+	if (!func_get_detail(funcIndex->name, nargs, argTypes,
+						 &funcid, &rettype, &retset, &true_typeids))
 		func_error("DefineIndex", funcIndex->name, nargs, argTypes, NULL);
 
 	if (retset)
@@ -425,7 +426,7 @@ FuncIndexArgs(IndexInfo *indexInfo,
 	for (i = 0; i < nargs; i++)
 	{
 		if (argTypes[i] != true_typeids[i] &&
-			! IS_BINARY_COMPATIBLE(argTypes[i], true_typeids[i]))
+			!IS_BINARY_COMPATIBLE(argTypes[i], true_typeids[i]))
 			func_error("DefineIndex", funcIndex->name, nargs, argTypes,
 					   "Index function must be binary-compatible with table datatype");
 	}
@@ -439,7 +440,7 @@ FuncIndexArgs(IndexInfo *indexInfo,
 
 	indexInfo->ii_FuncOid = funcid;
 	/* Need to do the fmgr function lookup now, too */
-	fmgr_info(funcid, & indexInfo->ii_FuncInfo);
+	fmgr_info(funcid, &indexInfo->ii_FuncInfo);
 }
 
 static void
@@ -477,7 +478,7 @@ NormIndexAttrs(IndexInfo *indexInfo,
 		indexInfo->ii_KeyAttrNumbers[attn] = attform->attnum;
 
 		classOidP[attn] = GetAttrOpClass(attribute, attform->atttypid,
-										 accessMethodName, accessMethodId);
+									   accessMethodName, accessMethodId);
 
 		ReleaseSysCache(atttuple);
 		attn++;
@@ -515,8 +516,8 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
 			 attribute->class);
 
 	/*
-	 * Assume the opclass is supported by this index access method
-	 * if we can find at least one relevant entry in pg_amop.
+	 * Assume the opclass is supported by this index access method if we
+	 * can find at least one relevant entry in pg_amop.
 	 */
 	ScanKeyEntryInitialize(&entry[0], 0,
 						   Anum_pg_amop_amopid,
@@ -530,7 +531,7 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
 	relation = heap_openr(AccessMethodOperatorRelationName, AccessShareLock);
 	scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
 
-	if (! HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
+	if (!HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
 		elog(ERROR, "DefineIndex: opclass \"%s\" not supported by access method \"%s\"",
 			 attribute->class, accessMethodName);
 
@@ -540,17 +541,18 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
 	heap_close(relation, AccessShareLock);
 
 	/*
-	 * Make sure the operators associated with this opclass actually accept
-	 * the column data type.  This prevents possible coredumps caused by
-	 * user errors like applying text_ops to an int4 column.  We will accept
-	 * an opclass as OK if the operator's input datatype is binary-compatible
-	 * with the actual column datatype.  Note we assume that all the operators
-	 * associated with an opclass accept the same datatypes, so checking the
-	 * first one we happened to find in the table is sufficient.
+	 * Make sure the operators associated with this opclass actually
+	 * accept the column data type.  This prevents possible coredumps
+	 * caused by user errors like applying text_ops to an int4 column.	We
+	 * will accept an opclass as OK if the operator's input datatype is
+	 * binary-compatible with the actual column datatype.  Note we assume
+	 * that all the operators associated with an opclass accept the same
+	 * datatypes, so checking the first one we happened to find in the
+	 * table is sufficient.
 	 *
 	 * If the opclass was the default for the datatype, assume we can skip
-	 * this check --- that saves a few cycles in the most common case.
-	 * If pg_opclass is wrong then we're probably screwed anyway...
+	 * this check --- that saves a few cycles in the most common case. If
+	 * pg_opclass is wrong then we're probably screwed anyway...
 	 */
 	if (doTypeCheck)
 	{
@@ -560,11 +562,11 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
 		if (HeapTupleIsValid(tuple))
 		{
 			Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tuple);
-			Oid		opInputType = (optup->oprkind == 'l') ?
-				optup->oprright : optup->oprleft;
+			Oid			opInputType = (optup->oprkind == 'l') ?
+			optup->oprright : optup->oprleft;
 
 			if (attrType != opInputType &&
-				! IS_BINARY_COMPATIBLE(attrType, opInputType))
+				!IS_BINARY_COMPATIBLE(attrType, opInputType))
 				elog(ERROR, "DefineIndex: opclass \"%s\" does not accept datatype \"%s\"",
 					 attribute->class, typeidTypeName(attrType));
 			ReleaseSysCache(tuple);
@@ -660,7 +662,7 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
 	if (IsIgnoringSystemIndexes())
 		overwrite = true;
 	if (!reindex_index(tuple->t_data->t_oid, force, overwrite))
-#endif /* OLD_FILE_NAMING */
+#endif	 /* OLD_FILE_NAMING */
 		elog(NOTICE, "index \"%s\" wasn't reindexed", name);
 
 	ReleaseSysCache(tuple);
@@ -752,18 +754,18 @@ ReindexDatabase(const char *dbname, bool force, bool all)
 		elog(ERROR, "REINDEX DATABASE: Can be executed only on the currently open database.");
 
 	/*
-	 * We cannot run inside a user transaction block; if we were
-	 * inside a transaction, then our commit- and
-	 * start-transaction-command calls would not have the intended effect!
+	 * We cannot run inside a user transaction block; if we were inside a
+	 * transaction, then our commit- and start-transaction-command calls
+	 * would not have the intended effect!
 	 */
 	if (IsTransactionBlock())
 		elog(ERROR, "REINDEX DATABASE cannot run inside a BEGIN/END block");
 
 	/*
-	 * Create a memory context that will survive forced transaction commits
-	 * we do below.  Since it is a child of QueryContext, it will go away
-	 * eventually even if we suffer an error; there's no need for special
-	 * abort cleanup logic.
+	 * Create a memory context that will survive forced transaction
+	 * commits we do below.  Since it is a child of QueryContext, it will
+	 * go away eventually even if we suffer an error; there's no need for
+	 * special abort cleanup logic.
 	 */
 	private_context = AllocSetContextCreate(QueryContext,
 											"ReindexDatabase",
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index bbf008c918eb88972c9c16d930c226831872bf89..ca1dbf3cbe4955253bb1157d717a5624ba10b095 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -111,7 +111,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
 
 	i = 0;
 	values[i++] = PointerGetDatum(languageName);
-	values[i++] = BoolGetDatum(true); /* lanispl */
+	values[i++] = BoolGetDatum(true);	/* lanispl */
 	values[i++] = BoolGetDatum(stmt->pltrusted);
 	values[i++] = ObjectIdGetDatum(procTup->t_data->t_oid);
 	values[i++] = DirectFunctionCall1(textin,
diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c
index 2c271758e0868e8ed2977561b3149db49105b56a..da5ad74d8ba8d544eb9be1a11d20157d9962f6e0 100644
--- a/src/backend/commands/remove.c
+++ b/src/backend/commands/remove.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.59 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.60 2001/03/22 03:59:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,8 +40,8 @@
  */
 void
 RemoveOperator(char *operatorName,		/* operator name */
-			   char *typeName1,			/* left argument type name */
-			   char *typeName2)			/* right argument type name */
+			   char *typeName1, /* left argument type name */
+			   char *typeName2) /* right argument type name */
 {
 	Relation	relation;
 	HeapTuple	tup;
diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c
index 3630cdd0d19cdf022b53ffdf2ed8fabb3336f550..52568f29f5f4bc6473ea2b16b2d388a942dbd8e9 100644
--- a/src/backend/commands/rename.c
+++ b/src/backend/commands/rename.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.55 2001/01/24 19:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.56 2001/03/22 03:59:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -189,15 +189,15 @@ renamerel(const char *oldrelname, const char *newrelname)
 			 newrelname);
 
 	/*
-	 * Check for renaming a temp table, which only requires altering
-	 * the temp-table mapping, not the underlying table.
+	 * Check for renaming a temp table, which only requires altering the
+	 * temp-table mapping, not the underlying table.
 	 */
 	if (rename_temp_relation(oldrelname, newrelname))
 		return;					/* all done... */
 
 	/*
-	 * Instead of using heap_openr(), do it the hard way, so that we
-	 * can rename indexes as well as regular relations.
+	 * Instead of using heap_openr(), do it the hard way, so that we can
+	 * rename indexes as well as regular relations.
 	 */
 	targetrelation = RelationNameGetRelation(oldrelname);
 
@@ -219,8 +219,9 @@ renamerel(const char *oldrelname, const char *newrelname)
 	heap_close(targetrelation, NoLock);
 
 	/*
-	 * Flush the relcache entry (easier than trying to change it at exactly
-	 * the right instant).  It'll get rebuilt on next access to relation.
+	 * Flush the relcache entry (easier than trying to change it at
+	 * exactly the right instant).	It'll get rebuilt on next access to
+	 * relation.
 	 *
 	 * XXX What if relation is myxactonly?
 	 *
@@ -244,8 +245,8 @@ renamerel(const char *oldrelname, const char *newrelname)
 		elog(ERROR, "renamerel: relation \"%s\" exists", newrelname);
 
 	/*
-	 * Update pg_class tuple with new relname.  (Scribbling on reltup
-	 * is OK because it's a copy...)
+	 * Update pg_class tuple with new relname.	(Scribbling on reltup is
+	 * OK because it's a copy...)
 	 */
 	StrNCpy(NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
 			newrelname, NAMEDATALEN);
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 04398423b67349484e407d38841cc2a9bf7b10f7..85a8b740048fab6ac204fc687c8e49311e84e978 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.51 2001/03/07 21:20:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.52 2001/03/22 03:59:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@
  * so we pre-log a few fetches in advance. In the event of
  * crash we can lose as much as we pre-logged.
  */
-#define	SEQ_LOG_VALS	32
+#define SEQ_LOG_VALS	32
 
 typedef struct sequence_magic
 {
@@ -140,7 +140,7 @@ DefineSequence(CreateSeqStmt *seq)
 			case SEQ_COL_LOG:
 				typnam->name = "int4";
 				coldef->colname = "log_cnt";
-				value[i - 1] = Int32GetDatum((int32)1);
+				value[i - 1] = Int32GetDatum((int32) 1);
 				break;
 			case SEQ_COL_CYCLE:
 				typnam->name = "char";
@@ -247,7 +247,7 @@ nextval(PG_FUNCTION_ARGS)
 		logit = true;
 	}
 
-	while (fetch)		/* try to fetch cache [+ log ] numbers */
+	while (fetch)				/* try to fetch cache [+ log ] numbers */
 	{
 
 		/*
@@ -292,8 +292,8 @@ nextval(PG_FUNCTION_ARGS)
 			log--;
 			rescnt++;
 			last = next;
-			if (rescnt == 1)		/* if it's first result - */
-				result = next;		/* it's what to return */
+			if (rescnt == 1)	/* if it's first result - */
+				result = next;	/* it's what to return */
 		}
 	}
 
@@ -306,12 +306,12 @@ nextval(PG_FUNCTION_ARGS)
 	{
 		xl_seq_rec	xlrec;
 		XLogRecPtr	recptr;
-		XLogRecData	rdata[2];
+		XLogRecData rdata[2];
 		Page		page = BufferGetPage(buf);
 
 		xlrec.node = elm->rel->rd_node;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = sizeof(xl_seq_rec);
 		rdata[0].next = &(rdata[1]);
 
@@ -319,17 +319,17 @@ nextval(PG_FUNCTION_ARGS)
 		seq->is_called = 't';
 		seq->log_cnt = 0;
 		rdata[1].buffer = InvalidBuffer;
-		rdata[1].data = (char*)page + ((PageHeader) page)->pd_upper;
-		rdata[1].len = ((PageHeader)page)->pd_special - 
-						((PageHeader)page)->pd_upper;
+		rdata[1].data = (char *) page + ((PageHeader) page)->pd_upper;
+		rdata[1].len = ((PageHeader) page)->pd_special -
+			((PageHeader) page)->pd_upper;
 		rdata[1].next = NULL;
 
-		recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG|XLOG_NO_TRAN, rdata);
+		recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG | XLOG_NO_TRAN, rdata);
 
 		PageSetLSN(page, recptr);
 		PageSetSUI(page, ThisStartUpID);
 
-		if (fetch)		/* not all numbers were fetched */
+		if (fetch)				/* not all numbers were fetched */
 			log -= fetch;
 	}
 
@@ -374,15 +374,15 @@ currval(PG_FUNCTION_ARGS)
 	PG_RETURN_INT32(result);
 }
 
-/* 
+/*
  * Main internal procedure that handles 2 & 3 arg forms of SETVAL.
  *
  * Note that the 3 arg version (which sets the is_called flag) is
  * only for use in pg_dump, and setting the is_called flag may not
- * work if multiple users are attached to the database and referencing 
+ * work if multiple users are attached to the database and referencing
  * the sequence (unlikely if pg_dump is restoring it).
  *
- * It is necessary to have the 3 arg version so that pg_dump can 
+ * It is necessary to have the 3 arg version so that pg_dump can
  * restore the state of a sequence exactly during data-only restores -
  * it is the only way to clear the is_called flag in an existing
  * sequence.
@@ -409,18 +409,19 @@ do_setval(char *seqname, int32 next, bool iscalled)
 
 	/* save info in local cache */
 	elm->last = next;			/* last returned number */
-	elm->cached = next;			/* last cached number (forget cached values) */
+	elm->cached = next;			/* last cached number (forget cached
+								 * values) */
 
 	START_CRIT_SECTION();
 	{
 		xl_seq_rec	xlrec;
 		XLogRecPtr	recptr;
-		XLogRecData	rdata[2];
+		XLogRecData rdata[2];
 		Page		page = BufferGetPage(buf);
 
 		xlrec.node = elm->rel->rd_node;
 		rdata[0].buffer = InvalidBuffer;
-		rdata[0].data = (char*)&xlrec;
+		rdata[0].data = (char *) &xlrec;
 		rdata[0].len = sizeof(xl_seq_rec);
 		rdata[0].next = &(rdata[1]);
 
@@ -428,12 +429,12 @@ do_setval(char *seqname, int32 next, bool iscalled)
 		seq->is_called = 't';
 		seq->log_cnt = 0;
 		rdata[1].buffer = InvalidBuffer;
-		rdata[1].data = (char*)page + ((PageHeader) page)->pd_upper;
-		rdata[1].len = ((PageHeader)page)->pd_special - 
-						((PageHeader)page)->pd_upper;
+		rdata[1].data = (char *) page + ((PageHeader) page)->pd_upper;
+		rdata[1].len = ((PageHeader) page)->pd_special -
+			((PageHeader) page)->pd_upper;
 		rdata[1].next = NULL;
 
-		recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG|XLOG_NO_TRAN, rdata);
+		recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG | XLOG_NO_TRAN, rdata);
 
 		PageSetLSN(page, recptr);
 		PageSetSUI(page, ThisStartUpID);
@@ -496,7 +497,7 @@ static char *
 get_seq_name(text *seqin)
 {
 	char	   *rawname = DatumGetCString(DirectFunctionCall1(textout,
-													PointerGetDatum(seqin)));
+												PointerGetDatum(seqin)));
 	int			rawlen = strlen(rawname);
 	char	   *seqname;
 
@@ -511,6 +512,7 @@ get_seq_name(text *seqin)
 	else
 	{
 		seqname = rawname;
+
 		/*
 		 * It's important that this match the identifier downcasing code
 		 * used by backend/parser/scan.l.
@@ -752,15 +754,16 @@ get_param(DefElem *def)
 	return -1;
 }
 
-void seq_redo(XLogRecPtr lsn, XLogRecord *record)
+void
+seq_redo(XLogRecPtr lsn, XLogRecord *record)
 {
-	uint8			info = record->xl_info & ~XLR_INFO_MASK;
-	Relation		reln;
-	Buffer			buffer;
-	Page			page;
-	char		   *item;
-	Size			itemsz;
-	xl_seq_rec	   *xlrec = (xl_seq_rec*) XLogRecGetData(record);
+	uint8		info = record->xl_info & ~XLR_INFO_MASK;
+	Relation	reln;
+	Buffer		buffer;
+	Page		page;
+	char	   *item;
+	Size		itemsz;
+	xl_seq_rec *xlrec = (xl_seq_rec *) XLogRecGetData(record);
 	sequence_magic *sm;
 
 	if (info != XLOG_SEQ_LOG)
@@ -772,8 +775,8 @@ void seq_redo(XLogRecPtr lsn, XLogRecord *record)
 
 	buffer = XLogReadBuffer(true, reln, 0);
 	if (!BufferIsValid(buffer))
-		elog(STOP, "seq_redo: can't read block of %u/%u", 
-			xlrec->node.tblNode, xlrec->node.relNode);
+		elog(STOP, "seq_redo: can't read block of %u/%u",
+			 xlrec->node.tblNode, xlrec->node.relNode);
 
 	page = (Page) BufferGetPage(buffer);
 
@@ -781,10 +784,10 @@ void seq_redo(XLogRecPtr lsn, XLogRecord *record)
 	sm = (sequence_magic *) PageGetSpecialPointer(page);
 	sm->magic = SEQ_MAGIC;
 
-	item = (char*)xlrec + sizeof(xl_seq_rec);
+	item = (char *) xlrec + sizeof(xl_seq_rec);
 	itemsz = record->xl_len - sizeof(xl_seq_rec);
 	itemsz = MAXALIGN(itemsz);
-	if (PageAddItem(page, (Item)item, itemsz, 
+	if (PageAddItem(page, (Item) item, itemsz,
 					FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
 		elog(STOP, "seq_redo: failed to add item to page");
 
@@ -795,14 +798,16 @@ void seq_redo(XLogRecPtr lsn, XLogRecord *record)
 	return;
 }
 
-void seq_undo(XLogRecPtr lsn, XLogRecord *record)
+void
+seq_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 }
 
-void seq_desc(char *buf, uint8 xl_info, char* rec)
+void
+seq_desc(char *buf, uint8 xl_info, char *rec)
 {
-	uint8				info = xl_info & ~XLR_INFO_MASK;
-	xl_seq_rec		   *xlrec = (xl_seq_rec*) rec;
+	uint8		info = xl_info & ~XLR_INFO_MASK;
+	xl_seq_rec *xlrec = (xl_seq_rec *) rec;
 
 	if (info == XLOG_SEQ_LOG)
 		strcat(buf, "log: ");
@@ -813,5 +818,5 @@ void seq_desc(char *buf, uint8 xl_info, char* rec)
 	}
 
 	sprintf(buf + strlen(buf), "node %u/%u",
-		xlrec->node.tblNode, xlrec->node.relNode);
+			xlrec->node.tblNode, xlrec->node.relNode);
 }
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 4a6ddef9283484b49f7c85b9bcbee66a04613b80..034b49887e746eaedbe7462139c7b3314d5b4be9 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.88 2001/03/14 21:50:32 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.89 2001/03/22 03:59:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,8 +36,8 @@ static void DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger);
 static HeapTuple GetTupleForTrigger(EState *estate, ItemPointer tid,
 				   TupleTableSlot **newSlot);
 static HeapTuple ExecCallTriggerFunc(Trigger *trigger,
-									 TriggerData *trigdata,
-									 MemoryContext per_tuple_context);
+					TriggerData *trigdata,
+					MemoryContext per_tuple_context);
 static void DeferredTriggerSaveEvent(Relation rel, int event,
 						 HeapTuple oldtup, HeapTuple newtup);
 
@@ -87,7 +87,9 @@ CreateTrigger(CreateTrigStmt *stmt)
 			constrrelid = InvalidOid;
 		else
 		{
-			/* NoLock is probably sufficient here, since we're only
+
+			/*
+			 * NoLock is probably sufficient here, since we're only
 			 * interested in getting the relation's OID...
 			 */
 			rel = heap_openr(stmt->constrrelname, NoLock);
@@ -192,7 +194,7 @@ CreateTrigger(CreateTrigStmt *stmt)
 
 	values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel));
 	values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein,
-											CStringGetDatum(stmt->trigname));
+										CStringGetDatum(stmt->trigname));
 	values[Anum_pg_trigger_tgfoid - 1] = ObjectIdGetDatum(funcoid);
 	values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
 	values[Anum_pg_trigger_tgenabled - 1] = BoolGetDatum(true);
@@ -211,7 +213,7 @@ CreateTrigger(CreateTrigStmt *stmt)
 
 		foreach(le, stmt->args)
 		{
-			char	   *ar = ((Value*) lfirst(le))->val.str;
+			char	   *ar = ((Value *) lfirst(le))->val.str;
 
 			len += strlen(ar) + 4;
 			for (; *ar; ar++)
@@ -224,7 +226,7 @@ CreateTrigger(CreateTrigStmt *stmt)
 		args[0] = '\0';
 		foreach(le, stmt->args)
 		{
-			char	   *s = ((Value*) lfirst(le))->val.str;
+			char	   *s = ((Value *) lfirst(le))->val.str;
 			char	   *d = args + strlen(args);
 
 			while (*s)
@@ -237,7 +239,7 @@ CreateTrigger(CreateTrigStmt *stmt)
 		}
 		values[Anum_pg_trigger_tgnargs - 1] = Int16GetDatum(nargs);
 		values[Anum_pg_trigger_tgargs - 1] = DirectFunctionCall1(byteain,
-													CStringGetDatum(args));
+												  CStringGetDatum(args));
 	}
 	else
 	{
@@ -569,15 +571,16 @@ RelationBuildTriggers(Relation relation)
 													  sizeof(Trigger));
 		else
 			triggers = (Trigger *) repalloc(triggers,
-											(found + 1) * sizeof(Trigger));
+										  (found + 1) * sizeof(Trigger));
 		build = &(triggers[found]);
 
 		build->tgoid = htup->t_data->t_oid;
 		build->tgname = MemoryContextStrdup(CacheMemoryContext,
-						DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&pg_trigger->tgname))));
+							 DatumGetCString(DirectFunctionCall1(nameout,
+									NameGetDatum(&pg_trigger->tgname))));
 		build->tgfoid = pg_trigger->tgfoid;
-		build->tgfunc.fn_oid = InvalidOid; /* mark FmgrInfo as uninitialized */
+		build->tgfunc.fn_oid = InvalidOid;		/* mark FmgrInfo as
+												 * uninitialized */
 		build->tgtype = pg_trigger->tgtype;
 		build->tgenabled = pg_trigger->tgenabled;
 		build->tgisconstraint = pg_trigger->tgisconstraint;
@@ -836,22 +839,22 @@ ExecCallTriggerFunc(Trigger *trigger,
 					TriggerData *trigdata,
 					MemoryContext per_tuple_context)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
-	MemoryContext			oldContext;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
+	MemoryContext oldContext;
 
 	/*
-	 * Fmgr lookup info is cached in the Trigger structure,
-	 * so that we need not repeat the lookup on every call.
+	 * Fmgr lookup info is cached in the Trigger structure, so that we
+	 * need not repeat the lookup on every call.
 	 */
 	if (trigger->tgfunc.fn_oid == InvalidOid)
 		fmgr_info(trigger->tgfoid, &trigger->tgfunc);
 
 	/*
-	 * Do the function evaluation in the per-tuple memory context,
-	 * so that leaked memory will be reclaimed once per tuple.
-	 * Note in particular that any new tuple created by the trigger function
-	 * will live till the end of the tuple cycle.
+	 * Do the function evaluation in the per-tuple memory context, so that
+	 * leaked memory will be reclaimed once per tuple. Note in particular
+	 * that any new tuple created by the trigger function will live till
+	 * the end of the tuple cycle.
 	 */
 	oldContext = MemoryContextSwitchTo(per_tuple_context);
 
@@ -868,8 +871,8 @@ ExecCallTriggerFunc(Trigger *trigger,
 	MemoryContextSwitchTo(oldContext);
 
 	/*
-	 * Trigger protocol allows function to return a null pointer,
-	 * but NOT to set the isnull result flag.
+	 * Trigger protocol allows function to return a null pointer, but NOT
+	 * to set the isnull result flag.
 	 */
 	if (fcinfo.isnull)
 		elog(ERROR, "ExecCallTriggerFunc: function %u returned NULL",
@@ -885,7 +888,7 @@ ExecBRInsertTriggers(EState *estate, Relation rel, HeapTuple trigtuple)
 	Trigger   **trigger = rel->trigdesc->tg_before_row[TRIGGER_EVENT_INSERT];
 	HeapTuple	newtuple = trigtuple;
 	HeapTuple	oldtuple;
-	TriggerData	LocTriggerData;
+	TriggerData LocTriggerData;
 	int			i;
 
 	LocTriggerData.type = T_TriggerData;
@@ -915,9 +918,7 @@ ExecARInsertTriggers(EState *estate, Relation rel, HeapTuple trigtuple)
 	if (rel->trigdesc->n_after_row[TRIGGER_EVENT_INSERT] > 0 ||
 		rel->trigdesc->n_after_row[TRIGGER_EVENT_UPDATE] > 0 ||
 		rel->trigdesc->n_after_row[TRIGGER_EVENT_DELETE] > 0)
-	{
 		DeferredTriggerSaveEvent(rel, TRIGGER_EVENT_INSERT, NULL, trigtuple);
-	}
 }
 
 bool
@@ -1240,10 +1241,11 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate)
 static void
 deferredTriggerAddEvent(DeferredTriggerEvent event)
 {
+
 	/*
 	 * Since the event list could grow quite long, we keep track of the
-	 * list tail and append there, rather than just doing a stupid "lappend".
-	 * This avoids O(N^2) behavior for large numbers of events.
+	 * list tail and append there, rather than just doing a stupid
+	 * "lappend". This avoids O(N^2) behavior for large numbers of events.
 	 */
 	event->dte_next = NULL;
 	if (deftrig_event_tail == NULL)
@@ -1291,7 +1293,7 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid)
 
 	if (previous == NULL)
 		elog(ERROR,
-			 "deferredTriggerGetPreviousEvent: event for tuple %s not found",
+		 "deferredTriggerGetPreviousEvent: event for tuple %s not found",
 			 DatumGetCString(DirectFunctionCall1(tidout,
 												 PointerGetDatum(ctid))));
 	return previous;
@@ -1528,7 +1530,7 @@ DeferredTriggerBeginXact(void)
 
 	if (deftrig_cxt != NULL)
 		elog(ERROR,
-			 "DeferredTriggerBeginXact() called while inside transaction");
+		   "DeferredTriggerBeginXact() called while inside transaction");
 
 	/* ----------
 	 * Create the per transaction memory context and copy all states
@@ -1671,7 +1673,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
 			l = deftrig_dfl_trigstates;
 			while (l != NIL)
 			{
-				List   *next = lnext(l);
+				List	   *next = lnext(l);
 
 				pfree(lfirst(l));
 				pfree(l);
@@ -1700,7 +1702,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
 			l = deftrig_trigstates;
 			while (l != NIL)
 			{
-				List   *next = lnext(l);
+				List	   *next = lnext(l);
 
 				pfree(lfirst(l));
 				pfree(l);
@@ -1912,7 +1914,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
  *	Called by ExecAR...Triggers() to add the event to the queue.
  *
  *	NOTE: should be called only if we've determined that an event must
- *	be added to the queue.  We must save *all* events if there is either
+ *	be added to the queue.	We must save *all* events if there is either
  *	an UPDATE or a DELETE deferred trigger; see uses of
  *	deferredTriggerGetPreviousEvent.
  * ----------
@@ -2099,15 +2101,15 @@ DeferredTriggerSaveEvent(Relation rel, int event,
 							TRIGGER_DEFERRED_ROW_INSERTED)
 							elog(ERROR, "triggered data change violation "
 								 "on relation \"%s\"",
-								 DatumGetCString(DirectFunctionCall1(nameout,
-								 NameGetDatum(&(rel->rd_rel->relname)))));
+							 DatumGetCString(DirectFunctionCall1(nameout,
+								NameGetDatum(&(rel->rd_rel->relname)))));
 
 						if (prev_event->dte_item[i].dti_state &
 							TRIGGER_DEFERRED_KEY_CHANGED)
 							elog(ERROR, "triggered data change violation "
 								 "on relation \"%s\"",
-								 DatumGetCString(DirectFunctionCall1(nameout,
-								 NameGetDatum(&(rel->rd_rel->relname)))));
+							 DatumGetCString(DirectFunctionCall1(nameout,
+								NameGetDatum(&(rel->rd_rel->relname)))));
 					}
 
 					/* ----------
@@ -2142,7 +2144,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
 				elog(ERROR, "triggered data change violation "
 					 "on relation \"%s\"",
 					 DatumGetCString(DirectFunctionCall1(nameout,
-					 NameGetDatum(&(rel->rd_rel->relname)))));
+								NameGetDatum(&(rel->rd_rel->relname)))));
 
 			break;
 	}
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 378620cb3b704eb30c2436214845828b97e97209..ede41b64cc8c53de44df027740106001fdd88869 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.73 2001/01/24 19:42:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.74 2001/03/22 03:59:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -122,7 +122,7 @@ write_password_file(Relation rel)
 				CRYPT_PWD_FILE_SEPSTR
 				"%s\n",
 				DatumGetCString(DirectFunctionCall1(nameout,
-								NameGetDatum(DatumGetName(datum_n)))),
+								   NameGetDatum(DatumGetName(datum_n)))),
 				null_p ? "" :
 				DatumGetCString(DirectFunctionCall1(textout, datum_p)),
 				null_v ? "\\N" :
@@ -248,7 +248,7 @@ CreateUser(CreateUserStmt *stmt)
 	 * Build a tuple to insert
 	 */
 	new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
-												CStringGetDatum(stmt->user));
+											CStringGetDatum(stmt->user));
 	new_record[Anum_pg_shadow_usesysid - 1] = Int32GetDatum(havesysid ? stmt->sysid : max_id + 1);
 
 	AssertState(BoolIsValid(stmt->createdb));
@@ -312,7 +312,7 @@ CreateUser(CreateUserStmt *stmt)
 												 * this in */
 		ags.action = +1;
 		ags.listUsers = makeList1(makeInteger(havesysid ?
-							stmt->sysid : max_id + 1));
+											  stmt->sysid : max_id + 1));
 		AlterGroup(&ags, "CREATE USER");
 	}
 
@@ -377,7 +377,7 @@ AlterUser(AlterUserStmt *stmt)
 	 * Build a tuple to update, perusing the information just obtained
 	 */
 	new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
-												CStringGetDatum(stmt->user));
+											CStringGetDatum(stmt->user));
 	new_record_nulls[Anum_pg_shadow_usename - 1] = ' ';
 
 	/* sysid - leave as is */
@@ -561,7 +561,7 @@ DropUser(DropUserStmt *stmt)
 			elog(ERROR, "DROP USER: user \"%s\" owns database \"%s\", cannot be removed%s",
 				 user,
 				 DatumGetCString(DirectFunctionCall1(nameout,
-									NameGetDatum(DatumGetName(datum)))),
+									 NameGetDatum(DatumGetName(datum)))),
 				 (length(stmt->users) > 1) ? " (no users removed)" : ""
 				);
 		}
@@ -603,6 +603,7 @@ DropUser(DropUserStmt *stmt)
 		}
 		heap_endscan(scan);
 		heap_close(pg_rel, AccessExclusiveLock);
+
 		/*
 		 * Advance command counter so that later iterations of this loop
 		 * will see the changes already made.  This is essential if, for
@@ -873,7 +874,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
 			{
 				/* Get the uid of the proposed user to add. */
 				tuple = SearchSysCache(SHADOWNAME,
-									   PointerGetDatum(strVal(lfirst(item))),
+								   PointerGetDatum(strVal(lfirst(item))),
 									   0, 0, 0);
 				if (!HeapTupleIsValid(tuple))
 					elog(ERROR, "%s: user \"%s\" does not exist",
@@ -995,7 +996,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
 				{
 					/* Get the uid of the proposed user to drop. */
 					tuple = SearchSysCache(SHADOWNAME,
-										   PointerGetDatum(strVal(lfirst(item))),
+								   PointerGetDatum(strVal(lfirst(item))),
 										   0, 0, 0);
 					if (!HeapTupleIsValid(tuple))
 						elog(ERROR, "ALTER GROUP: user \"%s\" does not exist", strVal(lfirst(item)));
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 3606d05f74123fa80a2bd523ef766b55e88e7222..078c9b53475068af18a102445111ebd472aecf21 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.187 2001/03/14 08:40:57 inoue Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.188 2001/03/22 03:59:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,11 +47,11 @@
 #include "utils/syscache.h"
 #include "utils/temprel.h"
 
-extern XLogRecPtr	log_heap_clean(Relation reln, Buffer buffer,
-									char *unused, int unlen);
-extern XLogRecPtr	log_heap_move(Relation reln, 
-						Buffer oldbuf, ItemPointerData from,
-						Buffer newbuf, HeapTuple newtup);
+extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer,
+			   char *unused, int unlen);
+extern XLogRecPtr log_heap_move(Relation reln,
+			  Buffer oldbuf, ItemPointerData from,
+			  Buffer newbuf, HeapTuple newtup);
 
 static MemoryContext vac_context = NULL;
 
@@ -78,9 +78,9 @@ static void vpage_insert(VacPageList vacpagelist, VacPage vpnew);
 static void get_indices(Relation relation, int *nindices, Relation **Irel);
 static void close_indices(int nindices, Relation *Irel);
 static IndexInfo **get_index_desc(Relation onerel, int nindices,
-								  Relation *Irel);
+			   Relation *Irel);
 static void *vac_find_eq(void *bot, int nelem, int size, void *elm,
-			 int (*compar) (const void *, const void *));
+			int (*compar) (const void *, const void *));
 static int	vac_cmp_blk(const void *left, const void *right);
 static int	vac_cmp_offno(const void *left, const void *right);
 static int	vac_cmp_vtlinks(const void *left, const void *right);
@@ -120,9 +120,9 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *anal_cols)
 	/*
 	 * Create special memory context for cross-transaction storage.
 	 *
-	 * Since it is a child of QueryContext, it will go away eventually
-	 * even if we suffer an error; there's no need for special abort
-	 * cleanup logic.
+	 * Since it is a child of QueryContext, it will go away eventually even
+	 * if we suffer an error; there's no need for special abort cleanup
+	 * logic.
 	 */
 	vac_context = AllocSetContextCreate(QueryContext,
 										"Vacuum",
@@ -215,8 +215,8 @@ vacuum_shutdown()
 
 	/*
 	 * Clean up working storage --- note we must do this after
-	 * StartTransactionCommand, else we might be trying to delete
-	 * the active context!
+	 * StartTransactionCommand, else we might be trying to delete the
+	 * active context!
 	 */
 	MemoryContextDelete(vac_context);
 	vac_context = NULL;
@@ -360,10 +360,10 @@ vacuum_rel(Oid relid)
 {
 	Relation	onerel;
 	LockRelId	onerelid;
-	VacPageListData vacuum_pages; /* List of pages to vacuum and/or clean
-								   * indices */
-	VacPageListData fraged_pages; /* List of pages with space enough for
-								   * re-using */
+	VacPageListData vacuum_pages;		/* List of pages to vacuum and/or
+										 * clean indices */
+	VacPageListData fraged_pages;		/* List of pages with space enough
+										 * for re-using */
 	Relation   *Irel;
 	int32		nindices,
 				i;
@@ -411,10 +411,10 @@ vacuum_rel(Oid relid)
 	}
 
 	/*
-	 * Get a session-level exclusive lock too.  This will protect our
-	 * exclusive access to the relation across multiple transactions,
-	 * so that we can vacuum the relation's TOAST table (if any) secure
-	 * in the knowledge that no one is diddling the parent relation.
+	 * Get a session-level exclusive lock too.	This will protect our
+	 * exclusive access to the relation across multiple transactions, so
+	 * that we can vacuum the relation's TOAST table (if any) secure in
+	 * the knowledge that no one is diddling the parent relation.
 	 *
 	 * NOTE: this cannot block, even if someone else is waiting for access,
 	 * because the lock manager knows that both lock requests are from the
@@ -458,10 +458,11 @@ vacuum_rel(Oid relid)
 		vacrelstats->hasindex = true;
 	else
 		vacrelstats->hasindex = false;
-#ifdef NOT_USED	
+#ifdef NOT_USED
+
 	/*
-	 *	reindex in VACUUM is dangerous under WAL.
-	 *	ifdef out until it becomes safe.		
+	 * reindex in VACUUM is dangerous under WAL. ifdef out until it
+	 * becomes safe.
 	 */
 	if (reindex)
 	{
@@ -470,7 +471,7 @@ vacuum_rel(Oid relid)
 		Irel = (Relation *) NULL;
 		activate_indexes_of_a_table(relid, false);
 	}
-#endif /* NOT_USED */
+#endif	 /* NOT_USED */
 
 	/* Clean/scan index relation(s) */
 	if (Irel != (Relation *) NULL)
@@ -506,6 +507,7 @@ vacuum_rel(Oid relid)
 		}
 		else
 		{
+
 			/*
 			 * Flush dirty pages out to disk.  We must do this even if we
 			 * didn't do anything else, because we want to ensure that all
@@ -518,10 +520,10 @@ vacuum_rel(Oid relid)
 					 i);
 		}
 	}
-#ifdef NOT_USED	
+#ifdef NOT_USED
 	if (reindex)
 		activate_indexes_of_a_table(relid, true);
-#endif /* NOT_USED */	
+#endif	 /* NOT_USED */
 
 	/* all done with this class, but hold lock until commit */
 	heap_close(onerel, NoLock);
@@ -537,11 +539,11 @@ vacuum_rel(Oid relid)
 	CommitTransactionCommand();
 
 	/*
-	 * If the relation has a secondary toast one, vacuum that too
-	 * while we still hold the session lock on the master table.
-	 * We don't need to propagate "analyze" to it, because the toaster
-	 * always uses hardcoded index access and statistics are
-	 * totally unimportant for toast relations
+	 * If the relation has a secondary toast one, vacuum that too while we
+	 * still hold the session lock on the master table. We don't need to
+	 * propagate "analyze" to it, because the toaster always uses
+	 * hardcoded index access and statistics are totally unimportant for
+	 * toast relations
 	 */
 	if (toast_relid != InvalidOid)
 		vacuum_rel(toast_relid);
@@ -563,7 +565,7 @@ vacuum_rel(Oid relid)
  */
 static void
 scan_heap(VRelStats *vacrelstats, Relation onerel,
-			VacPageList vacuum_pages, VacPageList fraged_pages)
+		  VacPageList vacuum_pages, VacPageList fraged_pages)
 {
 	BlockNumber nblocks,
 				blkno;
@@ -845,7 +847,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
 				 * dead tuples removed.  Below we will apply
 				 * PageRepairFragmentation to the copy, so that we can
 				 * determine how much space will be available after
-				 * removal of dead tuples.  But note we are NOT changing
+				 * removal of dead tuples.	But note we are NOT changing
 				 * the real page yet...
 				 */
 				if (tempPage == (Page) NULL)
@@ -964,8 +966,8 @@ Re-using: Free/Avail. Space %lu/%lu; EndEmpty/Avail. Pages %u/%u. %s",
 		 nblocks, changed_pages, vacuum_pages->num_pages, empty_pages,
 		 new_pages, num_tuples, tups_vacuumed,
 		 nkeep, vacrelstats->num_vtlinks, ncrash,
-		 nunused, (unsigned long)min_tlen, (unsigned long)max_tlen,
-		 (unsigned long)free_size, (unsigned long)usable_free_size,
+		 nunused, (unsigned long) min_tlen, (unsigned long) max_tlen,
+		 (unsigned long) free_size, (unsigned long) usable_free_size,
 		 empty_end_pages, fraged_pages->num_pages,
 		 show_rusage(&ru0));
 
@@ -984,8 +986,8 @@ Re-using: Free/Avail. Space %lu/%lu; EndEmpty/Avail. Pages %u/%u. %s",
  */
 static void
 repair_frag(VRelStats *vacrelstats, Relation onerel,
-			   VacPageList vacuum_pages, VacPageList fraged_pages,
-			   int nindices, Relation *Irel)
+			VacPageList vacuum_pages, VacPageList fraged_pages,
+			int nindices, Relation *Irel)
 {
 	TransactionId myXID;
 	CommandId	myCID;
@@ -1077,7 +1079,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 		dowrite = false;
 		if (blkno == last_vacuum_block) /* it's reaped page */
 		{
-			if (last_vacuum_page->offsets_free > 0) /* there are dead tuples */
+			if (last_vacuum_page->offsets_free > 0)		/* there are dead tuples */
 			{					/* on this page - clean */
 				Assert(!isempty);
 				LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
@@ -1100,7 +1102,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 				last_vacuum_block = -1;
 			}
 			if (num_fraged_pages > 0 &&
-			fraged_pages->pagedesc[num_fraged_pages - 1]->blkno ==
+				fraged_pages->pagedesc[num_fraged_pages - 1]->blkno ==
 				(BlockNumber) blkno)
 			{
 				/* page is in fraged_pages too; remove it */
@@ -1142,8 +1144,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
 				/*
 				 * If this (chain) tuple is moved by me already then I
-				 * have to check is it in vacpage or not - i.e. is it moved
-				 * while cleaning this page or some previous one.
+				 * have to check is it in vacpage or not - i.e. is it
+				 * moved while cleaning this page or some previous one.
 				 */
 				if (tuple.t_data->t_infomask & HEAP_MOVED_OFF)
 				{
@@ -1232,8 +1234,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 						 * xaction and this tuple is already deleted by
 						 * me. Actually, upper part of chain should be
 						 * removed and seems that this should be handled
-						 * in scan_heap(), but it's not implemented at
-						 * the moment and so we just stop shrinking here.
+						 * in scan_heap(), but it's not implemented at the
+						 * moment and so we just stop shrinking here.
 						 */
 						ReleaseBuffer(Cbuf);
 						pfree(vtmove);
@@ -1256,15 +1258,15 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 					{
 
 						/*
-						 * if to_vacpage no longer has enough free space to be
-						 * useful, remove it from fraged_pages list
+						 * if to_vacpage no longer has enough free space
+						 * to be useful, remove it from fraged_pages list
 						 */
 						if (to_vacpage != NULL &&
-						 !enough_space(to_vacpage, vacrelstats->min_tlen))
+						!enough_space(to_vacpage, vacrelstats->min_tlen))
 						{
 							Assert(num_fraged_pages > to_item);
 							memmove(fraged_pages->pagedesc + to_item,
-								fraged_pages->pagedesc + to_item + 1,
+									fraged_pages->pagedesc + to_item + 1,
 									sizeof(VacPage) * (num_fraged_pages - to_item - 1));
 							num_fraged_pages--;
 						}
@@ -1326,10 +1328,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 						vtld.new_tid = tp.t_self;
 						vtlp = (VTupleLink)
 							vac_find_eq((void *) (vacrelstats->vtlinks),
-									   vacrelstats->num_vtlinks,
-									   sizeof(VTupleLinkData),
-									   (void *) &vtld,
-									   vac_cmp_vtlinks);
+										vacrelstats->num_vtlinks,
+										sizeof(VTupleLinkData),
+										(void *) &vtld,
+										vac_cmp_vtlinks);
 						if (vtlp == NULL)
 							elog(ERROR, "Parent tuple was not found");
 						tp.t_self = vtlp->this_tid;
@@ -1416,7 +1418,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 				ItemPointerSetInvalid(&Ctid);
 				for (ti = 0; ti < num_vtmove; ti++)
 				{
-					VacPage	destvacpage = vtmove[ti].vacpage;
+					VacPage		destvacpage = vtmove[ti].vacpage;
 
 					/* Get page to move from */
 					tuple.t_self = vtmove[ti].tid;
@@ -1460,21 +1462,22 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 					 *
 					 * NOTE: a nasty bug used to lurk here.  It is possible
 					 * for the source and destination pages to be the same
-					 * (since this tuple-chain member can be on a page lower
-					 * than the one we're currently processing in the outer
-					 * loop).  If that's true, then after vacuum_page() the
-					 * source tuple will have been moved, and tuple.t_data
-					 * will be pointing at garbage.  Therefore we must do
-					 * everything that uses tuple.t_data BEFORE this step!!
+					 * (since this tuple-chain member can be on a page
+					 * lower than the one we're currently processing in
+					 * the outer loop).  If that's true, then after
+					 * vacuum_page() the source tuple will have been
+					 * moved, and tuple.t_data will be pointing at
+					 * garbage.  Therefore we must do everything that uses
+					 * tuple.t_data BEFORE this step!!
 					 *
 					 * This path is different from the other callers of
-					 * vacuum_page, because we have already incremented the
-					 * vacpage's offsets_used field to account for the
+					 * vacuum_page, because we have already incremented
+					 * the vacpage's offsets_used field to account for the
 					 * tuple(s) we expect to move onto the page. Therefore
-					 * vacuum_page's check for offsets_used == 0 is
-					 * wrong. But since that's a good debugging check for
-					 * all other callers, we work around it here rather
-					 * than remove it.
+					 * vacuum_page's check for offsets_used == 0 is wrong.
+					 * But since that's a good debugging check for all
+					 * other callers, we work around it here rather than
+					 * remove it.
 					 */
 					if (!PageIsEmpty(ToPage) && vtmove[ti].cleanVpd)
 					{
@@ -1498,7 +1501,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 					if (newoff == InvalidOffsetNumber)
 					{
 						elog(STOP, "moving chain: failed to add item with len = %lu to page %u",
-							 (unsigned long)tuple_len, destvacpage->blkno);
+						  (unsigned long) tuple_len, destvacpage->blkno);
 					}
 					newitemid = PageGetItemId(ToPage, newoff);
 					pfree(newtup.t_data);
@@ -1507,9 +1510,9 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 					ItemPointerSet(&(newtup.t_self), destvacpage->blkno, newoff);
 
 					{
-						XLogRecPtr	recptr = 
-							log_heap_move(onerel, Cbuf, tuple.t_self,
-												cur_buffer, &newtup);
+						XLogRecPtr	recptr =
+						log_heap_move(onerel, Cbuf, tuple.t_self,
+									  cur_buffer, &newtup);
 
 						if (Cbuf != cur_buffer)
 						{
@@ -1526,7 +1529,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
 					/*
 					 * Set new tuple's t_ctid pointing to itself for last
-					 * tuple in chain, and to next tuple in chain otherwise.
+					 * tuple in chain, and to next tuple in chain
+					 * otherwise.
 					 */
 					if (!ItemPointerIsValid(&Ctid))
 						newtup.t_data->t_ctid = newtup.t_self;
@@ -1552,13 +1556,15 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
 					if (Irel != (Relation *) NULL)
 					{
+
 						/*
 						 * XXX using CurrentMemoryContext here means
-						 * intra-vacuum memory leak for functional indexes.
-						 * Should fix someday.
+						 * intra-vacuum memory leak for functional
+						 * indexes. Should fix someday.
 						 *
 						 * XXX This code fails to handle partial indexes!
-						 * Probably should change it to use ExecOpenIndices.
+						 * Probably should change it to use
+						 * ExecOpenIndices.
 						 */
 						for (i = 0; i < nindices; i++)
 						{
@@ -1653,8 +1659,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 			{
 				elog(STOP, "\
 failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)",
-					 (unsigned long)tuple_len, cur_page->blkno, (unsigned long)cur_page->free,
-				 cur_page->offsets_used, cur_page->offsets_free);
+					 (unsigned long) tuple_len, cur_page->blkno, (unsigned long) cur_page->free,
+					 cur_page->offsets_used, cur_page->offsets_free);
 			}
 			newitemid = PageGetItemId(ToPage, newoff);
 			pfree(newtup.t_data);
@@ -1673,9 +1679,9 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 			tuple.t_data->t_infomask |= HEAP_MOVED_OFF;
 
 			{
-				XLogRecPtr	recptr = 
-					log_heap_move(onerel, buf, tuple.t_self,
-										cur_buffer, &newtup);
+				XLogRecPtr	recptr =
+				log_heap_move(onerel, buf, tuple.t_self,
+							  cur_buffer, &newtup);
 
 				PageSetLSN(page, recptr);
 				PageSetSUI(page, ThisStartUpID);
@@ -1698,13 +1704,13 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 			/* insert index' tuples if needed */
 			if (Irel != (Relation *) NULL)
 			{
+
 				/*
-				 * XXX using CurrentMemoryContext here means
-				 * intra-vacuum memory leak for functional indexes.
-				 * Should fix someday.
+				 * XXX using CurrentMemoryContext here means intra-vacuum
+				 * memory leak for functional indexes. Should fix someday.
 				 *
-				 * XXX This code fails to handle partial indexes!
-				 * Probably should change it to use ExecOpenIndices.
+				 * XXX This code fails to handle partial indexes! Probably
+				 * should change it to use ExecOpenIndices.
 				 */
 				for (i = 0; i < nindices; i++)
 				{
@@ -1803,14 +1809,15 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 
 	if (num_moved > 0)
 	{
+
 		/*
 		 * We have to commit our tuple movings before we truncate the
 		 * relation.  Ideally we should do Commit/StartTransactionCommand
 		 * here, relying on the session-level table lock to protect our
 		 * exclusive access to the relation.  However, that would require
 		 * a lot of extra code to close and re-open the relation, indices,
-		 * etc.  For now, a quick hack: record status of current transaction
-		 * as committed, and continue.
+		 * etc.  For now, a quick hack: record status of current
+		 * transaction as committed, and continue.
 		 */
 		RecordTransactionCommit();
 	}
@@ -1873,7 +1880,7 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 		 nblocks, blkno, num_moved,
 		 show_rusage(&ru0));
 
-	/* 
+	/*
 	 * Reflect the motion of system tuples to catalog cache here.
 	 */
 	CommandCounterIncrement();
@@ -1883,13 +1890,13 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 		/* vacuum indices again if needed */
 		if (Irel != (Relation *) NULL)
 		{
-			VacPage	   *vpleft,
+			VacPage    *vpleft,
 					   *vpright,
 						vpsave;
 
 			/* re-sort Nvacpagelist.pagedesc */
 			for (vpleft = Nvacpagelist.pagedesc,
-				 vpright = Nvacpagelist.pagedesc + Nvacpagelist.num_pages - 1;
+			vpright = Nvacpagelist.pagedesc + Nvacpagelist.num_pages - 1;
 				 vpleft < vpright; vpleft++, vpright--)
 			{
 				vpsave = *vpleft;
@@ -1906,9 +1913,9 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 		if (vacpage->blkno == (BlockNumber) (blkno - 1) &&
 			vacpage->offsets_free > 0)
 		{
-			char			unbuf[BLCKSZ];
-			OffsetNumber   *unused = (OffsetNumber*)unbuf;
-			int				uncnt;
+			char		unbuf[BLCKSZ];
+			OffsetNumber *unused = (OffsetNumber *) unbuf;
+			int			uncnt;
 
 			buf = ReadBuffer(onerel, vacpage->blkno);
 			LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
@@ -1943,8 +1950,9 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 			uncnt = PageRepairFragmentation(page, unused);
 			{
 				XLogRecPtr	recptr;
-				recptr = log_heap_clean(onerel, buf, (char*)unused,
-					(char*)(&(unused[uncnt])) - (char*)unused);
+
+				recptr = log_heap_clean(onerel, buf, (char *) unused,
+						  (char *) (&(unused[uncnt])) - (char *) unused);
 				PageSetLSN(page, recptr);
 				PageSetSUI(page, ThisStartUpID);
 			}
@@ -1962,9 +1970,9 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
 
 	/*
 	 * Flush dirty pages out to disk.  We do this unconditionally, even if
-	 * we don't need to truncate, because we want to ensure that all tuples
-	 * have correct on-row commit status on disk (see bufmgr.c's comments
-	 * for FlushRelationBuffers()).
+	 * we don't need to truncate, because we want to ensure that all
+	 * tuples have correct on-row commit status on disk (see bufmgr.c's
+	 * comments for FlushRelationBuffers()).
 	 */
 	i = FlushRelationBuffers(onerel, blkno);
 	if (i < 0)
@@ -2005,8 +2013,7 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
 	int			i;
 
 	nblocks = vacuum_pages->num_pages;
-	nblocks -= vacuum_pages->empty_end_pages;		/* nothing to do with
-													 * them */
+	nblocks -= vacuum_pages->empty_end_pages;	/* nothing to do with them */
 
 	for (i = 0, vacpage = vacuum_pages->pagedesc; i < nblocks; i++, vacpage++)
 	{
@@ -2022,9 +2029,9 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
 
 	/*
 	 * Flush dirty pages out to disk.  We do this unconditionally, even if
-	 * we don't need to truncate, because we want to ensure that all tuples
-	 * have correct on-row commit status on disk (see bufmgr.c's comments
-	 * for FlushRelationBuffers()).
+	 * we don't need to truncate, because we want to ensure that all
+	 * tuples have correct on-row commit status on disk (see bufmgr.c's
+	 * comments for FlushRelationBuffers()).
 	 */
 	Assert(vacrelstats->num_pages >= vacuum_pages->empty_end_pages);
 	nblocks = vacrelstats->num_pages - vacuum_pages->empty_end_pages;
@@ -2042,7 +2049,8 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
 			 vacrelstats->num_pages, nblocks);
 		nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks);
 		Assert(nblocks >= 0);
-		vacrelstats->num_pages = nblocks; /* set new number of blocks */
+		vacrelstats->num_pages = nblocks;		/* set new number of
+												 * blocks */
 	}
 }
 
@@ -2053,12 +2061,12 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
 static void
 vacuum_page(Relation onerel, Buffer buffer, VacPage vacpage)
 {
-	char			unbuf[BLCKSZ];
-	OffsetNumber   *unused = (OffsetNumber*)unbuf;
-	int				uncnt;
-	Page			page = BufferGetPage(buffer);
-	ItemId			itemid;
-	int				i;
+	char		unbuf[BLCKSZ];
+	OffsetNumber *unused = (OffsetNumber *) unbuf;
+	int			uncnt;
+	Page		page = BufferGetPage(buffer);
+	ItemId		itemid;
+	int			i;
 
 	/* There shouldn't be any tuples moved onto the page yet! */
 	Assert(vacpage->offsets_used == 0);
@@ -2072,8 +2080,9 @@ vacuum_page(Relation onerel, Buffer buffer, VacPage vacpage)
 	uncnt = PageRepairFragmentation(page, unused);
 	{
 		XLogRecPtr	recptr;
-		recptr = log_heap_clean(onerel, buffer, (char*)unused,
-					(char*)(&(unused[uncnt])) - (char*)unused);
+
+		recptr = log_heap_clean(onerel, buffer, (char *) unused,
+						  (char *) (&(unused[uncnt])) - (char *) unused);
 		PageSetLSN(page, recptr);
 		PageSetSUI(page, ThisStartUpID);
 	}
@@ -2220,8 +2229,8 @@ tid_reaped(ItemPointer itemptr, VacPageList vacpagelist)
 
 	vp = &vacpage;
 	vpp = (VacPage *) vac_find_eq((void *) (vacpagelist->pagedesc),
-					vacpagelist->num_pages, sizeof(VacPage), (void *) &vp,
-									vac_cmp_blk);
+				   vacpagelist->num_pages, sizeof(VacPage), (void *) &vp,
+								  vac_cmp_blk);
 
 	if (vpp == (VacPage *) NULL)
 		return (VacPage) NULL;
@@ -2235,8 +2244,8 @@ tid_reaped(ItemPointer itemptr, VacPageList vacpagelist)
 	}
 
 	voff = (OffsetNumber *) vac_find_eq((void *) (vp->offsets),
-			vp->offsets_free, sizeof(OffsetNumber), (void *) &ioffno,
-									   vac_cmp_offno);
+				vp->offsets_free, sizeof(OffsetNumber), (void *) &ioffno,
+										vac_cmp_offno);
 
 	if (voff == (OffsetNumber *) NULL)
 		return (VacPage) NULL;
@@ -2265,7 +2274,7 @@ tid_reaped(ItemPointer itemptr, VacPageList vacpagelist)
  */
 static void
 update_relstats(Oid relid, int num_pages, int num_tuples, bool hasindex,
-			VRelStats *vacrelstats)
+				VRelStats *vacrelstats)
 {
 	Relation	rd;
 	HeapTupleData rtup;
@@ -2313,7 +2322,7 @@ update_relstats(Oid relid, int num_pages, int num_tuples, bool hasindex,
 static void
 reap_page(VacPageList vacpagelist, VacPage vacpage)
 {
-	VacPage	newvacpage;
+	VacPage		newvacpage;
 
 	/* allocate a VacPageData entry */
 	newvacpage = (VacPage) palloc(sizeof(VacPageData) + vacpage->offsets_free * sizeof(OffsetNumber));
@@ -2354,7 +2363,7 @@ vpage_insert(VacPageList vacpagelist, VacPage vpnew)
 
 static void *
 vac_find_eq(void *bot, int nelem, int size, void *elm,
-		   int (*compar) (const void *, const void *))
+			int (*compar) (const void *, const void *))
 {
 	int			res;
 	int			last = nelem - 1;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 6f07bff095dda582aee65c48e20eebcd21790008..cc5f64f41a01c0a05ffaf7bce23b274111028950 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.45 2001/01/24 19:42:53 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.46 2001/03/22 03:59:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -453,6 +453,7 @@ parse_DefaultXactIsoLevel(char *value)
 {
 #if 0
 	TransactionState s = CurrentTransactionState;
+
 #endif
 
 	if (value == NULL)
@@ -632,7 +633,7 @@ parse_client_encoding(char *value)
 	}
 #else
 	if (value &&
-		strcasecmp(value, pg_encoding_to_char(pg_get_client_encoding())) != 0)
+	strcasecmp(value, pg_encoding_to_char(pg_get_client_encoding())) != 0)
 		elog(ERROR, "Client encoding %s is not supported", value);
 #endif
 	return TRUE;
@@ -701,28 +702,27 @@ reset_server_encoding(void)
 void
 SetPGVariable(const char *name, const char *value)
 {
-	char	   *mvalue = value ? pstrdup(value) : ((char*) NULL);
-
-    /*
-     * Special cases ought to be removed and handled separately
-     * by TCOP
-     */
-    if (strcasecmp(name, "datestyle")==0)
-        parse_date(mvalue);
-    else if (strcasecmp(name, "timezone")==0)
-        parse_timezone(mvalue);
-    else if (strcasecmp(name, "DefaultXactIsoLevel")==0)
-        parse_DefaultXactIsoLevel(mvalue);
-    else if (strcasecmp(name, "XactIsoLevel")==0)
-        parse_XactIsoLevel(mvalue);
-    else if (strcasecmp(name, "client_encoding")==0)
-        parse_client_encoding(mvalue);
-    else if (strcasecmp(name, "server_encoding")==0)
-        parse_server_encoding(mvalue);
-    else if (strcasecmp(name, "random_seed")==0)
-        parse_random_seed(mvalue);
-    else
-        SetConfigOption(name, value, superuser() ? PGC_SUSET : PGC_USERSET);
+	char	   *mvalue = value ? pstrdup(value) : ((char *) NULL);
+
+	/*
+	 * Special cases ought to be removed and handled separately by TCOP
+	 */
+	if (strcasecmp(name, "datestyle") == 0)
+		parse_date(mvalue);
+	else if (strcasecmp(name, "timezone") == 0)
+		parse_timezone(mvalue);
+	else if (strcasecmp(name, "DefaultXactIsoLevel") == 0)
+		parse_DefaultXactIsoLevel(mvalue);
+	else if (strcasecmp(name, "XactIsoLevel") == 0)
+		parse_XactIsoLevel(mvalue);
+	else if (strcasecmp(name, "client_encoding") == 0)
+		parse_client_encoding(mvalue);
+	else if (strcasecmp(name, "server_encoding") == 0)
+		parse_server_encoding(mvalue);
+	else if (strcasecmp(name, "random_seed") == 0)
+		parse_random_seed(mvalue);
+	else
+		SetConfigOption(name, value, superuser() ? PGC_SUSET : PGC_USERSET);
 
 	if (mvalue)
 		pfree(mvalue);
@@ -732,44 +732,45 @@ SetPGVariable(const char *name, const char *value)
 void
 GetPGVariable(const char *name)
 {
-    if (strcasecmp(name, "datestyle")==0)
-        show_date();
-    else if (strcasecmp(name, "timezone")==0)
-        show_timezone();
-    else if (strcasecmp(name, "DefaultXactIsoLevel")==0)
-        show_DefaultXactIsoLevel();
-    else if (strcasecmp(name, "XactIsoLevel")==0)
-        show_XactIsoLevel();
-    else if (strcasecmp(name, "client_encoding")==0)
-        show_client_encoding();
-    else if (strcasecmp(name, "server_encoding")==0)
-        show_server_encoding();
-    else if (strcasecmp(name, "random_seed")==0)
-        show_random_seed();
-    else
-    {
-        const char * val = GetConfigOption(name);
-        elog(NOTICE, "%s is %s", name, val);
-    }
-} 
+	if (strcasecmp(name, "datestyle") == 0)
+		show_date();
+	else if (strcasecmp(name, "timezone") == 0)
+		show_timezone();
+	else if (strcasecmp(name, "DefaultXactIsoLevel") == 0)
+		show_DefaultXactIsoLevel();
+	else if (strcasecmp(name, "XactIsoLevel") == 0)
+		show_XactIsoLevel();
+	else if (strcasecmp(name, "client_encoding") == 0)
+		show_client_encoding();
+	else if (strcasecmp(name, "server_encoding") == 0)
+		show_server_encoding();
+	else if (strcasecmp(name, "random_seed") == 0)
+		show_random_seed();
+	else
+	{
+		const char *val = GetConfigOption(name);
+
+		elog(NOTICE, "%s is %s", name, val);
+	}
+}
 
 void
 ResetPGVariable(const char *name)
 {
-    if (strcasecmp(name, "datestyle")==0)
-        reset_date();
-    else if (strcasecmp(name, "timezone")==0)
-        reset_timezone();
-    else if (strcasecmp(name, "DefaultXactIsoLevel")==0)
-			reset_DefaultXactIsoLevel();
-    else if (strcasecmp(name, "XactIsoLevel")==0)
-			reset_XactIsoLevel();
-    else if (strcasecmp(name, "client_encoding")==0)
-        reset_client_encoding();
-    else if (strcasecmp(name, "server_encoding")==0)
-        reset_server_encoding();
-    else if (strcasecmp(name, "random_seed")==0)
-        reset_random_seed();
-    else
-        SetConfigOption(name, NULL, superuser() ? PGC_SUSET : PGC_USERSET);
-}  
+	if (strcasecmp(name, "datestyle") == 0)
+		reset_date();
+	else if (strcasecmp(name, "timezone") == 0)
+		reset_timezone();
+	else if (strcasecmp(name, "DefaultXactIsoLevel") == 0)
+		reset_DefaultXactIsoLevel();
+	else if (strcasecmp(name, "XactIsoLevel") == 0)
+		reset_XactIsoLevel();
+	else if (strcasecmp(name, "client_encoding") == 0)
+		reset_client_encoding();
+	else if (strcasecmp(name, "server_encoding") == 0)
+		reset_server_encoding();
+	else if (strcasecmp(name, "random_seed") == 0)
+		reset_random_seed();
+	else
+		SetConfigOption(name, NULL, superuser() ? PGC_SUSET : PGC_USERSET);
+}
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 99481d4d54bec32f46abc636a1f4397c11d31a2f..320f2c08e92fa11841edc980708eb91df0e7a08f 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Id: view.c,v 1.53 2001/01/24 19:42:53 momjian Exp $
+ *	$Id: view.c,v 1.54 2001/03/22 03:59:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,7 +57,7 @@ DefineVirtualRelation(char *relname, List *tlist)
 		TargetEntry *entry = lfirst(t);
 		Resdom	   *res = entry->resdom;
 
-		if (! res->resjunk)
+		if (!res->resjunk)
 		{
 			char	   *resname = res->resname;
 			char	   *restypename = typeidTypeName(res->restype);
@@ -118,9 +118,9 @@ MakeRetrieveViewRuleName(char *viewName)
 	snprintf(buf, buflen, "_RET%s", viewName);
 	/* clip to less than NAMEDATALEN bytes, if necessary */
 #ifdef MULTIBYTE
-	maxlen = pg_mbcliplen(buf, strlen(buf), NAMEDATALEN-1);
+	maxlen = pg_mbcliplen(buf, strlen(buf), NAMEDATALEN - 1);
 #else
-	maxlen = NAMEDATALEN-1;
+	maxlen = NAMEDATALEN - 1;
 #endif
 	if (maxlen < buflen)
 		buf[maxlen] = '\0';
@@ -211,12 +211,12 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
 			   *rt_entry2;
 
 	/*
-	 * Make a copy of the given parsetree.  It's not so much that we
-	 * don't want to scribble on our input, it's that the parser has
-	 * a bad habit of outputting multiple links to the same subtree
-	 * for constructs like BETWEEN, and we mustn't have OffsetVarNodes
-	 * increment the varno of a Var node twice.  copyObject will expand
-	 * any multiply-referenced subtree into multiple copies.
+	 * Make a copy of the given parsetree.	It's not so much that we don't
+	 * want to scribble on our input, it's that the parser has a bad habit
+	 * of outputting multiple links to the same subtree for constructs
+	 * like BETWEEN, and we mustn't have OffsetVarNodes increment the
+	 * varno of a Var node twice.  copyObject will expand any
+	 * multiply-referenced subtree into multiple copies.
 	 */
 	viewParse = (Query *) copyObject(viewParse);
 
@@ -261,6 +261,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
 void
 DefineView(char *viewName, Query *viewParse)
 {
+
 	/*
 	 * Create the "view" relation NOTE: if it already exists, the xact
 	 * will be aborted.
@@ -295,9 +296,10 @@ DefineView(char *viewName, Query *viewParse)
 void
 RemoveView(char *viewName)
 {
+
 	/*
-	 * We just have to drop the relation; the associated rules will
-	 * be cleaned up automatically.
+	 * We just have to drop the relation; the associated rules will be
+	 * cleaned up automatically.
 	 */
 	heap_drop_with_catalog(viewName, allowSystemTableMods);
 }
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 0888e2638b217a2b1b81760a13aaf1c596411b7c..a9c5bd4037237ff5ef4edd0afab6476a9d73113a 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Id: execAmi.c,v 1.56 2001/01/24 19:42:53 momjian Exp $
+ *	$Id: execAmi.c,v 1.57 2001/03/22 03:59:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
  *		ExecInsert		   \  executor interface   /	aminsert
  *		ExecReScanR		   /  to access methods    \	amrescan
  *		ExecMarkPos		  /							\	ammarkpos
- *		ExecRestrPos	 /							 \  amrestpos
+ *		ExecRestrPos	 /							 \	amrestpos
  */
 
 #include "postgres.h"
@@ -91,7 +91,7 @@ ExecOpenScanR(Oid relOid,
 	 *	on whether this is a heap relation or an index relation.
 	 *
 	 *	For a table, acquire AccessShareLock for the duration of the query
-	 *	execution.  For indexes, acquire no lock here; the index machinery
+	 *	execution.	For indexes, acquire no lock here; the index machinery
 	 *	does its own locks and unlocks.  (We rely on having some kind of
 	 *	lock on the parent table to ensure the index won't go away!)
 	 * ----------------
@@ -413,7 +413,7 @@ ExecMarkPos(Plan *node)
 {
 	switch (nodeTag(node))
 	{
-		case T_SeqScan:
+			case T_SeqScan:
 			ExecSeqMarkPos((SeqScan *) node);
 			break;
 
@@ -455,7 +455,7 @@ ExecRestrPos(Plan *node)
 {
 	switch (nodeTag(node))
 	{
-		case T_SeqScan:
+			case T_SeqScan:
 			ExecSeqRestrPos((SeqScan *) node);
 			break;
 
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c
index f23ba27346219e09aab38e80a5f6760a29b49692..d288a8de735ce8e2641a450c5cdfefd357b652f0 100644
--- a/src/backend/executor/execJunk.c
+++ b/src/backend/executor/execJunk.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.25 2001/01/29 00:39:17 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.26 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -265,6 +265,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType)
 void
 ExecFreeJunkFilter(JunkFilter *junkfilter)
 {
+
 	/*
 	 * Since the junkfilter is inside its own context, we just have to
 	 * delete the context and we're set.
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 929134209ba4759d0d9a11a159528af347ecc0be..fc1dccd0467c404d175975dd378f525ae0369250 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -27,7 +27,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.138 2001/01/29 00:39:18 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,15 +51,15 @@ static TupleDesc InitPlan(CmdType operation,
 		 Plan *plan,
 		 EState *estate);
 static void initResultRelInfo(ResultRelInfo *resultRelInfo,
-							  Index resultRelationIndex,
-							  List *rangeTable,
-							  CmdType operation);
+				  Index resultRelationIndex,
+				  List *rangeTable,
+				  CmdType operation);
 static void EndPlan(Plan *plan, EState *estate);
 static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
-								   CmdType operation,
-								   long numberTuples,
-								   ScanDirection direction,
-								   DestReceiver *destfunc);
+			CmdType operation,
+			long numberTuples,
+			ScanDirection direction,
+			DestReceiver *destfunc);
 static void ExecRetrieve(TupleTableSlot *slot,
 			 DestReceiver *destfunc,
 			 EState *estate);
@@ -72,9 +72,9 @@ static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
 static TupleTableSlot *EvalPlanQualNext(EState *estate);
 static void EndEvalPlanQual(EState *estate);
 static void ExecCheckQueryPerms(CmdType operation, Query *parseTree,
-								Plan *plan);
+					Plan *plan);
 static void ExecCheckPlanPerms(Plan *plan, List *rangeTable,
-							   CmdType operation);
+				   CmdType operation);
 static void ExecCheckRTPerms(List *rangeTable, CmdType operation);
 static void ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation);
 
@@ -91,7 +91,7 @@ static void ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation);
  *		be returned by the query.
  *
  * NB: the CurrentMemoryContext when this is called must be the context
- * to be used as the per-query context for the query plan.  ExecutorRun()
+ * to be used as the per-query context for the query plan.	ExecutorRun()
  * and ExecutorEnd() must be called in this same memory context.
  * ----------------------------------------------------------------
  */
@@ -287,6 +287,7 @@ ExecutorEnd(QueryDesc *queryDesc, EState *estate)
 static void
 ExecCheckQueryPerms(CmdType operation, Query *parseTree, Plan *plan)
 {
+
 	/*
 	 * Check RTEs in the query's primary rangetable.
 	 */
@@ -339,7 +340,7 @@ ExecCheckPlanPerms(Plan *plan, List *rangeTable, CmdType operation)
 	{
 		case T_SubqueryScan:
 			{
-				SubqueryScan   *scan = (SubqueryScan *) plan;
+				SubqueryScan *scan = (SubqueryScan *) plan;
 				RangeTblEntry *rte;
 
 				/* Recursively check the subquery */
@@ -405,12 +406,13 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
 	relName = rte->relname;
 
 	/*
-	 * userid to check as: current user unless we have a setuid indication.
+	 * userid to check as: current user unless we have a setuid
+	 * indication.
 	 *
-	 * Note: GetUserId() is presently fast enough that there's no harm
-	 * in calling it separately for each RTE.  If that stops being true,
-	 * we could call it once in ExecCheckQueryPerms and pass the userid
-	 * down from there.  But for now, no need for the extra clutter.
+	 * Note: GetUserId() is presently fast enough that there's no harm in
+	 * calling it separately for each RTE.	If that stops being true, we
+	 * could call it once in ExecCheckQueryPerms and pass the userid down
+	 * from there.	But for now, no need for the extra clutter.
 	 */
 	userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
 
@@ -426,6 +428,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
 
 	if (rte->checkForWrite)
 	{
+
 		/*
 		 * Note: write access in a SELECT context means SELECT FOR UPDATE.
 		 * Right now we don't distinguish that from true update as far as
@@ -519,6 +522,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 
 		if (resultRelations != NIL)
 		{
+
 			/*
 			 * Multiple result relations (due to inheritance)
 			 * parseTree->resultRelations identifies them all
@@ -541,8 +545,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 		}
 		else
 		{
+
 			/*
-			 * Single result relation identified by parseTree->resultRelation
+			 * Single result relation identified by
+			 * parseTree->resultRelation
 			 */
 			numResultRelations = 1;
 			resultRelInfos = (ResultRelInfo *) palloc(sizeof(ResultRelInfo));
@@ -559,6 +565,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 	}
 	else
 	{
+
 		/*
 		 * if no result relation, then set state appropriately
 		 */
@@ -616,10 +623,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 	tupType = ExecGetTupType(plan);		/* tuple descriptor */
 
 	/*
-	 * Initialize the junk filter if needed. SELECT and INSERT queries need
-	 * a filter if there are any junk attrs in the tlist.  UPDATE and
-	 * DELETE always need one, since there's always a junk 'ctid' attribute
-	 * present --- no need to look first.
+	 * Initialize the junk filter if needed. SELECT and INSERT queries
+	 * need a filter if there are any junk attrs in the tlist.	UPDATE and
+	 * DELETE always need one, since there's always a junk 'ctid'
+	 * attribute present --- no need to look first.
 	 */
 	{
 		bool		junk_filter_needed = false;
@@ -650,11 +657,12 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 
 		if (junk_filter_needed)
 		{
+
 			/*
-			 * If there are multiple result relations, each one needs
-			 * its own junk filter.  Note this is only possible for
-			 * UPDATE/DELETE, so we can't be fooled by some needing
-			 * a filter and some not.
+			 * If there are multiple result relations, each one needs its
+			 * own junk filter.  Note this is only possible for
+			 * UPDATE/DELETE, so we can't be fooled by some needing a
+			 * filter and some not.
 			 */
 			if (parseTree->resultRelations != NIL)
 			{
@@ -678,6 +686,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 					resultRelInfo++;
 					subplans = lnext(subplans);
 				}
+
 				/*
 				 * Set active junkfilter too; at this point ExecInitAppend
 				 * has already selected an active result relation...
@@ -750,10 +759,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 				CommandCounterIncrement();
 
 				/*
-				 * If necessary, create a TOAST table for the into relation.
-				 * Note that AlterTableCreateToastTable ends with
-				 * CommandCounterIncrement(), so that the TOAST table will
-				 * be visible for insertion.
+				 * If necessary, create a TOAST table for the into
+				 * relation. Note that AlterTableCreateToastTable ends
+				 * with CommandCounterIncrement(), so that the TOAST table
+				 * will be visible for insertion.
 				 */
 				AlterTableCreateToastTable(intoName, true);
 
@@ -817,9 +826,8 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
 	/*
 	 * If there are indices on the result relation, open them and save
 	 * descriptors in the result relation info, so that we can add new
-	 * index entries for the tuples we add/update.	We need not do
-	 * this for a DELETE, however, since deletion doesn't affect
-	 * indexes.
+	 * index entries for the tuples we add/update.	We need not do this
+	 * for a DELETE, however, since deletion doesn't affect indexes.
 	 */
 	if (resultRelationDesc->rd_rel->relhasindex &&
 		operation != CMD_DELETE)
@@ -857,8 +865,8 @@ EndPlan(Plan *plan, EState *estate)
 	estate->es_tupleTable = NULL;
 
 	/*
-	 * close the result relation(s) if any, but hold locks
-	 * until xact commit.  Also clean up junkfilters if present.
+	 * close the result relation(s) if any, but hold locks until xact
+	 * commit.	Also clean up junkfilters if present.
 	 */
 	resultRelInfo = estate->es_result_relations;
 	for (i = estate->es_num_result_relations; i > 0; i--)
@@ -1033,7 +1041,7 @@ lnext:	;
 					/*
 					 * Unlike the UPDATE/DELETE case, a null result is
 					 * possible here, when the referenced table is on the
-					 * nullable side of an outer join.  Ignore nulls.
+					 * nullable side of an outer join.	Ignore nulls.
 					 */
 					if (isNull)
 						continue;
@@ -1216,7 +1224,7 @@ ExecAppend(TupleTableSlot *slot,
 
 	/* BEFORE ROW INSERT Triggers */
 	if (resultRelationDesc->trigdesc &&
-		resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
+	resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
 	{
 		HeapTuple	newtuple;
 
@@ -1227,11 +1235,12 @@ ExecAppend(TupleTableSlot *slot,
 
 		if (newtuple != tuple)	/* modified by Trigger(s) */
 		{
+
 			/*
 			 * Insert modified tuple into tuple table slot, replacing the
 			 * original.  We assume that it was allocated in per-tuple
-			 * memory context, and therefore will go away by itself.
-			 * The tuple table slot should not try to clear it.
+			 * memory context, and therefore will go away by itself. The
+			 * tuple table slot should not try to clear it.
 			 */
 			ExecStoreTuple(newtuple, slot, InvalidBuffer, false);
 			tuple = newtuple;
@@ -1294,7 +1303,7 @@ ExecDelete(TupleTableSlot *slot,
 
 	/* BEFORE ROW DELETE Triggers */
 	if (resultRelationDesc->trigdesc &&
-		resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
+	resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
 	{
 		bool		dodelete;
 
@@ -1323,7 +1332,7 @@ ldelete:;
 			else if (!(ItemPointerEquals(tupleid, &ctid)))
 			{
 				TupleTableSlot *epqslot = EvalPlanQual(estate,
-						  resultRelInfo->ri_RangeTableIndex, &ctid);
+							   resultRelInfo->ri_RangeTableIndex, &ctid);
 
 				if (!TupIsNull(epqslot))
 				{
@@ -1400,7 +1409,7 @@ ExecReplace(TupleTableSlot *slot,
 
 	/* BEFORE ROW UPDATE Triggers */
 	if (resultRelationDesc->trigdesc &&
-		resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
+	resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
 	{
 		HeapTuple	newtuple;
 
@@ -1411,11 +1420,12 @@ ExecReplace(TupleTableSlot *slot,
 
 		if (newtuple != tuple)	/* modified by Trigger(s) */
 		{
+
 			/*
 			 * Insert modified tuple into tuple table slot, replacing the
 			 * original.  We assume that it was allocated in per-tuple
-			 * memory context, and therefore will go away by itself.
-			 * The tuple table slot should not try to clear it.
+			 * memory context, and therefore will go away by itself. The
+			 * tuple table slot should not try to clear it.
 			 */
 			ExecStoreTuple(newtuple, slot, InvalidBuffer, false);
 			tuple = newtuple;
@@ -1447,7 +1457,7 @@ lreplace:;
 			else if (!(ItemPointerEquals(tupleid, &ctid)))
 			{
 				TupleTableSlot *epqslot = EvalPlanQual(estate,
-						  resultRelInfo->ri_RangeTableIndex, &ctid);
+							   resultRelInfo->ri_RangeTableIndex, &ctid);
 
 				if (!TupIsNull(epqslot))
 				{
@@ -1469,10 +1479,10 @@ lreplace:;
 
 	/*
 	 * Note: instead of having to update the old index tuples associated
-	 * with the heap tuple, all we do is form and insert new index
-	 * tuples.  This is because replaces are actually deletes and inserts
-	 * and index tuple deletion is done automagically by the vacuum
-	 * daemon. All we do is insert new index tuples.  -cim 9/27/89
+	 * with the heap tuple, all we do is form and insert new index tuples.
+	 * This is because replaces are actually deletes and inserts and index
+	 * tuple deletion is done automagically by the vacuum daemon. All we
+	 * do is insert new index tuples.  -cim 9/27/89
 	 */
 
 	/*
@@ -1525,8 +1535,8 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
 	}
 
 	/*
-	 * We will use the EState's per-tuple context for evaluating constraint
-	 * expressions (creating it if it's not already there).
+	 * We will use the EState's per-tuple context for evaluating
+	 * constraint expressions (creating it if it's not already there).
 	 */
 	econtext = GetPerTupleExprContext(estate);
 
@@ -1568,10 +1578,10 @@ ExecConstraints(char *caller, ResultRelInfo *resultRelInfo,
 
 		for (attrChk = 1; attrChk <= natts; attrChk++)
 		{
-			if (rel->rd_att->attrs[attrChk-1]->attnotnull &&
+			if (rel->rd_att->attrs[attrChk - 1]->attnotnull &&
 				heap_attisnull(tuple, attrChk))
 				elog(ERROR, "%s: Fail to add null value in not null attribute %s",
-					 caller, NameStr(rel->rd_att->attrs[attrChk-1]->attname));
+					 caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
 		}
 	}
 
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index bab2851df9d408d7b39c0f1656f1b2597572d6bc..79873073b7aadb0f6d6481966e3d9cc57f1ef3a6 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.83 2001/01/29 00:39:18 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.84 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,22 +46,22 @@
 
 /* static function decls */
 static Datum ExecEvalAggref(Aggref *aggref, ExprContext *econtext,
-							bool *isNull);
+			   bool *isNull);
 static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
-							  bool *isNull, ExprDoneCond *isDone);
+				 bool *isNull, ExprDoneCond *isDone);
 static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
-						  bool *isNull, ExprDoneCond *isDone);
+			 bool *isNull, ExprDoneCond *isDone);
 static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
-						  bool *isNull, ExprDoneCond *isDone);
+			 bool *isNull, ExprDoneCond *isDone);
 static ExprDoneCond ExecEvalFuncArgs(FunctionCachePtr fcache,
-									 List *argList,
-									 ExprContext *econtext);
+				 List *argList,
+				 ExprContext *econtext);
 static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext,
-						  bool *isNull, ExprDoneCond *isDone);
+			 bool *isNull, ExprDoneCond *isDone);
 
 
 /*----------
@@ -77,7 +77,7 @@ static Datum ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext,
  * done in versions up through 7.0) then an assignment like
  *			UPDATE table SET arrayfield[4] = NULL
  * will result in setting the whole array to NULL, which is certainly not
- * very desirable.  By returning the source array we make the assignment
+ * very desirable.	By returning the source array we make the assignment
  * into a no-op, instead.  (Eventually we need to redesign arrays so that
  * individual elements can be NULL, but for now, let's try to protect users
  * from shooting themselves in the foot.)
@@ -112,10 +112,11 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 										 econtext,
 										 isNull,
 										 isDone));
+
 		/*
 		 * If refexpr yields NULL, result is always NULL, for now anyway.
-		 * (This means you cannot assign to an element or slice of an array
-		 * that's NULL; it'll just stay NULL.)
+		 * (This means you cannot assign to an element or slice of an
+		 * array that's NULL; it'll just stay NULL.)
 		 */
 		if (*isNull)
 			return (Datum) NULL;
@@ -147,7 +148,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 		/* If any index expr yields NULL, result is NULL or source array */
 		if (*isNull)
 		{
-			if (! isAssignment || array_source == NULL)
+			if (!isAssignment || array_source == NULL)
 				return (Datum) NULL;
 			*isNull = false;
 			return PointerGetDatum(array_source);
@@ -166,10 +167,14 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 														 econtext,
 														 isNull,
 														 NULL));
-			/* If any index expr yields NULL, result is NULL or source array */
+
+			/*
+			 * If any index expr yields NULL, result is NULL or source
+			 * array
+			 */
 			if (*isNull)
 			{
-				if (! isAssignment || array_source == NULL)
+				if (!isAssignment || array_source == NULL)
 					return (Datum) NULL;
 				*isNull = false;
 				return PointerGetDatum(array_source);
@@ -189,9 +194,10 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 											  econtext,
 											  isNull,
 											  NULL);
+
 		/*
-		 * For now, can't cope with inserting NULL into an array,
-		 * so make it a no-op per discussion above...
+		 * For now, can't cope with inserting NULL into an array, so make
+		 * it a no-op per discussion above...
 		 */
 		if (*isNull)
 		{
@@ -202,7 +208,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 		}
 
 		if (array_source == NULL)
-			return sourceData;		/* XXX do something else? */
+			return sourceData;	/* XXX do something else? */
 
 		if (lIndex == NULL)
 			resultArray = array_set(array_source, i,
@@ -215,7 +221,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 		else
 			resultArray = array_set_slice(array_source, i,
 										  upper.indx, lower.indx,
-										  (ArrayType *) DatumGetPointer(sourceData),
+							   (ArrayType *) DatumGetPointer(sourceData),
 										  arrayRef->refelembyval,
 										  arrayRef->refelemlength,
 										  arrayRef->refattrlength,
@@ -587,12 +593,12 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
 	int			i;
 	List	   *arg;
 
-	argIsDone = ExprSingleResult; /* default assumption */
+	argIsDone = ExprSingleResult;		/* default assumption */
 
 	i = 0;
 	foreach(arg, argList)
 	{
-		ExprDoneCond	thisArgIsDone;
+		ExprDoneCond thisArgIsDone;
 
 		fcache->fcinfo.arg[i] = ExecEvalExpr((Node *) lfirst(arg),
 											 econtext,
@@ -601,10 +607,12 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
 
 		if (thisArgIsDone != ExprSingleResult)
 		{
+
 			/*
 			 * We allow only one argument to have a set value; we'd need
-			 * much more complexity to keep track of multiple set arguments
-			 * (cf. ExecTargetList) and it doesn't seem worth it.
+			 * much more complexity to keep track of multiple set
+			 * arguments (cf. ExecTargetList) and it doesn't seem worth
+			 * it.
 			 */
 			if (argIsDone != ExprSingleResult)
 				elog(ERROR, "Functions and operators can take only one set argument");
@@ -632,15 +640,15 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
 					   bool *isNull,
 					   ExprDoneCond *isDone)
 {
-	Datum				result;
-	ExprDoneCond		argDone;
-	int					i;
+	Datum		result;
+	ExprDoneCond argDone;
+	int			i;
 
 	/*
 	 * arguments is a list of expressions to evaluate before passing to
 	 * the function manager.  We skip the evaluation if it was already
-	 * done in the previous call (ie, we are continuing the evaluation
-	 * of a set-valued function).  Otherwise, collect the current argument
+	 * done in the previous call (ie, we are continuing the evaluation of
+	 * a set-valued function).	Otherwise, collect the current argument
 	 * values into fcache->fcinfo.
 	 */
 	if (fcache->fcinfo.nargs > 0 && !fcache->argsValid)
@@ -664,28 +672,30 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
 	 */
 	if (fcache->func.fn_retset || fcache->hasSetArg)
 	{
+
 		/*
-		 * We need to return a set result.  Complain if caller not ready
+		 * We need to return a set result.	Complain if caller not ready
 		 * to accept one.
 		 */
 		if (isDone == NULL)
 			elog(ERROR, "Set-valued function called in context that cannot accept a set");
 
 		/*
-		 * This loop handles the situation where we have both a set argument
-		 * and a set-valued function.  Once we have exhausted the function's
-		 * value(s) for a particular argument value, we have to get the next
-		 * argument value and start the function over again.  We might have
-		 * to do it more than once, if the function produces an empty result
-		 * set for a particular input value.
+		 * This loop handles the situation where we have both a set
+		 * argument and a set-valued function.	Once we have exhausted the
+		 * function's value(s) for a particular argument value, we have to
+		 * get the next argument value and start the function over again.
+		 * We might have to do it more than once, if the function produces
+		 * an empty result set for a particular input value.
 		 */
 		for (;;)
 		{
+
 			/*
 			 * If function is strict, and there are any NULL arguments,
 			 * skip calling the function (at least for this set of args).
 			 */
-			bool	callit = true;
+			bool		callit = true;
 
 			if (fcache->func.fn_strict)
 			{
@@ -716,13 +726,15 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
 
 			if (*isDone != ExprEndResult)
 			{
+
 				/*
-				 * Got a result from current argument.  If function itself
-				 * returns set, flag that we want to reuse current argument
-				 * values on next call.
+				 * Got a result from current argument.	If function itself
+				 * returns set, flag that we want to reuse current
+				 * argument values on next call.
 				 */
 				if (fcache->func.fn_retset)
 					fcache->argsValid = true;
+
 				/*
 				 * Make sure we say we are returning a set, even if the
 				 * function itself doesn't return sets.
@@ -762,11 +774,12 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
 	}
 	else
 	{
+
 		/*
 		 * Non-set case: much easier.
 		 *
-		 * If function is strict, and there are any NULL arguments,
-		 * skip calling the function and return NULL.
+		 * If function is strict, and there are any NULL arguments, skip
+		 * calling the function and return NULL.
 		 */
 		if (fcache->func.fn_strict)
 		{
@@ -852,9 +865,9 @@ ExecEvalFunc(Expr *funcClause,
 	FunctionCachePtr fcache;
 
 	/*
-	 * we extract the oid of the function associated with the func node and
-	 * then pass the work onto ExecMakeFunctionResult which evaluates the
-	 * arguments and returns the result of calling the function on the
+	 * we extract the oid of the function associated with the func node
+	 * and then pass the work onto ExecMakeFunctionResult which evaluates
+	 * the arguments and returns the result of calling the function on the
 	 * evaluated arguments.
 	 *
 	 * this is nearly identical to the ExecEvalOper code.
@@ -915,7 +928,7 @@ ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull)
 	 * evaluation of 'not' is simple.. expr is false, then return 'true'
 	 * and vice versa.
 	 */
-	return BoolGetDatum(! DatumGetBool(expr_value));
+	return BoolGetDatum(!DatumGetBool(expr_value));
 }
 
 /* ----------------------------------------------------------------
@@ -999,7 +1012,7 @@ ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull)
 		 */
 		if (*isNull)
 			AnyNull = true;		/* remember we got a null */
-		else if (! DatumGetBool(clause_value))
+		else if (!DatumGetBool(clause_value))
 			return clause_value;
 	}
 
@@ -1079,7 +1092,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
 					bool *isNull,
 					ExprDoneCond *isDone)
 {
-	Datum			result;
+	Datum		result;
 	TupleTableSlot *resSlot;
 
 	result = ExecEvalExpr(fselect->arg, econtext, isNull, isDone);
@@ -1111,7 +1124,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
  *
  * A caller that can only accept a singleton (non-set) result should pass
  * NULL for isDone; if the expression computes a set result then an elog()
- * error will be reported.  If the caller does pass an isDone pointer then
+ * error will be reported.	If the caller does pass an isDone pointer then
  * *isDone is set to one of these three states:
  *		ExprSingleResult		singleton result (not a set)
  *		ExprMultipleResult		return value is one element of a set
@@ -1127,7 +1140,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
  * The caller should already have switched into the temporary memory
  * context econtext->ecxt_per_tuple_memory.  The convenience entry point
  * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
- * do the switch in an outer loop.  We do not do the switch here because
+ * do the switch in an outer loop.	We do not do the switch here because
  * it'd be a waste of cycles during recursive entries to ExecEvalExpr().
  *
  * This routine is an inner loop routine and must be as fast as possible.
@@ -1353,15 +1366,15 @@ ExecQual(List *qual, ExprContext *econtext, bool resultForNull)
 		{
 			if (resultForNull == false)
 			{
-				result = false;	/* treat NULL as FALSE */
+				result = false; /* treat NULL as FALSE */
 				break;
 			}
 		}
 		else
 		{
-			if (! DatumGetBool(expr_value))
+			if (!DatumGetBool(expr_value))
 			{
-				result = false;	/* definitely FALSE */
+				result = false; /* definitely FALSE */
 				break;
 			}
 		}
@@ -1383,7 +1396,7 @@ ExecTargetListLength(List *targetlist)
 
 	foreach(tl, targetlist)
 	{
-		TargetEntry	   *curTle = (TargetEntry *) lfirst(tl);
+		TargetEntry *curTle = (TargetEntry *) lfirst(tl);
 
 		if (curTle->resdom != NULL)
 			len++;
@@ -1404,17 +1417,15 @@ ExecCleanTargetListLength(List *targetlist)
 
 	foreach(tl, targetlist)
 	{
-		TargetEntry	   *curTle = (TargetEntry *) lfirst(tl);
+		TargetEntry *curTle = (TargetEntry *) lfirst(tl);
 
 		if (curTle->resdom != NULL)
 		{
-			if (! curTle->resdom->resjunk)
+			if (!curTle->resdom->resjunk)
 				len++;
 		}
 		else
-		{
 			len += curTle->fjoin->fj_nNodes;
-		}
 	}
 	return len;
 }
@@ -1440,6 +1451,7 @@ ExecTargetList(List *targetlist,
 			   ExprDoneCond *isDone)
 {
 	MemoryContext oldContext;
+
 #define NPREALLOCDOMAINS 64
 	char		nullsArray[NPREALLOCDOMAINS];
 	bool		fjIsNullArray[NPREALLOCDOMAINS];
@@ -1484,10 +1496,11 @@ ExecTargetList(List *targetlist,
 	 * we have a really large targetlist.  otherwise we use the stack.
 	 *
 	 * We also allocate a bool array that is used to hold fjoin result state,
-	 * and another array that holds the isDone status for each targetlist item.
-	 * The isDone status is needed so that we can iterate, generating multiple
-	 * tuples, when one or more tlist items return sets.  (We expect the caller
-	 * to call us again if we return *isDone = ExprMultipleResult.)
+	 * and another array that holds the isDone status for each targetlist
+	 * item. The isDone status is needed so that we can iterate,
+	 * generating multiple tuples, when one or more tlist items return
+	 * sets.  (We expect the caller to call us again if we return *isDone
+	 * = ExprMultipleResult.)
 	 */
 	if (nodomains > NPREALLOCDOMAINS)
 	{
@@ -1507,7 +1520,7 @@ ExecTargetList(List *targetlist,
 	 */
 
 	if (isDone)
-		*isDone = ExprSingleResult;	/* until proven otherwise */
+		*isDone = ExprSingleResult;		/* until proven otherwise */
 
 	haveDoneSets = false;		/* any exhausted set exprs in tlist? */
 
@@ -1554,8 +1567,10 @@ ExecTargetList(List *targetlist,
 
 			ExecEvalFjoin(tle, econtext, fjIsNull, isDone);
 
-			/* XXX this is wrong, but since fjoin code is completely broken
-			 * anyway, I'm not going to worry about it now --- tgl 8/23/00
+			/*
+			 * XXX this is wrong, but since fjoin code is completely
+			 * broken anyway, I'm not going to worry about it now --- tgl
+			 * 8/23/00
 			 */
 			if (isDone && *isDone == ExprEndResult)
 			{
@@ -1594,6 +1609,7 @@ ExecTargetList(List *targetlist,
 
 	if (haveDoneSets)
 	{
+
 		/*
 		 * note: can't get here unless we verified isDone != NULL
 		 */
@@ -1601,7 +1617,8 @@ ExecTargetList(List *targetlist,
 		{
 
 			/*
-			 * all sets are done, so report that tlist expansion is complete.
+			 * all sets are done, so report that tlist expansion is
+			 * complete.
 			 */
 			*isDone = ExprEndResult;
 			MemoryContextSwitchTo(oldContext);
@@ -1612,7 +1629,7 @@ ExecTargetList(List *targetlist,
 		{
 
 			/*
-			 * We have some done and some undone sets.  Restart the done
+			 * We have some done and some undone sets.	Restart the done
 			 * ones so that we can deliver a tuple (if possible).
 			 */
 			foreach(tl, targetlist)
@@ -1628,7 +1645,7 @@ ExecTargetList(List *targetlist,
 						values[resind] = ExecEvalExpr(tle->expr,
 													  econtext,
 													  &isNull,
-													  &itemIsDone[resind]);
+													&itemIsDone[resind]);
 						nulls[resind] = isNull ? 'n' : ' ';
 
 						if (itemIsDone[resind] == ExprEndResult)
@@ -1644,10 +1661,11 @@ ExecTargetList(List *targetlist,
 					}
 				}
 			}
+
 			/*
-			 * If we cannot make a tuple because some sets are empty,
-			 * we still have to cycle the nonempty sets to completion,
-			 * else resources will not be released from subplans etc.
+			 * If we cannot make a tuple because some sets are empty, we
+			 * still have to cycle the nonempty sets to completion, else
+			 * resources will not be released from subplans etc.
 			 */
 			if (*isDone == ExprEndResult)
 			{
@@ -1752,8 +1770,8 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
 	/*
 	 * store the tuple in the projection slot and return the slot.
 	 */
-	return ExecStoreTuple(newTuple,			/* tuple to store */
-						  slot,				/* slot to store in */
-						  InvalidBuffer,	/* tuple has no buffer */
+	return ExecStoreTuple(newTuple,		/* tuple to store */
+						  slot, /* slot to store in */
+						  InvalidBuffer,		/* tuple has no buffer */
 						  true);
 }
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 3a2e79dbdd4bc11ed31847a37f3884449e6bb8da..58a3b5edea46a814ae00acfa5fe1254aa8a79361 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.15 2001/01/24 19:42:54 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.16 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,7 +46,7 @@
  */
 TupleTableSlot *
 ExecScan(Scan *node,
-		 ExecScanAccessMtd accessMtd) /* function returning a tuple */
+		 ExecScanAccessMtd accessMtd)	/* function returning a tuple */
 {
 	CommonScanState *scanstate;
 	EState	   *estate;
@@ -81,7 +81,7 @@ ExecScan(Scan *node,
 
 	/* ----------------
 	 *	Reset per-tuple memory context to free any expression evaluation
-	 *	storage allocated in the previous tuple cycle.  Note this can't
+	 *	storage allocated in the previous tuple cycle.	Note this can't
 	 *	happen until we're done projecting out tuples from a scan tuple.
 	 * ----------------
 	 */
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index e5f1a269d817bb8bd091f31114fab638b66d28e2..3e75aef337c6bc3969313aca859b95965d935191 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.46 2001/01/29 00:39:18 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.47 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@
  *		TupIsNull				- true when slot contains no tuple(Macro)
  *
  *	 CONVENIENCE INITIALIZATION ROUTINES
- *		ExecInitResultTupleSlot	   \	convenience routines to initialize
+ *		ExecInitResultTupleSlot    \	convenience routines to initialize
  *		ExecInitScanTupleSlot		\	the various tuple slots for nodes
  *		ExecInitExtraTupleSlot		/	which store copies of tuples.
  *		ExecInitNullTupleSlot	   /
@@ -422,7 +422,7 @@ ExecClearTuple(TupleTableSlot *slot)	/* slot in which to store tuple */
 
 	slot->val = (HeapTuple) NULL;
 
-	slot->ttc_shouldFree = true;	/* probably useless code... */
+	slot->ttc_shouldFree = true;/* probably useless code... */
 
 	/* ----------------
 	 *	Drop the pin on the referenced buffer, if there is one.
@@ -446,7 +446,7 @@ ExecClearTuple(TupleTableSlot *slot)	/* slot in which to store tuple */
 void
 ExecSetSlotDescriptor(TupleTableSlot *slot,		/* slot to change */
 					  TupleDesc tupdesc,		/* new tuple descriptor */
-					  bool shouldFree)			/* is desc owned by slot? */
+					  bool shouldFree)	/* is desc owned by slot? */
 {
 	if (slot->ttc_shouldFreeDesc &&
 		slot->ttc_tupleDescriptor != NULL)
@@ -482,7 +482,7 @@ ExecSetSlotDescriptorIsNew(TupleTableSlot *slot,		/* slot to change */
  *		ExecInit{Result,Scan,Extra}TupleSlot
  *
  *		These are convenience routines to initialize the specified slot
- *		in nodes inheriting the appropriate state.  ExecInitExtraTupleSlot
+ *		in nodes inheriting the appropriate state.	ExecInitExtraTupleSlot
  *		is used for initializing special-purpose slots.
  * --------------------------------
  */
@@ -541,11 +541,13 @@ ExecInitExtraTupleSlot(EState *estate)
 TupleTableSlot *
 ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
 {
-	TupleTableSlot*   slot = ExecInitExtraTupleSlot(estate);
+	TupleTableSlot *slot = ExecInitExtraTupleSlot(estate);
+
 	/*
 	 * Since heap_getattr() will treat attributes beyond a tuple's t_natts
-	 * as being NULL, we can make an all-nulls tuple just by making it be of
-	 * zero length.  However, the slot descriptor must match the real tupType.
+	 * as being NULL, we can make an all-nulls tuple just by making it be
+	 * of zero length.	However, the slot descriptor must match the real
+	 * tupType.
 	 */
 	HeapTuple	nullTuple;
 	Datum		values[1];
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 6b030b64a0e9a6a8be8008198bf899a9c4d33e5d..6ee0d2e26ed2caad0cc14cfe930fd295aff47e3c 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.73 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.74 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -148,6 +148,7 @@ ExecAssignExprContext(EState *estate, CommonState *commonstate)
 	econtext->ecxt_innertuple = NULL;
 	econtext->ecxt_outertuple = NULL;
 	econtext->ecxt_per_query_memory = CurrentMemoryContext;
+
 	/*
 	 * Create working memory for expression evaluation in this context.
 	 */
@@ -184,14 +185,16 @@ MakeExprContext(TupleTableSlot *slot,
 	econtext->ecxt_innertuple = NULL;
 	econtext->ecxt_outertuple = NULL;
 	econtext->ecxt_per_query_memory = queryContext;
+
 	/*
 	 * We make the temporary context a child of current working context,
 	 * not of the specified queryContext.  This seems reasonable but I'm
 	 * not totally sure about it...
 	 *
 	 * Expression contexts made via this routine typically don't live long
-	 * enough to get reset, so specify a minsize of 0.  That avoids alloc'ing
-	 * any memory in the common case where expr eval doesn't use any.
+	 * enough to get reset, so specify a minsize of 0.	That avoids
+	 * alloc'ing any memory in the common case where expr eval doesn't use
+	 * any.
 	 */
 	econtext->ecxt_per_tuple_memory =
 		AllocSetContextCreate(CurrentMemoryContext,
@@ -209,7 +212,7 @@ MakeExprContext(TupleTableSlot *slot,
 
 /*
  * Free an ExprContext made by MakeExprContext, including the temporary
- * context used for expression evaluation.  Note this will cause any
+ * context used for expression evaluation.	Note this will cause any
  * pass-by-reference expression result to go away!
  */
 void
@@ -447,7 +450,7 @@ ExecAssignScanTypeFromOuterPlan(Plan *node, CommonScanState *csstate)
  *		resultRelInfo->ri_RelationDesc.
  *
  *		This used to be horribly ugly code, and slow too because it
- *		did a sequential scan of pg_index.  Now we rely on the relcache
+ *		did a sequential scan of pg_index.	Now we rely on the relcache
  *		to cache a list of the OIDs of the indices associated with any
  *		specific relation, and we use the pg_index syscache to get the
  *		entries we need from pg_index.
@@ -467,7 +470,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
 	resultRelInfo->ri_NumIndices = 0;
 
 	/* checks for disabled indexes */
-	if (! RelationGetForm(resultRelation)->relhasindex)
+	if (!RelationGetForm(resultRelation)->relhasindex)
 		return;
 	if (IsIgnoringSystemIndexes() &&
 		IsSystemRelationName(RelationGetRelationName(resultRelation)))
@@ -635,8 +638,9 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
 	heapDescriptor = RelationGetDescr(heapRelation);
 
 	/*
-	 * We will use the EState's per-tuple context for evaluating predicates
-	 * and functional-index functions (creating it if it's not already there).
+	 * We will use the EState's per-tuple context for evaluating
+	 * predicates and functional-index functions (creating it if it's not
+	 * already there).
 	 */
 	econtext = GetPerTupleExprContext(estate);
 
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 575f33d84b690c4c8bab63f5dd86be2cbcc88a37..4cc1dc27926eb6714262e2dad57c0151b406d49f 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.43 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.44 2001/03/22 03:59:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,15 +70,15 @@ typedef SQLFunctionCache *SQLFunctionCachePtr;
 
 /* non-export function prototypes */
 static execution_state *init_execution_state(char *src,
-											 Oid *argOidVect, int nargs);
+					 Oid *argOidVect, int nargs);
 static void init_sql_fcache(FmgrInfo *finfo);
 static void postquel_start(execution_state *es);
 static TupleTableSlot *postquel_getnext(execution_state *es);
 static void postquel_end(execution_state *es);
 static void postquel_sub_params(execution_state *es, FunctionCallInfo fcinfo);
 static Datum postquel_execute(execution_state *es,
-							  FunctionCallInfo fcinfo,
-							  SQLFunctionCachePtr fcache);
+				 FunctionCallInfo fcinfo,
+				 SQLFunctionCachePtr fcache);
 
 
 static execution_state *
@@ -180,7 +180,7 @@ init_sql_fcache(FmgrInfo *finfo)
 	 * ----------------
 	 */
 	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(procedureStruct->prorettype),
+						   ObjectIdGetDatum(procedureStruct->prorettype),
 							   0, 0, 0);
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "init_sql_fcache: Cache lookup failed for type %u",
@@ -235,9 +235,7 @@ init_sql_fcache(FmgrInfo *finfo)
 			   nargs * sizeof(Oid));
 	}
 	else
-	{
 		argOidVect = (Oid *) NULL;
-	}
 
 	tmp = SysCacheGetAttr(PROCOID,
 						  procedureTuple,
@@ -346,8 +344,8 @@ copy_function_result(SQLFunctionCachePtr fcache,
 		return resultSlot;		/* no need to copy result */
 
 	/*
-	 * If first time through, we have to initialize the funcSlot's
-	 * tuple descriptor.
+	 * If first time through, we have to initialize the funcSlot's tuple
+	 * descriptor.
 	 */
 	if (funcSlot->ttc_tupleDescriptor == NULL)
 	{
@@ -415,12 +413,14 @@ postquel_execute(execution_state *es,
 
 		/*
 		 * If we are supposed to return a tuple, we return the tuple slot
-		 * pointer converted to Datum.  If we are supposed to return a simple
-		 * value, then project out the first attribute of the result tuple
-		 * (ie, take the first result column of the final SELECT).
+		 * pointer converted to Datum.	If we are supposed to return a
+		 * simple value, then project out the first attribute of the
+		 * result tuple (ie, take the first result column of the final
+		 * SELECT).
 		 */
 		if (fcache->returnsTuple)
 		{
+
 			/*
 			 * XXX do we need to remove junk attrs from the result tuple?
 			 * Probably OK to leave them, as long as they are at the end.
@@ -434,6 +434,7 @@ postquel_execute(execution_state *es,
 								 1,
 								 resSlot->ttc_tupleDescriptor,
 								 &(fcinfo->isnull));
+
 			/*
 			 * Note: if result type is pass-by-reference then we are
 			 * returning a pointer into the tuple copied by
@@ -546,7 +547,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
 		 */
 		if (fcinfo->flinfo->fn_retset)
 		{
-			ReturnSetInfo  *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
+			ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
 
 			if (rsi && IsA(rsi, ReturnSetInfo))
 				rsi->isDone = ExprEndResult;
@@ -572,7 +573,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
 	 */
 	if (fcinfo->flinfo->fn_retset)
 	{
-		ReturnSetInfo  *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
+		ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
 
 		if (rsi && IsA(rsi, ReturnSetInfo))
 			rsi->isDone = ExprMultipleResult;
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index f60f499e6be894731261cbdba2d158a77ddf853a..e0f50bd66d1739d1fa1736d27ee176c7c20bbeb6 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -19,7 +19,7 @@
  *	  The agg's input type and transtype must be the same in this case!
  *
  *	  If transfunc is marked "strict" then NULL input_values are skipped,
- *	  keeping the previous transvalue.  If transfunc is not strict then it
+ *	  keeping the previous transvalue.	If transfunc is not strict then it
  *	  is called for every input tuple and must deal with NULL initcond
  *	  or NULL input_value for itself.
  *
@@ -34,7 +34,7 @@
  *	  are not allowed to accumulate until end of query.  We do this by
  *	  "ping-ponging" between two memory contexts; successive calls to the
  *	  transfunc are executed in alternate contexts, passing the previous
- *	  transvalue that is in the other context.  At the beginning of each
+ *	  transvalue that is in the other context.	At the beginning of each
  *	  tuple cycle we can reset the current output context to avoid memory
  *	  usage growth.  Note: we must use MemoryContextContains() to check
  *	  whether the transfunc has perhaps handed us back one of its input
@@ -46,7 +46,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.75 2001/02/16 03:16:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.76 2001/03/22 03:59:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -130,8 +130,8 @@ typedef struct AggStatePerAggData
 	 * an input tuple group and updated for each input tuple.
 	 *
 	 * For a simple (non DISTINCT) aggregate, we just feed the input values
-	 * straight to the transition function.  If it's DISTINCT, we pass
-	 * the input values into a Tuplesort object; then at completion of the
+	 * straight to the transition function.  If it's DISTINCT, we pass the
+	 * input values into a Tuplesort object; then at completion of the
 	 * input tuple group, we scan the sorted values, eliminate duplicates,
 	 * and run the transition function on the rest.
 	 */
@@ -144,20 +144,21 @@ typedef struct AggStatePerAggData
 	bool		noTransValue;	/* true if transValue not set yet */
 
 	/*
-	 * Note: noTransValue initially has the same value as transValueIsNull,
-	 * and if true both are cleared to false at the same time.  They are
-	 * not the same though: if transfn later returns a NULL, we want to
-	 * keep that NULL and not auto-replace it with a later input value.
-	 * Only the first non-NULL input will be auto-substituted.
+	 * Note: noTransValue initially has the same value as
+	 * transValueIsNull, and if true both are cleared to false at the same
+	 * time.  They are not the same though: if transfn later returns a
+	 * NULL, we want to keep that NULL and not auto-replace it with a
+	 * later input value. Only the first non-NULL input will be
+	 * auto-substituted.
 	 */
 } AggStatePerAggData;
 
 
 static void initialize_aggregate(AggStatePerAgg peraggstate);
 static void advance_transition_function(AggStatePerAgg peraggstate,
-										Datum newVal, bool isNull);
+							Datum newVal, bool isNull);
 static void process_sorted_aggregate(AggState *aggstate,
-									 AggStatePerAgg peraggstate);
+						 AggStatePerAgg peraggstate);
 static void finalize_aggregate(AggStatePerAgg peraggstate,
 				   Datum *resultVal, bool *resultIsNull);
 
@@ -195,8 +196,8 @@ initialize_aggregate(AggStatePerAgg peraggstate)
 	 * (Re)set transValue to the initial value.
 	 *
 	 * Note that when the initial value is pass-by-ref, we just reuse it
-	 * without copying for each group.  Hence, transition function
-	 * had better not scribble on its input, or it will fail for GROUP BY!
+	 * without copying for each group.	Hence, transition function had
+	 * better not scribble on its input, or it will fail for GROUP BY!
 	 */
 	peraggstate->transValue = peraggstate->initValue;
 	peraggstate->transValueIsNull = peraggstate->initValueIsNull;
@@ -222,50 +223,55 @@ static void
 advance_transition_function(AggStatePerAgg peraggstate,
 							Datum newVal, bool isNull)
 {
-	FunctionCallInfoData	fcinfo;
+	FunctionCallInfoData fcinfo;
 
 	if (peraggstate->transfn.fn_strict)
 	{
 		if (isNull)
 		{
+
 			/*
-			 * For a strict transfn, nothing happens at a NULL input tuple;
-			 * we just keep the prior transValue.  However, if the transtype
-			 * is pass-by-ref, we have to copy it into the new context
-			 * because the old one is going to get reset.
+			 * For a strict transfn, nothing happens at a NULL input
+			 * tuple; we just keep the prior transValue.  However, if the
+			 * transtype is pass-by-ref, we have to copy it into the new
+			 * context because the old one is going to get reset.
 			 */
 			if (!peraggstate->transValueIsNull)
 				peraggstate->transValue = datumCopy(peraggstate->transValue,
-												peraggstate->transtypeByVal,
-												peraggstate->transtypeLen);
+											 peraggstate->transtypeByVal,
+											  peraggstate->transtypeLen);
 			return;
 		}
 		if (peraggstate->noTransValue)
 		{
+
 			/*
-			 * transValue has not been initialized. This is the first non-NULL
-			 * input value. We use it as the initial value for transValue.
-			 * (We already checked that the agg's input type is binary-
-			 * compatible with its transtype, so straight copy here is OK.)
+			 * transValue has not been initialized. This is the first
+			 * non-NULL input value. We use it as the initial value for
+			 * transValue. (We already checked that the agg's input type
+			 * is binary- compatible with its transtype, so straight copy
+			 * here is OK.)
 			 *
-			 * We had better copy the datum if it is pass-by-ref, since
-			 * the given pointer may be pointing into a scan tuple that
-			 * will be freed on the next iteration of the scan.
+			 * We had better copy the datum if it is pass-by-ref, since the
+			 * given pointer may be pointing into a scan tuple that will
+			 * be freed on the next iteration of the scan.
 			 */
 			peraggstate->transValue = datumCopy(newVal,
-												peraggstate->transtypeByVal,
-												peraggstate->transtypeLen);
+											 peraggstate->transtypeByVal,
+											  peraggstate->transtypeLen);
 			peraggstate->transValueIsNull = false;
 			peraggstate->noTransValue = false;
 			return;
 		}
 		if (peraggstate->transValueIsNull)
 		{
+
 			/*
 			 * Don't call a strict function with NULL inputs.  Note it is
-			 * possible to get here despite the above tests, if the transfn
-			 * is strict *and* returned a NULL on a prior cycle.  If that
-			 * happens we will propagate the NULL all the way to the end.
+			 * possible to get here despite the above tests, if the
+			 * transfn is strict *and* returned a NULL on a prior cycle.
+			 * If that happens we will propagate the NULL all the way to
+			 * the end.
 			 */
 			return;
 		}
@@ -283,14 +289,14 @@ advance_transition_function(AggStatePerAgg peraggstate,
 	newVal = FunctionCallInvoke(&fcinfo);
 
 	/*
-	 * If the transition function was uncooperative, it may have
-	 * given us a pass-by-ref result that points at the scan tuple
-	 * or the prior-cycle working memory.  Copy it into the active
-	 * context if it doesn't look right.
+	 * If the transition function was uncooperative, it may have given us
+	 * a pass-by-ref result that points at the scan tuple or the
+	 * prior-cycle working memory.	Copy it into the active context if it
+	 * doesn't look right.
 	 */
 	if (!peraggstate->transtypeByVal && !fcinfo.isnull &&
-		! MemoryContextContains(CurrentMemoryContext,
-								DatumGetPointer(newVal)))
+		!MemoryContextContains(CurrentMemoryContext,
+							   DatumGetPointer(newVal)))
 		newVal = datumCopy(newVal,
 						   peraggstate->transtypeByVal,
 						   peraggstate->transtypeLen);
@@ -302,7 +308,7 @@ advance_transition_function(AggStatePerAgg peraggstate,
 /*
  * Run the transition function for a DISTINCT aggregate.  This is called
  * after we have completed entering all the input values into the sort
- * object.  We complete the sort, read out the values in sorted order,
+ * object.	We complete the sort, read out the values in sorted order,
  * and run the transition function on each non-duplicate value.
  *
  * When called, CurrentMemoryContext should be the per-query context.
@@ -321,19 +327,21 @@ process_sorted_aggregate(AggState *aggstate,
 
 	/*
 	 * Note: if input type is pass-by-ref, the datums returned by the sort
-	 * are freshly palloc'd in the per-query context, so we must be careful
-	 * to pfree them when they are no longer needed.
+	 * are freshly palloc'd in the per-query context, so we must be
+	 * careful to pfree them when they are no longer needed.
 	 */
 
 	while (tuplesort_getdatum(peraggstate->sortstate, true,
 							  &newVal, &isNull))
 	{
+
 		/*
 		 * DISTINCT always suppresses nulls, per SQL spec, regardless of
 		 * the transition function's strictness.
 		 */
 		if (isNull)
 			continue;
+
 		/*
 		 * Clear and select the current working context for evaluation of
 		 * the equality function and transition function.
@@ -349,6 +357,7 @@ process_sorted_aggregate(AggState *aggstate,
 			/* equal to prior, so forget this one */
 			if (!peraggstate->inputtypeByVal)
 				pfree(DatumGetPointer(newVal));
+
 			/*
 			 * note we do NOT flip contexts in this case, so no need to
 			 * copy prior transValue to other context.
@@ -357,6 +366,7 @@ process_sorted_aggregate(AggState *aggstate,
 		else
 		{
 			advance_transition_function(peraggstate, newVal, false);
+
 			/*
 			 * Make the other context current so that this transition
 			 * result is preserved.
@@ -389,12 +399,13 @@ static void
 finalize_aggregate(AggStatePerAgg peraggstate,
 				   Datum *resultVal, bool *resultIsNull)
 {
+
 	/*
 	 * Apply the agg's finalfn if one is provided, else return transValue.
 	 */
 	if (OidIsValid(peraggstate->finalfn_oid))
 	{
-		FunctionCallInfoData	fcinfo;
+		FunctionCallInfoData fcinfo;
 
 		MemSet(&fcinfo, 0, sizeof(fcinfo));
 		fcinfo.flinfo = &peraggstate->finalfn;
@@ -422,9 +433,9 @@ finalize_aggregate(AggStatePerAgg peraggstate,
 	/*
 	 * If result is pass-by-ref, make sure it is in the right context.
 	 */
-	if (!peraggstate->resulttypeByVal && ! *resultIsNull &&
-		! MemoryContextContains(CurrentMemoryContext,
-								DatumGetPointer(*resultVal)))
+	if (!peraggstate->resulttypeByVal && !*resultIsNull &&
+		!MemoryContextContains(CurrentMemoryContext,
+							   DatumGetPointer(*resultVal)))
 		*resultVal = datumCopy(*resultVal,
 							   peraggstate->resulttypeByVal,
 							   peraggstate->resulttypeLen);
@@ -480,7 +491,8 @@ ExecAgg(Agg *node)
 	peragg = aggstate->peragg;
 
 	/*
-	 * We loop retrieving groups until we find one matching node->plan.qual
+	 * We loop retrieving groups until we find one matching
+	 * node->plan.qual
 	 */
 	do
 	{
@@ -578,19 +590,19 @@ ExecAgg(Agg *node)
 		 * calculation, and stash results in the per-output-tuple context.
 		 *
 		 * This is a bit tricky when there are both DISTINCT and plain
-		 * aggregates: we must first finalize all the plain aggs and then all
-		 * the DISTINCT ones.  This is needed because the last transition
-		 * values for the plain aggs are stored in the not-current working
-		 * context, and we have to evaluate those aggs (and stash the results
-		 * in the output tup_cxt!) before we start flipping contexts again
-		 * in process_sorted_aggregate.
+		 * aggregates: we must first finalize all the plain aggs and then
+		 * all the DISTINCT ones.  This is needed because the last
+		 * transition values for the plain aggs are stored in the
+		 * not-current working context, and we have to evaluate those aggs
+		 * (and stash the results in the output tup_cxt!) before we start
+		 * flipping contexts again in process_sorted_aggregate.
 		 */
 		oldContext = MemoryContextSwitchTo(aggstate->tup_cxt);
 		for (aggno = 0; aggno < aggstate->numaggs; aggno++)
 		{
 			AggStatePerAgg peraggstate = &peragg[aggno];
 
-			if (! peraggstate->aggref->aggdistinct)
+			if (!peraggstate->aggref->aggdistinct)
 				finalize_aggregate(peraggstate,
 								   &aggvalues[aggno], &aggnulls[aggno]);
 		}
@@ -766,21 +778,22 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
 	ExecAssignExprContext(estate, &aggstate->csstate.cstate);
 
 	/*
-	 * We actually need three separate expression memory contexts: one
-	 * for calculating per-output-tuple values (ie, the finished aggregate
+	 * We actually need three separate expression memory contexts: one for
+	 * calculating per-output-tuple values (ie, the finished aggregate
 	 * results), and two that we ping-pong between for per-input-tuple
 	 * evaluation of input expressions and transition functions.  The
-	 * context made by ExecAssignExprContext() is used as the output context.
+	 * context made by ExecAssignExprContext() is used as the output
+	 * context.
 	 */
 	aggstate->tup_cxt =
 		aggstate->csstate.cstate.cs_ExprContext->ecxt_per_tuple_memory;
-	aggstate->agg_cxt[0] = 
+	aggstate->agg_cxt[0] =
 		AllocSetContextCreate(CurrentMemoryContext,
 							  "AggExprContext1",
 							  ALLOCSET_DEFAULT_MINSIZE,
 							  ALLOCSET_DEFAULT_INITSIZE,
 							  ALLOCSET_DEFAULT_MAXSIZE);
-	aggstate->agg_cxt[1] = 
+	aggstate->agg_cxt[1] =
 		AllocSetContextCreate(CurrentMemoryContext,
 							  "AggExprContext2",
 							  ALLOCSET_DEFAULT_MINSIZE,
@@ -882,30 +895,32 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
 		/*
 		 * If the transfn is strict and the initval is NULL, make sure
 		 * input type and transtype are the same (or at least binary-
-		 * compatible), so that it's OK to use the first input value
-		 * as the initial transValue.  This should have been checked at
-		 * agg definition time, but just in case...
+		 * compatible), so that it's OK to use the first input value as
+		 * the initial transValue.	This should have been checked at agg
+		 * definition time, but just in case...
 		 */
 		if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
 		{
+
 			/*
-			 * Note: use the type from the input expression here,
-			 * not aggform->aggbasetype, because the latter might be 0.
+			 * Note: use the type from the input expression here, not
+			 * aggform->aggbasetype, because the latter might be 0.
 			 * (Consider COUNT(*).)
 			 */
 			Oid			inputType = exprType(aggref->target);
 
 			if (inputType != aggform->aggtranstype &&
-				! IS_BINARY_COMPATIBLE(inputType, aggform->aggtranstype))
+				!IS_BINARY_COMPATIBLE(inputType, aggform->aggtranstype))
 				elog(ERROR, "Aggregate %s needs to have compatible input type and transition type",
 					 aggname);
 		}
 
 		if (aggref->aggdistinct)
 		{
+
 			/*
-			 * Note: use the type from the input expression here,
-			 * not aggform->aggbasetype, because the latter might be 0.
+			 * Note: use the type from the input expression here, not
+			 * aggform->aggbasetype, because the latter might be 0.
 			 * (Consider COUNT(*).)
 			 */
 			Oid			inputType = exprType(aggref->target);
@@ -947,12 +962,14 @@ ExecEndAgg(Agg *node)
 	Plan	   *outerPlan;
 
 	ExecFreeProjectionInfo(&aggstate->csstate.cstate);
+
 	/*
 	 * Make sure ExecFreeExprContext() frees the right expr context...
 	 */
 	aggstate->csstate.cstate.cs_ExprContext->ecxt_per_tuple_memory =
 		aggstate->tup_cxt;
 	ExecFreeExprContext(&aggstate->csstate.cstate);
+
 	/*
 	 * ... and I free the others.
 	 */
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index e4ede51852a10dab8b578bd0d59931ab83262c6d..500e9c07c43fc024ec382e4a1bc9e31921d08b80 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -15,7 +15,7 @@
  *	  locate group boundaries.
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.41 2001/02/16 03:16:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.42 2001/03/22 03:59:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -88,8 +88,8 @@ ExecGroupEveryTuple(Group *node)
 	tupdesc = ExecGetScanType(&grpstate->csstate);
 
 	/*
-	 *	We need not call ResetExprContext here because execTuplesMatch
-	 *	will reset the per-tuple memory context once per input tuple.
+	 * We need not call ResetExprContext here because execTuplesMatch will
+	 * reset the per-tuple memory context once per input tuple.
 	 */
 
 	/* if we haven't returned first tuple of a new group yet ... */
@@ -199,8 +199,8 @@ ExecGroupOneTuple(Group *node)
 	tupdesc = ExecGetScanType(&grpstate->csstate);
 
 	/*
-	 *	We need not call ResetExprContext here because execTuplesMatch
-	 *	will reset the per-tuple memory context once per input tuple.
+	 * We need not call ResetExprContext here because execTuplesMatch will
+	 * reset the per-tuple memory context once per input tuple.
 	 */
 
 	firsttuple = grpstate->grp_firstTuple;
@@ -465,8 +465,8 @@ execTuplesMatch(HeapTuple tuple1,
 
 		/* Apply the type-specific equality function */
 
-		if (! DatumGetBool(FunctionCall2(&eqfunctions[i],
-										 attr1, attr2)))
+		if (!DatumGetBool(FunctionCall2(&eqfunctions[i],
+										attr1, attr2)))
 		{
 			result = false;		/* they aren't equal */
 			break;
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 070354ace7cf181c100e6fb7dfa556b7e24bc5a7..7b5e3d4ccedf6a89ac2a760f7c29ec5c22f4cdc8 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *	$Id: nodeHash.c,v 1.54 2001/01/24 19:42:54 momjian Exp $
+ *	$Id: nodeHash.c,v 1.55 2001/03/22 03:59:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -540,9 +540,7 @@ ExecHashGetBucket(HashJoinTable hashtable,
 	 * ------------------
 	 */
 	if (isNull)
-	{
 		bucketno = 0;
-	}
 	else
 	{
 		bucketno = hashFunc(keyval,
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index a3fc2f545cbde9df6d4a011eb0e593b7c548adb6..dae06d2c937f08514678582f110d2eda6c06727a 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.36 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.37 2001/03/22 03:59:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -105,7 +105,7 @@ ExecHashJoin(HashJoin *node)
 
 	/* ----------------
 	 *	Reset per-tuple memory context to free any expression evaluation
-	 *	storage allocated in the previous tuple cycle.  Note this can't
+	 *	storage allocated in the previous tuple cycle.	Note this can't
 	 *	happen until we're done projecting out tuples from a join tuple.
 	 * ----------------
 	 */
@@ -155,6 +155,7 @@ ExecHashJoin(HashJoin *node)
 
 	for (;;)
 	{
+
 		/*
 		 * If we don't have an outer tuple, get the next one
 		 */
@@ -276,14 +277,15 @@ ExecHashJoin(HashJoin *node)
 		 */
 		hjstate->hj_NeedNewOuter = true;
 
-		if (! hjstate->hj_MatchedOuter &&
+		if (!hjstate->hj_MatchedOuter &&
 			node->join.jointype == JOIN_LEFT)
 		{
+
 			/*
 			 * We are doing an outer join and there were no join matches
 			 * for this outer tuple.  Generate a fake join tuple with
-			 * nulls for the inner tuple, and return it if it passes
-			 * the non-join quals.
+			 * nulls for the inner tuple, and return it if it passes the
+			 * non-join quals.
 			 */
 			econtext->ecxt_innertuple = hjstate->hj_NullInnerTupleSlot;
 
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index c0369e8f4cdfeaf117365ce1357dbc868cbe1c34..a6e6e45e9dc9c901ebff3b3bac0cca0aca23b3b9 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.57 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.58 2001/03/22 03:59:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,7 +224,7 @@ IndexNext(IndexScan *node)
 					qual = lnext(qual);
 				}
 				if (!prev_matches)
-					return slot; /* OK to return tuple */
+					return slot;/* OK to return tuple */
 				/* Duplicate tuple, so drop it and loop back for another */
 				ExecClearTuple(slot);
 			}
@@ -326,7 +326,8 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
 
 	estate = node->scan.plan.state;
 	indexstate = node->indxstate;
-	econtext = indexstate->iss_RuntimeContext; /* context for runtime keys */
+	econtext = indexstate->iss_RuntimeContext;	/* context for runtime
+												 * keys */
 	direction = estate->es_direction;
 	numIndices = indexstate->iss_NumIndices;
 	scanDescs = indexstate->iss_ScanDescs;
@@ -340,16 +341,18 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
 
 	if (econtext)
 	{
+
 		/*
-		 * If we are being passed an outer tuple,
-		 * save it for runtime key calc
+		 * If we are being passed an outer tuple, save it for runtime key
+		 * calc
 		 */
 		if (exprCtxt != NULL)
 			econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
+
 		/*
-		 * Reset the runtime-key context so we don't leak memory as
-		 * each outer tuple is scanned.  Note this assumes that we
-		 * will recalculate *all* runtime keys on each call.
+		 * Reset the runtime-key context so we don't leak memory as each
+		 * outer tuple is scanned.	Note this assumes that we will
+		 * recalculate *all* runtime keys on each call.
 		 */
 		ResetExprContext(econtext);
 	}
@@ -385,8 +388,8 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
 				 * outer tuple.  We then stick the result into the scan
 				 * key.
 				 *
-				 * Note: the result of the eval could be a pass-by-ref
-				 * value that's stored in the outer scan's tuple, not in
+				 * Note: the result of the eval could be a pass-by-ref value
+				 * that's stored in the outer scan's tuple, not in
 				 * econtext->ecxt_per_tuple_memory.  We assume that the
 				 * outer tuple will stay put throughout our scan.  If this
 				 * is wrong, we could copy the result into our context
@@ -790,7 +793,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 
 			Assert(leftop != NULL);
 
-			if (IsA(leftop, Var) && var_is_rel((Var *) leftop))
+			if (IsA(leftop, Var) &&var_is_rel((Var *) leftop))
 			{
 				/* ----------------
 				 *	if the leftop is a "rel-var", then it means
@@ -862,7 +865,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 
 			Assert(rightop != NULL);
 
-			if (IsA(rightop, Var) && var_is_rel((Var *) rightop))
+			if (IsA(rightop, Var) &&var_is_rel((Var *) rightop))
 			{
 				/* ----------------
 				 *	here we make sure only one op identifies the
@@ -986,7 +989,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 	 */
 	if (have_runtime_keys)
 	{
-		ExprContext	   *stdecontext = scanstate->cstate.cs_ExprContext;
+		ExprContext *stdecontext = scanstate->cstate.cs_ExprContext;
 
 		ExecAssignExprContext(estate, &scanstate->cstate);
 		indexstate->iss_RuntimeKeyInfo = runtimeKeyInfo;
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index c7cc76f0a70a42b7e39651c03b2474a9901c1d7d..534c3a419d1341e12570e4c1a5e63796dd1423f4 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.3 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.4 2001/03/22 03:59:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -59,7 +59,7 @@ ExecLimit(Limit *node)
 	 *	may not be set until now.)
 	 * ----------------
 	 */
-	if (! limitstate->parmsSet)
+	if (!limitstate->parmsSet)
 		recompute_limits(node);
 	netlimit = limitstate->offset + limitstate->count;
 
@@ -89,7 +89,7 @@ ExecLimit(Limit *node)
 		{
 			if (limitstate->atEnd)
 				return NULL;
-			if (! limitstate->noCount && limitstate->position > netlimit)
+			if (!limitstate->noCount && limitstate->position > netlimit)
 				return NULL;
 		}
 		else
@@ -104,13 +104,14 @@ ExecLimit(Limit *node)
 		slot = ExecProcNode(outerPlan, (Plan *) node);
 		if (TupIsNull(slot))
 		{
+
 			/*
 			 * We are at start or end of the subplan.  Update local state
 			 * appropriately, but always return NULL.
 			 */
 			if (ScanDirectionIsForward(direction))
 			{
-				Assert(! limitstate->atEnd);
+				Assert(!limitstate->atEnd);
 				/* must bump position to stay in sync for backwards fetch */
 				limitstate->position++;
 				limitstate->atEnd = true;
@@ -122,6 +123,7 @@ ExecLimit(Limit *node)
 			}
 			return NULL;
 		}
+
 		/*
 		 * We got the next subplan tuple successfully, so adjust state.
 		 */
@@ -135,7 +137,7 @@ ExecLimit(Limit *node)
 		limitstate->atEnd = false;
 
 		/* ----------------
-		 *	 Now, is this a tuple we want?  If not, loop around to fetch
+		 *	 Now, is this a tuple we want?	If not, loop around to fetch
 		 *	 another tuple from the subplan.
 		 * ----------------
 		 */
@@ -185,9 +187,9 @@ recompute_limits(Limit *node)
 	if (node->limitCount)
 	{
 		limitstate->count = DatumGetInt32(ExecEvalExpr(node->limitCount,
-														econtext,
-														&isNull,
-														NULL));
+													   econtext,
+													   &isNull,
+													   NULL));
 		/* Interpret NULL count as no count (LIMIT ALL) */
 		if (isNull)
 			limitstate->noCount = true;
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index dd09c6ac1c1a861f35a11c733e2061aff5418fce..1f55f852f0e94cd839b090f5f430464c8c99123a 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.33 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.34 2001/03/22 03:59:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
  *
  *		The first time this is called, ExecMaterial retrieves tuples
  *		from this node's outer subplan and inserts them into a tuplestore
- *		(a temporary tuple storage structure).  The first tuple is then
+ *		(a temporary tuple storage structure).	The first tuple is then
  *		returned.  Successive calls to ExecMaterial return successive
  *		tuples from the tuplestore.
  *
@@ -85,7 +85,7 @@ ExecMaterial(Material *node)
 		 *	 Initialize tuplestore module.
 		 * ----------------
 		 */
-		tuplestorestate = tuplestore_begin_heap(true, /* randomAccess */
+		tuplestorestate = tuplestore_begin_heap(true,	/* randomAccess */
 												SortMem);
 
 		matstate->tuplestorestate = (void *) tuplestorestate;
@@ -250,7 +250,7 @@ ExecEndMaterial(Material *node)
 void
 ExecMaterialMarkPos(Material *node)
 {
-	MaterialState  *matstate = node->matstate;
+	MaterialState *matstate = node->matstate;
 
 	/* ----------------
 	 *	if we haven't materialized yet, just return.
@@ -271,7 +271,7 @@ ExecMaterialMarkPos(Material *node)
 void
 ExecMaterialRestrPos(Material *node)
 {
-	MaterialState  *matstate = node->matstate;
+	MaterialState *matstate = node->matstate;
 
 	/* ----------------
 	 *	if we haven't materialized yet, just return.
@@ -299,8 +299,8 @@ ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
 	MaterialState *matstate = node->matstate;
 
 	/*
-	 * If we haven't materialized yet, just return. If outerplan' chgParam is
-	 * not NULL then it will be re-scanned by ExecProcNode, else - no
+	 * If we haven't materialized yet, just return. If outerplan' chgParam
+	 * is not NULL then it will be re-scanned by ExecProcNode, else - no
 	 * reason to re-scan it at all.
 	 */
 	if (!matstate->tuplestorestate)
@@ -309,8 +309,8 @@ ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
 	ExecClearTuple(matstate->csstate.cstate.cs_ResultTupleSlot);
 
 	/*
-	 * If subnode is to be rescanned then we forget previous stored results;
-	 * we have to re-read the subplan and re-store.
+	 * If subnode is to be rescanned then we forget previous stored
+	 * results; we have to re-read the subplan and re-store.
 	 *
 	 * Otherwise we can just rewind and rescan the stored output.
 	 */
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index fd8868a4a54a62203b170a32d28d46d44039dcbe..e3617c032b0a5d8b07d3282cb6e5175ef7eba8f5 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.42 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.43 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -169,7 +169,7 @@ MJFormSkipQual(List *qualList, char *replaceopname)
 							   CharGetDatum('b'));
 		if (!HeapTupleIsValid(optup))
 			elog(ERROR,
-				 "MJFormSkipQual: mergejoin operator %u has no matching %s op",
+			"MJFormSkipQual: mergejoin operator %u has no matching %s op",
 				 op->opno, replaceopname);
 		opform = (Form_pg_operator) GETSTRUCT(optup);
 
@@ -258,7 +258,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
 								   &isNull,
 								   NULL);
 
-		if (! DatumGetBool(const_value) || isNull)
+		if (!DatumGetBool(const_value) || isNull)
 			break;				/* return false */
 
 		eqclause = lnext(eqclause);
@@ -439,7 +439,7 @@ ExecMergeJoin(MergeJoin *node)
 		default:
 			elog(ERROR, "ExecMergeJoin: unsupported join type %d",
 				 (int) node->join.jointype);
-			doFillOuter = false; /* keep compiler quiet */
+			doFillOuter = false;/* keep compiler quiet */
 			doFillInner = false;
 			break;
 	}
@@ -464,7 +464,7 @@ ExecMergeJoin(MergeJoin *node)
 	if (mergestate->jstate.cs_TupFromTlist)
 	{
 		TupleTableSlot *result;
-		ExprDoneCond	isDone;
+		ExprDoneCond isDone;
 
 		result = ExecProject(mergestate->jstate.cs_ProjInfo, &isDone);
 		if (isDone == ExprMultipleResult)
@@ -475,7 +475,7 @@ ExecMergeJoin(MergeJoin *node)
 
 	/* ----------------
 	 *	Reset per-tuple memory context to free any expression evaluation
-	 *	storage allocated in the previous tuple cycle.  Note this can't
+	 *	storage allocated in the previous tuple cycle.	Note this can't
 	 *	happen until we're done projecting out tuples from a join tuple.
 	 * ----------------
 	 */
@@ -500,9 +500,9 @@ ExecMergeJoin(MergeJoin *node)
 
 				/*
 				 * EXEC_MJ_INITIALIZE means that this is the first time
-				 * ExecMergeJoin() has been called and so we have to
-				 * fetch the first tuple for both outer and inner subplans.
-				 * If we fail to get a tuple here, then that subplan is
+				 * ExecMergeJoin() has been called and so we have to fetch
+				 * the first tuple for both outer and inner subplans. If
+				 * we fail to get a tuple here, then that subplan is
 				 * empty, and we either end the join or go to one of the
 				 * fill-remaining-tuples states.
 				 */
@@ -516,6 +516,7 @@ ExecMergeJoin(MergeJoin *node)
 					MJ_printf("ExecMergeJoin: outer subplan is empty\n");
 					if (doFillInner)
 					{
+
 						/*
 						 * Need to emit right-join tuples for remaining
 						 * inner tuples.  We set MatchedInner = true to
@@ -536,11 +537,13 @@ ExecMergeJoin(MergeJoin *node)
 					MJ_printf("ExecMergeJoin: inner subplan is empty\n");
 					if (doFillOuter)
 					{
+
 						/*
-						 * Need to emit left-join tuples for all outer tuples,
-						 * including the one we just fetched.  We set
-						 * MatchedOuter = false to force the ENDINNER state
-						 * to emit this tuple before advancing outer.
+						 * Need to emit left-join tuples for all outer
+						 * tuples, including the one we just fetched.  We
+						 * set MatchedOuter = false to force the ENDINNER
+						 * state to emit this tuple before advancing
+						 * outer.
 						 */
 						mergestate->mj_JoinState = EXEC_MJ_ENDINNER;
 						mergestate->mj_MatchedOuter = false;
@@ -614,17 +617,17 @@ ExecMergeJoin(MergeJoin *node)
 
 				/*
 				 * Check the extra qual conditions to see if we actually
-				 * want to return this join tuple.  If not, can proceed with
-				 * merge.  We must distinguish the additional joinquals
-				 * (which must pass to consider the tuples "matched" for
-				 * outer-join logic) from the otherquals (which must pass
-				 * before we actually return the tuple).
+				 * want to return this join tuple.	If not, can proceed
+				 * with merge.	We must distinguish the additional
+				 * joinquals (which must pass to consider the tuples
+				 * "matched" for outer-join logic) from the otherquals
+				 * (which must pass before we actually return the tuple).
 				 *
 				 * We don't bother with a ResetExprContext here, on the
-				 * assumption that we just did one before checking the merge
-				 * qual.  One per tuple should be sufficient.  Also, the
-				 * econtext's tuple pointers were set up before checking
-				 * the merge qual, so we needn't do it again.
+				 * assumption that we just did one before checking the
+				 * merge qual.	One per tuple should be sufficient.  Also,
+				 * the econtext's tuple pointers were set up before
+				 * checking the merge qual, so we needn't do it again.
 				 */
 				qualResult = (joinqual == NIL ||
 							  ExecQual(joinqual, econtext, false));
@@ -677,11 +680,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (doFillInner && !mergestate->mj_MatchedInner)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the outer
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedInner = true;	/* do it only once */
+					mergestate->mj_MatchedInner = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -753,11 +758,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (doFillOuter && !mergestate->mj_MatchedOuter)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the inner
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedOuter = true;	/* do it only once */
+					mergestate->mj_MatchedOuter = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -810,6 +817,7 @@ ExecMergeJoin(MergeJoin *node)
 					innerTupleSlot = mergestate->mj_InnerTupleSlot;
 					if (doFillInner && !TupIsNull(innerTupleSlot))
 					{
+
 						/*
 						 * Need to emit right-join tuples for remaining
 						 * inner tuples.
@@ -879,19 +887,20 @@ ExecMergeJoin(MergeJoin *node)
 				{
 
 					/*
-					 * the merge clause matched so now we restore the inner
-					 * scan position to the first mark, and loop back to
-					 * JOINTEST.  Actually, since we know the mergeclause
-					 * matches, we can skip JOINTEST and go straight to
-					 * JOINTUPLES.
+					 * the merge clause matched so now we restore the
+					 * inner scan position to the first mark, and loop
+					 * back to JOINTEST.  Actually, since we know the
+					 * mergeclause matches, we can skip JOINTEST and go
+					 * straight to JOINTUPLES.
 					 *
 					 * NOTE: we do not need to worry about the MatchedInner
 					 * state for the rescanned inner tuples.  We know all
-					 * of them will match this new outer tuple and therefore
-					 * won't be emitted as fill tuples.  This works *only*
-					 * because we require the extra joinquals to be nil when
-					 * doing a right or full join --- otherwise some of the
-					 * rescanned tuples might fail the extra joinquals.
+					 * of them will match this new outer tuple and
+					 * therefore won't be emitted as fill tuples.  This
+					 * works *only* because we require the extra joinquals
+					 * to be nil when doing a right or full join ---
+					 * otherwise some of the rescanned tuples might fail
+					 * the extra joinquals.
 					 */
 					ExecRestrPos(innerPlan);
 					mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
@@ -918,6 +927,7 @@ ExecMergeJoin(MergeJoin *node)
 					{
 						if (doFillOuter)
 						{
+
 							/*
 							 * Need to emit left-join tuples for remaining
 							 * outer tuples.
@@ -1044,11 +1054,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (doFillOuter && !mergestate->mj_MatchedOuter)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the inner
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedOuter = true;	/* do it only once */
+					mergestate->mj_MatchedOuter = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -1101,6 +1113,7 @@ ExecMergeJoin(MergeJoin *node)
 					innerTupleSlot = mergestate->mj_InnerTupleSlot;
 					if (doFillInner && !TupIsNull(innerTupleSlot))
 					{
+
 						/*
 						 * Need to emit right-join tuples for remaining
 						 * inner tuples.
@@ -1229,11 +1242,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (doFillInner && !mergestate->mj_MatchedInner)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the outer
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedInner = true;	/* do it only once */
+					mergestate->mj_MatchedInner = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -1286,6 +1301,7 @@ ExecMergeJoin(MergeJoin *node)
 					outerTupleSlot = mergestate->mj_OuterTupleSlot;
 					if (doFillOuter && !TupIsNull(outerTupleSlot))
 					{
+
 						/*
 						 * Need to emit left-join tuples for remaining
 						 * outer tuples.
@@ -1306,8 +1322,8 @@ ExecMergeJoin(MergeJoin *node)
 
 				/*
 				 * EXEC_MJ_ENDOUTER means we have run out of outer tuples,
-				 * but are doing a right/full join and therefore must null-
-				 * fill any remaing unmatched inner tuples.
+				 * but are doing a right/full join and therefore must
+				 * null- fill any remaing unmatched inner tuples.
 				 */
 			case EXEC_MJ_ENDOUTER:
 				MJ_printf("ExecMergeJoin: EXEC_MJ_ENDOUTER\n");
@@ -1316,11 +1332,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (!mergestate->mj_MatchedInner)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the outer
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedInner = true;	/* do it only once */
+					mergestate->mj_MatchedInner = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -1383,11 +1401,13 @@ ExecMergeJoin(MergeJoin *node)
 
 				if (!mergestate->mj_MatchedOuter)
 				{
+
 					/*
 					 * Generate a fake join tuple with nulls for the inner
-					 * tuple, and return it if it passes the non-join quals.
+					 * tuple, and return it if it passes the non-join
+					 * quals.
 					 */
-					mergestate->mj_MatchedOuter = true;	/* do it only once */
+					mergestate->mj_MatchedOuter = true; /* do it only once */
 
 					ResetExprContext(econtext);
 
@@ -1515,14 +1535,16 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
 		case JOIN_LEFT:
 			mergestate->mj_NullInnerTupleSlot =
 				ExecInitNullTupleSlot(estate,
-									  ExecGetTupType(innerPlan((Plan*) node)));
+							   ExecGetTupType(innerPlan((Plan *) node)));
 			break;
 		case JOIN_RIGHT:
 			mergestate->mj_NullOuterTupleSlot =
 				ExecInitNullTupleSlot(estate,
-									  ExecGetTupType(outerPlan((Plan*) node)));
+							   ExecGetTupType(outerPlan((Plan *) node)));
+
 			/*
-			 * Can't handle right or full join with non-nil extra joinclauses.
+			 * Can't handle right or full join with non-nil extra
+			 * joinclauses.
 			 */
 			if (node->join.joinqual != NIL)
 				elog(ERROR, "RIGHT JOIN is only supported with mergejoinable join conditions");
@@ -1530,12 +1552,14 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
 		case JOIN_FULL:
 			mergestate->mj_NullOuterTupleSlot =
 				ExecInitNullTupleSlot(estate,
-									  ExecGetTupType(outerPlan((Plan*) node)));
+							   ExecGetTupType(outerPlan((Plan *) node)));
 			mergestate->mj_NullInnerTupleSlot =
 				ExecInitNullTupleSlot(estate,
-									  ExecGetTupType(innerPlan((Plan*) node)));
+							   ExecGetTupType(innerPlan((Plan *) node)));
+
 			/*
-			 * Can't handle right or full join with non-nil extra joinclauses.
+			 * Can't handle right or full join with non-nil extra
+			 * joinclauses.
 			 */
 			if (node->join.joinqual != NIL)
 				elog(ERROR, "FULL JOIN is only supported with mergejoinable join conditions");
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index f514b03851f7509c60134d2934d560f3c779303a..9c01ee4a1fb910ea532888b3bd0d8f70677de4a7 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.22 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.23 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -97,7 +97,7 @@ ExecNestLoop(NestLoop *node)
 	if (nlstate->jstate.cs_TupFromTlist)
 	{
 		TupleTableSlot *result;
-		ExprDoneCond	isDone;
+		ExprDoneCond isDone;
 
 		result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
 		if (isDone == ExprMultipleResult)
@@ -108,7 +108,7 @@ ExecNestLoop(NestLoop *node)
 
 	/* ----------------
 	 *	Reset per-tuple memory context to free any expression evaluation
-	 *	storage allocated in the previous tuple cycle.  Note this can't
+	 *	storage allocated in the previous tuple cycle.	Note this can't
 	 *	happen until we're done projecting out tuples from a join tuple.
 	 * ----------------
 	 */
@@ -179,14 +179,15 @@ ExecNestLoop(NestLoop *node)
 
 			nlstate->nl_NeedNewOuter = true;
 
-			if (! nlstate->nl_MatchedOuter &&
+			if (!nlstate->nl_MatchedOuter &&
 				node->join.jointype == JOIN_LEFT)
 			{
+
 				/*
-				 * We are doing an outer join and there were no join matches
-				 * for this outer tuple.  Generate a fake join tuple with
-				 * nulls for the inner tuple, and return it if it passes
-				 * the non-join quals.
+				 * We are doing an outer join and there were no join
+				 * matches for this outer tuple.  Generate a fake join
+				 * tuple with nulls for the inner tuple, and return it if
+				 * it passes the non-join quals.
 				 */
 				econtext->ecxt_innertuple = nlstate->nl_NullInnerTupleSlot;
 
@@ -215,6 +216,7 @@ ExecNestLoop(NestLoop *node)
 					}
 				}
 			}
+
 			/*
 			 * Otherwise just return to top of loop for a new outer tuple.
 			 */
@@ -328,7 +330,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate, Plan *parent)
 		case JOIN_LEFT:
 			nlstate->nl_NullInnerTupleSlot =
 				ExecInitNullTupleSlot(estate,
-									  ExecGetTupType(innerPlan((Plan*) node)));
+							   ExecGetTupType(innerPlan((Plan *) node)));
 			break;
 		default:
 			elog(ERROR, "ExecInitNestLoop: unsupported join type %d",
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index fa401e20b24053a69974d4d023d0b6e524b83d7b..863d4a4a56e335186e6e9f8807ae598732de2043 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -34,7 +34,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.17 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.18 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -111,7 +111,7 @@ ExecResult(Result *node)
 
 	/* ----------------
 	 *	Reset per-tuple memory context to free any expression evaluation
-	 *	storage allocated in the previous tuple cycle.  Note this can't
+	 *	storage allocated in the previous tuple cycle.	Note this can't
 	 *	happen until we're done projecting out tuples from a scan tuple.
 	 * ----------------
 	 */
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index a39128ff2f073f5204a4d41982b65820d0a79b79..d879cee7a75824c406f446e799e383fbccb47054 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.27 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.28 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
 #include "parser/parsetree.h"
 
 static Oid InitScanRelation(SeqScan *node, EState *estate,
-							CommonScanState *scanstate);
+				 CommonScanState *scanstate);
 static TupleTableSlot *SeqNext(SeqScan *node);
 
 /* ----------------------------------------------------------------
@@ -174,8 +174,8 @@ InitScanRelation(SeqScan *node, EState *estate,
 				  0,			/* is index */
 				  direction,	/* scan direction */
 				  estate->es_snapshot,
-				  &currentRelation, /* return: rel desc */
-				  (Pointer *) &currentScanDesc); /* return: scan desc */
+				  &currentRelation,		/* return: rel desc */
+				  (Pointer *) &currentScanDesc);		/* return: scan desc */
 
 	scanstate->css_currentRelation = currentRelation;
 	scanstate->css_currentScanDesc = currentScanDesc;
diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c
index ad35a46d636e62ee158398be90763b9a923b0dfe..00c799920398ae7a8bd368acb13a2c339cc21a10 100644
--- a/src/backend/executor/nodeSetOp.c
+++ b/src/backend/executor/nodeSetOp.c
@@ -5,7 +5,7 @@
  *
  * The input of a SetOp node consists of tuples from two relations,
  * which have been combined into one dataset and sorted on all the nonjunk
- * attributes.  In addition there is a junk attribute that shows which
+ * attributes.	In addition there is a junk attribute that shows which
  * relation each tuple came from.  The SetOp node scans each group of
  * identical tuples to determine how many came from each input relation.
  * Then it is a simple matter to emit the output demanded by the SQL spec
@@ -21,7 +21,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.2 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.3 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -93,7 +93,7 @@ ExecSetOp(SetOp *node)
 		 * ----------------
 		 */
 		if (setopstate->cstate.cs_OuterTupleSlot == NULL &&
-			! setopstate->subplan_done)
+			!setopstate->subplan_done)
 		{
 			setopstate->cstate.cs_OuterTupleSlot =
 				ExecProcNode(outerPlan, (Plan *) node);
@@ -104,6 +104,7 @@ ExecSetOp(SetOp *node)
 
 		if (TupIsNull(resultTupleSlot))
 		{
+
 			/*
 			 * First of group: save a copy in result slot, and reset
 			 * duplicate-counters for new group.
@@ -113,13 +114,15 @@ ExecSetOp(SetOp *node)
 			ExecStoreTuple(heap_copytuple(inputTupleSlot->val),
 						   resultTupleSlot,
 						   InvalidBuffer,
-						   true); /* free copied tuple at ExecClearTuple */
+						   true);		/* free copied tuple at
+										 * ExecClearTuple */
 			setopstate->numLeft = 0;
 			setopstate->numRight = 0;
 			endOfGroup = false;
 		}
 		else if (setopstate->subplan_done)
 		{
+
 			/*
 			 * Reached end of input, so finish processing final group
 			 */
@@ -127,8 +130,10 @@ ExecSetOp(SetOp *node)
 		}
 		else
 		{
+
 			/*
-			 * Else test if the new tuple and the previously saved tuple match.
+			 * Else test if the new tuple and the previously saved tuple
+			 * match.
 			 */
 			if (execTuplesMatch(inputTupleSlot->val,
 								resultTupleSlot->val,
@@ -143,6 +148,7 @@ ExecSetOp(SetOp *node)
 
 		if (endOfGroup)
 		{
+
 			/*
 			 * We've reached the end of the group containing resultTuple.
 			 * Decide how many copies (if any) to emit.  This logic is
@@ -185,12 +191,13 @@ ExecSetOp(SetOp *node)
 		}
 		else
 		{
+
 			/*
-			 * Current tuple is member of same group as resultTuple.
-			 * Count it in the appropriate counter.
+			 * Current tuple is member of same group as resultTuple. Count
+			 * it in the appropriate counter.
 			 */
-			int		flag;
-			bool	isNull;
+			int			flag;
+			bool		isNull;
 
 			flag = DatumGetInt32(heap_getattr(inputTupleSlot->val,
 											  node->flagColIdx,
@@ -207,8 +214,8 @@ ExecSetOp(SetOp *node)
 	}
 
 	/*
-	 * If we fall out of loop, then we need to emit at least one copy
-	 * of resultTuple.
+	 * If we fall out of loop, then we need to emit at least one copy of
+	 * resultTuple.
 	 */
 	Assert(setopstate->numOutput > 0);
 	setopstate->numOutput--;
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index d75d9a6f05288672d03769525d727ab5e84030f9..a8df4940ae497f149795d8f11f52d6f87223f30f 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.29 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.30 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -102,7 +102,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
 	{
 		HeapTuple	tup = slot->val;
 		TupleDesc	tdesc = slot->ttc_tupleDescriptor;
-		Datum		rowresult = BoolGetDatum(! useor);
+		Datum		rowresult = BoolGetDatum(!useor);
 		bool		rownull = false;
 		int			col = 1;
 
@@ -213,7 +213,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
 				/* combine within row per AND semantics */
 				if (expnull)
 					rownull = true;
-				else if (! DatumGetBool(expresult))
+				else if (!DatumGetBool(expresult))
 				{
 					rowresult = BoolGetDatum(false);
 					rownull = false;
@@ -240,7 +240,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
 			/* combine across rows per AND semantics */
 			if (rownull)
 				*isNull = true;
-			else if (! DatumGetBool(rowresult))
+			else if (!DatumGetBool(rowresult))
 			{
 				result = BoolGetDatum(false);
 				*isNull = false;
@@ -332,7 +332,7 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
  *
  * This is called from ExecEvalParam() when the value of a PARAM_EXEC
  * parameter is requested and the param's execPlan field is set (indicating
- * that the param has not yet been evaluated).  This allows lazy evaluation
+ * that the param has not yet been evaluated).	This allows lazy evaluation
  * of initplans: we don't run the subplan until/unless we need its output.
  * Note that this routine MUST clear the execPlan fields of the plan's
  * output parameters after evaluating them!
diff --git a/src/backend/executor/nodeSubqueryscan.c b/src/backend/executor/nodeSubqueryscan.c
index 4c9144bc3a82aebb631a2fe0be9df6a1f56f3222..9b8711c9914a5437ae63007e07ad4eda2de03453 100644
--- a/src/backend/executor/nodeSubqueryscan.c
+++ b/src/backend/executor/nodeSubqueryscan.c
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.4 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.5 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -67,8 +67,8 @@ SubqueryNext(SubqueryScan *node)
 	/*
 	 * Check if we are evaluating PlanQual for tuple of this relation.
 	 * Additional checking is not good, but no other way for now. We could
-	 * introduce new nodes for this case and handle SubqueryScan --> NewNode
-	 * switching in Init/ReScan plan...
+	 * introduce new nodes for this case and handle SubqueryScan -->
+	 * NewNode switching in Init/ReScan plan...
 	 */
 	if (estate->es_evTuple != NULL &&
 		estate->es_evTuple[node->scan.scanrelid - 1] != NULL)
@@ -202,6 +202,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate, Plan *parent)
 int
 ExecCountSlotsSubqueryScan(SubqueryScan *node)
 {
+
 	/*
 	 * The subplan has its own tuple table and must not be counted here!
 	 */
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index a5c0299d2896821d781c511b6653aefb1cde7dee..04c9efc4b0a2f19f274f92d0fbd87d788ede0feb 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.14 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.15 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -371,6 +371,7 @@ ExecTidRestrPos(TidScan *node)
 	tidstate = node->tidstate;
 	tidstate->tss_TidPtr = tidstate->tss_MarkTidPtr;
 }
+
 #endif
 
 /* ----------------------------------------------------------------
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 4c4da6c3034ba79c919cbdefd46c0b2969da39d0..4aa8c475c30922ff7ef4c6003509102f002adeb3 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -3,17 +3,17 @@
  * spi.c
  *				Server Programming Interface
  *
- * $Id: spi.c,v 1.52 2001/02/19 19:49:52 tgl Exp $
+ * $Id: spi.c,v 1.53 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "executor/spi_priv.h"
 #include "access/printtup.h"
 
-uint32 SPI_processed = 0;
-Oid SPI_lastoid = InvalidOid;
+uint32		SPI_processed = 0;
+Oid			SPI_lastoid = InvalidOid;
 SPITupleTable *SPI_tuptable = NULL;
-int SPI_result;
+int			SPI_result;
 
 static _SPI_connection *_SPI_stack = NULL;
 static _SPI_connection *_SPI_current = NULL;
@@ -46,6 +46,7 @@ extern void ShowUsage(void);
 int
 SPI_connect()
 {
+
 	/*
 	 * When procedure called by Executor _SPI_curid expected to be equal
 	 * to _SPI_connected
@@ -80,14 +81,14 @@ SPI_connect()
 	/* Create memory contexts for this procedure */
 	_SPI_current->procCxt = AllocSetContextCreate(TopTransactionContext,
 												  "SPI Proc",
-												  ALLOCSET_DEFAULT_MINSIZE,
-												  ALLOCSET_DEFAULT_INITSIZE,
-												  ALLOCSET_DEFAULT_MAXSIZE);
+												ALLOCSET_DEFAULT_MINSIZE,
+											   ALLOCSET_DEFAULT_INITSIZE,
+											   ALLOCSET_DEFAULT_MAXSIZE);
 	_SPI_current->execCxt = AllocSetContextCreate(TopTransactionContext,
 												  "SPI Exec",
-												  ALLOCSET_DEFAULT_MINSIZE,
-												  ALLOCSET_DEFAULT_INITSIZE,
-												  ALLOCSET_DEFAULT_MAXSIZE);
+												ALLOCSET_DEFAULT_MINSIZE,
+											   ALLOCSET_DEFAULT_INITSIZE,
+											   ALLOCSET_DEFAULT_MAXSIZE);
 	/* ... and switch to procedure's context */
 	_SPI_current->savedcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
 
@@ -146,6 +147,7 @@ SPI_finish()
 void
 AtEOXact_SPI(void)
 {
+
 	/*
 	 * Note that memory contexts belonging to SPI stack entries will be
 	 * freed automatically, so we can ignore them here.  We just need to
@@ -425,8 +427,8 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
 	}
 
 	/*
-	 * If we have a toasted datum, forcibly detoast it here to avoid memory
-	 * leakage inside the type's output routine.
+	 * If we have a toasted datum, forcibly detoast it here to avoid
+	 * memory leakage inside the type's output routine.
 	 */
 	if (typisvarlena)
 		val = PointerGetDatum(PG_DETOAST_DATUM(origval));
@@ -436,7 +438,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
 	result = OidFunctionCall3(foutoid,
 							  val,
 							  ObjectIdGetDatum(typelem),
-							  Int32GetDatum(tupdesc->attrs[fnumber - 1]->atttypmod));
+				  Int32GetDatum(tupdesc->attrs[fnumber - 1]->atttypmod));
 
 	/* Clean up detoasted copy, if any */
 	if (val != origval)
@@ -833,14 +835,13 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
 #endif
 	tupdesc = ExecutorStart(queryDesc, state);
 
-	/* Don't work currently --- need to rearrange callers so that
-	 * we prepare the portal before doing CreateExecutorState() etc.
-	 * See pquery.c for the correct order of operations.
+	/*
+	 * Don't work currently --- need to rearrange callers so that we
+	 * prepare the portal before doing CreateExecutorState() etc. See
+	 * pquery.c for the correct order of operations.
 	 */
 	if (isRetrieveIntoPortal)
-	{
 		elog(FATAL, "SPI_select: retrieve into portal not implemented");
-	}
 
 	ExecutorRun(queryDesc, state, EXEC_FOR, (long) tcount);
 
@@ -901,9 +902,7 @@ _SPI_begin_call(bool execmem)
 		elog(FATAL, "SPI: stack corrupted");
 
 	if (execmem)				/* switch to the Executor memory context */
-	{
 		_SPI_execmem();
-	}
 
 	return 0;
 }
diff --git a/src/backend/lib/bit.c b/src/backend/lib/bit.c
index 1b54292a46421e801a77898bb1d1e8756eeaccad..57da3522c46af23ce39a27422bf11f462abfcd02 100644
--- a/src/backend/lib/bit.c
+++ b/src/backend/lib/bit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.12 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.13 2001/03/22 03:59:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,14 +22,14 @@ void
 BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
 {
 	bitArray[bitIndex / BITS_PER_BYTE] |=
-		(1 << (BITS_PER_BYTE - 1 - (bitIndex % BITS_PER_BYTE)));
+	(1 << (BITS_PER_BYTE - 1 - (bitIndex % BITS_PER_BYTE)));
 }
 
 void
 BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
 {
 	bitArray[bitIndex / BITS_PER_BYTE] &=
-		~(1 << (BITS_PER_BYTE - 1 - (bitIndex % BITS_PER_BYTE)));
+	~(1 << (BITS_PER_BYTE - 1 - (bitIndex % BITS_PER_BYTE)));
 }
 
 bool
@@ -37,5 +37,5 @@ BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
 {
 	return ((bitArray[bitIndex / BITS_PER_BYTE] &
 			 (1 << (BITS_PER_BYTE - 1 - (bitIndex % BITS_PER_BYTE)))
-		) != 0);
+			 ) != 0);
 }
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index d91fa9a822044f907448088ac0447c660bb7fa1a..dcb702e95967604d0b78062c0b9fb04c385e644c 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.51 2001/01/24 19:42:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.52 2001/03/22 03:59:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,7 @@ static int	map_old_to_new(Port *port, UserAuth old, int status);
 static void auth_failed(Port *port);
 
 
-char * pg_krb_server_keyfile;
+char	   *pg_krb_server_keyfile;
 
 
 #ifdef KRB4
@@ -177,7 +177,7 @@ pg_an_to_ln(char *aname)
  * Various krb5 state which is not connection specfic, and a flag to
  * indicate whether we have initialised it yet.
  */
-static int pg_krb5_initialised;
+static int	pg_krb5_initialised;
 static krb5_context pg_krb5_context;
 static krb5_keytab pg_krb5_keytab;
 static krb5_principal pg_krb5_server;
@@ -192,7 +192,8 @@ pg_krb5_init(void)
 		return STATUS_OK;
 
 	retval = krb5_init_context(&pg_krb5_context);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_init_context returned"
 				 " Kerberos error %d\n", retval);
@@ -201,23 +202,25 @@ pg_krb5_init(void)
 	}
 
 	retval = krb5_kt_resolve(pg_krb5_context, pg_krb_server_keyfile, &pg_krb5_keytab);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_kt_resolve returned"
 				 " Kerberos error %d\n", retval);
-	    com_err("postgres", retval, "while resolving keytab file %s",
+		com_err("postgres", retval, "while resolving keytab file %s",
 				pg_krb_server_keyfile);
 		krb5_free_context(pg_krb5_context);
 		return STATUS_ERROR;
 	}
 
-    retval = krb5_sname_to_principal(pg_krb5_context, NULL, PG_KRB_SRVNAM, 
+	retval = krb5_sname_to_principal(pg_krb5_context, NULL, PG_KRB_SRVNAM,
 									 KRB5_NT_SRV_HST, &pg_krb5_server);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_sname_to_principal returned"
 				 " Kerberos error %d\n", retval);
-	    com_err("postgres", retval, 
+		com_err("postgres", retval,
 				"while getting server principal for service %s",
 				pg_krb_server_keyfile);
 		krb5_kt_close(pg_krb5_context, pg_krb5_keytab);
@@ -245,25 +248,26 @@ static int
 pg_krb5_recvauth(Port *port)
 {
 	krb5_error_code retval;
-	int ret;
+	int			ret;
 	krb5_auth_context auth_context = NULL;
 	krb5_ticket *ticket;
-    char *kusername;
+	char	   *kusername;
 
 	ret = pg_krb5_init();
 	if (ret != STATUS_OK)
 		return ret;
 
 	retval = krb5_recvauth(pg_krb5_context, &auth_context,
-						   (krb5_pointer)&port->sock, PG_KRB_SRVNAM,
+						   (krb5_pointer) & port->sock, PG_KRB_SRVNAM,
 						   pg_krb5_server, 0, pg_krb5_keytab, &ticket);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_recvauth: krb5_recvauth returned"
 				 " Kerberos error %d\n", retval);
-	    com_err("postgres", retval, "from krb5_recvauth");
+		com_err("postgres", retval, "from krb5_recvauth");
 		return STATUS_ERROR;
-	}						   
+	}
 
 	/*
 	 * The "client" structure comes out of the ticket and is therefore
@@ -272,13 +276,14 @@ pg_krb5_recvauth(Port *port)
 	 *
 	 * I have no idea why this is considered necessary.
 	 */
-    retval = krb5_unparse_name(pg_krb5_context, 
+	retval = krb5_unparse_name(pg_krb5_context,
 							   ticket->enc_part2->client, &kusername);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_recvauth: krb5_unparse_name returned"
 				 " Kerberos error %d\n", retval);
-	    com_err("postgres", retval, "while unparsing client name");
+		com_err("postgres", retval, "while unparsing client name");
 		krb5_free_ticket(pg_krb5_context, ticket);
 		krb5_auth_con_free(pg_krb5_context, auth_context);
 		return STATUS_ERROR;
@@ -288,13 +293,13 @@ pg_krb5_recvauth(Port *port)
 	if (strncmp(port->user, kusername, SM_USER))
 	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
-				 "pg_krb5_recvauth: user name \"%s\" != krb5 name \"%s\"\n", 
+			  "pg_krb5_recvauth: user name \"%s\" != krb5 name \"%s\"\n",
 				 port->user, kusername);
 		ret = STATUS_ERROR;
 	}
 	else
 		ret = STATUS_OK;
-	
+
 	krb5_free_ticket(pg_krb5_context, ticket);
 	krb5_auth_con_free(pg_krb5_context, auth_context);
 	free(kusername);
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index 1d5870e93f405e8a5e9c68e740144bbd02da7cba..4d50ee1ae12d907d744f603d1440570a2d824d48 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.57 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.58 2001/03/22 03:59:30 momjian Exp $
  *
  * NOTES
  *	  This should be moved to a more appropriate place.  It is here
@@ -60,7 +60,7 @@
  * entries, of which any unused entries will be NULL.
  */
 static LargeObjectDesc **cookies = NULL;
-static int cookies_size = 0;
+static int	cookies_size = 0;
 
 static MemoryContext fscxt = NULL;
 
@@ -329,10 +329,10 @@ loread(PG_FUNCTION_ARGS)
 Datum
 lowrite(PG_FUNCTION_ARGS)
 {
-	int32			fd = PG_GETARG_INT32(0);
+	int32		fd = PG_GETARG_INT32(0);
 	struct varlena *wbuf = PG_GETARG_VARLENA_P(1);
-	int				bytestowrite;
-	int				totalwritten;
+	int			bytestowrite;
+	int			totalwritten;
 
 	bytestowrite = VARSIZE(wbuf) - VARHDRSZ;
 	totalwritten = lo_write(fd, VARDATA(wbuf), bytestowrite);
@@ -371,7 +371,7 @@ lo_import(PG_FUNCTION_ARGS)
 	 */
 	nbytes = VARSIZE(filename) - VARHDRSZ;
 	if (nbytes >= MAXPGPATH)
-		nbytes = MAXPGPATH-1;
+		nbytes = MAXPGPATH - 1;
 	memcpy(fnamebuf, VARDATA(filename), nbytes);
 	fnamebuf[nbytes] = '\0';
 	fd = PathNameOpenFile(fnamebuf, O_RDONLY | PG_BINARY, 0666);
@@ -445,7 +445,7 @@ lo_export(PG_FUNCTION_ARGS)
 	 */
 	nbytes = VARSIZE(filename) - VARHDRSZ;
 	if (nbytes >= MAXPGPATH)
-		nbytes = MAXPGPATH-1;
+		nbytes = MAXPGPATH - 1;
 	memcpy(fnamebuf, VARDATA(filename), nbytes);
 	fnamebuf[nbytes] = '\0';
 	oumask = umask((mode_t) 0022);
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index 325056ab1efd941f270bc7d91b837b18991731dd..59aef0d514d06109451d7b7bc4d43e0dbd8dd6f2 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -9,7 +9,7 @@
  * Dec 17, 1997 - Todd A. Brandys
  *	Orignal Version Completed.
  *
- * $Id: crypt.c,v 1.30 2001/02/07 23:31:38 tgl Exp $
+ * $Id: crypt.c,v 1.31 2001/03/22 03:59:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -295,7 +295,7 @@ crypt_verify(const Port *port, const char *user, const char *pgpass)
 			vuntil = INVALID_ABSTIME;
 		else
 			vuntil = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
-										  CStringGetDatum(valuntil)));
+											 CStringGetDatum(valuntil)));
 		current = GetCurrentAbsoluteTime();
 		if (vuntil != INVALID_ABSTIME && vuntil < current)
 			retval = STATUS_ERROR;
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index 856c30288009a7c3763725a2b1961f583ff04291..77b09be18a4eaf8b9a6153626d9dd715573d4908 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -2,7 +2,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: password.c,v 1.35 2001/01/24 19:42:56 momjian Exp $
+ * $Id: password.c,v 1.36 2001/03/22 03:59:30 momjian Exp $
  *
  */
 
@@ -37,7 +37,7 @@ verify_password(const Port *port, const char *user, const char *password)
 	if (!pw_file)
 	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
-				 "verify_password: Unable to open password file \"%s\": %s\n",
+			"verify_password: Unable to open password file \"%s\": %s\n",
 				 pw_file_fullname, strerror(errno));
 		fputs(PQerrormsg, stderr);
 		pqdebug("%s", PQerrormsg);
@@ -77,12 +77,12 @@ verify_password(const Port *port, const char *user, const char *password)
 
 			/*
 			 * If the password is empty of "+" then we use the regular
-			 * pg_shadow passwords. If we use crypt then we have to
-			 * use pg_shadow passwords no matter what.
+			 * pg_shadow passwords. If we use crypt then we have to use
+			 * pg_shadow passwords no matter what.
 			 */
 			if (port->auth_method == uaCrypt
 				|| test_pw == NULL || test_pw[0] == '\0'
-				|| strcmp(test_pw, "+")==0)
+				|| strcmp(test_pw, "+") == 0)
 				return crypt_verify(port, user, password);
 
 			if (strcmp(crypt(password, test_pw), test_pw) == 0)
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 7a20d66f7e1fa28f8e567f457e418753dd9cbc8c..e3250862363cd7e41a5a6d69d49299a91bce36e4 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Id: pqcomm.c,v 1.116 2001/01/24 19:42:56 momjian Exp $
+ *	$Id: pqcomm.c,v 1.117 2001/03/22 03:59:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -71,7 +71,7 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
+#include <netinet/tcp.h>
 #endif
 #include <arpa/inet.h>
 #include <sys/file.h>
@@ -91,8 +91,8 @@ static void pq_close(void);
 /*
  * Configuration options
  */
-int Unix_socket_permissions;
-char * Unix_socket_group;
+int			Unix_socket_permissions;
+char	   *Unix_socket_group;
 
 
 /*
@@ -223,47 +223,49 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
 		UNIXSOCK_PATH(saddr.un, portNumber, unixSocketName);
 		len = UNIXSOCK_LEN(saddr.un);
 		strcpy(sock_path, saddr.un.sun_path);
+
 		/*
 		 * Grab an interlock file associated with the socket file.
 		 */
-		if (! CreateSocketLockFile(sock_path, true))
+		if (!CreateSocketLockFile(sock_path, true))
 			return STATUS_ERROR;
+
 		/*
-		 * Once we have the interlock, we can safely delete any pre-existing
-		 * socket file to avoid failure at bind() time.
+		 * Once we have the interlock, we can safely delete any
+		 * pre-existing socket file to avoid failure at bind() time.
 		 */
 		unlink(sock_path);
 	}
-#endif /* HAVE_UNIX_SOCKETS */
+#endif	 /* HAVE_UNIX_SOCKETS */
 
-    if (family == AF_INET) 
-    {
+	if (family == AF_INET)
+	{
 		/* TCP/IP socket */
 		if (hostName[0] == '\0')
-	 		saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
+			saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
 		else
-	    {
+		{
 			struct hostent *hp;
-	
+
 			hp = gethostbyname(hostName);
 			if ((hp == NULL) || (hp->h_addrtype != AF_INET))
 			{
 				snprintf(PQerrormsg, PQERRORMSG_LENGTH,
-					   "FATAL: StreamServerPort: gethostbyname(%s) failed\n",
-							hostName);
-					   fputs(PQerrormsg, stderr);
-					   pqdebug("%s", PQerrormsg);
+				   "FATAL: StreamServerPort: gethostbyname(%s) failed\n",
+						 hostName);
+				fputs(PQerrormsg, stderr);
+				pqdebug("%s", PQerrormsg);
 				return STATUS_ERROR;
 			}
 			memmove((char *) &(saddr.in.sin_addr), (char *) hp->h_addr,
 					hp->h_length);
 		}
-	
+
 		saddr.in.sin_port = htons(portNumber);
 		len = sizeof(struct sockaddr_in);
 	}
 
-	err = bind(fd, (struct sockaddr *)&saddr.sa, len);
+	err = bind(fd, (struct sockaddr *) & saddr.sa, len);
 	if (err < 0)
 	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
@@ -291,16 +293,16 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
 		on_proc_exit(StreamDoUnlink, 0);
 
 		/*
-		 * Fix socket ownership/permission if requested.  Note we must
-		 * do this before we listen() to avoid a window where unwanted
+		 * Fix socket ownership/permission if requested.  Note we must do
+		 * this before we listen() to avoid a window where unwanted
 		 * connections could get accepted.
 		 */
 		Assert(Unix_socket_group);
 		if (Unix_socket_group[0] != '\0')
 		{
-			char *endptr;
+			char	   *endptr;
 			unsigned long int val;
-			gid_t gid;
+			gid_t		gid;
 
 			val = strtoul(Unix_socket_group, &endptr, 10);
 			if (*endptr == '\0')
@@ -346,7 +348,7 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
 			return STATUS_ERROR;
 		}
 	}
-#endif /* HAVE_UNIX_SOCKETS */
+#endif	 /* HAVE_UNIX_SOCKETS */
 
 	listen(fd, SOMAXCONN);
 
@@ -385,9 +387,10 @@ StreamConnection(int server_fd, Port *port)
 	}
 
 #ifdef SCO_ACCEPT_BUG
+
 	/*
-	 * UnixWare 7+ and OpenServer 5.0.4 are known to have this bug,
-	 * but it shouldn't hurt it catch if for all of them.
+	 * UnixWare 7+ and OpenServer 5.0.4 are known to have this bug, but it
+	 * shouldn't hurt it catch if for all of them.
 	 */
 	if (port->raddr.sa.sa_family == 0)
 		port->raddr.sa.sa_family = AF_UNIX;
diff --git a/src/backend/libpq/pqpacket.c b/src/backend/libpq/pqpacket.c
index 5e99b148f8e63131f78c2312c1f0f064d5bb4106..5f9d3cdb48fd19a86d1c752f3d836c9b37d119fe 100644
--- a/src/backend/libpq/pqpacket.c
+++ b/src/backend/libpq/pqpacket.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.28 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.29 2001/03/22 03:59:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -64,8 +64,8 @@ PacketReceiveFragment(Port *port)
 #ifndef __BEOS__
 		got = read(port->sock, pkt->ptr, pkt->nrtodo);
 #else
-        got = recv(port->sock, pkt->ptr, pkt->nrtodo, 0);
-#endif /* __BEOS__ */
+		got = recv(port->sock, pkt->ptr, pkt->nrtodo, 0);
+#endif	 /* __BEOS__ */
 	if (got > 0)
 	{
 		pkt->nrtodo -= got;
diff --git a/src/backend/libpq/pqsignal.c b/src/backend/libpq/pqsignal.c
index 668d5f996dd2bb5b7f2f744e34c7249967e87115..8cc8f140aceb1cc687e818e5fdc3f6fdcec12491 100644
--- a/src/backend/libpq/pqsignal.c
+++ b/src/backend/libpq/pqsignal.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.19 2001/02/10 02:31:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.20 2001/03/22 03:59:30 momjian Exp $
  *
  * NOTES
  *		This shouldn't be in libpq, but the monitor and some other
@@ -61,10 +61,11 @@ pqinitmask(void)
 #ifdef HAVE_SIGPROCMASK
 	sigemptyset(&UnBlockSig);
 	sigfillset(&BlockSig);
+
 	/*
-	 * Unmark those signals that should never be blocked.
-	 * Some of these signal names don't exist on all platforms.  Most do,
-	 * but might as well ifdef them all for consistency...
+	 * Unmark those signals that should never be blocked. Some of these
+	 * signal names don't exist on all platforms.  Most do, but might as
+	 * well ifdef them all for consistency...
 	 */
 #ifdef SIGTRAP
 	sigdelset(&BlockSig, SIGTRAP);
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index b8c6cffdf64635e51a590f6e6bd6774a1467983d..46e03d8e0ab11dc0eaa6b9adc1b59b5a05d17e2b 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.41 2001/02/06 17:00:01 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.42 2001/03/22 03:59:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,17 +53,17 @@ main(int argc, char *argv[])
 {
 	int			len;
 	struct passwd *pw;
-	char * pw_name_persist;
+	char	   *pw_name_persist;
 
 	/*
-	 * Place platform-specific startup hacks here.  This is the right
-	 * place to put code that must be executed early in launch of either
-	 * a postmaster, a standalone backend, or a standalone bootstrap run.
+	 * Place platform-specific startup hacks here.	This is the right
+	 * place to put code that must be executed early in launch of either a
+	 * postmaster, a standalone backend, or a standalone bootstrap run.
 	 * Note that this code will NOT be executed when a backend or
 	 * sub-bootstrap run is forked by the postmaster.
 	 *
-	 * XXX The need for code here is proof that the platform in question
-	 * is too brain-dead to provide a standard C execution environment
+	 * XXX The need for code here is proof that the platform in question is
+	 * too brain-dead to provide a standard C execution environment
 	 * without help.  Avoid adding more here, if you can.
 	 */
 
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
 	int			buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
 
 #endif	 /* NOPRINTADE */
-#endif /* __alpha */
+#endif	 /* __alpha */
 
 #if defined(NOFIXADE) || defined(NOPRINTADE)
 
@@ -93,38 +93,39 @@ main(int argc, char *argv[])
 #endif	 /* NOFIXADE || NOPRINTADE */
 
 #ifdef __BEOS__
- 	/* BeOS-specific actions on startup */
- 	beos_startup(argc,argv);
+	/* BeOS-specific actions on startup */
+	beos_startup(argc, argv);
 #endif
 
 	/*
-	 * Not-quite-so-platform-specific startup environment checks.
-	 * Still best to minimize these.
+	 * Not-quite-so-platform-specific startup environment checks. Still
+	 * best to minimize these.
 	 */
 
 	/*
 	 * Make sure we are not running as root.
 	 *
-	 * BeOS currently runs everything as root :-(, so this check must
-	 * be temporarily disabled there...
-	*/
+	 * BeOS currently runs everything as root :-(, so this check must be
+	 * temporarily disabled there...
+	 */
 #ifndef __BEOS__
 	if (!(argc > 1
-		  && ( strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0
-			   || strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0 ))
-		&& (geteuid() == 0) )
+		  && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0
+	 || strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0))
+		&& (geteuid() == 0))
 	{
 		fprintf(stderr, "%s", NOROOTEXEC);
 		exit(1);
 	}
-#endif /* __BEOS__ */
+#endif	 /* __BEOS__ */
 
 	/*
 	 * Set up locale information from environment, in only the categories
 	 * needed by Postgres; leave other categories set to default "C".
-	 * (Note that CTYPE and COLLATE will be overridden later from pg_control
-	 * if we are in an already-initialized database.  We set them here so
-	 * that they will be available to fill pg_control during initdb.)
+	 * (Note that CTYPE and COLLATE will be overridden later from
+	 * pg_control if we are in an already-initialized database.  We set
+	 * them here so that they will be available to fill pg_control during
+	 * initdb.)
 	 */
 #ifdef USE_LOCALE
 	setlocale(LC_CTYPE, "");
@@ -133,9 +134,10 @@ main(int argc, char *argv[])
 #endif
 
 	/*
-	 * Now dispatch to one of PostmasterMain, PostgresMain, or BootstrapMain
-	 * depending on the program name (and possibly first argument) we
-	 * were called with.  The lack of consistency here is historical.
+	 * Now dispatch to one of PostmasterMain, PostgresMain, or
+	 * BootstrapMain depending on the program name (and possibly first
+	 * argument) we were called with.  The lack of consistency here is
+	 * historical.
 	 */
 	len = strlen(argv[0]);
 
@@ -146,15 +148,16 @@ main(int argc, char *argv[])
 	}
 
 	/*
-	 * If the first argument is "-boot", then invoke bootstrap mode.
-	 * Note we remove "-boot" from the arguments passed on to BootstrapMain.
+	 * If the first argument is "-boot", then invoke bootstrap mode. Note
+	 * we remove "-boot" from the arguments passed on to BootstrapMain.
 	 */
 	if (argc > 1 && strcmp(argv[1], "-boot") == 0)
 		exit(BootstrapMain(argc - 1, argv + 1));
 
 	/*
 	 * Otherwise we're a standalone backend.  Invoke PostgresMain,
-	 * specifying current userid as the "authenticated" Postgres user name.
+	 * specifying current userid as the "authenticated" Postgres user
+	 * name.
 	 */
 	pw = getpwuid(geteuid());
 	if (pw == NULL)
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index f7127443082115ac7ca699d3a20a888ad5f6f949..3dc2bf0373a6570a4febab7722b62045aa43349c 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -6,7 +6,7 @@
  * NOTE: a general convention when copying or comparing plan nodes is
  * that we ignore the executor state subnode.  We do not need to look
  * at it because no current uses of copyObject() or equal() need to
- * deal with already-executing plan trees.  By leaving the state subnodes
+ * deal with already-executing plan trees.	By leaving the state subnodes
  * out, we avoid needing to write copy/compare routines for all the
  * different executor state node types.
  *
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.138 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.139 2001/03/22 03:59:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -305,7 +305,7 @@ _copyTidScan(TidScan *from)
 static SubqueryScan *
 _copySubqueryScan(SubqueryScan *from)
 {
-	SubqueryScan  *newnode = makeNode(SubqueryScan);
+	SubqueryScan *newnode = makeNode(SubqueryScan);
 
 	/* ----------------
 	 *	copy node superclass fields
@@ -339,7 +339,7 @@ CopyJoinFields(Join *from, Join *newnode)
 	/* subPlan list must point to subplans in the new subtree, not the old */
 	if (from->plan.subPlan != NIL)
 		newnode->plan.subPlan = nconc(newnode->plan.subPlan,
-									  pull_subplans((Node *) newnode->joinqual));
+							  pull_subplans((Node *) newnode->joinqual));
 }
 
 
@@ -991,7 +991,7 @@ _copyRangeTblRef(RangeTblRef *from)
 static FromExpr *
 _copyFromExpr(FromExpr *from)
 {
-	FromExpr *newnode = makeNode(FromExpr);
+	FromExpr   *newnode = makeNode(FromExpr);
 
 	Node_Copy(from, newnode, fromlist);
 	Node_Copy(from, newnode, quals);
@@ -1002,7 +1002,7 @@ _copyFromExpr(FromExpr *from)
 static JoinExpr *
 _copyJoinExpr(JoinExpr *from)
 {
-	JoinExpr *newnode = makeNode(JoinExpr);
+	JoinExpr   *newnode = makeNode(JoinExpr);
 
 	newnode->jointype = from->jointype;
 	newnode->isNatural = from->isNatural;
@@ -1281,7 +1281,7 @@ _copyTidPath(TidPath *from)
 static AppendPath *
 _copyAppendPath(AppendPath *from)
 {
-	AppendPath    *newnode = makeNode(AppendPath);
+	AppendPath *newnode = makeNode(AppendPath);
 
 	/* ----------------
 	 *	copy the node superclass fields
@@ -1424,7 +1424,11 @@ _copyRestrictInfo(RestrictInfo *from)
 	newnode->mergejoinoperator = from->mergejoinoperator;
 	newnode->left_sortop = from->left_sortop;
 	newnode->right_sortop = from->right_sortop;
-	/* Do not copy pathkeys, since they'd not be canonical in a copied query */
+
+	/*
+	 * Do not copy pathkeys, since they'd not be canonical in a copied
+	 * query
+	 */
 	newnode->left_pathkey = NIL;
 	newnode->right_pathkey = NIL;
 	newnode->hashjoinoperator = from->hashjoinoperator;
@@ -1525,7 +1529,7 @@ _copyRangeTblEntry(RangeTblEntry *from)
 static FkConstraint *
 _copyFkConstraint(FkConstraint *from)
 {
-	FkConstraint    *newnode = makeNode(FkConstraint);
+	FkConstraint *newnode = makeNode(FkConstraint);
 
 	if (from->constr_name)
 		newnode->constr_name = pstrdup(from->constr_name);
@@ -1538,7 +1542,7 @@ _copyFkConstraint(FkConstraint *from)
 	newnode->actions = from->actions;
 	newnode->deferrable = from->deferrable;
 	newnode->initdeferred = from->initdeferred;
-	
+
 	return newnode;
 }
 
@@ -1556,7 +1560,7 @@ _copySortClause(SortClause *from)
 static A_Expr *
 _copyAExpr(A_Expr *from)
 {
-	A_Expr    *newnode = makeNode(A_Expr);
+	A_Expr	   *newnode = makeNode(A_Expr);
 
 	newnode->oper = from->oper;
 	if (from->opname)
@@ -1593,7 +1597,7 @@ _copyParamNo(ParamNo *from)
 static Ident *
 _copyIdent(Ident *from)
 {
-	Ident    *newnode = makeNode(Ident);
+	Ident	   *newnode = makeNode(Ident);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -1606,7 +1610,7 @@ _copyIdent(Ident *from)
 static FuncCall *
 _copyFuncCall(FuncCall *from)
 {
-	FuncCall    *newnode = makeNode(FuncCall);
+	FuncCall   *newnode = makeNode(FuncCall);
 
 	if (from->funcname)
 		newnode->funcname = pstrdup(from->funcname);
@@ -1620,7 +1624,7 @@ _copyFuncCall(FuncCall *from)
 static A_Indices *
 _copyAIndices(A_Indices *from)
 {
-	A_Indices    *newnode = makeNode(A_Indices);
+	A_Indices  *newnode = makeNode(A_Indices);
 
 	Node_Copy(from, newnode, lidx);
 	Node_Copy(from, newnode, uidx);
@@ -1631,7 +1635,7 @@ _copyAIndices(A_Indices *from)
 static ResTarget *
 _copyResTarget(ResTarget *from)
 {
-	ResTarget    *newnode = makeNode(ResTarget);
+	ResTarget  *newnode = makeNode(ResTarget);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -1659,7 +1663,7 @@ _copyTypeName(TypeName *from)
 static SortGroupBy *
 _copySortGroupBy(SortGroupBy *from)
 {
-	SortGroupBy   *newnode = makeNode(SortGroupBy);
+	SortGroupBy *newnode = makeNode(SortGroupBy);
 
 	if (from->useOp)
 		newnode->useOp = pstrdup(from->useOp);
@@ -1684,7 +1688,7 @@ _copyRangeVar(RangeVar *from)
 static RangeSubselect *
 _copyRangeSubselect(RangeSubselect *from)
 {
-	RangeSubselect   *newnode = makeNode(RangeSubselect);
+	RangeSubselect *newnode = makeNode(RangeSubselect);
 
 	Node_Copy(from, newnode, subquery);
 	Node_Copy(from, newnode, name);
@@ -1706,7 +1710,7 @@ _copyTypeCast(TypeCast *from)
 static IndexElem *
 _copyIndexElem(IndexElem *from)
 {
-	IndexElem   *newnode = makeNode(IndexElem);
+	IndexElem  *newnode = makeNode(IndexElem);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -1720,7 +1724,7 @@ _copyIndexElem(IndexElem *from)
 static ColumnDef *
 _copyColumnDef(ColumnDef *from)
 {
-	ColumnDef   *newnode = makeNode(ColumnDef);
+	ColumnDef  *newnode = makeNode(ColumnDef);
 
 	if (from->colname)
 		newnode->colname = pstrdup(from->colname);
@@ -1738,7 +1742,7 @@ _copyColumnDef(ColumnDef *from)
 static Constraint *
 _copyConstraint(Constraint *from)
 {
-	Constraint   *newnode = makeNode(Constraint);
+	Constraint *newnode = makeNode(Constraint);
 
 	newnode->contype = from->contype;
 	if (from->name)
@@ -1754,7 +1758,7 @@ _copyConstraint(Constraint *from)
 static DefElem *
 _copyDefElem(DefElem *from)
 {
-	DefElem   *newnode = makeNode(DefElem);
+	DefElem    *newnode = makeNode(DefElem);
 
 	if (from->defname)
 		newnode->defname = pstrdup(from->defname);
@@ -1811,7 +1815,7 @@ static InsertStmt *
 _copyInsertStmt(InsertStmt *from)
 {
 	InsertStmt *newnode = makeNode(InsertStmt);
-	
+
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
 	Node_Copy(from, newnode, cols);
@@ -1825,7 +1829,7 @@ static DeleteStmt *
 _copyDeleteStmt(DeleteStmt *from)
 {
 	DeleteStmt *newnode = makeNode(DeleteStmt);
-	
+
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
 	Node_Copy(from, newnode, whereClause);
@@ -1838,7 +1842,7 @@ static UpdateStmt *
 _copyUpdateStmt(UpdateStmt *from)
 {
 	UpdateStmt *newnode = makeNode(UpdateStmt);
-	
+
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
 	Node_Copy(from, newnode, targetList);
@@ -1853,7 +1857,7 @@ static SelectStmt *
 _copySelectStmt(SelectStmt *from)
 {
 	SelectStmt *newnode = makeNode(SelectStmt);
-	
+
 	Node_Copy(from, newnode, distinctClause);
 	if (from->into)
 		newnode->into = pstrdup(from->into);
@@ -1882,7 +1886,7 @@ static SetOperationStmt *
 _copySetOperationStmt(SetOperationStmt *from)
 {
 	SetOperationStmt *newnode = makeNode(SetOperationStmt);
-	
+
 	newnode->op = from->op;
 	newnode->all = from->all;
 	Node_Copy(from, newnode, larg);
@@ -1896,7 +1900,7 @@ static AlterTableStmt *
 _copyAlterTableStmt(AlterTableStmt *from)
 {
 	AlterTableStmt *newnode = makeNode(AlterTableStmt);
-	
+
 	newnode->subtype = from->subtype;
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
@@ -1913,7 +1917,7 @@ static ChangeACLStmt *
 _copyChangeACLStmt(ChangeACLStmt *from)
 {
 	ChangeACLStmt *newnode = makeNode(ChangeACLStmt);
-	
+
 	Node_Copy(from, newnode, relNames);
 	if (from->aclString)
 		newnode->aclString = pstrdup(from->aclString);
@@ -1936,7 +1940,7 @@ static ClusterStmt *
 _copyClusterStmt(ClusterStmt *from)
 {
 	ClusterStmt *newnode = makeNode(ClusterStmt);
-	
+
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
 	if (from->indexname)
@@ -1948,8 +1952,8 @@ _copyClusterStmt(ClusterStmt *from)
 static CopyStmt *
 _copyCopyStmt(CopyStmt *from)
 {
-	CopyStmt *newnode = makeNode(CopyStmt);
-	
+	CopyStmt   *newnode = makeNode(CopyStmt);
+
 	newnode->binary = from->binary;
 	if (from->relname)
 		newnode->relname = pstrdup(from->relname);
@@ -1969,7 +1973,7 @@ static CreateStmt *
 _copyCreateStmt(CreateStmt *from)
 {
 	CreateStmt *newnode = makeNode(CreateStmt);
-	
+
 	newnode->istemp = from->istemp;
 	newnode->relname = pstrdup(from->relname);
 	Node_Copy(from, newnode, tableElts);
@@ -1983,7 +1987,7 @@ static VersionStmt *
 _copyVersionStmt(VersionStmt *from)
 {
 	VersionStmt *newnode = makeNode(VersionStmt);
-	
+
 	newnode->relname = pstrdup(from->relname);
 	newnode->direction = from->direction;
 	newnode->fromRelname = pstrdup(from->fromRelname);
@@ -1996,7 +2000,7 @@ static DefineStmt *
 _copyDefineStmt(DefineStmt *from)
 {
 	DefineStmt *newnode = makeNode(DefineStmt);
-	
+
 	newnode->defType = from->defType;
 	newnode->defname = pstrdup(from->defname);
 	Node_Copy(from, newnode, definition);
@@ -2007,8 +2011,8 @@ _copyDefineStmt(DefineStmt *from)
 static DropStmt *
 _copyDropStmt(DropStmt *from)
 {
-	DropStmt *newnode = makeNode(DropStmt);
-	
+	DropStmt   *newnode = makeNode(DropStmt);
+
 	Node_Copy(from, newnode, names);
 	newnode->removeType = from->removeType;
 
@@ -2029,11 +2033,11 @@ static CommentStmt *
 _copyCommentStmt(CommentStmt *from)
 {
 	CommentStmt *newnode = makeNode(CommentStmt);
-	
+
 	newnode->objtype = from->objtype;
 	newnode->objname = pstrdup(from->objname);
 	if (from->objproperty)
-	  newnode->objproperty = pstrdup(from->objproperty);
+		newnode->objproperty = pstrdup(from->objproperty);
 	Node_Copy(from, newnode, objlist);
 	newnode->comment = pstrdup(from->comment);
 
@@ -2044,7 +2048,7 @@ static ExtendStmt *
 _copyExtendStmt(ExtendStmt *from)
 {
 	ExtendStmt *newnode = makeNode(ExtendStmt);
-	
+
 	newnode->idxname = pstrdup(from->idxname);
 	Node_Copy(from, newnode, whereClause);
 	Node_Copy(from, newnode, rangetable);
@@ -2055,8 +2059,8 @@ _copyExtendStmt(ExtendStmt *from)
 static FetchStmt *
 _copyFetchStmt(FetchStmt *from)
 {
-	FetchStmt *newnode = makeNode(FetchStmt);
-	
+	FetchStmt  *newnode = makeNode(FetchStmt);
+
 	newnode->direction = from->direction;
 	newnode->howMany = from->howMany;
 	newnode->portalname = pstrdup(from->portalname);
@@ -2068,8 +2072,8 @@ _copyFetchStmt(FetchStmt *from)
 static IndexStmt *
 _copyIndexStmt(IndexStmt *from)
 {
-	IndexStmt *newnode = makeNode(IndexStmt);
-	
+	IndexStmt  *newnode = makeNode(IndexStmt);
+
 	newnode->idxname = pstrdup(from->idxname);
 	newnode->relname = pstrdup(from->relname);
 	newnode->accessMethod = pstrdup(from->accessMethod);
@@ -2087,7 +2091,7 @@ static ProcedureStmt *
 _copyProcedureStmt(ProcedureStmt *from)
 {
 	ProcedureStmt *newnode = makeNode(ProcedureStmt);
-	
+
 	newnode->funcname = pstrdup(from->funcname);
 	Node_Copy(from, newnode, argTypes);
 	Node_Copy(from, newnode, returnType);
@@ -2102,7 +2106,7 @@ static RemoveAggrStmt *
 _copyRemoveAggrStmt(RemoveAggrStmt *from)
 {
 	RemoveAggrStmt *newnode = makeNode(RemoveAggrStmt);
-	
+
 	newnode->aggname = pstrdup(from->aggname);
 	Node_Copy(from, newnode, aggtype);
 
@@ -2113,7 +2117,7 @@ static RemoveFuncStmt *
 _copyRemoveFuncStmt(RemoveFuncStmt *from)
 {
 	RemoveFuncStmt *newnode = makeNode(RemoveFuncStmt);
-	
+
 	newnode->funcname = pstrdup(from->funcname);
 	Node_Copy(from, newnode, args);
 
@@ -2124,7 +2128,7 @@ static RemoveOperStmt *
 _copyRemoveOperStmt(RemoveOperStmt *from)
 {
 	RemoveOperStmt *newnode = makeNode(RemoveOperStmt);
-	
+
 	newnode->opname = pstrdup(from->opname);
 	Node_Copy(from, newnode, args);
 
@@ -2135,7 +2139,7 @@ static RenameStmt *
 _copyRenameStmt(RenameStmt *from)
 {
 	RenameStmt *newnode = makeNode(RenameStmt);
-	
+
 	newnode->relname = pstrdup(from->relname);
 	newnode->inhOpt = from->inhOpt;
 	if (from->column)
@@ -2149,8 +2153,8 @@ _copyRenameStmt(RenameStmt *from)
 static RuleStmt *
 _copyRuleStmt(RuleStmt *from)
 {
-	RuleStmt *newnode = makeNode(RuleStmt);
-	
+	RuleStmt   *newnode = makeNode(RuleStmt);
+
 	newnode->rulename = pstrdup(from->rulename);
 	Node_Copy(from, newnode, whereClause);
 	newnode->event = from->event;
@@ -2231,7 +2235,7 @@ _copyLoadStmt(LoadStmt *from)
 static CreatedbStmt *
 _copyCreatedbStmt(CreatedbStmt *from)
 {
-	CreatedbStmt   *newnode = makeNode(CreatedbStmt);
+	CreatedbStmt *newnode = makeNode(CreatedbStmt);
 
 	if (from->dbname)
 		newnode->dbname = pstrdup(from->dbname);
@@ -2247,7 +2251,7 @@ _copyCreatedbStmt(CreatedbStmt *from)
 static DropdbStmt *
 _copyDropdbStmt(DropdbStmt *from)
 {
-	DropdbStmt   *newnode = makeNode(DropdbStmt);
+	DropdbStmt *newnode = makeNode(DropdbStmt);
 
 	if (from->dbname)
 		newnode->dbname = pstrdup(from->dbname);
@@ -2258,7 +2262,7 @@ _copyDropdbStmt(DropdbStmt *from)
 static VacuumStmt *
 _copyVacuumStmt(VacuumStmt *from)
 {
-	VacuumStmt   *newnode = makeNode(VacuumStmt);
+	VacuumStmt *newnode = makeNode(VacuumStmt);
 
 	newnode->verbose = from->verbose;
 	newnode->analyze = from->analyze;
@@ -2272,7 +2276,7 @@ _copyVacuumStmt(VacuumStmt *from)
 static ExplainStmt *
 _copyExplainStmt(ExplainStmt *from)
 {
-	ExplainStmt   *newnode = makeNode(ExplainStmt);
+	ExplainStmt *newnode = makeNode(ExplainStmt);
 
 	Node_Copy(from, newnode, query);
 	newnode->verbose = from->verbose;
@@ -2283,7 +2287,7 @@ _copyExplainStmt(ExplainStmt *from)
 static CreateSeqStmt *
 _copyCreateSeqStmt(CreateSeqStmt *from)
 {
-	CreateSeqStmt   *newnode = makeNode(CreateSeqStmt);
+	CreateSeqStmt *newnode = makeNode(CreateSeqStmt);
 
 	if (from->seqname)
 		newnode->seqname = pstrdup(from->seqname);
@@ -2346,6 +2350,7 @@ _copyCreateTrigStmt(CreateTrigStmt *from)
 		newnode->lang = pstrdup(from->lang);
 	if (from->text)
 		newnode->text = pstrdup(from->text);
+
 	Node_Copy(from, newnode, attr);
 	if (from->when)
 		newnode->when = pstrdup(from->when);
@@ -2459,7 +2464,7 @@ _copyLockStmt(LockStmt *from)
 static ConstraintsSetStmt *
 _copyConstraintsSetStmt(ConstraintsSetStmt *from)
 {
-	ConstraintsSetStmt   *newnode = makeNode(ConstraintsSetStmt);
+	ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);
 
 	Node_Copy(from, newnode, constraints);
 	newnode->deferred = from->deferred;
@@ -2470,7 +2475,7 @@ _copyConstraintsSetStmt(ConstraintsSetStmt *from)
 static CreateGroupStmt *
 _copyCreateGroupStmt(CreateGroupStmt *from)
 {
-	CreateGroupStmt   *newnode = makeNode(CreateGroupStmt);
+	CreateGroupStmt *newnode = makeNode(CreateGroupStmt);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -2483,7 +2488,7 @@ _copyCreateGroupStmt(CreateGroupStmt *from)
 static AlterGroupStmt *
 _copyAlterGroupStmt(AlterGroupStmt *from)
 {
-	AlterGroupStmt   *newnode = makeNode(AlterGroupStmt);
+	AlterGroupStmt *newnode = makeNode(AlterGroupStmt);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -2497,7 +2502,7 @@ _copyAlterGroupStmt(AlterGroupStmt *from)
 static DropGroupStmt *
 _copyDropGroupStmt(DropGroupStmt *from)
 {
-	DropGroupStmt   *newnode = makeNode(DropGroupStmt);
+	DropGroupStmt *newnode = makeNode(DropGroupStmt);
 
 	if (from->name)
 		newnode->name = pstrdup(from->name);
@@ -2508,7 +2513,7 @@ _copyDropGroupStmt(DropGroupStmt *from)
 static ReindexStmt *
 _copyReindexStmt(ReindexStmt *from)
 {
-	ReindexStmt   *newnode = makeNode(ReindexStmt);
+	ReindexStmt *newnode = makeNode(ReindexStmt);
 
 	newnode->reindexType = from->reindexType;
 	if (from->name)
@@ -2919,7 +2924,7 @@ copyObject(void *from)
 			retval = _copyReindexStmt(from);
 			break;
 		case T_CheckPointStmt:
-			retval = (void*)makeNode(CheckPointStmt);
+			retval = (void *) makeNode(CheckPointStmt);
 			break;
 
 		case T_A_Expr:
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 9e16b79c6ccc583468e235d886c7b22a88e73431..06ee63bbacd05398c5445bd4ce4f8dfb169090da 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -6,7 +6,7 @@
  * NOTE: a general convention when copying or comparing plan nodes is
  * that we ignore the executor state subnode.  We do not need to look
  * at it because no current uses of copyObject() or equal() need to
- * deal with already-executing plan trees.  By leaving the state subnodes
+ * deal with already-executing plan trees.	By leaving the state subnodes
  * out, we avoid needing to write copy/compare routines for all the
  * different executor state node types.
  *
@@ -20,7 +20,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.87 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.88 2001/03/22 03:59:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
 
 
 /* Macro for comparing string fields that might be NULL */
-#define equalstr(a, b)  \
+#define equalstr(a, b)	\
 	(((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
 
 
@@ -134,9 +134,9 @@ _equalOper(Oper *a, Oper *b)
 		return false;
 
 	/*
-	 * We do not examine opid or op_fcache, since these are
-	 * logically derived from opno, and they may not be set yet depending
-	 * on how far along the node is in the parse/plan pipeline.
+	 * We do not examine opid or op_fcache, since these are logically
+	 * derived from opno, and they may not be set yet depending on how far
+	 * along the node is in the parse/plan pipeline.
 	 *
 	 * (Besides, op_fcache is executor state, which we don't check --- see
 	 * notes at head of file.)
@@ -514,6 +514,7 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
 {
 	if (!equal(a->clause, b->clause))
 		return false;
+
 	/*
 	 * ignore eval_cost, left/right_pathkey, and left/right_dispersion,
 	 * since they may not be set yet, and should be derivable from the
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index aa83006c8407424b67f807e044a90dcacf825870..9b588150fda8be7757d8345626164ef383f7be59 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.38 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.39 2001/03/22 03:59:32 momjian Exp $
  *
  * NOTES
  *	  XXX a few of the following functions are duplicated to handle
@@ -557,13 +557,12 @@ set_differencei(List *l1, List *l2)
 List *
 lreverse(List *l)
 {
-    List       *result = NIL;
-    List       *i;
-    foreach(i, l)
-    {
-        result = lcons(lfirst(i), result);
-    }
-    return result;
+	List	   *result = NIL;
+	List	   *i;
+
+	foreach(i, l)
+		result = lcons(lfirst(i), result);
+	return result;
 }
 
 /*
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index f8bbb117291e2ceab133d58c87e72ef4adc9bfe9..d8f8310c5b7463dd0c83fc42b72bde8098af6973 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.25 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.26 2001/03/22 03:59:32 momjian Exp $
  *
  * NOTES
  *	  Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -109,9 +109,10 @@ makeResdom(AttrNumber resno,
 	resdom->resname = resname;
 
 	/*
-	 * We always set the sorting/grouping fields to 0.  If the caller wants
-	 * to change them he must do so explicitly.  Few if any callers should
-	 * be doing that, so omitting these arguments reduces the chance of error.
+	 * We always set the sorting/grouping fields to 0.	If the caller
+	 * wants to change them he must do so explicitly.  Few if any callers
+	 * should be doing that, so omitting these arguments reduces the
+	 * chance of error.
 	 */
 	resdom->ressortgroupref = 0;
 	resdom->reskey = 0;
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index c8baef5fbfa9a2fb63a056e2ed3c9f4c9083dccd..42dd9a2dab8e529711e4b1d2bb95e2e0532452d1 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.13 2001/01/24 19:42:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.14 2001/03/22 03:59:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -114,5 +114,5 @@ non_null(Expr *c)
 	else
 		return false;
 }
-#endif
 
+#endif
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 97f931f5cc66e40b1518abfc78e38df7724fbb5d..2c0cfed7ee49c27f576fe5f5c9fed302e5cfbba8 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.139 2001/01/24 19:42:57 momjian Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.140 2001/03/22 03:59:32 momjian Exp $
  *
  * NOTES
  *	  Every (plan) node in POSTGRES has an associated "out" routine which
@@ -224,6 +224,7 @@ _outQuery(StringInfo str, Query *node)
 
 	if (node->utilityStmt)
 	{
+
 		/*
 		 * Hack to make up for lack of outfuncs for utility-stmt nodes
 		 */
@@ -602,7 +603,7 @@ _outGroup(StringInfo str, Group *node)
 static void
 _outUnique(StringInfo str, Unique *node)
 {
-	int		i;
+	int			i;
 
 	appendStringInfo(str, " UNIQUE ");
 	_outPlanInfo(str, (Plan *) node);
@@ -616,7 +617,7 @@ _outUnique(StringInfo str, Unique *node)
 static void
 _outSetOp(StringInfo str, SetOp *node)
 {
-	int		i;
+	int			i;
 
 	appendStringInfo(str, " SETOP ");
 	_outPlanInfo(str, (Plan *) node);
@@ -889,7 +890,7 @@ _outFieldSelect(StringInfo str, FieldSelect *node)
 	_outNode(str, node->arg);
 
 	appendStringInfo(str, " :fieldnum %d :resulttype %u :resulttypmod %d ",
-					 node->fieldnum, node->resulttype, node->resulttypmod);
+				   node->fieldnum, node->resulttype, node->resulttypmod);
 }
 
 /*
@@ -1279,14 +1280,14 @@ static void
 _outStream(StringInfo str, Stream *node)
 {
 	appendStringInfo(str,
-					 " STREAM :pathptr @ %p :cinfo @ %p :clausetype %p :upstream @ %p ",
+	  " STREAM :pathptr @ %p :cinfo @ %p :clausetype %p :upstream @ %p ",
 					 node->pathptr,
 					 node->cinfo,
 					 node->clausetype,
 					 node->upstream);
 
 	appendStringInfo(str,
-		   " :downstream @ %p :groupup %d :groupcost %f :groupsel %f ",
+			 " :downstream @ %p :groupup %d :groupcost %f :groupsel %f ",
 					 node->downstream,
 					 node->groupup,
 					 node->groupcost,
@@ -1332,7 +1333,7 @@ _outValue(StringInfo str, Value *value)
 {
 	switch (value->type)
 	{
-		case T_Integer:
+			case T_Integer:
 			appendStringInfo(str, " %ld ", value->val.ival);
 			break;
 		case T_Float:
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 4f57a365c45dd3719f4857273e3567bee961ac2e..932f55ab885acfaad88e15626669bd3c63464bf7 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.46 2001/01/24 19:42:57 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.47 2001/03/22 03:59:32 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -290,7 +290,7 @@ plannode_type(Plan *p)
 {
 	switch (nodeTag(p))
 	{
-		case T_Plan:
+			case T_Plan:
 			return "PLAN";
 		case T_Result:
 			return "RESULT";
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c
index beebe262f9f5b45511097ca2de53bc30449bfdd0..1f41cc85718b1c97a881af09802df20ea2d47338 100644
--- a/src/backend/nodes/read.c
+++ b/src/backend/nodes/read.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.28 2001/01/24 19:42:57 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.29 2001/03/22 03:59:32 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -41,9 +41,9 @@ stringToNode(char *str)
 	void	   *retval;
 
 	/*
-	 * We save and restore the pre-existing state of pg_strtok.
-	 * This makes the world safe for re-entrant invocation of stringToNode,
-	 * without incurring a lot of notational overhead by having to pass the
+	 * We save and restore the pre-existing state of pg_strtok. This makes
+	 * the world safe for re-entrant invocation of stringToNode, without
+	 * incurring a lot of notational overhead by having to pass the
 	 * next-character pointer around through all the readfuncs.c code.
 	 */
 	save_strtok = pg_strtok_ptr;
@@ -213,7 +213,7 @@ nodeTokenType(char *token, int length)
 	if (*numptr == '+' || *numptr == '-')
 		numptr++, numlen--;
 	if ((numlen > 0 && isdigit((unsigned char) *numptr)) ||
-		(numlen > 1 && *numptr == '.' && isdigit((unsigned char) numptr[1])))
+	(numlen > 1 && *numptr == '.' && isdigit((unsigned char) numptr[1])))
 	{
 
 		/*
@@ -357,14 +357,15 @@ nodeRead(bool read_car_only)
 			make_dotted_pair_cell = true;
 			break;
 		case T_BitString:
-		{
-			char * val = palloc(tok_len);
-			/* skip leading 'b'*/
-			strncpy(val, token + 1, tok_len - 1);
-			val[tok_len - 1] = '\0';
-			this_value = (Node *) makeBitString(val);
-			break;
-		}
+			{
+				char	   *val = palloc(tok_len);
+
+				/* skip leading 'b' */
+				strncpy(val, token + 1, tok_len - 1);
+				val[tok_len - 1] = '\0';
+				this_value = (Node *) makeBitString(val);
+				break;
+			}
 		default:
 			elog(ERROR, "nodeRead: Bad type %d", type);
 			this_value = NULL;	/* keep compiler happy */
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index a6eb9de4dceefaa61eacd8a862a41e37bef73c55..9a071e7a250df88efe03c183927ffeadfa07a86c 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.106 2001/02/12 21:03:03 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.107 2001/03/22 03:59:32 momjian Exp $
  *
  * NOTES
  *	  Most of the read functions for plan nodes are tested. (In fact, they
@@ -35,7 +35,7 @@
 /*
  * NOTE: use atoi() to read values written with %d, or atoui() to read
  * values written with %u in outfuncs.c.  An exception is OID values,
- * for which use atooid().  (As of 7.1, outfuncs.c writes OIDs as %u,
+ * for which use atooid().	(As of 7.1, outfuncs.c writes OIDs as %u,
  * but this will probably change in the future.)
  */
 #define atoui(x)  ((unsigned int) strtoul((x), NULL, 10))
@@ -64,7 +64,7 @@ toIntList(List *list)
 
 	foreach(l, list)
 	{
-		Value  *v = (Value *) lfirst(l);
+		Value	   *v = (Value *) lfirst(l);
 
 		if (!IsA(v, Integer))
 			elog(ERROR, "toIntList: unexpected datatype");
@@ -82,12 +82,12 @@ toOidList(List *list)
 
 	foreach(l, list)
 	{
-		Value  *v = (Value *) lfirst(l);
+		Value	   *v = (Value *) lfirst(l);
 
 		/*
 		 * This is a bit tricky because OID is unsigned, and so nodeRead
-		 * might have concluded the value doesn't fit in an integer.
-		 * Must cope with T_Float as well.
+		 * might have concluded the value doesn't fit in an integer. Must
+		 * cope with T_Float as well.
 		 */
 		if (IsA(v, Integer))
 		{
@@ -119,16 +119,17 @@ _readQuery(void)
 
 	local_node = makeNode(Query);
 
-	token = pg_strtok(&length);		/* skip the :command */
-	token = pg_strtok(&length);		/* get the commandType */
+	token = pg_strtok(&length); /* skip the :command */
+	token = pg_strtok(&length); /* get the commandType */
 	local_node->commandType = atoi(token);
 
-	token = pg_strtok(&length);		/* skip :utility */
+	token = pg_strtok(&length); /* skip :utility */
 	token = pg_strtok(&length);
 	if (length == 0)
 		local_node->utilityStmt = NULL;
 	else
 	{
+
 		/*
 		 * Hack to make up for lack of readfuncs for utility-stmt nodes
 		 *
@@ -140,68 +141,68 @@ _readQuery(void)
 		local_node->utilityStmt = (Node *) n;
 	}
 
-	token = pg_strtok(&length);		/* skip the :resultRelation */
-	token = pg_strtok(&length);		/* get the resultRelation */
+	token = pg_strtok(&length); /* skip the :resultRelation */
+	token = pg_strtok(&length); /* get the resultRelation */
 	local_node->resultRelation = atoi(token);
 
-	token = pg_strtok(&length);		/* skip :into */
-	token = pg_strtok(&length);		/* get into */
+	token = pg_strtok(&length); /* skip :into */
+	token = pg_strtok(&length); /* get into */
 	local_node->into = nullable_string(token, length);
 
-	token = pg_strtok(&length);		/* skip :isPortal */
-	token = pg_strtok(&length);		/* get isPortal */
+	token = pg_strtok(&length); /* skip :isPortal */
+	token = pg_strtok(&length); /* get isPortal */
 	local_node->isPortal = strtobool(token);
 
-	token = pg_strtok(&length);		/* skip :isBinary */
-	token = pg_strtok(&length);		/* get isBinary */
+	token = pg_strtok(&length); /* skip :isBinary */
+	token = pg_strtok(&length); /* get isBinary */
 	local_node->isBinary = strtobool(token);
 
-	token = pg_strtok(&length);		/* skip :isTemp */
-	token = pg_strtok(&length);		/* get isTemp */
+	token = pg_strtok(&length); /* skip :isTemp */
+	token = pg_strtok(&length); /* get isTemp */
 	local_node->isTemp = strtobool(token);
 
-	token = pg_strtok(&length);		/* skip the :hasAggs */
-	token = pg_strtok(&length);		/* get hasAggs */
+	token = pg_strtok(&length); /* skip the :hasAggs */
+	token = pg_strtok(&length); /* get hasAggs */
 	local_node->hasAggs = strtobool(token);
 
-	token = pg_strtok(&length);		/* skip the :hasSubLinks */
-	token = pg_strtok(&length);		/* get hasSubLinks */
+	token = pg_strtok(&length); /* skip the :hasSubLinks */
+	token = pg_strtok(&length); /* get hasSubLinks */
 	local_node->hasSubLinks = strtobool(token);
 
-	token = pg_strtok(&length);		/* skip :rtable */
+	token = pg_strtok(&length); /* skip :rtable */
 	local_node->rtable = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :jointree */
+	token = pg_strtok(&length); /* skip :jointree */
 	local_node->jointree = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :rowMarks */
+	token = pg_strtok(&length); /* skip :rowMarks */
 	local_node->rowMarks = toIntList(nodeRead(true));
 
-	token = pg_strtok(&length);		/* skip :targetlist */
+	token = pg_strtok(&length); /* skip :targetlist */
 	local_node->targetList = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :groupClause */
+	token = pg_strtok(&length); /* skip :groupClause */
 	local_node->groupClause = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :havingQual */
+	token = pg_strtok(&length); /* skip :havingQual */
 	local_node->havingQual = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :distinctClause */
+	token = pg_strtok(&length); /* skip :distinctClause */
 	local_node->distinctClause = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :sortClause */
+	token = pg_strtok(&length); /* skip :sortClause */
 	local_node->sortClause = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :limitOffset */
+	token = pg_strtok(&length); /* skip :limitOffset */
 	local_node->limitOffset = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :limitCount */
+	token = pg_strtok(&length); /* skip :limitCount */
 	local_node->limitCount = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :setOperations */
+	token = pg_strtok(&length); /* skip :setOperations */
 	local_node->setOperations = nodeRead(true);
 
-	token = pg_strtok(&length);		/* skip :resultRelations */
+	token = pg_strtok(&length); /* skip :resultRelations */
 	local_node->resultRelations = toIntList(nodeRead(true));
 
 	return local_node;
@@ -220,12 +221,12 @@ _readSortClause(void)
 
 	local_node = makeNode(SortClause);
 
-	token = pg_strtok(&length);		/* skip :tleSortGroupRef */
-	token = pg_strtok(&length);		/* get tleSortGroupRef */
+	token = pg_strtok(&length); /* skip :tleSortGroupRef */
+	token = pg_strtok(&length); /* get tleSortGroupRef */
 	local_node->tleSortGroupRef = atoui(token);
 
-	token = pg_strtok(&length);		/* skip :sortop */
-	token = pg_strtok(&length);		/* get sortop */
+	token = pg_strtok(&length); /* skip :sortop */
+	token = pg_strtok(&length); /* get sortop */
 	local_node->sortop = atooid(token);
 
 	return local_node;
@@ -244,12 +245,12 @@ _readGroupClause(void)
 
 	local_node = makeNode(GroupClause);
 
-	token = pg_strtok(&length);		/* skip :tleSortGroupRef */
-	token = pg_strtok(&length);		/* get tleSortGroupRef */
+	token = pg_strtok(&length); /* skip :tleSortGroupRef */
+	token = pg_strtok(&length); /* get tleSortGroupRef */
 	local_node->tleSortGroupRef = atoui(token);
 
-	token = pg_strtok(&length);		/* skip :sortop */
-	token = pg_strtok(&length);		/* get sortop */
+	token = pg_strtok(&length); /* skip :sortop */
+	token = pg_strtok(&length); /* get sortop */
 	local_node->sortop = atooid(token);
 
 	return local_node;
@@ -268,21 +269,21 @@ _readSetOperationStmt(void)
 
 	local_node = makeNode(SetOperationStmt);
 
-	token = pg_strtok(&length);		/* eat :op */
-	token = pg_strtok(&length);		/* get op */
+	token = pg_strtok(&length); /* eat :op */
+	token = pg_strtok(&length); /* get op */
 	local_node->op = (SetOperation) atoi(token);
 
-	token = pg_strtok(&length);		/* eat :all */
-	token = pg_strtok(&length);		/* get all */
+	token = pg_strtok(&length); /* eat :all */
+	token = pg_strtok(&length); /* get all */
 	local_node->all = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :larg */
+	token = pg_strtok(&length); /* eat :larg */
 	local_node->larg = nodeRead(true);	/* get larg */
 
-	token = pg_strtok(&length);		/* eat :rarg */
+	token = pg_strtok(&length); /* eat :rarg */
 	local_node->rarg = nodeRead(true);	/* get rarg */
 
-	token = pg_strtok(&length);		/* eat :colTypes */
+	token = pg_strtok(&length); /* eat :colTypes */
 	local_node->colTypes = toOidList(nodeRead(true));
 
 	return local_node;
@@ -298,32 +299,32 @@ _getPlan(Plan *node)
 	char	   *token;
 	int			length;
 
-	token = pg_strtok(&length);		/* first token is :startup_cost */
-	token = pg_strtok(&length);		/* next is the actual cost */
+	token = pg_strtok(&length); /* first token is :startup_cost */
+	token = pg_strtok(&length); /* next is the actual cost */
 	node->startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* skip the :total_cost */
-	token = pg_strtok(&length);		/* next is the actual cost */
+	token = pg_strtok(&length); /* skip the :total_cost */
+	token = pg_strtok(&length); /* next is the actual cost */
 	node->total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* skip the :rows */
-	token = pg_strtok(&length);		/* get the plan_rows */
+	token = pg_strtok(&length); /* skip the :rows */
+	token = pg_strtok(&length); /* get the plan_rows */
 	node->plan_rows = atof(token);
 
-	token = pg_strtok(&length);		/* skip the :width */
-	token = pg_strtok(&length);		/* get the plan_width */
+	token = pg_strtok(&length); /* skip the :width */
+	token = pg_strtok(&length); /* get the plan_width */
 	node->plan_width = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :qptargetlist */
+	token = pg_strtok(&length); /* eat :qptargetlist */
 	node->targetlist = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :qpqual */
+	token = pg_strtok(&length); /* eat :qpqual */
 	node->qual = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :lefttree */
+	token = pg_strtok(&length); /* eat :lefttree */
 	node->lefttree = (Plan *) nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :righttree */
+	token = pg_strtok(&length); /* eat :righttree */
 	node->righttree = (Plan *) nodeRead(true);
 
 	node->state = (EState *) NULL;		/* never read in */
@@ -366,7 +367,7 @@ _readResult(void)
 
 	_getPlan((Plan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :resconstantqual */
+	token = pg_strtok(&length); /* eat :resconstantqual */
 	local_node->resconstantqual = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -390,11 +391,11 @@ _readAppend(void)
 
 	_getPlan((Plan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :appendplans */
+	token = pg_strtok(&length); /* eat :appendplans */
 	local_node->appendplans = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :isTarget */
-	token = pg_strtok(&length);		/* get isTarget */
+	token = pg_strtok(&length); /* eat :isTarget */
+	token = pg_strtok(&length); /* get isTarget */
 	local_node->isTarget = strtobool(token);
 
 	return local_node;
@@ -412,11 +413,11 @@ _getJoin(Join *node)
 
 	_getPlan((Plan *) node);
 
-	token = pg_strtok(&length);		/* skip the :jointype */
-	token = pg_strtok(&length);		/* get the jointype */
+	token = pg_strtok(&length); /* skip the :jointype */
+	token = pg_strtok(&length); /* get the jointype */
 	node->jointype = (JoinType) atoi(token);
 
-	token = pg_strtok(&length);		/* skip the :joinqual */
+	token = pg_strtok(&length); /* skip the :joinqual */
 	node->joinqual = nodeRead(true);	/* get the joinqual */
 }
 
@@ -475,7 +476,7 @@ _readMergeJoin(void)
 
 	_getJoin((Join *) local_node);
 
-	token = pg_strtok(&length);		/* eat :mergeclauses */
+	token = pg_strtok(&length); /* eat :mergeclauses */
 	local_node->mergeclauses = nodeRead(true);	/* now read it */
 
 	return local_node;
@@ -498,11 +499,11 @@ _readHashJoin(void)
 
 	_getJoin((Join *) local_node);
 
-	token = pg_strtok(&length);		/* eat :hashclauses */
+	token = pg_strtok(&length); /* eat :hashclauses */
 	local_node->hashclauses = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :hashjoinop */
-	token = pg_strtok(&length);		/* get hashjoinop */
+	token = pg_strtok(&length); /* eat :hashjoinop */
+	token = pg_strtok(&length); /* get hashjoinop */
 	local_node->hashjoinop = atooid(token);
 
 	return local_node;
@@ -524,8 +525,8 @@ _getScan(Scan *node)
 
 	_getPlan((Plan *) node);
 
-	token = pg_strtok(&length);		/* eat :scanrelid */
-	token = pg_strtok(&length);		/* get scanrelid */
+	token = pg_strtok(&length); /* eat :scanrelid */
+	token = pg_strtok(&length); /* get scanrelid */
 	node->scanrelid = atoui(token);
 }
 
@@ -582,17 +583,17 @@ _readIndexScan(void)
 
 	_getScan((Scan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :indxid */
+	token = pg_strtok(&length); /* eat :indxid */
 	local_node->indxid = toOidList(nodeRead(true));		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :indxqual */
+	token = pg_strtok(&length); /* eat :indxqual */
 	local_node->indxqual = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :indxqualorig */
+	token = pg_strtok(&length); /* eat :indxqualorig */
 	local_node->indxqualorig = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :indxorderdir */
-	token = pg_strtok(&length);		/* get indxorderdir */
+	token = pg_strtok(&length); /* eat :indxorderdir */
+	token = pg_strtok(&length); /* get indxorderdir */
 	local_node->indxorderdir = atoi(token);
 
 	return local_node;
@@ -615,11 +616,11 @@ _readTidScan(void)
 
 	_getScan((Scan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :needrescan */
-	token = pg_strtok(&length);		/* get needrescan */
+	token = pg_strtok(&length); /* eat :needrescan */
+	token = pg_strtok(&length); /* get needrescan */
 	local_node->needRescan = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :tideval */
+	token = pg_strtok(&length); /* eat :tideval */
 	local_node->tideval = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -634,7 +635,7 @@ _readTidScan(void)
 static SubqueryScan *
 _readSubqueryScan(void)
 {
-	SubqueryScan  *local_node;
+	SubqueryScan *local_node;
 	char	   *token;
 	int			length;
 
@@ -642,8 +643,8 @@ _readSubqueryScan(void)
 
 	_getScan((Scan *) local_node);
 
-	token = pg_strtok(&length);			/* eat :subplan */
-	local_node->subplan = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :subplan */
+	local_node->subplan = nodeRead(true);		/* now read it */
 
 	return local_node;
 }
@@ -665,8 +666,8 @@ _readSort(void)
 
 	_getPlan((Plan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :keycount */
-	token = pg_strtok(&length);		/* get keycount */
+	token = pg_strtok(&length); /* eat :keycount */
+	token = pg_strtok(&length); /* get keycount */
 	local_node->keycount = atoi(token);
 
 	return local_node;
@@ -700,7 +701,7 @@ _readHash(void)
 
 	_getPlan((Plan *) local_node);
 
-	token = pg_strtok(&length);		/* eat :hashkey */
+	token = pg_strtok(&length); /* eat :hashkey */
 	local_node->hashkey = nodeRead(true);
 
 	return local_node;
@@ -725,36 +726,36 @@ _readResdom(void)
 
 	local_node = makeNode(Resdom);
 
-	token = pg_strtok(&length);		/* eat :resno */
-	token = pg_strtok(&length);		/* get resno */
+	token = pg_strtok(&length); /* eat :resno */
+	token = pg_strtok(&length); /* get resno */
 	local_node->resno = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :restype */
-	token = pg_strtok(&length);		/* get restype */
+	token = pg_strtok(&length); /* eat :restype */
+	token = pg_strtok(&length); /* get restype */
 	local_node->restype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :restypmod */
-	token = pg_strtok(&length);		/* get restypmod */
+	token = pg_strtok(&length); /* eat :restypmod */
+	token = pg_strtok(&length); /* get restypmod */
 	local_node->restypmod = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :resname */
-	token = pg_strtok(&length);		/* get the name */
+	token = pg_strtok(&length); /* eat :resname */
+	token = pg_strtok(&length); /* get the name */
 	local_node->resname = nullable_string(token, length);
 
-	token = pg_strtok(&length);		/* eat :reskey */
-	token = pg_strtok(&length);		/* get reskey */
+	token = pg_strtok(&length); /* eat :reskey */
+	token = pg_strtok(&length); /* get reskey */
 	local_node->reskey = atoui(token);
 
-	token = pg_strtok(&length);		/* eat :reskeyop */
-	token = pg_strtok(&length);		/* get reskeyop */
+	token = pg_strtok(&length); /* eat :reskeyop */
+	token = pg_strtok(&length); /* get reskeyop */
 	local_node->reskeyop = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :ressortgroupref */
-	token = pg_strtok(&length);		/* get ressortgroupref */
+	token = pg_strtok(&length); /* eat :ressortgroupref */
+	token = pg_strtok(&length); /* get ressortgroupref */
 	local_node->ressortgroupref = atoui(token);
 
-	token = pg_strtok(&length);		/* eat :resjunk */
-	token = pg_strtok(&length);		/* get resjunk */
+	token = pg_strtok(&length); /* eat :resjunk */
+	token = pg_strtok(&length); /* get resjunk */
 	local_node->resjunk = strtobool(token);
 
 	return local_node;
@@ -775,12 +776,12 @@ _readExpr(void)
 
 	local_node = makeNode(Expr);
 
-	token = pg_strtok(&length);		/* eat :typeOid */
-	token = pg_strtok(&length);		/* get typeOid */
+	token = pg_strtok(&length); /* eat :typeOid */
+	token = pg_strtok(&length); /* get typeOid */
 	local_node->typeOid = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :opType */
-	token = pg_strtok(&length);		/* get opType */
+	token = pg_strtok(&length); /* eat :opType */
+	token = pg_strtok(&length); /* get opType */
 	if (strncmp(token, "op", 2) == 0)
 		local_node->opType = OP_EXPR;
 	else if (strncmp(token, "func", 4) == 0)
@@ -796,10 +797,10 @@ _readExpr(void)
 	else
 		elog(ERROR, "_readExpr: unknown opType \"%.*s\"", length, token);
 
-	token = pg_strtok(&length);		/* eat :oper */
+	token = pg_strtok(&length); /* eat :oper */
 	local_node->oper = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :args */
+	token = pg_strtok(&length); /* eat :args */
 	local_node->args = nodeRead(true);	/* now read it */
 
 	return local_node;
@@ -820,17 +821,17 @@ _readCaseExpr(void)
 
 	local_node = makeNode(CaseExpr);
 
-	token = pg_strtok(&length);		/* eat :casetype */
-	token = pg_strtok(&length);		/* get casetype */
+	token = pg_strtok(&length); /* eat :casetype */
+	token = pg_strtok(&length); /* get casetype */
 	local_node->casetype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :arg */
+	token = pg_strtok(&length); /* eat :arg */
 	local_node->arg = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :args */
+	token = pg_strtok(&length); /* eat :args */
 	local_node->args = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :defresult */
+	token = pg_strtok(&length); /* eat :defresult */
 	local_node->defresult = nodeRead(true);
 
 	return local_node;
@@ -852,7 +853,7 @@ _readCaseWhen(void)
 	local_node = makeNode(CaseWhen);
 
 	local_node->expr = nodeRead(true);
-	token = pg_strtok(&length);		/* eat :then */
+	token = pg_strtok(&length); /* eat :then */
 	local_node->result = nodeRead(true);
 
 	return local_node;
@@ -873,32 +874,32 @@ _readVar(void)
 
 	local_node = makeNode(Var);
 
-	token = pg_strtok(&length);		/* eat :varno */
-	token = pg_strtok(&length);		/* get varno */
+	token = pg_strtok(&length); /* eat :varno */
+	token = pg_strtok(&length); /* get varno */
 	local_node->varno = atoui(token);
 
-	token = pg_strtok(&length);		/* eat :varattno */
-	token = pg_strtok(&length);		/* get varattno */
+	token = pg_strtok(&length); /* eat :varattno */
+	token = pg_strtok(&length); /* get varattno */
 	local_node->varattno = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :vartype */
-	token = pg_strtok(&length);		/* get vartype */
+	token = pg_strtok(&length); /* eat :vartype */
+	token = pg_strtok(&length); /* get vartype */
 	local_node->vartype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :vartypmod */
-	token = pg_strtok(&length);		/* get vartypmod */
+	token = pg_strtok(&length); /* eat :vartypmod */
+	token = pg_strtok(&length); /* get vartypmod */
 	local_node->vartypmod = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :varlevelsup */
-	token = pg_strtok(&length);		/* get varlevelsup */
+	token = pg_strtok(&length); /* eat :varlevelsup */
+	token = pg_strtok(&length); /* get varlevelsup */
 	local_node->varlevelsup = atoui(token);
 
-	token = pg_strtok(&length);		/* eat :varnoold */
-	token = pg_strtok(&length);		/* get varnoold */
+	token = pg_strtok(&length); /* eat :varnoold */
+	token = pg_strtok(&length); /* get varnoold */
 	local_node->varnoold = atoui(token);
 
-	token = pg_strtok(&length);		/* eat :varoattno */
-	token = pg_strtok(&length);		/* eat :varoattno */
+	token = pg_strtok(&length); /* eat :varoattno */
+	token = pg_strtok(&length); /* eat :varoattno */
 	local_node->varoattno = atoi(token);
 
 	return local_node;
@@ -919,32 +920,32 @@ _readArrayRef(void)
 
 	local_node = makeNode(ArrayRef);
 
-	token = pg_strtok(&length);		/* eat :refelemtype */
-	token = pg_strtok(&length);		/* get refelemtype */
+	token = pg_strtok(&length); /* eat :refelemtype */
+	token = pg_strtok(&length); /* get refelemtype */
 	local_node->refelemtype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :refattrlength */
-	token = pg_strtok(&length);		/* get refattrlength */
+	token = pg_strtok(&length); /* eat :refattrlength */
+	token = pg_strtok(&length); /* get refattrlength */
 	local_node->refattrlength = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :refelemlength */
-	token = pg_strtok(&length);		/* get refelemlength */
+	token = pg_strtok(&length); /* eat :refelemlength */
+	token = pg_strtok(&length); /* get refelemlength */
 	local_node->refelemlength = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :refelembyval */
-	token = pg_strtok(&length);		/* get refelembyval */
+	token = pg_strtok(&length); /* eat :refelembyval */
+	token = pg_strtok(&length); /* get refelembyval */
 	local_node->refelembyval = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :refupperindex */
+	token = pg_strtok(&length); /* eat :refupperindex */
 	local_node->refupperindexpr = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :reflowerindex */
+	token = pg_strtok(&length); /* eat :reflowerindex */
 	local_node->reflowerindexpr = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :refexpr */
+	token = pg_strtok(&length); /* eat :refexpr */
 	local_node->refexpr = nodeRead(true);
 
-	token = pg_strtok(&length);		/* eat :refassgnexpr */
+	token = pg_strtok(&length); /* eat :refassgnexpr */
 	local_node->refassgnexpr = nodeRead(true);
 
 	return local_node;
@@ -965,32 +966,30 @@ _readConst(void)
 
 	local_node = makeNode(Const);
 
-	token = pg_strtok(&length);		/* get :consttype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :consttype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->consttype = atooid(token);
 
-	token = pg_strtok(&length);		/* get :constlen */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :constlen */
+	token = pg_strtok(&length); /* now read it */
 	local_node->constlen = atoi(token);
 
-	token = pg_strtok(&length);		/* get :constbyval */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :constbyval */
+	token = pg_strtok(&length); /* now read it */
 	local_node->constbyval = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :constisnull */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :constisnull */
+	token = pg_strtok(&length); /* now read it */
 	local_node->constisnull = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :constvalue */
+	token = pg_strtok(&length); /* get :constvalue */
 
 	if (local_node->constisnull)
 	{
-		token = pg_strtok(&length);	/* skip "NIL" */
+		token = pg_strtok(&length);		/* skip "NIL" */
 	}
 	else
-	{
 		local_node->constvalue = readDatum(local_node->constbyval);
-	}
 
 	return local_node;
 }
@@ -1010,12 +1009,12 @@ _readFunc(void)
 
 	local_node = makeNode(Func);
 
-	token = pg_strtok(&length);		/* get :funcid */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :funcid */
+	token = pg_strtok(&length); /* now read it */
 	local_node->funcid = atooid(token);
 
-	token = pg_strtok(&length);		/* get :functype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :functype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->functype = atooid(token);
 
 	local_node->func_fcache = NULL;
@@ -1038,16 +1037,16 @@ _readOper(void)
 
 	local_node = makeNode(Oper);
 
-	token = pg_strtok(&length);		/* get :opno */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :opno */
+	token = pg_strtok(&length); /* now read it */
 	local_node->opno = atooid(token);
 
-	token = pg_strtok(&length);		/* get :opid */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :opid */
+	token = pg_strtok(&length); /* now read it */
 	local_node->opid = atooid(token);
 
-	token = pg_strtok(&length);		/* get :opresulttype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :opresulttype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->opresulttype = atooid(token);
 
 	local_node->op_fcache = NULL;
@@ -1070,20 +1069,20 @@ _readParam(void)
 
 	local_node = makeNode(Param);
 
-	token = pg_strtok(&length);		/* get :paramkind */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :paramkind */
+	token = pg_strtok(&length); /* now read it */
 	local_node->paramkind = atoi(token);
 
-	token = pg_strtok(&length);		/* get :paramid */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :paramid */
+	token = pg_strtok(&length); /* now read it */
 	local_node->paramid = atoi(token);
 
-	token = pg_strtok(&length);		/* get :paramname */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :paramname */
+	token = pg_strtok(&length); /* now read it */
 	local_node->paramname = nullable_string(token, length);
 
-	token = pg_strtok(&length);		/* get :paramtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :paramtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->paramtype = atooid(token);
 
 	return local_node;
@@ -1104,27 +1103,27 @@ _readAggref(void)
 
 	local_node = makeNode(Aggref);
 
-	token = pg_strtok(&length);		/* eat :aggname */
-	token = pg_strtok(&length);		/* get aggname */
+	token = pg_strtok(&length); /* eat :aggname */
+	token = pg_strtok(&length); /* get aggname */
 	local_node->aggname = debackslash(token, length);
 
-	token = pg_strtok(&length);		/* eat :basetype */
-	token = pg_strtok(&length);		/* get basetype */
+	token = pg_strtok(&length); /* eat :basetype */
+	token = pg_strtok(&length); /* get basetype */
 	local_node->basetype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :aggtype */
-	token = pg_strtok(&length);		/* get aggtype */
+	token = pg_strtok(&length); /* eat :aggtype */
+	token = pg_strtok(&length); /* get aggtype */
 	local_node->aggtype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :target */
+	token = pg_strtok(&length); /* eat :target */
 	local_node->target = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :aggstar */
-	token = pg_strtok(&length);		/* get aggstar */
+	token = pg_strtok(&length); /* eat :aggstar */
+	token = pg_strtok(&length); /* get aggstar */
 	local_node->aggstar = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :aggdistinct */
-	token = pg_strtok(&length);		/* get aggdistinct */
+	token = pg_strtok(&length); /* eat :aggdistinct */
+	token = pg_strtok(&length); /* get aggdistinct */
 	local_node->aggdistinct = strtobool(token);
 
 	return local_node;
@@ -1145,21 +1144,21 @@ _readSubLink(void)
 
 	local_node = makeNode(SubLink);
 
-	token = pg_strtok(&length);		/* eat :subLinkType */
-	token = pg_strtok(&length);		/* get subLinkType */
+	token = pg_strtok(&length); /* eat :subLinkType */
+	token = pg_strtok(&length); /* get subLinkType */
 	local_node->subLinkType = atoi(token);
 
-	token = pg_strtok(&length);		/* eat :useor */
-	token = pg_strtok(&length);		/* get useor */
+	token = pg_strtok(&length); /* eat :useor */
+	token = pg_strtok(&length); /* get useor */
 	local_node->useor = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :lefthand */
+	token = pg_strtok(&length); /* eat :lefthand */
 	local_node->lefthand = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :oper */
+	token = pg_strtok(&length); /* eat :oper */
 	local_node->oper = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :subselect */
+	token = pg_strtok(&length); /* eat :subselect */
 	local_node->subselect = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -1180,19 +1179,19 @@ _readFieldSelect(void)
 
 	local_node = makeNode(FieldSelect);
 
-	token = pg_strtok(&length);		/* eat :arg */
+	token = pg_strtok(&length); /* eat :arg */
 	local_node->arg = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :fieldnum */
-	token = pg_strtok(&length);		/* get fieldnum */
+	token = pg_strtok(&length); /* eat :fieldnum */
+	token = pg_strtok(&length); /* get fieldnum */
 	local_node->fieldnum = (AttrNumber) atoi(token);
 
-	token = pg_strtok(&length);		/* eat :resulttype */
-	token = pg_strtok(&length);		/* get resulttype */
+	token = pg_strtok(&length); /* eat :resulttype */
+	token = pg_strtok(&length); /* get resulttype */
 	local_node->resulttype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :resulttypmod */
-	token = pg_strtok(&length);		/* get resulttypmod */
+	token = pg_strtok(&length); /* eat :resulttypmod */
+	token = pg_strtok(&length); /* get resulttypmod */
 	local_node->resulttypmod = atoi(token);
 
 	return local_node;
@@ -1213,15 +1212,15 @@ _readRelabelType(void)
 
 	local_node = makeNode(RelabelType);
 
-	token = pg_strtok(&length);		/* eat :arg */
+	token = pg_strtok(&length); /* eat :arg */
 	local_node->arg = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :resulttype */
-	token = pg_strtok(&length);		/* get resulttype */
+	token = pg_strtok(&length); /* eat :resulttype */
+	token = pg_strtok(&length); /* get resulttype */
 	local_node->resulttype = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :resulttypmod */
-	token = pg_strtok(&length);		/* get resulttypmod */
+	token = pg_strtok(&length); /* eat :resulttypmod */
+	token = pg_strtok(&length); /* get resulttypmod */
 	local_node->resulttypmod = atoi(token);
 
 	return local_node;
@@ -1242,7 +1241,7 @@ _readRangeTblRef(void)
 
 	local_node = makeNode(RangeTblRef);
 
-	token = pg_strtok(&length);		/* get rtindex */
+	token = pg_strtok(&length); /* get rtindex */
 	local_node->rtindex = atoi(token);
 
 	return local_node;
@@ -1263,11 +1262,11 @@ _readFromExpr(void)
 
 	local_node = makeNode(FromExpr);
 
-	token = pg_strtok(&length);		/* eat :fromlist */
-	local_node->fromlist = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :fromlist */
+	local_node->fromlist = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :quals */
-	local_node->quals = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :quals */
+	local_node->quals = nodeRead(true); /* now read it */
 
 	return local_node;
 }
@@ -1287,34 +1286,34 @@ _readJoinExpr(void)
 
 	local_node = makeNode(JoinExpr);
 
-	token = pg_strtok(&length);		/* eat :jointype */
-	token = pg_strtok(&length);		/* get jointype */
+	token = pg_strtok(&length); /* eat :jointype */
+	token = pg_strtok(&length); /* get jointype */
 	local_node->jointype = (JoinType) atoi(token);
 
-	token = pg_strtok(&length);		/* eat :isNatural */
-	token = pg_strtok(&length);		/* get :isNatural */
+	token = pg_strtok(&length); /* eat :isNatural */
+	token = pg_strtok(&length); /* get :isNatural */
 	local_node->isNatural = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :larg */
+	token = pg_strtok(&length); /* eat :larg */
 	local_node->larg = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :rarg */
+	token = pg_strtok(&length); /* eat :rarg */
 	local_node->rarg = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :using */
-	local_node->using = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :using */
+	local_node->using = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* eat :quals */
-	local_node->quals = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :quals */
+	local_node->quals = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* eat :alias */
-	local_node->alias = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :alias */
+	local_node->alias = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* eat :colnames */
-	local_node->colnames = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* eat :colnames */
+	local_node->colnames = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :colvars */
-	local_node->colvars = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* eat :colvars */
+	local_node->colvars = nodeRead(true);		/* now read it */
 
 	return local_node;
 }
@@ -1336,66 +1335,66 @@ _readRelOptInfo(void)
 
 	local_node = makeNode(RelOptInfo);
 
-	token = pg_strtok(&length);		/* get :relids */
+	token = pg_strtok(&length); /* get :relids */
 	local_node->relids = toIntList(nodeRead(true));		/* now read it */
 
-	token = pg_strtok(&length);		/* get :rows */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :rows */
+	token = pg_strtok(&length); /* now read it */
 	local_node->rows = atof(token);
 
-	token = pg_strtok(&length);		/* get :width */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :width */
+	token = pg_strtok(&length); /* now read it */
 	local_node->width = atoi(token);
 
-	token = pg_strtok(&length);		/* get :targetlist */
+	token = pg_strtok(&length); /* get :targetlist */
 	local_node->targetlist = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :pathlist */
+	token = pg_strtok(&length); /* get :pathlist */
 	local_node->pathlist = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :cheapest_startup_path */
+	token = pg_strtok(&length); /* get :cheapest_startup_path */
 	local_node->cheapest_startup_path = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :cheapest_total_path */
+	token = pg_strtok(&length); /* get :cheapest_total_path */
 	local_node->cheapest_total_path = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :pruneable */
-	token = pg_strtok(&length);		/* get :pruneable */
+	token = pg_strtok(&length); /* eat :pruneable */
+	token = pg_strtok(&length); /* get :pruneable */
 	local_node->pruneable = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :issubquery */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :issubquery */
+	token = pg_strtok(&length); /* now read it */
 	local_node->issubquery = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :indexed */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :indexed */
+	token = pg_strtok(&length); /* now read it */
 	local_node->indexed = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :pages */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pages */
+	token = pg_strtok(&length); /* now read it */
 	local_node->pages = atol(token);
 
-	token = pg_strtok(&length);		/* get :tuples */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :tuples */
+	token = pg_strtok(&length); /* now read it */
 	local_node->tuples = atof(token);
 
-	token = pg_strtok(&length);		/* get :subplan */
-	local_node->subplan = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* get :subplan */
+	local_node->subplan = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :baserestrictinfo */
-	local_node->baserestrictinfo = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* get :baserestrictinfo */
+	local_node->baserestrictinfo = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :baserestrictcost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :baserestrictcost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->baserestrictcost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :outerjoinset */
-	local_node->outerjoinset = toIntList(nodeRead(true)); /* now read it */
+	token = pg_strtok(&length); /* get :outerjoinset */
+	local_node->outerjoinset = toIntList(nodeRead(true));		/* now read it */
 
-	token = pg_strtok(&length);		/* get :joininfo */
+	token = pg_strtok(&length); /* get :joininfo */
 	local_node->joininfo = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :innerjoin */
+	token = pg_strtok(&length); /* get :innerjoin */
 	local_node->innerjoin = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -1414,10 +1413,10 @@ _readTargetEntry(void)
 
 	local_node = makeNode(TargetEntry);
 
-	token = pg_strtok(&length);		/* get :resdom */
+	token = pg_strtok(&length); /* get :resdom */
 	local_node->resdom = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :expr */
+	token = pg_strtok(&length); /* get :expr */
 	local_node->expr = nodeRead(true);	/* now read it */
 
 	return local_node;
@@ -1432,11 +1431,11 @@ _readAttr(void)
 
 	local_node = makeNode(Attr);
 
-	token = pg_strtok(&length);		/* eat :relname */
-	token = pg_strtok(&length);		/* get relname */
+	token = pg_strtok(&length); /* eat :relname */
+	token = pg_strtok(&length); /* get relname */
 	local_node->relname = debackslash(token, length);
 
-	token = pg_strtok(&length);		/* eat :attrs */
+	token = pg_strtok(&length); /* eat :attrs */
 	local_node->attrs = nodeRead(true); /* now read it */
 
 	return local_node;
@@ -1455,41 +1454,41 @@ _readRangeTblEntry(void)
 
 	local_node = makeNode(RangeTblEntry);
 
-	token = pg_strtok(&length);		/* eat :relname */
-	token = pg_strtok(&length);		/* get :relname */
+	token = pg_strtok(&length); /* eat :relname */
+	token = pg_strtok(&length); /* get :relname */
 	local_node->relname = nullable_string(token, length);
 
-	token = pg_strtok(&length);		/* eat :relid */
-	token = pg_strtok(&length);		/* get :relid */
+	token = pg_strtok(&length); /* eat :relid */
+	token = pg_strtok(&length); /* get :relid */
 	local_node->relid = atooid(token);
 
-	token = pg_strtok(&length);		/* eat :subquery */
-	local_node->subquery = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :subquery */
+	local_node->subquery = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* eat :alias */
-	local_node->alias = nodeRead(true);	/* now read it */
+	token = pg_strtok(&length); /* eat :alias */
+	local_node->alias = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* eat :eref */
+	token = pg_strtok(&length); /* eat :eref */
 	local_node->eref = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* eat :inh */
-	token = pg_strtok(&length);		/* get :inh */
+	token = pg_strtok(&length); /* eat :inh */
+	token = pg_strtok(&length); /* get :inh */
 	local_node->inh = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :inFromCl */
-	token = pg_strtok(&length);		/* get :inFromCl */
+	token = pg_strtok(&length); /* eat :inFromCl */
+	token = pg_strtok(&length); /* get :inFromCl */
 	local_node->inFromCl = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :checkForRead */
-	token = pg_strtok(&length);		/* get :checkForRead */
+	token = pg_strtok(&length); /* eat :checkForRead */
+	token = pg_strtok(&length); /* get :checkForRead */
 	local_node->checkForRead = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :checkForWrite */
-	token = pg_strtok(&length);		/* get :checkForWrite */
+	token = pg_strtok(&length); /* eat :checkForWrite */
+	token = pg_strtok(&length); /* get :checkForWrite */
 	local_node->checkForWrite = strtobool(token);
 
-	token = pg_strtok(&length);		/* eat :checkAsUser */
-	token = pg_strtok(&length);		/* get :checkAsUser */
+	token = pg_strtok(&length); /* eat :checkAsUser */
+	token = pg_strtok(&length); /* get :checkAsUser */
 	local_node->checkAsUser = atooid(token);
 
 	return local_node;
@@ -1510,19 +1509,19 @@ _readPath(void)
 
 	local_node = makeNode(Path);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->pathkeys = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -1543,40 +1542,40 @@ _readIndexPath(void)
 
 	local_node = makeNode(IndexPath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->path.pathkeys = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :indexid */
+	token = pg_strtok(&length); /* get :indexid */
 	local_node->indexid = toOidList(nodeRead(true));
 
-	token = pg_strtok(&length);		/* get :indexqual */
+	token = pg_strtok(&length); /* get :indexqual */
 	local_node->indexqual = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :indexscandir */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :indexscandir */
+	token = pg_strtok(&length); /* now read it */
 	local_node->indexscandir = (ScanDirection) atoi(token);
 
-	token = pg_strtok(&length);		/* get :joinrelids */
+	token = pg_strtok(&length); /* get :joinrelids */
 	local_node->joinrelids = toIntList(nodeRead(true));
 
-	token = pg_strtok(&length);		/* get :alljoinquals */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :alljoinquals */
+	token = pg_strtok(&length); /* now read it */
 	local_node->alljoinquals = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :rows */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :rows */
+	token = pg_strtok(&length); /* now read it */
 	local_node->rows = atof(token);
 
 	return local_node;
@@ -1597,25 +1596,25 @@ _readTidPath(void)
 
 	local_node = makeNode(TidPath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->path.pathkeys = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :tideval */
+	token = pg_strtok(&length); /* get :tideval */
 	local_node->tideval = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :unjoined_relids */
+	token = pg_strtok(&length); /* get :unjoined_relids */
 	local_node->unjoined_relids = toIntList(nodeRead(true));
 
 	return local_node;
@@ -1636,22 +1635,22 @@ _readAppendPath(void)
 
 	local_node = makeNode(AppendPath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->path.pathkeys = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :subpaths */
+	token = pg_strtok(&length); /* get :subpaths */
 	local_node->subpaths = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -1672,33 +1671,33 @@ _readNestPath(void)
 
 	local_node = makeNode(NestPath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->path.pathkeys = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :jointype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :jointype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jointype = (JoinType) atoi(token);
 
-	token = pg_strtok(&length);		/* get :outerjoinpath */
+	token = pg_strtok(&length); /* get :outerjoinpath */
 	local_node->outerjoinpath = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :innerjoinpath */
+	token = pg_strtok(&length); /* get :innerjoinpath */
 	local_node->innerjoinpath = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :joinrestrictinfo */
-	local_node->joinrestrictinfo = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* get :joinrestrictinfo */
+	local_node->joinrestrictinfo = nodeRead(true);		/* now read it */
 
 	return local_node;
 }
@@ -1718,41 +1717,41 @@ _readMergePath(void)
 
 	local_node = makeNode(MergePath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->jpath.path.pathkeys = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :jointype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :jointype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.jointype = (JoinType) atoi(token);
 
-	token = pg_strtok(&length);		/* get :outerjoinpath */
+	token = pg_strtok(&length); /* get :outerjoinpath */
 	local_node->jpath.outerjoinpath = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :innerjoinpath */
+	token = pg_strtok(&length); /* get :innerjoinpath */
 	local_node->jpath.innerjoinpath = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :joinrestrictinfo */
-	local_node->jpath.joinrestrictinfo = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* get :joinrestrictinfo */
+	local_node->jpath.joinrestrictinfo = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :path_mergeclauses */
+	token = pg_strtok(&length); /* get :path_mergeclauses */
 	local_node->path_mergeclauses = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :outersortkeys */
+	token = pg_strtok(&length); /* get :outersortkeys */
 	local_node->outersortkeys = nodeRead(true); /* now read it */
 
-	token = pg_strtok(&length);		/* get :innersortkeys */
+	token = pg_strtok(&length); /* get :innersortkeys */
 	local_node->innersortkeys = nodeRead(true); /* now read it */
 
 	return local_node;
@@ -1773,35 +1772,35 @@ _readHashPath(void)
 
 	local_node = makeNode(HashPath);
 
-	token = pg_strtok(&length);		/* get :pathtype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :pathtype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.pathtype = atoi(token);
 
-	token = pg_strtok(&length);		/* get :startup_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :startup_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.startup_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :total_cost */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :total_cost */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.path.total_cost = (Cost) atof(token);
 
-	token = pg_strtok(&length);		/* get :pathkeys */
+	token = pg_strtok(&length); /* get :pathkeys */
 	local_node->jpath.path.pathkeys = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :jointype */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :jointype */
+	token = pg_strtok(&length); /* now read it */
 	local_node->jpath.jointype = (JoinType) atoi(token);
 
-	token = pg_strtok(&length);		/* get :outerjoinpath */
+	token = pg_strtok(&length); /* get :outerjoinpath */
 	local_node->jpath.outerjoinpath = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :innerjoinpath */
+	token = pg_strtok(&length); /* get :innerjoinpath */
 	local_node->jpath.innerjoinpath = nodeRead(true);	/* now read it */
 
-	token = pg_strtok(&length);		/* get :joinrestrictinfo */
-	local_node->jpath.joinrestrictinfo = nodeRead(true); /* now read it */
+	token = pg_strtok(&length); /* get :joinrestrictinfo */
+	local_node->jpath.joinrestrictinfo = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :path_hashclauses */
+	token = pg_strtok(&length); /* get :path_hashclauses */
 	local_node->path_hashclauses = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -1822,11 +1821,11 @@ _readPathKeyItem(void)
 
 	local_node = makeNode(PathKeyItem);
 
-	token = pg_strtok(&length);		/* get :sortop */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :sortop */
+	token = pg_strtok(&length); /* now read it */
 	local_node->sortop = atooid(token);
 
-	token = pg_strtok(&length);		/* get :key */
+	token = pg_strtok(&length); /* get :key */
 	local_node->key = nodeRead(true);	/* now read it */
 
 	return local_node;
@@ -1847,30 +1846,30 @@ _readRestrictInfo(void)
 
 	local_node = makeNode(RestrictInfo);
 
-	token = pg_strtok(&length);		/* get :clause */
+	token = pg_strtok(&length); /* get :clause */
 	local_node->clause = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :ispusheddown */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :ispusheddown */
+	token = pg_strtok(&length); /* now read it */
 	local_node->ispusheddown = strtobool(token);
 
-	token = pg_strtok(&length);		/* get :subclauseindices */
+	token = pg_strtok(&length); /* get :subclauseindices */
 	local_node->subclauseindices = nodeRead(true);		/* now read it */
 
-	token = pg_strtok(&length);		/* get :mergejoinoperator */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :mergejoinoperator */
+	token = pg_strtok(&length); /* now read it */
 	local_node->mergejoinoperator = atooid(token);
 
-	token = pg_strtok(&length);		/* get :left_sortop */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :left_sortop */
+	token = pg_strtok(&length); /* now read it */
 	local_node->left_sortop = atooid(token);
 
-	token = pg_strtok(&length);		/* get :right_sortop */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :right_sortop */
+	token = pg_strtok(&length); /* now read it */
 	local_node->right_sortop = atooid(token);
 
-	token = pg_strtok(&length);		/* get :hashjoinoperator */
-	token = pg_strtok(&length);		/* now read it */
+	token = pg_strtok(&length); /* get :hashjoinoperator */
+	token = pg_strtok(&length); /* now read it */
 	local_node->hashjoinoperator = atooid(token);
 
 	/* eval_cost is not part of saved representation; compute on first use */
@@ -1899,10 +1898,10 @@ _readJoinInfo(void)
 
 	local_node = makeNode(JoinInfo);
 
-	token = pg_strtok(&length);		/* get :unjoined_relids */
+	token = pg_strtok(&length); /* get :unjoined_relids */
 	local_node->unjoined_relids = toIntList(nodeRead(true));	/* now read it */
 
-	token = pg_strtok(&length);		/* get :jinfo_restrictinfo */
+	token = pg_strtok(&length); /* get :jinfo_restrictinfo */
 	local_node->jinfo_restrictinfo = nodeRead(true);	/* now read it */
 
 	return local_node;
@@ -1922,7 +1921,7 @@ _readIter(void)
 
 	local_node = makeNode(Iter);
 
-	token = pg_strtok(&length);		/* eat :iterexpr */
+	token = pg_strtok(&length); /* eat :iterexpr */
 	local_node->iterexpr = nodeRead(true);		/* now read it */
 
 	return local_node;
@@ -2081,7 +2080,7 @@ readDatum(bool typbyval)
 	token = pg_strtok(&tokenLength);
 	length = atoui(token);
 
-	token = pg_strtok(&tokenLength); /* skip the '[' */
+	token = pg_strtok(&tokenLength);	/* skip the '[' */
 
 	if (typbyval)
 	{
@@ -2109,7 +2108,7 @@ readDatum(bool typbyval)
 		res = PointerGetDatum(s);
 	}
 
-	token = pg_strtok(&tokenLength); /* skip the ']' */
+	token = pg_strtok(&tokenLength);	/* skip the ']' */
 	if (token == NULL || token[0] != ']')
 		elog(ERROR, "readDatum: ']' expected, length = %lu",
 			 (unsigned long) length);
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index 4422e03cb401e3ff6c82e8a0f0d8e67c9923f047..dd3d6bd5372a11ef5c9f16707da1ed3ab35cb718 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_eval.c,v 1.57 2001/01/24 19:42:57 momjian Exp $
+ * $Id: geqo_eval.c,v 1.58 2001/03/22 03:59:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,8 +49,8 @@ geqo_eval(Query *root, List *initial_rels, Gene *tour, int num_gene)
 	 * allocated inside gimme_tree().
 	 *
 	 * Since geqo_eval() will be called many times, we can't afford to let
-	 * all that memory go unreclaimed until end of statement.  Note we make
-	 * the temp context a child of TransactionCommandContext, so that
+	 * all that memory go unreclaimed until end of statement.  Note we
+	 * make the temp context a child of TransactionCommandContext, so that
 	 * it will be freed even if we abort via elog(ERROR).
 	 */
 	mycontext = AllocSetContextCreate(TransactionCommandContext,
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c
index 2300f8677c1d3603ce2567fb813f62c4318029ba..86b5b334097bfcc8e67f000260c3097a62801b58 100644
--- a/src/backend/optimizer/geqo/geqo_main.c
+++ b/src/backend/optimizer/geqo/geqo_main.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_main.c,v 1.26 2001/01/24 19:42:57 momjian Exp $
+ * $Id: geqo_main.c,v 1.27 2001/03/22 03:59:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,11 +36,11 @@
 /*
  * Configuration options
  */
-int 	    Geqo_pool_size;
-int         Geqo_effort;
-int 		Geqo_generations;
+int			Geqo_pool_size;
+int			Geqo_effort;
+int			Geqo_generations;
 double		Geqo_selection_bias;
-int         Geqo_random_seed;
+int			Geqo_random_seed;
 
 
 static int	gimme_pool_size(int nr_rel);
@@ -101,10 +101,10 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
 
 /* seed random number generator */
 /* XXX why is this done every time around? */
-    if (Geqo_random_seed >= 0)
-        srandom((unsigned int) Geqo_random_seed);
-    else
-        srandom((unsigned int) time(NULL));
+	if (Geqo_random_seed >= 0)
+		srandom((unsigned int) Geqo_random_seed);
+	else
+		srandom((unsigned int) time(NULL));
 
 /* allocate genetic pool memory */
 	pool = alloc_pool(pool_size, number_of_rels);
@@ -160,8 +160,8 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
 	{
 
 		/* SELECTION */
-		geqo_selection(momma, daddy, pool, Geqo_selection_bias);/* using linear bias
-																 * function */
+		geqo_selection(momma, daddy, pool, Geqo_selection_bias);		/* using linear bias
+																		 * function */
 
 
 
@@ -293,15 +293,15 @@ gimme_pool_size(int nr_rel)
 {
 	double		size;
 
-    if (Geqo_pool_size != 0)
-    {
-        if (Geqo_pool_size < MIN_GEQO_POOL_SIZE)
-            return MIN_GEQO_POOL_SIZE;
-        else if (Geqo_pool_size > MAX_GEQO_POOL_SIZE)
-            return MAX_GEQO_POOL_SIZE;
-        else
-            return Geqo_pool_size;
-    }
+	if (Geqo_pool_size != 0)
+	{
+		if (Geqo_pool_size < MIN_GEQO_POOL_SIZE)
+			return MIN_GEQO_POOL_SIZE;
+		else if (Geqo_pool_size > MAX_GEQO_POOL_SIZE)
+			return MAX_GEQO_POOL_SIZE;
+		else
+			return Geqo_pool_size;
+	}
 
 	size = pow(2.0, nr_rel + 1.0);
 
@@ -323,8 +323,8 @@ gimme_pool_size(int nr_rel)
 static int
 gimme_number_generations(int pool_size, int effort)
 {
-    if (Geqo_generations <= 0)
-        return effort * (int) ceil(log((double) pool_size) / log(2.0));
-    else
-        return Geqo_generations;
+	if (Geqo_generations <= 0)
+		return effort * (int) ceil(log((double) pool_size) / log(2.0));
+	else
+		return Geqo_generations;
 }
diff --git a/src/backend/optimizer/path/_deadcode/predmig.c b/src/backend/optimizer/path/_deadcode/predmig.c
index bb73132240a08bf2babc622710ff3af16fb3c4de..1781f43db1d470367fec015834e91fba965be8f8 100644
--- a/src/backend/optimizer/path/_deadcode/predmig.c
+++ b/src/backend/optimizer/path/_deadcode/predmig.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.8 2001/01/24 19:42:58 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.9 2001/03/22 03:59:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -485,7 +485,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
 }
 
 
-/* -------------------						 UTILITY FUNCTIONS	   ------------------------- */
+/* -------------------						   UTILITY FUNCTIONS	 ------------------------- */
 
 /*
  ** xfunc_free_stream
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 7d44c4dcfa070b5dbf48d39ae48f313062e2986d..1cf73dffff769ed7bda494674909cd76726f82d4 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.71 2001/02/03 21:17:52 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.72 2001/03/22 03:59:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,12 +33,12 @@ int			geqo_rels = DEFAULT_GEQO_RELS;
 
 static void set_base_rel_pathlists(Query *root);
 static void set_plain_rel_pathlist(Query *root, RelOptInfo *rel,
-								   RangeTblEntry *rte);
+					   RangeTblEntry *rte);
 static void set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
-									   RangeTblEntry *rte,
-									   List *inheritlist);
+						   RangeTblEntry *rte,
+						   List *inheritlist);
 static RelOptInfo *make_one_rel_by_joins(Query *root, int levels_needed,
-										 List *initial_rels);
+					  List *initial_rels);
 
 #ifdef OPTIMIZER_DEBUG
 static void debug_print_rel(Query *root, RelOptInfo *rel);
@@ -94,7 +94,7 @@ set_base_rel_pathlists(Query *root)
 		RangeTblEntry *rte;
 		List	   *inheritlist;
 
-		Assert(length(rel->relids) == 1); /* better be base rel */
+		Assert(length(rel->relids) == 1);		/* better be base rel */
 		rti = lfirsti(rel->relids);
 		rte = rt_fetch(rti, root->rtable);
 
@@ -103,24 +103,25 @@ set_base_rel_pathlists(Query *root)
 			/* Subquery --- generate a separate plan for it */
 
 			/*
-			 * If there are any restriction clauses that have been attached
-			 * to the subquery relation, consider pushing them down to become
-			 * HAVING quals of the subquery itself.  (Not WHERE clauses, since
-			 * they may refer to subquery outputs that are aggregate results.
-			 * But planner.c will transfer them into the subquery's WHERE if
-			 * they do not.)  This transformation is useful because it may
-			 * allow us to generate a better plan for the subquery than
-			 * evaluating all the subquery output rows and then filtering
-			 * them.
+			 * If there are any restriction clauses that have been
+			 * attached to the subquery relation, consider pushing them
+			 * down to become HAVING quals of the subquery itself.	(Not
+			 * WHERE clauses, since they may refer to subquery outputs
+			 * that are aggregate results. But planner.c will transfer
+			 * them into the subquery's WHERE if they do not.)  This
+			 * transformation is useful because it may allow us to
+			 * generate a better plan for the subquery than evaluating all
+			 * the subquery output rows and then filtering them.
 			 *
-			 * Currently, we do not push down clauses that contain subselects,
-			 * mainly because I'm not sure it will work correctly (the
-			 * subplan hasn't yet transformed sublinks to subselects).
-			 * Also, if the subquery contains set ops (UNION/INTERSECT/EXCEPT)
-			 * we do not push down any qual clauses, since the planner doesn't
-			 * support quals at the top level of a setop.  (With suitable
-			 * analysis we could try to push the quals down into the component
-			 * queries of the setop, but getting it right is not trivial.)
+			 * Currently, we do not push down clauses that contain
+			 * subselects, mainly because I'm not sure it will work
+			 * correctly (the subplan hasn't yet transformed sublinks to
+			 * subselects). Also, if the subquery contains set ops
+			 * (UNION/INTERSECT/EXCEPT) we do not push down any qual
+			 * clauses, since the planner doesn't support quals at the top
+			 * level of a setop.  (With suitable analysis we could try to
+			 * push the quals down into the component queries of the
+			 * setop, but getting it right is not trivial.)
 			 * Non-pushed-down clauses will get evaluated as qpquals of
 			 * the SubqueryScan node.
 			 *
@@ -136,8 +137,8 @@ set_base_rel_pathlists(Query *root)
 
 				foreach(lst, rel->baserestrictinfo)
 				{
-					RestrictInfo   *rinfo = (RestrictInfo *) lfirst(lst);
-					Node		   *clause = (Node *) rinfo->clause;
+					RestrictInfo *rinfo = (RestrictInfo *) lfirst(lst);
+					Node	   *clause = (Node *) rinfo->clause;
 
 					if (contain_subplans(clause))
 					{
@@ -146,13 +147,14 @@ set_base_rel_pathlists(Query *root)
 					}
 					else
 					{
+
 						/*
-						 * We need to replace Vars in the clause (which must
-						 * refer to outputs of the subquery) with copies of
-						 * the subquery's targetlist expressions.  Note that
-						 * at this point, any uplevel Vars in the clause
-						 * should have been replaced with Params, so they
-						 * need no work.
+						 * We need to replace Vars in the clause (which
+						 * must refer to outputs of the subquery) with
+						 * copies of the subquery's targetlist
+						 * expressions.  Note that at this point, any
+						 * uplevel Vars in the clause should have been
+						 * replaced with Params, so they need no work.
 						 */
 						clause = ResolveNew(clause, rti, 0,
 											rte->subquery->targetList,
@@ -160,11 +162,12 @@ set_base_rel_pathlists(Query *root)
 						rte->subquery->havingQual =
 							make_and_qual(rte->subquery->havingQual,
 										  clause);
+
 						/*
 						 * We need not change the subquery's hasAggs or
-						 * hasSublinks flags, since we can't be pushing down
-						 * any aggregates that weren't there before, and we
-						 * don't push down subselects at all.
+						 * hasSublinks flags, since we can't be pushing
+						 * down any aggregates that weren't there before,
+						 * and we don't push down subselects at all.
 						 */
 					}
 				}
@@ -215,9 +218,9 @@ set_plain_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte)
 	/*
 	 * Generate paths and add them to the rel's pathlist.
 	 *
-	 * Note: add_path() will discard any paths that are dominated by
-	 * another available path, keeping only those paths that are
-	 * superior along at least one dimension of cost or sortedness.
+	 * Note: add_path() will discard any paths that are dominated by another
+	 * available path, keeping only those paths that are superior along at
+	 * least one dimension of cost or sortedness.
 	 */
 
 	/* Consider sequential scan */
@@ -230,9 +233,9 @@ set_plain_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte)
 	create_index_paths(root, rel, indices);
 
 	/*
-	 * Note: create_or_index_paths depends on create_index_paths to
-	 * have marked OR restriction clauses with relevant indices; this
-	 * is why it doesn't need to be given the list of indices.
+	 * Note: create_or_index_paths depends on create_index_paths to have
+	 * marked OR restriction clauses with relevant indices; this is why it
+	 * doesn't need to be given the list of indices.
 	 */
 	create_or_index_paths(root, rel, rel->baserestrictinfo);
 
@@ -258,8 +261,8 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte,
 	List	   *il;
 
 	/*
-	 * XXX for now, can't handle inherited expansion of FOR UPDATE;
-	 * can we do better?
+	 * XXX for now, can't handle inherited expansion of FOR UPDATE; can we
+	 * do better?
 	 */
 	if (intMember(parentRTindex, root->rowMarks))
 		elog(ERROR, "SELECT FOR UPDATE is not supported for inherit queries");
@@ -271,14 +274,14 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte,
 	rel->width = 0;
 
 	/*
-	 * Generate access paths for each table in the tree (parent AND children),
-	 * and pick the cheapest path for each table.
+	 * Generate access paths for each table in the tree (parent AND
+	 * children), and pick the cheapest path for each table.
 	 */
 	foreach(il, inheritlist)
 	{
-		int		childRTindex = lfirsti(il);
+		int			childRTindex = lfirsti(il);
 		RangeTblEntry *childrte;
-		Oid		childOID;
+		Oid			childOID;
 		RelOptInfo *childrel;
 
 		childrte = rt_fetch(childRTindex, root->rtable);
@@ -289,16 +292,18 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte,
 		 * attach the RelOptInfo to the query's base_rel_list, however.
 		 *
 		 * NOTE: when childRTindex == parentRTindex, we create a second
-		 * RelOptInfo for the same relation.  This RelOptInfo will represent
-		 * the parent table alone, whereas the original RelOptInfo represents
-		 * the union of the inheritance tree members.
+		 * RelOptInfo for the same relation.  This RelOptInfo will
+		 * represent the parent table alone, whereas the original
+		 * RelOptInfo represents the union of the inheritance tree
+		 * members.
 		 */
 		childrel = make_base_rel(root, childRTindex);
 
 		/*
-		 * Copy the parent's targetlist and restriction quals to the child,
-		 * with attribute-number adjustment if needed.  We don't bother
-		 * to copy the join quals, since we can't do any joining here.
+		 * Copy the parent's targetlist and restriction quals to the
+		 * child, with attribute-number adjustment if needed.  We don't
+		 * bother to copy the join quals, since we can't do any joining
+		 * here.
 		 */
 		childrel->targetlist = (List *)
 			adjust_inherited_attrs((Node *) rel->targetlist,
@@ -328,8 +333,8 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte,
 	}
 
 	/*
-	 * Finally, build Append path and install it as the only access
-	 * path for the parent rel.
+	 * Finally, build Append path and install it as the only access path
+	 * for the parent rel.
 	 */
 	add_path(rel, (Path *) create_append_path(rel, subpaths));
 
@@ -350,9 +355,9 @@ make_fromexpr_rel(Query *root, FromExpr *from)
 	List	   *jt;
 
 	/*
-	 * Count the number of child jointree nodes.  This is the depth
-	 * of the dynamic-programming algorithm we must employ to consider
-	 * all ways of joining the child nodes.
+	 * Count the number of child jointree nodes.  This is the depth of the
+	 * dynamic-programming algorithm we must employ to consider all ways
+	 * of joining the child nodes.
 	 */
 	levels_needed = length(from->fromlist);
 
@@ -374,6 +379,7 @@ make_fromexpr_rel(Query *root, FromExpr *from)
 
 	if (levels_needed == 1)
 	{
+
 		/*
 		 * Single jointree node, so we're done.
 		 */
@@ -381,6 +387,7 @@ make_fromexpr_rel(Query *root, FromExpr *from)
 	}
 	else
 	{
+
 		/*
 		 * Consider the different orders in which we could join the rels,
 		 * using either GEQO or regular optimizer.
@@ -401,7 +408,7 @@ make_fromexpr_rel(Query *root, FromExpr *from)
  *		independent jointree items in the query.  This is > 1.
  *
  * 'initial_rels' is a list of RelOptInfo nodes for each independent
- *		jointree item.  These are the components to be joined together.
+ *		jointree item.	These are the components to be joined together.
  *
  * Returns the final level of join relations, i.e., the relation that is
  * the result of joining all the original relations together.
@@ -423,8 +430,8 @@ make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels)
 	 * joinitems[j] is a list of all the j-item rels.  Initially we set
 	 * joinitems[1] to represent all the single-jointree-item relations.
 	 */
-	joinitems = (List **) palloc((levels_needed+1) * sizeof(List *));
-	MemSet(joinitems, 0, (levels_needed+1) * sizeof(List *));
+	joinitems = (List **) palloc((levels_needed + 1) * sizeof(List *));
+	MemSet(joinitems, 0, (levels_needed + 1) * sizeof(List *));
 
 	joinitems[1] = initial_rels;
 
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index b404eabccdb578ccb430a86d48a82690029c06a6..8493067f9a2cd4c3172a54a10240122f71d011ce 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.41 2001/01/24 19:42:57 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.42 2001/03/22 03:59:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -128,7 +128,8 @@ clauselist_selectivity(Query *root,
 		 * behave in the simple way we are expecting.)
 		 *
 		 * NB: for consistency of results, this fragment of code had better
-		 * match what clause_selectivity() would do in the cases it handles.
+		 * match what clause_selectivity() would do in the cases it
+		 * handles.
 		 */
 		if (varRelid != 0 || NumRelids(clause) == 1)
 		{
@@ -148,7 +149,7 @@ clauselist_selectivity(Query *root,
 					get_leftop((Expr *) clause);
 				if (is_pseudo_constant_clause((Node *) other))
 				{
-					Oid		opno = ((Oper *) ((Expr *) clause)->oper)->opno;
+					Oid			opno = ((Oper *) ((Expr *) clause)->oper)->opno;
 					RegProcedure oprrest = get_oprrest(opno);
 
 					if (!oprrest)
@@ -156,15 +157,16 @@ clauselist_selectivity(Query *root,
 					else
 						s2 = restriction_selectivity(oprrest, opno,
 													 getrelid(relidx,
-															  root->rtable),
+														   root->rtable),
 													 attno,
 													 constval, flag);
 
 					/*
-					 * If we reach here, we have computed the same result that
-					 * clause_selectivity would, so we can just use s2 if it's
-					 * the wrong oprrest.  But if it's the right oprrest, add
-					 * the clause to rqlist for later processing.
+					 * If we reach here, we have computed the same result
+					 * that clause_selectivity would, so we can just use
+					 * s2 if it's the wrong oprrest.  But if it's the
+					 * right oprrest, add the clause to rqlist for later
+					 * processing.
 					 */
 					switch (oprrest)
 					{
@@ -384,18 +386,20 @@ clause_selectivity(Query *root,
 
 			if (rte->subquery)
 			{
+
 				/*
-				 * XXX not smart about subquery references...
-				 * any way to do better?
+				 * XXX not smart about subquery references... any way to
+				 * do better?
 				 */
 				s1 = 0.5;
 			}
 			else
 			{
+
 				/*
-				 * A Var at the top of a clause must be a bool Var.
-				 * This is equivalent to the clause reln.attribute = 't',
-				 * so we compute the selectivity as if that is what we have.
+				 * A Var at the top of a clause must be a bool Var. This
+				 * is equivalent to the clause reln.attribute = 't', so we
+				 * compute the selectivity as if that is what we have.
 				 */
 				s1 = restriction_selectivity(F_EQSEL,
 											 BooleanEqualOperator,
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 8e88e46d571068c5f6318d7a1a8e349224701145..d5b343a90cf8f1938315bcaea19390a789db5c14 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -41,7 +41,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.68 2001/02/16 00:03:07 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.69 2001/03/22 03:59:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -67,11 +67,11 @@
 #define LOG6(x)  (log(x) / 1.79175946922805)
 
 
-double      effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
-double      random_page_cost = DEFAULT_RANDOM_PAGE_COST;
-double      cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST;
-double      cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST;
-double      cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST;
+double		effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
+double		random_page_cost = DEFAULT_RANDOM_PAGE_COST;
+double		cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST;
+double		cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST;
+double		cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST;
 
 Cost		disable_cost = 100000000.0;
 
@@ -117,14 +117,14 @@ cost_seqscan(Path *path, RelOptInfo *baserel)
 	/*
 	 * disk costs
 	 *
-	 * The cost of reading a page sequentially is 1.0, by definition.
-	 * Note that the Unix kernel will typically do some amount of
-	 * read-ahead optimization, so that this cost is less than the
-	 * true cost of reading a page from disk.  We ignore that issue
-	 * here, but must take it into account when estimating the cost of
-	 * non-sequential accesses!
+	 * The cost of reading a page sequentially is 1.0, by definition. Note
+	 * that the Unix kernel will typically do some amount of read-ahead
+	 * optimization, so that this cost is less than the true cost of
+	 * reading a page from disk.  We ignore that issue here, but must take
+	 * it into account when estimating the cost of non-sequential
+	 * accesses!
 	 */
-	run_cost += baserel->pages;	/* sequential fetches with cost 1.0 */
+	run_cost += baserel->pages; /* sequential fetches with cost 1.0 */
 
 	/* CPU costs */
 	cpu_per_tuple = cpu_tuple_cost + baserel->baserestrictcost;
@@ -600,12 +600,12 @@ cost_hashjoin(Path *path,
 	/*
 	 * The number of tuple comparisons needed is the number of outer
 	 * tuples times the typical hash bucket size.  nodeHash.c tries for
-	 * average bucket loading of NTUP_PER_BUCKET, but that goal will
-	 * be reached only if data values are uniformly distributed among
-	 * the buckets.  To be conservative, we scale up the target bucket
-	 * size by the number of inner rows times inner dispersion, giving
-	 * an estimate of the typical number of duplicates of each value.
-	 * We then charge one cpu_operator_cost per tuple comparison.
+	 * average bucket loading of NTUP_PER_BUCKET, but that goal will be
+	 * reached only if data values are uniformly distributed among the
+	 * buckets.  To be conservative, we scale up the target bucket size by
+	 * the number of inner rows times inner dispersion, giving an estimate
+	 * of the typical number of duplicates of each value. We then charge
+	 * one cpu_operator_cost per tuple comparison.
 	 */
 	run_cost += cpu_operator_cost * outer_path->parent->rows *
 		NTUP_PER_BUCKET * ceil(inner_path->parent->rows * innerdispersion);
@@ -672,7 +672,7 @@ cost_qual_eval(List *quals)
 
 	foreach(l, quals)
 	{
-		Node   *qual = (Node *) lfirst(l);
+		Node	   *qual = (Node *) lfirst(l);
 
 		/*
 		 * RestrictInfo nodes contain an eval_cost field reserved for this
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index ed5a53db0b9cbc4e04411b803493c31a7264fdcb..064a2fafa50f507f2c17969a7d705a192e8236a0 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.102 2001/02/16 03:16:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.103 2001/03/22 03:59:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -183,8 +183,8 @@ create_index_paths(Query *root,
 													restrictinfo_list);
 
 		/*
-		 * 3. Compute pathkeys describing index's ordering, if any,
-		 * then see how many of them are actually useful for this query.
+		 * 3. Compute pathkeys describing index's ordering, if any, then
+		 * see how many of them are actually useful for this query.
 		 */
 		index_pathkeys = build_index_pathkeys(root, rel, index,
 											  ForwardScanDirection);
@@ -207,8 +207,9 @@ create_index_paths(Query *root,
 									   NoMovementScanDirection));
 
 		/*
-		 * 5. If the index is ordered, a backwards scan might be interesting.
-		 * Currently this is only possible for a DESC query result ordering.
+		 * 5. If the index is ordered, a backwards scan might be
+		 * interesting. Currently this is only possible for a DESC query
+		 * result ordering.
 		 */
 		if (index_is_ordered)
 		{
@@ -422,10 +423,11 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
 
 	if (and_clause((Node *) orsubclause))
 	{
+
 		/*
-		 * Extract relevant sub-subclauses in indexkey order.  This is just
-		 * like group_clauses_by_indexkey() except that the input and output
-		 * are lists of bare clauses, not of RestrictInfo nodes.
+		 * Extract relevant sub-subclauses in indexkey order.  This is
+		 * just like group_clauses_by_indexkey() except that the input and
+		 * output are lists of bare clauses, not of RestrictInfo nodes.
 		 */
 		int		   *indexkeys = index->indexkeys;
 		Oid		   *classes = index->classlist;
@@ -446,8 +448,8 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
 			}
 
 			/*
-			 * If no clauses match this key, we're done; we don't want to look
-			 * at keys to its right.
+			 * If no clauses match this key, we're done; we don't want to
+			 * look at keys to its right.
 			 */
 			if (clausegroup == NIL)
 				break;
@@ -748,8 +750,8 @@ match_clause_to_indexkey(RelOptInfo *rel,
 		/*
 		 * Check for an indexqual that could be handled by a nestloop
 		 * join. We need the index key to be compared against an
-		 * expression that uses none of the indexed relation's vars
-		 * and contains no non-cachable functions.
+		 * expression that uses none of the indexed relation's vars and
+		 * contains no non-cachable functions.
 		 */
 		if (match_index_to_operand(indexkey, leftop, rel, index))
 		{
@@ -793,7 +795,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
  * recognizing binary-compatible datatypes.  For example, if we have
  * an expression like "oid = 123", the operator will be oideqint4,
  * which we need to replace with oideq in order to recognize it as
- * matching an oid_ops index on the oid field.  A variant case is where
+ * matching an oid_ops index on the oid field.	A variant case is where
  * the expression is like "oid::int4 = 123", where the given operator
  * will be int4eq and again we need to intuit that we want to use oideq.
  *
@@ -832,13 +834,13 @@ indexable_operator(Expr *clause, Oid opclass, Oid relam,
 	/*
 	 * Maybe the index uses a binary-compatible operator set.
 	 *
-	 * Get the nominal input types of the given operator and the actual
-	 * type (before binary-compatible relabeling) of the index key.
+	 * Get the nominal input types of the given operator and the actual type
+	 * (before binary-compatible relabeling) of the index key.
 	 */
 	oldoptup = SearchSysCache(OPEROID,
 							  ObjectIdGetDatum(expr_op),
 							  0, 0, 0);
-	if (! HeapTupleIsValid(oldoptup))
+	if (!HeapTupleIsValid(oldoptup))
 		return InvalidOid;		/* probably can't happen */
 	oldopform = (Form_pg_operator) GETSTRUCT(oldoptup);
 	opname = pstrdup(NameStr(oldopform->oprname));
@@ -848,7 +850,7 @@ indexable_operator(Expr *clause, Oid opclass, Oid relam,
 
 	if (indexkey_on_left)
 	{
-		Node   *leftop = (Node *) get_leftop(clause);
+		Node	   *leftop = (Node *) get_leftop(clause);
 
 		if (leftop && IsA(leftop, RelabelType))
 			leftop = ((RelabelType *) leftop)->arg;
@@ -856,7 +858,7 @@ indexable_operator(Expr *clause, Oid opclass, Oid relam,
 	}
 	else
 	{
-		Node   *rightop = (Node *) get_rightop(clause);
+		Node	   *rightop = (Node *) get_rightop(clause);
 
 		if (rightop && IsA(rightop, RelabelType))
 			rightop = ((RelabelType *) rightop)->arg;
@@ -874,9 +876,10 @@ indexable_operator(Expr *clause, Oid opclass, Oid relam,
 		return InvalidOid;
 
 	/*
-	 * OK, look for operator of the same name with the indexkey's data type.
-	 * (In theory this might find a non-semantically-comparable operator,
-	 * but in practice that seems pretty unlikely for binary-compatible types.)
+	 * OK, look for operator of the same name with the indexkey's data
+	 * type. (In theory this might find a non-semantically-comparable
+	 * operator, but in practice that seems pretty unlikely for
+	 * binary-compatible types.)
 	 */
 	new_op = compatible_oper_opid(opname, indexkeytype, indexkeytype, true);
 
@@ -886,8 +889,8 @@ indexable_operator(Expr *clause, Oid opclass, Oid relam,
 		{
 
 			/*
-			 * OK, we found a binary-compatible operator of the same
-			 * name; now does it match the index?
+			 * OK, we found a binary-compatible operator of the same name;
+			 * now does it match the index?
 			 */
 			if (indexkey_on_left)
 				commuted_op = new_op;
@@ -1491,8 +1494,9 @@ match_index_to_operand(int indexkey,
 					   RelOptInfo *rel,
 					   IndexOptInfo *index)
 {
+
 	/*
-	 * Ignore any RelabelType node above the indexkey.  This is needed to
+	 * Ignore any RelabelType node above the indexkey.	This is needed to
 	 * be able to apply indexscanning in binary-compatible-operator cases.
 	 * Note: we can assume there is at most one RelabelType node;
 	 * eval_const_expressions() will have simplified if more than one.
@@ -1670,7 +1674,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
 				patt = DatumGetCString(DirectFunctionCall1(textout,
 														   constvalue));
 				isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like,
-												   &prefix, &rest) != Pattern_Prefix_None;
+								  &prefix, &rest) != Pattern_Prefix_None;
 				if (prefix)
 					pfree(prefix);
 				pfree(patt);
@@ -1687,7 +1691,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
 				patt = DatumGetCString(DirectFunctionCall1(textout,
 														   constvalue));
 				isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like_IC,
-												   &prefix, &rest) != Pattern_Prefix_None;
+								  &prefix, &rest) != Pattern_Prefix_None;
 				if (prefix)
 					pfree(prefix);
 				pfree(patt);
@@ -1704,7 +1708,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
 				patt = DatumGetCString(DirectFunctionCall1(textout,
 														   constvalue));
 				isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex,
-												   &prefix, &rest) != Pattern_Prefix_None;
+								  &prefix, &rest) != Pattern_Prefix_None;
 				if (prefix)
 					pfree(prefix);
 				pfree(patt);
@@ -1721,7 +1725,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
 				patt = DatumGetCString(DirectFunctionCall1(textout,
 														   constvalue));
 				isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex_IC,
-												   &prefix, &rest) != Pattern_Prefix_None;
+								  &prefix, &rest) != Pattern_Prefix_None;
 				if (prefix)
 					pfree(prefix);
 				pfree(patt);
@@ -1983,8 +1987,8 @@ prefix_quals(Var *leftop, Oid expr_op,
 	result = makeList1(expr);
 
 	/*
-	 * If we can create a string larger than the prefix, we can say
-	 * "x < greaterstr".
+	 * If we can create a string larger than the prefix, we can say "x <
+	 * greaterstr".
 	 */
 	greaterstr = make_greater_string(prefix, datatype);
 	if (greaterstr)
@@ -2025,6 +2029,7 @@ find_operator(const char *opname, Oid datatype)
 static Datum
 string_to_datum(const char *str, Oid datatype)
 {
+
 	/*
 	 * We cheat a little by assuming that textin() will do for bpchar and
 	 * varchar constants too...
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index cfbfb56c90227ae38bcfc6bf000311bfcc3a9a22..bfd246388b441aa283e7d846b1635a3b3c88f1db 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.61 2001/01/24 19:42:58 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.62 2001/03/22 03:59:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,32 +25,32 @@
 #include "utils/lsyscache.h"
 
 static void sort_inner_and_outer(Query *root, RelOptInfo *joinrel,
-								 RelOptInfo *outerrel, RelOptInfo *innerrel,
-								 List *restrictlist, List *mergeclause_list,
-								 JoinType jointype);
+					 RelOptInfo *outerrel, RelOptInfo *innerrel,
+					 List *restrictlist, List *mergeclause_list,
+					 JoinType jointype);
 static void match_unsorted_outer(Query *root, RelOptInfo *joinrel,
-								 RelOptInfo *outerrel, RelOptInfo *innerrel,
-								 List *restrictlist, List *mergeclause_list,
-								 JoinType jointype);
+					 RelOptInfo *outerrel, RelOptInfo *innerrel,
+					 List *restrictlist, List *mergeclause_list,
+					 JoinType jointype);
 
 #ifdef NOT_USED
 static void match_unsorted_inner(Query *root, RelOptInfo *joinrel,
-								 RelOptInfo *outerrel, RelOptInfo *innerrel,
-								 List *restrictlist, List *mergeclause_list,
-								 JoinType jointype);
+					 RelOptInfo *outerrel, RelOptInfo *innerrel,
+					 List *restrictlist, List *mergeclause_list,
+					 JoinType jointype);
 
 #endif
 static void hash_inner_and_outer(Query *root, RelOptInfo *joinrel,
-								 RelOptInfo *outerrel, RelOptInfo *innerrel,
-								 List *restrictlist, JoinType jointype);
+					 RelOptInfo *outerrel, RelOptInfo *innerrel,
+					 List *restrictlist, JoinType jointype);
 static Path *best_innerjoin(List *join_paths, List *outer_relid,
-							JoinType jointype);
+			   JoinType jointype);
 static Selectivity estimate_dispersion(Query *root, Var *var);
 static List *select_mergejoin_clauses(RelOptInfo *joinrel,
-									  RelOptInfo *outerrel,
-									  RelOptInfo *innerrel,
-									  List *restrictlist,
-									  JoinType jointype);
+						 RelOptInfo *outerrel,
+						 RelOptInfo *innerrel,
+						 List *restrictlist,
+						 JoinType jointype);
 
 
 /*
@@ -160,26 +160,27 @@ sort_inner_and_outer(Query *root,
 	 * generate a differently-sorted result path at essentially the same
 	 * cost.  We have no basis for choosing one over another at this level
 	 * of joining, but some sort orders may be more useful than others for
-	 * higher-level mergejoins, so it's worth considering multiple orderings.
+	 * higher-level mergejoins, so it's worth considering multiple
+	 * orderings.
 	 *
 	 * Actually, it's not quite true that every mergeclause ordering will
 	 * generate a different path order, because some of the clauses may be
-	 * redundant.  Therefore, what we do is convert the mergeclause list to
-	 * a list of canonical pathkeys, and then consider different orderings
-	 * of the pathkeys.
+	 * redundant.  Therefore, what we do is convert the mergeclause list
+	 * to a list of canonical pathkeys, and then consider different
+	 * orderings of the pathkeys.
 	 *
-	 * Generating a path for *every* permutation of the pathkeys doesn't
-	 * seem like a winning strategy; the cost in planning time is too high.
-	 * For now, we generate one path for each pathkey, listing that pathkey
-	 * first and the rest in random order.  This should allow at
-	 * least a one-clause mergejoin without re-sorting against any other
-	 * possible mergejoin partner path.  But if we've not guessed the
-	 * right ordering of secondary keys, we may end up evaluating
-	 * clauses as qpquals when they could have been done as mergeclauses.
-	 * We need to figure out a better way.	(Two possible approaches: look
-	 * at all the relevant index relations to suggest plausible sort
-	 * orders, or make just one output path and somehow mark it as having
-	 * a sort-order that can be rearranged freely.)
+	 * Generating a path for *every* permutation of the pathkeys doesn't seem
+	 * like a winning strategy; the cost in planning time is too high. For
+	 * now, we generate one path for each pathkey, listing that pathkey
+	 * first and the rest in random order.	This should allow at least a
+	 * one-clause mergejoin without re-sorting against any other possible
+	 * mergejoin partner path.	But if we've not guessed the right
+	 * ordering of secondary keys, we may end up evaluating clauses as
+	 * qpquals when they could have been done as mergeclauses. We need to
+	 * figure out a better way.  (Two possible approaches: look at all the
+	 * relevant index relations to suggest plausible sort orders, or make
+	 * just one output path and somehow mark it as having a sort-order
+	 * that can be rearranged freely.)
 	 */
 	all_pathkeys = make_pathkeys_for_mergeclauses(root,
 												  mergeclause_list,
@@ -200,16 +201,17 @@ sort_inner_and_outer(Query *root,
 								 lremove(front_pathkey,
 										 listCopy(all_pathkeys)));
 		else
-			cur_pathkeys = all_pathkeys;	/* no work at first one... */
+			cur_pathkeys = all_pathkeys;		/* no work at first one... */
 
 		/*
 		 * Select mergeclause(s) that match this sort ordering.  If we had
-		 * redundant merge clauses then we will get a subset of the original
-		 * clause list.  There had better be some match, however...
+		 * redundant merge clauses then we will get a subset of the
+		 * original clause list.  There had better be some match,
+		 * however...
 		 */
 		cur_mergeclauses = find_mergeclauses_for_pathkeys(root,
 														  cur_pathkeys,
-														  mergeclause_list);
+													   mergeclause_list);
 		Assert(cur_mergeclauses != NIL);
 
 		/*
@@ -334,10 +336,12 @@ match_unsorted_outer(Query *root,
 
 		if (nestjoinOK)
 		{
+
 			/*
-			 * Always consider a nestloop join with this outer and cheapest-
-			 * total-cost inner.  Consider nestloops using the cheapest-
-			 * startup-cost inner as well, and the best innerjoin indexpath.
+			 * Always consider a nestloop join with this outer and
+			 * cheapest- total-cost inner.	Consider nestloops using the
+			 * cheapest- startup-cost inner as well, and the best
+			 * innerjoin indexpath.
 			 */
 			add_path(joinrel, (Path *)
 					 create_nestloop_path(joinrel,
@@ -352,7 +356,7 @@ match_unsorted_outer(Query *root,
 						 create_nestloop_path(joinrel,
 											  jointype,
 											  outerpath,
-											  innerrel->cheapest_startup_path,
+										 innerrel->cheapest_startup_path,
 											  restrictlist,
 											  merge_pathkeys));
 			if (bestinnerjoin != NULL)
@@ -382,8 +386,8 @@ match_unsorted_outer(Query *root,
 		/*
 		 * Generate a mergejoin on the basis of sorting the cheapest
 		 * inner. Since a sort will be needed, only cheapest total cost
-		 * matters.  (But create_mergejoin_path will do the right thing
-		 * if innerrel->cheapest_total_path is already correctly sorted.)
+		 * matters.  (But create_mergejoin_path will do the right thing if
+		 * innerrel->cheapest_total_path is already correctly sorted.)
 		 */
 		add_path(joinrel, (Path *)
 				 create_mergejoin_path(joinrel,
@@ -400,13 +404,14 @@ match_unsorted_outer(Query *root,
 		 * Look for presorted inner paths that satisfy the innersortkey
 		 * list or any truncation thereof.	Here, we consider both cheap
 		 * startup cost and cheap total cost.  Ignore
-		 * innerrel->cheapest_total_path, since we already made a path with it.
+		 * innerrel->cheapest_total_path, since we already made a path
+		 * with it.
 		 */
 		num_sortkeys = length(innersortkeys);
 		if (num_sortkeys > 1)
-			trialsortkeys = listCopy(innersortkeys); /* need modifiable copy */
+			trialsortkeys = listCopy(innersortkeys);	/* need modifiable copy */
 		else
-			trialsortkeys = innersortkeys; /* won't really truncate */
+			trialsortkeys = innersortkeys;		/* won't really truncate */
 		cheapest_startup_inner = NULL;
 		cheapest_total_inner = NULL;
 
@@ -417,8 +422,8 @@ match_unsorted_outer(Query *root,
 
 			/*
 			 * Look for an inner path ordered well enough for the first
-			 * 'sortkeycnt' innersortkeys.	NB: trialsortkeys list
-			 * is modified destructively, which is why we made a copy...
+			 * 'sortkeycnt' innersortkeys.	NB: trialsortkeys list is
+			 * modified destructively, which is why we made a copy...
 			 */
 			trialsortkeys = ltruncate(sortkeycnt, trialsortkeys);
 			innerpath = get_cheapest_path_for_pathkeys(innerrel->pathlist,
@@ -478,8 +483,8 @@ match_unsorted_outer(Query *root,
 						{
 							newclauses =
 								find_mergeclauses_for_pathkeys(root,
-															   trialsortkeys,
-															   mergeclauses);
+														   trialsortkeys,
+														   mergeclauses);
 							Assert(newclauses != NIL);
 						}
 						else
@@ -601,7 +606,7 @@ match_unsorted_inner(Query *root,
 		if (startupouterpath != NULL && startupouterpath != totalouterpath)
 		{
 			merge_pathkeys = build_join_pathkeys(root, joinrel,
-												 startupouterpath->pathkeys);
+											 startupouterpath->pathkeys);
 			add_path(joinrel, (Path *)
 					 create_mergejoin_path(joinrel,
 										   jointype,
@@ -696,8 +701,8 @@ hash_inner_and_outer(Query *root,
 		 * estimate dispersion of inner var for costing purposes.
 		 *
 		 * Since we tend to visit the same clauses over and over when
-		 * planning a large query, we cache the dispersion estimates in the
-		 * RestrictInfo node to avoid repeated lookups of statistics.
+		 * planning a large query, we cache the dispersion estimates in
+		 * the RestrictInfo node to avoid repeated lookups of statistics.
 		 */
 		if (intMember(left->varno, outerrelids) &&
 			intMember(right->varno, innerrelids))
@@ -793,13 +798,13 @@ best_innerjoin(List *join_paths, Relids outer_relids, JoinType jointype)
 
 	foreach(join_path, join_paths)
 	{
-		IndexPath   *path = (IndexPath *) lfirst(join_path);
+		IndexPath  *path = (IndexPath *) lfirst(join_path);
 
 		Assert(IsA(path, IndexPath));
 
 		/*
-		 * If processing an outer join, only use explicit join clauses in the
-		 * inner indexscan.  For inner joins we need not be so picky.
+		 * If processing an outer join, only use explicit join clauses in
+		 * the inner indexscan.  For inner joins we need not be so picky.
 		 */
 		if (isouterjoin && !path->alljoinquals)
 			continue;
@@ -879,15 +884,15 @@ select_mergejoin_clauses(RelOptInfo *joinrel,
 				   *right;
 
 		/*
-		 * If processing an outer join, only use its own join clauses in the
-		 * merge.  For inner joins we need not be so picky.
+		 * If processing an outer join, only use its own join clauses in
+		 * the merge.  For inner joins we need not be so picky.
 		 *
 		 * Furthermore, if it is a right/full join then *all* the explicit
-		 * join clauses must be mergejoinable, else the executor will fail.
-		 * If we are asked for a right join then just return NIL to indicate
-		 * no mergejoin is possible (we can handle it as a left join instead).
-		 * If we are asked for a full join then emit an error, because there
-		 * is no fallback.
+		 * join clauses must be mergejoinable, else the executor will
+		 * fail. If we are asked for a right join then just return NIL to
+		 * indicate no mergejoin is possible (we can handle it as a left
+		 * join instead). If we are asked for a full join then emit an
+		 * error, because there is no fallback.
 		 */
 		if (isouterjoin)
 		{
@@ -897,7 +902,7 @@ select_mergejoin_clauses(RelOptInfo *joinrel,
 			{
 				case JOIN_RIGHT:
 					if (restrictinfo->mergejoinoperator == InvalidOid)
-						return NIL;	/* not mergejoinable */
+						return NIL;		/* not mergejoinable */
 					break;
 				case JOIN_FULL:
 					if (restrictinfo->mergejoinoperator == InvalidOid)
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 2492f17ea9b5c2cb5a3de5a6b253e461d91fe9cb..929a977112d13e515b81f12f5aee1d781b79038c 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.51 2001/02/16 00:03:07 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.52 2001/03/22 03:59:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
 
 
 static RelOptInfo *make_join_rel(Query *root, RelOptInfo *rel1,
-								 RelOptInfo *rel2, JoinType jointype);
+			  RelOptInfo *rel2, JoinType jointype);
 
 
 /*
@@ -44,18 +44,19 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 
 	/*
 	 * First, consider left-sided and right-sided plans, in which rels of
-	 * exactly level-1 member relations are joined against initial relations.
-	 * We prefer to join using join clauses, but if we find a rel of level-1
-	 * members that has no join clauses, we will generate Cartesian-product
-	 * joins against all initial rels not already contained in it.
+	 * exactly level-1 member relations are joined against initial
+	 * relations. We prefer to join using join clauses, but if we find a
+	 * rel of level-1 members that has no join clauses, we will generate
+	 * Cartesian-product joins against all initial rels not already
+	 * contained in it.
 	 *
-	 * In the first pass (level == 2), we try to join each initial rel to each
-	 * initial rel that appears later in joinrels[1].  (The mirror-image
-	 * joins are handled automatically by make_join_rel.)  In later
-	 * passes, we try to join rels of size level-1 from joinrels[level-1]
-	 * to each initial rel in joinrels[1].
+	 * In the first pass (level == 2), we try to join each initial rel to
+	 * each initial rel that appears later in joinrels[1].	(The
+	 * mirror-image joins are handled automatically by make_join_rel.)	In
+	 * later passes, we try to join rels of size level-1 from
+	 * joinrels[level-1] to each initial rel in joinrels[1].
 	 */
-	foreach(r, joinrels[level-1])
+	foreach(r, joinrels[level - 1])
 	{
 		RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
 		List	   *other_rels;
@@ -73,9 +74,9 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 			 * Note that if all available join clauses for this rel
 			 * require more than one other rel, we will fail to make any
 			 * joins against it here.  That's OK; it'll be considered by
-			 * "bushy plan" join code in a higher-level pass where we
-			 * have those other rels collected into a join rel.  See also
-			 * the last-ditch case below.
+			 * "bushy plan" join code in a higher-level pass where we have
+			 * those other rels collected into a join rel.	See also the
+			 * last-ditch case below.
 			 */
 			new_rels = make_rels_by_clause_joins(root,
 												 old_rel,
@@ -94,16 +95,16 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 		}
 
 		/*
-		 * At levels above 2 we will generate the same joined relation
-		 * in multiple ways --- for example (a join b) join c is the same
+		 * At levels above 2 we will generate the same joined relation in
+		 * multiple ways --- for example (a join b) join c is the same
 		 * RelOptInfo as (b join c) join a, though the second case will
-		 * add a different set of Paths to it.  To avoid making extra work
-		 * for subsequent passes, do not enter the same RelOptInfo into our
-		 * output list multiple times.
+		 * add a different set of Paths to it.	To avoid making extra work
+		 * for subsequent passes, do not enter the same RelOptInfo into
+		 * our output list multiple times.
 		 */
 		foreach(nr, new_rels)
 		{
-			RelOptInfo	   *jrel = (RelOptInfo *) lfirst(nr);
+			RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
 
 			if (!ptrMember(jrel, result_rels))
 				result_rels = lcons(jrel, result_rels);
@@ -111,20 +112,21 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 	}
 
 	/*
-	 * Now, consider "bushy plans" in which relations of k initial rels are
-	 * joined to relations of level-k initial rels, for 2 <= k <= level-2.
+	 * Now, consider "bushy plans" in which relations of k initial rels
+	 * are joined to relations of level-k initial rels, for 2 <= k <=
+	 * level-2.
 	 *
 	 * We only consider bushy-plan joins for pairs of rels where there is a
 	 * suitable join clause, in order to avoid unreasonable growth of
 	 * planning time.
 	 */
-	for (k = 2; ; k++)
+	for (k = 2;; k++)
 	{
 		int			other_level = level - k;
 
 		/*
-		 * Since make_join_rel(x, y) handles both x,y and y,x cases,
-		 * we only need to go as far as the halfway point.
+		 * Since make_join_rel(x, y) handles both x,y and y,x cases, we
+		 * only need to go as far as the halfway point.
 		 */
 		if (k > other_level)
 			break;
@@ -139,7 +141,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 				continue;		/* we ignore clauseless joins here */
 
 			if (k == other_level)
-				other_rels = lnext(r); /* only consider remaining rels */
+				other_rels = lnext(r);	/* only consider remaining rels */
 			else
 				other_rels = joinrels[other_level];
 
@@ -153,8 +155,8 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 
 					/*
 					 * OK, we can build a rel of the right level from this
-					 * pair of rels.  Do so if there is at least one usable
-					 * join clause.
+					 * pair of rels.  Do so if there is at least one
+					 * usable join clause.
 					 */
 					foreach(i, old_rel->joininfo)
 					{
@@ -170,7 +172,8 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 							/* Avoid making duplicate entries ... */
 							if (!ptrMember(jrel, result_rels))
 								result_rels = lcons(jrel, result_rels);
-							break; /* need not consider more joininfos */
+							break;		/* need not consider more
+										 * joininfos */
 						}
 					}
 				}
@@ -180,31 +183,34 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 
 	/*
 	 * Last-ditch effort: if we failed to find any usable joins so far,
-	 * force a set of cartesian-product joins to be generated.  This
+	 * force a set of cartesian-product joins to be generated.	This
 	 * handles the special case where all the available rels have join
-	 * clauses but we cannot use any of the joins yet.  An example is
+	 * clauses but we cannot use any of the joins yet.	An example is
 	 *
 	 * SELECT * FROM a,b,c WHERE (a.f1 + b.f2 + c.f3) = 0;
 	 *
-	 * The join clause will be usable at level 3, but at level 2 we have
-	 * no choice but to make cartesian joins.  We consider only left-sided
+	 * The join clause will be usable at level 3, but at level 2 we have no
+	 * choice but to make cartesian joins.	We consider only left-sided
 	 * and right-sided cartesian joins in this case (no bushy).
 	 */
 	if (result_rels == NIL)
 	{
-		/* This loop is just like the first one, except we always call
+
+		/*
+		 * This loop is just like the first one, except we always call
 		 * make_rels_by_clauseless_joins().
 		 */
-		foreach(r, joinrels[level-1])
+		foreach(r, joinrels[level - 1])
 		{
 			RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
 			List	   *other_rels;
 
 			if (level == 2)
-				other_rels = lnext(r); /* only consider remaining initial
-										* rels */
+				other_rels = lnext(r);	/* only consider remaining initial
+										 * rels */
 			else
-				other_rels = joinrels[1]; /* consider all initial rels */
+				other_rels = joinrels[1];		/* consider all initial
+												 * rels */
 
 			new_rels = make_rels_by_clauseless_joins(root,
 													 old_rel,
@@ -212,7 +218,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
 
 			foreach(nr, new_rels)
 			{
-				RelOptInfo	   *jrel = (RelOptInfo *) lfirst(nr);
+				RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
 
 				if (!ptrMember(jrel, result_rels))
 					result_rels = lcons(jrel, result_rels);
@@ -266,6 +272,7 @@ make_rels_by_clause_joins(Query *root,
 				RelOptInfo *jrel;
 
 				jrel = make_join_rel(root, old_rel, other_rel, JOIN_INNER);
+
 				/*
 				 * Avoid entering same joinrel into our output list more
 				 * than once.  (make_rels_by_joins doesn't really care,
@@ -310,9 +317,10 @@ make_rels_by_clauseless_joins(Query *root,
 			RelOptInfo *jrel;
 
 			jrel = make_join_rel(root, old_rel, other_rel, JOIN_INNER);
+
 			/*
-			 * As long as given other_rels are distinct, don't need
-			 * to test to see if jrel is already part of output list.
+			 * As long as given other_rels are distinct, don't need to
+			 * test to see if jrel is already part of output list.
 			 */
 			result = lcons(jrel, result);
 		}
@@ -325,7 +333,7 @@ make_rels_by_clauseless_joins(Query *root,
 /*
  * make_jointree_rel
  *		Find or build a RelOptInfojoin rel representing a specific
- *		jointree item.  For JoinExprs, we only consider the construction
+ *		jointree item.	For JoinExprs, we only consider the construction
  *		path that corresponds exactly to what the user wrote.
  */
 RelOptInfo *
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index e96a96f6deb97f36499f32d9b1ba5656715c0652..f93a027cd53dfdce8cc983a7728496b85f50f889 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.30 2001/01/24 19:42:58 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.31 2001/03/22 03:59:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
 static PathKeyItem *makePathKeyItem(Node *key, Oid sortop);
 static List *make_canonical_pathkey(Query *root, PathKeyItem *item);
 static Var *find_indexkey_var(Query *root, RelOptInfo *rel,
-							  AttrNumber varattno);
+				  AttrNumber varattno);
 
 
 /*
@@ -89,10 +89,10 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
 	 * into our new set. When done, we add the new set to the front of
 	 * equi_key_list.
 	 *
-	 * It may well be that the two items we're given are already known to
-	 * be equijoin-equivalent, in which case we don't need to change our
-	 * data structure.  If we find both of them in the same equivalence
-	 * set to start with, we can quit immediately.
+	 * It may well be that the two items we're given are already known to be
+	 * equijoin-equivalent, in which case we don't need to change our data
+	 * structure.  If we find both of them in the same equivalence set to
+	 * start with, we can quit immediately.
 	 *
 	 * This is a standard UNION-FIND problem, for which there exist better
 	 * data structures than simple lists.  If this code ever proves to be
@@ -109,7 +109,11 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
 
 		if (item1here || item2here)
 		{
-			/* If find both in same equivalence set, no need to do any more */
+
+			/*
+			 * If find both in same equivalence set, no need to do any
+			 * more
+			 */
 			if (item1here && item2here)
 			{
 				/* Better not have seen only one in an earlier set... */
@@ -126,7 +130,8 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
 
 			/*
 			 * Remove old set from equi_key_list.  NOTE this does not
-			 * change lnext(cursetlink), so the foreach loop doesn't break.
+			 * change lnext(cursetlink), so the foreach loop doesn't
+			 * break.
 			 */
 			root->equi_key_list = lremove(curset, root->equi_key_list);
 			freeList(curset);	/* might as well recycle old cons cells */
@@ -171,8 +176,8 @@ generate_implied_equalities(Query *root)
 			continue;
 
 		/*
-		 * Match each item in the set with all that appear after it
-		 * (it's sufficient to generate A=B, need not process B=A too).
+		 * Match each item in the set with all that appear after it (it's
+		 * sufficient to generate A=B, need not process B=A too).
 		 */
 		foreach(ptr1, curset)
 		{
@@ -246,11 +251,12 @@ canonicalize_pathkeys(Query *root, List *pathkeys)
 		Assert(pathkey != NIL);
 		item = (PathKeyItem *) lfirst(pathkey);
 		cpathkey = make_canonical_pathkey(root, item);
+
 		/*
-		 * Eliminate redundant ordering requests --- ORDER BY A,A
-		 * is the same as ORDER BY A.  We want to check this only
-		 * after we have canonicalized the keys, so that equivalent-key
-		 * knowledge is used when deciding if an item is redundant.
+		 * Eliminate redundant ordering requests --- ORDER BY A,A is the
+		 * same as ORDER BY A.	We want to check this only after we have
+		 * canonicalized the keys, so that equivalent-key knowledge is
+		 * used when deciding if an item is redundant.
 		 */
 		if (!ptrMember(cpathkey, new_pathkeys))
 			new_pathkeys = lappend(new_pathkeys, cpathkey);
@@ -285,8 +291,8 @@ compare_pathkeys(List *keys1, List *keys2)
 		List	   *subkey2 = lfirst(key2);
 
 		/*
-		 * XXX would like to check that we've been given canonicalized input,
-		 * but query root not accessible here...
+		 * XXX would like to check that we've been given canonicalized
+		 * input, but query root not accessible here...
 		 */
 #ifdef NOT_USED
 		Assert(ptrMember(subkey1, root->equi_key_list));
@@ -295,7 +301,7 @@ compare_pathkeys(List *keys1, List *keys2)
 
 		/*
 		 * We will never have two subkeys where one is a subset of the
-		 * other, because of the canonicalization process.  Either they
+		 * other, because of the canonicalization process.	Either they
 		 * are equal or they ain't.  Furthermore, we only need pointer
 		 * comparison to detect equality.
 		 */
@@ -555,9 +561,10 @@ build_index_pathkeys(Query *root,
 			/* OK, make a sublist for this sort key */
 			item = makePathKeyItem((Node *) relvar, sortop);
 			cpathkey = make_canonical_pathkey(root, item);
+
 			/*
-			 * Eliminate redundant ordering info; could happen if query
-			 * is such that index keys are equijoined...
+			 * Eliminate redundant ordering info; could happen if query is
+			 * such that index keys are equijoined...
 			 */
 			if (!ptrMember(cpathkey, retval))
 				retval = lappend(retval, cpathkey);
@@ -693,7 +700,7 @@ make_pathkeys_for_sortclauses(List *sortclauses,
  *
  * RestrictInfo contains fields in which we may cache the result
  * of looking up the canonical pathkeys for the left and right sides
- * of the mergeclause.  (Note that in normal cases they will be the
+ * of the mergeclause.	(Note that in normal cases they will be the
  * same, but not if the mergeclause appears above an OUTER JOIN.)
  * This is a worthwhile savings because these routines will be invoked
  * many times when dealing with a many-relation query.
@@ -756,8 +763,8 @@ find_mergeclauses_for_pathkeys(Query *root,
 		/*
 		 * We can match a pathkey against either left or right side of any
 		 * mergejoin clause we haven't used yet.  For the moment we use a
-		 * dumb "greedy" algorithm with no backtracking.  Is it worth being
-		 * any smarter to make a longer list of usable mergeclauses?
+		 * dumb "greedy" algorithm with no backtracking.  Is it worth
+		 * being any smarter to make a longer list of usable mergeclauses?
 		 * Probably not.
 		 */
 		foreach(j, restrictinfos)
@@ -765,9 +772,10 @@ find_mergeclauses_for_pathkeys(Query *root,
 			RestrictInfo *restrictinfo = lfirst(j);
 
 			cache_mergeclause_pathkeys(root, restrictinfo);
+
 			/*
-			 * We can compare canonical pathkey sublists by simple
-			 * pointer equality; see compare_pathkeys.
+			 * We can compare canonical pathkey sublists by simple pointer
+			 * equality; see compare_pathkeys.
 			 */
 			if ((pathkey == restrictinfo->left_pathkey ||
 				 pathkey == restrictinfo->right_pathkey) &&
@@ -830,7 +838,7 @@ make_pathkeys_for_mergeclauses(Query *root,
 		cache_mergeclause_pathkeys(root, restrictinfo);
 
 		key = (Node *) get_leftop(restrictinfo->clause);
-		if (IsA(key, Var) && intMember(((Var *) key)->varno, rel->relids))
+		if (IsA(key, Var) &&intMember(((Var *) key)->varno, rel->relids))
 		{
 			/* Rel is left side of mergeclause */
 			pathkey = restrictinfo->left_pathkey;
@@ -838,7 +846,7 @@ make_pathkeys_for_mergeclauses(Query *root,
 		else
 		{
 			key = (Node *) get_rightop(restrictinfo->clause);
-			if (IsA(key, Var) && intMember(((Var *) key)->varno, rel->relids))
+			if (IsA(key, Var) &&intMember(((Var *) key)->varno, rel->relids))
 			{
 				/* Rel is right side of mergeclause */
 				pathkey = restrictinfo->right_pathkey;
@@ -851,13 +859,14 @@ make_pathkeys_for_mergeclauses(Query *root,
 		}
 
 		/*
-		 * When we are given multiple merge clauses, it's possible that some
-		 * clauses refer to the same vars as earlier clauses.  There's no
-		 * reason for us to specify sort keys like (A,B,A) when (A,B) will
-		 * do --- and adding redundant sort keys makes add_path think that
-		 * this sort order is different from ones that are really the same,
-		 * so don't do it.  Since we now have a canonicalized pathkey,
-		 * a simple ptrMember test is sufficient to detect redundant keys.
+		 * When we are given multiple merge clauses, it's possible that
+		 * some clauses refer to the same vars as earlier clauses.
+		 * There's no reason for us to specify sort keys like (A,B,A) when
+		 * (A,B) will do --- and adding redundant sort keys makes add_path
+		 * think that this sort order is different from ones that are
+		 * really the same, so don't do it.  Since we now have a
+		 * canonicalized pathkey, a simple ptrMember test is sufficient to
+		 * detect redundant keys.
 		 */
 		if (!ptrMember(pathkey, pathkeys))
 			pathkeys = lappend(pathkeys, pathkey);
@@ -911,6 +920,7 @@ pathkeys_useful_for_merging(Query *root, RelOptInfo *rel, List *pathkeys)
 				if (restrictinfo->mergejoinoperator == InvalidOid)
 					continue;
 				cache_mergeclause_pathkeys(root, restrictinfo);
+
 				/*
 				 * We can compare canonical pathkey sublists by simple
 				 * pointer equality; see compare_pathkeys.
@@ -984,7 +994,9 @@ truncate_useless_pathkeys(Query *root,
 	nuseful2 = pathkeys_useful_for_ordering(root, pathkeys);
 	if (nuseful2 > nuseful)
 		nuseful = nuseful2;
-	/* Note: not safe to modify input list destructively, but we can avoid
+
+	/*
+	 * Note: not safe to modify input list destructively, but we can avoid
 	 * copying the list if we're not actually going to change it
 	 */
 	if (nuseful == length(pathkeys))
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 738b696306af29612a07c5a3798e207e5ed90fda..8c3b00289d3e7d467aeb03dcc1b53eb02f5a3a2b 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.103 2001/01/24 19:42:58 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.104 2001/03/22 03:59:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,19 +42,19 @@ static IndexScan *create_indexscan_plan(Query *root, IndexPath *best_path,
 static TidScan *create_tidscan_plan(TidPath *best_path, List *tlist,
 					List *scan_clauses);
 static SubqueryScan *create_subqueryscan_plan(Path *best_path,
-					  List *tlist, List *scan_clauses);
+						 List *tlist, List *scan_clauses);
 static NestLoop *create_nestloop_plan(NestPath *best_path, List *tlist,
-									  List *joinclauses, List *otherclauses,
-									  Plan *outer_plan, List *outer_tlist,
-									  Plan *inner_plan, List *inner_tlist);
+					 List *joinclauses, List *otherclauses,
+					 Plan *outer_plan, List *outer_tlist,
+					 Plan *inner_plan, List *inner_tlist);
 static MergeJoin *create_mergejoin_plan(MergePath *best_path, List *tlist,
-										List *joinclauses, List *otherclauses,
-										Plan *outer_plan, List *outer_tlist,
-										Plan *inner_plan, List *inner_tlist);
+					  List *joinclauses, List *otherclauses,
+					  Plan *outer_plan, List *outer_tlist,
+					  Plan *inner_plan, List *inner_tlist);
 static HashJoin *create_hashjoin_plan(HashPath *best_path, List *tlist,
-									  List *joinclauses, List *otherclauses,
-									  Plan *outer_plan, List *outer_tlist,
-									  Plan *inner_plan, List *inner_tlist);
+					 List *joinclauses, List *otherclauses,
+					 Plan *outer_plan, List *outer_tlist,
+					 Plan *inner_plan, List *inner_tlist);
 static List *fix_indxqual_references(List *indexquals, IndexPath *index_path);
 static List *fix_indxqual_sublist(List *indexqual, int baserelid, Oid relam,
 					 Form_pg_index index);
@@ -72,20 +72,20 @@ static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
 static TidScan *make_tidscan(List *qptlist, List *qpqual, Index scanrelid,
 			 List *tideval);
 static NestLoop *make_nestloop(List *tlist,
-							   List *joinclauses, List *otherclauses,
-							   Plan *lefttree, Plan *righttree,
-							   JoinType jointype);
+			  List *joinclauses, List *otherclauses,
+			  Plan *lefttree, Plan *righttree,
+			  JoinType jointype);
 static HashJoin *make_hashjoin(List *tlist,
-							   List *joinclauses, List *otherclauses,
-							   List *hashclauses,
-							   Plan *lefttree, Plan *righttree,
-							   JoinType jointype);
+			  List *joinclauses, List *otherclauses,
+			  List *hashclauses,
+			  Plan *lefttree, Plan *righttree,
+			  JoinType jointype);
 static Hash *make_hash(List *tlist, Node *hashkey, Plan *lefttree);
 static MergeJoin *make_mergejoin(List *tlist,
-								 List *joinclauses, List *otherclauses,
-								 List *mergeclauses,
-								 Plan *lefttree, Plan *righttree,
-								 JoinType jointype);
+			   List *joinclauses, List *otherclauses,
+			   List *mergeclauses,
+			   Plan *lefttree, Plan *righttree,
+			   JoinType jointype);
 
 /*
  * create_plan
@@ -313,8 +313,8 @@ create_append_plan(Query *root, AppendPath *best_path)
 
 	foreach(subpaths, best_path->subpaths)
 	{
-		Path   *subpath = (Path *) lfirst(subpaths);
-		
+		Path	   *subpath = (Path *) lfirst(subpaths);
+
 		subplans = lappend(subplans, create_plan(root, subpath));
 	}
 
@@ -344,7 +344,7 @@ create_seqscan_plan(Path *best_path, List *tlist, List *scan_clauses)
 
 	/* there should be exactly one base rel involved... */
 	Assert(length(best_path->parent->relids) == 1);
-	Assert(! best_path->parent->issubquery);
+	Assert(!best_path->parent->issubquery);
 
 	scan_relid = (Index) lfirsti(best_path->parent->relids);
 
@@ -386,7 +386,7 @@ create_indexscan_plan(Query *root,
 
 	/* there should be exactly one base rel involved... */
 	Assert(length(best_path->path.parent->relids) == 1);
-	Assert(! best_path->path.parent->issubquery);
+	Assert(!best_path->path.parent->issubquery);
 
 	baserelid = lfirsti(best_path->path.parent->relids);
 
@@ -496,7 +496,7 @@ create_tidscan_plan(TidPath *best_path, List *tlist, List *scan_clauses)
 
 	/* there should be exactly one base rel involved... */
 	Assert(length(best_path->path.parent->relids) == 1);
-	Assert(! best_path->path.parent->issubquery);
+	Assert(!best_path->path.parent->issubquery);
 
 	scan_relid = (Index) lfirsti(best_path->path.parent->relids);
 
@@ -737,21 +737,22 @@ create_mergejoin_plan(MergePath *best_path,
 									best_path->innersortkeys);
 
 	/*
-	 * The executor requires the inner side of a mergejoin to support "mark"
-	 * and "restore" operations.  Not all plan types do, so we must be careful
-	 * not to generate an invalid plan.  If necessary, an invalid inner plan
-	 * can be handled by inserting a Materialize node.
+	 * The executor requires the inner side of a mergejoin to support
+	 * "mark" and "restore" operations.  Not all plan types do, so we must
+	 * be careful not to generate an invalid plan.	If necessary, an
+	 * invalid inner plan can be handled by inserting a Materialize node.
 	 *
-	 * Since the inner side must be ordered, and only Sorts and IndexScans can
-	 * create order to begin with, you might think there's no problem --- but
-	 * you'd be wrong.  Nestloop and merge joins can *preserve* the order of
-	 * their inputs, so they can be selected as the input of a mergejoin,
-	 * and that won't work in the present executor.
+	 * Since the inner side must be ordered, and only Sorts and IndexScans
+	 * can create order to begin with, you might think there's no problem
+	 * --- but you'd be wrong.  Nestloop and merge joins can *preserve*
+	 * the order of their inputs, so they can be selected as the input of
+	 * a mergejoin, and that won't work in the present executor.
 	 *
 	 * Doing this here is a bit of a kluge since the cost of the Materialize
-	 * wasn't taken into account in our earlier decisions.  But Materialize
-	 * is hard to estimate a cost for, and the above consideration shows that
-	 * this is a rare case anyway, so this seems an acceptable way to proceed.
+	 * wasn't taken into account in our earlier decisions.  But
+	 * Materialize is hard to estimate a cost for, and the above
+	 * consideration shows that this is a rare case anyway, so this seems
+	 * an acceptable way to proceed.
 	 *
 	 * This check must agree with ExecMarkPos/ExecRestrPos in
 	 * executor/execAmi.c!
@@ -1015,6 +1016,7 @@ static Node *
 fix_indxqual_operand(Node *node, int baserelid, Form_pg_index index,
 					 Oid *opclass)
 {
+
 	/*
 	 * Remove any binary-compatible relabeling of the indexkey
 	 */
@@ -1025,8 +1027,8 @@ fix_indxqual_operand(Node *node, int baserelid, Form_pg_index index,
 	 * We represent index keys by Var nodes having the varno of the base
 	 * table but varattno equal to the index's attribute number (index
 	 * column position).  This is a bit hokey ... would be cleaner to use
-	 * a special-purpose node type that could not be mistaken for a regular
-	 * Var.  But it will do for now.
+	 * a special-purpose node type that could not be mistaken for a
+	 * regular Var.  But it will do for now.
 	 */
 	if (IsA(node, Var))
 	{
@@ -1062,7 +1064,7 @@ fix_indxqual_operand(Node *node, int baserelid, Form_pg_index index,
 	 * the returned varattno must be 1.
 	 */
 
-	Assert(is_funcclause(node)); /* not a very thorough check, but easy */
+	Assert(is_funcclause(node));/* not a very thorough check, but easy */
 
 	/* indclass[0] is the only class of a functional index */
 	*opclass = index->indclass[0];
@@ -1493,7 +1495,7 @@ make_sort_from_pathkeys(List *tlist, Plan *lefttree, List *pathkeys)
 	return make_sort(sort_tlist, lefttree, numsortkeys);
 }
 
-Material *
+Material   *
 make_material(List *tlist, Plan *lefttree)
 {
 	Material   *node = makeNode(Material);
@@ -1734,10 +1736,10 @@ make_limit(List *tlist, Plan *lefttree,
 	copy_plan_costsize(plan, lefttree);
 
 	/*
-	 * If offset/count are constants, adjust the output rows count and costs
-	 * accordingly.  This is only a cosmetic issue if we are at top level,
-	 * but if we are building a subquery then it's important to report
-	 * correct info to the outer planner.
+	 * If offset/count are constants, adjust the output rows count and
+	 * costs accordingly.  This is only a cosmetic issue if we are at top
+	 * level, but if we are building a subquery then it's important to
+	 * report correct info to the outer planner.
 	 */
 	if (limitOffset && IsA(limitOffset, Const))
 	{
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index 1025a9b7f6bc8e2774f6453b654eb747ef94dbb3..2b2ebf238fefbe702ddb211a6064a16740b18f2e 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.57 2001/02/16 03:16:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.58 2001/03/22 03:59:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,11 +35,11 @@
 
 
 static void mark_baserels_for_outer_join(Query *root, Relids rels,
-										 Relids outerrels);
+							 Relids outerrels);
 static void distribute_qual_to_rels(Query *root, Node *clause,
-									bool ispusheddown,
-									bool isouterjoin,
-									Relids qualscope);
+						bool ispusheddown,
+						bool isouterjoin,
+						Relids qualscope);
 static void add_join_info_to_rels(Query *root, RestrictInfo *restrictinfo,
 					  Relids join_relids);
 static void add_vars_to_targetlist(Query *root, List *vars);
@@ -57,7 +57,7 @@ static void check_hashjoinable(RestrictInfo *restrictinfo);
  * build_base_rel_tlists
  *	  Creates rel nodes for every relation mentioned in the target list
  *	  'tlist' (if a node hasn't already been created) and adds them to
- *	  root->base_rel_list.  Creates targetlist entries for each var seen
+ *	  root->base_rel_list.	Creates targetlist entries for each var seen
  *	  in 'tlist' and adds them to the tlist of the appropriate rel node.
  */
 void
@@ -118,6 +118,7 @@ add_missing_rels_to_query(Query *root, Node *jtnode)
 	if (IsA(jtnode, RangeTblRef))
 	{
 		int			varno = ((RangeTblRef *) jtnode)->rtindex;
+
 		/* This call to get_base_rel does the primary work... */
 		RelOptInfo *rel = get_base_rel(root, varno);
 
@@ -160,7 +161,7 @@ add_missing_rels_to_query(Query *root, Node *jtnode)
  * distribute_quals_to_rels
  *	  Recursively scan the query's join tree for WHERE and JOIN/ON qual
  *	  clauses, and add these to the appropriate RestrictInfo and JoinInfo
- *	  lists belonging to base RelOptInfos.  New base rel entries are created
+ *	  lists belonging to base RelOptInfos.	New base rel entries are created
  *	  as needed.  Also, base RelOptInfos are marked with outerjoinset
  *	  information, to aid in proper positioning of qual clauses that appear
  *	  above outer joins.
@@ -169,7 +170,7 @@ add_missing_rels_to_query(Query *root, Node *jtnode)
  * be evaluated at the lowest level where all the variables it mentions are
  * available.  However, we cannot push a qual down into the nullable side(s)
  * of an outer join since the qual might eliminate matching rows and cause a
- * NULL row to be incorrectly emitted by the join.  Therefore, rels appearing
+ * NULL row to be incorrectly emitted by the join.	Therefore, rels appearing
  * within the nullable side(s) of an outer join are marked with
  * outerjoinset = list of Relids used at the outer join node.
  * This list will be added to the list of rels referenced by quals using such
@@ -228,14 +229,14 @@ distribute_quals_to_rels(Query *root, Node *jtnode)
 		List	   *qual;
 
 		/*
-		 * Order of operations here is subtle and critical.  First we recurse
-		 * to handle sub-JOINs.  Their join quals will be placed without
-		 * regard for whether this level is an outer join, which is correct.
-		 * Then, if we are an outer join, we mark baserels contained within
-		 * the nullable side(s) with our own rel list; this will restrict
-		 * placement of subsequent quals using those rels, including our own
-		 * quals and quals above us in the join tree.
-		 * Finally we place our own join quals.
+		 * Order of operations here is subtle and critical.  First we
+		 * recurse to handle sub-JOINs.  Their join quals will be placed
+		 * without regard for whether this level is an outer join, which
+		 * is correct. Then, if we are an outer join, we mark baserels
+		 * contained within the nullable side(s) with our own rel list;
+		 * this will restrict placement of subsequent quals using those
+		 * rels, including our own quals and quals above us in the join
+		 * tree. Finally we place our own join quals.
 		 */
 		leftids = distribute_quals_to_rels(root, j->larg);
 		rightids = distribute_quals_to_rels(root, j->rarg);
@@ -261,9 +262,10 @@ distribute_quals_to_rels(Query *root, Node *jtnode)
 				isouterjoin = true;
 				break;
 			case JOIN_UNION:
+
 				/*
-				 * This is where we fail if upper levels of planner haven't
-				 * rewritten UNION JOIN as an Append ...
+				 * This is where we fail if upper levels of planner
+				 * haven't rewritten UNION JOIN as an Append ...
 				 */
 				elog(ERROR, "UNION JOIN is not implemented yet");
 				break;
@@ -338,12 +340,12 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	bool		can_be_equijoin;
 
 	restrictinfo->clause = (Expr *) clause;
-	restrictinfo->eval_cost = -1; /* not computed until needed */
+	restrictinfo->eval_cost = -1;		/* not computed until needed */
 	restrictinfo->subclauseindices = NIL;
 	restrictinfo->mergejoinoperator = InvalidOid;
 	restrictinfo->left_sortop = InvalidOid;
 	restrictinfo->right_sortop = InvalidOid;
-	restrictinfo->left_pathkey = NIL; /* not computable yet */
+	restrictinfo->left_pathkey = NIL;	/* not computable yet */
 	restrictinfo->right_pathkey = NIL;
 	restrictinfo->hashjoinoperator = InvalidOid;
 	restrictinfo->left_dispersion = -1; /* not computed until needed */
@@ -358,7 +360,7 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	 * Cross-check: clause should contain no relids not within its scope.
 	 * Otherwise the parser messed up.
 	 */
-	if (! is_subseti(relids, qualscope))
+	if (!is_subseti(relids, qualscope))
 		elog(ERROR, "JOIN qualification may not refer to other relations");
 
 	/*
@@ -377,14 +379,14 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	 * This ensures that the clause will be evaluated exactly at the level
 	 * of joining corresponding to the outer join.
 	 *
-	 * For a non-outer-join qual, we can evaluate the qual as soon as
-	 * (1) we have all the rels it mentions, and (2) we are at or above any
-	 * outer joins that can null any of these rels and are below the syntactic
-	 * location of the given qual.  To enforce the latter, scan the base rels
-	 * listed in relids, and merge their outer-join lists into the clause's
-	 * own reference list.  At the time we are called, the outerjoinset list
-	 * of each baserel will show exactly those outer joins that are below the
-	 * qual in the join tree.
+	 * For a non-outer-join qual, we can evaluate the qual as soon as (1) we
+	 * have all the rels it mentions, and (2) we are at or above any outer
+	 * joins that can null any of these rels and are below the syntactic
+	 * location of the given qual.	To enforce the latter, scan the base
+	 * rels listed in relids, and merge their outer-join lists into the
+	 * clause's own reference list.  At the time we are called, the
+	 * outerjoinset list of each baserel will show exactly those outer
+	 * joins that are below the qual in the join tree.
 	 */
 	if (isouterjoin)
 	{
@@ -396,19 +398,24 @@ distribute_qual_to_rels(Query *root, Node *clause,
 		Relids		newrelids = relids;
 		List	   *relid;
 
-		/* We rely on set_unioni to be nondestructive of its input lists... */
+		/*
+		 * We rely on set_unioni to be nondestructive of its input
+		 * lists...
+		 */
 		can_be_equijoin = true;
 		foreach(relid, relids)
 		{
 			RelOptInfo *rel = get_base_rel(root, lfirsti(relid));
 
 			if (rel->outerjoinset &&
-				! is_subseti(rel->outerjoinset, relids))
+				!is_subseti(rel->outerjoinset, relids))
 			{
 				newrelids = set_unioni(newrelids, rel->outerjoinset);
+
 				/*
-				 * Because application of the qual will be delayed by outer
-				 * join, we mustn't assume its vars are equal everywhere.
+				 * Because application of the qual will be delayed by
+				 * outer join, we mustn't assume its vars are equal
+				 * everywhere.
 				 */
 				can_be_equijoin = false;
 			}
@@ -419,10 +426,11 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	}
 
 	/*
-	 * Mark the qual as "pushed down" if it can be applied at a level below
-	 * its original syntactic level.  This allows us to distinguish original
-	 * JOIN/ON quals from higher-level quals pushed down to the same joinrel.
-	 * A qual originating from WHERE is always considered "pushed down".
+	 * Mark the qual as "pushed down" if it can be applied at a level
+	 * below its original syntactic level.	This allows us to distinguish
+	 * original JOIN/ON quals from higher-level quals pushed down to the
+	 * same joinrel. A qual originating from WHERE is always considered
+	 * "pushed down".
 	 */
 	restrictinfo->ispusheddown = ispusheddown || !sameseti(relids,
 														   qualscope);
@@ -458,10 +466,10 @@ distribute_qual_to_rels(Query *root, Node *clause,
 		 * the relid list.	Set additional RestrictInfo fields for
 		 * joining.
 		 *
-		 * We don't bother setting the merge/hashjoin info if we're not
-		 * going to need it.  We do want to know about mergejoinable ops
-		 * in any potential equijoin clause (see later in this routine),
-		 * and we ignore enable_mergejoin if isouterjoin is true, because
+		 * We don't bother setting the merge/hashjoin info if we're not going
+		 * to need it.	We do want to know about mergejoinable ops in any
+		 * potential equijoin clause (see later in this routine), and we
+		 * ignore enable_mergejoin if isouterjoin is true, because
 		 * mergejoin is the only implementation we have for full and right
 		 * outer joins.
 		 */
@@ -485,6 +493,7 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	}
 	else
 	{
+
 		/*
 		 * 'clause' references no rels, and therefore we have no place to
 		 * attach it.  Shouldn't get here if callers are working properly.
@@ -493,12 +502,12 @@ distribute_qual_to_rels(Query *root, Node *clause,
 	}
 
 	/*
-	 * If the clause has a mergejoinable operator, and is not an outer-join
-	 * qualification nor bubbled up due to an outer join, then the two sides
-	 * represent equivalent PathKeyItems for path keys: any path that is
-	 * sorted by one side will also be sorted by the other (as soon as the
-	 * two rels are joined, that is).  Record the key equivalence for future
-	 * use.
+	 * If the clause has a mergejoinable operator, and is not an
+	 * outer-join qualification nor bubbled up due to an outer join, then
+	 * the two sides represent equivalent PathKeyItems for path keys: any
+	 * path that is sorted by one side will also be sorted by the other
+	 * (as soon as the two rels are joined, that is).  Record the key
+	 * equivalence for future use.
 	 */
 	if (can_be_equijoin && restrictinfo->mergejoinoperator != InvalidOid)
 		add_equijoined_keys(root, restrictinfo);
@@ -569,15 +578,16 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 	Expr	   *clause;
 
 	/*
-	 * Currently, since check_mergejoinable only accepts Var = Var clauses,
-	 * we should only see Var nodes here.  Would have to work a little
-	 * harder to locate the right rel(s) if more-general mergejoin clauses
-	 * were accepted.
+	 * Currently, since check_mergejoinable only accepts Var = Var
+	 * clauses, we should only see Var nodes here.	Would have to work a
+	 * little harder to locate the right rel(s) if more-general mergejoin
+	 * clauses were accepted.
 	 */
 	Assert(IsA(item1, Var));
 	irel1 = ((Var *) item1)->varno;
 	Assert(IsA(item2, Var));
 	irel2 = ((Var *) item2)->varno;
+
 	/*
 	 * If both vars belong to same rel, we need to look at that rel's
 	 * baserestrictinfo list.  If different rels, each will have a
@@ -593,6 +603,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 
 		restrictlist = joininfo->jinfo_restrictinfo;
 	}
+
 	/*
 	 * Scan to see if equality is already known.
 	 */
@@ -611,6 +622,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 			(equal(item2, left) && equal(item1, right)))
 			return;				/* found a matching clause */
 	}
+
 	/*
 	 * This equality is new information, so construct a clause
 	 * representing it to add to the query data structures.
@@ -620,6 +632,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 	eq_operator = compatible_oper("=", ltype, rtype, true);
 	if (!HeapTupleIsValid(eq_operator))
 	{
+
 		/*
 		 * Would it be safe to just not add the equality to the query if
 		 * we have no suitable equality operator for the combination of
@@ -629,6 +642,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 			 typeidTypeName(ltype), typeidTypeName(rtype));
 	}
 	pgopform = (Form_pg_operator) GETSTRUCT(eq_operator);
+
 	/*
 	 * Let's just make sure this appears to be a compatible operator.
 	 */
@@ -641,21 +655,21 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
 	clause = makeNode(Expr);
 	clause->typeOid = BOOLOID;
 	clause->opType = OP_EXPR;
-	clause->oper = (Node *) makeOper(oprid(eq_operator), /* opno */
-									 InvalidOid, /* opid */
-									 BOOLOID); /* operator result type */
+	clause->oper = (Node *) makeOper(oprid(eq_operator),		/* opno */
+									 InvalidOid,		/* opid */
+									 BOOLOID);	/* operator result type */
 	clause->args = makeList2(item1, item2);
 
 	ReleaseSysCache(eq_operator);
 
 	/*
 	 * Note: we mark the qual "pushed down" to ensure that it can never be
-	 * taken for an original JOIN/ON clause.  We also claim it is an outer-
-	 * join clause, which it isn't, but that keeps distribute_qual_to_rels
-	 * from examining the outerjoinsets of the relevant rels (which are no
-	 * longer of interest, but could keep the qual from being pushed down
-	 * to where it should be).  It'll also save a useless call to
-	 * add_equijoined keys...
+	 * taken for an original JOIN/ON clause.  We also claim it is an
+	 * outer- join clause, which it isn't, but that keeps
+	 * distribute_qual_to_rels from examining the outerjoinsets of the
+	 * relevant rels (which are no longer of interest, but could keep the
+	 * qual from being pushed down to where it should be).	It'll also
+	 * save a useless call to add_equijoined keys...
 	 */
 	distribute_qual_to_rels(root, (Node *) clause,
 							true, true,
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index d196e755d660f6a862be503a728da7c7e42a4294..b2b362e84a5299b16a3792966b1cb6897e310ad5 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.63 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.64 2001/03/22 03:59:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@
 
 
 static Plan *subplanner(Query *root, List *flat_tlist,
-						double tuple_fraction);
+		   double tuple_fraction);
 
 
 /*--------------------
@@ -82,7 +82,7 @@ query_planner(Query *root,
 
 	/*
 	 * If the query has an empty join tree, then it's something easy like
-	 * "SELECT 2+2;" or "INSERT ... VALUES()".  Fall through quickly.
+	 * "SELECT 2+2;" or "INSERT ... VALUES()".	Fall through quickly.
 	 */
 	if (root->jointree->fromlist == NIL)
 	{
@@ -213,9 +213,9 @@ subplanner(Query *root,
 	foreach(brel, root->base_rel_list)
 	{
 		RelOptInfo *baserel = (RelOptInfo *) lfirst(brel);
-		int		relid = lfirsti(baserel->relids);
+		int			relid = lfirsti(baserel->relids);
 
-		if (! ptrMember(baserel, joined_rels))
+		if (!ptrMember(baserel, joined_rels))
 			elog(ERROR, "Internal error: no jointree entry for rel %s (%d)",
 				 rt_fetch(relid, root->rtable)->eref->relname, relid);
 	}
@@ -334,9 +334,9 @@ subplanner(Query *root,
 	/*
 	 * Nothing for it but to sort the cheapest-total-cost path --- but we
 	 * let the caller do that.	grouping_planner has to be able to add a
-	 * sort node anyway, so no need for extra code here.  (Furthermore, the
-	 * given pathkeys might involve something we can't compute here, such
-	 * as an aggregate function...)
+	 * sort node anyway, so no need for extra code here.  (Furthermore,
+	 * the given pathkeys might involve something we can't compute here,
+	 * such as an aggregate function...)
 	 */
 	root->query_pathkeys = cheapestpath->pathkeys;
 	resultplan = create_plan(root, cheapestpath);
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 9faf6b95e801f20bad29871349182caf91eefcde..c5bd439587ea688ea4e7b23ff067faf8a3b30053 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.101 2001/01/27 04:42:32 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.102 2001/03/22 03:59:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,9 +33,9 @@
 
 
 /* Expression kind codes for preprocess_expression */
-#define EXPRKIND_TARGET	0
+#define EXPRKIND_TARGET 0
 #define EXPRKIND_WHERE	1
-#define EXPRKIND_HAVING	2
+#define EXPRKIND_HAVING 2
 
 
 static Node *pull_up_subqueries(Query *parse, Node *jtnode);
@@ -68,16 +68,16 @@ planner(Query *parse)
 
 	/*
 	 * The planner can be called recursively (an example is when
-	 * eval_const_expressions tries to pre-evaluate an SQL function).
-	 * So, these global state variables must be saved and restored.
+	 * eval_const_expressions tries to pre-evaluate an SQL function). So,
+	 * these global state variables must be saved and restored.
 	 *
-	 * These vars cannot be moved into the Query structure since their
-	 * whole purpose is communication across multiple sub-Queries.
+	 * These vars cannot be moved into the Query structure since their whole
+	 * purpose is communication across multiple sub-Queries.
 	 *
 	 * Note we do NOT save and restore PlannerPlanId: it exists to assign
-	 * unique IDs to SubPlan nodes, and we want those IDs to be unique
-	 * for the life of a backend.  Also, PlannerInitPlan is saved/restored
-	 * in subquery_planner, not here.
+	 * unique IDs to SubPlan nodes, and we want those IDs to be unique for
+	 * the life of a backend.  Also, PlannerInitPlan is saved/restored in
+	 * subquery_planner, not here.
 	 */
 	save_PlannerQueryLevel = PlannerQueryLevel;
 	save_PlannerParamVar = PlannerParamVar;
@@ -150,6 +150,7 @@ subquery_planner(Query *parse, double tuple_fraction)
 	 */
 	parse->jointree = (FromExpr *)
 		pull_up_subqueries(parse, (Node *) parse->jointree);
+
 	/*
 	 * If so, we may have created opportunities to simplify the jointree.
 	 */
@@ -170,26 +171,26 @@ subquery_planner(Query *parse, double tuple_fraction)
 
 	/*
 	 * A HAVING clause without aggregates is equivalent to a WHERE clause
-	 * (except it can only refer to grouped fields).  Transfer any agg-free
-	 * clauses of the HAVING qual into WHERE.  This may seem like wasting
-	 * cycles to cater to stupidly-written queries, but there are other
-	 * reasons for doing it.  Firstly, if the query contains no aggs at all,
-	 * then we aren't going to generate an Agg plan node, and so there'll be
-	 * no place to execute HAVING conditions; without this transfer, we'd
-	 * lose the HAVING condition entirely, which is wrong.  Secondly, when
-	 * we push down a qual condition into a sub-query, it's easiest to push
-	 * the qual into HAVING always, in case it contains aggs, and then let
-	 * this code sort it out.
+	 * (except it can only refer to grouped fields).  Transfer any
+	 * agg-free clauses of the HAVING qual into WHERE.	This may seem like
+	 * wasting cycles to cater to stupidly-written queries, but there are
+	 * other reasons for doing it.	Firstly, if the query contains no aggs
+	 * at all, then we aren't going to generate an Agg plan node, and so
+	 * there'll be no place to execute HAVING conditions; without this
+	 * transfer, we'd lose the HAVING condition entirely, which is wrong.
+	 * Secondly, when we push down a qual condition into a sub-query, it's
+	 * easiest to push the qual into HAVING always, in case it contains
+	 * aggs, and then let this code sort it out.
 	 *
 	 * Note that both havingQual and parse->jointree->quals are in
 	 * implicitly-ANDed-list form at this point, even though they are
-	 * declared as Node *.  Also note that contain_agg_clause does not
+	 * declared as Node *.	Also note that contain_agg_clause does not
 	 * recurse into sub-selects, which is exactly what we need here.
 	 */
 	newHaving = NIL;
 	foreach(lst, (List *) parse->havingQual)
 	{
-		Node   *havingclause = (Node *) lfirst(lst);
+		Node	   *havingclause = (Node *) lfirst(lst);
 
 		if (contain_agg_clause(havingclause))
 			newHaving = lappend(newHaving, havingclause);
@@ -201,30 +202,32 @@ subquery_planner(Query *parse, double tuple_fraction)
 
 	/*
 	 * Do the main planning.  If we have an inherited target relation,
-	 * that needs special processing, else go straight to grouping_planner.
+	 * that needs special processing, else go straight to
+	 * grouping_planner.
 	 */
 	if (parse->resultRelation &&
-		(lst = expand_inherted_rtentry(parse, parse->resultRelation)) != NIL)
+	(lst = expand_inherted_rtentry(parse, parse->resultRelation)) != NIL)
 		plan = inheritance_planner(parse, lst);
 	else
 		plan = grouping_planner(parse, tuple_fraction);
 
 	/*
-	 * If any subplans were generated, or if we're inside a subplan,
-	 * build subPlan, extParam and locParam lists for plan nodes.
+	 * If any subplans were generated, or if we're inside a subplan, build
+	 * subPlan, extParam and locParam lists for plan nodes.
 	 */
 	if (PlannerPlanId != saved_planid || PlannerQueryLevel > 1)
 	{
 		(void) SS_finalize_plan(plan);
+
 		/*
-		 * At the moment, SS_finalize_plan doesn't handle initPlans
-		 * and so we assign them to the topmost plan node.
+		 * At the moment, SS_finalize_plan doesn't handle initPlans and so
+		 * we assign them to the topmost plan node.
 		 */
 		plan->initPlan = PlannerInitPlan;
 		/* Must add the initPlans' extParams to the topmost node's, too */
 		foreach(lst, plan->initPlan)
 		{
-			SubPlan *subplan = (SubPlan *) lfirst(lst);
+			SubPlan    *subplan = (SubPlan *) lfirst(lst);
 
 			plan->extParam = set_unioni(plan->extParam,
 										subplan->plan->extParam);
@@ -266,44 +269,47 @@ pull_up_subqueries(Query *parse, Node *jtnode)
 		Query	   *subquery = rte->subquery;
 
 		/*
-		 * Is this a subquery RTE, and if so, is the subquery simple enough
-		 * to pull up?  (If not, do nothing at this node.)
+		 * Is this a subquery RTE, and if so, is the subquery simple
+		 * enough to pull up?  (If not, do nothing at this node.)
 		 */
 		if (subquery && is_simple_subquery(subquery))
 		{
-			int		rtoffset;
-			Node   *subjointree;
-			List   *subtlist;
-			List   *l;
+			int			rtoffset;
+			Node	   *subjointree;
+			List	   *subtlist;
+			List	   *l;
 
 			/*
-			 * First, recursively pull up the subquery's subqueries,
-			 * so that this routine's processing is complete for its
-			 * jointree and rangetable.  NB: if the same subquery is
-			 * referenced from multiple jointree items (which can't happen
-			 * normally, but might after rule rewriting), then we will invoke
-			 * this processing multiple times on that subquery.  OK because
+			 * First, recursively pull up the subquery's subqueries, so
+			 * that this routine's processing is complete for its jointree
+			 * and rangetable.	NB: if the same subquery is referenced
+			 * from multiple jointree items (which can't happen normally,
+			 * but might after rule rewriting), then we will invoke this
+			 * processing multiple times on that subquery.	OK because
 			 * nothing will happen after the first time.  We do have to be
 			 * careful to copy everything we pull up, however, or risk
 			 * having chunks of structure multiply linked.
 			 */
 			subquery->jointree = (FromExpr *)
 				pull_up_subqueries(subquery, (Node *) subquery->jointree);
+
 			/*
-			 * Append the subquery's rangetable to mine (currently,
-			 * no adjustments will be needed in the subquery's rtable).
+			 * Append the subquery's rangetable to mine (currently, no
+			 * adjustments will be needed in the subquery's rtable).
 			 */
 			rtoffset = length(parse->rtable);
 			parse->rtable = nconc(parse->rtable,
 								  copyObject(subquery->rtable));
+
 			/*
-			 * Make copies of the subquery's jointree and targetlist
-			 * with varnos adjusted to match the merged rangetable.
+			 * Make copies of the subquery's jointree and targetlist with
+			 * varnos adjusted to match the merged rangetable.
 			 */
 			subjointree = copyObject(subquery->jointree);
 			OffsetVarNodes(subjointree, rtoffset, 0);
 			subtlist = copyObject(subquery->targetList);
 			OffsetVarNodes((Node *) subtlist, rtoffset, 0);
+
 			/*
 			 * Replace all of the top query's references to the subquery's
 			 * outputs with copies of the adjusted subtlist items, being
@@ -316,16 +322,18 @@ pull_up_subqueries(Query *parse, Node *jtnode)
 			parse->havingQual =
 				ResolveNew(parse->havingQual,
 						   varno, 0, subtlist, CMD_SELECT, 0);
+
 			/*
 			 * Pull up any FOR UPDATE markers, too.
 			 */
 			foreach(l, subquery->rowMarks)
 			{
-				int		submark = lfirsti(l);
+				int			submark = lfirsti(l);
 
 				parse->rowMarks = lappendi(parse->rowMarks,
 										   submark + rtoffset);
 			}
+
 			/*
 			 * Miscellaneous housekeeping.
 			 */
@@ -345,9 +353,7 @@ pull_up_subqueries(Query *parse, Node *jtnode)
 		List	   *l;
 
 		foreach(l, f->fromlist)
-		{
 			lfirst(l) = pull_up_subqueries(parse, lfirst(l));
-		}
 	}
 	else if (IsA(jtnode, JoinExpr))
 	{
@@ -370,6 +376,7 @@ pull_up_subqueries(Query *parse, Node *jtnode)
 static bool
 is_simple_subquery(Query *subquery)
 {
+
 	/*
 	 * Let's just make sure it's a valid subselect ...
 	 */
@@ -379,12 +386,14 @@ is_simple_subquery(Query *subquery)
 		subquery->into != NULL ||
 		subquery->isPortal)
 		elog(ERROR, "is_simple_subquery: subquery is bogus");
+
 	/*
-	 * Can't currently pull up a query with setops.
-	 * Maybe after querytree redesign...
+	 * Can't currently pull up a query with setops. Maybe after querytree
+	 * redesign...
 	 */
 	if (subquery->setOperations)
 		return false;
+
 	/*
 	 * Can't pull up a subquery involving grouping, aggregation, sorting,
 	 * or limiting.
@@ -397,12 +406,13 @@ is_simple_subquery(Query *subquery)
 		subquery->limitOffset ||
 		subquery->limitCount)
 		return false;
+
 	/*
 	 * Hack: don't try to pull up a subquery with an empty jointree.
 	 * query_planner() will correctly generate a Result plan for a
 	 * jointree that's totally empty, but I don't think the right things
-	 * happen if an empty FromExpr appears lower down in a jointree.
-	 * Not worth working hard on this, just to collapse SubqueryScan/Result
+	 * happen if an empty FromExpr appears lower down in a jointree. Not
+	 * worth working hard on this, just to collapse SubqueryScan/Result
 	 * into Result...
 	 */
 	if (subquery->jointree->fromlist == NIL)
@@ -443,7 +453,9 @@ resolvenew_in_jointree(Node *jtnode, int varno, List *subtlist)
 		resolvenew_in_jointree(j->rarg, varno, subtlist);
 		j->quals = ResolveNew(j->quals,
 							  varno, 0, subtlist, CMD_SELECT, 0);
-		/* We don't bother to update the colvars list, since it won't be
+
+		/*
+		 * We don't bother to update the colvars list, since it won't be
 		 * used again ...
 		 */
 	}
@@ -458,13 +470,13 @@ resolvenew_in_jointree(Node *jtnode, int varno, List *subtlist)
  *
  * If we succeed in pulling up a subquery then we might form a jointree
  * in which a FromExpr is a direct child of another FromExpr.  In that
- * case we can consider collapsing the two FromExprs into one.  This is
+ * case we can consider collapsing the two FromExprs into one.	This is
  * an optional conversion, since the planner will work correctly either
  * way.  But we may find a better plan (at the cost of more planning time)
  * if we merge the two nodes.
  *
  * NOTE: don't try to do this in the same jointree scan that does subquery
- * pullup!  Since we're changing the jointree structure here, that wouldn't
+ * pullup!	Since we're changing the jointree structure here, that wouldn't
  * work reliably --- see comments for pull_up_subqueries().
  */
 static Node *
@@ -484,27 +496,29 @@ preprocess_jointree(Query *parse, Node *jtnode)
 
 		foreach(l, f->fromlist)
 		{
-			Node   *child = (Node *) lfirst(l);
+			Node	   *child = (Node *) lfirst(l);
 
 			/* Recursively simplify the child... */
 			child = preprocess_jointree(parse, child);
 			/* Now, is it a FromExpr? */
 			if (child && IsA(child, FromExpr))
 			{
+
 				/*
-				 * Yes, so do we want to merge it into parent?  Always do so
-				 * if child has just one element (since that doesn't make the
-				 * parent's list any longer).  Otherwise we have to be careful
-				 * about the increase in planning time caused by combining the
-				 * two join search spaces into one.  Our heuristic is to merge
-				 * if the merge will produce a join list no longer than
-				 * GEQO_RELS/2.  (Perhaps need an additional user parameter?)
+				 * Yes, so do we want to merge it into parent?	Always do
+				 * so if child has just one element (since that doesn't
+				 * make the parent's list any longer).  Otherwise we have
+				 * to be careful about the increase in planning time
+				 * caused by combining the two join search spaces into
+				 * one.  Our heuristic is to merge if the merge will
+				 * produce a join list no longer than GEQO_RELS/2.
+				 * (Perhaps need an additional user parameter?)
 				 */
 				FromExpr   *subf = (FromExpr *) child;
 				int			childlen = length(subf->fromlist);
 				int			myothers = length(newlist) + length(lnext(l));
 
-				if (childlen <= 1 || (childlen+myothers) <= geqo_rels/2)
+				if (childlen <= 1 || (childlen + myothers) <= geqo_rels / 2)
 				{
 					newlist = nconc(newlist, subf->fromlist);
 					f->quals = make_and_qual(f->quals, subf->quals);
@@ -540,6 +554,7 @@ preprocess_jointree(Query *parse, Node *jtnode)
 static Node *
 preprocess_expression(Query *parse, Node *expr, int kind)
 {
+
 	/*
 	 * Simplify constant expressions.
 	 *
@@ -551,8 +566,8 @@ preprocess_expression(Query *parse, Node *expr, int kind)
 	expr = eval_const_expressions(expr);
 
 	/*
-	 * If it's a qual or havingQual, canonicalize it, and convert it
-	 * to implicit-AND format.
+	 * If it's a qual or havingQual, canonicalize it, and convert it to
+	 * implicit-AND format.
 	 *
 	 * XXX Is there any value in re-applying eval_const_expressions after
 	 * canonicalize_qual?
@@ -575,10 +590,11 @@ preprocess_expression(Query *parse, Node *expr, int kind)
 		if (kind != EXPRKIND_WHERE &&
 			(parse->groupClause != NIL || parse->hasAggs))
 		{
+
 			/*
 			 * Check for ungrouped variables passed to subplans.  Note we
-			 * do NOT do this for subplans in WHERE (or JOIN/ON); it's legal
-			 * there because WHERE is evaluated pre-GROUP.
+			 * do NOT do this for subplans in WHERE (or JOIN/ON); it's
+			 * legal there because WHERE is evaluated pre-GROUP.
 			 */
 			check_subplans_for_ungrouped_vars(expr, parse);
 		}
@@ -635,12 +651,12 @@ preprocess_qual_conditions(Query *parse, Node *jtnode)
  *	  inheritance set.
  *
  * We have to handle this case differently from cases where a source
- * relation is an inheritance set.  Source inheritance is expanded at
+ * relation is an inheritance set.	Source inheritance is expanded at
  * the bottom of the plan tree (see allpaths.c), but target inheritance
  * has to be expanded at the top.  The reason is that for UPDATE, each
  * target relation needs a different targetlist matching its own column
  * set.  (This is not so critical for DELETE, but for simplicity we treat
- * inherited DELETE the same way.)  Fortunately, the UPDATE/DELETE target
+ * inherited DELETE the same way.)	Fortunately, the UPDATE/DELETE target
  * can never be the nullable side of an outer join, so it's OK to generate
  * the plan this way.
  *
@@ -661,17 +677,17 @@ inheritance_planner(Query *parse, List *inheritlist)
 
 	foreach(l, inheritlist)
 	{
-		int		childRTindex = lfirsti(l);
-		Oid		childOID = getrelid(childRTindex, parse->rtable);
-		Query  *subquery;
-		Plan   *subplan;
+		int			childRTindex = lfirsti(l);
+		Oid			childOID = getrelid(childRTindex, parse->rtable);
+		Query	   *subquery;
+		Plan	   *subplan;
 
 		/* Generate modified query with this rel as target */
 		subquery = (Query *) adjust_inherited_attrs((Node *) parse,
-													parentRTindex, parentOID,
-													childRTindex, childOID);
+												parentRTindex, parentOID,
+												 childRTindex, childOID);
 		/* Generate plan */
-		subplan = grouping_planner(subquery, 0.0 /* retrieve all tuples */);
+		subplan = grouping_planner(subquery, 0.0 /* retrieve all tuples */ );
 		subplans = lappend(subplans, subplan);
 		/* Save preprocessed tlist from first rel for use in Append */
 		if (tlist == NIL)
@@ -718,6 +734,7 @@ grouping_planner(Query *parse, double tuple_fraction)
 
 	if (parse->setOperations)
 	{
+
 		/*
 		 * Construct the plan for set operations.  The result will not
 		 * need any work except perhaps a top-level sort and/or LIMIT.
@@ -736,17 +753,17 @@ grouping_planner(Query *parse, double tuple_fraction)
 		tlist = postprocess_setop_tlist(result_plan->targetlist, tlist);
 
 		/*
-		 * Can't handle FOR UPDATE here (parser should have checked already,
-		 * but let's make sure).
+		 * Can't handle FOR UPDATE here (parser should have checked
+		 * already, but let's make sure).
 		 */
 		if (parse->rowMarks)
 			elog(ERROR, "SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT");
 
 		/*
 		 * We set current_pathkeys NIL indicating we do not know sort
-		 * order.  This is correct when the top set operation is UNION ALL,
-		 * since the appended-together results are unsorted even if the
-		 * subplans were sorted.  For other set operations we could be
+		 * order.  This is correct when the top set operation is UNION
+		 * ALL, since the appended-together results are unsorted even if
+		 * the subplans were sorted.  For other set operations we could be
 		 * smarter --- room for future improvement!
 		 */
 		current_pathkeys = NIL;
@@ -772,22 +789,26 @@ grouping_planner(Query *parse, double tuple_fraction)
 
 		/*
 		 * Add TID targets for rels selected FOR UPDATE (should this be
-		 * done in preprocess_targetlist?).  The executor uses the TID
-		 * to know which rows to lock, much as for UPDATE or DELETE.
+		 * done in preprocess_targetlist?).  The executor uses the TID to
+		 * know which rows to lock, much as for UPDATE or DELETE.
 		 */
 		if (parse->rowMarks)
 		{
 			List	   *l;
 
 			/*
-			 * We've got trouble if the FOR UPDATE appears inside grouping,
-			 * since grouping renders a reference to individual tuple CTIDs
-			 * invalid.  This is also checked at parse time, but that's
-			 * insufficient because of rule substitution, query pullup, etc.
+			 * We've got trouble if the FOR UPDATE appears inside
+			 * grouping, since grouping renders a reference to individual
+			 * tuple CTIDs invalid.  This is also checked at parse time,
+			 * but that's insufficient because of rule substitution, query
+			 * pullup, etc.
 			 */
 			CheckSelectForUpdate(parse);
 
-			/* Currently the executor only supports FOR UPDATE at top level */
+			/*
+			 * Currently the executor only supports FOR UPDATE at top
+			 * level
+			 */
 			if (PlannerQueryLevel > 1)
 				elog(ERROR, "SELECT FOR UPDATE is not allowed in subselects");
 
@@ -873,9 +894,9 @@ grouping_planner(Query *parse, double tuple_fraction)
 					int32		count = DatumGetInt32(limitc->constvalue);
 
 					/*
-					 * A NULL-constant LIMIT represents "LIMIT ALL",
-					 * which we treat the same as no limit (ie,
-					 * expect to retrieve all the tuples).
+					 * A NULL-constant LIMIT represents "LIMIT ALL", which
+					 * we treat the same as no limit (ie, expect to
+					 * retrieve all the tuples).
 					 */
 					if (!limitc->constisnull && count > 0)
 					{
@@ -902,17 +923,19 @@ grouping_planner(Query *parse, double tuple_fraction)
 				}
 				else
 				{
+
 					/*
-					 * COUNT is an expression ... don't know exactly what the
-					 * limit will be, but for lack of a better idea assume
-					 * 10% of the plan's result is wanted.
+					 * COUNT is an expression ... don't know exactly what
+					 * the limit will be, but for lack of a better idea
+					 * assume 10% of the plan's result is wanted.
 					 */
 					tuple_fraction = 0.10;
 				}
 			}
 
 			/*
-			 * If no LIMIT, check for retrieve-into-portal, ie DECLARE CURSOR.
+			 * If no LIMIT, check for retrieve-into-portal, ie DECLARE
+			 * CURSOR.
 			 *
 			 * We have no real idea how many tuples the user will ultimately
 			 * FETCH from a cursor, but it seems a good bet that he
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index 1f2ae69561b1632ba321a7dbb6c1a149d4b60944..e7f8361b9a726e5d3c25970bce108ad1f3462623 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.70 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.71 2001/03/22 03:59:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -97,16 +97,17 @@ set_plan_references(Plan *plan)
 			fix_expr_references(plan,
 								(Node *) ((IndexScan *) plan)->indxqual);
 			fix_expr_references(plan,
-								(Node *) ((IndexScan *) plan)->indxqualorig);
+							(Node *) ((IndexScan *) plan)->indxqualorig);
 			break;
 		case T_TidScan:
 			fix_expr_references(plan, (Node *) plan->targetlist);
 			fix_expr_references(plan, (Node *) plan->qual);
 			break;
 		case T_SubqueryScan:
+
 			/*
-			 * We do not do set_uppernode_references() here, because
-			 * a SubqueryScan will always have been created with correct
+			 * We do not do set_uppernode_references() here, because a
+			 * SubqueryScan will always have been created with correct
 			 * references to its subplan's outputs to begin with.
 			 */
 			fix_expr_references(plan, (Node *) plan->targetlist);
@@ -126,7 +127,7 @@ set_plan_references(Plan *plan)
 			fix_expr_references(plan, (Node *) plan->qual);
 			fix_expr_references(plan, (Node *) ((Join *) plan)->joinqual);
 			fix_expr_references(plan,
-								(Node *) ((MergeJoin *) plan)->mergeclauses);
+							(Node *) ((MergeJoin *) plan)->mergeclauses);
 			break;
 		case T_HashJoin:
 			set_join_references((Join *) plan);
@@ -134,7 +135,7 @@ set_plan_references(Plan *plan)
 			fix_expr_references(plan, (Node *) plan->qual);
 			fix_expr_references(plan, (Node *) ((Join *) plan)->joinqual);
 			fix_expr_references(plan,
-								(Node *) ((HashJoin *) plan)->hashclauses);
+							  (Node *) ((HashJoin *) plan)->hashclauses);
 			break;
 		case T_Material:
 		case T_Sort:
@@ -148,10 +149,10 @@ set_plan_references(Plan *plan)
 			 * targetlists or quals (because they just return their
 			 * unmodified input tuples).  The optimizer is lazy about
 			 * creating really valid targetlists for them.	Best to just
-			 * leave the targetlist alone.  In particular, we do not want
+			 * leave the targetlist alone.	In particular, we do not want
 			 * to pull a subplan list for them, since we will likely end
-			 * up with duplicate list entries for subplans that also appear
-			 * in lower levels of the plan tree!
+			 * up with duplicate list entries for subplans that also
+			 * appear in lower levels of the plan tree!
 			 */
 			break;
 		case T_Agg:
@@ -175,11 +176,12 @@ set_plan_references(Plan *plan)
 			fix_expr_references(plan, ((Result *) plan)->resconstantqual);
 			break;
 		case T_Append:
+
 			/*
 			 * Append, like Sort et al, doesn't actually evaluate its
-			 * targetlist or quals, and we haven't bothered to give it
-			 * its own tlist copy.  So, don't fix targetlist/qual.
-			 * But do recurse into subplans.
+			 * targetlist or quals, and we haven't bothered to give it its
+			 * own tlist copy.	So, don't fix targetlist/qual. But do
+			 * recurse into subplans.
 			 */
 			foreach(pl, ((Append *) plan)->appendplans)
 				set_plan_references((Plan *) lfirst(pl));
@@ -296,7 +298,7 @@ set_uppernode_references(Plan *plan, Index subvarno)
 		subplanTargetList = NIL;
 
 	outputTargetList = NIL;
-	foreach (l, plan->targetlist)
+	foreach(l, plan->targetlist)
 	{
 		TargetEntry *tle = (TargetEntry *) lfirst(l);
 		TargetEntry *subplantle;
@@ -306,8 +308,8 @@ set_uppernode_references(Plan *plan, Index subvarno)
 		if (subplantle)
 		{
 			/* Found a matching subplan output expression */
-			Resdom *resdom = subplantle->resdom;
-			Var	   *newvar;
+			Resdom	   *resdom = subplantle->resdom;
+			Var		   *newvar;
 
 			newvar = makeVar(subvarno,
 							 resdom->resno,
@@ -317,7 +319,7 @@ set_uppernode_references(Plan *plan, Index subvarno)
 			/* If we're just copying a simple Var, copy up original info */
 			if (subplantle->expr && IsA(subplantle->expr, Var))
 			{
-				Var	   *subvar = (Var *) subplantle->expr;
+				Var		   *subvar = (Var *) subplantle->expr;
 
 				newvar->varnoold = subvar->varnoold;
 				newvar->varoattno = subvar->varoattno;
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 0a7d4926b7659e0a1df9d11e0780e2d566480523..9d47b60430aab2c67b94894db3e7059d36a2d2cd 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.48 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.49 2001/03/22 03:59:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -82,12 +82,12 @@ replace_var(Var *var)
 
 	/*
 	 * If there's already a PlannerParamVar entry for this same Var, just
-	 * use it.	NOTE: in sufficiently complex querytrees, it is
-	 * possible for the same varno/varlevel to refer to different RTEs in
-	 * different parts of the parsetree, so that different fields might
-	 * end up sharing the same Param number.  As long as we check the
-	 * vartype as well, I believe that this sort of aliasing will cause no
-	 * trouble. The correct field should get stored into the Param slot at
+	 * use it.	NOTE: in sufficiently complex querytrees, it is possible
+	 * for the same varno/varlevel to refer to different RTEs in different
+	 * parts of the parsetree, so that different fields might end up
+	 * sharing the same Param number.  As long as we check the vartype as
+	 * well, I believe that this sort of aliasing will cause no trouble.
+	 * The correct field should get stored into the Param slot at
 	 * execution in each part of the tree.
 	 */
 	i = 0;
@@ -142,10 +142,10 @@ make_subplan(SubLink *slink)
 		elog(ERROR, "make_subplan: invalid expression structure (subquery already processed?)");
 
 	/*
-	 * Copy the source Query node.  This is a quick and dirty kluge to resolve
-	 * the fact that the parser can generate trees with multiple links to the
-	 * same sub-Query node, but the planner wants to scribble on the Query.
-	 * Try to clean this up when we do querytree redesign...
+	 * Copy the source Query node.	This is a quick and dirty kluge to
+	 * resolve the fact that the parser can generate trees with multiple
+	 * links to the same sub-Query node, but the planner wants to scribble
+	 * on the Query. Try to clean this up when we do querytree redesign...
 	 */
 	subquery = (Query *) copyObject(subquery);
 
@@ -183,7 +183,8 @@ make_subplan(SubLink *slink)
 	 */
 	node->plan = plan = subquery_planner(subquery, tuple_fraction);
 
-	node->plan_id = PlannerPlanId++; /* Assign unique ID to this SubPlan */
+	node->plan_id = PlannerPlanId++;	/* Assign unique ID to this
+										 * SubPlan */
 
 	node->rtable = subquery->rtable;
 	node->sublink = slink;
@@ -191,8 +192,8 @@ make_subplan(SubLink *slink)
 	slink->subselect = NULL;	/* cool ?! see error check above! */
 
 	/*
-	 * Make parParam list of params that current query level will pass
-	 * to this child plan.
+	 * Make parParam list of params that current query level will pass to
+	 * this child plan.
 	 */
 	foreach(lst, plan->extParam)
 	{
@@ -275,7 +276,7 @@ make_subplan(SubLink *slink)
 			tup = SearchSysCache(OPEROID,
 								 ObjectIdGetDatum(oper->opno),
 								 0, 0, 0);
-			if (! HeapTupleIsValid(tup))
+			if (!HeapTupleIsValid(tup))
 				elog(ERROR, "cache lookup failed for operator %u", oper->opno);
 			opform = (Form_pg_operator) GETSTRUCT(tup);
 
@@ -413,7 +414,7 @@ make_subplan(SubLink *slink)
 			tup = SearchSysCache(OPEROID,
 								 ObjectIdGetDatum(oper->opno),
 								 0, 0, 0);
-			if (! HeapTupleIsValid(tup))
+			if (!HeapTupleIsValid(tup))
 				elog(ERROR, "cache lookup failed for operator %u", oper->opno);
 			opform = (Form_pg_operator) GETSTRUCT(tup);
 
@@ -614,15 +615,16 @@ SS_finalize_plan(Plan *plan)
 			break;
 
 		case T_SubqueryScan:
+
 			/*
-			 * In a SubqueryScan, SS_finalize_plan has already been run
-			 * on the subplan by the inner invocation of subquery_planner,
-			 * so there's no need to do it again.  Instead, just pull out
-			 * the subplan's extParams list, which represents the params
-			 * it needs from my level and higher levels.
+			 * In a SubqueryScan, SS_finalize_plan has already been run on
+			 * the subplan by the inner invocation of subquery_planner, so
+			 * there's no need to do it again.  Instead, just pull out the
+			 * subplan's extParams list, which represents the params it
+			 * needs from my level and higher levels.
 			 */
 			results.paramids = set_unioni(results.paramids,
-								((SubqueryScan *) plan)->subplan->extParam);
+							 ((SubqueryScan *) plan)->subplan->extParam);
 			break;
 
 		case T_IndexScan:
diff --git a/src/backend/optimizer/prep/prepkeyset.c b/src/backend/optimizer/prep/prepkeyset.c
index 64d1d818108d23acd675ee76049da7478df04f17..180637d099ec6a7b49c9189eaef4f0b38c1714f6 100644
--- a/src/backend/optimizer/prep/prepkeyset.c
+++ b/src/backend/optimizer/prep/prepkeyset.c
@@ -104,7 +104,8 @@ transformKeySetQuery(Query *origNode)
 		Node_Copy(origNode, unionNode, distinctClause);
 		Node_Copy(origNode, unionNode, sortClause);
 		Node_Copy(origNode, unionNode, rtable);
-		origNode->jointree->quals = NULL; /* avoid unnecessary copying */
+		origNode->jointree->quals = NULL;		/* avoid unnecessary
+												 * copying */
 		Node_Copy(origNode, unionNode, jointree);
 		Node_Copy(origNode, unionNode, targetList);
 
@@ -216,4 +217,4 @@ inspectOpNode(Expr *expr)
 	return (firstExpr && secondExpr && nodeTag(firstExpr) == T_Var && nodeTag(secondExpr) == T_Const);
 }
 
-#endif /* ENABLE_KEY_SET_QUERY */
+#endif	 /* ENABLE_KEY_SET_QUERY */
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c
index 6fa9c4db29e4d06dae43ae7d5e3609ec8047219a..2dc92deca1744175fe37694f37a15046c05c84c4 100644
--- a/src/backend/optimizer/prep/prepqual.c
+++ b/src/backend/optimizer/prep/prepqual.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.28 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.29 2001/03/22 03:59:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -260,6 +260,7 @@ dnfify(Expr *qual)
 
 	return newqual;
 }
+
 #endif
 
 /*--------------------
@@ -663,11 +664,11 @@ or_normalize(List *orlist)
 		 * We are going to insert the orlist into multiple places in the
 		 * result expression.  For most expression types, it'd be OK to
 		 * just have multiple links to the same subtree, but this fails
-		 * badly for SubLinks (and perhaps other cases?).  For safety,
-		 * we make a distinct copy for each place the orlist is inserted.
+		 * badly for SubLinks (and perhaps other cases?).  For safety, we
+		 * make a distinct copy for each place the orlist is inserted.
 		 */
 		if (lnext(temp) == NIL)
-			neworlist = orlist;	/* can use original tree at the end */
+			neworlist = orlist; /* can use original tree at the end */
 		else
 			neworlist = copyObject(orlist);
 
@@ -791,11 +792,12 @@ and_normalize(List *andlist)
 		 * We are going to insert the andlist into multiple places in the
 		 * result expression.  For most expression types, it'd be OK to
 		 * just have multiple links to the same subtree, but this fails
-		 * badly for SubLinks (and perhaps other cases?).  For safety,
-		 * we make a distinct copy for each place the andlist is inserted.
+		 * badly for SubLinks (and perhaps other cases?).  For safety, we
+		 * make a distinct copy for each place the andlist is inserted.
 		 */
 		if (lnext(temp) == NIL)
-			newandlist = andlist;	/* can use original tree at the end */
+			newandlist = andlist;		/* can use original tree at the
+										 * end */
 		else
 			newandlist = copyObject(andlist);
 
@@ -957,8 +959,10 @@ count_bool_nodes(Expr *qual,
 	}
 	else if (contain_subplans((Node *) qual))
 	{
-		/* charge extra for subexpressions containing sub-SELECTs,
-		 * to discourage us from rearranging them in a way that might
+
+		/*
+		 * charge extra for subexpressions containing sub-SELECTs, to
+		 * discourage us from rearranging them in a way that might
 		 * generate N copies of a subselect rather than one.  The magic
 		 * constant here interacts with the "4x maximum growth" heuristic
 		 * in canonicalize_qual().
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index f8a5afbbc45a24d05ca0bf9f76f62ef4bd0ffd3d..da51a76d3f3ac8ef6c52f01de2e727ad3fe530e5 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.41 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.42 2001/03/22 03:59:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,8 +33,8 @@
 static List *expand_targetlist(List *tlist, int command_type,
 				  Index result_relation, List *range_table);
 static TargetEntry *process_matched_tle(TargetEntry *src_tle,
-										TargetEntry *prior_tle,
-										int attrno);
+					TargetEntry *prior_tle,
+					int attrno);
 
 
 /*
@@ -49,9 +49,10 @@ preprocess_targetlist(List *tlist,
 					  Index result_relation,
 					  List *range_table)
 {
+
 	/*
-	 * Sanity check: if there is a result relation, it'd better be a
-	 * real relation not a subquery.  Else parser or rewriter messed up.
+	 * Sanity check: if there is a result relation, it'd better be a real
+	 * relation not a subquery.  Else parser or rewriter messed up.
 	 */
 	if (result_relation)
 	{
@@ -250,7 +251,7 @@ expand_targetlist(List *tlist, int command_type,
 						new_tle = makeTargetEntry(makeResdom(attrno,
 															 atttype,
 															 atttypmod,
-															 pstrdup(attrname),
+													   pstrdup(attrname),
 															 false),
 												  (Node *) temp_var);
 						break;
@@ -280,7 +281,7 @@ expand_targetlist(List *tlist, int command_type,
 		{
 			Resdom	   *resdom = old_tle->resdom;
 
-			if (! resdom->resjunk)
+			if (!resdom->resjunk)
 				elog(ERROR, "Unexpected assignment to attribute \"%s\"",
 					 resdom->resname);
 			/* Get the resno right, but don't copy unnecessarily */
@@ -314,9 +315,10 @@ expand_targetlist(List *tlist, int command_type,
  * Essentially, the expression we want to produce in this case is like
  *		foo = array_set(array_set(foo, 2, 42), 4, 43)
  */
-static TargetEntry *process_matched_tle(TargetEntry *src_tle,
-										TargetEntry *prior_tle,
-										int attrno)
+static TargetEntry *
+process_matched_tle(TargetEntry *src_tle,
+					TargetEntry *prior_tle,
+					int attrno)
 {
 	Resdom	   *resdom = src_tle->resdom;
 	Node	   *priorbottom;
@@ -324,11 +326,13 @@ static TargetEntry *process_matched_tle(TargetEntry *src_tle,
 
 	if (prior_tle == NULL)
 	{
+
 		/*
-		 * Normal case where this is the first assignment to the attribute.
+		 * Normal case where this is the first assignment to the
+		 * attribute.
 		 *
-		 * We can recycle the old TLE+resdom if right resno; else make a
-		 * new one to avoid modifying the old tlist structure. (Is preserving
+		 * We can recycle the old TLE+resdom if right resno; else make a new
+		 * one to avoid modifying the old tlist structure. (Is preserving
 		 * old tlist actually necessary?  Not sure, be safe.)
 		 */
 		if (resdom->resno == attrno)
@@ -339,7 +343,7 @@ static TargetEntry *process_matched_tle(TargetEntry *src_tle,
 	}
 
 	/*
-	 * Multiple assignments to same attribute.  Allow only if all are
+	 * Multiple assignments to same attribute.	Allow only if all are
 	 * array-assign operators with same bottom array object.
 	 */
 	if (src_tle->expr == NULL || !IsA(src_tle->expr, ArrayRef) ||
@@ -350,16 +354,19 @@ static TargetEntry *process_matched_tle(TargetEntry *src_tle,
 		((ArrayRef *) prior_tle->expr)->refelemtype)
 		elog(ERROR, "Multiple assignments to same attribute \"%s\"",
 			 resdom->resname);
+
 	/*
-	 * Prior TLE could be a nest of ArrayRefs if we do this more than once.
+	 * Prior TLE could be a nest of ArrayRefs if we do this more than
+	 * once.
 	 */
 	priorbottom = ((ArrayRef *) prior_tle->expr)->refexpr;
 	while (priorbottom != NULL && IsA(priorbottom, ArrayRef) &&
 		   ((ArrayRef *) priorbottom)->refassgnexpr != NULL)
 		priorbottom = ((ArrayRef *) priorbottom)->refexpr;
-	if (! equal(priorbottom, ((ArrayRef *) src_tle->expr)->refexpr))
+	if (!equal(priorbottom, ((ArrayRef *) src_tle->expr)->refexpr))
 		elog(ERROR, "Multiple assignments to same attribute \"%s\"",
 			 resdom->resname);
+
 	/*
 	 * Looks OK to nest 'em.
 	 */
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 85058757e5ef2089f9e9f71e50cf3186fade37ce..968b9ded7801d70cb11425b184af3364a05c4ca2 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -5,7 +5,7 @@
  *	  from a time when only UNIONs were implemented.
  *
  * There is also some code here to support planning of queries that use
- * inheritance (SELECT FROM foo*).  This no longer has much connection
+ * inheritance (SELECT FROM foo*).	This no longer has much connection
  * to the processing of UNION queries, but it's still here.
  *
  *
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.60 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.61 2001/03/22 03:59:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,22 +50,22 @@ typedef struct
 } adjust_inherited_attrs_context;
 
 static Plan *recurse_set_operations(Node *setOp, Query *parse,
-									List *colTypes, bool junkOK,
-									int flag, List *refnames_tlist);
+					   List *colTypes, bool junkOK,
+					   int flag, List *refnames_tlist);
 static Plan *generate_union_plan(SetOperationStmt *op, Query *parse,
-								 List *refnames_tlist);
+					List *refnames_tlist);
 static Plan *generate_nonunion_plan(SetOperationStmt *op, Query *parse,
-									List *refnames_tlist);
+					   List *refnames_tlist);
 static List *recurse_union_children(Node *setOp, Query *parse,
-									SetOperationStmt *top_union,
-									List *refnames_tlist);
+					   SetOperationStmt *top_union,
+					   List *refnames_tlist);
 static List *generate_setop_tlist(List *colTypes, int flag,
-								  bool hack_constants,
-								  List *input_tlist,
-								  List *refnames_tlist);
+					 bool hack_constants,
+					 List *input_tlist,
+					 List *refnames_tlist);
 static bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK);
 static Node *adjust_inherited_attrs_mutator(Node *node,
-								adjust_inherited_attrs_context *context);
+							   adjust_inherited_attrs_context *context);
 
 
 /*
@@ -99,10 +99,10 @@ plan_set_operations(Query *parse)
 	Assert(leftmostQuery != NULL);
 
 	/*
-	 * Recurse on setOperations tree to generate plans for set ops.
-	 * The final output plan should have just the column types shown
-	 * as the output from the top-level node, plus possibly a resjunk
-	 * working column (we can rely on upper-level nodes to deal with that).
+	 * Recurse on setOperations tree to generate plans for set ops. The
+	 * final output plan should have just the column types shown as the
+	 * output from the top-level node, plus possibly a resjunk working
+	 * column (we can rely on upper-level nodes to deal with that).
 	 */
 	return recurse_set_operations((Node *) topop, parse,
 								  topop->colTypes, true, -1,
@@ -127,16 +127,18 @@ recurse_set_operations(Node *setOp, Query *parse,
 	{
 		RangeTblRef *rtr = (RangeTblRef *) setOp;
 		RangeTblEntry *rte = rt_fetch(rtr->rtindex, parse->rtable);
-		Query  *subquery = rte->subquery;
-		Plan   *subplan,
-			   *plan;
+		Query	   *subquery = rte->subquery;
+		Plan	   *subplan,
+				   *plan;
 
 		Assert(subquery != NULL);
+
 		/*
 		 * Generate plan for primitive subquery
 		 */
 		subplan = subquery_planner(subquery,
 								   -1.0 /* default case */ );
+
 		/*
 		 * Add a SubqueryScan with the caller-requested targetlist
 		 */
@@ -152,28 +154,30 @@ recurse_set_operations(Node *setOp, Query *parse,
 	else if (IsA(setOp, SetOperationStmt))
 	{
 		SetOperationStmt *op = (SetOperationStmt *) setOp;
-		Plan   *plan;
+		Plan	   *plan;
 
 		/* UNIONs are much different from INTERSECT/EXCEPT */
 		if (op->op == SETOP_UNION)
 			plan = generate_union_plan(op, parse, refnames_tlist);
 		else
 			plan = generate_nonunion_plan(op, parse, refnames_tlist);
+
 		/*
 		 * If necessary, add a Result node to project the caller-requested
 		 * output columns.
 		 *
 		 * XXX you don't really want to know about this: setrefs.c will apply
 		 * replace_vars_with_subplan_refs() to the Result node's tlist.
-		 * This would fail if the input plan's non-resjunk tlist entries were
-		 * not all simple Vars equal() to the referencing Vars generated by
-		 * generate_setop_tlist().  However, since the input plan was
-		 * generated by generate_union_plan() or generate_nonunion_plan(),
-		 * the referencing Vars will equal the tlist entries they reference.
-		 * Ugly but I don't feel like making that code more general right now.
+		 * This would fail if the input plan's non-resjunk tlist entries
+		 * were not all simple Vars equal() to the referencing Vars
+		 * generated by generate_setop_tlist().  However, since the input
+		 * plan was generated by generate_union_plan() or
+		 * generate_nonunion_plan(), the referencing Vars will equal the
+		 * tlist entries they reference. Ugly but I don't feel like making
+		 * that code more general right now.
 		 */
 		if (flag >= 0 ||
-			! tlist_same_datatypes(plan->targetlist, colTypes, junkOK))
+			!tlist_same_datatypes(plan->targetlist, colTypes, junkOK))
 		{
 			plan = (Plan *)
 				make_result(generate_setop_tlist(colTypes, flag, false,
@@ -199,8 +203,8 @@ static Plan *
 generate_union_plan(SetOperationStmt *op, Query *parse,
 					List *refnames_tlist)
 {
-	List   *planlist;
-	Plan   *plan;
+	List	   *planlist;
+	Plan	   *plan;
 
 	/*
 	 * If any of my children are identical UNION nodes (same op, all-flag,
@@ -212,27 +216,29 @@ generate_union_plan(SetOperationStmt *op, Query *parse,
 											op, refnames_tlist),
 					 recurse_union_children(op->rarg, parse,
 											op, refnames_tlist));
+
 	/*
 	 * Append the child results together.
 	 *
-	 * The tlist for an Append plan isn't important as far as the Append
-	 * is concerned, but we must make it look real anyway for the benefit
-	 * of the next plan level up.
+	 * The tlist for an Append plan isn't important as far as the Append is
+	 * concerned, but we must make it look real anyway for the benefit of
+	 * the next plan level up.
 	 */
 	plan = (Plan *)
 		make_append(planlist,
 					false,
 					generate_setop_tlist(op->colTypes, -1, false,
-									((Plan *) lfirst(planlist))->targetlist,
-									refnames_tlist));
+								 ((Plan *) lfirst(planlist))->targetlist,
+										 refnames_tlist));
+
 	/*
-	 * For UNION ALL, we just need the Append plan.  For UNION,
-	 * need to add Sort and Unique nodes to produce unique output.
+	 * For UNION ALL, we just need the Append plan.  For UNION, need to
+	 * add Sort and Unique nodes to produce unique output.
 	 */
-	if (! op->all)
+	if (!op->all)
 	{
-		List   *tlist,
-			   *sortList;
+		List	   *tlist,
+				   *sortList;
 
 		tlist = new_unsorted_tlist(plan->targetlist);
 		sortList = addAllTargetsToSortList(NIL, tlist);
@@ -249,12 +255,12 @@ static Plan *
 generate_nonunion_plan(SetOperationStmt *op, Query *parse,
 					   List *refnames_tlist)
 {
-	Plan   *lplan,
-		   *rplan,
-		   *plan;
-	List   *tlist,
-		   *sortList;
-	SetOpCmd cmd;
+	Plan	   *lplan,
+			   *rplan,
+			   *plan;
+	List	   *tlist,
+			   *sortList;
+	SetOpCmd	cmd;
 
 	/* Recurse on children, ensuring their outputs are marked */
 	lplan = recurse_set_operations(op->larg, parse,
@@ -263,12 +269,13 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
 	rplan = recurse_set_operations(op->rarg, parse,
 								   op->colTypes, false, 1,
 								   refnames_tlist);
+
 	/*
 	 * Append the child results together.
 	 *
-	 * The tlist for an Append plan isn't important as far as the Append
-	 * is concerned, but we must make it look real anyway for the benefit
-	 * of the next plan level up.
+	 * The tlist for an Append plan isn't important as far as the Append is
+	 * concerned, but we must make it look real anyway for the benefit of
+	 * the next plan level up.
 	 */
 	plan = (Plan *)
 		make_append(makeList2(lplan, rplan),
@@ -276,9 +283,10 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
 					generate_setop_tlist(op->colTypes, 0, false,
 										 lplan->targetlist,
 										 refnames_tlist));
+
 	/*
-	 * Sort the child results, then add a SetOp plan node to
-	 * generate the correct output.
+	 * Sort the child results, then add a SetOp plan node to generate the
+	 * correct output.
 	 */
 	tlist = new_unsorted_tlist(plan->targetlist);
 	sortList = addAllTargetsToSortList(NIL, tlist);
@@ -293,11 +301,11 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
 			break;
 		default:
 			elog(ERROR, "generate_nonunion_plan: bogus operation code");
-			cmd = SETOPCMD_INTERSECT; /* keep compiler quiet */
+			cmd = SETOPCMD_INTERSECT;	/* keep compiler quiet */
 			break;
 	}
 	plan = (Plan *) make_setop(cmd, tlist, plan, sortList,
-							   length(op->colTypes)+1);
+							   length(op->colTypes) + 1);
 	return plan;
 }
 
@@ -322,20 +330,21 @@ recurse_union_children(Node *setOp, Query *parse,
 		{
 			/* Same UNION, so fold children into parent's subplan list */
 			return nconc(recurse_union_children(op->larg, parse,
-												top_union, refnames_tlist),
+											  top_union, refnames_tlist),
 						 recurse_union_children(op->rarg, parse,
-												top_union, refnames_tlist));
+											 top_union, refnames_tlist));
 		}
 	}
+
 	/*
 	 * Not same, so plan this child separately.
 	 *
-	 * Note we disallow any resjunk columns in child results.  This
-	 * is necessary since the Append node that implements the union
-	 * won't do any projection, and upper levels will get confused if
-	 * some of our output tuples have junk and some don't.  This case
-	 * only arises when we have an EXCEPT or INTERSECT as child, else
-	 * there won't be resjunk anyway.
+	 * Note we disallow any resjunk columns in child results.  This is
+	 * necessary since the Append node that implements the union won't do
+	 * any projection, and upper levels will get confused if some of our
+	 * output tuples have junk and some don't.  This case only arises when
+	 * we have an EXCEPT or INTERSECT as child, else there won't be
+	 * resjunk anyway.
 	 */
 	return makeList1(recurse_set_operations(setOp, parse,
 											top_union->colTypes, false,
@@ -359,7 +368,7 @@ generate_setop_tlist(List *colTypes, int flag,
 
 	foreach(i, colTypes)
 	{
-		Oid		colType = (Oid) lfirsti(i);
+		Oid			colType = (Oid) lfirsti(i);
 		TargetEntry *inputtle = (TargetEntry *) lfirst(input_tlist);
 		TargetEntry *reftle = (TargetEntry *) lfirst(refnames_tlist);
 
@@ -367,18 +376,19 @@ generate_setop_tlist(List *colTypes, int flag,
 		Assert(reftle->resdom->resno == resno);
 		Assert(!inputtle->resdom->resjunk);
 		Assert(!reftle->resdom->resjunk);
+
 		/*
 		 * Generate columns referencing input columns and having
 		 * appropriate data types and column names.  Insert datatype
 		 * coercions where necessary.
 		 *
 		 * HACK: constants in the input's targetlist are copied up as-is
-		 * rather than being referenced as subquery outputs.  This is mainly
-		 * to ensure that when we try to coerce them to the output column's
-		 * datatype, the right things happen for UNKNOWN constants.  But do
-		 * this only at the first level of subquery-scan plans; we don't
-		 * want phony constants appearing in the output tlists of upper-level
-		 * nodes!
+		 * rather than being referenced as subquery outputs.  This is
+		 * mainly to ensure that when we try to coerce them to the output
+		 * column's datatype, the right things happen for UNKNOWN
+		 * constants.  But do this only at the first level of
+		 * subquery-scan plans; we don't want phony constants appearing in
+		 * the output tlists of upper-level nodes!
 		 */
 		resdom = makeResdom((AttrNumber) resno++,
 							colType,
@@ -440,7 +450,7 @@ tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK)
 
 		if (tle->resdom->resjunk)
 		{
-			if (! junkOK)
+			if (!junkOK)
 				return false;
 		}
 		else
@@ -484,11 +494,11 @@ find_all_inheritors(Oid parentrel)
 		currentchildren = find_inheritance_children(currentrel);
 
 		/*
-		 * Add to the queue only those children not already seen.
-		 * This avoids making duplicate entries in case of multiple
-		 * inheritance paths from the same parent.  (It'll also keep
-		 * us from getting into an infinite loop, though theoretically
-		 * there can't be any cycles in the inheritance graph anyway.)
+		 * Add to the queue only those children not already seen. This
+		 * avoids making duplicate entries in case of multiple inheritance
+		 * paths from the same parent.	(It'll also keep us from getting
+		 * into an infinite loop, though theoretically there can't be any
+		 * cycles in the inheritance graph anyway.)
 		 */
 		currentchildren = set_differencei(currentchildren, examined_relids);
 		unexamined_relids = set_unioni(unexamined_relids, currentchildren);
@@ -524,20 +534,21 @@ expand_inherted_rtentry(Query *parse, Index rti)
 	List	   *l;
 
 	/* Does RT entry allow inheritance? */
-	if (! rte->inh)
+	if (!rte->inh)
 		return NIL;
 	Assert(parentOID != InvalidOid && rte->subquery == NULL);
 	/* Always clear the parent's inh flag, see above comments */
 	rte->inh = false;
 	/* Fast path for common case of childless table */
-	if (! has_subclass(parentOID))
+	if (!has_subclass(parentOID))
 		return NIL;
 	/* Scan for all members of inheritance set */
 	inhOIDs = find_all_inheritors(parentOID);
+
 	/*
-	 * Check that there's at least one descendant, else treat as
-	 * no-child case.  This could happen despite above has_subclass()
-	 * check, if table once had a child but no longer does.
+	 * Check that there's at least one descendant, else treat as no-child
+	 * case.  This could happen despite above has_subclass() check, if
+	 * table once had a child but no longer does.
 	 */
 	if (lnext(inhOIDs) == NIL)
 		return NIL;
@@ -545,18 +556,19 @@ expand_inherted_rtentry(Query *parse, Index rti)
 	inhRTIs = makeListi1(rti);
 	foreach(l, inhOIDs)
 	{
-		Oid		childOID = (Oid) lfirsti(l);
+		Oid			childOID = (Oid) lfirsti(l);
 		RangeTblEntry *childrte;
-		Index	childRTindex;
+		Index		childRTindex;
 
 		/* parent will be in the list too, so ignore it */
 		if (childOID == parentOID)
 			continue;
 
 		/*
-		 * Build an RTE for the child, and attach to query's rangetable list.
-		 * We copy most fields of the parent's RTE, but replace relation
-		 * real name and OID.  Note that inh will be false at this point.
+		 * Build an RTE for the child, and attach to query's rangetable
+		 * list. We copy most fields of the parent's RTE, but replace
+		 * relation real name and OID.	Note that inh will be false at
+		 * this point.
 		 */
 		childrte = copyObject(rte);
 		childrte->relname = get_rel_name(childOID);
@@ -575,12 +587,12 @@ expand_inherted_rtentry(Query *parse, Index rti)
  *	  to old_rt_index to refer to new_rt_index.
  *
  * We also adjust varattno to match the new table by column name, rather
- * than column number.  This hack makes it possible for child tables to have
+ * than column number.	This hack makes it possible for child tables to have
  * different column positions for the "same" attribute as a parent, which
  * helps ALTER TABLE ADD COLUMN.  Unfortunately this isn't nearly enough to
  * make it work transparently; there are other places where things fall down
  * if children and parents don't have the same column numbers for inherited
- * attributes.  It'd be better to rip this code out and fix ALTER TABLE...
+ * attributes.	It'd be better to rip this code out and fix ALTER TABLE...
  */
 Node *
 adjust_inherited_attrs(Node *node,
@@ -643,12 +655,13 @@ adjust_inherited_attrs_mutator(Node *node,
 	}
 	if (IsA(node, RangeTblRef))
 	{
-		RangeTblRef	   *rtr = (RangeTblRef *) copyObject(node);
+		RangeTblRef *rtr = (RangeTblRef *) copyObject(node);
 
 		if (rtr->rtindex == context->old_rt_index)
 			rtr->rtindex = context->new_rt_index;
 		return (Node *) rtr;
 	}
+
 	/*
 	 * We have to process RestrictInfo nodes specially: we do NOT want to
 	 * copy the original subclauseindices list, since the new rel may have
@@ -656,8 +669,8 @@ adjust_inherited_attrs_mutator(Node *node,
 	 */
 	if (IsA(node, RestrictInfo))
 	{
-		RestrictInfo   *oldinfo = (RestrictInfo *) node;
-		RestrictInfo   *newinfo = makeNode(RestrictInfo);
+		RestrictInfo *oldinfo = (RestrictInfo *) node;
+		RestrictInfo *newinfo = makeNode(RestrictInfo);
 
 		/* Copy all flat-copiable fields */
 		memcpy(newinfo, oldinfo, sizeof(RestrictInfo));
@@ -666,18 +679,19 @@ adjust_inherited_attrs_mutator(Node *node,
 			adjust_inherited_attrs_mutator((Node *) oldinfo->clause, context);
 
 		newinfo->subclauseindices = NIL;
-		newinfo->eval_cost = -1; /* reset this too */
-		newinfo->left_pathkey = NIL; /* and these */
+		newinfo->eval_cost = -1;/* reset this too */
+		newinfo->left_pathkey = NIL;	/* and these */
 		newinfo->right_pathkey = NIL;
 		newinfo->left_dispersion = -1;
 		newinfo->right_dispersion = -1;
 
 		return (Node *) newinfo;
 	}
+
 	/*
 	 * NOTE: we do not need to recurse into sublinks, because they should
 	 * already have been converted to subplans before we see them.
 	 */
 	return expression_tree_mutator(node, adjust_inherited_attrs_mutator,
-								  (void *) context);
+								   (void *) context);
 }
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index bc05908148b372b205f17a561725eb60d630218f..83d2468b02ce3a36943f1149fae3aee38a81e23a 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.82 2001/03/08 01:49:01 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.83 2001/03/22 03:59:39 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -544,8 +544,8 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
 
 	/*
 	 * If we find an aggregate function, do not recurse into its
-	 * arguments.  Subplans invoked within aggregate calls are allowed
-	 * to receive ungrouped variables.
+	 * arguments.  Subplans invoked within aggregate calls are allowed to
+	 * receive ungrouped variables.
 	 */
 	if (IsA(node, Aggref))
 		return false;
@@ -630,7 +630,7 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
  *	  Recursively search for noncachable functions within a clause.
  *
  * Returns true if any noncachable function (or operator implemented by a
- * noncachable function) is found.  This test is needed so that we don't
+ * noncachable function) is found.	This test is needed so that we don't
  * mistakenly think that something like "WHERE random() < 0.5" can be treated
  * as a constant qualification.
  *
@@ -655,11 +655,11 @@ contain_noncachable_functions_walker(Node *node, void *context)
 		switch (expr->opType)
 		{
 			case OP_EXPR:
-				if (! op_iscachable(((Oper *) expr->oper)->opno))
+				if (!op_iscachable(((Oper *) expr->oper)->opno))
 					return true;
 				break;
 			case FUNC_EXPR:
-				if (! func_iscachable(((Func *) expr->oper)->funcid))
+				if (!func_iscachable(((Func *) expr->oper)->funcid))
 					return true;
 				break;
 			default:
@@ -680,13 +680,14 @@ contain_noncachable_functions_walker(Node *node, void *context)
  *	  Detect whether a clause is "constant", ie, it contains no variables
  *	  of the current query level and no uses of noncachable functions.
  *	  Such a clause is not necessarily a true constant: it can still contain
- *	  Params and outer-level Vars.  However, its value will be constant over
+ *	  Params and outer-level Vars.	However, its value will be constant over
  *	  any one scan of the current query, so it can be used as an indexscan
  *	  key or (if a top-level qual) can be pushed up to become a gating qual.
  */
 bool
 is_pseudo_constant_clause(Node *clause)
 {
+
 	/*
 	 * We could implement this check in one recursive scan.  But since the
 	 * check for noncachable functions is both moderately expensive and
@@ -716,7 +717,7 @@ pull_constant_clauses(List *quals, List **constantQual)
 
 	foreach(q, quals)
 	{
-		Node   *qual = (Node *) lfirst(q);
+		Node	   *qual = (Node *) lfirst(q);
 
 		if (is_pseudo_constant_clause(qual))
 			constqual = lappend(constqual, qual);
@@ -1277,8 +1278,8 @@ eval_const_expressions_mutator(Node *node, void *context)
 		arg = eval_const_expressions_mutator(relabel->arg, context);
 
 		/*
-		 * If we find stacked RelabelTypes (eg, from foo :: int :: oid)
-		 * we can discard all but the top one.
+		 * If we find stacked RelabelTypes (eg, from foo :: int :: oid) we
+		 * can discard all but the top one.
 		 */
 		while (arg && IsA(arg, RelabelType))
 			arg = ((RelabelType *) arg)->arg;
@@ -1472,8 +1473,8 @@ simplify_op_or_func(Expr *expr, List *args)
 	 * If the function is strict and has a constant-NULL input, it will
 	 * never be called at all, so we can replace the call by a NULL
 	 * constant even if there are other inputs that aren't constant.
-	 * Otherwise, we can only simplify if all inputs are constants.
-	 * We can skip the function lookup if neither case applies.
+	 * Otherwise, we can only simplify if all inputs are constants. We can
+	 * skip the function lookup if neither case applies.
 	 */
 	if (has_nonconst_input && !has_null_input)
 		return NULL;
@@ -1500,9 +1501,10 @@ simplify_op_or_func(Expr *expr, List *args)
 		funcid = func->funcid;
 		result_typeid = func->functype;
 	}
+
 	/*
-	 * we could use func_iscachable() here, but we need several fields
-	 * out of the func tuple, so might as well just look it up once.
+	 * we could use func_iscachable() here, but we need several fields out
+	 * of the func tuple, so might as well just look it up once.
 	 */
 	func_tuple = SearchSysCache(PROCOID,
 								ObjectIdGetDatum(funcid),
@@ -1530,6 +1532,7 @@ simplify_op_or_func(Expr *expr, List *args)
 	 */
 	if (proisstrict && has_null_input)
 	{
+
 		/*
 		 * It's strict and has NULL input, so must produce NULL output.
 		 * Return a NULL constant of the right type.
@@ -1538,9 +1541,9 @@ simplify_op_or_func(Expr *expr, List *args)
 	}
 
 	/*
-	 * Otherwise, can simplify only if all inputs are constants.
-	 * (For a non-strict function, constant NULL inputs are treated
-	 * the same as constant non-NULL inputs.)
+	 * Otherwise, can simplify only if all inputs are constants. (For a
+	 * non-strict function, constant NULL inputs are treated the same as
+	 * constant non-NULL inputs.)
 	 */
 	if (has_nonconst_input)
 		return NULL;
@@ -1565,10 +1568,10 @@ simplify_op_or_func(Expr *expr, List *args)
 	get_typlenbyval(result_typeid, &resultTypLen, &resultTypByVal);
 
 	/*
-	 * It is OK to pass a dummy econtext because none of the ExecEvalExpr()
-	 * code used in this situation will use econtext.  That might seem
-	 * fortuitous, but it's not so unreasonable --- a constant expression
-	 * does not depend on context, by definition, n'est ce pas?
+	 * It is OK to pass a dummy econtext because none of the
+	 * ExecEvalExpr() code used in this situation will use econtext.  That
+	 * might seem fortuitous, but it's not so unreasonable --- a constant
+	 * expression does not depend on context, by definition, n'est ce pas?
 	 */
 	econtext = MakeExprContext(NULL, CurrentMemoryContext);
 
@@ -1657,10 +1660,10 @@ simplify_op_or_func(Expr *expr, List *args)
  * expression_tree_walker itself is called on a Query node, it does nothing
  * and returns "false".  The net effect is that unless the walker does
  * something special at a Query node, sub-selects will not be visited
- * during an expression tree walk.  This is exactly the behavior wanted
+ * during an expression tree walk.	This is exactly the behavior wanted
  * in many cases --- and for those walkers that do want to recurse into
  * sub-selects, special behavior is typically needed anyway at the entry
- * to a sub-select (such as incrementing a depth counter).  A walker that
+ * to a sub-select (such as incrementing a depth counter).	A walker that
  * wants to examine sub-selects should include code along the lines of:
  *
  *		if (IsA(node, Query))
@@ -1780,9 +1783,10 @@ expression_tree_walker(Node *node,
 				/*
 				 * If the SubLink has already been processed by
 				 * subselect.c, it will have lefthand=NIL, and we need to
-				 * scan the oper list.  Otherwise we only need to look at
-				 * the lefthand list (the incomplete Oper nodes in the oper
-				 * list are deemed uninteresting, perhaps even confusing).
+				 * scan the oper list.	Otherwise we only need to look at
+				 * the lefthand list (the incomplete Oper nodes in the
+				 * oper list are deemed uninteresting, perhaps even
+				 * confusing).
 				 */
 				if (sublink->lefthand)
 				{
@@ -1794,9 +1798,10 @@ expression_tree_walker(Node *node,
 					if (walker((Node *) sublink->oper, context))
 						return true;
 				}
+
 				/*
-				 * Also invoke the walker on the sublink's Query node,
-				 * so it can recurse into the sub-query if it wants to.
+				 * Also invoke the walker on the sublink's Query node, so
+				 * it can recurse into the sub-query if it wants to.
 				 */
 				return walker(sublink->subselect, context);
 			}
@@ -1815,7 +1820,7 @@ expression_tree_walker(Node *node,
 			return walker(((TargetEntry *) node)->expr, context);
 		case T_FromExpr:
 			{
-				FromExpr    *from = (FromExpr *) node;
+				FromExpr   *from = (FromExpr *) node;
 
 				if (walker(from->fromlist, context))
 					return true;
@@ -1825,7 +1830,7 @@ expression_tree_walker(Node *node,
 			break;
 		case T_JoinExpr:
 			{
-				JoinExpr    *join = (JoinExpr *) node;
+				JoinExpr   *join = (JoinExpr *) node;
 
 				if (walker(join->larg, context))
 					return true;
@@ -1835,7 +1840,9 @@ expression_tree_walker(Node *node,
 					return true;
 				if (walker((Node *) join->colvars, context))
 					return true;
-				/* alias clause, using list, colnames list are deemed
+
+				/*
+				 * alias clause, using list, colnames list are deemed
 				 * uninteresting.
 				 */
 			}
@@ -1890,7 +1897,7 @@ query_tree_walker(Query *query,
 		return true;
 	if (visitQueryRTEs)
 	{
-		List   *rt;
+		List	   *rt;
 
 		foreach(rt, query->rtable)
 		{
@@ -2176,8 +2183,8 @@ expression_tree_mutator(Node *node,
 			break;
 		case T_FromExpr:
 			{
-				FromExpr *from = (FromExpr *) node;
-				FromExpr *newnode;
+				FromExpr   *from = (FromExpr *) node;
+				FromExpr   *newnode;
 
 				FLATCOPY(newnode, from, FromExpr);
 				MUTATE(newnode->fromlist, from->fromlist, List *);
@@ -2187,8 +2194,8 @@ expression_tree_mutator(Node *node,
 			break;
 		case T_JoinExpr:
 			{
-				JoinExpr *join = (JoinExpr *) node;
-				JoinExpr *newnode;
+				JoinExpr   *join = (JoinExpr *) node;
+				JoinExpr   *newnode;
 
 				FLATCOPY(newnode, join, JoinExpr);
 				MUTATE(newnode->larg, join->larg, Node *);
@@ -2226,7 +2233,7 @@ expression_tree_mutator(Node *node,
  * This routine exists just to reduce the number of places that need to know
  * where all the expression subtrees of a Query are.  Note it can be used
  * for starting a walk at top level of a Query regardless of whether the
- * mutator intends to descend into subqueries.  It is also useful for
+ * mutator intends to descend into subqueries.	It is also useful for
  * descending into subqueries within a mutator.
  *
  * The specified Query node is modified-in-place; do a FLATCOPY() beforehand
@@ -2252,8 +2259,8 @@ query_tree_mutator(Query *query,
 	MUTATE(query->havingQual, query->havingQual, Node *);
 	if (visitQueryRTEs)
 	{
-		List   *newrt = NIL;
-		List   *rt;
+		List	   *newrt = NIL;
+		List	   *rt;
 
 		foreach(rt, query->rtable)
 		{
diff --git a/src/backend/optimizer/util/joininfo.c b/src/backend/optimizer/util/joininfo.c
index 81bb3bb9e8818bc9cdb187945121d697673910d4..ec98dbcb24fa8025296afb48f8aafb8581807c71 100644
--- a/src/backend/optimizer/util/joininfo.c
+++ b/src/backend/optimizer/util/joininfo.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.28 2001/01/24 19:43:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.29 2001/03/22 03:59:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@ static JoinInfo *joininfo_member(List *join_relids, List *joininfo_list);
  * exists.
  *
  */
-static JoinInfo   *
+static JoinInfo *
 joininfo_member(List *join_relids, List *joininfo_list)
 {
 	List	   *i;
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 1a0dfc67df7b8f420eb804793c8606c3db2e5102..cfba3ee395f2e0216f74c1e2497a7a8f5897d74b 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.70 2001/01/24 19:43:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.71 2001/03/22 03:59:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -192,7 +192,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
 	 * possible for more than one old path to be tossed out because
 	 * new_path dominates it.
 	 */
-	p1 = parent_rel->pathlist;			/* cannot use foreach here */
+	p1 = parent_rel->pathlist;	/* cannot use foreach here */
 	while (p1 != NIL)
 	{
 		Path	   *old_path = (Path *) lfirst(p1);
@@ -243,7 +243,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
 		 */
 		if (remove_old && parent_rel->pruneable)
 		{
-			List   *p1_next = lnext(p1);
+			List	   *p1_next = lnext(p1);
 
 			if (p1_prev)
 				lnext(p1_prev) = p1_next;
@@ -409,14 +409,15 @@ create_append_path(RelOptInfo *rel, List *subpaths)
 
 	pathnode->path.pathtype = T_Append;
 	pathnode->path.parent = rel;
-	pathnode->path.pathkeys = NIL; /* result is always considered unsorted */
+	pathnode->path.pathkeys = NIL;		/* result is always considered
+										 * unsorted */
 	pathnode->subpaths = subpaths;
 
 	pathnode->path.startup_cost = 0;
 	pathnode->path.total_cost = 0;
 	foreach(l, subpaths)
 	{
-		Path   *subpath = (Path *) lfirst(l);
+		Path	   *subpath = (Path *) lfirst(l);
 
 		if (l == subpaths)		/* first node? */
 			pathnode->path.startup_cost = subpath->startup_cost;
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index e4c3a077a3036c468c7c2aa46f1f0a58f7860a34..4f711df203c846acf4402ed131def54dbbf94443 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.63 2001/01/24 19:43:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.64 2001/03/22 03:59:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -83,8 +83,8 @@ find_secondary_indexes(Oid relationObjectId)
 	Relation	relation;
 
 	/*
-	 * We used to scan pg_index directly, but now the relcache offers
-	 * a cached list of OID indexes for each relation.  So, get that list
+	 * We used to scan pg_index directly, but now the relcache offers a
+	 * cached list of OID indexes for each relation.  So, get that list
 	 * and then use the syscache to obtain pg_index entries.
 	 */
 	relation = heap_open(relationObjectId, AccessShareLock);
@@ -126,7 +126,7 @@ find_secondary_indexes(Oid relationObjectId)
 			char	   *predString;
 
 			predString = DatumGetCString(DirectFunctionCall1(textout,
-											PointerGetDatum(&index->indpred)));
+									  PointerGetDatum(&index->indpred)));
 			info->indpred = (List *) stringToNode(predString);
 			pfree(predString);
 		}
@@ -213,11 +213,11 @@ restriction_selectivity(Oid functionObjectId,
 	float8		result;
 
 	result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
-							ObjectIdGetDatum(operatorObjectId),
-							ObjectIdGetDatum(relationObjectId),
-							Int16GetDatum(attributeNumber),
-							constValue,
-							Int32GetDatum(constFlag)));
+									  ObjectIdGetDatum(operatorObjectId),
+									  ObjectIdGetDatum(relationObjectId),
+										  Int16GetDatum(attributeNumber),
+											 constValue,
+											 Int32GetDatum(constFlag)));
 
 	if (result < 0.0 || result > 1.0)
 		elog(ERROR, "restriction_selectivity: bad value %f", result);
@@ -246,11 +246,11 @@ join_selectivity(Oid functionObjectId,
 	float8		result;
 
 	result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
-							ObjectIdGetDatum(operatorObjectId),
-							ObjectIdGetDatum(relationObjectId1),
-							Int16GetDatum(attributeNumber1),
-							ObjectIdGetDatum(relationObjectId2),
-							Int16GetDatum(attributeNumber2)));
+									  ObjectIdGetDatum(operatorObjectId),
+									 ObjectIdGetDatum(relationObjectId1),
+										 Int16GetDatum(attributeNumber1),
+									 ObjectIdGetDatum(relationObjectId2),
+									   Int16GetDatum(attributeNumber2)));
 
 	if (result < 0.0 || result > 1.0)
 		elog(ERROR, "join_selectivity: bad value %f", result);
@@ -277,13 +277,13 @@ find_inheritance_children(Oid inhparent)
 	HeapScanDesc scan;
 	HeapTuple	inheritsTuple;
 	Oid			inhrelid;
-	ScanKeyData	key[1];
+	ScanKeyData key[1];
 
 	/*
-	 * Can skip the scan if pg_class shows the relation has never had
-	 * a subclass.
+	 * Can skip the scan if pg_class shows the relation has never had a
+	 * subclass.
 	 */
-	if (! has_subclass(inhparent))
+	if (!has_subclass(inhparent))
 		return NIL;
 
 	ScanKeyEntryInitialize(&key[0],
@@ -306,7 +306,7 @@ find_inheritance_children(Oid inhparent)
 /*
  * has_subclass
  *
- * In the current implementation, has_subclass returns whether a 
+ * In the current implementation, has_subclass returns whether a
  * particular class *might* have a subclass. It will not return the
  * correct result if a class had a subclass which was later dropped.
  * This is because relhassubclass in pg_class is not updated when a
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index b9296fdfa0053fc2adc5ffb6f7f3279034b5b572..9d5d6c080e7fc5f1cf57e900e86d26d8722751d7 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.49 2001/01/24 19:43:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.50 2001/03/22 03:59:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,6 +60,7 @@ matching_tlist_expr(Node *node, List *targetlist)
 
 	return (Node *) NULL;
 }
+
 #endif
 
 /*
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 1347bd9a5223f77cd7c0591b6fcf1d803e6474af..cac0eee8276a9ff8131e6995cfa3e35f39e490a1 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.29 2001/01/24 19:43:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.30 2001/03/22 03:59:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@ typedef struct
 } pull_var_clause_context;
 
 static bool pull_varnos_walker(Node *node,
-							   pull_varnos_context *context);
+				   pull_varnos_context *context);
 static bool contain_var_clause_walker(Node *node, void *context);
 static bool pull_var_clause_walker(Node *node,
 					   pull_var_clause_context *context);
@@ -90,15 +90,16 @@ pull_varnos_walker(Node *node, pull_varnos_context *context)
 	}
 	if (is_subplan(node))
 	{
+
 		/*
-		 * Already-planned subquery.  Examine the args list (parameters
-		 * to be passed to subquery), as well as the "oper" list which
-		 * is executed by the outer query.  But short-circuit recursion into
+		 * Already-planned subquery.  Examine the args list (parameters to
+		 * be passed to subquery), as well as the "oper" list which is
+		 * executed by the outer query.  But short-circuit recursion into
 		 * the subquery itself, which would be a waste of effort.
 		 */
 		Expr	   *expr = (Expr *) node;
 
-		if (pull_varnos_walker((Node*) ((SubPlan*) expr->oper)->sublink->oper,
+		if (pull_varnos_walker((Node *) ((SubPlan *) expr->oper)->sublink->oper,
 							   context))
 			return true;
 		if (pull_varnos_walker((Node *) expr->args,
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index ba0a3cfa348b7ed29f931a56e3c156446c8b9177..a502cea5d6762b29ce8b16517676eb98953361ba 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.181 2001/02/15 01:10:28 tgl Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.182 2001/03/22 03:59:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -228,7 +228,7 @@ transformStmt(ParseState *pstate, Node *parseTree)
 											 (SelectStmt *) parseTree);
 			else
 				result = transformSetOperationStmt(pstate,
-												   (SelectStmt *) parseTree);
+											   (SelectStmt *) parseTree);
 			break;
 
 		default:
@@ -302,11 +302,11 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	/*
 	 * If a non-nil rangetable/namespace was passed in, and we are doing
 	 * INSERT/SELECT, arrange to pass the rangetable/namespace down to the
-	 * SELECT.  This can only happen if we are inside a CREATE RULE,
-	 * and in that case we want the rule's OLD and NEW rtable entries to
+	 * SELECT.	This can only happen if we are inside a CREATE RULE, and
+	 * in that case we want the rule's OLD and NEW rtable entries to
 	 * appear as part of the SELECT's rtable, not as outer references for
-	 * it.  (Kluge!)  The SELECT's joinlist is not affected however.
-	 * We must do this before adding the target table to the INSERT's rtable.
+	 * it.	(Kluge!)  The SELECT's joinlist is not affected however. We
+	 * must do this before adding the target table to the INSERT's rtable.
 	 */
 	if (stmt->selectStmt)
 	{
@@ -324,7 +324,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	/*
 	 * Must get write lock on INSERT target table before scanning SELECT,
 	 * else we will grab the wrong kind of initial lock if the target
-	 * table is also mentioned in the SELECT part.  Note that the target
+	 * table is also mentioned in the SELECT part.	Note that the target
 	 * table is not added to the joinlist or namespace.
 	 */
 	qry->resultRelation = setTargetTable(pstate, stmt->relname,
@@ -336,17 +336,17 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	if (stmt->selectStmt)
 	{
 		ParseState *sub_pstate = make_parsestate(pstate->parentParseState);
-		Query  *selectQuery;
+		Query	   *selectQuery;
 		RangeTblEntry *rte;
 		RangeTblRef *rtr;
 
 		/*
 		 * Process the source SELECT.
 		 *
-		 * It is important that this be handled just like a standalone SELECT;
-		 * otherwise the behavior of SELECT within INSERT might be different
-		 * from a stand-alone SELECT. (Indeed, Postgres up through 6.5 had
-		 * bugs of just that nature...)
+		 * It is important that this be handled just like a standalone
+		 * SELECT; otherwise the behavior of SELECT within INSERT might be
+		 * different from a stand-alone SELECT. (Indeed, Postgres up
+		 * through 6.5 had bugs of just that nature...)
 		 */
 		sub_pstate->p_rtable = sub_rtable;
 		sub_pstate->p_namespace = sub_namespace;
@@ -360,9 +360,10 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 		Assert(selectQuery->commandType == CMD_SELECT);
 		if (selectQuery->into || selectQuery->isPortal)
 			elog(ERROR, "INSERT ... SELECT may not specify INTO");
+
 		/*
-		 * Make the source be a subquery in the INSERT's rangetable,
-		 * and add it to the INSERT's joinlist.
+		 * Make the source be a subquery in the INSERT's rangetable, and
+		 * add it to the INSERT's joinlist.
 		 */
 		rte = addRangeTableEntryForSubquery(pstate,
 											selectQuery,
@@ -373,18 +374,19 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 		rtr->rtindex = length(pstate->p_rtable);
 		Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
 		pstate->p_joinlist = lappend(pstate->p_joinlist, rtr);
+
 		/*
-		 * Generate a targetlist for the INSERT that selects all
-		 * the non-resjunk columns from the subquery.  (We need this to
-		 * be separate from the subquery's tlist because we may add
-		 * columns, insert datatype coercions, etc.)
+		 * Generate a targetlist for the INSERT that selects all the
+		 * non-resjunk columns from the subquery.  (We need this to be
+		 * separate from the subquery's tlist because we may add columns,
+		 * insert datatype coercions, etc.)
 		 *
 		 * HACK: constants in the INSERT's targetlist are copied up as-is
-		 * rather than being referenced as subquery outputs.  This is mainly
-		 * to ensure that when we try to coerce them to the target column's
-		 * datatype, the right things happen for UNKNOWN constants.
-		 * Otherwise this fails:
-		 *		INSERT INTO foo SELECT 'bar', ... FROM baz
+		 * rather than being referenced as subquery outputs.  This is
+		 * mainly to ensure that when we try to coerce them to the target
+		 * column's datatype, the right things happen for UNKNOWN
+		 * constants. Otherwise this fails: INSERT INTO foo SELECT 'bar',
+		 * ... FROM baz
 		 */
 		qry->targetList = NIL;
 		foreach(tl, selectQuery->targetList)
@@ -411,9 +413,10 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	}
 	else
 	{
+
 		/*
-		 * For INSERT ... VALUES, transform the given list of values
-		 * to form a targetlist for the INSERT.
+		 * For INSERT ... VALUES, transform the given list of values to
+		 * form a targetlist for the INSERT.
 		 */
 		qry->targetList = transformTargetList(pstate, stmt->targetList);
 	}
@@ -466,8 +469,8 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
 	 * have defaults and were not assigned to by the user.
 	 *
 	 * XXX wouldn't it make more sense to do this further downstream, after
-	 * the rule rewriter?  As is, altering a column default will not change
-	 * the behavior of INSERTs in already-defined rules.
+	 * the rule rewriter?  As is, altering a column default will not
+	 * change the behavior of INSERTs in already-defined rules.
 	 */
 	rd_att = pstate->p_target_relation->rd_att;
 	if (rd_att->constr && rd_att->constr->num_defval > 0)
@@ -618,8 +621,8 @@ CreateIndexName(char *table_name, char *column_name,
 	 * The type name for makeObjectName is label, or labelN if that's
 	 * necessary to prevent collisions among multiple indexes for the same
 	 * table.  Note there is no check for collisions with already-existing
-	 * indexes, only among the indexes we're about to create now; this ought
-	 * to be improved someday.
+	 * indexes, only among the indexes we're about to create now; this
+	 * ought to be improved someday.
 	 */
 	strcpy(typename, label);
 
@@ -748,7 +751,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 					constraint = makeNode(Constraint);
 					constraint->contype = CONSTR_UNIQUE;
-					constraint->name = NULL; /* assign later */
+					constraint->name = NULL;	/* assign later */
 					column->constraints = lappend(column->constraints,
 												  constraint);
 
@@ -948,7 +951,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 		else if (constraint->contype == CONSTR_PRIMARY)
 			index->idxname = makeObjectName(stmt->relname, NULL, "pkey");
 		else
-			index->idxname = NULL; /* will set it later */
+			index->idxname = NULL;		/* will set it later */
 
 		index->relname = stmt->relname;
 		index->accessMethod = "btree";
@@ -956,9 +959,9 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 		index->withClause = NIL;
 		index->whereClause = NULL;
 
-		foreach (keys, constraint->keys)
+		foreach(keys, constraint->keys)
 		{
-			bool	found = false;
+			bool		found = false;
 
 			key = (Ident *) lfirst(keys);
 			Assert(IsA(key, Ident));
@@ -982,14 +985,14 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 			else
 			{
 				/* try inherited tables */
-				List *inhRelnames = stmt->inhRelnames;
-				List *inher;
+				List	   *inhRelnames = stmt->inhRelnames;
+				List	   *inher;
 
-				foreach (inher, inhRelnames)
+				foreach(inher, inhRelnames)
 				{
-					Value *inh = lfirst(inher);
-					Relation rel;
-					int count;
+					Value	   *inh = lfirst(inher);
+					Relation	rel;
+					int			count;
 
 					Assert(IsA(inh, String));
 					rel = heap_openr(strVal(inh), AccessShareLock);
@@ -999,26 +1002,28 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 					for (count = 0; count < rel->rd_att->natts; count++)
 					{
 						Form_pg_attribute inhattr = rel->rd_att->attrs[count];
-						char *inhname = NameStr(inhattr->attname);
+						char	   *inhname = NameStr(inhattr->attname);
 
 						if (strcmp(key->name, inhname) == 0)
 						{
 							found = true;
+
 							/*
-							 * If the column is inherited, we currently have
-							 * no easy way to force it to be NOT NULL.
-							 * Only way I can see to fix this would be to
-							 * convert the inherited-column info to ColumnDef
-							 * nodes before we reach this point, and then
-							 * create the table from those nodes rather than
-							 * referencing the parent tables later.  That
-							 * would likely be cleaner, but too much work
-							 * to contemplate right now.  Instead, raise an
-							 * error if the inherited column won't be NOT NULL.
-							 * (Would a NOTICE be more reasonable?)
+							 * If the column is inherited, we currently
+							 * have no easy way to force it to be NOT
+							 * NULL. Only way I can see to fix this would
+							 * be to convert the inherited-column info to
+							 * ColumnDef nodes before we reach this point,
+							 * and then create the table from those nodes
+							 * rather than referencing the parent tables
+							 * later.  That would likely be cleaner, but
+							 * too much work to contemplate right now.
+							 * Instead, raise an error if the inherited
+							 * column won't be NOT NULL. (Would a NOTICE
+							 * be more reasonable?)
 							 */
 							if (constraint->contype == CONSTR_PRIMARY &&
-								! inhattr->attnotnull)
+								!inhattr->attnotnull)
 								elog(ERROR, "inherited attribute \"%s\" cannot be a PRIMARY KEY because it is not marked NOT NULL",
 									 inhname);
 							break;
@@ -1047,10 +1052,10 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 	/*
 	 * Scan the index list and remove any redundant index specifications.
-	 * This can happen if, for instance, the user writes SERIAL PRIMARY KEY
-	 * or SERIAL UNIQUE.  A strict reading of SQL92 would suggest raising
-	 * an error instead, but that strikes me as too anal-retentive.
-	 * - tgl 2001-02-14
+	 * This can happen if, for instance, the user writes SERIAL PRIMARY
+	 * KEY or SERIAL UNIQUE.  A strict reading of SQL92 would suggest
+	 * raising an error instead, but that strikes me as too
+	 * anal-retentive. - tgl 2001-02-14
 	 */
 	dlist = ilist;
 	ilist = NIL;
@@ -1075,12 +1080,13 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 				if (equal(index->indexParams, priorindex->indexParams))
 				{
+
 					/*
 					 * If the prior index is as yet unnamed, and this one
-					 * is named, then transfer the name to the prior index.
-					 * This ensures that if we have named and unnamed
-					 * constraints, we'll use (at least one of) the names
-					 * for the index.
+					 * is named, then transfer the name to the prior
+					 * index. This ensures that if we have named and
+					 * unnamed constraints, we'll use (at least one of)
+					 * the names for the index.
 					 */
 					if (priorindex->idxname == NULL)
 						priorindex->idxname = index->idxname;
@@ -1149,46 +1155,57 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 			if (fkconstraint->constr_name == NULL)
 				fkconstraint->constr_name = "<unnamed>";
 
-			/* 
+			/*
 			 * Check to see if the attributes mentioned by the constraint
 			 * actually exist on this table.
 			 */
-			if (fkconstraint->fk_attrs!=NIL) {
-				int found=0;
-				List *cols;
-				List *fkattrs;
-				Ident *fkattr = NULL;
-				ColumnDef *col;
-				foreach(fkattrs, fkconstraint->fk_attrs) {
-					found=0;
-					fkattr=lfirst(fkattrs);
-					foreach(cols, stmt->tableElts) {
-						col=lfirst(cols);
-						if (strcmp(col->colname, fkattr->name)==0) {
-							found=1;
+			if (fkconstraint->fk_attrs != NIL)
+			{
+				int			found = 0;
+				List	   *cols;
+				List	   *fkattrs;
+				Ident	   *fkattr = NULL;
+				ColumnDef  *col;
+
+				foreach(fkattrs, fkconstraint->fk_attrs)
+				{
+					found = 0;
+					fkattr = lfirst(fkattrs);
+					foreach(cols, stmt->tableElts)
+					{
+						col = lfirst(cols);
+						if (strcmp(col->colname, fkattr->name) == 0)
+						{
+							found = 1;
 							break;
 						}
 					}
 					if (!found)
 						break;
 				}
-				if (!found) { /* try inherited tables */
-					List *inher;
-					List *inhRelnames=stmt->inhRelnames;
-					Relation rel;
-					foreach (inher, inhRelnames) {
-						Value *inh=lfirst(inher);
-						int count;
+				if (!found)
+				{				/* try inherited tables */
+					List	   *inher;
+					List	   *inhRelnames = stmt->inhRelnames;
+					Relation	rel;
+
+					foreach(inher, inhRelnames)
+					{
+						Value	   *inh = lfirst(inher);
+						int			count;
 
 						Assert(IsA(inh, String));
-						rel=heap_openr(strVal(inh), AccessShareLock);
+						rel = heap_openr(strVal(inh), AccessShareLock);
 						if (rel->rd_rel->relkind != RELKIND_RELATION)
 							elog(ERROR, "inherited table \"%s\" is not a relation",
-								strVal(inh));
-						for (count = 0; count < rel->rd_att->natts; count++) {
-							char *name=NameStr(rel->rd_att->attrs[count]->attname);
-							if (strcmp(fkattr->name, name) == 0) {
-								found=1;
+								 strVal(inh));
+						for (count = 0; count < rel->rd_att->natts; count++)
+						{
+							char	   *name = NameStr(rel->rd_att->attrs[count]->attname);
+
+							if (strcmp(fkattr->name, name) == 0)
+							{
+								found = 1;
 								break;
 							}
 						}
@@ -1197,9 +1214,8 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 							break;
 					}
 				}
-				else {
-					found=1;
-				}
+				else
+					found = 1;
 				if (!found)
 					elog(ERROR, "columns referenced in foreign key constraint not found.");
 			}
@@ -1238,35 +1254,44 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 						 fkconstraint->pktable_name);
 				}
 			}
-			else {
-				if (strcmp(fkconstraint->pktable_name, stmt->relname)!=0)
+			else
+			{
+				if (strcmp(fkconstraint->pktable_name, stmt->relname) != 0)
 					transformFkeyCheckAttrs(fkconstraint);
-				else {
+				else
+				{
 					/* Get a unique/pk constraint from above */
-					List *index;
-					int found=0;
+					List	   *index;
+					int			found = 0;
+
 					foreach(index, ilist)
 					{
-						IndexStmt *ind=lfirst(index);
-						IndexElem *indparm;
-						List *indparms;
-						List *pkattrs;
-						Ident *pkattr;
-						if (ind->unique) {
-							int count=0;
-							foreach(indparms, ind->indexParams) {
+						IndexStmt  *ind = lfirst(index);
+						IndexElem  *indparm;
+						List	   *indparms;
+						List	   *pkattrs;
+						Ident	   *pkattr;
+
+						if (ind->unique)
+						{
+							int			count = 0;
+
+							foreach(indparms, ind->indexParams)
 								count++;
-							}
-							if (count!=length(fkconstraint->pk_attrs))
-								found=0;
-							else {
-								foreach(pkattrs, fkconstraint->pk_attrs) {
-									found=0;
-									pkattr=lfirst(pkattrs);
-									foreach(indparms, ind->indexParams) {
-										indparm=lfirst(indparms);
-										if (strcmp(indparm->name, pkattr->name)==0) {
-											found=1;
+							if (count != length(fkconstraint->pk_attrs))
+								found = 0;
+							else
+							{
+								foreach(pkattrs, fkconstraint->pk_attrs)
+								{
+									found = 0;
+									pkattr = lfirst(pkattrs);
+									foreach(indparms, ind->indexParams)
+									{
+										indparm = lfirst(indparms);
+										if (strcmp(indparm->name, pkattr->name) == 0)
+										{
+											found = 1;
 											break;
 										}
 									}
@@ -1283,6 +1308,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 							 fkconstraint->pktable_name);
 				}
 			}
+
 			/*
 			 * Build a CREATE CONSTRAINT TRIGGER statement for the CHECK
 			 * action.
@@ -1309,13 +1335,13 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 			fk_trigger->args = NIL;
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 			fk_trigger->args = lappend(fk_trigger->args,
 									   makeString(stmt->relname));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 			fk_attr = fkconstraint->fk_attrs;
 			pk_attr = fkconstraint->pk_attrs;
 			if (length(fk_attr) != length(pk_attr))
@@ -1388,13 +1414,13 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 			fk_trigger->args = NIL;
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 			fk_trigger->args = lappend(fk_trigger->args,
 									   makeString(stmt->relname));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 			fk_attr = fkconstraint->fk_attrs;
 			pk_attr = fkconstraint->pk_attrs;
 			while (fk_attr != NIL)
@@ -1461,13 +1487,13 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
 
 			fk_trigger->args = NIL;
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 			fk_trigger->args = lappend(fk_trigger->args,
 									   makeString(stmt->relname));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 			fk_trigger->args = lappend(fk_trigger->args,
-									   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 			fk_attr = fkconstraint->fk_attrs;
 			pk_attr = fkconstraint->pk_attrs;
 			while (fk_attr != NIL)
@@ -1558,18 +1584,18 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 
 	/*
 	 * To avoid deadlock, make sure the first thing we do is grab
-	 * AccessExclusiveLock on the target relation.  This will be
-	 * needed by DefineQueryRewrite(), and we don't want to grab a lesser
-	 * lock beforehand.  We don't need to hold a refcount on the relcache
+	 * AccessExclusiveLock on the target relation.	This will be needed by
+	 * DefineQueryRewrite(), and we don't want to grab a lesser lock
+	 * beforehand.	We don't need to hold a refcount on the relcache
 	 * entry, however.
 	 */
 	heap_close(heap_openr(stmt->object->relname, AccessExclusiveLock),
 			   NoLock);
 
 	/*
-	 * NOTE: 'OLD' must always have a varno equal to 1 and 'NEW'
-	 * equal to 2.  Set up their RTEs in the main pstate for use
-	 * in parsing the rule qualification.
+	 * NOTE: 'OLD' must always have a varno equal to 1 and 'NEW' equal to
+	 * 2.  Set up their RTEs in the main pstate for use in parsing the
+	 * rule qualification.
 	 */
 	Assert(pstate->p_rtable == NIL);
 	oldrte = addRangeTableEntry(pstate, stmt->object->relname,
@@ -1581,13 +1607,15 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 	/* Must override addRangeTableEntry's default access-check flags */
 	oldrte->checkForRead = false;
 	newrte->checkForRead = false;
+
 	/*
 	 * They must be in the namespace too for lookup purposes, but only add
 	 * the one(s) that are relevant for the current kind of rule.  In an
 	 * UPDATE rule, quals must refer to OLD.field or NEW.field to be
-	 * unambiguous, but there's no need to be so picky for INSERT & DELETE.
-	 * (Note we marked the RTEs "inFromCl = true" above to allow unqualified
-	 * references to their fields.)  We do not add them to the joinlist.
+	 * unambiguous, but there's no need to be so picky for INSERT &
+	 * DELETE. (Note we marked the RTEs "inFromCl = true" above to allow
+	 * unqualified references to their fields.)  We do not add them to the
+	 * joinlist.
 	 */
 	switch (stmt->event)
 	{
@@ -1613,7 +1641,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 	/* take care of the where clause */
 	stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
 
-	if (length(pstate->p_rtable) != 2) /* naughty, naughty... */
+	if (length(pstate->p_rtable) != 2)	/* naughty, naughty... */
 		elog(ERROR, "Rule WHERE condition may not contain references to other relations");
 
 	/* save info about sublinks in where clause */
@@ -1632,7 +1660,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 
 		nothing_qry->commandType = CMD_NOTHING;
 		nothing_qry->rtable = pstate->p_rtable;
-		nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
+		nothing_qry->jointree = makeFromExpr(NIL, NULL);		/* no join wanted */
 
 		stmt->actions = makeList1(nothing_qry);
 	}
@@ -1652,12 +1680,12 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 						has_new;
 
 			/*
-			 * Set up OLD/NEW in the rtable for this statement.  The entries
-			 * are marked not inFromCl because we don't want them to be
-			 * referred to by unqualified field names nor "*" in the rule
-			 * actions.  We must add them to the namespace, however, or they
-			 * won't be accessible at all.  We decide later whether to put
-			 * them in the joinlist.
+			 * Set up OLD/NEW in the rtable for this statement.  The
+			 * entries are marked not inFromCl because we don't want them
+			 * to be referred to by unqualified field names nor "*" in the
+			 * rule actions.  We must add them to the namespace, however,
+			 * or they won't be accessible at all.  We decide later
+			 * whether to put them in the joinlist.
 			 */
 			oldrte = addRangeTableEntry(sub_pstate, stmt->object->relname,
 										makeAttr("*OLD*", NULL),
@@ -1676,7 +1704,8 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 			/*
 			 * If the action is INSERT...SELECT, OLD/NEW have been pushed
 			 * down into the SELECT, and that's what we need to look at.
-			 * (Ugly kluge ... try to fix this when we redesign querytrees.)
+			 * (Ugly kluge ... try to fix this when we redesign
+			 * querytrees.)
 			 */
 			sub_qry = getInsertSelectQuery(top_subqry, NULL);
 
@@ -1716,19 +1745,21 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 			}
 
 			/*
-			 * For efficiency's sake, add OLD to the rule action's jointree
-			 * only if it was actually referenced in the statement or qual.
+			 * For efficiency's sake, add OLD to the rule action's
+			 * jointree only if it was actually referenced in the
+			 * statement or qual.
 			 *
 			 * For INSERT, NEW is not really a relation (only a reference to
 			 * the to-be-inserted tuple) and should never be added to the
 			 * jointree.
 			 *
 			 * For UPDATE, we treat NEW as being another kind of reference to
-			 * OLD, because it represents references to *transformed* tuples
-			 * of the existing relation.  It would be wrong to enter NEW
-			 * separately in the jointree, since that would cause a double
-			 * join of the updated relation.  It's also wrong to fail to make
-			 * a jointree entry if only NEW and not OLD is mentioned.
+			 * OLD, because it represents references to *transformed*
+			 * tuples of the existing relation.  It would be wrong to
+			 * enter NEW separately in the jointree, since that would
+			 * cause a double join of the updated relation.  It's also
+			 * wrong to fail to make a jointree entry if only NEW and not
+			 * OLD is mentioned.
 			 */
 			if (has_old || (has_new && stmt->event == CMD_UPDATE))
 			{
@@ -1772,12 +1803,12 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
 		if (stmt->forUpdate)
 			elog(ERROR, "DECLARE/UPDATE is not supported"
 				 "\n\tCursors must be READ ONLY");
+
 		/*
-		 *	15 august 1991 -- since 3.0 postgres does locking
-		 *	right, we discovered that portals were violating
-		 *	locking protocol.  portal locks cannot span xacts.
-		 *	as a short-term fix, we installed the check here.
-		 *							-- mao
+		 * 15 august 1991 -- since 3.0 postgres does locking right, we
+		 * discovered that portals were violating locking protocol.
+		 * portal locks cannot span xacts. as a short-term fix, we
+		 * installed the check here. -- mao
 		 */
 		if (!IsTransactionBlock())
 			elog(ERROR, "DECLARE CURSOR may only be used in begin/end transaction blocks");
@@ -1785,7 +1816,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
 		qry->into = stmt->portalname;
 		qry->isTemp = stmt->istemp;
 		qry->isPortal = TRUE;
-		qry->isBinary = stmt->binary; /* internal portal */
+		qry->isBinary = stmt->binary;	/* internal portal */
 	}
 	else
 	{
@@ -1881,8 +1912,8 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 	qry->commandType = CMD_SELECT;
 
 	/*
-	 * Find leftmost leaf SelectStmt; extract the one-time-only items
-	 * from it and from the top-level node.
+	 * Find leftmost leaf SelectStmt; extract the one-time-only items from
+	 * it and from the top-level node.
 	 */
 	leftmostSelect = stmt->larg;
 	while (leftmostSelect && leftmostSelect->op != SETOP_NONE)
@@ -1902,8 +1933,8 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 
 	/*
 	 * These are not one-time, exactly, but we want to process them here
-	 * and not let transformSetOperationTree() see them --- else it'll just
-	 * recurse right back here!
+	 * and not let transformSetOperationTree() see them --- else it'll
+	 * just recurse right back here!
 	 */
 	sortClause = stmt->sortClause;
 	limitOffset = stmt->limitOffset;
@@ -1936,11 +1967,12 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 	leftmostRTI = ((RangeTblRef *) node)->rtindex;
 	leftmostQuery = rt_fetch(leftmostRTI, pstate->p_rtable)->subquery;
 	Assert(leftmostQuery != NULL);
+
 	/*
 	 * Generate dummy targetlist for outer query using column names of
-	 * leftmost select and common datatypes of topmost set operation.
-	 * Also make lists of the dummy vars and their names for use in
-	 * parsing ORDER BY.
+	 * leftmost select and common datatypes of topmost set operation. Also
+	 * make lists of the dummy vars and their names for use in parsing
+	 * ORDER BY.
 	 */
 	qry->targetList = NIL;
 	targetvars = NIL;
@@ -1948,11 +1980,11 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 	lefttl = leftmostQuery->targetList;
 	foreach(dtlist, sostmt->colTypes)
 	{
-		Oid		colType = (Oid) lfirsti(dtlist);
-		Resdom *leftResdom = ((TargetEntry *) lfirst(lefttl))->resdom;
-		char   *colName = pstrdup(leftResdom->resname);
-		Resdom *resdom;
-		Node   *expr;
+		Oid			colType = (Oid) lfirsti(dtlist);
+		Resdom	   *leftResdom = ((TargetEntry *) lfirst(lefttl))->resdom;
+		char	   *colName = pstrdup(leftResdom->resname);
+		Resdom	   *resdom;
+		Node	   *expr;
 
 		resdom = makeResdom((AttrNumber) pstate->p_last_resno++,
 							colType,
@@ -1970,6 +2002,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 		targetnames = lappend(targetnames, makeString(colName));
 		lefttl = lnext(lefttl);
 	}
+
 	/*
 	 * Insert one-time items into top-level query
 	 *
@@ -1983,12 +2016,12 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 		if (forUpdate)
 			elog(ERROR, "DECLARE/UPDATE is not supported"
 				 "\n\tCursors must be READ ONLY");
+
 		/*
-		 *	15 august 1991 -- since 3.0 postgres does locking
-		 *	right, we discovered that portals were violating
-		 *	locking protocol.  portal locks cannot span xacts.
-		 *	as a short-term fix, we installed the check here.
-		 *							-- mao
+		 * 15 august 1991 -- since 3.0 postgres does locking right, we
+		 * discovered that portals were violating locking protocol.
+		 * portal locks cannot span xacts. as a short-term fix, we
+		 * installed the check here. -- mao
 		 */
 		if (!IsTransactionBlock())
 			elog(ERROR, "DECLARE CURSOR may only be used in begin/end transaction blocks");
@@ -2008,10 +2041,11 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 	}
 
 	/*
-	 * As a first step towards supporting sort clauses that are expressions
-	 * using the output columns, generate a namespace entry that makes the
-	 * output columns visible.  A JoinExpr node is handy for this, since
-	 * we can easily control the Vars generated upon matches.
+	 * As a first step towards supporting sort clauses that are
+	 * expressions using the output columns, generate a namespace entry
+	 * that makes the output columns visible.  A JoinExpr node is handy
+	 * for this, since we can easily control the Vars generated upon
+	 * matches.
 	 *
 	 * Note: we don't yet do anything useful with such cases, but at least
 	 * "ORDER BY upper(foo)" will draw the right error message rather than
@@ -2065,7 +2099,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 static Node *
 transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 {
-	bool	isLeaf;
+	bool		isLeaf;
 
 	Assert(stmt && IsA(stmt, SelectStmt));
 
@@ -2104,9 +2138,9 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 	if (isLeaf)
 	{
 		/* Process leaf SELECT */
-		List   *selectList;
-		Query  *selectQuery;
-		char	selectName[32];
+		List	   *selectList;
+		Query	   *selectQuery;
+		char		selectName[32];
 		RangeTblEntry *rte;
 		RangeTblRef *rtr;
 
@@ -2114,13 +2148,14 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 		 * Transform SelectStmt into a Query.
 		 *
 		 * Note: previously transformed sub-queries don't affect the parsing
-		 * of this sub-query, because they are not in the toplevel pstate's
-		 * namespace list.
+		 * of this sub-query, because they are not in the toplevel
+		 * pstate's namespace list.
 		 */
 		selectList = parse_analyze((Node *) stmt, pstate);
 
 		Assert(length(selectList) == 1);
 		selectQuery = (Query *) lfirst(selectList);
+
 		/*
 		 * Make the leaf query be a subquery in the top-level rangetable.
 		 */
@@ -2130,8 +2165,10 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 											makeAttr(pstrdup(selectName),
 													 NULL),
 											false);
+
 		/*
-		 * Return a RangeTblRef to replace the SelectStmt in the set-op tree.
+		 * Return a RangeTblRef to replace the SelectStmt in the set-op
+		 * tree.
 		 */
 		rtr = makeNode(RangeTblRef);
 		/* assume new rte is at end */
@@ -2143,8 +2180,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 	{
 		/* Process an internal node (set operation node) */
 		SetOperationStmt *op = makeNode(SetOperationStmt);
-		List   *lcoltypes;
-		List   *rcoltypes;
+		List	   *lcoltypes;
+		List	   *rcoltypes;
 		const char *context;
 
 		context = (stmt->op == SETOP_UNION ? "UNION" :
@@ -2159,6 +2196,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 		 */
 		op->larg = transformSetOperationTree(pstate, stmt->larg);
 		op->rarg = transformSetOperationTree(pstate, stmt->rarg);
+
 		/*
 		 * Verify that the two children have the same number of non-junk
 		 * columns, and determine the types of the merged output columns.
@@ -2171,9 +2209,9 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
 		op->colTypes = NIL;
 		while (lcoltypes != NIL)
 		{
-			Oid		lcoltype = (Oid) lfirsti(lcoltypes);
-			Oid		rcoltype = (Oid) lfirsti(rcoltypes);
-			Oid		rescoltype;
+			Oid			lcoltype = (Oid) lfirsti(lcoltypes);
+			Oid			rcoltype = (Oid) lfirsti(rcoltypes);
+			Oid			rescoltype;
 
 			rescoltype = select_common_type(makeListi2(lcoltype, rcoltype),
 											context);
@@ -2197,9 +2235,9 @@ getSetColTypes(ParseState *pstate, Node *node)
 	{
 		RangeTblRef *rtr = (RangeTblRef *) node;
 		RangeTblEntry *rte = rt_fetch(rtr->rtindex, pstate->p_rtable);
-		Query  *selectQuery = rte->subquery;
-		List   *result = NIL;
-		List   *tl;
+		Query	   *selectQuery = rte->subquery;
+		List	   *result = NIL;
+		List	   *tl;
 
 		Assert(selectQuery != NULL);
 		/* Get types of non-junk columns */
@@ -2392,13 +2430,13 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
 
 				fk_trigger->args = NIL;
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 				fk_trigger->args = lappend(fk_trigger->args,
 										   makeString(stmt->relname));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 				fk_attr = fkconstraint->fk_attrs;
 				pk_attr = fkconstraint->pk_attrs;
 				if (length(fk_attr) != length(pk_attr))
@@ -2469,13 +2507,13 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
 
 				fk_trigger->args = NIL;
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 				fk_trigger->args = lappend(fk_trigger->args,
 										   makeString(stmt->relname));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 				fk_attr = fkconstraint->fk_attrs;
 				pk_attr = fkconstraint->pk_attrs;
 				while (fk_attr != NIL)
@@ -2540,13 +2578,13 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
 
 				fk_trigger->args = NIL;
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->constr_name));
+								  makeString(fkconstraint->constr_name));
 				fk_trigger->args = lappend(fk_trigger->args,
 										   makeString(stmt->relname));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->pktable_name));
+								 makeString(fkconstraint->pktable_name));
 				fk_trigger->args = lappend(fk_trigger->args,
-										   makeString(fkconstraint->match_type));
+								   makeString(fkconstraint->match_type));
 				fk_attr = fkconstraint->fk_attrs;
 				pk_attr = fkconstraint->pk_attrs;
 				while (fk_attr != NIL)
@@ -2613,7 +2651,7 @@ transformForUpdate(Query *qry, List *forUpdate)
 			}
 			else
 			{
-				if (!intMember(i, rowMarks)) /* avoid duplicates */
+				if (!intMember(i, rowMarks))	/* avoid duplicates */
 					rowMarks = lappendi(rowMarks, i);
 				rte->checkForWrite = true;
 			}
@@ -2641,7 +2679,7 @@ transformForUpdate(Query *qry, List *forUpdate)
 					}
 					else
 					{
-						if (!intMember(i, rowMarks)) /* avoid duplicates */
+						if (!intMember(i, rowMarks))	/* avoid duplicates */
 							rowMarks = lappendi(rowMarks, i);
 						rte->checkForWrite = true;
 					}
@@ -2662,10 +2700,10 @@ transformForUpdate(Query *qry, List *forUpdate)
  * transformFkeyCheckAttrs -
  *
  *	Try to make sure that the attributes of a referenced table
- *      belong to a unique (or primary key) constraint.
+ *		belong to a unique (or primary key) constraint.
  *
  */
-static void 
+static void
 transformFkeyCheckAttrs(FkConstraint *fkconstraint)
 {
 	Relation	pkrel;
@@ -2696,7 +2734,7 @@ transformFkeyCheckAttrs(FkConstraint *fkconstraint)
 
 	foreach(indexoidscan, indexoidlist)
 	{
-		Oid		indexoid = lfirsti(indexoidscan);
+		Oid			indexoid = lfirsti(indexoidscan);
 		HeapTuple	indexTuple;
 		Form_pg_index indexStruct;
 
@@ -2710,24 +2748,28 @@ transformFkeyCheckAttrs(FkConstraint *fkconstraint)
 
 		if (indexStruct->indisunique)
 		{
-			List *attrl;
+			List	   *attrl;
 
 			for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++);
-			if (i!=length(fkconstraint->pk_attrs))
-				found=false;
-			else {
+			if (i != length(fkconstraint->pk_attrs))
+				found = false;
+			else
+			{
 				/* go through the fkconstraint->pk_attrs list */
 				foreach(attrl, fkconstraint->pk_attrs)
 				{
-					Ident *attr=lfirst(attrl);
+					Ident	   *attr = lfirst(attrl);
+
 					found = false;
 					for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++)
 					{
-						int		pkattno = indexStruct->indkey[i];
-						if (pkattno>0)
+						int			pkattno = indexStruct->indkey[i];
+
+						if (pkattno > 0)
 						{
-							char *name = NameStr(pkrel_attrs[pkattno - 1]->attname);
-							if (strcmp(name, attr->name)==0)
+							char	   *name = NameStr(pkrel_attrs[pkattno - 1]->attname);
+
+							if (strcmp(name, attr->name) == 0)
 							{
 								found = true;
 								break;
@@ -2741,7 +2783,7 @@ transformFkeyCheckAttrs(FkConstraint *fkconstraint)
 		}
 		ReleaseSysCache(indexTuple);
 		if (found)
-			break;		
+			break;
 	}
 	if (!found)
 		elog(ERROR, "UNIQUE constraint matching given keys for referenced table \"%s\" not found",
@@ -2790,7 +2832,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint)
 
 	foreach(indexoidscan, indexoidlist)
 	{
-		Oid		indexoid = lfirsti(indexoidscan);
+		Oid			indexoid = lfirsti(indexoidscan);
 
 		indexTuple = SearchSysCache(INDEXRELID,
 									ObjectIdGetDatum(indexoid),
@@ -2826,7 +2868,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint)
 		Ident	   *pkattr = makeNode(Ident);
 
 		pkattr->name = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(pkrel_attrs[pkattno - 1]->attname))));
+					NameGetDatum(&(pkrel_attrs[pkattno - 1]->attname))));
 		pkattr->indirection = NIL;
 		pkattr->isRel = false;
 
@@ -2935,7 +2977,7 @@ transformConstraintAttrs(List *constraintList)
 static FromExpr *
 makeFromExpr(List *fromlist, Node *quals)
 {
-	FromExpr *f = makeNode(FromExpr);
+	FromExpr   *f = makeNode(FromExpr);
 
 	f->fromlist = fromlist;
 	f->quals = quals;
@@ -2978,19 +3020,20 @@ transformColumnType(ParseState *pstate, ColumnDef *column)
 	}
 
 	/*
-	 * Is this the name of a complex type? If so, implement
-	 * it as a set.
+	 * Is this the name of a complex type? If so, implement it as a set.
 	 *
 	 * XXX this is a hangover from ancient Berkeley code that probably
 	 * doesn't work anymore anyway.
 	 */
-	 if (typeTypeRelid(ctype) != InvalidOid)
-	 {
-		 /* (Eventually add in here that the set can only
-		  * contain one element.)
-		  */
-		 typename->setof = true;
-	 }
-
-	 ReleaseSysCache(ctype);
+	if (typeTypeRelid(ctype) != InvalidOid)
+	{
+
+		/*
+		 * (Eventually add in here that the set can only contain one
+		 * element.)
+		 */
+		typename->setof = true;
+	}
+
+	ReleaseSysCache(ctype);
 }
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index c8f5f2c0e92486893fddb08cf052a879970cd931..402dbfd28ca561a2c9d9ba513e7986dda06ec7df 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.89 2001/02/21 18:53:46 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.90 2001/03/22 03:59:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ static ScanKeyword ScanKeywords[] = {
 	{"aggregate", AGGREGATE},
 	{"all", ALL},
 	{"alter", ALTER},
-	{"analyse", ANALYSE}, /* British spelling */
+	{"analyse", ANALYSE},		/* British spelling */
 	{"analyze", ANALYZE},
 	{"and", AND},
 	{"any", ANY},
@@ -312,16 +312,16 @@ ScanKeywordLookup(char *text)
 		return NULL;
 
 	/*
-	 * Apply an ASCII-only downcasing.  We must not use tolower() since
-	 * it may produce the wrong translation in some locales (eg, Turkish),
+	 * Apply an ASCII-only downcasing.	We must not use tolower() since it
+	 * may produce the wrong translation in some locales (eg, Turkish),
 	 * and we don't trust isupper() very much either.  In an ASCII-based
-	 * encoding the tests against A and Z are sufficient, but we also check
-	 * isupper() so that we will work correctly under EBCDIC.  The actual
-	 * case conversion step should work for either ASCII or EBCDIC.
+	 * encoding the tests against A and Z are sufficient, but we also
+	 * check isupper() so that we will work correctly under EBCDIC.  The
+	 * actual case conversion step should work for either ASCII or EBCDIC.
 	 */
 	for (i = 0; i < len; i++)
 	{
-		char	ch = text[i];
+		char		ch = text[i];
 
 		if (ch >= 'A' && ch <= 'Z' && isupper((unsigned char) ch))
 			ch += 'a' - 'A';
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 5d44bbefbdef44bcddfbd9c49326239bdab53073..cae712c1bbbac44275603471d9ec5f237a0f45b8 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.77 2001/02/16 03:16:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.78 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,17 +39,17 @@
 static char *clauseText[] = {"ORDER BY", "GROUP BY", "DISTINCT ON"};
 
 static void extractUniqueColumns(List *common_colnames,
-								 List *src_colnames, List *src_colvars,
-								 List **res_colnames, List **res_colvars);
+					 List *src_colnames, List *src_colvars,
+					 List **res_colnames, List **res_colvars);
 static Node *transformJoinUsingClause(ParseState *pstate,
-									  List *leftVars, List *rightVars);
+						 List *leftVars, List *rightVars);
 static Node *transformJoinOnClause(ParseState *pstate, JoinExpr *j,
-								   List *containedRels);
+					  List *containedRels);
 static RangeTblRef *transformTableEntry(ParseState *pstate, RangeVar *r);
 static RangeTblRef *transformRangeSubselect(ParseState *pstate,
-											RangeSubselect *r);
+						RangeSubselect *r);
 static Node *transformFromClauseItem(ParseState *pstate, Node *n,
-									 List **containedRels);
+						List **containedRels);
 static TargetEntry *findTargetlistEntry(ParseState *pstate, Node *node,
 					List *tlist, int clause);
 static List *addTargetToSortList(TargetEntry *tle, List *sortlist,
@@ -78,10 +78,10 @@ transformFromClause(ParseState *pstate, List *frmList)
 	List	   *fl;
 
 	/*
-	 * The grammar will have produced a list of RangeVars, RangeSubselects,
-	 * and/or JoinExprs. Transform each one (possibly adding entries to the
-	 * rtable), check for duplicate refnames, and then add it to the joinlist
-	 * and namespace.
+	 * The grammar will have produced a list of RangeVars,
+	 * RangeSubselects, and/or JoinExprs. Transform each one (possibly
+	 * adding entries to the rtable), check for duplicate refnames, and
+	 * then add it to the joinlist and namespace.
 	 */
 	foreach(fl, frmList)
 	{
@@ -126,11 +126,11 @@ setTargetTable(ParseState *pstate, char *relname,
 		heap_close(pstate->p_target_relation, NoLock);
 
 	/*
-	 * Open target rel and grab suitable lock (which we will hold till
-	 * end of transaction).
+	 * Open target rel and grab suitable lock (which we will hold till end
+	 * of transaction).
 	 *
-	 * analyze.c will eventually do the corresponding heap_close(),
-	 * but *not* release the lock.
+	 * analyze.c will eventually do the corresponding heap_close(), but *not*
+	 * release the lock.
 	 */
 	pstate->p_target_relation = heap_openr(relname, RowExclusiveLock);
 
@@ -148,10 +148,10 @@ setTargetTable(ParseState *pstate, char *relname,
 	 * Override addRangeTableEntry's default checkForRead, and instead
 	 * mark target table as requiring write access.
 	 *
-	 * If we find an explicit reference to the rel later during
-	 * parse analysis, scanRTEForColumn will change checkForRead
-	 * to 'true' again.  That can't happen for INSERT but it is
-	 * possible for UPDATE and DELETE.
+	 * If we find an explicit reference to the rel later during parse
+	 * analysis, scanRTEForColumn will change checkForRead to 'true'
+	 * again.  That can't happen for INSERT but it is possible for UPDATE
+	 * and DELETE.
 	 */
 	rte->checkForRead = false;
 	rte->checkForWrite = true;
@@ -169,7 +169,7 @@ setTargetTable(ParseState *pstate, char *relname,
  * Simplify InhOption (yes/no/default) into boolean yes/no.
  *
  * The reason we do things this way is that we don't want to examine the
- * SQL_inheritance option flag until parse_analyze is run.  Otherwise,
+ * SQL_inheritance option flag until parse_analyze is run.	Otherwise,
  * we'd do the wrong thing with query strings that intermix SET commands
  * with queries.
  */
@@ -178,7 +178,7 @@ interpretInhOption(InhOption inhOpt)
 {
 	switch (inhOpt)
 	{
-		case INH_NO:
+			case INH_NO:
 			return false;
 		case INH_YES:
 			return true;
@@ -246,7 +246,7 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
 
 	/*
 	 * We cheat a little bit here by building an untransformed operator
-	 * tree whose leaves are the already-transformed Vars.  This is OK
+	 * tree whose leaves are the already-transformed Vars.	This is OK
 	 * because transformExpr() won't complain about already-transformed
 	 * subnodes.
 	 */
@@ -288,7 +288,11 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
 
 	if (exprType(result) != BOOLOID)
 	{
-		/* This could only happen if someone defines a funny version of '=' */
+
+		/*
+		 * This could only happen if someone defines a funny version of
+		 * '='
+		 */
 		elog(ERROR, "JOIN/USING clause must return type bool, not type %s",
 			 typeidTypeName(exprType(result)));
 	}
@@ -312,11 +316,12 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
 	/*
 	 * This is a tad tricky, for two reasons.  First, the namespace that
 	 * the join expression should see is just the two subtrees of the JOIN
-	 * plus any outer references from upper pstate levels.  So, temporarily
-	 * set this pstate's namespace accordingly.  (We need not check for
-	 * refname conflicts, because transformFromClauseItem() already did.)
-	 * NOTE: this code is OK only because the ON clause can't legally alter
-	 * the namespace by causing implicit relation refs to be added.
+	 * plus any outer references from upper pstate levels.	So,
+	 * temporarily set this pstate's namespace accordingly.  (We need not
+	 * check for refname conflicts, because transformFromClauseItem()
+	 * already did.) NOTE: this code is OK only because the ON clause
+	 * can't legally alter the namespace by causing implicit relation refs
+	 * to be added.
 	 */
 	save_namespace = pstate->p_namespace;
 	pstate->p_namespace = makeList2(j->larg, j->rarg);
@@ -333,17 +338,18 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
 
 	/*
 	 * Second, we need to check that the ON condition doesn't refer to any
-	 * rels outside the input subtrees of the JOIN.  It could do that despite
-	 * our hack on the namespace if it uses fully-qualified names.  So, grovel
-	 * through the transformed clause and make sure there are no bogus
-	 * references.  (Outer references are OK, and are ignored here.)
+	 * rels outside the input subtrees of the JOIN.  It could do that
+	 * despite our hack on the namespace if it uses fully-qualified names.
+	 * So, grovel through the transformed clause and make sure there are
+	 * no bogus references.  (Outer references are OK, and are ignored
+	 * here.)
 	 */
 	clause_varnos = pull_varnos(result);
 	foreach(l, clause_varnos)
 	{
-		int		varno = lfirsti(l);
+		int			varno = lfirsti(l);
 
-		if (! intMember(varno, containedRels))
+		if (!intMember(varno, containedRels))
 		{
 			elog(ERROR, "JOIN/ON clause refers to \"%s\", which is not part of JOIN",
 				 rt_fetch(varno, pstate->p_rtable)->eref->relname);
@@ -400,21 +406,21 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
 	RangeTblRef *rtr;
 
 	/*
-	 * We require user to supply an alias for a subselect, per SQL92.
-	 * To relax this, we'd have to be prepared to gin up a unique alias
-	 * for an unlabeled subselect.
+	 * We require user to supply an alias for a subselect, per SQL92. To
+	 * relax this, we'd have to be prepared to gin up a unique alias for
+	 * an unlabeled subselect.
 	 */
 	if (r->name == NULL)
 		elog(ERROR, "sub-select in FROM must have an alias");
 
 	/*
-	 * Analyze and transform the subquery.  This is a bit tricky because
+	 * Analyze and transform the subquery.	This is a bit tricky because
 	 * we don't want the subquery to be able to see any FROM items already
 	 * created in the current query (per SQL92, the scope of a FROM item
-	 * does not include other FROM items).  But it does need to be able to
-	 * see any further-up parent states, so we can't just pass a null parent
-	 * pstate link.  So, temporarily make the current query level have an
-	 * empty namespace.
+	 * does not include other FROM items).	But it does need to be able to
+	 * see any further-up parent states, so we can't just pass a null
+	 * parent pstate link.	So, temporarily make the current query level
+	 * have an empty namespace.
 	 */
 	save_namespace = pstate->p_namespace;
 	pstate->p_namespace = NIL;
@@ -422,7 +428,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
 	pstate->p_namespace = save_namespace;
 
 	/*
-	 * Check that we got something reasonable.  Some of these conditions
+	 * Check that we got something reasonable.	Some of these conditions
 	 * are probably impossible given restrictions of the grammar, but
 	 * check 'em anyway.
 	 */
@@ -513,9 +519,9 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 		*containedRels = nconc(l_containedRels, r_containedRels);
 
 		/*
-		 * Check for conflicting refnames in left and right subtrees.  Must
-		 * do this because higher levels will assume I hand back a self-
-		 * consistent namespace subtree.
+		 * Check for conflicting refnames in left and right subtrees.
+		 * Must do this because higher levels will assume I hand back a
+		 * self- consistent namespace subtree.
 		 */
 		checkNameSpaceConflicts(pstate, j->larg, j->rarg);
 
@@ -556,12 +562,11 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 		}
 
 		/*
-		 * Natural join does not explicitly specify columns; must
-		 * generate columns to join. Need to run through the list of
-		 * columns from each table or join result and match up the
-		 * column names. Use the first table, and check every column
-		 * in the second table for a match.  (We'll check that the
-		 * matches were unique later on.)
+		 * Natural join does not explicitly specify columns; must generate
+		 * columns to join. Need to run through the list of columns from
+		 * each table or join result and match up the column names. Use
+		 * the first table, and check every column in the second table for
+		 * a match.  (We'll check that the matches were unique later on.)
 		 * The result of this step is a list of column names just like an
 		 * explicitly-written USING list.
 		 */
@@ -571,7 +576,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 			List	   *lx,
 					   *rx;
 
-			Assert(j->using == NIL); /* shouldn't have USING() too */
+			Assert(j->using == NIL);	/* shouldn't have USING() too */
 
 			foreach(lx, l_colnames)
 			{
@@ -605,17 +610,18 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 
 		if (j->using)
 		{
+
 			/*
 			 * JOIN/USING (or NATURAL JOIN, as transformed above).
-			 * Transform the list into an explicit ON-condition,
-			 * and generate a list of result columns.
+			 * Transform the list into an explicit ON-condition, and
+			 * generate a list of result columns.
 			 */
 			List	   *ucols = j->using;
 			List	   *l_usingvars = NIL;
 			List	   *r_usingvars = NIL;
 			List	   *ucol;
 
-			Assert(j->quals == NULL); /* shouldn't have ON() too */
+			Assert(j->quals == NULL);	/* shouldn't have ON() too */
 
 			foreach(ucol, ucols)
 			{
@@ -679,22 +685,22 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 						colvar = r_colvar;
 						break;
 					default:
-					{
-						/* Need COALESCE(l_colvar, r_colvar) */
-						CaseExpr *c = makeNode(CaseExpr);
-						CaseWhen *w = makeNode(CaseWhen);
-						A_Expr *a = makeNode(A_Expr);
-
-						a->oper = NOTNULL;
-						a->lexpr = l_colvar;
-						w->expr = (Node *) a;
-						w->result = l_colvar;
-						c->args = makeList1(w);
-						c->defresult = r_colvar;
-						colvar = transformExpr(pstate, (Node *) c,
-											   EXPR_COLUMN_FIRST);
-						break;
-					}
+						{
+							/* Need COALESCE(l_colvar, r_colvar) */
+							CaseExpr   *c = makeNode(CaseExpr);
+							CaseWhen   *w = makeNode(CaseWhen);
+							A_Expr	   *a = makeNode(A_Expr);
+
+							a->oper = NOTNULL;
+							a->lexpr = l_colvar;
+							w->expr = (Node *) a;
+							w->result = l_colvar;
+							c->args = makeList1(w);
+							c->defresult = r_colvar;
+							colvar = transformExpr(pstate, (Node *) c,
+												   EXPR_COLUMN_FIRST);
+							break;
+						}
 				}
 				res_colvars = lappend(res_colvars, colvar);
 			}
@@ -730,6 +736,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 		 */
 		if (j->alias)
 		{
+
 			/*
 			 * If a column alias list is specified, substitute the alias
 			 * names into my output-column list
@@ -751,7 +758,8 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
 	else
 		elog(ERROR, "transformFromClauseItem: unexpected node (internal error)"
 			 "\n\t%s", nodeToString(n));
-	return NULL;				/* can't get here, just keep compiler quiet */
+	return NULL;				/* can't get here, just keep compiler
+								 * quiet */
 }
 
 
@@ -848,8 +856,8 @@ findTargetlistEntry(ParseState *pstate, Node *node, List *tlist, int clause)
 			 * is a matching column.  If so, fall through to let
 			 * transformExpr() do the rest.  NOTE: if name could refer
 			 * ambiguously to more than one column name exposed by FROM,
-			 * colnameToVar will elog(ERROR).  That's just what
-			 * we want here.
+			 * colnameToVar will elog(ERROR).  That's just what we want
+			 * here.
 			 */
 			if (colnameToVar(pstate, name) != NULL)
 				name = NULL;
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 69731ff89e11480307240925ba01e80e07d2bc18..1e7c8af7b0b68d64abf1941bc047e8ec9e594dee 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.55 2001/02/27 07:07:00 ishii Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.56 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,7 +78,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
 		{
 			/* We know the source constant is really of type 'text' */
 			char	   *val = DatumGetCString(DirectFunctionCall1(textout,
-														con->constvalue));
+													   con->constvalue));
 
 			newcon->constvalue = stringTypeDatum(targetType, val, atttypmod);
 			pfree(val);
@@ -227,9 +227,9 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
 
 		/* don't choke on references to no-longer-existing types */
 		if (!typeidIsValid(inputTypeId))
- 		    return false;
- 		if (!typeidIsValid(targetTypeId))
- 		    return false;
+			return false;
+		if (!typeidIsValid(targetTypeId))
+			return false;
 
 		/*
 		 * Else, try for explicit conversion using functions: look for a
@@ -240,7 +240,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
 		oid_array[0] = inputTypeId;
 
 		ftup = SearchSysCache(PROCNAME,
-							  PointerGetDatum(typeidTypeName(targetTypeId)),
+						   PointerGetDatum(typeidTypeName(targetTypeId)),
 							  Int32GetDatum(1),
 							  PointerGetDatum(oid_array),
 							  0);
@@ -333,7 +333,7 @@ coerce_type_typmod(ParseState *pstate, Node *node,
  *
  * XXX this code is WRONG, since (for example) given the input (int4,int8)
  * it will select int4, whereas according to SQL92 clause 9.3 the correct
- * answer is clearly int8.  To fix this we need a notion of a promotion
+ * answer is clearly int8.	To fix this we need a notion of a promotion
  * hierarchy within type categories --- something more complete than
  * just a single preferred type.
  */
@@ -349,7 +349,7 @@ select_common_type(List *typeids, const char *context)
 	pcategory = TypeCategory(ptype);
 	foreach(l, lnext(typeids))
 	{
-		Oid		ntype = (Oid) lfirsti(l);
+		Oid			ntype = (Oid) lfirsti(l);
 
 		/* move on to next one if no new information... */
 		if (ntype && (ntype != UNKNOWNOID) && (ntype != ptype))
@@ -362,20 +362,21 @@ select_common_type(List *typeids, const char *context)
 			}
 			else if (TypeCategory(ntype) != pcategory)
 			{
+
 				/*
-				 * both types in different categories? then
-				 * not much hope...
+				 * both types in different categories? then not much
+				 * hope...
 				 */
 				elog(ERROR, "%s types \"%s\" and \"%s\" not matched",
-					 context, typeidTypeName(ptype), typeidTypeName(ntype));
+				  context, typeidTypeName(ptype), typeidTypeName(ntype));
 			}
 			else if (IsPreferredType(pcategory, ntype)
 					 && !IsPreferredType(pcategory, ptype)
 					 && can_coerce_type(1, &ptype, &ntype))
 			{
+
 				/*
-				 * new one is preferred and can convert? then
-				 * take it...
+				 * new one is preferred and can convert? then take it...
 				 */
 				ptype = ntype;
 				pcategory = TypeCategory(ptype);
@@ -384,16 +385,15 @@ select_common_type(List *typeids, const char *context)
 	}
 
 	/*
-	 * If all the inputs were UNKNOWN type --- ie, unknown-type literals ---
-	 * then resolve as type TEXT.  This situation comes up with constructs
-	 * like
-	 *			SELECT (CASE WHEN foo THEN 'bar' ELSE 'baz' END);
-	 *			SELECT 'foo' UNION SELECT 'bar';
-	 * It might seem desirable to leave the construct's output type as
-	 * UNKNOWN, but that really doesn't work, because we'd probably end up
-	 * needing a runtime coercion from UNKNOWN to something else, and we
-	 * usually won't have it.  We need to coerce the unknown literals while
-	 * they are still literals, so a decision has to be made now.
+	 * If all the inputs were UNKNOWN type --- ie, unknown-type literals
+	 * --- then resolve as type TEXT.  This situation comes up with
+	 * constructs like SELECT (CASE WHEN foo THEN 'bar' ELSE 'baz' END);
+	 * SELECT 'foo' UNION SELECT 'bar'; It might seem desirable to leave
+	 * the construct's output type as UNKNOWN, but that really doesn't
+	 * work, because we'd probably end up needing a runtime coercion from
+	 * UNKNOWN to something else, and we usually won't have it.  We need
+	 * to coerce the unknown literals while they are still literals, so a
+	 * decision has to be made now.
 	 */
 	if (ptype == UNKNOWNOID)
 		ptype = TEXTOID;
@@ -420,9 +420,7 @@ coerce_to_common_type(ParseState *pstate, Node *node,
 	if (inputTypeId == targetTypeId)
 		return node;			/* no work */
 	if (can_coerce_type(1, &inputTypeId, &targetTypeId))
-	{
 		node = coerce_type(pstate, node, inputTypeId, targetTypeId, -1);
-	}
 	else
 	{
 		elog(ERROR, "%s unable to convert to type \"%s\"",
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 69f34c890edde47bf02fe29946fb80540d957651..9c60b17cf8c414b03a762fc29a52e9ff97440414 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.91 2001/02/16 03:16:58 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.92 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -384,9 +384,9 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
 						left_list = lnext(left_list);
 
 						/*
-						 * It's OK to use oper() not compatible_oper() here,
-						 * because make_subplan() will insert type coercion
-						 * calls if needed.
+						 * It's OK to use oper() not compatible_oper()
+						 * here, because make_subplan() will insert type
+						 * coercion calls if needed.
 						 */
 						optup = oper(op,
 									 exprType(lexpr),
@@ -458,10 +458,12 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
 					c->defresult = (Node *) n;
 				}
 				c->defresult = transformExpr(pstate, c->defresult, precedence);
+
 				/*
 				 * Note: default result is considered the most significant
-				 * type in determining preferred type.  This is how the code
-				 * worked before, but it seems a little bogus to me --- tgl
+				 * type in determining preferred type.	This is how the
+				 * code worked before, but it seems a little bogus to me
+				 * --- tgl
 				 */
 				typeids = lconsi(exprType(c->defresult), typeids);
 
@@ -571,7 +573,7 @@ transformIdent(ParseState *pstate, Ident *ident, int precedence)
 	 * appear
 	 */
 	if (ident->indirection == NIL &&
-		refnameRangeOrJoinEntry(pstate, ident->name, &sublevels_up) != NULL)
+	 refnameRangeOrJoinEntry(pstate, ident->name, &sublevels_up) != NULL)
 	{
 		ident->isRel = TRUE;
 		result = (Node *) ident;
@@ -580,7 +582,7 @@ transformIdent(ParseState *pstate, Ident *ident, int precedence)
 	if (result == NULL || precedence == EXPR_COLUMN_FIRST)
 	{
 		/* try to find the ident as a column */
-		Node   *var = colnameToVar(pstate, ident->name);
+		Node	   *var = colnameToVar(pstate, ident->name);
 
 		if (var != NULL)
 			result = transformIndirection(pstate, var, ident->indirection);
@@ -852,7 +854,7 @@ parser_typecast_constant(Value *expr, TypeName *typename)
 	{
 		case T_Integer:
 			const_string = DatumGetCString(DirectFunctionCall1(int4out,
-										   Int32GetDatum(expr->val.ival)));
+										 Int32GetDatum(expr->val.ival)));
 			string_palloced = true;
 			break;
 		case T_Float:
@@ -931,7 +933,7 @@ parser_typecast_expression(ParseState *pstate,
 
 /*
  * Given a TypeName node as returned by the grammar, generate the internal
- * name of the corresponding type.  Note this does NOT check if the type
+ * name of the corresponding type.	Note this does NOT check if the type
  * exists or not.
  */
 char *
@@ -939,11 +941,12 @@ TypeNameToInternalName(TypeName *typename)
 {
 	if (typename->arrayBounds != NIL)
 	{
+
 		/*
 		 * By convention, the name of an array type is the name of its
 		 * element type with "_" prepended.
 		 */
-		char   *arrayname = palloc(strlen(typename->name) + 2);
+		char	   *arrayname = palloc(strlen(typename->name) + 2);
 
 		sprintf(arrayname, "_%s", typename->name);
 		return arrayname;
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index bece816a7f47f717ea19d6c13daa87bfa5165772..8d2f632f33acb48041e1ea9563070cb28870012f 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.100 2001/03/14 23:55:33 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.101 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -72,7 +72,7 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int precedence)
 	if (attr->paramNo != NULL)
 	{
 		Param	   *param = (Param *) transformExpr(pstate,
-													(Node *) attr->paramNo,
+												  (Node *) attr->paramNo,
 													EXPR_RELATION_FIRST);
 
 		retval = ParseFuncOrColumn(pstate, strVal(lfirst(attr->attrs)),
@@ -277,7 +277,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 	if (nargs == 1 && !must_be_agg)
 	{
 		/* Is it a plain Relation name from the parser? */
-		if (IsA(first_arg, Ident) && ((Ident *) first_arg)->isRel)
+		if (IsA(first_arg, Ident) &&((Ident *) first_arg)->isRel)
 		{
 			Ident	   *ident = (Ident *) first_arg;
 
@@ -337,7 +337,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 		if (nargs != 1)
 			elog(ERROR, "Aggregate functions may only have one parameter");
 		/* Agg's argument can't be a relation name, either */
-		if (IsA(first_arg, Ident) && ((Ident *) first_arg)->isRel)
+		if (IsA(first_arg, Ident) &&((Ident *) first_arg)->isRel)
 			elog(ERROR, "Aggregate functions cannot be applied to relation names");
 		could_be_agg = true;
 	}
@@ -345,7 +345,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 	{
 		/* Try to parse as an aggregate if above-mentioned checks are OK */
 		could_be_agg = (nargs == 1) &&
-			!(IsA(first_arg, Ident) && ((Ident *) first_arg)->isRel);
+			!(IsA(first_arg, Ident) &&((Ident *) first_arg)->isRel);
 	}
 
 	if (could_be_agg)
@@ -424,7 +424,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 	{
 		Node	   *arg = lfirst(i);
 
-		if (IsA(arg, Ident) && ((Ident *) arg)->isRel)
+		if (IsA(arg, Ident) &&((Ident *) arg)->isRel)
 		{
 			RangeTblEntry *rte;
 			int			vnum;
@@ -440,21 +440,18 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 												&sublevels_up);
 
 			if (rteorjoin == NULL)
-			{
 				rte = addImplicitRTE(pstate, refname);
-			}
 			else if (IsA(rteorjoin, RangeTblEntry))
-			{
 				rte = (RangeTblEntry *) rteorjoin;
-			}
 			else if (IsA(rteorjoin, JoinExpr))
 			{
+
 				/*
 				 * We have f(x) or more likely x.f where x is a join and f
-				 * is not one of the attribute names of the join (else we'd
-				 * have recognized it above).  We don't support functions on
-				 * join tuples (since we don't have a named type for the join
-				 * tuples), so error out.
+				 * is not one of the attribute names of the join (else
+				 * we'd have recognized it above).  We don't support
+				 * functions on join tuples (since we don't have a named
+				 * type for the join tuples), so error out.
 				 */
 				elog(ERROR, "No such attribute or function %s.%s",
 					 refname, funcname);
@@ -525,14 +522,14 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 	{							/* we know all of these fields already */
 
 		/*
-		 * We create a funcnode with a placeholder function seteval().
-		 * At runtime, seteval() will execute the function identified
-		 * by the funcid it receives as parameter.
+		 * We create a funcnode with a placeholder function seteval(). At
+		 * runtime, seteval() will execute the function identified by the
+		 * funcid it receives as parameter.
 		 *
 		 * Example: retrieve (emp.mgr.name).  The plan for this will scan the
-		 * emp relation, projecting out the mgr attribute, which is a funcid.
-		 * This function is then called (via seteval()) and "name" is
-		 * projected from its result.
+		 * emp relation, projecting out the mgr attribute, which is a
+		 * funcid. This function is then called (via seteval()) and "name"
+		 * is projected from its result.
 		 */
 		funcid = F_SETEVAL;
 		rettype = toid;
@@ -639,11 +636,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
 	retval = (Node *) expr;
 
 	/*
-	 * For sets, we want to project out the desired attribute of the tuples.
+	 * For sets, we want to project out the desired attribute of the
+	 * tuples.
 	 */
 	if (attisset)
 	{
-		FieldSelect	   *fselect;
+		FieldSelect *fselect;
 
 		fselect = setup_field_select(retval, funcname, argrelid);
 		rettype = fselect->resulttype;
@@ -952,31 +950,31 @@ func_select_candidate(int nargs,
 	 * columns.
 	 *
 	 * We do this by examining each unknown argument position to see if we
-	 * can determine a "type category" for it.  If any candidate has an
+	 * can determine a "type category" for it.	If any candidate has an
 	 * input datatype of STRING category, use STRING category (this bias
 	 * towards STRING is appropriate since unknown-type literals look like
 	 * strings).  Otherwise, if all the candidates agree on the type
 	 * category of this argument position, use that category.  Otherwise,
 	 * fail because we cannot determine a category.
 	 *
-	 * If we are able to determine a type category, also notice whether
-	 * any of the candidates takes a preferred datatype within the category.
+	 * If we are able to determine a type category, also notice whether any
+	 * of the candidates takes a preferred datatype within the category.
 	 *
-	 * Having completed this examination, remove candidates that accept
-	 * the wrong category at any unknown position.  Also, if at least one
-	 * candidate accepted a preferred type at a position, remove candidates
-	 * that accept non-preferred types.
+	 * Having completed this examination, remove candidates that accept the
+	 * wrong category at any unknown position.	Also, if at least one
+	 * candidate accepted a preferred type at a position, remove
+	 * candidates that accept non-preferred types.
 	 *
 	 * If we are down to one candidate at the end, we win.
 	 */
 	resolved_unknowns = false;
 	for (i = 0; i < nargs; i++)
 	{
-		bool	have_conflict;
+		bool		have_conflict;
 
 		if (input_typeids[i] != UNKNOWNOID)
 			continue;
-		resolved_unknowns = true; /* assume we can do it */
+		resolved_unknowns = true;		/* assume we can do it */
 		slot_category[i] = INVALID_TYPE;
 		slot_has_preferred_type[i] = false;
 		have_conflict = false;
@@ -1012,7 +1010,11 @@ func_select_candidate(int nargs,
 				}
 				else
 				{
-					/* Remember conflict, but keep going (might find STRING) */
+
+					/*
+					 * Remember conflict, but keep going (might find
+					 * STRING)
+					 */
 					have_conflict = true;
 				}
 			}
@@ -1034,7 +1036,7 @@ func_select_candidate(int nargs,
 			 current_candidate != NULL;
 			 current_candidate = current_candidate->next)
 		{
-			bool	keepit = true;
+			bool		keepit = true;
 
 			current_typeids = current_candidate->args;
 			for (i = 0; i < nargs; i++)
@@ -1185,7 +1187,7 @@ func_get_detail(char *funcname,
 						ftup = SearchSysCache(PROCNAME,
 											  PointerGetDatum(funcname),
 											  Int32GetDatum(nargs),
-											  PointerGetDatum(*true_typeids),
+										  PointerGetDatum(*true_typeids),
 											  0);
 						Assert(HeapTupleIsValid(ftup));
 						break;
@@ -1542,12 +1544,12 @@ ParseComplexProjection(ParseState *pstate,
 				Iter	   *iter = (Iter *) first_arg;
 
 				/*
-				 * If the argument of the Iter returns a tuple,
-				 * funcname may be a projection.  If so, we stick
-				 * the FieldSelect *inside* the Iter --- this is
-				 * klugy, but necessary because ExecTargetList()
-				 * currently does the right thing only when the
-				 * Iter node is at the top level of a targetlist item.
+				 * If the argument of the Iter returns a tuple, funcname
+				 * may be a projection.  If so, we stick the FieldSelect
+				 * *inside* the Iter --- this is klugy, but necessary
+				 * because ExecTargetList() currently does the right thing
+				 * only when the Iter node is at the top level of a
+				 * targetlist item.
 				 */
 				argtype = iter->itertype;
 				argrelid = typeidTypeRelid(argtype);
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 36e43166aa92e01969e2b420fa987dde942d714e..b23dd7f1b98a229c099646e6a2de93e0f0f44023 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.52 2001/02/14 21:35:04 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.53 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,7 +136,7 @@ make_op(char *opname, Node *ltree, Node *rtree)
 
 	newop = makeOper(oprid(tup),/* opno */
 					 InvalidOid,/* opid */
-					 opform->oprresult); /* operator result type */
+					 opform->oprresult);		/* operator result type */
 
 	result = makeNode(Expr);
 	result->typeOid = opform->oprresult;
@@ -235,7 +235,7 @@ make_var(ParseState *pstate, RangeTblEntry *rte, int attrno)
  * forceSlice	If true, treat subscript as array slice in all cases
  * assignFrom	NULL for array fetch, else transformed expression for source.
  */
-ArrayRef *
+ArrayRef   *
 transformArraySubscripts(ParseState *pstate,
 						 Node *arrayBase,
 						 Oid arrayType,
@@ -449,7 +449,7 @@ make_const(Value *value)
 
 				typeid = FLOAT8OID;
 				typelen = sizeof(float8);
-				typebyval = false; /* XXX might change someday */
+				typebyval = false;		/* XXX might change someday */
 			}
 			else
 			{
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index cd557994f179ebe8db0dfa40da16c6b7e68f25b5..fdca83115d33958aa752125ae6c0e79c2f285811 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.47 2001/02/16 03:16:58 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.48 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,7 +63,7 @@ oprid(Operator op)
 Oid
 oprfuncid(Operator op)
 {
-	Form_pg_operator	pgopform = (Form_pg_operator) GETSTRUCT(op);
+	Form_pg_operator pgopform = (Form_pg_operator) GETSTRUCT(op);
 
 	return pgopform->oprcode;
 }
@@ -416,34 +416,35 @@ oper_select_candidate(int nargs,
 	}
 
 	/*
-	 * Second try: same algorithm as for unknown resolution in parse_func.c.
+	 * Second try: same algorithm as for unknown resolution in
+	 * parse_func.c.
 	 *
 	 * We do this by examining each unknown argument position to see if we
-	 * can determine a "type category" for it.  If any candidate has an
+	 * can determine a "type category" for it.	If any candidate has an
 	 * input datatype of STRING category, use STRING category (this bias
 	 * towards STRING is appropriate since unknown-type literals look like
 	 * strings).  Otherwise, if all the candidates agree on the type
 	 * category of this argument position, use that category.  Otherwise,
 	 * fail because we cannot determine a category.
 	 *
-	 * If we are able to determine a type category, also notice whether
-	 * any of the candidates takes a preferred datatype within the category.
+	 * If we are able to determine a type category, also notice whether any
+	 * of the candidates takes a preferred datatype within the category.
 	 *
-	 * Having completed this examination, remove candidates that accept
-	 * the wrong category at any unknown position.  Also, if at least one
-	 * candidate accepted a preferred type at a position, remove candidates
-	 * that accept non-preferred types.
+	 * Having completed this examination, remove candidates that accept the
+	 * wrong category at any unknown position.	Also, if at least one
+	 * candidate accepted a preferred type at a position, remove
+	 * candidates that accept non-preferred types.
 	 *
 	 * If we are down to one candidate at the end, we win.
 	 */
 	resolved_unknowns = false;
 	for (i = 0; i < nargs; i++)
 	{
-		bool	have_conflict;
+		bool		have_conflict;
 
 		if (input_typeids[i] != UNKNOWNOID)
 			continue;
-		resolved_unknowns = true; /* assume we can do it */
+		resolved_unknowns = true;		/* assume we can do it */
 		slot_category[i] = INVALID_TYPE;
 		slot_has_preferred_type[i] = false;
 		have_conflict = false;
@@ -479,7 +480,11 @@ oper_select_candidate(int nargs,
 				}
 				else
 				{
-					/* Remember conflict, but keep going (might find STRING) */
+
+					/*
+					 * Remember conflict, but keep going (might find
+					 * STRING)
+					 */
 					have_conflict = true;
 				}
 			}
@@ -501,7 +506,7 @@ oper_select_candidate(int nargs,
 			 current_candidate != NULL;
 			 current_candidate = current_candidate->next)
 		{
-			bool	keepit = true;
+			bool		keepit = true;
 
 			current_typeids = current_candidate->args;
 			for (i = 0; i < nargs; i++)
@@ -602,7 +607,8 @@ oper_inexact(char *op, Oid arg1, Oid arg2)
 	if (ncandidates == 0)
 		return NULL;
 
-	/* Otherwise, check for compatible datatypes, and then try to resolve
+	/*
+	 * Otherwise, check for compatible datatypes, and then try to resolve
 	 * the conflict if more than one candidate remains.
 	 */
 	inputOids[0] = arg1;
@@ -659,18 +665,18 @@ oper(char *opname, Oid ltypeId, Oid rtypeId, bool noError)
  *
  *	This is tighter than oper() because it will not return an operator that
  *	requires coercion of the input datatypes (but binary-compatible operators
- *	are accepted).  Otherwise, the semantics are the same.
+ *	are accepted).	Otherwise, the semantics are the same.
  */
 Operator
 compatible_oper(char *op, Oid arg1, Oid arg2, bool noError)
 {
 	Operator	optup;
-	Form_pg_operator	opform;
+	Form_pg_operator opform;
 
 	/* oper() will find the best available match */
 	optup = oper(op, arg1, arg2, noError);
 	if (optup == (Operator) NULL)
-		return (Operator) NULL;	/* must be noError case */
+		return (Operator) NULL; /* must be noError case */
 
 	/* but is it good enough? */
 	opform = (Form_pg_operator) GETSTRUCT(optup);
@@ -825,8 +831,11 @@ right_oper(char *op, Oid arg)
 			unary_op_error(op, arg, FALSE);
 		else
 		{
-			/* We must run oper_select_candidate even if only one candidate,
-			 * otherwise we may falsely return a non-type-compatible operator.
+
+			/*
+			 * We must run oper_select_candidate even if only one
+			 * candidate, otherwise we may falsely return a
+			 * non-type-compatible operator.
 			 */
 			targetOid = oper_select_candidate(1, &arg, candidates);
 			if (targetOid != NULL)
@@ -879,8 +888,11 @@ left_oper(char *op, Oid arg)
 			unary_op_error(op, arg, TRUE);
 		else
 		{
-			/* We must run oper_select_candidate even if only one candidate,
-			 * otherwise we may falsely return a non-type-compatible operator.
+
+			/*
+			 * We must run oper_select_candidate even if only one
+			 * candidate, otherwise we may falsely return a
+			 * non-type-compatible operator.
 			 */
 			targetOid = oper_select_candidate(1, &arg, candidates);
 			if (targetOid != NULL)
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index d9280529c4f99774cf154f16db67ed6be2602e37..59be1044748b6eb502e3e04d8f0389d1f7a7aac4 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.52 2001/02/14 21:35:04 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.53 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,11 +31,11 @@
 
 
 static Node *scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
-									 char *refname);
+						char *refname);
 static Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
-							  char *colname);
+				 char *colname);
 static Node *scanJoinForColumn(JoinExpr *join, char *colname,
-							   int sublevels_up);
+				  int sublevels_up);
 static bool isForUpdate(ParseState *pstate, char *relname);
 static List *expandNamesVars(ParseState *pstate, List *names, List *vars);
 static void warnAutoRange(ParseState *pstate, char *refname);
@@ -145,7 +145,8 @@ scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
 		if (j->alias)
 		{
 			if (strcmp(j->alias->relname, refname) == 0)
-				return (Node *) j; /* matched a join alias */
+				return (Node *) j;		/* matched a join alias */
+
 			/*
 			 * Tables within an aliased join are invisible from outside
 			 * the join, according to the scope rules of SQL92 (the join
@@ -154,7 +155,7 @@ scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
 			return NULL;
 		}
 		result = scanNameSpaceForRefname(pstate, j->larg, refname);
-		if (! result)
+		if (!result)
 			result = scanNameSpaceForRefname(pstate, j->rarg, refname);
 	}
 	else if (IsA(nsnode, List))
@@ -185,7 +186,7 @@ scanNameSpaceForConflict(ParseState *pstate, Node *nsnode,
 
 /*
  * Recursively check for refname conflicts between two namespaces or
- * namespace subtrees.  Raise an error if any is found.
+ * namespace subtrees.	Raise an error if any is found.
  *
  * Works by recursively scanning namespace1 in the same way that
  * scanNameSpaceForRefname does, and then looking in namespace2 for
@@ -214,6 +215,7 @@ checkNameSpaceConflicts(ParseState *pstate, Node *namespace1,
 		if (j->alias)
 		{
 			scanNameSpaceForConflict(pstate, namespace2, j->alias->relname);
+
 			/*
 			 * Tables within an aliased join are invisible from outside
 			 * the join, according to the scope rules of SQL92 (the join
@@ -229,9 +231,7 @@ checkNameSpaceConflicts(ParseState *pstate, Node *namespace1,
 		List	   *l;
 
 		foreach(l, (List *) namespace1)
-		{
 			checkNameSpaceConflicts(pstate, lfirst(l), namespace2);
-		}
 	}
 	else
 		elog(ERROR, "checkNameSpaceConflicts: unexpected node type %d",
@@ -290,8 +290,8 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname)
 	List	   *c;
 
 	/*
-	 * Scan the user column names (or aliases) for a match.
-	 * Complain if multiple matches.
+	 * Scan the user column names (or aliases) for a match. Complain if
+	 * multiple matches.
 	 */
 	foreach(c, rte->eref->attrs)
 	{
@@ -354,7 +354,8 @@ scanJoinForColumn(JoinExpr *join, char *colname, int sublevels_up)
 		{
 			if (result)
 				elog(ERROR, "Column reference \"%s\" is ambiguous", colname);
-			result = copyObject(nth(attnum-1, join->colvars));
+			result = copyObject(nth(attnum - 1, join->colvars));
+
 			/*
 			 * If referencing an uplevel join item, we must adjust
 			 * sublevels settings in the copied expression.
@@ -385,20 +386,20 @@ colnameToVar(ParseState *pstate, char *colname)
 
 		/*
 		 * We need to look only at top-level namespace items, and even for
-		 * those, ignore RTEs that are marked as not inFromCl and not
-		 * the query's target relation.
+		 * those, ignore RTEs that are marked as not inFromCl and not the
+		 * query's target relation.
 		 */
 		foreach(ns, pstate->p_namespace)
 		{
-			Node   *nsnode = (Node *) lfirst(ns);
-			Node   *newresult = NULL;
+			Node	   *nsnode = (Node *) lfirst(ns);
+			Node	   *newresult = NULL;
 
 			if (IsA(nsnode, RangeTblRef))
 			{
 				int			varno = ((RangeTblRef *) nsnode)->rtindex;
 				RangeTblEntry *rte = rt_fetch(varno, pstate->p_rtable);
 
-				if (! rte->inFromCl &&
+				if (!rte->inFromCl &&
 					rte != pstate->p_target_rangetblentry)
 					continue;
 
@@ -452,7 +453,7 @@ qualifiedNameToVar(ParseState *pstate, char *refname, char *colname,
 
 	if (rteorjoin == NULL)
 	{
-		if (! implicitRTEOK)
+		if (!implicitRTEOK)
 			return NULL;
 		rteorjoin = (Node *) addImplicitRTE(pstate, refname);
 		sublevels_up = 0;
@@ -505,9 +506,9 @@ addRangeTableEntry(ParseState *pstate,
 
 	/*
 	 * Get the rel's OID.  This access also ensures that we have an
-	 * up-to-date relcache entry for the rel.  Since this is typically
-	 * the first access to a rel in a statement, be careful to get the
-	 * right access level depending on whether we're doing SELECT FOR UPDATE.
+	 * up-to-date relcache entry for the rel.  Since this is typically the
+	 * first access to a rel in a statement, be careful to get the right
+	 * access level depending on whether we're doing SELECT FOR UPDATE.
 	 */
 	lockmode = isForUpdate(pstate, relname) ? RowShareLock : AccessShareLock;
 	rel = heap_openr(relname, lockmode);
@@ -517,8 +518,8 @@ addRangeTableEntry(ParseState *pstate,
 	numaliases = length(eref->attrs);
 
 	/*
-	 * Since the rel is open anyway, let's check that the
-	 * number of column aliases is reasonable. - Thomas 2000-02-04
+	 * Since the rel is open anyway, let's check that the number of column
+	 * aliases is reasonable. - Thomas 2000-02-04
 	 */
 	maxattrs = RelationGetNumberOfAttributes(rel);
 	if (maxattrs < numaliases)
@@ -536,9 +537,9 @@ addRangeTableEntry(ParseState *pstate,
 	rte->eref = eref;
 
 	/*
-	 * Drop the rel refcount, but keep the access lock till end of transaction
-	 * so that the table can't be deleted or have its schema modified
-	 * underneath us.
+	 * Drop the rel refcount, but keep the access lock till end of
+	 * transaction so that the table can't be deleted or have its schema
+	 * modified underneath us.
 	 */
 	heap_close(rel, NoLock);
 
@@ -557,11 +558,11 @@ addRangeTableEntry(ParseState *pstate,
 	rte->checkForRead = true;
 	rte->checkForWrite = false;
 
-	rte->checkAsUser = InvalidOid; /* not set-uid by default, either */
+	rte->checkAsUser = InvalidOid;		/* not set-uid by default, either */
 
 	/*
-	 * Add completed RTE to pstate's range table list, but not to join list
-	 * nor namespace --- caller must do that if appropriate.
+	 * Add completed RTE to pstate's range table list, but not to join
+	 * list nor namespace --- caller must do that if appropriate.
 	 */
 	if (pstate != NULL)
 		pstate->p_rtable = lappend(pstate->p_rtable, rte);
@@ -637,8 +638,8 @@ addRangeTableEntryForSubquery(ParseState *pstate,
 	rte->checkAsUser = InvalidOid;
 
 	/*
-	 * Add completed RTE to pstate's range table list, but not to join list
-	 * nor namespace --- caller must do that if appropriate.
+	 * Add completed RTE to pstate's range table list, but not to join
+	 * list nor namespace --- caller must do that if appropriate.
 	 */
 	if (pstate != NULL)
 		pstate->p_rtable = lappend(pstate->p_rtable, rte);
@@ -665,7 +666,7 @@ isForUpdate(ParseState *pstate, char *relname)
 			else
 			{
 				/* just the named tables */
-				List   *l;
+				List	   *l;
 
 				foreach(l, pstate->p_forUpdate)
 				{
@@ -683,7 +684,7 @@ isForUpdate(ParseState *pstate, char *relname)
 
 /*
  * Add the given RTE as a top-level entry in the pstate's join list
- * and/or name space list.  (We assume caller has checked for any
+ * and/or name space list.	(We assume caller has checked for any
  * namespace conflict.)
  */
 void
@@ -854,9 +855,10 @@ expandJoinAttrs(ParseState *pstate, JoinExpr *join, int sublevels_up)
 	List	   *vars;
 
 	vars = copyObject(join->colvars);
+
 	/*
-	 * If referencing an uplevel join item, we must adjust
-	 * sublevels settings in the copied expression.
+	 * If referencing an uplevel join item, we must adjust sublevels
+	 * settings in the copied expression.
 	 */
 	if (sublevels_up > 0)
 		IncrementVarSublevelsUp((Node *) vars, sublevels_up, 0);
@@ -922,15 +924,17 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
 	 * If there is an alias, use it
 	 */
 	if (attnum > 0 && attnum <= length(rte->eref->attrs))
-		return strVal(nth(attnum-1, rte->eref->attrs));
+		return strVal(nth(attnum - 1, rte->eref->attrs));
+
 	/*
-	 * Can get here for a system attribute (which never has an alias),
-	 * or if alias name list is too short (which probably can't happen
+	 * Can get here for a system attribute (which never has an alias), or
+	 * if alias name list is too short (which probably can't happen
 	 * anymore).  Neither of these cases is valid for a subselect RTE.
 	 */
 	if (rte->relid == InvalidOid)
 		elog(ERROR, "Invalid attnum %d for rangetable entry %s",
 			 attnum, rte->eref->relname);
+
 	/*
 	 * Use the real name of the table's column
 	 */
@@ -1007,6 +1011,7 @@ attnameIsSet(Relation rd, char *name)
 	}
 	return get_attisset(RelationGetRelid(rd), name);
 }
+
 #endif
 
 #ifdef NOT_USED
@@ -1020,6 +1025,7 @@ attnumAttNelems(Relation rd, int attid)
 {
 	return rd->rd_att->attrs[attid - 1]->attnelems;
 }
+
 #endif
 
 /* given attribute id, return type of that attribute */
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 6b566da7475e0399eaa69add9b17748d3a45d6bf..8f8ea4e168b5062861cac69fe9b13c28d30c8302 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.65 2001/02/14 21:35:05 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.66 2001/03/22 03:59:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,11 +131,11 @@ transformTargetList(ParseState *pstate, List *targetlist)
 				if (IsA(rteorjoin, RangeTblEntry))
 					p_target = nconc(p_target,
 									 expandRelAttrs(pstate,
-													(RangeTblEntry *) rteorjoin));
+										   (RangeTblEntry *) rteorjoin));
 				else if (IsA(rteorjoin, JoinExpr))
 					p_target = nconc(p_target,
 									 expandJoinAttrs(pstate,
-													 (JoinExpr *) rteorjoin,
+												  (JoinExpr *) rteorjoin,
 													 sublevels_up));
 				else
 					elog(ERROR, "transformTargetList: unexpected node type %d",
@@ -217,6 +217,7 @@ updateTargetListEntry(ParseState *pstate,
 
 		if (pstate->p_is_insert)
 		{
+
 			/*
 			 * The command is INSERT INTO table (arraycol[subscripts]) ...
 			 * so there is not really a source array value to work with.
@@ -229,6 +230,7 @@ updateTargetListEntry(ParseState *pstate,
 		}
 		else
 		{
+
 			/*
 			 * Build a Var for the array to be updated.
 			 */
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index 5935b565b6217c0035abfe8c64faef68aac497ba..856affbdbe395bb79558eb0bdb2f053b15b5add0 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.34 2001/01/24 19:43:03 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.35 2001/03/22 03:59:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,6 +136,7 @@ typeTypElem(Type typ)
 
 	return typtup->typelem;
 }
+
 #endif
 
 #ifdef NOT_USED
@@ -149,6 +150,7 @@ typeInfunc(Type typ)
 
 	return typtup->typinput;
 }
+
 #endif
 
 #ifdef NOT_USED
@@ -162,6 +164,7 @@ typeOutfunc(Type typ)
 
 	return typtup->typoutput;
 }
+
 #endif
 
 /* Given a type structure and a string, returns the internal form of
@@ -218,10 +221,11 @@ typeidTypeName(Oid id)
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "Unable to locate type oid %u in catalog", id);
 	typetuple = (Form_pg_type) GETSTRUCT(tup);
+
 	/*
 	 * pstrdup here because result may need to outlive the syscache entry
-	 * (eg, it might end up as part of a parse tree that will outlive
-	 * the current transaction...)
+	 * (eg, it might end up as part of a parse tree that will outlive the
+	 * current transaction...)
 	 */
 	result = pstrdup(NameStr(typetuple->typname));
 	ReleaseSysCache(tup);
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 63eff93edf51eda021c478c1bfdbb8877603efe7..11f1fa6df3755df7c8efbc929a3acce28ab27dc6 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -14,7 +14,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.48 2001/01/24 19:43:03 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.49 2001/03/22 03:59:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,6 +30,7 @@
 
 #if defined(FLEX_SCANNER)
 extern void DeleteBuffer(void);
+
 #endif	 /* FLEX_SCANNER */
 
 char	   *parseString;		/* the char* which holds the string to be
@@ -82,7 +83,7 @@ parser(char *str, Oid *typev, int nargs)
  * token lookahead.  We reduce these cases to one-token lookahead by combining
  * tokens here, in order to keep the grammar LR(1).
  *
- * Using a filter is simpler than trying to recognize multiword tokens 
+ * Using a filter is simpler than trying to recognize multiword tokens
  * directly in scan.l, because we'd have to allow for comments between the
  * words ...
  */
diff --git a/src/backend/port/beos/sem.c b/src/backend/port/beos/sem.c
index 1a6d0d97a19a81774b8b33b2ae21c5778c45dbdf..3b829817ee7b56422a7dcf194b8f9480542ad12f 100644
--- a/src/backend/port/beos/sem.c
+++ b/src/backend/port/beos/sem.c
@@ -4,7 +4,7 @@
  *	  BeOS System V Semaphores Emulation
  *
  * Copyright (c) 1999-2000, Cyril VELTER
- * 
+ *
  *-------------------------------------------------------------------------
  */
 
@@ -29,204 +29,227 @@
 
 /* Control of a semaphore pool. The pool is an area in which we stored all
 the semIds of the pool. The first 4 bytes are the number of semaphore allocated
-in the pool followed by SemIds */ 
+in the pool followed by SemIds */
 
-int semctl(int semId,int semNum,int flag,union semun semun)
+int
+semctl(int semId, int semNum, int flag, union semun semun)
 {
-	int32* Address;
-	area_info info; 
+	int32	   *Address;
+	area_info	info;
 
 	TRACEDBG("->semctl");
 	/* Try to find the pool */
-	if (get_area_info(semId,&info)!=B_OK)
+	if (get_area_info(semId, &info) != B_OK)
 	{
 		/* pool is invalid (BeOS area id is invalid) */
-		errno=EINVAL;
+		errno = EINVAL;
 		TRACEDBG("<-semctl invalid pool");
 		return -1;
 	}
-	
+
 	/* Get the pool address */
-	Address=(int32*)info.address;
-	TRACEDBGP("--semctl address %d",Address);
-	
-	
+	Address = (int32 *) info.address;
+	TRACEDBGP("--semctl address %d", Address);
+
+
 	/* semNum might be 0 */
 	/* semun.array contain the sem initial values */
-	
+
 	/* Fix the count of all sem of the pool to semun.array */
-	if (flag==SETALL)
+	if (flag == SETALL)
 	{
-		long i;
+		long		i;
+
 		TRACEDBG("--semctl setall");
-		for (i=0;i<Address[0];i++)
+		for (i = 0; i < Address[0]; i++)
 		{
-			int32 cnt;
+			int32		cnt;
+
 			/* Get the current count */
-			get_sem_count(Address[2*i+1],&cnt);
-	
-			TRACEDBGP("--semctl setall %d",semun.array[i]);
+			get_sem_count(Address[2 * i + 1], &cnt);
+
+			TRACEDBGP("--semctl setall %d", semun.array[i]);
 
 			/* Compute and set the new count (relative to the old one) */
-			cnt-=semun.array[i];
-			TRACEDBGPP("--semctl acquire id : %d cnt : %d",Address[2*i+1],cnt);
+			cnt -= semun.array[i];
+			TRACEDBGPP("--semctl acquire id : %d cnt : %d", Address[2 * i + 1], cnt);
 			if (cnt > 0)
-				while(acquire_sem_etc(Address[2*i+1],cnt,0,0)==B_INTERRUPTED);
+				while (acquire_sem_etc(Address[2 * i + 1], cnt, 0, 0) == B_INTERRUPTED);
 			if (cnt < 0)
-				release_sem_etc(Address[2*i+1],-cnt,0);
+				release_sem_etc(Address[2 * i + 1], -cnt, 0);
 		}
 		return 1;
 	}
-	
+
 	/* Fix the count of one semaphore to semun.val */
-	if (flag==SETVAL)
+	if (flag == SETVAL)
 	{
-		int32 cnt;
-		TRACEDBGP("--semctl setval %d",semun.val);
+		int32		cnt;
+
+		TRACEDBGP("--semctl setval %d", semun.val);
 		/* Get the current count */
-		get_sem_count(Address[2*semNum+1],&cnt);
+		get_sem_count(Address[2 * semNum + 1], &cnt);
 
 		/* Compute and set the new count (relative to the old one) */
-		cnt-=semun.val;
-		TRACEDBGPP("--semctl acquire id : %d cnt : %d",Address[2*semNum+1],cnt);
+		cnt -= semun.val;
+		TRACEDBGPP("--semctl acquire id : %d cnt : %d", Address[2 * semNum + 1], cnt);
 		if (cnt > 0)
-			while(acquire_sem_etc(Address[2*semNum+1],cnt,0,0)==B_INTERRUPTED);
+			while (acquire_sem_etc(Address[2 * semNum + 1], cnt, 0, 0) == B_INTERRUPTED);
 		if (cnt < 0)
-			release_sem_etc(Address[2*semNum+1],-cnt,0);
+			release_sem_etc(Address[2 * semNum + 1], -cnt, 0);
 		return 1;
 	}
-	
+
 	/* Get the last pid which accesed the sem */
-	if (flag==GETPID)
+	if (flag == GETPID)
 	{
 		TRACEDBG("->semctl getpid");
-		return Address[2*semNum+2];
+		return Address[2 * semNum + 2];
 	}
-	
+
 	/* Delete the pool */
-	if (flag==IPC_RMID)
+	if (flag == IPC_RMID)
 	{
-		long i;
+		long		i;
 
 		thread_info ti;
+
 		TRACEDBG("->semctl rmid");
-		get_thread_info(find_thread(NULL),&ti);
-		
+		get_thread_info(find_thread(NULL), &ti);
+
 		/* Loop over all semaphore to delete them */
-		TRACEDBGP("->semctl nmbre %d",Address[0]);
-		for (i=0;i<Address[0];i++)
+		TRACEDBGP("->semctl nmbre %d", Address[0]);
+		for (i = 0; i < Address[0]; i++)
 		{
-			/* Make sure to have ownership of the semaphore (if created by another team) */
-			TRACEDBGP("->semctl id %d",Address[2*i+1]);
-			set_sem_owner(Address[2*i+1],ti.team);
-			
+
+			/*
+			 * Make sure to have ownership of the semaphore (if created by
+			 * another team)
+			 */
+			TRACEDBGP("->semctl id %d", Address[2 * i + 1]);
+			set_sem_owner(Address[2 * i + 1], ti.team);
+
 			/* Delete the semaphore */
-			delete_sem(Address[2*i+1]);
+			delete_sem(Address[2 * i + 1]);
 
-			/* Reset to an invalid semId (in case other process try to get the infos from a cloned area */
-			Address[2*i+1]=0;
+			/*
+			 * Reset to an invalid semId (in case other process try to get
+			 * the infos from a cloned area
+			 */
+			Address[2 * i + 1] = 0;
 		}
-		
+
 		/* Set the semaphore count to 0 */
-		Address[0]=0;
-		
-		/* Delete the area (it might be cloned by other process. Let them live with it,
-		in all cases semIds are 0 so if another process try to use it, it will fail */
+		Address[0] = 0;
+
+		/*
+		 * Delete the area (it might be cloned by other process. Let them
+		 * live with it, in all cases semIds are 0 so if another process
+		 * try to use it, it will fail
+		 */
 		delete_area(semId);
 
 		return 1;
 	}
-	
+
 	/* Get the current semaphore count */
-	if (flag==GETNCNT)
+	if (flag == GETNCNT)
 	{
 		/* TO BE IMPLEMENTED */
 		TRACEDBG("--semctl getncnt");
-		elog(ERROR,"beos : semctl error : GETNCNT not implemented");
+		elog(ERROR, "beos : semctl error : GETNCNT not implemented");
 		return 0;
 	}
-	
+
 	/* Get the current semaphore count of the first semaphore in the pool */
-	if (flag==GETVAL)
+	if (flag == GETVAL)
 	{
-		int32 cnt;
+		int32		cnt;
+
 		TRACEDBG("--semctl getval");
-		get_sem_count(Address[2*semNum+1],&cnt);
-		TRACEDBGP("--semctl val %d",cnt);
+		get_sem_count(Address[2 * semNum + 1], &cnt);
+		TRACEDBGP("--semctl val %d", cnt);
 		return cnt;
 	}
 
-	elog(ERROR,"beos : semctl error : unknown flag");
+	elog(ERROR, "beos : semctl error : unknown flag");
 
 	TRACEDBG("<-semctl unknown flag");
 	return 0;
 }
 
 /* Find a pool id based on IPC key */
-int semget(int semKey, int semNum, int flags)
+int
+semget(int semKey, int semNum, int flags)
 {
-	char Nom[50];
-	area_id parea;
-	void* Address;
+	char		Nom[50];
+	area_id		parea;
+	void	   *Address;
 
-	TRACEDBGPP("->semget key : %d num : %d",semKey,semNum);
+	TRACEDBGPP("->semget key : %d num : %d", semKey, semNum);
 	/* Name of the area to find */
-	sprintf(Nom,"SYSV_IPC_SEM : %d",semKey);
+	sprintf(Nom, "SYSV_IPC_SEM : %d", semKey);
 
 	/* find area */
-	parea=find_area(Nom);
+	parea = find_area(Nom);
 
 	/* Test of area existance */
-	if (parea!=B_NAME_NOT_FOUND)
+	if (parea != B_NAME_NOT_FOUND)
 	{
 		/* Area exist and creation is requested, error */
-		if ((flags&IPC_CREAT)&&(flags&IPC_EXCL))
+		if ((flags & IPC_CREAT) && (flags & IPC_EXCL))
 		{
-			errno=EEXIST;
+			errno = EEXIST;
 			return -1;
 		}
-		
+
 		/* Get an area clone (in case it's not in our address space) */
-		/* TODO : a check of address space might be done to avoid duplicate areas in the same address space*/
-		parea=clone_area(Nom,&Address,B_ANY_ADDRESS,B_READ_AREA | B_WRITE_AREA,parea);
+
+		/*
+		 * TODO : a check of address space might be done to avoid
+		 * duplicate areas in the same address space
+		 */
+		parea = clone_area(Nom, &Address, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, parea);
 		return parea;
 	}
 	else
 	{
 		/* Area does not  exist, but creation is requested, so create it */
-		if (flags&IPC_CREAT)
+		if (flags & IPC_CREAT)
 		{
-			int32* Address;
-			void* Ad;
-			long i;
+			int32	   *Address;
+			void	   *Ad;
+			long		i;
 
-			/* Limit to 250 (8 byte per sem : 4 for the semid and 4 for the last pid
-			which acceced the semaphore in a pool */
-			if (semNum>250)
+			/*
+			 * Limit to 250 (8 byte per sem : 4 for the semid and 4 for
+			 * the last pid which acceced the semaphore in a pool
+			 */
+			if (semNum > 250)
 			{
-				errno=ENOSPC;
+				errno = ENOSPC;
 				return -1;
 			}
 
 			/* Create the shared memory area which will hold the pool */
-			parea=create_area(Nom,&Ad,B_ANY_ADDRESS,4096,B_NO_LOCK,B_READ_AREA | B_WRITE_AREA);		
-			if ((parea==B_BAD_VALUE)|| (parea==B_NO_MEMORY)||(parea==B_ERROR))
+			parea = create_area(Nom, &Ad, B_ANY_ADDRESS, 4096, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
+			if ((parea == B_BAD_VALUE) || (parea == B_NO_MEMORY) || (parea == B_ERROR))
 			{
-				errno=ENOMEM;
+				errno = ENOMEM;
 				return -1;
 			}
-			
+
 			/* fill up informations (sem number and sem ids) */
-			Address=(int32*)Ad;
-			Address[0]=semNum;
-			for (i=0;i<Address[0];i++)
+			Address = (int32 *) Ad;
+			Address[0] = semNum;
+			for (i = 0; i < Address[0]; i++)
 			{
 				/* Create the semaphores */
-				Address[2*i+1]=create_sem(0,Nom);
-				
-				if ((Address[2*i+1]==B_BAD_VALUE)|| (Address[2*i+1]==B_NO_MEMORY)||(Address[2*i+1]==B_NO_MORE_SEMS))
+				Address[2 * i + 1] = create_sem(0, Nom);
+
+				if ((Address[2 * i + 1] == B_BAD_VALUE) || (Address[2 * i + 1] == B_NO_MEMORY) || (Address[2 * i + 1] == B_NO_MORE_SEMS))
 				{
-					errno=ENOMEM;
+					errno = ENOMEM;
 					return -1;
 				}
 			}
@@ -236,59 +259,58 @@ int semget(int semKey, int semNum, int flags)
 		else
 		{
 			/* Area does not exist and no creation is requested */
-			errno=ENOENT;
+			errno = ENOENT;
 			return -1;
 		}
 	}
 }
 
 /* Acquire or release in the semaphore pool */
-int semop(int semId, struct sembuf *sops, int nsops)
+int
+semop(int semId, struct sembuf * sops, int nsops)
 {
-	int32* Address; /*Pool address*/
-   	area_info info; 
-	long i;
-	long ret;
+	int32	   *Address;		/* Pool address */
+	area_info	info;
+	long		i;
+	long		ret;
 
 	/* Get the pool address (semId IS an area id) */
-	get_area_info(semId,&info);
-	Address=(int32*)info.address;
-	
+	get_area_info(semId, &info);
+	Address = (int32 *) info.address;
+
 	/* Check the validity of semId (it should be an area id) */
-	if ((semId==B_BAD_VALUE)||(semId==B_NO_MEMORY)||(semId==B_ERROR))
+	if ((semId == B_BAD_VALUE) || (semId == B_NO_MEMORY) || (semId == B_ERROR))
 	{
-		errno=EINVAL;
+		errno = EINVAL;
 		return -1;
 	}
 
 	/* Perform acquire or release */
-	for(i=0;i<nsops;i++)
+	for (i = 0; i < nsops; i++)
 	{
 		/* remember the PID */
-		Address[2*(sops[i].sem_num)+2]=getpid();
-		
+		Address[2 * (sops[i].sem_num) + 2] = getpid();
+
 		/* For each sem in the pool, check the operation to perform */
 		if (sops[i].sem_op < 0)
 		{
-			/* Try acuiring the semaphore till we are not inteerupted by a signal */
-			if (sops[i].sem_flg==IPC_NOWAIT)
+
+			/*
+			 * Try acuiring the semaphore till we are not inteerupted by a
+			 * signal
+			 */
+			if (sops[i].sem_flg == IPC_NOWAIT)
 			{
 				/* Try to lock ... */
-				while ((ret=acquire_sem_etc(Address[2*(sops[i].sem_num)+1],-sops[i].sem_op,B_RELATIVE_TIMEOUT,0))==B_INTERRUPTED);
-				if (ret!=B_OK)
-				{
+				while ((ret = acquire_sem_etc(Address[2 * (sops[i].sem_num) + 1], -sops[i].sem_op, B_RELATIVE_TIMEOUT, 0)) == B_INTERRUPTED);
+				if (ret != B_OK)
 					return EWOULDBLOCK;
-				}
 			}
 			else
-			{
-				while (acquire_sem_etc(Address[2*(sops[i].sem_num)+1],-sops[i].sem_op,0,0)==B_INTERRUPTED);
-			}
+				while (acquire_sem_etc(Address[2 * (sops[i].sem_num) + 1], -sops[i].sem_op, 0, 0) == B_INTERRUPTED);
 		}
 		if (sops[i].sem_op > 0)
-		{
-			release_sem_etc(Address[2*(sops[i].sem_num)+1],sops[i].sem_op,0);
-		}
+			release_sem_etc(Address[2 * (sops[i].sem_num) + 1], sops[i].sem_op, 0);
 	}
 
 	return 0;
diff --git a/src/backend/port/beos/shm.c b/src/backend/port/beos/shm.c
index b30fc2b6b370e1c64da3281c42800db0242e47c8..56e44d38535d1013defddee12633cbf7279f1755 100644
--- a/src/backend/port/beos/shm.c
+++ b/src/backend/port/beos/shm.c
@@ -4,7 +4,7 @@
  *	  BeOS System V Shared Memory Emulation
  *
  * Copyright (c) 1999-2001, Cyril VELTER
- * 
+ *
  *-------------------------------------------------------------------------
  */
 
@@ -18,48 +18,61 @@ areas in copy on write mode */
 
 
 /* Detach from a shared mem area based on its address */
-int shmdt(char* shmaddr)
+int
+shmdt(char *shmaddr)
 {
 	/* Find area id for this address */
-	area_id s;
-	s=area_for(shmaddr);
+	area_id		s;
+
+	s = area_for(shmaddr);
 
 	/* Delete area */
 	return delete_area(s);
 }
 
 /* Attach to an existing area */
-int* shmat(int memId,int m1,int m2)
+int *
+shmat(int memId, int m1, int m2)
 {
 	/* Get our team id */
 	thread_info thinfo;
-	team_info teinfo;
-	area_info ainfo; 
-	
-	get_thread_info(find_thread(NULL),&thinfo);
-	get_team_info(thinfo.team,&teinfo);
-	
+	team_info	teinfo;
+	area_info	ainfo;
+
+	get_thread_info(find_thread(NULL), &thinfo);
+	get_team_info(thinfo.team, &teinfo);
+
 	/* Get area teamid */
-	if (get_area_info(memId,&ainfo)!=B_OK)
-		printf("AREA %d Invalide\n",memId);
-	
-	if (ainfo.team==teinfo.team)
+	if (get_area_info(memId, &ainfo) != B_OK)
+		printf("AREA %d Invalide\n", memId);
+
+	if (ainfo.team == teinfo.team)
 	{
-		/* the area is already in our address space, just return the address */
-		return (int*)ainfo.address;
-	}	
+
+		/*
+		 * the area is already in our address space, just return the
+		 * address
+		 */
+		return (int *) ainfo.address;
+	}
 	else
 	{
-		/* the area is not in our address space, clone it before and return the address */
-		area_id narea;
-		narea = clone_area(ainfo.name,&(ainfo.address),B_CLONE_ADDRESS,B_READ_AREA | B_WRITE_AREA,memId);	
-		get_area_info(narea,&ainfo);	
-		return (int*)ainfo.address;
+
+		/*
+		 * the area is not in our address space, clone it before and
+		 * return the address
+		 */
+		area_id		narea;
+
+		narea = clone_area(ainfo.name, &(ainfo.address), B_CLONE_ADDRESS, B_READ_AREA | B_WRITE_AREA, memId);
+		get_area_info(narea, &ainfo);
+		return (int *) ainfo.address;
 	}
 }
 
 /* Control a shared mem area */
-int shmctl(int shmid, int flag, struct shmid_ds* dummy)
+int
+shmctl(int shmid, int flag, struct shmid_ds * dummy)
 {
 	if (flag == IPC_RMID)
 	{
@@ -71,26 +84,26 @@ int shmctl(int shmid, int flag, struct shmid_ds* dummy)
 	{
 		/* Find any SYSV area with the shmid in its name */
 
-		area_info inf;
-		team_info infteam;
-		int32 cookteam=0;
-		char name[50];
-		sprintf(name,"SYSV_IPC %d",shmid);	
-	
-		dummy->shm_nattch=0;
-		
+		area_info	inf;
+		team_info	infteam;
+		int32		cookteam = 0;
+		char		name[50];
+
+		sprintf(name, "SYSV_IPC %d", shmid);
+
+		dummy->shm_nattch = 0;
+
 		while (get_next_team_info(&cookteam, &infteam) == B_OK)
-		{ 
-			int32 cook=0;
+		{
+			int32		cook = 0;
+
 			while (get_next_area_info(infteam.team, &cook, &inf) == B_OK)
 			{
-				if (strcmp(name,inf.name) == 0)
-				{
-					dummy->shm_nattch++;	
-				}
+				if (strcmp(name, inf.name) == 0)
+					dummy->shm_nattch++;
 			}
 		}
-			
+
 		errno = 0;
 		return 0;
 	}
@@ -99,31 +112,30 @@ int shmctl(int shmid, int flag, struct shmid_ds* dummy)
 }
 
 /* Get an area based on the IPC key */
-int shmget(int memKey,int size,int flag)
+int
+shmget(int memKey, int size, int flag)
 {
-	char nom[50];
-	void* Address;
-	area_id parea;
+	char		nom[50];
+	void	   *Address;
+	area_id		parea;
 
 	/* Area name */
-	sprintf(nom,"SYSV_IPC_SHM : %d",memKey);
+	sprintf(nom, "SYSV_IPC_SHM : %d", memKey);
 
 	/* Find area */
-	parea=find_area(nom);
-	
+	parea = find_area(nom);
+
 	/* area exist, just return its id */
-	if (parea!=B_NAME_NOT_FOUND)
-	{
+	if (parea != B_NAME_NOT_FOUND)
 		return parea;
-	}	
 
 	/* area does not exist and no creation is requested : error */
-	if (flag==0)
-	{
+	if (flag == 0)
 		return -1;
-	}
-	
-	/* area does not exist and its creation is requested, create it (be sure to have a 4ko multiple size */
-	return create_area(nom,&Address,B_ANY_ADDRESS,((size/4096)+1)*4096,B_NO_LOCK,B_READ_AREA | B_WRITE_AREA);		
-}
 
+	/*
+	 * area does not exist and its creation is requested, create it (be
+	 * sure to have a 4ko multiple size
+	 */
+	return create_area(nom, &Address, B_ANY_ADDRESS, ((size / 4096) + 1) * 4096, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
+}
diff --git a/src/backend/port/beos/support.c b/src/backend/port/beos/support.c
index 5dfe9e31976e6eab29d4446222f6d00fc1b4fce6..bc5264e5490e295b789c1a094779e38d2010cde6 100644
--- a/src/backend/port/beos/support.c
+++ b/src/backend/port/beos/support.c
@@ -4,19 +4,19 @@
  *	  BeOS Support functions
  *
  * Copyright (c) 1999-2001, Cyril VELTER
- * 
+ *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
 
 /* Support Globals */
-port_id beos_dl_port_in=0;
-port_id beos_dl_port_out=0;
-sem_id beos_shm_sem;
+port_id		beos_dl_port_in = 0;
+port_id		beos_dl_port_out = 0;
+sem_id		beos_shm_sem;
 
 /* Global var containing the postgres path */
-extern char		pg_pathname[];
+extern char pg_pathname[];
 
 
 /* Shared library loading doesn't work after fork in beos. The solution is to use an exact
@@ -27,185 +27,194 @@ postgres executable just run a loop to wait command on a port. Its only action i
 the beos_dl_open will then remap the good areas in the backend address space. */
 
 
-image_id beos_dl_open(char * filename)
+image_id
+beos_dl_open(char *filename)
 {
-	image_id im;
+	image_id	im;
 
-	/* If a port doesn't exist, lauch support server */ 
-	if ((beos_dl_port_in<=0)||(beos_dl_port_out<=0))
+	/* If a port doesn't exist, lauch support server */
+	if ((beos_dl_port_in <= 0) || (beos_dl_port_out <= 0))
 	{
 		/* Create communication port */
-		beos_dl_port_in=create_port(50,"beos_support_in");
-		beos_dl_port_out=create_port(50,"beos_support_in");
+		beos_dl_port_in = create_port(50, "beos_support_in");
+		beos_dl_port_out = create_port(50, "beos_support_in");
 
 
-		if ((beos_dl_port_in<=0)||(beos_dl_port_out<=0))
+		if ((beos_dl_port_in <= 0) || (beos_dl_port_out <= 0))
 		{
-			elog(NOTICE, "Error loading BeOS support server : can't create communication ports");				
+			elog(NOTICE, "Error loading BeOS support server : can't create communication ports");
 			return B_ERROR;
 		}
 		else
 		{
-			char Cmd[4000]; 
-		
+			char		Cmd[4000];
+
 			/* Build arg list */
-			sprintf(Cmd,"%s -beossupportserver %d %d &",pg_pathname,(int)beos_dl_port_in,(int)beos_dl_port_out);
+			sprintf(Cmd, "%s -beossupportserver %d %d &", pg_pathname, (int) beos_dl_port_in, (int) beos_dl_port_out);
 
 			/* Lauch process */
 			system(Cmd);
 		}
 	}
-	
+
 	/* Add-on loading */
-	
+
 	/* Send command '1' (load) to the support server */
-	write_port(beos_dl_port_in,1,filename,strlen(filename)+1);
-	
+	write_port(beos_dl_port_in, 1, filename, strlen(filename) + 1);
+
 	/* Read Object Id */
-	read_port(beos_dl_port_out,&im,NULL,0);
+	read_port(beos_dl_port_out, &im, NULL, 0);
 
 	/* Checking integrity */
-	if (im<0)
-	{	
+	if (im < 0)
+	{
 		elog(NOTICE, "Can't load this add-on ");
-		return B_ERROR;	
+		return B_ERROR;
 	}
 	else
 	{
 		/* Map text and data segment in our address space */
-		char datas[4000];
-		int32 area;
-		int32 resu;
-		void* add;
-	
+		char		datas[4000];
+		int32		area;
+		int32		resu;
+		void	   *add;
+
 		/* read text segment id and address */
-		read_port(beos_dl_port_out,&area,datas,4000);
-		read_port(beos_dl_port_out,(void*)&add,datas,4000);
+		read_port(beos_dl_port_out, &area, datas, 4000);
+		read_port(beos_dl_port_out, (void *) &add, datas, 4000);
 		/* map text segment in our address space */
-		resu=clone_area(datas,&add,B_EXACT_ADDRESS,B_READ_AREA|B_WRITE_AREA,area);
-		if (resu<0)
+		resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
+		if (resu < 0)
 		{
 			/* If we can't map, we are in reload case */
 			/* delete the mapping */
-			resu=delete_area(area_for(add));
+			resu = delete_area(area_for(add));
 			/* Remap */
-			resu=clone_area(datas,&add,B_EXACT_ADDRESS,B_READ_AREA|B_WRITE_AREA,area);
-			if (resu<0)
-			{
+			resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
+			if (resu < 0)
 				elog(NOTICE, "Can't load this add-on : map text error");
-			}
 		}
-		
+
 		/* read text segment id and address */
-		read_port(beos_dl_port_out,&area,datas,4000);
-		read_port(beos_dl_port_out,(void*)&add,datas,4000);
+		read_port(beos_dl_port_out, &area, datas, 4000);
+		read_port(beos_dl_port_out, (void *) &add, datas, 4000);
 		/* map text segment in our address space */
-		resu=clone_area(datas,&add,B_EXACT_ADDRESS,B_READ_AREA|B_WRITE_AREA,area);
-		if (resu<0)
+		resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
+		if (resu < 0)
 		{
 			/* If we can't map, we are in reload case */
 			/* delete the mapping */
-			resu=delete_area(area_for(add));
+			resu = delete_area(area_for(add));
 			/* Remap */
-			resu=clone_area(datas,&add,B_EXACT_ADDRESS,B_READ_AREA|B_WRITE_AREA,area);
-			if (resu<0)
-			{
+			resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
+			if (resu < 0)
 				elog(NOTICE, "Can't load this add-on : map data error");
-			}
 		}
-		
+
 		return im;
 	}
 }
 
-status_t beos_dl_close(image_id im)
+status_t
+beos_dl_close(image_id im)
 {
 	/* unload add-on */
-	int32 resu;
-	write_port(beos_dl_port_in,2,&im,4);
-	read_port(beos_dl_port_out,&resu,NULL,0);
+	int32		resu;
+
+	write_port(beos_dl_port_in, 2, &im, 4);
+	read_port(beos_dl_port_out, &resu, NULL, 0);
 	return resu;
 }
 
 /* Main support server loop */
 
-void beos_startup(int argc,char** argv)
+void
+beos_startup(int argc, char **argv)
 {
 	if (strlen(argv[0]) >= 10 && !strcmp(argv[0] + strlen(argv[0]) - 10, "postmaster"))
 	{
-		/* We are in the postmaster, create the protection semaphore for shared mem remapping */
-		beos_shm_sem=create_sem(1,"beos_shm_sem");	
+
+		/*
+		 * We are in the postmaster, create the protection semaphore for
+		 * shared mem remapping
+		 */
+		beos_shm_sem = create_sem(1, "beos_shm_sem");
 	}
 
 	if (argc > 1 && strcmp(argv[1], "-beossupportserver") == 0)
 	{
 		/* We are in the support server, run it ... */
 
-		port_id port_in;
-		port_id port_out;
-		
+		port_id		port_in;
+		port_id		port_out;
+
 		/* Get back port ids from arglist */
-		sscanf(argv[2],"%d",(int*)(&port_in));
-		sscanf(argv[3],"%d",(int*)(&port_out));
-			
+		sscanf(argv[2], "%d", (int *) (&port_in));
+		sscanf(argv[3], "%d", (int *) (&port_out));
+
 		/* Main server loop */
 		for (;;)
-		{ 
-			int32 opcode=0;
-			char datas[4000];
-	
-			/* Wait for a message from the backend :
-			1 : load a shared object 
-			2 : unload a shared object
-			any other : exit support server */
-			read_port(port_in,&opcode,datas,4000);
-	
-			switch(opcode)
+		{
+			int32		opcode = 0;
+			char		datas[4000];
+
+			/*
+			 * Wait for a message from the backend : 1 : load a shared
+			 * object 2 : unload a shared object any other : exit support
+			 * server
+			 */
+			read_port(port_in, &opcode, datas, 4000);
+
+			switch (opcode)
 			{
-				image_id addon;
-				image_info info_im;
-				area_info info_ar;
-	
-				/* Load Add-On */
-				case 1 :
-		
+					image_id	addon;
+					image_info	info_im;
+					area_info	info_ar;
+
+					/* Load Add-On */
+				case 1:
+
 					/* Load shared object */
-					addon=load_add_on(datas);
-		
+					addon = load_add_on(datas);
+
 					/* send back the shared object Id */
-					write_port(port_out,addon,NULL,0);
-					
+					write_port(port_out, addon, NULL, 0);
+
 					/* Get Shared Object infos */
-					get_image_info(addon,&info_im);
-	
+					get_image_info(addon, &info_im);
+
 					/* get text segment info */
-					get_area_info(area_for(info_im.text),&info_ar);
+					get_area_info(area_for(info_im.text), &info_ar);
 					/* Send back area_id of text segment */
-					write_port(port_out,info_ar.area,info_ar.name,strlen(info_ar.name)+1);
+					write_port(port_out, info_ar.area, info_ar.name, strlen(info_ar.name) + 1);
 					/* Send back real address of text segment */
-					write_port(port_out,(int)info_ar.address,info_ar.name,strlen(info_ar.name)+1);
-			
-					
+					write_port(port_out, (int) info_ar.address, info_ar.name, strlen(info_ar.name) + 1);
+
+
 					/* get data segment info */
-					get_area_info(area_for(info_im.data),&info_ar);
+					get_area_info(area_for(info_im.data), &info_ar);
 					/* Send back area_id of data segment */
-					write_port(port_out,info_ar.area,info_ar.name,strlen(info_ar.name)+1);
+					write_port(port_out, info_ar.area, info_ar.name, strlen(info_ar.name) + 1);
 					/* Send back real address of data segment */
-					write_port(port_out,(int)info_ar.address,info_ar.name,strlen(info_ar.name)+1);
-				break;
-				/* UnLoad Add-On */
-				case 2 :
-					/* Unload shared object and send back the result of the operation */
-					write_port(port_out,unload_add_on(*((int*)(datas))),NULL,0);
-				break;
-				/* Cleanup and exit */
+					write_port(port_out, (int) info_ar.address, info_ar.name, strlen(info_ar.name) + 1);
+					break;
+					/* UnLoad Add-On */
+				case 2:
+
+					/*
+					 * Unload shared object and send back the result of
+					 * the operation
+					 */
+					write_port(port_out, unload_add_on(*((int *) (datas))), NULL, 0);
+					break;
+					/* Cleanup and exit */
 				default:
 					/* Free system resources */
 					delete_port(port_in);
 					delete_port(port_out);
 					/* Exit */
 					exit(0);
-				break;
+					break;
 			}
 		}
 		/* Never be there */
@@ -215,76 +224,80 @@ void beos_startup(int argc,char** argv)
 
 
 
-/* The behavior of fork is borken on beos regarding shared memory. In fact 
+/* The behavior of fork is borken on beos regarding shared memory. In fact
 all shared memory areas are clones in copy on write mode in the new process.
 
 We need to do a remapping of these areas. Just afer the fork we performe the
 following actions :
 
 	* Find all areas with a name begining by SYS_V_IPC_ in our process
-	(areas created by the SYSV IPC emulation functions). The name is 
-	followed by the IPC KEY in decimal format 
-	
+	(areas created by the SYSV IPC emulation functions). The name is
+	followed by the IPC KEY in decimal format
+
 	* For each area we do :
-	
+
 		* 1 : Get its name
 		* 2 : destroy it
-		* 3 : find another area with the exact same name	
+		* 3 : find another area with the exact same name
 		* 4 : clone it in our address space with a different name
-		
+
 	There is a race condition in 3-4 : if there two fork in a very short
 	time, in step 3 we might end up with two areas with the same name, and no
 	possibility to find the postmaster one. So the whole process is protected
 	by a semaphore which is acquires just before the fork and released in case
 	of fork failure or just after the end of the remapping.*/
-	
-void beos_before_backend_startup(void)
+
+void
+beos_before_backend_startup(void)
 {
-	/* Just before forking, acquire the semaphore */	
-	if(acquire_sem(beos_shm_sem)!=B_OK)
-		exit(1); 		/* Fatal error, exiting with error */
+	/* Just before forking, acquire the semaphore */
+	if (acquire_sem(beos_shm_sem) != B_OK)
+		exit(1);				/* Fatal error, exiting with error */
 }
 
-void beos_backend_startup_failed(void)
+void
+beos_backend_startup_failed(void)
 {
 	/* The foek failed, just release the semaphore */
 	release_sem(beos_shm_sem);
 }
 
 
-void beos_backend_startup(void)
+void
+beos_backend_startup(void)
 {
-	char nom[50];
-	char nvnom[50];
-	area_info inf;
-	int32 cook=0;
+	char		nom[50];
+	char		nvnom[50];
+	area_info	inf;
+	int32		cook = 0;
 
 	/* Perform the remapping process */
 
 	/* Loop in all our team areas */
 	while (get_next_area_info(0, &cook, &inf) == B_OK)
 	{
-		strcpy(nom,inf.name);
-		strcpy(nvnom,inf.name);
-		nom[9]=0;
-		nvnom[5]='i';
+		strcpy(nom, inf.name);
+		strcpy(nvnom, inf.name);
+		nom[9] = 0;
+		nvnom[5] = 'i';
 		/* Is it a SYS V area ? */
-		if (!strcmp(nom,"SYSV_IPC_"))
+		if (!strcmp(nom, "SYSV_IPC_"))
 		{
-			void* area_address;
-			area_id area_postmaster;
+			void	   *area_address;
+			area_id		area_postmaster;
+
 			/* Get the area address */
-			area_address=inf.address;
+			area_address = inf.address;
 			/* Destroy the bad area */
 			delete_area(inf.area);
 			/* Find the postmaster area */
-			area_postmaster=find_area(inf.name);
+			area_postmaster = find_area(inf.name);
 			/* Compute new area name */
-			sprintf(nvnom,"SYSV_IPC %d",area_postmaster);
+			sprintf(nvnom, "SYSV_IPC %d", area_postmaster);
 			/* Clone it at the exact same address */
-			clone_area(nvnom,&area_address,B_CLONE_ADDRESS,B_READ_AREA|B_WRITE_AREA,area_postmaster);
+			clone_area(nvnom, &area_address, B_CLONE_ADDRESS, B_READ_AREA | B_WRITE_AREA, area_postmaster);
 		}
-	} 
+	}
 
 	/* remapping done release semaphore to allow other backend to startup */
 
diff --git a/src/backend/port/darwin/sem.c b/src/backend/port/darwin/sem.c
index 7dc7b0c919402fbc715d80dbbbbe1ab76c13ffe8..6130e6d72b26335397f74f9ded769c223cc43781 100644
--- a/src/backend/port/darwin/sem.c
+++ b/src/backend/port/darwin/sem.c
@@ -4,13 +4,13 @@
  *	  System V Semaphore Emulation
  *
  * Copyright (c) 1999, repas AEG Automation GmbH
- * 
- * 2000-12-1 pmb@mac.com 
- *   - changed from anonymous to named semaphores for darwin
- *   - this required changing sem_info from containig an array of sem_t to an array of sem_t*
+ *
+ * 2000-12-1 pmb@mac.com
+ *	 - changed from anonymous to named semaphores for darwin
+ *	 - this required changing sem_info from containig an array of sem_t to an array of sem_t*
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/darwin/Attic/sem.c,v 1.2 2001/01/17 22:11:19 momjian Exp $
+ *		 $Header: /cvsroot/pgsql/src/backend/port/darwin/Attic/sem.c,v 1.3 2001/03/22 03:59:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,13 +27,13 @@
 #include "storage/proc.h"
 #include "port/darwin/sem.h"
 
-#define SEMMAX  IPC_NMAXSEM
+#define SEMMAX	IPC_NMAXSEM
 #define SETMAX ((MAXBACKENDS + SEMMAX - 1) / SEMMAX)
 #define OPMAX	8
 
 #define MODE	0700
 #define SHM_INFO_NAME	"SysV_Sem_Info"
-#define SEM_NAME       "/pgsql-darwin"
+#define SEM_NAME	   "/pgsql-darwin"
 
 struct pending_ops
 {
@@ -43,12 +43,12 @@ struct pending_ops
 
 struct sem_info
 {
-       sem_t*          sem;
+	sem_t	   *sem;
 	struct
 	{
 		key_t		key;
 		int			nsems;
-               sem_t*          sem[SEMMAX];/* array of POSIX semaphores */
+		sem_t	   *sem[SEMMAX];/* array of POSIX semaphores */
 		struct sem	semV[SEMMAX];		/* array of System V semaphore
 										 * structures */
 		struct pending_ops pendingOps[SEMMAX];	/* array of pending
@@ -64,12 +64,12 @@ semctl(int semid, int semnum, int cmd, /* ... */ union semun arg)
 {
 	int			r = 0;
 
-       sem_wait(SemInfo->sem);
+	sem_wait(SemInfo->sem);
 
 	if (semid < 0 || semid >= SETMAX ||
 		semnum < 0 || semnum >= SemInfo->set[semid].nsems)
 	{
-               sem_post(SemInfo->sem);
+		sem_post(SemInfo->sem);
 		errno = EINVAL;
 		return -1;
 	}
@@ -109,7 +109,7 @@ semctl(int semid, int semnum, int cmd, /* ... */ union semun arg)
 		case IPC_RMID:
 			for (semnum = 0; semnum < SemInfo->set[semid].nsems; semnum++)
 			{
-                               if (sem_close(SemInfo->set[semid].sem[semnum]) == -1)
+				if (sem_close(SemInfo->set[semid].sem[semnum]) == -1)
 					r = -1;
 			}
 			SemInfo->set[semid].key = -1;
@@ -117,12 +117,12 @@ semctl(int semid, int semnum, int cmd, /* ... */ union semun arg)
 			break;
 
 		default:
-                       sem_post(SemInfo->sem);
+			sem_post(SemInfo->sem);
 			errno = EINVAL;
 			return -1;
 	}
 
-       sem_post(SemInfo->sem);
+	sem_post(SemInfo->sem);
 
 	return r;
 }
@@ -134,12 +134,12 @@ semget(key_t key, int nsems, int semflg)
 				semid,
 				semnum /* , semnum1 */ ;
 	int			exist = 0;
-       char                    semname[64];
+	char		semname[64];
 
 	if (nsems < 0 || nsems > SEMMAX)
 	{
 #ifdef DEBUG_IPC
-               fprintf(stderr, "darwin semget aborting because nsems out of range. (%d)\n", nsems);
+		fprintf(stderr, "darwin semget aborting because nsems out of range. (%d)\n", nsems);
 #endif
 		errno = EINVAL;
 		return -1;
@@ -149,13 +149,13 @@ semget(key_t key, int nsems, int semflg)
 	if (SemInfo == (struct sem_info *) - 1)
 	{
 #ifdef DEBUG_IPC
-               fprintf(stderr, "darwin initializing shared mem for semaphore shim.\n");
+		fprintf(stderr, "darwin initializing shared mem for semaphore shim.\n");
 #endif
 		/* test if the shared memory already exists */
 		fd = shm_open(SHM_INFO_NAME, O_RDWR | O_CREAT | O_EXCL, MODE);
 		if (fd == -1 && errno == EEXIST)
 		{
-/* 			exist = 1; */
+/*			exist = 1; */
 			shm_unlink(SHM_INFO_NAME);
 			fd = shm_open(SHM_INFO_NAME, O_RDWR | O_CREAT | O_EXCL, MODE);
 		}
@@ -163,7 +163,7 @@ semget(key_t key, int nsems, int semflg)
 			return fd;
 		shm_unlink(SHM_INFO_NAME);
 		/* The size may only be set once. Ignore errors. */
-               ftruncate(fd, sizeof(struct sem_info));
+		ftruncate(fd, sizeof(struct sem_info));
 		SemInfo = mmap(NULL, sizeof(struct sem_info),
 					   PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
 		if (SemInfo == MAP_FAILED)
@@ -171,22 +171,22 @@ semget(key_t key, int nsems, int semflg)
 		if (!exist)
 		{
 			/* create semaphore for locking */
-                       sprintf(semname, "%s-map", SEM_NAME);
+			sprintf(semname, "%s-map", SEM_NAME);
 #ifdef DEBUG_IPC
-                       fprintf(stderr, "darwin creating sem %s to cover shared mem.\n", semname);
+			fprintf(stderr, "darwin creating sem %s to cover shared mem.\n", semname);
 #endif
-                       SemInfo->sem = sem_open(semname, O_CREAT, semflg & 0777, 1);
-                       sem_unlink(semname);
-                       sem_wait(SemInfo->sem);
+			SemInfo->sem = sem_open(semname, O_CREAT, semflg & 0777, 1);
+			sem_unlink(semname);
+			sem_wait(SemInfo->sem);
 			/* initilize shared memory */
 			memset(SemInfo->set, 0, sizeof(SemInfo->set));
 			for (semid = 0; semid < SETMAX; semid++)
 				SemInfo->set[semid].key = -1;
-                       sem_post(SemInfo->sem);
+			sem_post(SemInfo->sem);
 		}
 	}
 
-       sem_wait(SemInfo->sem);
+	sem_wait(SemInfo->sem);
 
 	if (key != IPC_PRIVATE)
 	{
@@ -196,7 +196,7 @@ semget(key_t key, int nsems, int semflg)
 			semid++;
 		if (!(semflg & IPC_CREAT) && semid >= SETMAX)
 		{
-                       sem_post(SemInfo->sem);
+			sem_post(SemInfo->sem);
 			errno = ENOENT;
 			return -1;
 		}
@@ -204,7 +204,7 @@ semget(key_t key, int nsems, int semflg)
 		{
 			if (semflg & IPC_CREAT && semflg & IPC_EXCL)
 			{
-                               sem_post(SemInfo->sem);
+				sem_post(SemInfo->sem);
 				errno = EEXIST;
 				return -1;
 			}
@@ -213,14 +213,14 @@ semget(key_t key, int nsems, int semflg)
 				if (nsems != 0 && SemInfo->set[semid].nsems < nsems)
 				{
 #ifdef DEBUG_IPC
-fprintf(stderr, "darwin semget failed because if (nsems != 0 && SemInfo->set[semid].nsems < nsems) %d %d\n",
-       nsems, SemInfo->set[semid].nsems);
+					fprintf(stderr, "darwin semget failed because if (nsems != 0 && SemInfo->set[semid].nsems < nsems) %d %d\n",
+							nsems, SemInfo->set[semid].nsems);
 #endif
-                                       sem_post(SemInfo->sem);
+					sem_post(SemInfo->sem);
 					errno = EINVAL;
 					return -1;
 				}
-                               sem_post(SemInfo->sem);
+				sem_post(SemInfo->sem);
 				return semid;
 			}
 		}
@@ -233,28 +233,28 @@ fprintf(stderr, "darwin semget failed because if (nsems != 0 && SemInfo->set[sem
 	if (semid >= SETMAX)
 	{
 #ifdef DEBUG_IPC
-               fprintf(stderr, "darwin semget failed because all keys were -1 up to SETMAX\n");
+		fprintf(stderr, "darwin semget failed because all keys were -1 up to SETMAX\n");
 #endif
-               sem_post(SemInfo->sem);
+		sem_post(SemInfo->sem);
 		errno = ENOSPC;
 		return -1;
 	}
 
 	for (semnum = 0; semnum < nsems; semnum++)
 	{
-               sprintf(semname, "%s-%d-%d", SEM_NAME, semid, semnum);
+		sprintf(semname, "%s-%d-%d", SEM_NAME, semid, semnum);
 #ifdef DEBUG_IPC
-               fprintf(stderr, "darwin creating sem %s to cover set %d num %dm.\n", semname, semid, semnum);
+		fprintf(stderr, "darwin creating sem %s to cover set %d num %dm.\n", semname, semid, semnum);
 #endif
-               SemInfo->set[semid].sem[semnum] = sem_open(semname, O_CREAT, semflg & 0777, 0);
-               sem_unlink(semname);
+		SemInfo->set[semid].sem[semnum] = sem_open(semname, O_CREAT, semflg & 0777, 0);
+		sem_unlink(semname);
 
 /* Currently sem_init always returns -1.
 	if( sem_init( &SemInfo->set[semid].sem[semnum], 1, 0 ) == -1 )	{
 	  for( semnum1 = 0; semnum1 < semnum; semnum1++ )  {
-               sem_close( SemInfo->set[semid].sem[semnum1] );
+			   sem_close( SemInfo->set[semid].sem[semnum1] );
 	  }
-         sem_post( SemInfo->sem );
+		 sem_post( SemInfo->sem );
 	  return -1;
 	}
 */
@@ -263,7 +263,7 @@ fprintf(stderr, "darwin semget failed because if (nsems != 0 && SemInfo->set[sem
 	SemInfo->set[semid].key = key;
 	SemInfo->set[semid].nsems = nsems;
 
-       sem_post(SemInfo->sem);
+	sem_post(SemInfo->sem);
 
 	return semid;
 }
@@ -277,11 +277,11 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 				errno1 = 0,
 				op;
 
-       sem_wait(SemInfo->sem);
+	sem_wait(SemInfo->sem);
 
 	if (semid < 0 || semid >= SETMAX)
 	{
-               sem_post(SemInfo->sem);
+		sem_post(SemInfo->sem);
 		errno = EINVAL;
 		return -1;
 	}
@@ -289,7 +289,7 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 	{
 		if ( /* sops[i].sem_num < 0 || */ sops[i].sem_num >= SemInfo->set[semid].nsems)
 		{
-                       sem_post(SemInfo->sem);
+			sem_post(SemInfo->sem);
 			errno = EFBIG;
 			return -1;
 		}
@@ -303,7 +303,7 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 			{
 				if (sops[i].sem_flg & IPC_NOWAIT)
 				{
-                                       sem_post(SemInfo->sem);
+					sem_post(SemInfo->sem);
 					errno = EAGAIN;
 					return -1;
 				}
@@ -311,15 +311,15 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 				if (SemInfo->set[semid].pendingOps[sops[i].sem_num].idx >= OPMAX)
 				{
 					/* pending operations array overflow */
-                                       sem_post(SemInfo->sem);
+					sem_post(SemInfo->sem);
 					errno = ERANGE;
 					return -1;
 				}
 				SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx++] = sops[i].sem_op;
 				/* suspend */
-                               sem_post(SemInfo->sem);         /* avoid deadlock */
-                               r1 = sem_wait(SemInfo->set[semid].sem[sops[i].sem_num]);
-                               sem_wait(SemInfo->sem);
+				sem_post(SemInfo->sem); /* avoid deadlock */
+				r1 = sem_wait(SemInfo->set[semid].sem[sops[i].sem_num]);
+				sem_wait(SemInfo->sem);
 				if (r1)
 				{
 					errno1 = errno;
@@ -343,7 +343,7 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 				if (SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx - 1] + op >= 0)
 				{
 					/* unsuspend processes */
-                                       if (sem_post(SemInfo->set[semid].sem[sops[i].sem_num]))
+					if (sem_post(SemInfo->set[semid].sem[sops[i].sem_num]))
 					{
 						errno1 = errno;
 						r = -1;
@@ -364,14 +364,14 @@ semop(int semid, struct sembuf * sops, size_t nsops)
 			/* sops[i].sem_op == 0 */
 		{
 			/* not supported */
-                       sem_post(SemInfo->sem);
+			sem_post(SemInfo->sem);
 			errno = ENOSYS;
 			return -1;
 		}
 		SemInfo->set[semid].semV[sops[i].sem_num].sempid = getpid();
 	}
 
-       sem_post(SemInfo->sem);
+	sem_post(SemInfo->sem);
 
 	errno = errno1;
 	return r;
diff --git a/src/backend/port/dynloader/aix.c b/src/backend/port/dynloader/aix.c
index c1556bb1c20f73c2357c2a423ada673efcddf83f..44ae28d67dedee4ecc59346487a546569b37ffb4 100644
--- a/src/backend/port/dynloader/aix.c
+++ b/src/backend/port/dynloader/aix.c
@@ -609,4 +609,4 @@ findMain(void)
 	return ret;
 }
 
-#endif /* HAVE_DLOPEN */
+#endif	 /* HAVE_DLOPEN */
diff --git a/src/backend/port/dynloader/aix.h b/src/backend/port/dynloader/aix.h
index 9d8ff105c440f4960b9859182b8d5d7dd692b626..f34d07b06531a031f7a3e2fc8d18accce93e6d17 100644
--- a/src/backend/port/dynloader/aix.h
+++ b/src/backend/port/dynloader/aix.h
@@ -1,5 +1,5 @@
 /*
- * $Id: aix.h,v 1.4 2001/02/10 02:31:26 tgl Exp $
+ * $Id: aix.h,v 1.5 2001/03/22 03:59:42 momjian Exp $
  *
  * @(#)dlfcn.h	1.4 revision of 95/04/25  09:36:52
  * This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
@@ -13,7 +13,7 @@
 
 #include <dlfcn.h>
 
-#else /* HAVE_DLOPEN */
+#else							/* HAVE_DLOPEN */
 
 #ifdef __cplusplus
 extern		"C"
@@ -54,13 +54,13 @@ extern		"C"
 
 #endif
 
-#endif /* HAVE_DLOPEN */
+#endif	 /* HAVE_DLOPEN */
 
 #include "utils/dynamic_loader.h"
 
 #define  pg_dlopen(f)	dlopen(f, RTLD_LAZY)
 #define  pg_dlsym	dlsym
-#define  pg_dlclose	dlclose
-#define  pg_dlerror	dlerror
+#define  pg_dlclose dlclose
+#define  pg_dlerror dlerror
 
 #endif	 /* PORT_PROTOS_H */
diff --git a/src/backend/port/dynloader/beos.c b/src/backend/port/dynloader/beos.c
index 80bdbca037390481b3bb9a14203e7917c721c116..dd28c5c5f810ecfeceb20733c81972fdf7a9e599 100644
--- a/src/backend/port/dynloader/beos.c
+++ b/src/backend/port/dynloader/beos.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.6 2001/02/10 02:31:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.7 2001/03/22 03:59:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,59 +18,66 @@
 #include "utils/dynamic_loader.h"
 
 
-void	   *
+void *
 pg_dlopen(char *filename)
 {
-	image_id* im; 
-	
-	/* Handle memory allocation to store the Id of the shared object*/
-	im=(image_id*)(malloc(sizeof(image_id)));
-	
+	image_id   *im;
+
+	/* Handle memory allocation to store the Id of the shared object */
+	im = (image_id *) (malloc(sizeof(image_id)));
+
 	/* Add-on loading */
-	*im=beos_dl_open(filename);
-			
+	*im = beos_dl_open(filename);
+
 	return im;
 }
 
 
-char	   *
+char *
 pg_dlerror()
 {
 	static char errmsg[] = "Load Add-On failed";
+
 	return errmsg;
 }
 
-PGFunction 
+PGFunction
 pg_dlsym(void *handle, char *funcname)
 {
-	PGFunction fpt;
+	PGFunction	fpt;
 
 	/* Checking that "Handle" is valid */
-	if ((handle) && ((*(int*)(handle))>=0))
+	if ((handle) && ((*(int *) (handle)) >= 0))
 	{
 		/* Loading symbol */
-		if(get_image_symbol(*((int*)(handle)),funcname,B_SYMBOL_TYPE_TEXT,(void**)&fpt)==B_OK);
+		if (get_image_symbol(*((int *) (handle)), funcname, B_SYMBOL_TYPE_TEXT, (void **) &fpt) == B_OK);
 		{
-			/* Sometime the loader return B_OK for an inexistant function with an invalid address !!! 
-			Check that the return address is in the image range */
-			image_info info;
-			get_image_info(*((int*)(handle)),&info);
-			if ((fpt<info.text) || (fpt>=(info.text+info.text_size))) return NULL;
+
+			/*
+			 * Sometime the loader return B_OK for an inexistant function
+			 * with an invalid address !!! Check that the return address
+			 * is in the image range
+			 */
+			image_info	info;
+
+			get_image_info(*((int *) (handle)), &info);
+			if ((fpt < info.text) ||(fpt >= (info.text +info.text_size)))
+				return NULL;
 			return fpt;
 		}
-		elog(NOTICE, "loading symbol '%s' failed ",funcname);
+		elog(NOTICE, "loading symbol '%s' failed ", funcname);
 	}
 	elog(NOTICE, "add-on not loaded correctly");
 	return NULL;
 }
 
-void 
+void
 pg_dlclose(void *handle)
 {
 	/* Checking that "Handle" is valid */
-	if ((handle) && ((*(int*)(handle))>=0))
+	if ((handle) && ((*(int *) (handle)) >= 0))
 	{
-		if (beos_dl_close(*(image_id*)handle)!=B_OK)
+		if (beos_dl_close(*(image_id *) handle) != B_OK)
 			elog(NOTICE, "error while unloading add-on");
 		free(handle);
 	}
diff --git a/src/backend/port/dynloader/darwin.c b/src/backend/port/dynloader/darwin.c
index 6c149b9f55e0c68a30b8c7f6f23d0da72041b3de..9f95d4011f94d2f87dc721a296991394f9be07f5 100644
--- a/src/backend/port/dynloader/darwin.c
+++ b/src/backend/port/dynloader/darwin.c
@@ -1,16 +1,17 @@
 /*
  * These routines were taken from the Apache source, but were made
- * available with a PostgreSQL-compatible license.  Kudos Wilfredo
+ * available with a PostgreSQL-compatible license.	Kudos Wilfredo
  * S�nchez <wsanchez@apple.com>.
  *
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.4 2000/12/11 00:49:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.5 2001/03/22 03:59:42 momjian Exp $
  */
 
 #include "postgres.h"
 #include <mach-o/dyld.h>
 #include "dynloader.h"
 
-void *pg_dlopen(char *filename)
+void *
+pg_dlopen(char *filename)
 {
 	NSObjectFileImage image;
 
@@ -20,16 +21,18 @@ void *pg_dlopen(char *filename)
 	return NSLinkModule(image, filename, TRUE);
 }
 
-void pg_dlclose(void *handle)
+void
+pg_dlclose(void *handle)
 {
-	NSUnLinkModule(handle,FALSE);
+	NSUnLinkModule(handle, FALSE);
 	return;
 }
 
-PGFunction pg_dlsym(void *handle, char *funcname)
+PGFunction
+pg_dlsym(void *handle, char *funcname)
 {
-	NSSymbol symbol;
-	char *symname = (char*)malloc(strlen(funcname)+2);
+	NSSymbol	symbol;
+	char	   *symname = (char *) malloc(strlen(funcname) + 2);
 
 	sprintf(symname, "_%s", funcname);
 	if (NSIsSymbolNameDefined(symname))
@@ -41,11 +44,12 @@ PGFunction pg_dlsym(void *handle, char *funcname)
 	else
 	{
 		free(symname);
-		return (PGFunction)NULL;
+		return (PGFunction) NULL;
 	}
 }
 
-char *pg_dlerror(void)
+char *
+pg_dlerror(void)
 {
 	return "no error message available";
 }
diff --git a/src/backend/port/dynloader/darwin.h b/src/backend/port/dynloader/darwin.h
index 0e73eb2be67f8f18ea01c730700511984d665cee..da56c7690e051b0db9c36d88f05e81f71a94fc93 100644
--- a/src/backend/port/dynloader/darwin.h
+++ b/src/backend/port/dynloader/darwin.h
@@ -1,8 +1,8 @@
-/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.3 2000/12/11 00:49:54 tgl Exp $ */
+/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.4 2001/03/22 03:59:42 momjian Exp $ */
 
 #include "fmgr.h"
 
-void*		pg_dlopen(char *filename);
+void	   *pg_dlopen(char *filename);
 PGFunction	pg_dlsym(void *handle, char *funcname);
 void		pg_dlclose(void *handle);
-char*		pg_dlerror(void);
+char	   *pg_dlerror(void);
diff --git a/src/backend/port/dynloader/hpux.c b/src/backend/port/dynloader/hpux.c
index 73e50b718063fc7e88bea66368253ab913b5ec5f..967967e026948b2c61d3e76ea32fa4b058b035a1 100644
--- a/src/backend/port/dynloader/hpux.c
+++ b/src/backend/port/dynloader/hpux.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.17 2001/02/10 02:31:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.18 2001/03/22 03:59:43 momjian Exp $
  *
  *	NOTES
  *		all functions are defined here -- it's impossible to trace the
@@ -28,13 +28,14 @@
 void *
 pg_dlopen(char *filename)
 {
+
 	/*
 	 * Use BIND_IMMEDIATE so that undefined symbols cause a failure return
 	 * from shl_load(), rather than an abort() later on when we attempt to
 	 * call the library!
 	 */
 	shl_t		handle = shl_load(filename,
-								  BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH,
+							BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH,
 								  0L);
 
 	return (void *) handle;
diff --git a/src/backend/port/dynloader/solaris.h b/src/backend/port/dynloader/solaris.h
index 3c70b9095241482173ff3cfe37a033e92bac4ed3..c5f6ec187412b8a1fdc66393684f130143565d0c 100644
--- a/src/backend/port/dynloader/solaris.h
+++ b/src/backend/port/dynloader/solaris.h
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.2 2001/02/10 02:31:26 tgl Exp $ */
+/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.3 2001/03/22 03:59:43 momjian Exp $ */
 
 #ifndef DYNLOADER_SOLARIS_H
 #define DYNLOADER_SOLARIS_H
@@ -11,4 +11,4 @@
 #define pg_dlclose		dlclose
 #define pg_dlerror		dlerror
 
-#endif /* DYNLOADER_SOLARIS_H */
+#endif	 /* DYNLOADER_SOLARIS_H */
diff --git a/src/backend/port/qnx4/shm.c b/src/backend/port/qnx4/shm.c
index 9958f799384978ef795ce836446c50d0e341c813..14c77f4fc9ce6a4089c2857c11931cbc7e88dca6 100644
--- a/src/backend/port/qnx4/shm.c
+++ b/src/backend/port/qnx4/shm.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.3 2001/03/13 01:17:06 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.4 2001/03/22 03:59:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -184,8 +184,10 @@ shmctl(int shmid, int cmd, struct shmid_ds * buf)
 	}
 	if (cmd == IPC_STAT)
 	{
-		/* Can we support IPC_STAT?  We only need shm_nattch ...
-		 * For now, punt and assume the shm seg does not exist.
+
+		/*
+		 * Can we support IPC_STAT?  We only need shm_nattch ... For now,
+		 * punt and assume the shm seg does not exist.
 		 */
 		errno = EINVAL;
 		return -1;
diff --git a/src/backend/port/strtol.c b/src/backend/port/strtol.c
index d70f95901021d977c2b37d5cdc544e519a425c33..4e72275529779213749fecc57fecef8957c5e178 100644
--- a/src/backend/port/strtol.c
+++ b/src/backend/port/strtol.c
@@ -109,7 +109,7 @@ int			base;
 	cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX;
 	cutlim = cutoff % (unsigned long) base;
 	cutoff /= (unsigned long) base;
-	for (acc = 0, any = 0; ; c = *s++)
+	for (acc = 0, any = 0;; c = *s++)
 	{
 		if (isdigit(c))
 			c -= '0';
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 044bc207f92026441d7e0ad33cc686a2cea38ce9..5ee2257e4452ed16a23e8374cfed2086126ea143 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -7,7 +7,7 @@
  *	  message to setup a backend process.
  *
  *	  The postmaster also manages system-wide operations such as
- *	  startup, shutdown, and periodic checkpoints.  The postmaster
+ *	  startup, shutdown, and periodic checkpoints.	The postmaster
  *	  itself doesn't do those operations, mind you --- it just forks
  *	  off a subprocess to do them at the right times.  It also takes
  *	  care of resetting the system if a backend crashes.
@@ -15,7 +15,7 @@
  *	  The postmaster process creates the shared memory and semaphore
  *	  pools during startup, but as a rule does not touch them itself.
  *	  In particular, it is not a member of the PROC array of backends
- *	  and so it cannot participate in lock-manager operations.  Keeping
+ *	  and so it cannot participate in lock-manager operations.	Keeping
  *	  the postmaster away from shared memory operations makes it simpler
  *	  and more reliable.  The postmaster is almost always able to recover
  *	  from crashes of individual backends by resetting shared memory;
@@ -28,7 +28,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.210 2001/03/14 17:58:46 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.211 2001/03/22 03:59:43 momjian Exp $
  *
  * NOTES
  *
@@ -127,9 +127,9 @@ static Dllist *BackendList;
 static Dllist *PortList;
 
 /* The socket number we are listening for connections on */
-int PostPortNumber;
-char *UnixSocketDir;
-char *VirtualHost;
+int			PostPortNumber;
+char	   *UnixSocketDir;
+char	   *VirtualHost;
 
 /*
  * MaxBackends is the actual limit on the number of backends we will
@@ -139,7 +139,7 @@ char *VirtualHost;
  * memory area as well as cause the postmaster to grab more kernel
  * semaphores, even if you never actually use that many backends.
  */
-int	MaxBackends = DEF_MAXBACKENDS;
+int			MaxBackends = DEF_MAXBACKENDS;
 
 
 static char *progname = (char *) NULL;
@@ -158,10 +158,12 @@ static int	ServerSock_INET = INVALID_SOCK;		/* stream socket server */
 
 #ifdef HAVE_UNIX_SOCKETS
 static int	ServerSock_UNIX = INVALID_SOCK;		/* stream socket server */
+
 #endif
 
 #ifdef USE_SSL
 static SSL_CTX *SSL_context = NULL;		/* Global SSL context */
+
 #endif
 
 /*
@@ -179,16 +181,16 @@ static char ExtraOptions[MAXPGPATH];
 static bool Reinit = true;
 static int	SendStop = false;
 
-bool NetServer = false;	/* listen on TCP/IP */
-bool EnableSSL = false;
-bool SilentMode = false;	/* silent mode (-S) */
+bool		NetServer = false;	/* listen on TCP/IP */
+bool		EnableSSL = false;
+bool		SilentMode = false; /* silent mode (-S) */
 
-int				CheckPointTimeout = 300;
+int			CheckPointTimeout = 300;
 
-static pid_t	StartupPID = 0,
-				ShutdownPID = 0,
-				CheckPointPID = 0;
-static time_t	checkpointed = 0;
+static pid_t StartupPID = 0,
+			ShutdownPID = 0,
+			CheckPointPID = 0;
+static time_t checkpointed = 0;
 
 #define			NoShutdown		0
 #define			SmartShutdown	1
@@ -196,7 +198,7 @@ static time_t	checkpointed = 0;
 
 static int	Shutdown = NoShutdown;
 
-static bool FatalError = false;	/* T if recovering from backend crash */
+static bool FatalError = false; /* T if recovering from backend crash */
 
 /*
  * State for assigning random salts and cancel keys.
@@ -262,7 +264,7 @@ checkDataDir(const char *checkdir)
 		fprintf(stderr, "%s does not know where to find the database system "
 				"data.  You must specify the directory that contains the "
 				"database system either by specifying the -D invocation "
-				"option or by setting the PGDATA environment variable.\n\n",
+			 "option or by setting the PGDATA environment variable.\n\n",
 				progname);
 		ExitPostmaster(2);
 	}
@@ -292,7 +294,7 @@ PostmasterMain(int argc, char *argv[])
 	int			opt;
 	int			status;
 	char		original_extraoptions[MAXPGPATH];
-	char       *potential_DataDir = NULL;
+	char	   *potential_DataDir = NULL;
 
 	IsUnderPostmaster = true;	/* so that backends know this */
 
@@ -303,22 +305,22 @@ PostmasterMain(int argc, char *argv[])
 	real_argc = argc;
 
 	/*
-	 * Catch standard options before doing much else.  This even works
-	 * on systems without getopt_long.
+	 * Catch standard options before doing much else.  This even works on
+	 * systems without getopt_long.
 	 */
 	if (argc > 1)
 	{
-		if (strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0)
+		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
 		{
 			usage(progname);
 			ExitPostmaster(0);
 		}
-		if (strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0)
+		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
 		{
 			puts("postmaster (PostgreSQL) " PG_VERSION);
 			ExitPostmaster(0);
 		}
-	}		
+	}
 
 
 	/*
@@ -351,27 +353,26 @@ PostmasterMain(int argc, char *argv[])
 	/*
 	 * Options setup
 	 */
-	potential_DataDir = getenv("PGDATA"); /* default value */
+	potential_DataDir = getenv("PGDATA");		/* default value */
 
 	ResetAllOptions();
 
 	/*
-	 * First we must scan for a -D argument to get the data dir. Then
-	 * read the config file. Finally, scan all the other arguments.
-	 * (Command line switches override config file.)
+	 * First we must scan for a -D argument to get the data dir. Then read
+	 * the config file. Finally, scan all the other arguments. (Command
+	 * line switches override config file.)
 	 *
-	 * Note: The two lists of options must be exactly the same, even
-	 * though perhaps the first one would only have to be "D:" with
-	 * opterr turned off. But some versions of getopt (notably GNU)
-	 * are going to arbitrarily permute some "non-options" (according
-	 * to the local world view) which will result in some switches
-	 * being associated with the wrong argument. Death and destruction
-	 * will occur.
+	 * Note: The two lists of options must be exactly the same, even though
+	 * perhaps the first one would only have to be "D:" with opterr turned
+	 * off. But some versions of getopt (notably GNU) are going to
+	 * arbitrarily permute some "non-options" (according to the local
+	 * world view) which will result in some switches being associated
+	 * with the wrong argument. Death and destruction will occur.
 	 */
 	opterr = 1;
 	while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:")) != EOF)
 	{
-		switch(opt)
+		switch (opt)
 		{
 			case 'D':
 				potential_DataDir = optarg;
@@ -400,7 +401,7 @@ PostmasterMain(int argc, char *argv[])
 
 	IgnoreSystemIndexes(false);
 
-	optind = 1; /* start over */
+	optind = 1;					/* start over */
 #ifdef HAVE_INT_OPTRESET
 	optreset = 1;
 #endif
@@ -449,7 +450,7 @@ PostmasterMain(int argc, char *argv[])
 				break;
 #ifdef USE_SSL
 			case 'l':
-			        EnableSSL = true;
+				EnableSSL = true;
 				break;
 #endif
 			case 'm':
@@ -514,25 +515,26 @@ PostmasterMain(int argc, char *argv[])
 				break;
 			case 'c':
 			case '-':
-			{
-				char *name, *value;
-
-				ParseLongOption(optarg, &name, &value);
-				if (!value)
 				{
-					if (opt == '-')
-						elog(ERROR, "--%s requires argument", optarg);
-					else
-						elog(ERROR, "-c %s requires argument", optarg);
+					char	   *name,
+							   *value;
+
+					ParseLongOption(optarg, &name, &value);
+					if (!value)
+					{
+						if (opt == '-')
+							elog(ERROR, "--%s requires argument", optarg);
+						else
+							elog(ERROR, "-c %s requires argument", optarg);
+					}
+
+					SetConfigOption(name, value, PGC_POSTMASTER);
+					free(name);
+					if (value)
+						free(value);
+					break;
 				}
 
-				SetConfigOption(name, value, PGC_POSTMASTER);
-				free(name);
-				if (value)
-					free(value);
-				break;
-			}
-
 			default:
 				/* shouldn't get here */
 				fprintf(stderr, "Try '%s --help' for more information.\n", progname);
@@ -583,11 +585,11 @@ PostmasterMain(int argc, char *argv[])
 	 *
 	 * We want to do this before we try to grab the input sockets, because
 	 * the data directory interlock is more reliable than the socket-file
-	 * interlock (thanks to whoever decided to put socket files in /tmp :-().
-	 * For the same reason, it's best to grab the TCP socket before the
-	 * Unix socket.
+	 * interlock (thanks to whoever decided to put socket files in /tmp
+	 * :-(). For the same reason, it's best to grab the TCP socket before
+	 * the Unix socket.
 	 */
-	if (! CreateDataDirLockFile(DataDir, true))
+	if (!CreateDataDirLockFile(DataDir, true))
 		ExitPostmaster(1);
 
 	/*
@@ -601,14 +603,14 @@ PostmasterMain(int argc, char *argv[])
 		ExitPostmaster(1);
 	}
 	if (EnableSSL)
-	        InitSSL();
+		InitSSL();
 #endif
 
 	if (NetServer)
 	{
 		status = StreamServerPort(AF_INET, VirtualHost,
-						(unsigned short) PostPortNumber, UnixSocketDir,
-						&ServerSock_INET);
+						  (unsigned short) PostPortNumber, UnixSocketDir,
+								  &ServerSock_INET);
 		if (status != STATUS_OK)
 		{
 			fprintf(stderr, "%s: cannot create INET stream port\n",
@@ -619,8 +621,8 @@ PostmasterMain(int argc, char *argv[])
 
 #ifdef HAVE_UNIX_SOCKETS
 	status = StreamServerPort(AF_UNIX, VirtualHost,
-						(unsigned short) PostPortNumber, UnixSocketDir, 
-						&ServerSock_UNIX);
+						  (unsigned short) PostPortNumber, UnixSocketDir,
+							  &ServerSock_UNIX);
 	if (status != STATUS_OK)
 	{
 		fprintf(stderr, "%s: cannot create UNIX stream port\n",
@@ -644,8 +646,9 @@ PostmasterMain(int argc, char *argv[])
 	PortList = DLNewList();
 
 	/*
-	 * Record postmaster options.  We delay this till now to avoid recording
-	 * bogus options (eg, NBuffers too high for available memory).
+	 * Record postmaster options.  We delay this till now to avoid
+	 * recording bogus options (eg, NBuffers too high for available
+	 * memory).
 	 */
 	if (!CreateOptsFile(argc, argv))
 		ExitPostmaster(1);
@@ -656,13 +659,15 @@ PostmasterMain(int argc, char *argv[])
 	pqinitmask();
 	PG_SETMASK(&BlockSig);
 
-	pqsignal(SIGHUP, SIGHUP_handler);	/* reread config file and have children do same */
+	pqsignal(SIGHUP, SIGHUP_handler);	/* reread config file and have
+										 * children do same */
 	pqsignal(SIGINT, pmdie);	/* send SIGTERM and ShutdownDataBase */
 	pqsignal(SIGQUIT, pmdie);	/* send SIGQUIT and die */
 	pqsignal(SIGTERM, pmdie);	/* wait for children and ShutdownDataBase */
 	pqsignal(SIGALRM, SIG_IGN); /* ignored */
 	pqsignal(SIGPIPE, SIG_IGN); /* ignored */
-	pqsignal(SIGUSR1, schedule_checkpoint);	/* start a background checkpoint */
+	pqsignal(SIGUSR1, schedule_checkpoint);		/* start a background
+												 * checkpoint */
 	pqsignal(SIGUSR2, pmdie);	/* send SIGUSR2, don't die */
 	pqsignal(SIGCHLD, reaper);	/* handle child termination */
 	pqsignal(SIGTTIN, SIG_IGN); /* ignored */
@@ -677,7 +682,8 @@ PostmasterMain(int argc, char *argv[])
 	status = ServerLoop();
 
 	/*
-	 * ServerLoop probably shouldn't ever return, but if it does, close down.
+	 * ServerLoop probably shouldn't ever return, but if it does, close
+	 * down.
 	 */
 	ExitPostmaster(status != STATUS_OK);
 
@@ -749,7 +755,7 @@ usage(const char *progname)
 	printf("  -l              enable SSL connections\n");
 #endif
 	printf("  -N MAX-CONNECT  maximum number of allowed connections (1..%d, default %d)\n",
-			MAXBACKENDS, DEF_MAXBACKENDS);
+		   MAXBACKENDS, DEF_MAXBACKENDS);
 	printf("  -o OPTIONS      pass 'OPTIONS' to each backend server\n");
 	printf("  -p PORT         port number to listen on (default %d)\n", DEF_PGPORT);
 	printf("  -S              silent mode (start in background without logging output)\n");
@@ -782,20 +788,24 @@ ServerLoop(void)
 
 	for (;;)
 	{
-		Port		   *port;
-		fd_set			rmask,
-						wmask;
+		Port	   *port;
+		fd_set		rmask,
+					wmask;
 		struct timeval *timeout = NULL;
-		struct timeval	timeout_tv;
+		struct timeval timeout_tv;
 
 		if (CheckPointPID == 0 && checkpointed &&
 			Shutdown == NoShutdown && !FatalError)
 		{
-			time_t	now = time(NULL);
+			time_t		now = time(NULL);
 
 			if (CheckPointTimeout + checkpointed > now)
 			{
-				/* Not time for checkpoint yet, so set a timeout for select */
+
+				/*
+				 * Not time for checkpoint yet, so set a timeout for
+				 * select
+				 */
 				timeout_tv.tv_sec = CheckPointTimeout + checkpointed - now;
 				timeout_tv.tv_usec = 0;
 				timeout = &timeout_tv;
@@ -804,15 +814,18 @@ ServerLoop(void)
 			{
 				/* Time to make the checkpoint... */
 				CheckPointPID = CheckPointDataBase();
-				/* if fork failed, schedule another try at 0.1 normal delay */
+
+				/*
+				 * if fork failed, schedule another try at 0.1 normal
+				 * delay
+				 */
 				if (CheckPointPID == 0)
-				{
 					checkpointed = now - (9 * CheckPointTimeout) / 10;
-				}
 			}
 		}
 
 #ifdef USE_SSL
+
 		/*
 		 * If we are using SSL, there may be input data already read and
 		 * pending in SSL's input buffers.  If so, check for additional
@@ -955,19 +968,18 @@ ServerLoop(void)
 
 			if (status == STATUS_OK && port->pktInfo.state == Idle)
 			{
+
 				/*
 				 * Can we accept a connection now?
 				 *
-				 * Even though readStartupPacket() already checked,
-				 * we have to check again in case conditions changed
-				 * while negotiating authentication.
+				 * Even though readStartupPacket() already checked, we have
+				 * to check again in case conditions changed while
+				 * negotiating authentication.
 				 */
-				char   *rejectMsg = canAcceptConnections();
+				char	   *rejectMsg = canAcceptConnections();
 
 				if (rejectMsg != NULL)
-				{
 					PacketSendError(&port->pktInfo, rejectMsg);
-				}
 				else
 				{
 
@@ -1008,7 +1020,7 @@ ServerLoop(void)
 			}
 
 			curr = next;
-		} /* loop over active ports */
+		}						/* loop over active ports */
 	}
 }
 
@@ -1087,20 +1099,20 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
 		if (send(port->sock, &SSLok, 1, 0) != 1)
 		{
 			perror("Failed to send SSL negotiation response");
-			return STATUS_ERROR; /* Close connection */
+			return STATUS_ERROR;/* Close connection */
 		}
 
 #ifdef USE_SSL
 		if (SSLok == 'S')
 		{
-		  if (!(port->ssl = SSL_new(SSL_context)) ||
-		      !SSL_set_fd(port->ssl, port->sock) ||
-		      SSL_accept(port->ssl) <= 0)
-		    {
-		      fprintf(stderr, "Failed to initialize SSL connection: %s, errno: %d (%s)\n",
-			      ERR_reason_error_string(ERR_get_error()), errno, strerror(errno));
-		      return STATUS_ERROR;
-		    }
+			if (!(port->ssl = SSL_new(SSL_context)) ||
+				!SSL_set_fd(port->ssl, port->sock) ||
+				SSL_accept(port->ssl) <= 0)
+			{
+				fprintf(stderr, "Failed to initialize SSL connection: %s, errno: %d (%s)\n",
+						ERR_reason_error_string(ERR_get_error()), errno, strerror(errno));
+				return STATUS_ERROR;
+			}
 		}
 #endif
 		/* ready for the normal startup packet */
@@ -1140,13 +1152,16 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
 	if (port->database[0] == '\0')
 		StrNCpy(port->database, si->user, sizeof(port->database));
 
-	/* Truncate given database and user names to length of a Postgres name. */
+	/*
+	 * Truncate given database and user names to length of a Postgres
+	 * name.
+	 */
 	/* This avoids lookup failures when overlength names are given. */
 
 	if ((int) sizeof(port->database) >= NAMEDATALEN)
-		port->database[NAMEDATALEN-1] = '\0';
+		port->database[NAMEDATALEN - 1] = '\0';
 	if ((int) sizeof(port->user) >= NAMEDATALEN)
-		port->user[NAMEDATALEN-1] = '\0';
+		port->user[NAMEDATALEN - 1] = '\0';
 
 	/* Check a user name was given. */
 
@@ -1158,8 +1173,8 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
 	}
 
 	/*
-	 * If we're going to reject the connection due to database state,
-	 * say so now instead of wasting cycles on an authentication exchange.
+	 * If we're going to reject the connection due to database state, say
+	 * so now instead of wasting cycles on an authentication exchange.
 	 * (This also allows a pg_ping utility to be written.)
 	 */
 	rejectMsg = canAcceptConnections();
@@ -1358,13 +1373,15 @@ ClosePostmasterPorts(Port *myConn)
 static void
 reset_shared(unsigned short port)
 {
+
 	/*
-	 * Reset assignment of shared mem and semaphore IPC keys.
-	 * Doing this means that in normal cases we'll assign the same keys
-	 * on each "cycle of life", and thereby avoid leaving dead IPC objects
+	 * Reset assignment of shared mem and semaphore IPC keys. Doing this
+	 * means that in normal cases we'll assign the same keys on each
+	 * "cycle of life", and thereby avoid leaving dead IPC objects
 	 * floating around if the postmaster crashes and is restarted.
 	 */
 	IpcInitKeyAssignment(port);
+
 	/*
 	 * Create or re-create shared memory and semaphores.
 	 */
@@ -1540,10 +1557,13 @@ static void
 reaper(SIGNAL_ARGS)
 {
 	int			save_errno = errno;
+
 #ifdef HAVE_WAITPID
 	int			status;			/* backend exit status */
+
 #else
 	union wait	status;			/* backend exit status */
+
 #endif
 	int			exitstatus;
 	int			pid;			/* process id of dead backend */
@@ -1589,7 +1609,7 @@ reaper(SIGNAL_ARGS)
 				ExitPostmaster(1);
 			}
 			StartupPID = 0;
-			FatalError = false;	/* done with recovery */
+			FatalError = false; /* done with recovery */
 			if (Shutdown > NoShutdown)
 			{
 				if (ShutdownPID > 0)
@@ -1618,7 +1638,8 @@ reaper(SIGNAL_ARGS)
 	{
 
 		/*
-		 * Wait for all children exit, then reset shmem and StartupDataBase.
+		 * Wait for all children exit, then reset shmem and
+		 * StartupDataBase.
 		 */
 		if (DLGetHead(BackendList) || StartupPID > 0 || ShutdownPID > 0)
 		{
@@ -1735,14 +1756,15 @@ CleanupProc(int pid,
 		bp = (Backend *) DLE_VAL(curr);
 		if (bp->pid != pid)
 		{
+
 			/*
 			 * This backend is still alive.  Unless we did so already,
 			 * tell it to commit hara-kiri.
 			 *
 			 * SIGQUIT is the special signal that says exit without proc_exit
-			 * and let the user know what's going on. But if SendStop is set
-			 * (-s on command line), then we send SIGSTOP instead, so that we
-			 * can get core dumps from all backends by hand.
+			 * and let the user know what's going on. But if SendStop is
+			 * set (-s on command line), then we send SIGSTOP instead, so
+			 * that we can get core dumps from all backends by hand.
 			 */
 			if (!FatalError)
 			{
@@ -1756,12 +1778,13 @@ CleanupProc(int pid,
 		}
 		else
 		{
+
 			/*
 			 * Found entry for freshly-dead backend, so remove it.
 			 *
-			 * Don't call ProcRemove() here, since shmem may be corrupted!
-			 * We are going to reinitialize shmem and semaphores anyway
-			 * once all the children are dead, so no need for it.
+			 * Don't call ProcRemove() here, since shmem may be corrupted! We
+			 * are going to reinitialize shmem and semaphores anyway once
+			 * all the children are dead, so no need for it.
 			 */
 			DLRemove(curr);
 			free(bp);
@@ -2278,7 +2301,7 @@ static pid_t
 SSDataBase(int xlop)
 {
 	pid_t		pid;
-	Backend	   *bn;
+	Backend    *bn;
 
 	fflush(stdout);
 	fflush(stderr);
@@ -2340,13 +2363,14 @@ SSDataBase(int xlop)
 #endif
 
 		fprintf(stderr, "%s Data Base: fork failed: %s\n",
-				((xlop == BS_XLOG_STARTUP) ? "Startup" : 
+				((xlop == BS_XLOG_STARTUP) ? "Startup" :
 				 ((xlop == BS_XLOG_CHECKPOINT) ? "CheckPoint" :
 				  "Shutdown")),
 				strerror(errno));
+
 		/*
-		 * fork failure is fatal during startup/shutdown, but there's
-		 * no need to choke if a routine checkpoint fails.
+		 * fork failure is fatal during startup/shutdown, but there's no
+		 * need to choke if a routine checkpoint fails.
 		 */
 		if (xlop == BS_XLOG_CHECKPOINT)
 			return 0;
@@ -2354,9 +2378,9 @@ SSDataBase(int xlop)
 	}
 
 	/*
-	 * The startup and shutdown processes are not considered normal backends,
-	 * but the checkpoint process is.  Checkpoint must be added to the list
-	 * of backends.
+	 * The startup and shutdown processes are not considered normal
+	 * backends, but the checkpoint process is.  Checkpoint must be added
+	 * to the list of backends.
 	 */
 	if (xlop == BS_XLOG_CHECKPOINT)
 	{
@@ -2372,9 +2396,9 @@ SSDataBase(int xlop)
 		DLAddHead(BackendList, DLNewElem(bn));
 
 		/*
-		 * Since this code is executed periodically, it's a fine
-		 * place to do other actions that should happen every now
-		 * and then on no particular schedule.  Such as...
+		 * Since this code is executed periodically, it's a fine place to
+		 * do other actions that should happen every now and then on no
+		 * particular schedule.  Such as...
 		 */
 		TouchSocketLockFile();
 	}
@@ -2389,10 +2413,10 @@ SSDataBase(int xlop)
 static bool
 CreateOptsFile(int argc, char *argv[])
 {
-	char    fullprogname[MAXPGPATH];
-	char   *filename;
-	FILE   *fp;
-	unsigned i;
+	char		fullprogname[MAXPGPATH];
+	char	   *filename;
+	FILE	   *fp;
+	unsigned	i;
 
 	if (FindExec(fullprogname, argv[0], "postmaster") == -1)
 		return false;
diff --git a/src/backend/regex/engine.c b/src/backend/regex/engine.c
index 17aa3c8a4906736dfd528664fc1aaf0ae1151911..8bf0ee68954102fce720e985f6e29af5eded944e 100644
--- a/src/backend/regex/engine.c
+++ b/src/backend/regex/engine.c
@@ -80,25 +80,25 @@ struct match
 	pg_wchar   *endp;			/* end of string -- virtual NUL here */
 	pg_wchar   *coldp;			/* can be no match starting before here */
 	pg_wchar  **lastpos;		/* [nplus+1] */
-	STATEVARS;
+				STATEVARS;
 	states		st;				/* current states */
 	states		fresh;			/* states for a fresh start */
 	states		tmp;			/* temporary */
 	states		empty;			/* empty set of states */
 };
 
-static int matcher(struct re_guts *g, pg_wchar *string, size_t nmatch,
-				   regmatch_t *pmatch, int eflags);
-static pg_wchar *dissect(struct match *m, pg_wchar *start, pg_wchar *stop,
-						 sopno startst, sopno stopst);
-static pg_wchar *backref(struct match *m, pg_wchar *start, pg_wchar *stop,
-						 sopno startst, sopno stopst, sopno lev);
-static pg_wchar *fast(struct match *m, pg_wchar *start, pg_wchar *stop,
-					  sopno startst, sopno stopst);
-static pg_wchar *slow(struct match *m, pg_wchar *start, pg_wchar *stop,
-					  sopno startst, sopno stopst);
-static states step(struct re_guts *g, sopno start,
-				   sopno stop, states bef, int ch, states aft);
+static int matcher(struct re_guts * g, pg_wchar * string, size_t nmatch,
+		regmatch_t *pmatch, int eflags);
+static pg_wchar *dissect(struct match * m, pg_wchar * start, pg_wchar * stop,
+		sopno startst, sopno stopst);
+static pg_wchar *backref(struct match * m, pg_wchar * start, pg_wchar * stop,
+		sopno startst, sopno stopst, sopno lev);
+static pg_wchar *fast(struct match * m, pg_wchar * start, pg_wchar * stop,
+	 sopno startst, sopno stopst);
+static pg_wchar *slow(struct match * m, pg_wchar * start, pg_wchar * stop,
+	 sopno startst, sopno stopst);
+static states step(struct re_guts * g, sopno start,
+	 sopno stop, states bef, int ch, states aft);
 
 #define BOL		(OUT+1)
 #define EOL		(BOL+1)
@@ -117,12 +117,13 @@ static states step(struct re_guts *g, sopno start,
 #endif
 
 #ifdef REDEBUG
-static void print(struct match *m, pg_wchar *caption, states st, int ch,
-				  FILE *d);
-static void at(struct match *m, pg_wchar *title, pg_wchar *start,
-			   pg_wchar *stop, sopno startst, sopno stopst);
+static void print(struct match * m, pg_wchar * caption, states st, int ch,
+	  FILE *d);
+static void at(struct match * m, pg_wchar * title, pg_wchar * start,
+   pg_wchar * stop, sopno startst, sopno stopst);
 static pg_wchar *pchar(int ch);
-static int pg_isprint(int c);
+static int	pg_isprint(int c);
+
 #endif
 
 #ifdef REDEBUG
@@ -139,7 +140,7 @@ static int pg_isprint(int c);
  * matcher - the actual matching engine
  */
 static int						/* 0 success, REG_NOMATCH failure */
-matcher(struct re_guts *g, pg_wchar *string, size_t nmatch,
+matcher(struct re_guts * g, pg_wchar * string, size_t nmatch,
 		regmatch_t *pmatch, int eflags)
 {
 	pg_wchar   *endp;
@@ -325,7 +326,7 @@ matcher(struct re_guts *g, pg_wchar *string, size_t nmatch,
  * dissect - figure out what matched what, no back references
  */
 static pg_wchar *				/* == stop (success) always */
-dissect(struct match *m, pg_wchar *start, pg_wchar *stop,
+dissect(struct match * m, pg_wchar * start, pg_wchar * stop,
 		sopno startst, sopno stopst)
 {
 	int			i;
@@ -521,7 +522,7 @@ dissect(struct match *m, pg_wchar *start, pg_wchar *stop,
  * lev is PLUS nesting level
  */
 static pg_wchar *				/* == stop (success) or NULL (failure) */
-backref(struct match *m, pg_wchar *start, pg_wchar *stop,
+backref(struct match * m, pg_wchar * start, pg_wchar * stop,
 		sopno startst, sopno stopst, sopno lev)
 {
 	int			i;
@@ -728,7 +729,7 @@ backref(struct match *m, pg_wchar *start, pg_wchar *stop,
  * fast - step through the string at top speed
  */
 static pg_wchar *				/* where tentative match ended, or NULL */
-fast(struct match *m, pg_wchar *start, pg_wchar *stop,
+fast(struct match * m, pg_wchar * start, pg_wchar * stop,
 	 sopno startst, sopno stopst)
 {
 	states		st = m->st;
@@ -817,7 +818,7 @@ fast(struct match *m, pg_wchar *start, pg_wchar *stop,
  * slow - step through the string more deliberately
  */
 static pg_wchar *				/* where it ended */
-slow(struct match *m, pg_wchar *start, pg_wchar *stop,
+slow(struct match * m, pg_wchar * start, pg_wchar * stop,
 	 sopno startst, sopno stopst)
 {
 	states		st = m->st;
@@ -901,7 +902,7 @@ slow(struct match *m, pg_wchar *start, pg_wchar *stop,
  * step - map set of states reachable before char to set reachable after
  */
 static states
-step(struct re_guts *g,
+step(struct re_guts * g,
 	 sopno start,				/* start state within strip */
 	 sopno stop,				/* state after stop state within strip */
 	 states bef,				/* states reachable before */
@@ -1023,7 +1024,7 @@ step(struct re_guts *g,
  * print - print a set of states
  */
 static void
-print(struct match *m, pg_wchar *caption, states st,
+print(struct match * m, pg_wchar * caption, states st,
 	  int ch, FILE *d)
 {
 	struct re_guts *g = m->g;
@@ -1049,7 +1050,7 @@ print(struct match *m, pg_wchar *caption, states st,
  * at - print current situation
  */
 static void
-at(struct match *m, pg_wchar *title, pg_wchar *start, pg_wchar *stop,
+at(struct match * m, pg_wchar * title, pg_wchar * start, pg_wchar * stop,
    sopno startst, sopno stopst)
 {
 	if (!(m->eflags & REG_TRACE))
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index b45a3c52375917b66a454248a1f56f7957959d13..837a12c27ced2f7950dba1885e1a95393a372a25 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -82,10 +82,13 @@ static void p_b_cclass(struct parse * p, cset *cs);
 static void p_b_eclass(struct parse * p, cset *cs);
 static pg_wchar p_b_symbol(struct parse * p);
 static char p_b_coll_elem(struct parse * p, int endc);
+
 #ifdef MULTIBYTE
 static unsigned char othercase(int ch);
+
 #else
 static char othercase(int ch);
+
 #endif
 static void bothcases(struct parse * p, int ch);
 static void ordinary(struct parse * p, int ch);
@@ -295,8 +298,8 @@ pg95_regcomp(regex_t *preg, const char *pattern, int cflags)
  * p_ere - ERE parser top level, concatenation and alternation
  */
 static void
-p_ere(struct parse *p,
-	  int stop)				/* character this ERE should end at */
+p_ere(struct parse * p,
+	  int stop)					/* character this ERE should end at */
 {
 	char		c;
 	sopno		prevback = 0;
@@ -342,7 +345,7 @@ p_ere(struct parse *p,
  * p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
  */
 static void
-p_ere_exp(struct parse *p)
+p_ere_exp(struct parse * p)
 {
 	pg_wchar	c;
 	sopno		pos;
@@ -501,7 +504,7 @@ p_ere_exp(struct parse *p)
  * p_str - string (no metacharacters) "parser"
  */
 static void
-p_str(struct parse *p)
+p_str(struct parse * p)
 {
 	REQUIRE(MORE(), REG_EMPTY);
 	while (MORE())
@@ -520,7 +523,7 @@ p_str(struct parse *p)
  * The amount of lookahead needed to avoid this kludge is excessive.
  */
 static void
-p_bre(struct parse *p,
+p_bre(struct parse * p,
 	  int end1,					/* first terminating character */
 	  int end2)					/* second terminating character */
 {
@@ -554,7 +557,7 @@ p_bre(struct parse *p,
  * p_simp_re - parse a simple RE, an atom possibly followed by a repetition
  */
 static int						/* was the simple RE an unbackslashed $? */
-p_simp_re(struct parse *p,
+p_simp_re(struct parse * p,
 		  int starordinary)		/* is a leading * an ordinary character? */
 {
 	int			c;
@@ -691,7 +694,7 @@ p_simp_re(struct parse *p,
  * p_count - parse a repetition count
  */
 static int						/* the value */
-p_count(struct parse *p)
+p_count(struct parse * p)
 {
 	int			count = 0;
 	int			ndigits = 0;
@@ -713,7 +716,7 @@ p_count(struct parse *p)
  * no set operations are done.
  */
 static void
-p_bracket(struct parse *p)
+p_bracket(struct parse * p)
 {
 	cset	   *cs = allocset(p);
 	int			invert = 0;
@@ -806,7 +809,7 @@ p_bracket(struct parse *p)
  * p_b_term - parse one term of a bracketed character list
  */
 static void
-p_b_term(struct parse *p, cset *cs)
+p_b_term(struct parse * p, cset *cs)
 {
 	pg_wchar	c;
 	pg_wchar	start,
@@ -878,7 +881,7 @@ p_b_term(struct parse *p, cset *cs)
  * p_b_cclass - parse a character-class name and deal with it
  */
 static void
-p_b_cclass(struct parse *p, cset *cs)
+p_b_cclass(struct parse * p, cset *cs)
 {
 	pg_wchar   *sp = p->next;
 	struct cclass *cp;
@@ -916,7 +919,7 @@ p_b_cclass(struct parse *p, cset *cs)
  * This implementation is incomplete. xxx
  */
 static void
-p_b_eclass(struct parse *p, cset *cs)
+p_b_eclass(struct parse * p, cset *cs)
 {
 	char		c;
 
@@ -928,7 +931,7 @@ p_b_eclass(struct parse *p, cset *cs)
  * p_b_symbol - parse a character or [..]ed multicharacter collating symbol
  */
 static pg_wchar			/* value of symbol */
-p_b_symbol(struct parse *p)
+p_b_symbol(struct parse * p)
 {
 	pg_wchar	value;
 
@@ -946,7 +949,7 @@ p_b_symbol(struct parse *p)
  * p_b_coll_elem - parse a collating-element name and look it up
  */
 static char						/* value of collating element */
-p_b_coll_elem(struct parse *p, int endc)
+p_b_coll_elem(struct parse * p, int endc)
 {
 	pg_wchar   *sp = p->next;
 	struct cname *cp;
@@ -1011,7 +1014,7 @@ othercase(int ch)
  * Boy, is this implementation ever a kludge...
  */
 static void
-bothcases(struct parse *p, int ch)
+bothcases(struct parse * p, int ch)
 {
 	pg_wchar   *oldnext = p->next;
 	pg_wchar   *oldend = p->end;
@@ -1033,7 +1036,7 @@ bothcases(struct parse *p, int ch)
  * ordinary - emit an ordinary character
  */
 static void
-ordinary(struct parse *p, int ch)
+ordinary(struct parse * p, int ch)
 {
 	cat_t	   *cap = p->g->categories;
 
@@ -1057,7 +1060,7 @@ ordinary(struct parse *p, int ch)
  * Boy, is this implementation ever a kludge...
  */
 static void
-nonnewline(struct parse *p)
+nonnewline(struct parse * p)
 {
 	pg_wchar   *oldnext = p->next;
 	pg_wchar   *oldend = p->end;
@@ -1079,7 +1082,7 @@ nonnewline(struct parse *p)
  * repeat - generate code for a bounded repetition, recursively if needed
  */
 static void
-repeat(struct parse *p,
+repeat(struct parse * p,
 	   sopno start,				/* operand from here to end of strip */
 	   int from,				/* repeated from this number */
 	   int to)					/* to this number of times (maybe
@@ -1152,7 +1155,7 @@ repeat(struct parse *p,
  * seterr - set an error condition
  */
 static int						/* useless but makes type checking happy */
-seterr(struct parse *p, int e)
+seterr(struct parse * p, int e)
 {
 	if (p->error == 0)			/* keep earliest error condition */
 		p->error = e;
@@ -1165,7 +1168,7 @@ seterr(struct parse *p, int e)
  * allocset - allocate a set of characters for []
  */
 static cset *
-allocset(struct parse *p)
+allocset(struct parse * p)
 {
 	int			no = p->g->ncsets++;
 	size_t		nc;
@@ -1221,7 +1224,7 @@ allocset(struct parse *p)
  * freeset - free a now-unused set
  */
 static void
-freeset(struct parse *p, cset *cs)
+freeset(struct parse * p, cset *cs)
 {
 	int			i;
 	cset	   *top = &p->g->sets[p->g->ncsets];
@@ -1243,7 +1246,7 @@ freeset(struct parse *p, cset *cs)
  * the same value!
  */
 static int						/* set number */
-freezeset(struct parse *p, cset *cs)
+freezeset(struct parse * p, cset *cs)
 {
 	uch			h = cs->hash;
 	int			i;
@@ -1276,7 +1279,7 @@ freezeset(struct parse *p, cset *cs)
  * firstch - return first character in a set (which must have at least one)
  */
 static int						/* character; there is no "none" value */
-firstch(struct parse *p, cset *cs)
+firstch(struct parse * p, cset *cs)
 {
 	int			i;
 	size_t		css = (size_t) p->g->csetsize;
@@ -1292,7 +1295,7 @@ firstch(struct parse *p, cset *cs)
  * nch - number of characters in a set
  */
 static int
-nch(struct parse *p, cset *cs)
+nch(struct parse * p, cset *cs)
 {
 	int			i;
 	size_t		css = (size_t) p->g->csetsize;
@@ -1308,7 +1311,7 @@ nch(struct parse *p, cset *cs)
  * mcadd - add a collating element to a cset
  */
 static void
-mcadd(struct parse *p, cset *cs, char *cp)
+mcadd(struct parse * p, cset *cs, char *cp)
 {
 	size_t		oldend = cs->smultis;
 
@@ -1334,7 +1337,7 @@ mcadd(struct parse *p, cset *cs, char *cp)
  * is deferred.
  */
 static void
-mcinvert(struct parse *p, cset *cs)
+mcinvert(struct parse * p, cset *cs)
 {
 	assert(cs->multis == NULL); /* xxx */
 }
@@ -1346,7 +1349,7 @@ mcinvert(struct parse *p, cset *cs)
  * is deferred.
  */
 static void
-mccase(struct parse *p, cset *cs)
+mccase(struct parse * p, cset *cs)
 {
 	assert(cs->multis == NULL); /* xxx */
 }
@@ -1355,7 +1358,7 @@ mccase(struct parse *p, cset *cs)
  * isinsets - is this character in any sets?
  */
 static int						/* predicate */
-isinsets(struct re_guts *g, int c)
+isinsets(struct re_guts * g, int c)
 {
 	uch		   *col;
 	int			i;
@@ -1372,7 +1375,7 @@ isinsets(struct re_guts *g, int c)
  * samesets - are these two characters in exactly the same sets?
  */
 static int						/* predicate */
-samesets(struct re_guts *g, int c1, int c2)
+samesets(struct re_guts * g, int c1, int c2)
 {
 	uch		   *col;
 	int			i;
@@ -1390,7 +1393,7 @@ samesets(struct re_guts *g, int c1, int c2)
  * categorize - sort out character categories
  */
 static void
-categorize(struct parse *p, struct re_guts *g)
+categorize(struct parse * p, struct re_guts * g)
 {
 	cat_t	   *cats = g->categories;
 	int			c;
@@ -1416,7 +1419,7 @@ categorize(struct parse *p, struct re_guts *g)
  * dupl - emit a duplicate of a bunch of sops
  */
 static sopno					/* start of duplicate */
-dupl(struct parse *p,
+dupl(struct parse * p,
 	 sopno start,				/* from here */
 	 sopno finish)				/* to this less one */
 {
@@ -1442,7 +1445,7 @@ dupl(struct parse *p,
  * some changes to the data structures.  Maybe later.
  */
 static void
-doemit(struct parse *p, sop op, size_t opnd)
+doemit(struct parse * p, sop op, size_t opnd)
 {
 	/* avoid making error situations worse */
 	if (p->error != 0)
@@ -1464,7 +1467,7 @@ doemit(struct parse *p, sop op, size_t opnd)
  * doinsert - insert a sop into the strip
  */
 static void
-doinsert(struct parse *p, sop op, size_t opnd, sopno pos)
+doinsert(struct parse * p, sop op, size_t opnd, sopno pos)
 {
 	sopno		sn;
 	sop			s;
@@ -1498,7 +1501,7 @@ doinsert(struct parse *p, sop op, size_t opnd, sopno pos)
  * dofwd - complete a forward reference
  */
 static void
-dofwd(struct parse *p, sopno pos, sop value)
+dofwd(struct parse * p, sopno pos, sop value)
 {
 	/* avoid making error situations worse */
 	if (p->error != 0)
@@ -1512,7 +1515,7 @@ dofwd(struct parse *p, sopno pos, sop value)
  * enlarge - enlarge the strip
  */
 static void
-enlarge(struct parse *p, sopno size)
+enlarge(struct parse * p, sopno size)
 {
 	sop		   *sp;
 
@@ -1533,7 +1536,7 @@ enlarge(struct parse *p, sopno size)
  * stripsnug - compact the strip
  */
 static void
-stripsnug(struct parse *p, struct re_guts *g)
+stripsnug(struct parse * p, struct re_guts * g)
 {
 	g->nstates = p->slen;
 	g->strip = (sop *) realloc((char *) p->strip, p->slen * sizeof(sop));
@@ -1554,7 +1557,7 @@ stripsnug(struct parse *p, struct re_guts *g)
  * Note that must and mlen got initialized during setup.
  */
 static void
-findmust(struct parse *p, struct re_guts *g)
+findmust(struct parse * p, struct re_guts * g)
 {
 	sop		   *scan;
 	sop		   *start = 0;
@@ -1643,7 +1646,7 @@ findmust(struct parse *p, struct re_guts *g)
  * pluscount - count + nesting
  */
 static sopno					/* nesting depth */
-pluscount(struct parse *p, struct re_guts *g)
+pluscount(struct parse * p, struct re_guts * g)
 {
 	sop		   *scan;
 	sop			s;
diff --git a/src/backend/regex/regexec.c b/src/backend/regex/regexec.c
index 2d87d249bfd0341b922aa7d02cbc77a2efcf8284..cb52ad9afe472440bbd1570e17fbc1d70f19b6e4 100644
--- a/src/backend/regex/regexec.c
+++ b/src/backend/regex/regexec.c
@@ -73,7 +73,7 @@ static int	nope = 0;			/* for use in asserts; shuts lint up */
 #define onestate		long
 #define INIT(o, n)		((o) = (1L << (n)))
 #define INC(o)			((o) <<= 1)
-#define ISSTATEIN(v, o)	((v) & (o))
+#define ISSTATEIN(v, o) ((v) & (o))
 /* some abbreviations; note that some of these know variable names! */
 /* do "if I'm here, I can also be there" etc without branches */
 #define FWD(dst, src, n)		((dst) |= ((src) & (here)) << (n))
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index d470cb9fe77e693d937933ff357556bc723df9a0..316b18316c62b0191d40ad56428f441a18d2485e 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.58 2001/01/24 19:43:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.59 2001/03/22 03:59:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -175,9 +175,10 @@ DefineQueryRewrite(RuleStmt *stmt)
 	/*
 	 * If we are installing an ON SELECT rule, we had better grab
 	 * AccessExclusiveLock to ensure no SELECTs are currently running on
-	 * the event relation.  For other types of rules, it might be sufficient
-	 * to grab ShareLock to lock out insert/update/delete actions.  But
-	 * for now, let's just grab AccessExclusiveLock all the time.
+	 * the event relation.	For other types of rules, it might be
+	 * sufficient to grab ShareLock to lock out insert/update/delete
+	 * actions.  But for now, let's just grab AccessExclusiveLock all the
+	 * time.
 	 */
 	event_relation = heap_openr(event_obj->relname, AccessExclusiveLock);
 	ev_relid = RelationGetRelid(event_relation);
@@ -226,7 +227,7 @@ DefineQueryRewrite(RuleStmt *stmt)
 	{
 		List	   *tllist;
 		int			i;
-		char		*expected_name;
+		char	   *expected_name;
 
 		/*
 		 * So there cannot be INSTEAD NOTHING, ...
@@ -285,9 +286,10 @@ DefineQueryRewrite(RuleStmt *stmt)
 
 			/*
 			 * Allow typmods to be different only if one of them is -1,
-			 * ie, "unspecified".  This is necessary for cases like "numeric",
-			 * where the table will have a filled-in default length but the
-			 * select rule's expression will probably have typmod = -1.
+			 * ie, "unspecified".  This is necessary for cases like
+			 * "numeric", where the table will have a filled-in default
+			 * length but the select rule's expression will probably have
+			 * typmod = -1.
 			 */
 			if (attr->atttypmod != resdom->restypmod &&
 				attr->atttypmod != -1 && resdom->restypmod != -1)
@@ -327,13 +329,13 @@ DefineQueryRewrite(RuleStmt *stmt)
 		/*
 		 * Are we converting a relation to a view?
 		 *
-		 * If so, check that the relation is empty because the storage
-		 * for the relation is going to be deleted.
+		 * If so, check that the relation is empty because the storage for
+		 * the relation is going to be deleted.
 		 */
 		if (event_relation->rd_rel->relkind != RELKIND_VIEW)
 		{
-			HeapScanDesc  scanDesc;
-			HeapTuple	  tuple;
+			HeapScanDesc scanDesc;
+			HeapTuple	tuple;
 
 			scanDesc = heap_beginscan(event_relation, 0, SnapshotNow, 0, NULL);
 			tuple = heap_getnext(scanDesc, 0);
@@ -341,7 +343,10 @@ DefineQueryRewrite(RuleStmt *stmt)
 				elog(ERROR, "Relation \"%s\" is not empty. Cannot convert it to view",
 					 event_obj->relname);
 
-			/* don't need heap_freetuple because we never got a valid tuple */
+			/*
+			 * don't need heap_freetuple because we never got a valid
+			 * tuple
+			 */
 			heap_endscan(scanDesc);
 
 			RelisBecomingView = true;
@@ -368,10 +373,10 @@ DefineQueryRewrite(RuleStmt *stmt)
 				 is_instead, event_attype);
 
 	/*
-	 * We want the rule's table references to be checked as though by
-	 * the rule owner, not the user referencing the rule.  Therefore,
-	 * scan through the rule's rtables and set the checkAsUser field
-	 * on all rtable entries (except *OLD* and *NEW*).
+	 * We want the rule's table references to be checked as though by the
+	 * rule owner, not the user referencing the rule.  Therefore, scan
+	 * through the rule's rtables and set the checkAsUser field on all
+	 * rtable entries (except *OLD* and *NEW*).
 	 */
 	foreach(l, action)
 	{
@@ -394,21 +399,21 @@ DefineQueryRewrite(RuleStmt *stmt)
 							actionP);
 
 		/*
-		 * Set pg_class 'relhasrules' field TRUE for event relation.
-		 * If appropriate, also modify the 'relkind' field to show that
-		 * the relation is now a view.
+		 * Set pg_class 'relhasrules' field TRUE for event relation. If
+		 * appropriate, also modify the 'relkind' field to show that the
+		 * relation is now a view.
 		 *
 		 * Important side effect: an SI notice is broadcast to force all
-		 * backends (including me!) to update relcache entries with the new
-		 * rule.
+		 * backends (including me!) to update relcache entries with the
+		 * new rule.
 		 */
 		SetRelationRuleStatus(ev_relid, true, RelisBecomingView);
 	}
 
 	/*
-	 * IF the relation is becoming a view, delete the storage
-	 * files associated with it.  NB: we had better have AccessExclusiveLock
-	 * to do this ...
+	 * IF the relation is becoming a view, delete the storage files
+	 * associated with it.	NB: we had better have AccessExclusiveLock to
+	 * do this ...
 	 */
 	if (RelisBecomingView)
 		smgrunlink(DEFAULT_SMGR, event_relation);
@@ -439,21 +444,20 @@ setRuleCheckAsUser(Query *qry, Oid userid)
 
 		if (rte->subquery)
 		{
+
 			/*
 			 * Recurse into subquery in FROM
 			 */
 			setRuleCheckAsUser(rte->subquery, userid);
 		}
 		else
-		{
 			rte->checkAsUser = userid;
-		}
 	}
 
 	/* If there are sublinks, search for them and process their RTEs */
 	if (qry->hasSubLinks)
 		query_tree_walker(qry, setRuleCheckAsUser_walker, (void *) &userid,
-						  false /* already did the ones in rtable */);
+						  false /* already did the ones in rtable */ );
 }
 
 /*
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index 505d5f4350b4d9c369158db24c41ad5d4fa8c83f..6ece2ae938fe5b733bf16113f5b5dcce5767c516 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.89 2001/01/27 04:40:59 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.90 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@ static RewriteInfo *gatherRewriteMeta(Query *parsetree,
 static List *adjustJoinTreeList(Query *parsetree, bool removert, int rt_index);
 static void markQueryForUpdate(Query *qry, bool skipOldNew);
 static List *matchLocks(CmdType event, RuleLock *rulelocks,
-						int varno, Query *parsetree);
+		   int varno, Query *parsetree);
 static Query *fireRIRrules(Query *parsetree);
 
 
@@ -84,9 +84,9 @@ gatherRewriteMeta(Query *parsetree,
 	 * Adjust rule action and qual to offset its varnos, so that we can
 	 * merge its rtable into the main parsetree's rtable.
 	 *
-	 * If the rule action is an INSERT...SELECT, the OLD/NEW rtable
-	 * entries will be in the SELECT part, and we have to modify that
-	 * rather than the top-level INSERT (kluge!).
+	 * If the rule action is an INSERT...SELECT, the OLD/NEW rtable entries
+	 * will be in the SELECT part, and we have to modify that rather than
+	 * the top-level INSERT (kluge!).
 	 */
 	sub_action = getInsertSelectQuery(info->rule_action, &sub_action_ptr);
 
@@ -101,14 +101,14 @@ gatherRewriteMeta(Query *parsetree,
 	/*
 	 * We want the main parsetree's rtable to end up as the concatenation
 	 * of its original contents plus those of all the relevant rule
-	 * actions.  Also store same into all the rule_action rtables.
-	 * Some of the entries may be unused after we finish rewriting, but
-	 * if we tried to clean those out we'd have a much harder job to
-	 * adjust RT indexes in the query's Vars.  It's OK to have unused
-	 * RT entries, since planner will ignore them.
+	 * actions.  Also store same into all the rule_action rtables. Some of
+	 * the entries may be unused after we finish rewriting, but if we
+	 * tried to clean those out we'd have a much harder job to adjust RT
+	 * indexes in the query's Vars.  It's OK to have unused RT entries,
+	 * since planner will ignore them.
 	 *
-	 * NOTE KLUGY HACK: we assume the parsetree rtable had at least one
-	 * entry to begin with (OK enough, else where'd the rule come from?).
+	 * NOTE KLUGY HACK: we assume the parsetree rtable had at least one entry
+	 * to begin with (OK enough, else where'd the rule come from?).
 	 * Because of this, if multiple rules nconc() their rtable additions
 	 * onto parsetree->rtable, they'll all see the same rtable because
 	 * they all have the same list head pointer.
@@ -119,24 +119,25 @@ gatherRewriteMeta(Query *parsetree,
 
 	/*
 	 * Each rule action's jointree should be the main parsetree's jointree
-	 * plus that rule's jointree, but usually *without* the original rtindex
-	 * that we're replacing (if present, which it won't be for INSERT).
-	 * Note that if the rule action refers to OLD, its jointree will add
-	 * a reference to rt_index.  If the rule action doesn't refer to OLD,
-	 * but either the rule_qual or the user query quals do, then we need to
-	 * keep the original rtindex in the jointree to provide data for the
-	 * quals.  We don't want the original rtindex to be joined twice,
-	 * however, so avoid keeping it if the rule action mentions it.
+	 * plus that rule's jointree, but usually *without* the original
+	 * rtindex that we're replacing (if present, which it won't be for
+	 * INSERT). Note that if the rule action refers to OLD, its jointree
+	 * will add a reference to rt_index.  If the rule action doesn't refer
+	 * to OLD, but either the rule_qual or the user query quals do, then
+	 * we need to keep the original rtindex in the jointree to provide
+	 * data for the quals.	We don't want the original rtindex to be
+	 * joined twice, however, so avoid keeping it if the rule action
+	 * mentions it.
 	 */
 	if (sub_action->jointree != NULL)
 	{
-		bool	keeporig;
-		List   *newjointree;
+		bool		keeporig;
+		List	   *newjointree;
 
-		keeporig = (! rangeTableEntry_used((Node *) sub_action->jointree,
-										   rt_index, 0)) &&
+		keeporig = (!rangeTableEntry_used((Node *) sub_action->jointree,
+										  rt_index, 0)) &&
 			(rangeTableEntry_used(info->rule_qual, rt_index, 0) ||
-			 rangeTableEntry_used(parsetree->jointree->quals, rt_index, 0));
+		  rangeTableEntry_used(parsetree->jointree->quals, rt_index, 0));
 		newjointree = adjustJoinTreeList(parsetree, !keeporig, rt_index);
 		sub_action->jointree->fromlist =
 			nconc(newjointree, sub_action->jointree->fromlist);
@@ -154,17 +155,17 @@ gatherRewriteMeta(Query *parsetree,
 		parsetree->hasSubLinks = TRUE;
 
 	/*
-	 * Event Qualification forces copying of parsetree and
-	 * splitting into two queries one w/rule_qual, one w/NOT
-	 * rule_qual. Also add user query qual onto rule action
+	 * Event Qualification forces copying of parsetree and splitting into
+	 * two queries one w/rule_qual, one w/NOT rule_qual. Also add user
+	 * query qual onto rule action
 	 */
 	AddQual(sub_action, info->rule_qual);
 
 	AddQual(sub_action, parsetree->jointree->quals);
 
 	/*
-	 * Rewrite new.attribute w/ right hand side of target-list
-	 * entry for appropriate field name in insert/update.
+	 * Rewrite new.attribute w/ right hand side of target-list entry for
+	 * appropriate field name in insert/update.
 	 *
 	 * KLUGE ALERT: since ResolveNew returns a mutated copy, we can't just
 	 * apply it to sub_action; we have to remember to update the sublink
@@ -207,7 +208,7 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index)
 		{
 			RangeTblRef *rtr = lfirst(jjt);
 
-			if (IsA(rtr, RangeTblRef) && rtr->rtindex == rt_index)
+			if (IsA(rtr, RangeTblRef) &&rtr->rtindex == rt_index)
 			{
 				newjointree = lremove(rtr, newjointree);
 				break;
@@ -278,7 +279,7 @@ ApplyRetrieveRule(Query *parsetree,
 		elog(ERROR, "ApplyRetrieveRule: expected just one rule action");
 	if (rule->qual != NULL)
 		elog(ERROR, "ApplyRetrieveRule: can't handle qualified ON SELECT rule");
-	if (! relation_level)
+	if (!relation_level)
 		elog(ERROR, "ApplyRetrieveRule: can't handle per-attribute ON SELECT rule");
 
 	/*
@@ -290,8 +291,8 @@ ApplyRetrieveRule(Query *parsetree,
 	rule_action = fireRIRrules(rule_action);
 
 	/*
-	 * VIEWs are really easy --- just plug the view query in as a subselect,
-	 * replacing the relation's original RTE.
+	 * VIEWs are really easy --- just plug the view query in as a
+	 * subselect, replacing the relation's original RTE.
 	 */
 	rte = rt_fetch(rt_index, parsetree->rtable);
 
@@ -317,6 +318,7 @@ ApplyRetrieveRule(Query *parsetree,
 	 */
 	if (intMember(rt_index, parsetree->rowMarks))
 	{
+
 		/*
 		 * Remove the view from the list of rels that will actually be
 		 * marked FOR UPDATE by the executor.  It will still be access-
@@ -399,6 +401,7 @@ fireRIRonSubLink(Node *node, void *context)
 		sub->subselect = (Node *) fireRIRrules((Query *) (sub->subselect));
 		/* Fall through to process lefthand args of SubLink */
 	}
+
 	/*
 	 * Do NOT recurse into Query nodes, because fireRIRrules already
 	 * processed subselects of subselects for us.
@@ -462,17 +465,17 @@ fireRIRrules(Query *parsetree)
 			continue;
 
 		/*
-		 * This may well be the first access to the relation during
-		 * the current statement (it will be, if this Query was extracted
-		 * from a rule or somehow got here other than via the parser).
-		 * Therefore, grab the appropriate lock type for the relation,
-		 * and do not release it until end of transaction.  This protects
-		 * the rewriter and planner against schema changes mid-query.
+		 * This may well be the first access to the relation during the
+		 * current statement (it will be, if this Query was extracted from
+		 * a rule or somehow got here other than via the parser).
+		 * Therefore, grab the appropriate lock type for the relation, and
+		 * do not release it until end of transaction.	This protects the
+		 * rewriter and planner against schema changes mid-query.
 		 *
-		 * If the relation is the query's result relation, then RewriteQuery()
-		 * already got the right lock on it, so we need no additional lock.
-		 * Otherwise, check to see if the relation is accessed FOR UPDATE
-		 * or not.
+		 * If the relation is the query's result relation, then
+		 * RewriteQuery() already got the right lock on it, so we need no
+		 * additional lock. Otherwise, check to see if the relation is
+		 * accessed FOR UPDATE or not.
 		 */
 		if (rt_index == parsetree->resultRelation)
 			lockmode = NoLock;
@@ -534,14 +537,14 @@ fireRIRrules(Query *parsetree)
 	 */
 	if (parsetree->hasSubLinks)
 		query_tree_walker(parsetree, fireRIRonSubLink, NULL,
-						  false /* already handled the ones in rtable */);
+						false /* already handled the ones in rtable */ );
 
 	/*
-	 * If the query was marked having aggregates, check if this is
-	 * still true after rewriting.	Ditto for sublinks.  Note there
-	 * should be no aggs in the qual at this point.  (Does this code
-	 * still do anything useful?  The view-becomes-subselect-in-FROM
-	 * approach doesn't look like it could remove aggs or sublinks...)
+	 * If the query was marked having aggregates, check if this is still
+	 * true after rewriting.  Ditto for sublinks.  Note there should be no
+	 * aggs in the qual at this point.	(Does this code still do anything
+	 * useful?	The view-becomes-subselect-in-FROM approach doesn't look
+	 * like it could remove aggs or sublinks...)
 	 */
 	if (parsetree->hasAggs)
 	{
@@ -551,9 +554,7 @@ fireRIRrules(Query *parsetree)
 				elog(ERROR, "fireRIRrules: failed to remove aggs from qual");
 	}
 	if (parsetree->hasSubLinks)
-	{
 		parsetree->hasSubLinks = checkExprHasSubLink((Node *) parsetree);
-	}
 
 	return parsetree;
 }
@@ -594,7 +595,7 @@ orderRules(List *locks)
  * This is used to generate suitable "else clauses" for conditional INSTEAD
  * rules.
  *
- * The rule_qual may contain references to OLD or NEW.  OLD references are
+ * The rule_qual may contain references to OLD or NEW.	OLD references are
  * replaced by references to the specified rt_index (the relation that the
  * rule applies to).  NEW references are only possible for INSERT and UPDATE
  * queries on the relation itself, and so they should be replaced by copies
@@ -769,12 +770,12 @@ RewriteQuery(Query *parsetree, bool *instead_flag, List **qual_products)
 	rt_entry = rt_fetch(result_relation, parsetree->rtable);
 
 	/*
-	 * This may well be the first access to the result relation during
-	 * the current statement (it will be, if this Query was extracted
-	 * from a rule or somehow got here other than via the parser).
-	 * Therefore, grab the appropriate lock type for a result relation,
-	 * and do not release it until end of transaction.  This protects the
-	 * rewriter and planner against schema changes mid-query.
+	 * This may well be the first access to the result relation during the
+	 * current statement (it will be, if this Query was extracted from a
+	 * rule or somehow got here other than via the parser). Therefore,
+	 * grab the appropriate lock type for a result relation, and do not
+	 * release it until end of transaction.  This protects the rewriter
+	 * and planner against schema changes mid-query.
 	 */
 	rt_entry_relation = heap_openr(rt_entry->relname, RowExclusiveLock);
 
@@ -793,7 +794,7 @@ RewriteQuery(Query *parsetree, bool *instead_flag, List **qual_products)
 									qual_products);
 	}
 
-	heap_close(rt_entry_relation, NoLock); /* keep lock! */
+	heap_close(rt_entry_relation, NoLock);		/* keep lock! */
 
 	return product_queries;
 }
@@ -912,7 +913,7 @@ QueryRewrite(Query *parsetree)
 	 */
 	foreach(l, querylist)
 	{
-		Query   *query = (Query *) lfirst(l);
+		Query	   *query = (Query *) lfirst(l);
 
 		query = fireRIRrules(query);
 
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index d83dafa3c63a53845bbf9bc0b202dfff2daf595e..663b67708ee31ee151e98dc3804dc57b2e97457a 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.55 2001/01/27 01:44:20 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.56 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,9 +43,10 @@ static bool checkExprHasSubLink_walker(Node *node, void *context);
 bool
 checkExprHasAggs(Node *node)
 {
+
 	/*
-	 * If a Query is passed, examine it --- but we will not recurse
-	 * into sub-Queries.
+	 * If a Query is passed, examine it --- but we will not recurse into
+	 * sub-Queries.
 	 */
 	if (node && IsA(node, Query))
 		return query_tree_walker((Query *) node, checkExprHasAggs_walker,
@@ -73,9 +74,10 @@ checkExprHasAggs_walker(Node *node, void *context)
 bool
 checkExprHasSubLink(Node *node)
 {
+
 	/*
-	 * If a Query is passed, examine it --- but we will not recurse
-	 * into sub-Queries.
+	 * If a Query is passed, examine it --- but we will not recurse into
+	 * sub-Queries.
 	 */
 	if (node && IsA(node, Query))
 		return query_tree_walker((Query *) node, checkExprHasSubLink_walker,
@@ -101,7 +103,7 @@ checkExprHasSubLink_walker(Node *node, void *context)
  *
  * Find all Var nodes in the given tree with varlevelsup == sublevels_up,
  * and increment their varno fields (rangetable indexes) by 'offset'.
- * The varnoold fields are adjusted similarly.  Also, RangeTblRef nodes
+ * The varnoold fields are adjusted similarly.	Also, RangeTblRef nodes
  * in join trees and setOp trees are adjusted.
  *
  * NOTE: although this has the form of a walker, we cheat and modify the
@@ -133,7 +135,7 @@ OffsetVarNodes_walker(Node *node, OffsetVarNodes_context *context)
 	}
 	if (IsA(node, RangeTblRef))
 	{
-		RangeTblRef	   *rtr = (RangeTblRef *) node;
+		RangeTblRef *rtr = (RangeTblRef *) node;
 
 		if (context->sublevels_up == 0)
 			rtr->rtindex += context->offset;
@@ -170,24 +172,22 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
 	 */
 	if (node && IsA(node, Query))
 	{
-		Query  *qry = (Query *) node;
-		List   *l;
+		Query	   *qry = (Query *) node;
+		List	   *l;
 
 		/*
-		 * If we are starting at a Query, and sublevels_up is zero, then we
-		 * must also fix rangetable indexes in the Query itself --- namely
-		 * resultRelation and rowMarks entries.  sublevels_up cannot be zero
-		 * when recursing into a subquery, so there's no need to have the
-		 * same logic inside OffsetVarNodes_walker.
+		 * If we are starting at a Query, and sublevels_up is zero, then
+		 * we must also fix rangetable indexes in the Query itself ---
+		 * namely resultRelation and rowMarks entries.	sublevels_up
+		 * cannot be zero when recursing into a subquery, so there's no
+		 * need to have the same logic inside OffsetVarNodes_walker.
 		 */
 		if (sublevels_up == 0)
 		{
 			if (qry->resultRelation)
 				qry->resultRelation += offset;
 			foreach(l, qry->rowMarks)
-			{
 				lfirsti(l) += offset;
-			}
 		}
 		query_tree_walker(qry, OffsetVarNodes_walker,
 						  (void *) &context, true);
@@ -235,7 +235,7 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context)
 	}
 	if (IsA(node, RangeTblRef))
 	{
-		RangeTblRef	   *rtr = (RangeTblRef *) node;
+		RangeTblRef *rtr = (RangeTblRef *) node;
 
 		if (context->sublevels_up == 0 &&
 			rtr->rtindex == context->rt_index)
@@ -274,15 +274,15 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
 	 */
 	if (node && IsA(node, Query))
 	{
-		Query  *qry = (Query *) node;
-		List   *l;
+		Query	   *qry = (Query *) node;
+		List	   *l;
 
 		/*
-		 * If we are starting at a Query, and sublevels_up is zero, then we
-		 * must also fix rangetable indexes in the Query itself --- namely
-		 * resultRelation and rowMarks entries.  sublevels_up cannot be zero
-		 * when recursing into a subquery, so there's no need to have the
-		 * same logic inside ChangeVarNodes_walker.
+		 * If we are starting at a Query, and sublevels_up is zero, then
+		 * we must also fix rangetable indexes in the Query itself ---
+		 * namely resultRelation and rowMarks entries.	sublevels_up
+		 * cannot be zero when recursing into a subquery, so there's no
+		 * need to have the same logic inside ChangeVarNodes_walker.
 		 */
 		if (sublevels_up == 0)
 		{
@@ -541,11 +541,12 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
 		return parsetree;
 	if (parsetree->commandType != CMD_INSERT)
 		return parsetree;
+
 	/*
-	 * Currently, this is ONLY applied to rule-action queries, and so
-	 * we expect to find the *OLD* and *NEW* placeholder entries in the
-	 * given query.  If they're not there, it must be an INSERT/SELECT
-	 * in which they've been pushed down to the SELECT.
+	 * Currently, this is ONLY applied to rule-action queries, and so we
+	 * expect to find the *OLD* and *NEW* placeholder entries in the given
+	 * query.  If they're not there, it must be an INSERT/SELECT in which
+	 * they've been pushed down to the SELECT.
 	 */
 	if (length(parsetree->rtable) >= 2 &&
 		strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->relname,
@@ -560,17 +561,17 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
 	Assert(IsA(rtr, RangeTblRef));
 	selectrte = rt_fetch(rtr->rtindex, parsetree->rtable);
 	selectquery = selectrte->subquery;
-	if (! (selectquery && IsA(selectquery, Query) &&
-		   selectquery->commandType == CMD_SELECT))
+	if (!(selectquery && IsA(selectquery, Query) &&
+		  selectquery->commandType == CMD_SELECT))
 		elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
 	if (length(selectquery->rtable) >= 2 &&
-		strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->relname,
-			   "*OLD*") == 0 &&
-		strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->relname,
-			   "*NEW*") == 0)
+	 strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->relname,
+			"*OLD*") == 0 &&
+	 strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->relname,
+			"*NEW*") == 0)
 	{
 		if (subquery_ptr)
-			*subquery_ptr = & (selectrte->subquery);
+			*subquery_ptr = &(selectrte->subquery);
 		return selectquery;
 	}
 	elog(ERROR, "getInsertSelectQuery: can't find rule placeholders");
@@ -591,11 +592,12 @@ AddQual(Query *parsetree, Node *qual)
 
 	if (parsetree->commandType == CMD_UTILITY)
 	{
+
 		/*
 		 * Noplace to put the qual on a utility statement.
 		 *
-		 * For now, we expect utility stmt to be a NOTIFY, so give a
-		 * specific error message for that case.
+		 * For now, we expect utility stmt to be a NOTIFY, so give a specific
+		 * error message for that case.
 		 */
 		if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
 			elog(ERROR, "Conditional NOTIFY is not implemented");
@@ -632,11 +634,12 @@ AddHavingQual(Query *parsetree, Node *havingQual)
 
 	if (parsetree->commandType == CMD_UTILITY)
 	{
+
 		/*
 		 * Noplace to put the qual on a utility statement.
 		 *
-		 * For now, we expect utility stmt to be a NOTIFY, so give a
-		 * specific error message for that case.
+		 * For now, we expect utility stmt to be a NOTIFY, so give a specific
+		 * error message for that case.
 		 */
 		if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
 			elog(ERROR, "Conditional NOTIFY is not implemented");
@@ -839,8 +842,8 @@ ResolveNew(Node *node, int target_varno, int sublevels_up,
 
 	/*
 	 * Must be prepared to start with a Query or a bare expression tree;
-	 * if it's a Query, go straight to query_tree_mutator to make sure that
-	 * sublevels_up doesn't get incremented prematurely.
+	 * if it's a Query, go straight to query_tree_mutator to make sure
+	 * that sublevels_up doesn't get incremented prematurely.
 	 */
 	if (node && IsA(node, Query))
 	{
@@ -876,11 +879,11 @@ typedef struct
 	int		   *modified;
 	int		   *badsql;
 	int			sublevels_up;
-} HandleRIRAttributeRule_context;
+}			HandleRIRAttributeRule_context;
 
 static Node *
 HandleRIRAttributeRule_mutator(Node *node,
-							   HandleRIRAttributeRule_context *context)
+							   HandleRIRAttributeRule_context * context)
 {
 	if (node == NULL)
 		return NULL;
@@ -988,4 +991,4 @@ HandleRIRAttributeRule(Query *parsetree,
 					   (void *) &context, true);
 }
 
-#endif /* NOT_USED */
+#endif	 /* NOT_USED */
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index 7063b505b9f649263dd3b504e19733adc60e4cf3..15e3434721a98e1fe1fc7c388a36932c3f029870 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.43 2001/01/24 19:43:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.44 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,7 +42,7 @@ RewriteGetRuleEventRel(char *rulename)
 						  0, 0, 0);
 	if (!HeapTupleIsValid(htup))
 		elog(ERROR, "Rule or view \"%s\" not found",
-		  ((strncmp(rulename, "_RET", 4) == 0) ? (rulename + 4) : rulename));
+			 ((strncmp(rulename, "_RET", 4) == 0) ? (rulename + 4) : rulename));
 	eventrel = ((Form_pg_rewrite) GETSTRUCT(htup))->ev_class;
 	ReleaseSysCache(htup);
 
@@ -102,15 +102,15 @@ RemoveRewriteRule(char *ruleName)
 
 	/*
 	 * We had better grab AccessExclusiveLock so that we know no other
-	 * rule additions/deletions are going on for this relation.  Else
-	 * we cannot set relhasrules correctly.  Besides, we don't want to
-	 * be changing the ruleset while queries are executing on the rel.
+	 * rule additions/deletions are going on for this relation.  Else we
+	 * cannot set relhasrules correctly.  Besides, we don't want to be
+	 * changing the ruleset while queries are executing on the rel.
 	 */
 	event_relation = heap_open(eventRelationOid, AccessExclusiveLock);
 
 	/* do not allow the removal of a view's SELECT rule */
 	if (event_relation->rd_rel->relkind == RELKIND_VIEW &&
-		((Form_pg_rewrite) GETSTRUCT(tuple))->ev_type == '1' )
+		((Form_pg_rewrite) GETSTRUCT(tuple))->ev_type == '1')
 		elog(ERROR, "Cannot remove a view's SELECT rule");
 
 	hasMoreRules = event_relation->rd_rules != NULL &&
@@ -133,10 +133,9 @@ RemoveRewriteRule(char *ruleName)
 	/*
 	 * Set pg_class 'relhasrules' field correctly for event relation.
 	 *
-	 * Important side effect: an SI notice is broadcast to force all
-	 * backends (including me!) to update relcache entries with the
-	 * new rule set.  Therefore, must do this even if relhasrules is
-	 * still true!
+	 * Important side effect: an SI notice is broadcast to force all backends
+	 * (including me!) to update relcache entries with the new rule set.
+	 * Therefore, must do this even if relhasrules is still true!
 	 */
 	SetRelationRuleStatus(eventRelationOid, hasMoreRules, false);
 
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index 0a171bb897cfe919eb60780865d502834a6e3626..7578acbcedd0d31377ad9ce288cb234d7f63fe74 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.47 2001/01/24 19:43:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.48 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,8 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
 	Relation	idescs[Num_pg_class_indices];
 
 	/*
-	 * Find the tuple to update in pg_class, using syscache for the lookup.
+	 * Find the tuple to update in pg_class, using syscache for the
+	 * lookup.
 	 */
 	relationRelation = heap_openr(RelationRelationName, RowExclusiveLock);
 	tuple = SearchSysCacheCopy(RELOID,
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c
index ff3d43fe8c0a955ccee2eff85a84ddb4c7261484..03d6504db8659a0889672e4b3178d73aeb6785f4 100644
--- a/src/backend/storage/buffer/buf_init.c
+++ b/src/backend/storage/buffer/buf_init.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.41 2001/01/24 19:43:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.42 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,8 +63,8 @@ long	   *PrivateRefCount;	/* also used in freelist.c */
 bits8	   *BufferLocks;		/* flag bits showing locks I have set */
 BufferTag  *BufferTagLastDirtied;		/* tag buffer had when last
 										 * dirtied by me */
-BufferBlindId  *BufferBlindLastDirtied;
-bool		   *BufferDirtiedByMe;	/* T if buf has been dirtied in cur xact */
+BufferBlindId *BufferBlindLastDirtied;
+bool	   *BufferDirtiedByMe;	/* T if buf has been dirtied in cur xact */
 
 
 /*
@@ -149,7 +149,8 @@ InitBufferPool(void)
 
 	/*
 	 * It's probably not really necessary to grab the lock --- if there's
-	 * anyone else attached to the shmem at this point, we've got problems.
+	 * anyone else attached to the shmem at this point, we've got
+	 * problems.
 	 */
 	SpinAcquire(BufMgrLock);
 
@@ -240,13 +241,11 @@ InitBufferPoolAccess(void)
 	BufferDirtiedByMe = (bool *) calloc(NBuffers, sizeof(bool));
 
 	/*
-	 * Convert shmem offsets into addresses as seen by this process.
-	 * This is just to speed up the BufferGetBlock() macro.
+	 * Convert shmem offsets into addresses as seen by this process. This
+	 * is just to speed up the BufferGetBlock() macro.
 	 */
 	for (i = 0; i < NBuffers; i++)
-	{
 		BufferBlockPointers[i] = (Block) MAKE_PTR(BufferDescriptors[i].data);
-	}
 
 	/*
 	 * Now that buffer access is initialized, set up a callback to shut it
diff --git a/src/backend/storage/buffer/buf_table.c b/src/backend/storage/buffer/buf_table.c
index f1512e0563ec740c0270f3bdb70a9220bb4943a5..9e8f16477865bef2c78dab22563a6c86b1d7d436 100644
--- a/src/backend/storage/buffer/buf_table.c
+++ b/src/backend/storage/buffer/buf_table.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.20 2001/01/24 19:43:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.21 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -123,8 +123,8 @@ BufTableDelete(BufferDesc *buf)
 	/*
 	 * Clear the buffer's tag.  This doesn't matter for the hash table,
 	 * since the buffer is already removed from it, but it ensures that
-	 * sequential searches through the buffer table won't think the
-	 * buffer is still valid for its old page.
+	 * sequential searches through the buffer table won't think the buffer
+	 * is still valid for its old page.
 	 */
 	buf->tag.rnode.relNode = InvalidOid;
 	buf->tag.rnode.tblNode = InvalidOid;
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index b247248a80c3fe99d45f091f29ebbc5941eacdd0..45dcdaed6a99b1521176bb9ae2dc2a53e359971d 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.108 2001/03/21 10:13:29 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.109 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -401,7 +401,7 @@ BufferAlloc(Relation reln,
 			bool		smok;
 
 			/*
-			 *	skip write error buffers 
+			 * skip write error buffers
 			 */
 			if ((buf->flags & BM_IO_ERROR) != 0)
 			{
@@ -409,6 +409,7 @@ BufferAlloc(Relation reln,
 				buf = (BufferDesc *) NULL;
 				continue;
 			}
+
 			/*
 			 * Set BM_IO_IN_PROGRESS to keep anyone from doing anything
 			 * with the contents of the buffer while we write it out. We
@@ -453,6 +454,7 @@ BufferAlloc(Relation reln,
 			}
 			else
 			{
+
 				/*
 				 * BM_JUST_DIRTIED cleared by BufferReplace and shouldn't
 				 * be setted by anyone.		- vadim 01/17/97
@@ -689,9 +691,7 @@ ReleaseAndReadBuffer(Buffer buffer,
 			bufHdr = &BufferDescriptors[buffer - 1];
 			Assert(PrivateRefCount[buffer - 1] > 0);
 			if (PrivateRefCount[buffer - 1] > 1)
-			{
 				PrivateRefCount[buffer - 1]--;
-			}
 			else
 			{
 				SpinAcquire(BufMgrLock);
@@ -724,7 +724,7 @@ BufferSync()
 	BufferDesc *bufHdr;
 	Buffer		buffer;
 	int			status;
-	RelFileNode	rnode;
+	RelFileNode rnode;
 	XLogRecPtr	recptr;
 	Relation	reln = NULL;
 
@@ -754,8 +754,8 @@ BufferSync()
 		}
 
 		/*
-		 * IO synchronization. Note that we do it with unpinned buffer
-		 * to avoid conflicts with FlushRelationBuffers.
+		 * IO synchronization. Note that we do it with unpinned buffer to
+		 * avoid conflicts with FlushRelationBuffers.
 		 */
 		if (bufHdr->flags & BM_IO_IN_PROGRESS)
 		{
@@ -769,12 +769,12 @@ BufferSync()
 		}
 
 		/*
-		 * Here: no one doing IO for this buffer and it's dirty.
-		 * Pin buffer now and set IO state for it *before* acquiring
-		 * shlock to avoid conflicts with FlushRelationBuffers.
+		 * Here: no one doing IO for this buffer and it's dirty. Pin
+		 * buffer now and set IO state for it *before* acquiring shlock to
+		 * avoid conflicts with FlushRelationBuffers.
 		 */
 		PinBuffer(bufHdr);
-		StartBufferIO(bufHdr, false);		/* output IO start */
+		StartBufferIO(bufHdr, false);	/* output IO start */
 
 		buffer = BufferDescriptorGetBuffer(bufHdr);
 		rnode = bufHdr->tag.rnode;
@@ -810,16 +810,16 @@ BufferSync()
 		if (reln == (Relation) NULL)
 		{
 			status = smgrblindwrt(DEFAULT_SMGR,
-								bufHdr->tag.rnode,
-								bufHdr->tag.blockNum,
-								(char *) MAKE_PTR(bufHdr->data),
-								true);	/* must fsync */
+								  bufHdr->tag.rnode,
+								  bufHdr->tag.blockNum,
+								  (char *) MAKE_PTR(bufHdr->data),
+								  true);		/* must fsync */
 		}
 		else
 		{
 			status = smgrwrite(DEFAULT_SMGR, reln,
-							bufHdr->tag.blockNum,
-							(char *) MAKE_PTR(bufHdr->data));
+							   bufHdr->tag.blockNum,
+							   (char *) MAKE_PTR(bufHdr->data));
 		}
 
 		if (status == SM_FAIL)	/* disk failure ?! */
@@ -827,9 +827,9 @@ BufferSync()
 				 bufHdr->tag.blockNum, bufHdr->blind.relname);
 
 		/*
-		 * Note that it's safe to change cntxDirty here because of
-		 * we protect it from upper writers by share lock and from
-		 * other bufmgr routines by BM_IO_IN_PROGRESS
+		 * Note that it's safe to change cntxDirty here because of we
+		 * protect it from upper writers by share lock and from other
+		 * bufmgr routines by BM_IO_IN_PROGRESS
 		 */
 		bufHdr->cntxDirty = false;
 
@@ -842,12 +842,11 @@ BufferSync()
 		SpinAcquire(BufMgrLock);
 
 		bufHdr->flags &= ~BM_IO_IN_PROGRESS;	/* mark IO finished */
-		TerminateBufferIO(bufHdr);				/* Sync IO finished */
+		TerminateBufferIO(bufHdr);		/* Sync IO finished */
 
 		/*
-		 * If this buffer was marked by someone as DIRTY while
-		 * we were flushing it out we must not clear DIRTY
-		 * flag - vadim 01/17/97
+		 * If this buffer was marked by someone as DIRTY while we were
+		 * flushing it out we must not clear DIRTY flag - vadim 01/17/97
 		 */
 		if (!(bufHdr->flags & BM_JUST_DIRTIED))
 			bufHdr->flags &= ~BM_DIRTY;
@@ -1020,6 +1019,7 @@ void
 BufmgrCommit(void)
 {
 	LocalBufferSync();
+
 	/*
 	 * All files created in current transaction will be fsync-ed
 	 */
@@ -1065,8 +1065,8 @@ BufferReplace(BufferDesc *bufHdr)
 	SpinRelease(BufMgrLock);
 
 	/*
-	 * No need to lock buffer context - no one should be able to
-	 * end ReadBuffer
+	 * No need to lock buffer context - no one should be able to end
+	 * ReadBuffer
 	 */
 	recptr = BufferGetLSN(bufHdr);
 	XLogFlush(recptr);
@@ -1113,8 +1113,8 @@ BlockNumber
 RelationGetNumberOfBlocks(Relation relation)
 {
 	return ((relation->rd_myxactonly) ? relation->rd_nblocks :
-		((relation->rd_rel->relkind == RELKIND_VIEW) ? 0 :
-			smgrnblocks(DEFAULT_SMGR, relation)));
+			((relation->rd_rel->relkind == RELKIND_VIEW) ? 0 :
+			 smgrnblocks(DEFAULT_SMGR, relation)));
 }
 
 /* ---------------------------------------------------------------------
@@ -1122,7 +1122,7 @@ RelationGetNumberOfBlocks(Relation relation)
  *
  *		This function removes all the buffered pages for a relation
  *		from the buffer pool.  Dirty pages are simply dropped, without
- *		bothering to write them out first.  This is NOT rollback-able,
+ *		bothering to write them out first.	This is NOT rollback-able,
  *		and so should be used only with extreme caution!
  *
  *		We assume that the caller holds an exclusive lock on the relation,
@@ -1196,6 +1196,7 @@ recheck:
 					   bufHdr->refcount == 1);
 				ReleaseBufferWithBufferLock(i);
 			}
+
 			/*
 			 * And mark the buffer as no longer occupied by this rel.
 			 */
@@ -1212,7 +1213,7 @@ recheck:
  *		This is the same as DropRelationBuffers, except that the target
  *		relation is specified by RelFileNode.
  *
- *		This is NOT rollback-able.  One legitimate use is to clear the
+ *		This is NOT rollback-able.	One legitimate use is to clear the
  *		buffer cache of buffers for a relation that is being deleted
  *		during transaction abort.
  * --------------------------------------------------------------------
@@ -1278,6 +1279,7 @@ recheck:
 					   bufHdr->refcount == 1);
 				ReleaseBufferWithBufferLock(i);
 			}
+
 			/*
 			 * And mark the buffer as no longer occupied by this rel.
 			 */
@@ -1293,7 +1295,7 @@ recheck:
  *
  *		This function removes all the buffers in the buffer cache for a
  *		particular database.  Dirty pages are simply dropped, without
- *		bothering to write them out first.  This is used when we destroy a
+ *		bothering to write them out first.	This is used when we destroy a
  *		database, to avoid trying to flush data to disk when the directory
  *		tree no longer exists.	Implementation is pretty similar to
  *		DropRelationBuffers() which is for destroying just one relation.
@@ -1310,10 +1312,11 @@ DropBuffers(Oid dbid)
 	{
 		bufHdr = &BufferDescriptors[i - 1];
 recheck:
+
 		/*
-		 * We know that currently database OID is tblNode but
-		 * this probably will be changed in future and this
-		 * func will be used to drop tablespace buffers.
+		 * We know that currently database OID is tblNode but this
+		 * probably will be changed in future and this func will be used
+		 * to drop tablespace buffers.
 		 */
 		if (bufHdr->tag.rnode.tblNode == dbid)
 		{
@@ -1342,6 +1345,7 @@ recheck:
 			 * backends are running in that database.
 			 */
 			Assert(bufHdr->flags & BM_FREE);
+
 			/*
 			 * And mark the buffer as no longer occupied by this page.
 			 */
@@ -1383,8 +1387,8 @@ blockNum=%d, flags=0x%x, refcount=%d %ld)",
 		for (i = 0; i < NBuffers; ++i, ++buf)
 		{
 			printf("[%-2d] (%s, %d) flags=0x%x, refcnt=%d %ld)\n",
-					i, buf->blind.relname, buf->tag.blockNum,
-					buf->flags, buf->refcount, PrivateRefCount[i]);
+				   i, buf->blind.relname, buf->tag.blockNum,
+				   buf->flags, buf->refcount, PrivateRefCount[i]);
 		}
 	}
 }
@@ -1441,7 +1445,7 @@ BufferPoolBlowaway()
  *
  *		This function writes all dirty pages of a relation out to disk.
  *		Furthermore, pages that have blocknumber >= firstDelBlock are
- *		actually removed from the buffer pool.  An error code is returned
+ *		actually removed from the buffer pool.	An error code is returned
  *		if we fail to dump a dirty buffer or if we find one of
  *		the target pages is pinned into the cache.
  *
@@ -1495,15 +1499,15 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
 			{
 				if (bufHdr->flags & BM_DIRTY || bufHdr->cntxDirty)
 				{
-					status = smgrwrite(DEFAULT_SMGR, rel, 
-								bufHdr->tag.blockNum,
-								(char *) MAKE_PTR(bufHdr->data));
+					status = smgrwrite(DEFAULT_SMGR, rel,
+									   bufHdr->tag.blockNum,
+									   (char *) MAKE_PTR(bufHdr->data));
 					if (status == SM_FAIL)
 					{
 						elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty, could not flush it",
 							 RelationGetRelationName(rel), firstDelBlock,
 							 bufHdr->tag.blockNum);
-						return(-1);
+						return (-1);
 					}
 					bufHdr->flags &= ~(BM_DIRTY | BM_JUST_DIRTIED);
 					bufHdr->cntxDirty = false;
@@ -1513,12 +1517,10 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
 					elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is referenced (%ld)",
 						 RelationGetRelationName(rel), firstDelBlock,
 						 bufHdr->tag.blockNum, LocalRefCount[i]);
-					return(-2);
+					return (-2);
 				}
 				if (bufHdr->tag.blockNum >= firstDelBlock)
-				{
 					bufHdr->tag.rnode.relNode = InvalidOid;
-				}
 			}
 		}
 		return 0;
@@ -1559,10 +1561,10 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
 					SpinRelease(BufMgrLock);
 
 					status = smgrwrite(DEFAULT_SMGR, rel,
-									bufHdr->tag.blockNum,
-									(char *) MAKE_PTR(bufHdr->data));
+									   bufHdr->tag.blockNum,
+									   (char *) MAKE_PTR(bufHdr->data));
 
-					if (status == SM_FAIL)	/* disk failure ?! */
+					if (status == SM_FAIL)		/* disk failure ?! */
 						elog(STOP, "FlushRelationBuffers: cannot write %u for %s",
 							 bufHdr->tag.blockNum, bufHdr->blind.relname);
 
@@ -1573,9 +1575,10 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
 					TerminateBufferIO(bufHdr);
 					Assert(!(bufHdr->flags & BM_JUST_DIRTIED));
 					bufHdr->flags &= ~BM_DIRTY;
+
 					/*
-					 * Note that it's safe to change cntxDirty here because
-					 * of we protect it from upper writers by
+					 * Note that it's safe to change cntxDirty here
+					 * because of we protect it from upper writers by
 					 * AccessExclusiveLock and from other bufmgr routines
 					 * by BM_IO_IN_PROGRESS
 					 */
@@ -1593,9 +1596,7 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
 				return -2;
 			}
 			if (bufHdr->tag.blockNum >= firstDelBlock)
-			{
 				BufTableDelete(bufHdr);
-			}
 		}
 	}
 	SpinRelease(BufMgrLock);
@@ -1628,9 +1629,7 @@ ReleaseBuffer(Buffer buffer)
 
 	Assert(PrivateRefCount[buffer - 1] > 0);
 	if (PrivateRefCount[buffer - 1] > 1)
-	{
 		PrivateRefCount[buffer - 1]--;
-	}
 	else
 	{
 		SpinAcquire(BufMgrLock);
@@ -1671,9 +1670,7 @@ ReleaseBufferWithBufferLock(Buffer buffer)
 
 	Assert(PrivateRefCount[buffer - 1] > 0);
 	if (PrivateRefCount[buffer - 1] > 1)
-	{
 		PrivateRefCount[buffer - 1]--;
-	}
 	else
 	{
 		PrivateRefCount[buffer - 1] = 0;
@@ -2084,8 +2081,8 @@ LockBuffer(Buffer buffer, int mode)
 		*buflock |= BL_W_LOCK;
 
 		/*
-		 * This is not the best place to set cntxDirty flag (eg indices
-		 * do not always change buffer they lock in excl mode). But please
+		 * This is not the best place to set cntxDirty flag (eg indices do
+		 * not always change buffer they lock in excl mode). But please
 		 * remember that it's critical to set cntxDirty *before* logging
 		 * changes with XLogInsert() - see comments in BufferSync().
 		 */
@@ -2200,6 +2197,7 @@ InitBufferIO(void)
 {
 	InProgressBuf = (BufferDesc *) 0;
 }
+
 #endif
 
 /*
@@ -2245,7 +2243,7 @@ AbortBufferIO(void)
  * NOTE: buffer must be excl locked.
  */
 void
-MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc)(Buffer))
+MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc) (Buffer))
 {
 	BufferDesc *bufHdr = &BufferDescriptors[buffer - 1];
 
@@ -2301,5 +2299,5 @@ BufferGetFileNode(Buffer buffer)
 	else
 		bufHdr = &BufferDescriptors[buffer - 1];
 
-	return(bufHdr->tag.rnode);
+	return (bufHdr->tag.rnode);
 }
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index a6d1b95f4fa24ea751eda194c6fb823b12cd4337..6e3cd7564113cde6139b62f7cbc14cdd56df514d 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.39 2001/01/24 19:43:06 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.40 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,7 +63,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
 	/* a low tech search for now -- not optimized for scans */
 	for (i = 0; i < NLocBuffer; i++)
 	{
-		if (LocalBufferDescriptors[i].tag.rnode.relNode == 
+		if (LocalBufferDescriptors[i].tag.rnode.relNode ==
 			reln->rd_node.relNode &&
 			LocalBufferDescriptors[i].tag.blockNum == blockNum)
 		{
@@ -125,8 +125,8 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
 	/*
 	 * it's all ours now.
 	 *
-	 * We need not in tblNode currently but will in future I think,
-	 * when we'll give up rel->rd_fd to fmgr cache.
+	 * We need not in tblNode currently but will in future I think, when
+	 * we'll give up rel->rd_fd to fmgr cache.
 	 */
 	bufHdr->tag.rnode = reln->rd_node;
 	bufHdr->tag.blockNum = blockNum;
@@ -142,12 +142,14 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
 
 		if (data == NULL)
 			elog(FATAL, "Out of memory in LocalBufferAlloc");
+
 		/*
-		 * This is a bit of a hack: bufHdr->data needs to be a shmem offset
-		 * for consistency with the shared-buffer case, so make it one
-		 * even though it's not really a valid shmem offset.
+		 * This is a bit of a hack: bufHdr->data needs to be a shmem
+		 * offset for consistency with the shared-buffer case, so make it
+		 * one even though it's not really a valid shmem offset.
 		 */
 		bufHdr->data = MAKE_OFFSET(data);
+
 		/*
 		 * Set pointer for use by BufferGetBlock() macro.
 		 */
diff --git a/src/backend/storage/buffer/s_lock.c b/src/backend/storage/buffer/s_lock.c
index 6bb76c2cda865907ac74138a54e4dab3248a184c..647802a19ea61cd1eb91796d80d130e390970d27 100644
--- a/src/backend/storage/buffer/s_lock.c
+++ b/src/backend/storage/buffer/s_lock.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.34 2001/02/24 22:42:45 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.35 2001/03/22 03:59:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,16 +43,16 @@
 #define S_NSPINCYCLE	20
 
 int			s_spincycle[S_NSPINCYCLE] =
-{	1,		10,		100,	1000,
-	10000,	1000,	1000,	1000,
-	10000,	1000,	1000,	10000,
-	1000,	1000,	10000,	1000,
-	10000,	1000,	10000,	30000
+{1, 10, 100, 1000,
+	10000, 1000, 1000, 1000,
+	10000, 1000, 1000, 10000,
+	1000, 1000, 10000, 1000,
+	10000, 1000, 10000, 30000
 };
 
 #define AVG_SPINCYCLE	5000	/* average entry in microsec: 100ms / 20 */
 
-#define DEFAULT_TIMEOUT	(100*1000000) /* default timeout: 100 sec */
+#define DEFAULT_TIMEOUT (100*1000000)	/* default timeout: 100 sec */
 
 
 /*
@@ -74,10 +74,10 @@ s_lock_stuck(volatile slock_t *lock, const char *file, const int line)
 /*
  * s_lock_sleep() - sleep a pseudo-random amount of time, check for timeout
  *
- * The 'timeout' is given in microsec, or may be 0 for "infinity".  Note that
+ * The 'timeout' is given in microsec, or may be 0 for "infinity".	Note that
  * this will be a lower bound (a fairly loose lower bound, on most platforms).
  *
- * 'microsec' is the number of microsec to delay per loop.  Normally
+ * 'microsec' is the number of microsec to delay per loop.	Normally
  * 'microsec' is 0, specifying to use the next s_spincycle[] value.
  * Some callers may pass a nonzero interval, specifying to use exactly that
  * delay value rather than a pseudo-random delay.
@@ -98,7 +98,7 @@ s_lock_sleep(unsigned spins, int timeout, int microsec,
 	{
 		delay.tv_sec = 0;
 		delay.tv_usec = s_spincycle[spins % S_NSPINCYCLE];
-		microsec = AVG_SPINCYCLE; /* use average to figure timeout */
+		microsec = AVG_SPINCYCLE;		/* use average to figure timeout */
 	}
 
 	if (timeout > 0)
@@ -125,10 +125,11 @@ s_lock(volatile slock_t *lock, const char *file, const int line)
 	 * If you are thinking of changing this code, be careful.  This same
 	 * loop logic is used in other places that call TAS() directly.
 	 *
-	 * While waiting for a lock, we check for cancel/die interrupts (which
-	 * is a no-op if we are inside a critical section).  The interrupt check
-	 * can be omitted in places that know they are inside a critical section.
-	 * Note that an interrupt must NOT be accepted after acquiring the lock.
+	 * While waiting for a lock, we check for cancel/die interrupts (which is
+	 * a no-op if we are inside a critical section).  The interrupt check
+	 * can be omitted in places that know they are inside a critical
+	 * section. Note that an interrupt must NOT be accepted after
+	 * acquiring the lock.
 	 */
 	while (TAS(lock))
 	{
@@ -155,8 +156,8 @@ static void
 tas_dummy()						/* really means: extern int tas(slock_t
 								 * **lock); */
 {
-	__asm__ __volatile__(
-"\
+	__asm__		__volatile__(
+										 "\
 .global		_tas				\n\
 _tas:							\n\
 			movel	sp@(0x4),a0	\n\
@@ -180,8 +181,8 @@ _success:						\n\
 static void
 tas_dummy()
 {
-	   __asm__ __volatile__(
-"\
+	__asm__		__volatile__(
+										 "\
 			.globl 	tas			\n\
 			.globl 	_tas		\n\
 _tas:							\n\
@@ -200,15 +201,15 @@ success:						\n\
 ");
 }
 
-#endif  /* __APPLE__ && __ppc__ */
+#endif	 /* __APPLE__ && __ppc__ */
 
 #if defined(__powerpc__)
 /* Note: need a nice gcc constrained asm version so it can be inlined */
 static void
 tas_dummy()
 {
-	__asm__ __volatile__(
-"\
+	__asm__		__volatile__(
+										 "\
 .global tas 					\n\
 tas:							\n\
 			lwarx	5,0,3		\n\
@@ -231,8 +232,8 @@ success:						\n\
 static void
 tas_dummy()
 {
-	__asm__  _volatile__(
-"\
+	__asm__		_volatile__(
+										"\
 .global	tas						\n\
 tas:							\n\
 			.frame	$sp, 0, $31	\n\
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index 7944ee8e3aff02b2a003b67e343d277ded614266..2ce6d31c38afb510d3108b73a0cbf0335459fa4a 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.9 2001/01/24 19:43:06 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.10 2001/03/22 03:59:45 momjian Exp $
  *
  * NOTES:
  *
@@ -163,6 +163,7 @@ BufFileCreate(File file)
 {
 	return makeBufFile(file);
 }
+
 #endif
 
 /*
@@ -574,5 +575,5 @@ BufFileTellBlock(BufFile *file)
 	blknum += file->curFile * RELSEG_SIZE;
 	return blknum;
 }
-#endif
 
+#endif
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index c6a72b8f25dc613b249e7aa7b3f9398f9bbc1faa..137dd769e3f2b840514f2a5c84803240186ffa09 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.73 2001/02/18 04:39:42 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.74 2001/03/22 03:59:45 momjian Exp $
  *
  * NOTES:
  *
@@ -243,7 +243,7 @@ pg_fdatasync(int fd)
 int
 BasicOpenFile(FileName fileName, int fileFlags, int fileMode)
 {
-	int		fd;
+	int			fd;
 
 tryAgain:
 	fd = open(fileName, fileFlags, fileMode);
@@ -253,7 +253,7 @@ tryAgain:
 
 	if (errno == EMFILE || errno == ENFILE)
 	{
-		int		save_errno = errno;
+		int			save_errno = errno;
 
 		DO_DB(elog(DEBUG, "BasicOpenFile: not enough descs, retry, er= %d",
 				   errno));
@@ -414,7 +414,7 @@ LruInsert(File file)
 	{
 		while (nfile + numAllocatedFiles >= pg_nofile())
 		{
-			if (! ReleaseLruFile())
+			if (!ReleaseLruFile())
 				break;
 		}
 
@@ -460,6 +460,7 @@ ReleaseLruFile(void)
 
 	if (nfile > 0)
 	{
+
 		/*
 		 * There are opened files and so there should be at least one used
 		 * vfd in the ring.
@@ -660,7 +661,7 @@ fileNameOpenFile(FileName fileName,
 
 	while (nfile + numAllocatedFiles >= pg_nofile())
 	{
-		if (! ReleaseLruFile())
+		if (!ReleaseLruFile())
 			break;
 	}
 
@@ -683,9 +684,10 @@ fileNameOpenFile(FileName fileName,
 	vfdP->fileFlags = fileFlags & ~(O_TRUNC | O_EXCL);
 	vfdP->fileMode = fileMode;
 	vfdP->seekPos = 0;
+
 	/*
-	 * Have to fsync file on commit. Alternative way - log
-	 * file creation and fsync log before actual file creation.
+	 * Have to fsync file on commit. Alternative way - log file creation
+	 * and fsync log before actual file creation.
 	 */
 	if (fileFlags & O_CREAT)
 		vfdP->fdstate = FD_DIRTY;
@@ -1083,7 +1085,7 @@ TryAgain:
 
 	if (errno == EMFILE || errno == ENFILE)
 	{
-		int		save_errno = errno;
+		int			save_errno = errno;
 
 		DO_DB(elog(DEBUG, "AllocateFile: not enough descs, retry, er= %d",
 				   errno));
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index eb8d488bdd371ac07a53aa360a017471e223ad90..375376abf838460b34ab7100458450964178812b 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.63 2001/03/13 01:17:06 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.64 2001/03/22 03:59:45 momjian Exp $
  *
  * NOTES
  *
@@ -71,7 +71,7 @@ static IpcSemaphoreId InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
 						   int semStartValue, bool removeOnExit);
 static void CallbackSemaphoreKill(int status, Datum semId);
 static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size,
-									 int permission);
+						int permission);
 static void IpcMemoryDetach(int status, Datum shmaddr);
 static void IpcMemoryDelete(int status, Datum shmId);
 static void *PrivateMemoryCreate(uint32 size);
@@ -101,6 +101,7 @@ static struct ONEXIT
 	void		(*function) ();
 	Datum		arg;
 }			on_proc_exit_list[MAX_ON_EXITS],
+
 			on_shmem_exit_list[MAX_ON_EXITS];
 
 static int	on_proc_exit_index,
@@ -127,9 +128,9 @@ proc_exit(int code)
 	proc_exit_inprogress = true;
 
 	/*
-	 * Forget any pending cancel or die requests; we're doing our best
-	 * to close up shop already.  Note that the signal handlers will not
-	 * set these flags again, now that proc_exit_inprogress is set.
+	 * Forget any pending cancel or die requests; we're doing our best to
+	 * close up shop already.  Note that the signal handlers will not set
+	 * these flags again, now that proc_exit_inprogress is set.
 	 */
 	InterruptPending = false;
 	ProcDiePending = false;
@@ -198,7 +199,7 @@ shmem_exit(int code)
  * ----------------------------------------------------------------
  */
 void
-on_proc_exit(void (*function) (), Datum arg)
+			on_proc_exit(void (*function) (), Datum arg)
 {
 	if (on_proc_exit_index >= MAX_ON_EXITS)
 		elog(FATAL, "Out of on_proc_exit slots");
@@ -217,7 +218,7 @@ on_proc_exit(void (*function) (), Datum arg)
  * ----------------------------------------------------------------
  */
 void
-on_shmem_exit(void (*function) (), Datum arg)
+			on_shmem_exit(void (*function) (), Datum arg)
 {
 	if (on_shmem_exit_index >= MAX_ON_EXITS)
 		elog(FATAL, "Out of on_shmem_exit slots");
@@ -282,11 +283,13 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
 
 	if (semId < 0)
 	{
+
 		/*
 		 * Fail quietly if error indicates a collision with existing set.
-		 * One would expect EEXIST, given that we said IPC_EXCL, but perhaps
-		 * we could get a permission violation instead?  Also, EIDRM might
-		 * occur if an old set is slated for destruction but not gone yet.
+		 * One would expect EEXIST, given that we said IPC_EXCL, but
+		 * perhaps we could get a permission violation instead?  Also,
+		 * EIDRM might occur if an old set is slated for destruction but
+		 * not gone yet.
 		 */
 		if (errno == EEXIST || errno == EACCES
 #ifdef EIDRM
@@ -294,11 +297,12 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
 #endif
 			)
 			return -1;
+
 		/*
 		 * Else complain and abort
 		 */
 		fprintf(stderr, "IpcSemaphoreCreate: semget(key=%d, num=%d, 0%o) failed: %s\n",
-				(int) semKey, numSems, (IPC_CREAT|IPC_EXCL|permission),
+			  (int) semKey, numSems, (IPC_CREAT | IPC_EXCL | permission),
 				strerror(errno));
 
 		if (errno == ENOSPC)
@@ -325,7 +329,7 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
 		if (errno == ERANGE)
 			fprintf(stderr,
 					"You possibly need to raise your kernel's SEMVMX value to be at least\n"
-					"%d.  Look into the PostgreSQL documentation for details.\n",
+			"%d.  Look into the PostgreSQL documentation for details.\n",
 					semStartValue);
 
 		IpcSemaphoreKill(semId);
@@ -348,12 +352,14 @@ IpcSemaphoreKill(IpcSemaphoreId semId)
 {
 	union semun semun;
 
-	semun.val = 0;		/* unused, but keep compiler quiet */
+	semun.val = 0;				/* unused, but keep compiler quiet */
 
 	if (semctl(semId, 0, IPC_RMID, semun) < 0)
 		fprintf(stderr, "IpcSemaphoreKill: semctl(%d, 0, IPC_RMID, ...) failed: %s\n",
 				semId, strerror(errno));
-	/* We used to report a failure via elog(NOTICE), but that's pretty
+
+	/*
+	 * We used to report a failure via elog(NOTICE), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
@@ -393,13 +399,13 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, bool interruptOK)
 	 *	section already).
 	 *
 	 *	Once we acquire the lock, we do NOT check for an interrupt before
-	 *	returning.  The caller needs to be able to record ownership of
+	 *	returning.	The caller needs to be able to record ownership of
 	 *	the lock before any interrupt can be accepted.
 	 *
 	 *	There is a window of a few instructions between CHECK_FOR_INTERRUPTS
-	 *	and entering the semop() call.  If a cancel/die interrupt occurs in
+	 *	and entering the semop() call.	If a cancel/die interrupt occurs in
 	 *	that window, we would fail to notice it until after we acquire the
-	 *	lock (or get another interrupt to escape the semop()).  We can avoid
+	 *	lock (or get another interrupt to escape the semop()).	We can avoid
 	 *	this problem by temporarily setting ImmediateInterruptOK = true
 	 *	before we do CHECK_FOR_INTERRUPTS; then, a die() interrupt in this
 	 *	interval will execute directly.  However, there is a huge pitfall:
@@ -426,7 +432,7 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, bool interruptOK)
 
 	if (errStatus == -1)
 	{
-        fprintf(stderr, "IpcSemaphoreLock: semop(id=%d) failed: %s\n",
+		fprintf(stderr, "IpcSemaphoreLock: semop(id=%d) failed: %s\n",
 				semId, strerror(errno));
 		proc_exit(255);
 	}
@@ -503,7 +509,7 @@ IpcSemaphoreTryLock(IpcSemaphoreId semId, int sem)
 			return false;		/* failed to lock it */
 #endif
 		/* Otherwise we got trouble */
-        fprintf(stderr, "IpcSemaphoreTryLock: semop(id=%d) failed: %s\n",
+		fprintf(stderr, "IpcSemaphoreTryLock: semop(id=%d) failed: %s\n",
 				semId, strerror(errno));
 		proc_exit(255);
 	}
@@ -516,7 +522,8 @@ int
 IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
 {
 	union semun dummy;			/* for Solaris */
-	dummy.val = 0;		/* unused */
+
+	dummy.val = 0;				/* unused */
 
 	return semctl(semId, sem, GETVAL, dummy);
 }
@@ -526,7 +533,8 @@ static pid_t
 IpcSemaphoreGetLastPID(IpcSemaphoreId semId, int sem)
 {
 	union semun dummy;			/* for Solaris */
-	dummy.val = 0;		/* unused */
+
+	dummy.val = 0;				/* unused */
 
 	return semctl(semId, sem, GETPID, dummy);
 }
@@ -563,11 +571,13 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
 
 	if (shmid < 0)
 	{
+
 		/*
-		 * Fail quietly if error indicates a collision with existing segment.
-		 * One would expect EEXIST, given that we said IPC_EXCL, but perhaps
-		 * we could get a permission violation instead?  Also, EIDRM might
-		 * occur if an old seg is slated for destruction but not gone yet.
+		 * Fail quietly if error indicates a collision with existing
+		 * segment. One would expect EEXIST, given that we said IPC_EXCL,
+		 * but perhaps we could get a permission violation instead?  Also,
+		 * EIDRM might occur if an old seg is slated for destruction but
+		 * not gone yet.
 		 */
 		if (errno == EEXIST || errno == EACCES
 #ifdef EIDRM
@@ -575,6 +585,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
 #endif
 			)
 			return NULL;
+
 		/*
 		 * Else complain and abort
 		 */
@@ -584,7 +595,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
 
 		if (errno == EINVAL)
 			fprintf(stderr,
-					"\nThis error can be caused by one of three things:\n\n"
+				 "\nThis error can be caused by one of three things:\n\n"
 					"1. The maximum size for shared memory segments on your system was\n"
 					"   exceeded.  You need to raise the SHMMAX parameter in your kernel\n"
 					"   to be at least %u bytes.\n\n"
@@ -618,7 +629,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
 
 	if (memAddress == (void *) -1)
 	{
-        fprintf(stderr, "IpcMemoryCreate: shmat(id=%d) failed: %s\n",
+		fprintf(stderr, "IpcMemoryCreate: shmat(id=%d) failed: %s\n",
 				shmid, strerror(errno));
 		proc_exit(1);
 	}
@@ -643,7 +654,9 @@ IpcMemoryDetach(int status, Datum shmaddr)
 	if (shmdt(DatumGetPointer(shmaddr)) < 0)
 		fprintf(stderr, "IpcMemoryDetach: shmdt(%p) failed: %s\n",
 				DatumGetPointer(shmaddr), strerror(errno));
-	/* We used to report a failure via elog(NOTICE), but that's pretty
+
+	/*
+	 * We used to report a failure via elog(NOTICE), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
@@ -658,7 +671,9 @@ IpcMemoryDelete(int status, Datum shmId)
 	if (shmctl(DatumGetInt32(shmId), IPC_RMID, (struct shmid_ds *) NULL) < 0)
 		fprintf(stderr, "IpcMemoryDelete: shmctl(%d, %d, 0) failed: %s\n",
 				DatumGetInt32(shmId), IPC_RMID, strerror(errno));
-	/* We used to report a failure via elog(NOTICE), but that's pretty
+
+	/*
+	 * We used to report a failure via elog(NOTICE), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
@@ -669,22 +684,23 @@ IpcMemoryDelete(int status, Datum shmId)
 bool
 SharedMemoryIsInUse(IpcMemoryKey shmKey, IpcMemoryId shmId)
 {
-	struct shmid_ds		shmStat;
+	struct shmid_ds shmStat;
 
 	/*
-	 * We detect whether a shared memory segment is in use by seeing whether
-	 * it (a) exists and (b) has any processes are attached to it.
+	 * We detect whether a shared memory segment is in use by seeing
+	 * whether it (a) exists and (b) has any processes are attached to it.
 	 *
 	 * If we are unable to perform the stat operation for a reason other than
-	 * nonexistence of the segment (most likely, because it doesn't belong to
-	 * our userid), assume it is in use.
+	 * nonexistence of the segment (most likely, because it doesn't belong
+	 * to our userid), assume it is in use.
 	 */
 	if (shmctl(shmId, IPC_STAT, &shmStat) < 0)
 	{
+
 		/*
 		 * EINVAL actually has multiple possible causes documented in the
-		 * shmctl man page, but we assume it must mean the segment no longer
-		 * exists.
+		 * shmctl man page, but we assume it must mean the segment no
+		 * longer exists.
 		 */
 		if (errno == EINVAL)
 			return false;
@@ -718,7 +734,7 @@ PrivateMemoryCreate(uint32 size)
 		fprintf(stderr, "PrivateMemoryCreate: malloc(%u) failed\n", size);
 		proc_exit(1);
 	}
-	MemSet(memAddress, 0, size);		/* keep Purify quiet */
+	MemSet(memAddress, 0, size);/* keep Purify quiet */
 
 	/* Register on-exit routine to release storage */
 	on_shmem_exit(PrivateMemoryDelete, PointerGetDatum(memAddress));
@@ -763,14 +779,14 @@ IpcInitKeyAssignment(int port)
 PGShmemHeader *
 IpcMemoryCreate(uint32 size, bool makePrivate, int permission)
 {
-	void   *memAddress;
+	void	   *memAddress;
 	PGShmemHeader *hdr;
 
 	/* Room for a header? */
 	Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
 
 	/* Loop till we find a free IPC key */
-	for (NextShmemSegID++ ; ; NextShmemSegID++)
+	for (NextShmemSegID++;; NextShmemSegID++)
 	{
 		IpcMemoryId shmid;
 
@@ -799,6 +815,7 @@ IpcMemoryCreate(uint32 size, bool makePrivate, int permission)
 			shmdt(memAddress);
 			continue;			/* segment belongs to a non-Postgres app */
 		}
+
 		/*
 		 * If the creator PID is my own PID or does not belong to any
 		 * extant process, it's safe to zap it.
@@ -812,28 +829,32 @@ IpcMemoryCreate(uint32 size, bool makePrivate, int permission)
 				continue;		/* segment belongs to a live process */
 			}
 		}
+
 		/*
-		 * The segment appears to be from a dead Postgres process, or
-		 * from a previous cycle of life in this same process.  Zap it,
-		 * if possible.  This probably shouldn't fail, but if it does,
-		 * assume the segment belongs to someone else after all,
-		 * and continue quietly.
+		 * The segment appears to be from a dead Postgres process, or from
+		 * a previous cycle of life in this same process.  Zap it, if
+		 * possible.  This probably shouldn't fail, but if it does, assume
+		 * the segment belongs to someone else after all, and continue
+		 * quietly.
 		 */
 		shmdt(memAddress);
 		if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
 			continue;
+
 		/*
 		 * Now try again to create the segment.
 		 */
 		memAddress = InternalIpcMemoryCreate(NextShmemSegID, size, permission);
 		if (memAddress)
 			break;				/* successful create and attach */
+
 		/*
 		 * Can only get here if some other process managed to create the
-		 * same shmem key before we did.  Let him have that one,
-		 * loop around to try next key.
+		 * same shmem key before we did.  Let him have that one, loop
+		 * around to try next key.
 		 */
 	}
+
 	/*
 	 * OK, we created a new segment.  Mark it as created by this process.
 	 * The order of assignments here is critical so that another Postgres
@@ -843,6 +864,7 @@ IpcMemoryCreate(uint32 size, bool makePrivate, int permission)
 	hdr = (PGShmemHeader *) memAddress;
 	hdr->creatorPID = getpid();
 	hdr->magic = PGShmemMagic;
+
 	/*
 	 * Initialize space allocation status for segment.
 	 */
@@ -862,27 +884,28 @@ IpcSemaphoreId
 IpcSemaphoreCreate(int numSems, int permission,
 				   int semStartValue, bool removeOnExit)
 {
-	IpcSemaphoreId	semId;
+	IpcSemaphoreId semId;
 	union semun semun;
 
 	/* Loop till we find a free IPC key */
-	for (NextSemaID++ ; ; NextSemaID++)
+	for (NextSemaID++;; NextSemaID++)
 	{
-		pid_t	creatorPID;
+		pid_t		creatorPID;
 
 		/* Try to create new semaphore set */
-		semId = InternalIpcSemaphoreCreate(NextSemaID, numSems+1,
+		semId = InternalIpcSemaphoreCreate(NextSemaID, numSems + 1,
 										   permission, semStartValue,
 										   removeOnExit);
 		if (semId >= 0)
 			break;				/* successful create */
 
 		/* See if it looks to be leftover from a dead Postgres process */
-		semId = semget(NextSemaID, numSems+1, 0);
+		semId = semget(NextSemaID, numSems + 1, 0);
 		if (semId < 0)
 			continue;			/* failed: must be some other app's */
 		if (IpcSemaphoreGetValue(semId, numSems) != PGSemaMagic)
 			continue;			/* sema belongs to a non-Postgres app */
+
 		/*
 		 * If the creator PID is my own PID or does not belong to any
 		 * extant process, it's safe to zap it.
@@ -896,46 +919,50 @@ IpcSemaphoreCreate(int numSems, int permission,
 				errno != ESRCH)
 				continue;		/* sema belongs to a live process */
 		}
+
 		/*
 		 * The sema set appears to be from a dead Postgres process, or
-		 * from a previous cycle of life in this same process.  Zap it,
-		 * if possible.  This probably shouldn't fail, but if it does,
-		 * assume the sema set belongs to someone else after all,
-		 * and continue quietly.
+		 * from a previous cycle of life in this same process.	Zap it, if
+		 * possible.  This probably shouldn't fail, but if it does, assume
+		 * the sema set belongs to someone else after all, and continue
+		 * quietly.
 		 */
 		semun.val = 0;			/* unused, but keep compiler quiet */
 		if (semctl(semId, 0, IPC_RMID, semun) < 0)
 			continue;
+
 		/*
 		 * Now try again to create the sema set.
 		 */
-		semId = InternalIpcSemaphoreCreate(NextSemaID, numSems+1,
+		semId = InternalIpcSemaphoreCreate(NextSemaID, numSems + 1,
 										   permission, semStartValue,
 										   removeOnExit);
 		if (semId >= 0)
 			break;				/* successful create */
+
 		/*
 		 * Can only get here if some other process managed to create the
-		 * same sema key before we did.  Let him have that one,
-		 * loop around to try next key.
+		 * same sema key before we did.  Let him have that one, loop
+		 * around to try next key.
 		 */
 	}
+
 	/*
 	 * OK, we created a new sema set.  Mark it as created by this process.
 	 * We do this by setting the spare semaphore to PGSemaMagic-1 and then
-	 * incrementing it with semop().  That leaves it with value PGSemaMagic
-	 * and sempid referencing this process.
+	 * incrementing it with semop().  That leaves it with value
+	 * PGSemaMagic and sempid referencing this process.
 	 */
-	semun.val = PGSemaMagic-1;
+	semun.val = PGSemaMagic - 1;
 	if (semctl(semId, numSems, SETVAL, semun) < 0)
 	{
 		fprintf(stderr, "IpcSemaphoreCreate: semctl(id=%d, %d, SETVAL, %d) failed: %s\n",
-				semId, numSems, PGSemaMagic-1, strerror(errno));
+				semId, numSems, PGSemaMagic - 1, strerror(errno));
 
 		if (errno == ERANGE)
 			fprintf(stderr,
 					"You possibly need to raise your kernel's SEMVMX value to be at least\n"
-					"%d.  Look into the PostgreSQL documentation for details.\n",
+			"%d.  Look into the PostgreSQL documentation for details.\n",
 					PGSemaMagic);
 
 		proc_exit(1);
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index 471e4298c4dcccd8129e855a902377f32470b9d2..ed42e51a925f3e6277e6713a184c1de823e9c0bf 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.39 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.40 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
  * for such a backend, the shared memory is already ready-to-go.
  *
  * If "makePrivate" is true then we only need private memory, not shared
- * memory.  This is true for a standalone backend, false for a postmaster.
+ * memory.	This is true for a standalone backend, false for a postmaster.
  */
 void
 CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends)
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index cc41a36888cf6e4ff7380526469e0cb426f454eb..caf94bda46c6cfa5c805c3377f2a28ff3e93140c 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -8,14 +8,14 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.56 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.57 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 /*
  * POSTGRES processes share one or more regions of shared memory.
  * The shared memory is created by a postmaster and is inherited
- * by each backend via fork().  The routines in this file are used for
+ * by each backend via fork().	The routines in this file are used for
  * allocating and binding to shared memory data structures.
  *
  * NOTES:
@@ -65,7 +65,7 @@
 
 /* shared memory global variables */
 
-static PGShmemHeader *ShmemSegHdr; /* shared mem segment header */
+static PGShmemHeader *ShmemSegHdr;		/* shared mem segment header */
 
 SHMEM_OFFSET ShmemBase;			/* start address of shared memory */
 
@@ -75,9 +75,9 @@ SPINLOCK	ShmemLock;			/* lock for shared memory allocation */
 
 SPINLOCK	ShmemIndexLock;		/* lock for shmem index access */
 
-static HTAB *ShmemIndex = NULL;	/* primary index hashtable for shmem */
+static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
 
-static bool ShmemBootstrap = false;	/* bootstrapping shmem index? */
+static bool ShmemBootstrap = false;		/* bootstrapping shmem index? */
 
 
 /*
@@ -99,9 +99,9 @@ InitShmemAllocation(PGShmemHeader *seghdr)
 
 	/*
 	 * Since ShmemInitHash calls ShmemInitStruct, which expects the
-	 * ShmemIndex hashtable to exist already, we have a bit of a circularity
-	 * problem in initializing the ShmemIndex itself.  We set ShmemBootstrap
-	 * to tell ShmemInitStruct to fake it.
+	 * ShmemIndex hashtable to exist already, we have a bit of a
+	 * circularity problem in initializing the ShmemIndex itself.  We set
+	 * ShmemBootstrap to tell ShmemInitStruct to fake it.
 	 */
 	ShmemIndex = (HTAB *) NULL;
 	ShmemBootstrap = true;
@@ -373,6 +373,7 @@ ShmemInitStruct(char *name, Size size, bool *foundPtr)
 
 	if (!ShmemIndex)
 	{
+
 		/*
 		 * If the shmem index doesn't exist, we are bootstrapping: we must
 		 * be trying to init the shmem index itself.
diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c
index 7fa6ac84b921b13347343be62ab4f999a1ff25d8..b840596a6ffc31d2b92552e2f2fc0b44e45572cb 100644
--- a/src/backend/storage/ipc/shmqueue.c
+++ b/src/backend/storage/ipc/shmqueue.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.15 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.16 2001/03/22 03:59:45 momjian Exp $
  *
  * NOTES
  *
@@ -152,7 +152,8 @@ SHMQueueInsertAfter(SHM_QUEUE *queue, SHM_QUEUE *elem)
 	dumpQ(queue, "in SHMQueueInsertAfter: end");
 #endif
 }
-#endif /* NOT_USED */
+
+#endif	 /* NOT_USED */
 
 /*--------------------
  * SHMQueueNext -- Get the next element from a queue
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index fb37e428cb7f3392bd73fd1dc8415743dc0f6600..526923593f91b3348165c505e317daad840437e1 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.27 2001/03/18 20:18:59 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.28 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -411,6 +411,7 @@ GetUndoRecPtr(void)
 		if (pOffset != INVALID_OFFSET)
 		{
 			PROC	   *proc = (PROC *) MAKE_PTR(pOffset);
+
 			tempr = proc->logRec;
 			if (tempr.xrecoff == 0)
 				continue;
@@ -422,5 +423,5 @@ GetUndoRecPtr(void)
 
 	SpinRelease(SInvalLock);
 
-	return(urec);
+	return (urec);
 }
diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c
index 959b70de5f11b02352408ff90fe5af3ef3be8490..06ba354d94a2ea4b9c11ba71da0fe096985e12bb 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.37 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.38 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,6 +35,7 @@ static void SISetProcStateInvalid(SISeg *segP);
 int
 SInvalShmemSize(int maxBackends)
 {
+
 	/*
 	 * Figure space needed. Note sizeof(SISeg) includes the first
 	 * ProcState entry.
@@ -91,7 +92,7 @@ SIBackendInit(SISeg *segP)
 	/* Look for a free entry in the procState array */
 	for (index = 0; index < segP->lastBackend; index++)
 	{
-		if (segP->procState[index].nextMsgNum < 0) /* inactive slot? */
+		if (segP->procState[index].nextMsgNum < 0)		/* inactive slot? */
 		{
 			stateP = &segP->procState[index];
 			break;
@@ -108,9 +109,10 @@ SIBackendInit(SISeg *segP)
 		}
 		else
 		{
+
 			/*
-			 * elog() with spinlock held is probably not too cool, but this
-			 * condition should never happen anyway.
+			 * elog() with spinlock held is probably not too cool, but
+			 * this condition should never happen anyway.
 			 */
 			elog(NOTICE, "SIBackendInit: no free procState slot available");
 			MyBackendId = InvalidBackendId;
diff --git a/src/backend/storage/ipc/spin.c b/src/backend/storage/ipc/spin.c
index 479e0b276629b9b10b267bada173721789f9eccd..33308f0cc1f9aa4c83fbf88ab6f431107daecfe1 100644
--- a/src/backend/storage/ipc/spin.c
+++ b/src/backend/storage/ipc/spin.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.31 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.32 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -83,17 +83,18 @@ typedef struct slock
 } SLock;
 
 #ifdef LOCK_DEBUG
-bool Trace_spinlocks = false;
+bool		Trace_spinlocks = false;
 
 inline static void
-PRINT_SLDEBUG(const char * where, SPINLOCK lockid, const SLock * lock)
+PRINT_SLDEBUG(const char *where, SPINLOCK lockid, const SLock *lock)
 {
-    if (Trace_spinlocks)
-        elog(DEBUG, "%s: id=%d", where, lockid);
+	if (Trace_spinlocks)
+		elog(DEBUG, "%s: id=%d", where, lockid);
 }
-#else  /* not LOCK_DEBUG */
+
+#else							/* not LOCK_DEBUG */
 #define PRINT_SLDEBUG(a,b,c)
-#endif /* not LOCK_DEBUG */
+#endif	 /* not LOCK_DEBUG */
 
 
 static SLock *SLockArray = NULL;
@@ -146,15 +147,17 @@ SpinAcquire(SPINLOCK lockid)
 	SLock	   *slckP = &(SLockArray[lockid]);
 
 	PRINT_SLDEBUG("SpinAcquire", lockid, slckP);
+
 	/*
-	 * Acquire the lock, then record that we have done so (for recovery
-	 * in case of elog(ERROR) while holding the lock).  Note we assume
-	 * here that S_LOCK will not accept cancel/die interrupts once it has
+	 * Acquire the lock, then record that we have done so (for recovery in
+	 * case of elog(ERROR) while holding the lock).  Note we assume here
+	 * that S_LOCK will not accept cancel/die interrupts once it has
 	 * acquired the lock.  However, interrupts should be accepted while
 	 * waiting, if InterruptHoldoffCount is zero.
 	 */
 	S_LOCK(&(slckP->shlock));
 	PROC_INCR_SLOCK(lockid);
+
 	/*
 	 * Lock out cancel/die interrupts until we exit the code section
 	 * protected by the spinlock.  This ensures that interrupts will not
@@ -162,7 +165,7 @@ SpinAcquire(SPINLOCK lockid)
 	 */
 	HOLD_INTERRUPTS();
 
-    PRINT_SLDEBUG("SpinAcquire/done", lockid, slckP);
+	PRINT_SLDEBUG("SpinAcquire/done", lockid, slckP);
 }
 
 void
@@ -170,26 +173,29 @@ SpinRelease(SPINLOCK lockid)
 {
 	SLock	   *slckP = &(SLockArray[lockid]);
 
-    PRINT_SLDEBUG("SpinRelease", lockid, slckP);
+	PRINT_SLDEBUG("SpinRelease", lockid, slckP);
+
 	/*
 	 * Check that we are actually holding the lock we are releasing. This
 	 * can be done only after MyProc has been initialized.
 	 */
-    Assert(!MyProc || MyProc->sLocks[lockid] > 0);
+	Assert(!MyProc || MyProc->sLocks[lockid] > 0);
+
 	/*
 	 * Record that we no longer hold the spinlock, and release it.
 	 */
 	PROC_DECR_SLOCK(lockid);
 	S_UNLOCK(&(slckP->shlock));
+
 	/*
 	 * Exit the interrupt holdoff entered in SpinAcquire().
 	 */
 	RESUME_INTERRUPTS();
 
-    PRINT_SLDEBUG("SpinRelease/done", lockid, slckP);
+	PRINT_SLDEBUG("SpinRelease/done", lockid, slckP);
 }
 
-#else /* !HAS_TEST_AND_SET */
+#else							/* !HAS_TEST_AND_SET */
 
 /*
  * No TAS, so spinlocks are implemented using SysV semaphores.
@@ -217,9 +223,9 @@ SpinRelease(SPINLOCK lockid)
 
 static IpcSemaphoreId *SpinLockIds = NULL;
 
-static int numSpinSets = 0;		/* number of sema sets used */
-static int numSpinLocks = 0;	/* total number of semas allocated */
-static int nextSpinLock = 0;	/* next free spinlock index */
+static int	numSpinSets = 0;	/* number of sema sets used */
+static int	numSpinLocks = 0;	/* total number of semas allocated */
+static int	nextSpinLock = 0;	/* next free spinlock index */
 
 static void SpinFreeAllSemaphores(void);
 
@@ -238,17 +244,18 @@ SLockShmemSize(void)
 void
 CreateSpinlocks(PGShmemHeader *seghdr)
 {
-	int		i;
+	int			i;
 
 	if (SpinLockIds == NULL)
 	{
+
 		/*
-		 * Compute number of spinlocks needed.  If this logic gets any more
-		 * complicated, it should be distributed into the affected modules,
-		 * similar to the way shmem space estimation is handled.
+		 * Compute number of spinlocks needed.	If this logic gets any
+		 * more complicated, it should be distributed into the affected
+		 * modules, similar to the way shmem space estimation is handled.
 		 *
-		 * For now, though, we just need the fixed spinlocks (MAX_SPINS),
-		 * two spinlocks per shared disk buffer, and four spinlocks for XLOG.
+		 * For now, though, we just need the fixed spinlocks (MAX_SPINS), two
+		 * spinlocks per shared disk buffer, and four spinlocks for XLOG.
 		 */
 		numSpinLocks = (int) MAX_SPINS + 2 * NBuffers + 4;
 
@@ -265,11 +272,11 @@ CreateSpinlocks(PGShmemHeader *seghdr)
 		SpinLockIds[i] = -1;
 
 	/*
-	 * Arrange to delete semas on exit --- set this up now so that we
-	 * will clean up if allocation fails.  We use our own freeproc,
-	 * rather than IpcSemaphoreCreate's removeOnExit option, because
-	 * we don't want to fill up the on_shmem_exit list with a separate
-	 * entry for each semaphore set.
+	 * Arrange to delete semas on exit --- set this up now so that we will
+	 * clean up if allocation fails.  We use our own freeproc, rather than
+	 * IpcSemaphoreCreate's removeOnExit option, because we don't want to
+	 * fill up the on_shmem_exit list with a separate entry for each
+	 * semaphore set.
 	 */
 	on_shmem_exit(SpinFreeAllSemaphores, 0);
 
@@ -320,12 +327,13 @@ SpinFreeAllSemaphores(void)
 void
 SpinAcquire(SPINLOCK lock)
 {
+
 	/*
 	 * See the TAS() version of this routine for primary commentary.
 	 *
 	 * NOTE we must pass interruptOK = false to IpcSemaphoreLock, to ensure
-	 * that a cancel/die interrupt cannot prevent us from recording ownership
-	 * of a lock we have just acquired.
+	 * that a cancel/die interrupt cannot prevent us from recording
+	 * ownership of a lock we have just acquired.
 	 */
 	IpcSemaphoreLock(SpinLockIds[0], lock, false);
 	PROC_INCR_SLOCK(lock);
@@ -348,7 +356,7 @@ SpinRelease(SPINLOCK lock)
 	semval = IpcSemaphoreGetValue(SpinLockIds[0], lock);
 	Assert(semval < 1);
 #endif
-    Assert(!MyProc || MyProc->sLocks[lockid] > 0);
+	Assert(!MyProc || MyProc->sLocks[lockid] > 0);
 	PROC_DECR_SLOCK(lock);
 	IpcSemaphoreUnlock(SpinLockIds[0], lock);
 	RESUME_INTERRUPTS();
@@ -384,7 +392,7 @@ int
 tas_sema(volatile slock_t *lock)
 {
 	/* Note that TAS macros return 0 if *success* */
-	return ! IpcSemaphoreTryLock(lock->semId, lock->sem);
+	return !IpcSemaphoreTryLock(lock->semId, lock->sem);
 }
 
-#endif /* !HAS_TEST_AND_SET */
+#endif	 /* !HAS_TEST_AND_SET */
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index bcf65f6004bdf5339b7155f80d51ba69faf52987..dba45d6590d8843ebe5ccc41bc032ead78542657 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.85 2001/02/10 02:31:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.86 2001/03/22 03:59:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,7 +44,7 @@
 static int32
 getbytealen(bytea *data)
 {
-	Assert(! VARATT_IS_EXTENDED(data));
+	Assert(!VARATT_IS_EXTENDED(data));
 	if (VARSIZE(data) < VARHDRSZ)
 		elog(ERROR, "getbytealen: VARSIZE(data) < VARHDRSZ. This is internal error.");
 	return (VARSIZE(data) - VARHDRSZ);
@@ -75,7 +75,8 @@ inv_create(int flags)
 		elog(ERROR, "inv_create: large object %u already exists. This is internal error.", file_oid);
 
 	/*
-	 * Create the LO by writing an empty first page for it in pg_largeobject
+	 * Create the LO by writing an empty first page for it in
+	 * pg_largeobject
 	 */
 	(void) LargeObjectCreate(file_oid);
 
@@ -93,13 +94,17 @@ inv_create(int flags)
 	retval->id = file_oid;
 	retval->offset = 0;
 
-	if (flags & INV_WRITE) {
+	if (flags & INV_WRITE)
+	{
 		retval->flags = IFS_WRLOCK | IFS_RDLOCK;
 		retval->heap_r = heap_openr(LargeObjectRelationName, RowExclusiveLock);
-	} else if (flags & INV_READ) {
+	}
+	else if (flags & INV_READ)
+	{
 		retval->flags = IFS_RDLOCK;
 		retval->heap_r = heap_openr(LargeObjectRelationName, AccessShareLock);
-	} else
+	}
+	else
 		elog(ERROR, "inv_create: invalid flags: %d", flags);
 
 	retval->index_r = index_openr(LargeObjectLOidPNIndex);
@@ -118,21 +123,25 @@ inv_open(Oid lobjId, int flags)
 {
 	LargeObjectDesc *retval;
 
-	if (! LargeObjectExists(lobjId))
+	if (!LargeObjectExists(lobjId))
 		elog(ERROR, "inv_open: large object %u not found", lobjId);
-	
+
 	retval = (LargeObjectDesc *) palloc(sizeof(LargeObjectDesc));
 
 	retval->id = lobjId;
 	retval->offset = 0;
 
-	if (flags & INV_WRITE) {
+	if (flags & INV_WRITE)
+	{
 		retval->flags = IFS_WRLOCK | IFS_RDLOCK;
 		retval->heap_r = heap_openr(LargeObjectRelationName, RowExclusiveLock);
-	} else if (flags & INV_READ) {
+	}
+	else if (flags & INV_READ)
+	{
 		retval->flags = IFS_RDLOCK;
 		retval->heap_r = heap_openr(LargeObjectRelationName, AccessShareLock);
-	} else
+	}
+	else
 		elog(ERROR, "inv_open: invalid flags: %d", flags);
 
 	retval->index_r = index_openr(LargeObjectLOidPNIndex);
@@ -185,16 +194,16 @@ inv_drop(Oid lobjId)
 static uint32
 inv_getsize(LargeObjectDesc *obj_desc)
 {
-	bool			found = false;
-	uint32			lastbyte = 0;
-	ScanKeyData		skey[1];
-	IndexScanDesc	sd;
-	RetrieveIndexResult	indexRes;
-	HeapTupleData	tuple;
-	Buffer			buffer;
-	Form_pg_largeobject	data;
-	bytea		   *datafield;
-	bool			pfreeit;
+	bool		found = false;
+	uint32		lastbyte = 0;
+	ScanKeyData skey[1];
+	IndexScanDesc sd;
+	RetrieveIndexResult indexRes;
+	HeapTupleData tuple;
+	Buffer		buffer;
+	Form_pg_largeobject data;
+	bytea	   *datafield;
+	bool		pfreeit;
 
 	Assert(PointerIsValid(obj_desc));
 
@@ -210,10 +219,10 @@ inv_getsize(LargeObjectDesc *obj_desc)
 	tuple.t_data = NULL;
 
 	/*
-	 * Because the pg_largeobject index is on both loid and pageno,
-	 * but we constrain only loid, a backwards scan should visit all
-	 * pages of the large object in reverse pageno order.  So, it's
-	 * sufficient to examine the first valid tuple (== last valid page).
+	 * Because the pg_largeobject index is on both loid and pageno, but we
+	 * constrain only loid, a backwards scan should visit all pages of the
+	 * large object in reverse pageno order.  So, it's sufficient to
+	 * examine the first valid tuple (== last valid page).
 	 */
 	while ((indexRes = index_getnext(sd, BackwardScanDirection)))
 	{
@@ -238,7 +247,7 @@ inv_getsize(LargeObjectDesc *obj_desc)
 		ReleaseBuffer(buffer);
 		break;
 	}
-	
+
 	index_endscan(sd);
 
 	if (!found)
@@ -259,15 +268,15 @@ inv_seek(LargeObjectDesc *obj_desc, int offset, int whence)
 			obj_desc->offset = offset;
 			break;
 		case SEEK_CUR:
-			if (offset < 0 && obj_desc->offset < ((uint32) (- offset)))
+			if (offset < 0 && obj_desc->offset < ((uint32) (-offset)))
 				elog(ERROR, "inv_seek: invalid offset: %d", offset);
 			obj_desc->offset += offset;
 			break;
 		case SEEK_END:
 			{
-				uint32	size = inv_getsize(obj_desc);
+				uint32		size = inv_getsize(obj_desc);
 
-				if (offset < 0 && size < ((uint32) (- offset)))
+				if (offset < 0 && size < ((uint32) (-offset)))
 					elog(ERROR, "inv_seek: invalid offset: %d", offset);
 				obj_desc->offset = size + offset;
 			}
@@ -289,20 +298,20 @@ inv_tell(LargeObjectDesc *obj_desc)
 int
 inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 {
-	int				nread = 0;
-	int				n;
-	int				off;
-	int				len;
-	int32			pageno = (int32) (obj_desc->offset / LOBLKSIZE);
-	uint32			pageoff;
-	ScanKeyData		skey[2];
-	IndexScanDesc	sd;
-	RetrieveIndexResult	indexRes;
-	HeapTupleData	tuple;
-	Buffer			buffer;
-	Form_pg_largeobject	data;
-	bytea		   *datafield;
-	bool			pfreeit;
+	int			nread = 0;
+	int			n;
+	int			off;
+	int			len;
+	int32		pageno = (int32) (obj_desc->offset / LOBLKSIZE);
+	uint32		pageoff;
+	ScanKeyData skey[2];
+	IndexScanDesc sd;
+	RetrieveIndexResult indexRes;
+	HeapTupleData tuple;
+	Buffer		buffer;
+	Form_pg_largeobject data;
+	bytea	   *datafield;
+	bool		pfreeit;
 
 	Assert(PointerIsValid(obj_desc));
 	Assert(buf != NULL);
@@ -335,13 +344,13 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 
 		if (tuple.t_data == NULL)
 			continue;
-		
+
 		data = (Form_pg_largeobject) GETSTRUCT(&tuple);
 
 		/*
 		 * We assume the indexscan will deliver pages in order.  However,
-		 * there may be missing pages if the LO contains unwritten "holes".
-		 * We want missing sections to read out as zeroes.
+		 * there may be missing pages if the LO contains unwritten
+		 * "holes". We want missing sections to read out as zeroes.
 		 */
 		pageoff = ((uint32) data->pageno) * LOBLKSIZE;
 		if (pageoff > obj_desc->offset)
@@ -393,28 +402,28 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 int
 inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 {
-	int				nwritten = 0;
-	int				n;
-	int				off;
-	int				len;
-	int32			pageno = (int32) (obj_desc->offset / LOBLKSIZE);
-	ScanKeyData		skey[2];
-	IndexScanDesc	sd;
-	RetrieveIndexResult	indexRes;
-	HeapTupleData	oldtuple;
-	Buffer			buffer;
-	Form_pg_largeobject	olddata;
-	bool			neednextpage;
-	bytea		   *datafield;
-	bool			pfreeit;
-	char			workbuf[LOBLKSIZE + VARHDRSZ];
-	char		   *workb = VARATT_DATA(workbuf);
-	HeapTuple		newtup;
-	Datum			values[Natts_pg_largeobject];
-	char			nulls[Natts_pg_largeobject];
-	char			replace[Natts_pg_largeobject];
-	bool			write_indices;
-	Relation		idescs[Num_pg_largeobject_indices];
+	int			nwritten = 0;
+	int			n;
+	int			off;
+	int			len;
+	int32		pageno = (int32) (obj_desc->offset / LOBLKSIZE);
+	ScanKeyData skey[2];
+	IndexScanDesc sd;
+	RetrieveIndexResult indexRes;
+	HeapTupleData oldtuple;
+	Buffer		buffer;
+	Form_pg_largeobject olddata;
+	bool		neednextpage;
+	bytea	   *datafield;
+	bool		pfreeit;
+	char		workbuf[LOBLKSIZE + VARHDRSZ];
+	char	   *workb = VARATT_DATA(workbuf);
+	HeapTuple	newtup;
+	Datum		values[Natts_pg_largeobject];
+	char		nulls[Natts_pg_largeobject];
+	char		replace[Natts_pg_largeobject];
+	bool		write_indices;
+	Relation	idescs[Num_pg_largeobject_indices];
 
 	Assert(PointerIsValid(obj_desc));
 	Assert(buf != NULL);
@@ -422,7 +431,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 	if (nbytes <= 0)
 		return 0;
 
-	write_indices = ! IsIgnoringSystemIndexes();
+	write_indices = !IsIgnoringSystemIndexes();
 	if (write_indices)
 		CatalogOpenIndices(Num_pg_largeobject_indices,
 						   Name_pg_largeobject_indices,
@@ -450,6 +459,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 
 	while (nwritten < nbytes)
 	{
+
 		/*
 		 * If possible, get next pre-existing page of the LO.  We assume
 		 * the indexscan will deliver these in order --- but there may be
@@ -471,12 +481,14 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 			}
 			neednextpage = false;
 		}
+
 		/*
 		 * If we have a pre-existing page, see if it is the page we want
 		 * to write, or a later one.
 		 */
 		if (olddata != NULL && olddata->pageno == pageno)
 		{
+
 			/*
 			 * Update an existing page with fresh data.
 			 *
@@ -495,12 +507,14 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 			memcpy(workb, VARDATA(datafield), len);
 			if (pfreeit)
 				pfree(datafield);
+
 			/*
 			 * Fill any hole
 			 */
 			off = (int) (obj_desc->offset % LOBLKSIZE);
 			if (off > len)
 				MemSet(workb + len, 0, off - len);
+
 			/*
 			 * Insert appropriate portion of new data
 			 */
@@ -513,6 +527,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 			/* compute valid length of new page */
 			len = (len >= off) ? len : off;
 			VARATT_SIZEP(workbuf) = len + VARHDRSZ;
+
 			/*
 			 * Form and insert updated tuple
 			 */
@@ -528,6 +543,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 				CatalogIndexInsert(idescs, Num_pg_largeobject_indices,
 								   obj_desc->heap_r, newtup);
 			heap_freetuple(newtup);
+
 			/*
 			 * We're done with this old page.
 			 */
@@ -539,6 +555,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 		}
 		else
 		{
+
 			/*
 			 * Write a brand new page.
 			 *
@@ -547,6 +564,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 			off = (int) (obj_desc->offset % LOBLKSIZE);
 			if (off > 0)
 				MemSet(workb, 0, off);
+
 			/*
 			 * Insert appropriate portion of new data
 			 */
@@ -558,6 +576,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 			/* compute valid length of new page */
 			len = off + n;
 			VARATT_SIZEP(workbuf) = len + VARHDRSZ;
+
 			/*
 			 * Form and insert updated tuple
 			 */
@@ -585,8 +604,8 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
 		CatalogCloseIndices(Num_pg_largeobject_indices, idescs);
 
 	/*
-	 * Advance command counter so that my tuple updates will be seen by later
-	 * large-object operations in this transaction.
+	 * Advance command counter so that my tuple updates will be seen by
+	 * later large-object operations in this transaction.
 	 */
 	CommandCounterIncrement();
 
diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c
index 31db44e74b007687fc3084bf67de2df5f8838019..160fc64fb24a82df602f8632b04bce8cc104801f 100644
--- a/src/backend/storage/lmgr/deadlock.c
+++ b/src/backend/storage/lmgr/deadlock.c
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.2 2001/01/25 03:45:50 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.3 2001/03/22 03:59:46 momjian Exp $
  *
  *	Interface:
  *
@@ -29,32 +29,36 @@
 
 
 /* One edge in the waits-for graph */
-typedef struct {
-	PROC   *waiter;				/* the waiting process */
-	PROC   *blocker;			/* the process it is waiting for */
-	int		pred;				/* workspace for TopoSort */
-	int		link;				/* workspace for TopoSort */
+typedef struct
+{
+	PROC	   *waiter;			/* the waiting process */
+	PROC	   *blocker;		/* the process it is waiting for */
+	int			pred;			/* workspace for TopoSort */
+	int			link;			/* workspace for TopoSort */
 } EDGE;
 
 /* One potential reordering of a lock's wait queue */
-typedef struct {
-	LOCK   *lock;				/* the lock whose wait queue is described */
-	PROC  **procs;				/* array of PROC *'s in new wait order */
-	int		nProcs;
+typedef struct
+{
+	LOCK	   *lock;			/* the lock whose wait queue is described */
+	PROC	  **procs;			/* array of PROC *'s in new wait order */
+	int			nProcs;
 } WAIT_ORDER;
 
 
 static bool DeadLockCheckRecurse(PROC *proc);
 static bool TestConfiguration(PROC *startProc);
 static bool FindLockCycle(PROC *checkProc,
-						  EDGE *softEdges, int *nSoftEdges);
+			  EDGE *softEdges, int *nSoftEdges);
 static bool FindLockCycleRecurse(PROC *checkProc,
-								 EDGE *softEdges, int *nSoftEdges);
+					 EDGE *softEdges, int *nSoftEdges);
 static bool ExpandConstraints(EDGE *constraints, int nConstraints);
 static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints,
-					 PROC **ordering);
+		 PROC **ordering);
+
 #ifdef DEBUG_DEADLOCK
 static void PrintLockQueue(LOCK *lock, const char *info);
+
 #endif
 
 
@@ -64,30 +68,34 @@ static void PrintLockQueue(LOCK *lock, const char *info);
 
 /* Workspace for FindLockCycle */
 static PROC **visitedProcs;		/* Array of visited procs */
-static int nVisitedProcs;
+static int	nVisitedProcs;
+
 /* Workspace for TopoSort */
 static PROC **topoProcs;		/* Array of not-yet-output procs */
 static int *beforeConstraints;	/* Counts of remaining before-constraints */
 static int *afterConstraints;	/* List head for after-constraints */
+
 /* Output area for ExpandConstraints */
 static WAIT_ORDER *waitOrders;	/* Array of proposed queue rearrangements */
-static int nWaitOrders;
+static int	nWaitOrders;
 static PROC **waitOrderProcs;	/* Space for waitOrders queue contents */
+
 /* Current list of constraints being considered */
 static EDGE *curConstraints;
-static int nCurConstraints;
-static int maxCurConstraints;
+static int	nCurConstraints;
+static int	maxCurConstraints;
+
 /* Storage space for results from FindLockCycle */
 static EDGE *possibleConstraints;
-static int nPossibleConstraints;
-static int maxPossibleConstraints;
+static int	nPossibleConstraints;
+static int	maxPossibleConstraints;
 
 
 /*
  * InitDeadLockChecking -- initialize deadlock checker during backend startup
  *
  * This does per-backend initialization of the deadlock checker; primarily,
- * allocation of working memory for DeadLockCheck.  We do this per-backend
+ * allocation of working memory for DeadLockCheck.	We do this per-backend
  * since there's no percentage in making the kernel do copy-on-write
  * inheritance of workspace from the postmaster.  We want to allocate the
  * space at startup because the deadlock checker might be invoked when there's
@@ -96,7 +104,7 @@ static int maxPossibleConstraints;
 void
 InitDeadLockChecking(void)
 {
-	MemoryContext	oldcxt;
+	MemoryContext oldcxt;
 
 	/* Make sure allocations are permanent */
 	oldcxt = MemoryContextSwitchTo(TopMemoryContext);
@@ -116,20 +124,21 @@ InitDeadLockChecking(void)
 
 	/*
 	 * We need to consider rearranging at most MaxBackends/2 wait queues
-	 * (since it takes at least two waiters in a queue to create a soft edge),
-	 * and the expanded form of the wait queues can't involve more than
-	 * MaxBackends total waiters.
+	 * (since it takes at least two waiters in a queue to create a soft
+	 * edge), and the expanded form of the wait queues can't involve more
+	 * than MaxBackends total waiters.
 	 */
-	waitOrders = (WAIT_ORDER *) palloc((MaxBackends/2) * sizeof(WAIT_ORDER));
+	waitOrders = (WAIT_ORDER *) palloc((MaxBackends / 2) * sizeof(WAIT_ORDER));
 	waitOrderProcs = (PROC **) palloc(MaxBackends * sizeof(PROC *));
 
 	/*
 	 * Allow at most MaxBackends distinct constraints in a configuration.
-	 * (Is this enough?  In practice it seems it should be, but I don't quite
-	 * see how to prove it.  If we run out, we might fail to find a workable
-	 * wait queue rearrangement even though one exists.)  NOTE that this
-	 * number limits the maximum recursion depth of DeadLockCheckRecurse.
-	 * Making it really big might potentially allow a stack-overflow problem.
+	 * (Is this enough?  In practice it seems it should be, but I don't
+	 * quite see how to prove it.  If we run out, we might fail to find a
+	 * workable wait queue rearrangement even though one exists.)  NOTE
+	 * that this number limits the maximum recursion depth of
+	 * DeadLockCheckRecurse. Making it really big might potentially allow
+	 * a stack-overflow problem.
 	 */
 	maxCurConstraints = MaxBackends;
 	curConstraints = (EDGE *) palloc(maxCurConstraints * sizeof(EDGE));
@@ -139,8 +148,8 @@ InitDeadLockChecking(void)
 	 * re-run TestConfiguration.  (This is probably more than enough, but
 	 * we can survive if we run low on space by doing excess runs of
 	 * TestConfiguration to re-compute constraint lists each time needed.)
-	 * The last MaxBackends entries in possibleConstraints[] are reserved as
-	 * output workspace for FindLockCycle.
+	 * The last MaxBackends entries in possibleConstraints[] are reserved
+	 * as output workspace for FindLockCycle.
 	 */
 	maxPossibleConstraints = MaxBackends * 4;
 	possibleConstraints =
@@ -185,9 +194,9 @@ DeadLockCheck(PROC *proc)
 	/* Apply any needed rearrangements of wait queues */
 	for (i = 0; i < nWaitOrders; i++)
 	{
-		LOCK   *lock = waitOrders[i].lock;
-		PROC  **procs = waitOrders[i].procs;
-		int		nProcs = waitOrders[i].nProcs;
+		LOCK	   *lock = waitOrders[i].lock;
+		PROC	  **procs = waitOrders[i].procs;
+		int			nProcs = waitOrders[i].nProcs;
 		PROC_QUEUE *waitQueue = &(lock->waitProcs);
 
 		Assert(nProcs == waitQueue->size);
@@ -218,10 +227,10 @@ DeadLockCheck(PROC *proc)
  * DeadLockCheckRecurse -- recursively search for valid orderings
  *
  * curConstraints[] holds the current set of constraints being considered
- * by an outer level of recursion.  Add to this each possible solution
+ * by an outer level of recursion.	Add to this each possible solution
  * constraint for any cycle detected at this level.
  *
- * Returns TRUE if no solution exists.  Returns FALSE if a deadlock-free
+ * Returns TRUE if no solution exists.	Returns FALSE if a deadlock-free
  * state is attainable, in which case waitOrders[] shows the required
  * rearrangements of lock wait queues (if any).
  */
@@ -252,6 +261,7 @@ DeadLockCheckRecurse(PROC *proc)
 		/* Not room; will need to regenerate the edges on-the-fly */
 		savedList = false;
 	}
+
 	/*
 	 * Try each available soft edge as an addition to the configuration.
 	 */
@@ -264,7 +274,7 @@ DeadLockCheckRecurse(PROC *proc)
 				elog(FATAL, "DeadLockCheckRecurse: inconsistent results");
 		}
 		curConstraints[nCurConstraints] =
-			possibleConstraints[oldPossibleConstraints+i];
+			possibleConstraints[oldPossibleConstraints + i];
 		nCurConstraints++;
 		if (!DeadLockCheckRecurse(proc))
 			return false;		/* found a valid solution! */
@@ -293,25 +303,27 @@ DeadLockCheckRecurse(PROC *proc)
 static bool
 TestConfiguration(PROC *startProc)
 {
-	int		softFound = 0;
-	EDGE   *softEdges = possibleConstraints + nPossibleConstraints;
-	int		nSoftEdges;
-	int		i;
+	int			softFound = 0;
+	EDGE	   *softEdges = possibleConstraints + nPossibleConstraints;
+	int			nSoftEdges;
+	int			i;
 
 	/*
 	 * Make sure we have room for FindLockCycle's output.
 	 */
 	if (nPossibleConstraints + MaxBackends > maxPossibleConstraints)
 		return -1;
+
 	/*
 	 * Expand current constraint set into wait orderings.  Fail if the
 	 * constraint set is not self-consistent.
 	 */
 	if (!ExpandConstraints(curConstraints, nCurConstraints))
 		return -1;
+
 	/*
 	 * Check for cycles involving startProc or any of the procs mentioned
-	 * in constraints.  We check startProc last because if it has a soft
+	 * in constraints.	We check startProc last because if it has a soft
 	 * cycle still to be dealt with, we want to deal with that first.
 	 */
 	for (i = 0; i < nCurConstraints; i++)
@@ -350,7 +362,7 @@ TestConfiguration(PROC *startProc)
  *
  * Since we need to be able to check hypothetical configurations that would
  * exist after wait queue rearrangement, the routine pays attention to the
- * table of hypothetical queue orders in waitOrders[].  These orders will
+ * table of hypothetical queue orders in waitOrders[].	These orders will
  * be believed in preference to the actual ordering seen in the locktable.
  */
 static bool
@@ -391,9 +403,10 @@ FindLockCycleRecurse(PROC *checkProc,
 			/* If we return to starting point, we have a deadlock cycle */
 			if (i == 0)
 				return true;
+
 			/*
-			 * Otherwise, we have a cycle but it does not include the start
-			 * point, so say "no deadlock".
+			 * Otherwise, we have a cycle but it does not include the
+			 * start point, so say "no deadlock".
 			 */
 			return false;
 		}
@@ -401,6 +414,7 @@ FindLockCycleRecurse(PROC *checkProc,
 	/* Mark proc as seen */
 	Assert(nVisitedProcs < MaxBackends);
 	visitedProcs[nVisitedProcs++] = checkProc;
+
 	/*
 	 * If the proc is not waiting, we have no outgoing waits-for edges.
 	 */
@@ -413,8 +427,9 @@ FindLockCycleRecurse(PROC *checkProc,
 	lockctl = lockMethodTable->ctl;
 	numLockModes = lockctl->numLockModes;
 	conflictMask = lockctl->conflictTab[checkProc->waitLockMode];
+
 	/*
-	 * Scan for procs that already hold conflicting locks.  These are
+	 * Scan for procs that already hold conflicting locks.	These are
 	 * "hard" edges in the waits-for graph.
 	 */
 	lockHolders = &(lock->lockHolders);
@@ -449,12 +464,13 @@ FindLockCycleRecurse(PROC *checkProc,
 
 	/*
 	 * Scan for procs that are ahead of this one in the lock's wait queue.
-	 * Those that have conflicting requests soft-block this one.  This must
-	 * be done after the hard-block search, since if another proc both
-	 * hard- and soft-blocks this one, we want to call it a hard edge.
+	 * Those that have conflicting requests soft-block this one.  This
+	 * must be done after the hard-block search, since if another proc
+	 * both hard- and soft-blocks this one, we want to call it a hard
+	 * edge.
 	 *
-	 * If there is a proposed re-ordering of the lock's wait order,
-	 * use that rather than the current wait order.
+	 * If there is a proposed re-ordering of the lock's wait order, use that
+	 * rather than the current wait order.
 	 */
 	for (i = 0; i < nWaitOrders; i++)
 	{
@@ -465,7 +481,7 @@ FindLockCycleRecurse(PROC *checkProc,
 	if (i < nWaitOrders)
 	{
 		/* Use the given hypothetical wait queue order */
-		PROC  **procs = waitOrders[i].procs;
+		PROC	  **procs = waitOrders[i].procs;
 
 		queue_size = waitOrders[i].nProcs;
 
@@ -483,7 +499,11 @@ FindLockCycleRecurse(PROC *checkProc,
 				/* This proc soft-blocks checkProc */
 				if (FindLockCycleRecurse(proc, softEdges, nSoftEdges))
 				{
-					/* Add this edge to the list of soft edges in the cycle */
+
+					/*
+					 * Add this edge to the list of soft edges in the
+					 * cycle
+					 */
 					Assert(*nSoftEdges < MaxBackends);
 					softEdges[*nSoftEdges].waiter = checkProc;
 					softEdges[*nSoftEdges].blocker = proc;
@@ -513,7 +533,11 @@ FindLockCycleRecurse(PROC *checkProc,
 				/* This proc soft-blocks checkProc */
 				if (FindLockCycleRecurse(proc, softEdges, nSoftEdges))
 				{
-					/* Add this edge to the list of soft edges in the cycle */
+
+					/*
+					 * Add this edge to the list of soft edges in the
+					 * cycle
+					 */
 					Assert(*nSoftEdges < MaxBackends);
 					softEdges[*nSoftEdges].waiter = checkProc;
 					softEdges[*nSoftEdges].blocker = proc;
@@ -553,18 +577,19 @@ ExpandConstraints(EDGE *constraints,
 				j;
 
 	nWaitOrders = 0;
+
 	/*
-	 * Scan constraint list backwards.  This is because the last-added
+	 * Scan constraint list backwards.	This is because the last-added
 	 * constraint is the only one that could fail, and so we want to test
 	 * it for inconsistency first.
 	 */
-	for (i = nConstraints; --i >= 0; )
+	for (i = nConstraints; --i >= 0;)
 	{
-		PROC   *proc = constraints[i].waiter;
-		LOCK   *lock = proc->waitLock;
+		PROC	   *proc = constraints[i].waiter;
+		LOCK	   *lock = proc->waitLock;
 
 		/* Did we already make a list for this lock? */
-		for (j = nWaitOrders; --j >= 0; )
+		for (j = nWaitOrders; --j >= 0;)
 		{
 			if (waitOrders[j].lock == lock)
 				break;
@@ -577,11 +602,12 @@ ExpandConstraints(EDGE *constraints,
 		waitOrders[nWaitOrders].nProcs = lock->waitProcs.size;
 		nWaitOrderProcs += lock->waitProcs.size;
 		Assert(nWaitOrderProcs <= MaxBackends);
+
 		/*
 		 * Do the topo sort.  TopoSort need not examine constraints after
 		 * this one, since they must be for different locks.
 		 */
-		if (!TopoSort(lock, constraints, i+1,
+		if (!TopoSort(lock, constraints, i + 1,
 					  waitOrders[nWaitOrders].procs))
 			return false;
 		nWaitOrders++;
@@ -607,7 +633,7 @@ ExpandConstraints(EDGE *constraints,
  * The initial queue ordering is taken directly from the lock's wait queue.
  * The output is an array of PROC pointers, of length equal to the lock's
  * wait queue length (the caller is responsible for providing this space).
- * The partial order is specified by an array of EDGE structs.  Each EDGE
+ * The partial order is specified by an array of EDGE structs.	Each EDGE
  * is one that we need to reverse, therefore the "waiter" must appear before
  * the "blocker" in the output array.  The EDGE array may well contain
  * edges associated with other locks; these should be ignored.
@@ -638,14 +664,15 @@ TopoSort(LOCK *lock,
 	}
 
 	/*
-	 * Scan the constraints, and for each proc in the array, generate a count
-	 * of the number of constraints that say it must be before something else,
-	 * plus a list of the constraints that say it must be after something else.
-	 * The count for the j'th proc is stored in beforeConstraints[j], and the
-	 * head of its list in afterConstraints[j].  Each constraint stores its
-	 * list link in constraints[i].link (note any constraint will be in
-	 * just one list).  The array index for the before-proc of the i'th
-	 * constraint is remembered in constraints[i].pred.
+	 * Scan the constraints, and for each proc in the array, generate a
+	 * count of the number of constraints that say it must be before
+	 * something else, plus a list of the constraints that say it must be
+	 * after something else. The count for the j'th proc is stored in
+	 * beforeConstraints[j], and the head of its list in
+	 * afterConstraints[j].  Each constraint stores its list link in
+	 * constraints[i].link (note any constraint will be in just one list).
+	 * The array index for the before-proc of the i'th constraint is
+	 * remembered in constraints[i].pred.
 	 */
 	MemSet(beforeConstraints, 0, queue_size * sizeof(int));
 	MemSet(afterConstraints, 0, queue_size * sizeof(int));
@@ -656,7 +683,7 @@ TopoSort(LOCK *lock,
 		if (proc->waitLock != lock)
 			continue;
 		/* Find the waiter proc in the array */
-		for (j = queue_size; --j >= 0; )
+		for (j = queue_size; --j >= 0;)
 		{
 			if (topoProcs[j] == proc)
 				break;
@@ -664,20 +691,20 @@ TopoSort(LOCK *lock,
 		Assert(j >= 0);			/* should have found a match */
 		/* Find the blocker proc in the array */
 		proc = constraints[i].blocker;
-		for (k = queue_size; --k >= 0; )
+		for (k = queue_size; --k >= 0;)
 		{
 			if (topoProcs[k] == proc)
 				break;
 		}
 		Assert(k >= 0);			/* should have found a match */
-		beforeConstraints[j]++;	/* waiter must come before */
+		beforeConstraints[j]++; /* waiter must come before */
 		/* add this constraint to list of after-constraints for blocker */
 		constraints[i].pred = j;
 		constraints[i].link = afterConstraints[k];
-		afterConstraints[k] = i+1;
+		afterConstraints[k] = i + 1;
 	}
 	/*--------------------
-	 * Now scan the topoProcs array backwards.  At each step, output the
+	 * Now scan the topoProcs array backwards.	At each step, output the
 	 * last proc that has no remaining before-constraints, and decrease
 	 * the beforeConstraints count of each of the procs it was constrained
 	 * against.
@@ -687,8 +714,8 @@ TopoSort(LOCK *lock,
 	 * last = last non-null index in topoProcs (avoid redundant searches)
 	 *--------------------
 	 */
-	last = queue_size-1;
-	for (i = queue_size; --i >= 0; )
+	last = queue_size - 1;
+	for (i = queue_size; --i >= 0;)
 	{
 		/* Find next candidate to output */
 		while (topoProcs[last] == NULL)
@@ -705,10 +732,8 @@ TopoSort(LOCK *lock,
 		ordering[i] = topoProcs[j];
 		topoProcs[j] = NULL;
 		/* Update beforeConstraints counts of its predecessors */
-		for (k = afterConstraints[j]; k > 0; k = constraints[k-1].link)
-		{
-			beforeConstraints[constraints[k-1].pred]--;
-		}
+		for (k = afterConstraints[j]; k > 0; k = constraints[k - 1].link)
+			beforeConstraints[constraints[k - 1].pred]--;
 	}
 
 	/* Done */
@@ -734,4 +759,5 @@ PrintLockQueue(LOCK *lock, const char *info)
 	printf("\n");
 	fflush(stdout);
 }
+
 #endif
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index a042bbe3ee636221096371641263ddf2db884c11..c06f76bfcdba3f6cb0fab4191a53b9d3c393ff65 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.44 2001/01/24 19:43:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.45 2001/03/22 03:59:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -174,7 +174,7 @@ UnlockRelation(Relation relation, LOCKMODE lockmode)
 /*
  *		LockRelationForSession
  *
- * This routine grabs a session-level lock on the target relation.  The
+ * This routine grabs a session-level lock on the target relation.	The
  * session lock persists across transaction boundaries.  It will be removed
  * when UnlockRelationForSession() is called, or if an elog(ERROR) occurs,
  * or if the backend exits.
@@ -291,6 +291,7 @@ XactLockTableDelete(TransactionId xid)
 
 	LockRelease(LockTableId, &tag, xid, ExclusiveLock);
 }
+
 #endif
 
 void
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index b3c630b79c09fc60215954ccb329885fc46addd5..912a25ff229c5f04eb4d3c1e33bff1b279e6ae16 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.87 2001/03/18 20:13:13 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.88 2001/03/22 03:59:46 momjian Exp $
  *
  * NOTES
  *	  Outside modules can create a lock table and acquire/release
@@ -40,10 +40,10 @@
 #include "utils/memutils.h"
 #include "utils/ps_status.h"
 
-static int	WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
-					   LOCK *lock, HOLDER *holder);
+static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
+		   LOCK *lock, HOLDER *holder);
 static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc,
-							 int *myHolding);
+				 int *myHolding);
 
 static char *lock_mode_names[] =
 {
@@ -65,40 +65,40 @@ static char *DeadLockMessage = "Deadlock detected.\n\tSee the lock(l) manual pag
 /*------
  * The following configuration options are available for lock debugging:
  *
- *     TRACE_LOCKS      -- give a bunch of output what's going on in this file
- *     TRACE_USERLOCKS  -- same but for user locks
- *     TRACE_LOCK_OIDMIN-- do not trace locks for tables below this oid
- *                         (use to avoid output on system tables)
- *     TRACE_LOCK_TABLE -- trace locks on this table (oid) unconditionally
- *     DEBUG_DEADLOCKS  -- currently dumps locks at untimely occasions ;)
+ *	   TRACE_LOCKS		-- give a bunch of output what's going on in this file
+ *	   TRACE_USERLOCKS	-- same but for user locks
+ *	   TRACE_LOCK_OIDMIN-- do not trace locks for tables below this oid
+ *						   (use to avoid output on system tables)
+ *	   TRACE_LOCK_TABLE -- trace locks on this table (oid) unconditionally
+ *	   DEBUG_DEADLOCKS	-- currently dumps locks at untimely occasions ;)
  *
  * Furthermore, but in storage/ipc/spin.c:
- *     TRACE_SPINLOCKS  -- trace spinlocks (pretty useless)
+ *	   TRACE_SPINLOCKS	-- trace spinlocks (pretty useless)
  *
  * Define LOCK_DEBUG at compile time to get all these enabled.
  * --------
  */
 
-int  Trace_lock_oidmin  = BootstrapObjectIdData;
-bool Trace_locks        = false;
-bool Trace_userlocks    = false;
-int  Trace_lock_table   = 0;
-bool Debug_deadlocks    = false;
+int			Trace_lock_oidmin = BootstrapObjectIdData;
+bool		Trace_locks = false;
+bool		Trace_userlocks = false;
+int			Trace_lock_table = 0;
+bool		Debug_deadlocks = false;
 
 
 inline static bool
-LOCK_DEBUG_ENABLED(const LOCK * lock)
+LOCK_DEBUG_ENABLED(const LOCK *lock)
 {
 	return
-		(((LOCK_LOCKMETHOD(*lock) == DEFAULT_LOCKMETHOD && Trace_locks)
-		  || (LOCK_LOCKMETHOD(*lock) == USER_LOCKMETHOD && Trace_userlocks))
-		 && (lock->tag.relId >= (Oid) Trace_lock_oidmin))
-		|| (Trace_lock_table && (lock->tag.relId == Trace_lock_table));
+	(((LOCK_LOCKMETHOD(*lock) == DEFAULT_LOCKMETHOD && Trace_locks)
+	  || (LOCK_LOCKMETHOD(*lock) == USER_LOCKMETHOD && Trace_userlocks))
+	 && (lock->tag.relId >= (Oid) Trace_lock_oidmin))
+	|| (Trace_lock_table && (lock->tag.relId == Trace_lock_table));
 }
 
 
 inline static void
-LOCK_PRINT(const char * where, const LOCK * lock, LOCKMODE type)
+LOCK_PRINT(const char *where, const LOCK *lock, LOCKMODE type)
 {
 	if (LOCK_DEBUG_ENABLED(lock))
 		elog(DEBUG,
@@ -119,30 +119,30 @@ LOCK_PRINT(const char * where, const LOCK * lock, LOCKMODE type)
 
 
 inline static void
-HOLDER_PRINT(const char * where, const HOLDER * holderP)
+HOLDER_PRINT(const char *where, const HOLDER *holderP)
 {
 	if (
-		(((HOLDER_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
-		  || (HOLDER_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks))
-		 && (((LOCK *)MAKE_PTR(holderP->tag.lock))->tag.relId >= (Oid) Trace_lock_oidmin))
-		|| (Trace_lock_table && (((LOCK *)MAKE_PTR(holderP->tag.lock))->tag.relId == Trace_lock_table))
-		)
+	 (((HOLDER_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
+	   || (HOLDER_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks))
+	  && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId >= (Oid) Trace_lock_oidmin))
+		|| (Trace_lock_table && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId == Trace_lock_table))
+	)
 		elog(DEBUG,
 			 "%s: holder(%lx) lock(%lx) tbl(%d) proc(%lx) xid(%u) hold(%d,%d,%d,%d,%d,%d,%d)=%d",
 			 where, MAKE_OFFSET(holderP), holderP->tag.lock,
 			 HOLDER_LOCKMETHOD(*(holderP)),
 			 holderP->tag.proc, holderP->tag.xid,
-			 holderP->holding[1], holderP->holding[2], holderP->holding[3],
-			 holderP->holding[4], holderP->holding[5], holderP->holding[6],
+		   holderP->holding[1], holderP->holding[2], holderP->holding[3],
+		   holderP->holding[4], holderP->holding[5], holderP->holding[6],
 			 holderP->holding[7], holderP->nHolding);
 }
 
-#else  /* not LOCK_DEBUG */
+#else							/* not LOCK_DEBUG */
 
 #define LOCK_PRINT(where, lock, type)
 #define HOLDER_PRINT(where, holderP)
 
-#endif /* not LOCK_DEBUG */
+#endif	 /* not LOCK_DEBUG */
 
 
 
@@ -218,7 +218,7 @@ LockingDisabled(void)
 LOCKMETHODTABLE *
 GetLocksMethodTable(LOCK *lock)
 {
-	LOCKMETHOD lockmethod = LOCK_LOCKMETHOD(*lock);
+	LOCKMETHOD	lockmethod = LOCK_LOCKMETHOD(*lock);
 
 	Assert(lockmethod > 0 && lockmethod < NumLockMethods);
 	return LockMethodTable[lockmethod];
@@ -258,7 +258,7 @@ LockMethodInit(LOCKMETHODTABLE *lockMethodTable,
  *		is wasteful, in this case, but not much space is involved.
  *
  * NOTE: data structures allocated here are allocated permanently, using
- * TopMemoryContext and shared memory.  We don't ever release them anyway,
+ * TopMemoryContext and shared memory.	We don't ever release them anyway,
  * and in normal multi-backend operation the lock table structures set up
  * by the postmaster are inherited by each backend, so they must be in
  * TopMemoryContext.
@@ -304,8 +304,8 @@ LockMethodTableInit(char *tabName,
 	SpinAcquire(LockMgrLock);
 
 	/*
-	 * allocate a control structure from shared memory or attach to it
-	 * if it already exists.
+	 * allocate a control structure from shared memory or attach to it if
+	 * it already exists.
 	 *
 	 */
 	sprintf(shmemName, "%s (ctl)", tabName);
@@ -341,8 +341,8 @@ LockMethodTableInit(char *tabName,
 	Assert(NumLockMethods <= MAX_LOCK_METHODS);
 
 	/*
-	 * allocate a hash table for LOCK structs.  This is used
-	 * to store per-locked-object information.
+	 * allocate a hash table for LOCK structs.	This is used to store
+	 * per-locked-object information.
 	 *
 	 */
 	info.keysize = SHMEM_LOCKTAB_KEYSIZE;
@@ -362,8 +362,8 @@ LockMethodTableInit(char *tabName,
 	Assert(lockMethodTable->lockHash->hash == tag_hash);
 
 	/*
-	 * allocate a hash table for HOLDER structs.  This is used
-	 * to store per-lock-holder information.
+	 * allocate a hash table for HOLDER structs.  This is used to store
+	 * per-lock-holder information.
 	 *
 	 */
 	info.keysize = SHMEM_HOLDERTAB_KEYSIZE;
@@ -558,7 +558,8 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	 * Create the hash key for the holder table.
 	 *
 	 */
-	MemSet(&holdertag, 0, sizeof(HOLDERTAG)); /* must clear padding, needed */
+	MemSet(&holdertag, 0, sizeof(HOLDERTAG));	/* must clear padding,
+												 * needed */
 	holdertag.lock = MAKE_OFFSET(lock);
 	holdertag.proc = MAKE_OFFSET(MyProc);
 	TransactionIdStore(xid, &holdertag.xid);
@@ -595,6 +596,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 		Assert(holder->nHolding <= lock->nGranted);
 
 #ifdef CHECK_DEADLOCK_RISK
+
 		/*
 		 * Issue warning if we already hold a lower-level lock on this
 		 * object and do not hold a lock of the requested level or higher.
@@ -602,12 +604,13 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 		 * a deadlock if another backend were following the same code path
 		 * at about the same time).
 		 *
-		 * This is not enabled by default, because it may generate log entries
-		 * about user-level coding practices that are in fact safe in context.
-		 * It can be enabled to help find system-level problems.
+		 * This is not enabled by default, because it may generate log
+		 * entries about user-level coding practices that are in fact safe
+		 * in context. It can be enabled to help find system-level
+		 * problems.
 		 *
-		 * XXX Doing numeric comparison on the lockmodes is a hack;
-		 * it'd be better to use a table.  For now, though, this works.
+		 * XXX Doing numeric comparison on the lockmodes is a hack; it'd be
+		 * better to use a table.  For now, though, this works.
 		 */
 		for (i = lockMethodTable->ctl->numLockModes; i > 0; i--)
 		{
@@ -618,17 +621,17 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 				elog(DEBUG, "Deadlock risk: raising lock level"
 					 " from %s to %s on object %u/%u/%u",
 					 lock_mode_names[i], lock_mode_names[lockmode],
-					 lock->tag.relId, lock->tag.dbId, lock->tag.objId.blkno);
+				 lock->tag.relId, lock->tag.dbId, lock->tag.objId.blkno);
 				break;
 			}
 		}
-#endif /* CHECK_DEADLOCK_RISK */
+#endif	 /* CHECK_DEADLOCK_RISK */
 	}
 
 	/*
 	 * lock->nRequested and lock->requested[] count the total number of
-	 * requests, whether granted or waiting, so increment those immediately.
-	 * The other counts don't increment till we get the lock.
+	 * requests, whether granted or waiting, so increment those
+	 * immediately. The other counts don't increment till we get the lock.
 	 *
 	 */
 	lock->nRequested++;
@@ -636,8 +639,8 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	Assert((lock->nRequested > 0) && (lock->requested[lockmode] > 0));
 
 	/*
-	 * If I already hold one or more locks of the requested type,
-	 * just grant myself another one without blocking.
+	 * If I already hold one or more locks of the requested type, just
+	 * grant myself another one without blocking.
 	 *
 	 */
 	if (holder->holding[lockmode] > 0)
@@ -649,8 +652,8 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	}
 
 	/*
-	 * If this process (under any XID) is a holder of the lock,
-	 * also grant myself another one without blocking.
+	 * If this process (under any XID) is a holder of the lock, also grant
+	 * myself another one without blocking.
 	 *
 	 */
 	LockCountMyLocks(holder->tag.lock, MyProc, myHolding);
@@ -663,9 +666,9 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	}
 
 	/*
-	 * If lock requested conflicts with locks requested by waiters,
-	 * must join wait queue.  Otherwise, check for conflict with
-	 * already-held locks.  (That's last because most complex check.)
+	 * If lock requested conflicts with locks requested by waiters, must
+	 * join wait queue.  Otherwise, check for conflict with already-held
+	 * locks.  (That's last because most complex check.)
 	 *
 	 */
 	if (lockMethodTable->ctl->conflictTab[lockmode] & lock->waitMask)
@@ -711,7 +714,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 			SpinRelease(masterLock);
 			return FALSE;
 		}
-#endif /* USER_LOCKS */
+#endif	 /* USER_LOCKS */
 
 		/*
 		 * Construct bitmask of locks this process holds on this object.
@@ -737,8 +740,9 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 
 		/*
 		 * NOTE: do not do any material change of state between here and
-		 * return.  All required changes in locktable state must have been
-		 * done when the lock was granted to us --- see notes in WaitOnLock.
+		 * return.	All required changes in locktable state must have been
+		 * done when the lock was granted to us --- see notes in
+		 * WaitOnLock.
 		 */
 
 		/*
@@ -795,13 +799,13 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
 	int			localHolding[MAX_LOCKMODES];
 
 	/*
-	 * first check for global conflicts: If no locks conflict
-	 * with my request, then I get the lock.
+	 * first check for global conflicts: If no locks conflict with my
+	 * request, then I get the lock.
 	 *
 	 * Checking for conflict: lock->grantMask represents the types of
-	 * currently held locks.  conflictTable[lockmode] has a bit
-	 * set for each type of lock that conflicts with request.	Bitwise
-	 * compare tells if there is a conflict.
+	 * currently held locks.  conflictTable[lockmode] has a bit set for
+	 * each type of lock that conflicts with request.	Bitwise compare
+	 * tells if there is a conflict.
 	 *
 	 */
 	if (!(lockctl->conflictTab[lockmode] & lock->grantMask))
@@ -811,10 +815,10 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
 	}
 
 	/*
-	 * Rats.  Something conflicts. But it could still be my own
-	 * lock.  We have to construct a conflict mask
-	 * that does not reflect our own locks.  Locks held by the current
-	 * process under another XID also count as "our own locks".
+	 * Rats.  Something conflicts. But it could still be my own lock.  We
+	 * have to construct a conflict mask that does not reflect our own
+	 * locks.  Locks held by the current process under another XID also
+	 * count as "our own locks".
 	 *
 	 */
 	if (myHolding == NULL)
@@ -834,10 +838,9 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
 	}
 
 	/*
-	 * now check again for conflicts.  'bitmask' describes the types
-	 * of locks held by other processes.  If one of these
-	 * conflicts with the kind of lock that I want, there is a
-	 * conflict and I have to sleep.
+	 * now check again for conflicts.  'bitmask' describes the types of
+	 * locks held by other processes.  If one of these conflicts with the
+	 * kind of lock that I want, there is a conflict and I have to sleep.
 	 *
 	 */
 	if (!(lockctl->conflictTab[lockmode] & bitmask))
@@ -878,9 +881,7 @@ LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding)
 		if (lockOffset == holder->tag.lock)
 		{
 			for (i = 1; i < MAX_LOCKMODES; i++)
-			{
 				myHolding[i] += holder->holding[i];
-			}
 		}
 
 		holder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink,
@@ -947,8 +948,8 @@ WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
 	 * Hence, after granting, the locktable state must fully reflect the
 	 * fact that we own the lock; we can't do additional work on return.
 	 * Contrariwise, if we fail, any cleanup must happen in xact abort
-	 * processing, not here, to ensure it will also happen in the cancel/die
-	 * case.
+	 * processing, not here, to ensure it will also happen in the
+	 * cancel/die case.
 	 */
 
 	if (ProcSleep(lockMethodTable,
@@ -956,9 +957,10 @@ WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
 				  lock,
 				  holder) != STATUS_OK)
 	{
+
 		/*
-		 * We failed as a result of a deadlock, see HandleDeadLock().
-		 * Quit now.  Removal of the holder and lock objects, if no longer
+		 * We failed as a result of a deadlock, see HandleDeadLock(). Quit
+		 * now.  Removal of the holder and lock objects, if no longer
 		 * needed, will happen in xact cleanup (see above for motivation).
 		 */
 		LOCK_PRINT("WaitOnLock: aborting on lock", lock, lockmode);
@@ -984,15 +986,15 @@ WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
  * NB: this does not remove the process' holder object, nor the lock object,
  * even though their counts might now have gone to zero.  That will happen
  * during a subsequent LockReleaseAll call, which we expect will happen
- * during transaction cleanup.  (Removal of a proc from its wait queue by
+ * during transaction cleanup.	(Removal of a proc from its wait queue by
  * this routine can only happen if we are aborting the transaction.)
  *--------------------
  */
 void
 RemoveFromWaitQueue(PROC *proc)
 {
-	LOCK   *waitLock = proc->waitLock;
-	LOCKMODE lockmode = proc->waitLockMode;
+	LOCK	   *waitLock = proc->waitLock;
+	LOCKMODE	lockmode = proc->waitLockMode;
 
 	/* Make sure proc is waiting */
 	Assert(proc->links.next != INVALID_OFFSET);
@@ -1095,7 +1097,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	/*
 	 * Find the holder entry for this holder.
 	 */
-	MemSet(&holdertag, 0, sizeof(HOLDERTAG)); /* must clear padding, needed */
+	MemSet(&holdertag, 0, sizeof(HOLDERTAG));	/* must clear padding,
+												 * needed */
 	holdertag.lock = MAKE_OFFSET(lock);
 	holdertag.proc = MAKE_OFFSET(MyProc);
 	TransactionIdStore(xid, &holdertag.xid);
@@ -1156,11 +1159,11 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	/*
 	 * We need only run ProcLockWakeup if the released lock conflicts with
 	 * at least one of the lock types requested by waiter(s).  Otherwise
-	 * whatever conflict made them wait must still exist.  NOTE: before MVCC,
-	 * we could skip wakeup if lock->granted[lockmode] was still positive.
-	 * But that's not true anymore, because the remaining granted locks might
-	 * belong to some waiter, who could now be awakened because he doesn't
-	 * conflict with his own locks.
+	 * whatever conflict made them wait must still exist.  NOTE: before
+	 * MVCC, we could skip wakeup if lock->granted[lockmode] was still
+	 * positive. But that's not true anymore, because the remaining
+	 * granted locks might belong to some waiter, who could now be
+	 * awakened because he doesn't conflict with his own locks.
 	 *
 	 */
 	if (lockMethodTable->ctl->conflictTab[lockmode] & lock->waitMask)
@@ -1168,10 +1171,10 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 
 	if (lock->nRequested == 0)
 	{
+
 		/*
-		 * if there's no one waiting in the queue,
-		 * we just released the last lock on this object.
-		 * Delete it from the lock table.
+		 * if there's no one waiting in the queue, we just released the
+		 * last lock on this object. Delete it from the lock table.
 		 *
 		 */
 		Assert(lockMethodTable->lockHash->hash == tag_hash);
@@ -1197,8 +1200,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 	Assert((holder->nHolding >= 0) && (holder->holding[lockmode] >= 0));
 
 	/*
-	 * If this was my last hold on this lock, delete my entry in the holder
-	 * table.
+	 * If this was my last hold on this lock, delete my entry in the
+	 * holder table.
 	 */
 	if (holder->nHolding == 0)
 	{
@@ -1316,11 +1319,12 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
 					Assert(lock->requested[i] >= 0 && lock->granted[i] >= 0);
 					if (lock->granted[i] == 0)
 						lock->grantMask &= BITS_OFF[i];
+
 					/*
 					 * Read comments in LockRelease
 					 */
 					if (!wakeupNeeded &&
-						lockMethodTable->ctl->conflictTab[i] & lock->waitMask)
+					lockMethodTable->ctl->conflictTab[i] & lock->waitMask)
 						wakeupNeeded = true;
 				}
 			}
@@ -1331,9 +1335,10 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
 		}
 		else
 		{
+
 			/*
-			 * This holder accounts for all the requested locks on the object,
-			 * so we can be lazy and just zero things out.
+			 * This holder accounts for all the requested locks on the
+			 * object, so we can be lazy and just zero things out.
 			 *
 			 */
 			lock->nRequested = 0;
@@ -1371,6 +1376,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
 
 		if (lock->nRequested == 0)
 		{
+
 			/*
 			 * We've just released the last lock, so garbage-collect the
 			 * lock object.
@@ -1412,7 +1418,8 @@ LockShmemSize(int maxBackends)
 
 	size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
 	size += maxBackends * MAXALIGN(sizeof(PROC));		/* each MyProc */
-	size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));	/* each lockMethodTable->ctl */
+	size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL)); /* each
+																 * lockMethodTable->ctl */
 
 	/* lockHash table */
 	size += hash_estimate_size(NLOCKENTS(maxBackends),
@@ -1534,4 +1541,4 @@ DumpAllLocks(void)
 	}
 }
 
-#endif /* LOCK_DEBUG */
+#endif	 /* LOCK_DEBUG */
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 463af1fa5e3dd9755abfb2bd482d4c50ccd1b6c0..ee2d6751c5e9685975bc7f28777991f8e1664b2c 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.98 2001/01/26 18:23:12 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.99 2001/03/22 03:59:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,7 +76,7 @@
 #include "storage/proc.h"
 
 
-int DeadlockTimeout = 1000;
+int			DeadlockTimeout = 1000;
 
 /* --------------------
  * Spin lock for manipulating the shared process data structure:
@@ -147,10 +147,10 @@ InitProcGlobal(int maxBackends)
 
 		/*
 		 * Arrange to delete semas on exit --- set this up now so that we
-		 * will clean up if pre-allocation fails.  We use our own freeproc,
-		 * rather than IpcSemaphoreCreate's removeOnExit option, because
-		 * we don't want to fill up the on_shmem_exit list with a separate
-		 * entry for each semaphore set.
+		 * will clean up if pre-allocation fails.  We use our own
+		 * freeproc, rather than IpcSemaphoreCreate's removeOnExit option,
+		 * because we don't want to fill up the on_shmem_exit list with a
+		 * separate entry for each semaphore set.
 		 */
 		on_shmem_exit(ProcFreeAllSemaphores, 0);
 
@@ -159,9 +159,9 @@ InitProcGlobal(int maxBackends)
 		 */
 		Assert(maxBackends > 0 && maxBackends <= MAXBACKENDS);
 
-		for (i = 0; i < ((maxBackends-1)/PROC_NSEMS_PER_SET+1); i++)
+		for (i = 0; i < ((maxBackends - 1) / PROC_NSEMS_PER_SET + 1); i++)
 		{
-			IpcSemaphoreId		semId;
+			IpcSemaphoreId semId;
 
 			semId = IpcSemaphoreCreate(PROC_NSEMS_PER_SET,
 									   IPCProtection,
@@ -242,6 +242,7 @@ InitProcess(void)
 	if (IsUnderPostmaster)
 	{
 		ProcGetNewSemIdAndNum(&MyProc->sem.semId, &MyProc->sem.semNum);
+
 		/*
 		 * we might be reusing a semaphore that belongs to a dead backend.
 		 * So be careful and reinitialize its value here.
@@ -288,8 +289,8 @@ InitProcess(void)
 	on_shmem_exit(ProcKill, 0);
 
 	/*
-	 * Now that we have a PROC, we could try to acquire locks,
-	 * so initialize the deadlock checker.
+	 * Now that we have a PROC, we could try to acquire locks, so
+	 * initialize the deadlock checker.
 	 */
 	InitDeadLockChecking();
 }
@@ -300,7 +301,7 @@ InitProcess(void)
 static void
 ZeroProcSemaphore(PROC *proc)
 {
-	union semun		semun;
+	union semun semun;
 
 	semun.val = 0;
 	if (semctl(proc->sem.semId, proc->sem.semNum, SETVAL, semun) < 0)
@@ -333,15 +334,15 @@ LockWaitCancel(void)
 #ifndef __BEOS__
 	{
 		struct itimerval timeval,
-						 dummy;
+					dummy;
 
 		MemSet(&timeval, 0, sizeof(struct itimerval));
 		setitimer(ITIMER_REAL, &timeval, &dummy);
 	}
 #else
 	/* BeOS doesn't have setitimer, but has set_alarm */
-    set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM);
-#endif /* __BEOS__ */
+	set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM);
+#endif	 /* __BEOS__ */
 
 	/* Unlink myself from the wait queue, if on it (might not be anymore!) */
 	LockLockTable();
@@ -352,17 +353,17 @@ LockWaitCancel(void)
 	/*
 	 * Reset the proc wait semaphore to zero.  This is necessary in the
 	 * scenario where someone else granted us the lock we wanted before we
-	 * were able to remove ourselves from the wait-list.  The semaphore will
-	 * have been bumped to 1 by the would-be grantor, and since we are no
-	 * longer going to wait on the sema, we have to force it back to zero.
-	 * Otherwise, our next attempt to wait for a lock will fall through
-	 * prematurely.
+	 * were able to remove ourselves from the wait-list.  The semaphore
+	 * will have been bumped to 1 by the would-be grantor, and since we
+	 * are no longer going to wait on the sema, we have to force it back
+	 * to zero. Otherwise, our next attempt to wait for a lock will fall
+	 * through prematurely.
 	 */
 	ZeroProcSemaphore(MyProc);
 
 	/*
-	 * Return true even if we were kicked off the lock before we were
-	 * able to remove ourselves.
+	 * Return true even if we were kicked off the lock before we were able
+	 * to remove ourselves.
 	 */
 	return true;
 }
@@ -467,7 +468,7 @@ ProcQueueAlloc(char *name)
 {
 	bool		found;
 	PROC_QUEUE *queue = (PROC_QUEUE *)
-		ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
+	ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
 
 	if (!queue)
 		return NULL;
@@ -520,11 +521,14 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 	int			myHeldLocks = MyProc->heldLocks;
 	PROC	   *proc;
 	int			i;
+
 #ifndef __BEOS__
 	struct itimerval timeval,
 				dummy;
+
 #else
-    bigtime_t time_interval;
+	bigtime_t	time_interval;
+
 #endif
 
 	/* ----------------------
@@ -582,6 +586,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 			aheadRequests |= (1 << proc->waitLockMode);
 			proc = (PROC *) MAKE_PTR(proc->links.next);
 		}
+
 		/*
 		 * If we fall out of loop normally, proc points to waitQueue head,
 		 * so we will insert at tail of queue as desired.
@@ -607,7 +612,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 	MyProc->waitHolder = holder;
 	MyProc->waitLockMode = lockmode;
 
-	MyProc->errType = STATUS_OK; /* initialize result for success */
+	MyProc->errType = STATUS_OK;/* initialize result for success */
 
 	/* mark that we are waiting for a lock */
 	waitingForLock = true;
@@ -643,7 +648,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 	if (setitimer(ITIMER_REAL, &timeval, &dummy))
 		elog(FATAL, "ProcSleep: Unable to set timer for process wakeup");
 #else
-    time_interval = DeadlockTimeout * 1000000; /* usecs */
+	time_interval = DeadlockTimeout * 1000000;	/* usecs */
 	if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
 		elog(FATAL, "ProcSleep: Unable to set timer for process wakeup");
 #endif
@@ -674,7 +679,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 	if (setitimer(ITIMER_REAL, &timeval, &dummy))
 		elog(FATAL, "ProcSleep: Unable to disable timer for process wakeup");
 #else
-    if (set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM) < 0)
+	if (set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM) < 0)
 		elog(FATAL, "ProcSleep: Unable to disable timer for process wakeup");
 #endif
 
@@ -759,7 +764,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock)
 
 	while (queue_size-- > 0)
 	{
-		LOCKMODE lockmode = proc->waitLockMode;
+		LOCKMODE	lockmode = proc->waitLockMode;
 
 		/*
 		 * Waken if (a) doesn't conflict with requests of earlier waiters,
@@ -776,15 +781,20 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock)
 			/* OK to waken */
 			GrantLock(lock, proc->waitHolder, lockmode);
 			proc = ProcWakeup(proc, STATUS_OK);
+
 			/*
-			 * ProcWakeup removes proc from the lock's waiting process queue
-			 * and returns the next proc in chain; don't use proc's next-link,
-			 * because it's been cleared.
+			 * ProcWakeup removes proc from the lock's waiting process
+			 * queue and returns the next proc in chain; don't use proc's
+			 * next-link, because it's been cleared.
 			 */
 		}
 		else
 		{
-			/* Cannot wake this guy. Remember his request for later checks. */
+
+			/*
+			 * Cannot wake this guy. Remember his request for later
+			 * checks.
+			 */
 			aheadRequests |= (1 << lockmode);
 			proc = (PROC *) MAKE_PTR(proc->links.next);
 		}
@@ -807,11 +817,11 @@ HandleDeadLock(SIGNAL_ARGS)
 	int			save_errno = errno;
 
 	/*
-	 * Acquire locktable lock.  Note that the SIGALRM interrupt had better
-	 * not be enabled anywhere that this process itself holds the locktable
-	 * lock, else this will wait forever.  Also note that this calls
-	 * SpinAcquire which creates a critical section, so that this routine
-	 * cannot be interrupted by cancel/die interrupts.
+	 * Acquire locktable lock.	Note that the SIGALRM interrupt had better
+	 * not be enabled anywhere that this process itself holds the
+	 * locktable lock, else this will wait forever.  Also note that this
+	 * calls SpinAcquire which creates a critical section, so that this
+	 * routine cannot be interrupted by cancel/die interrupts.
 	 */
 	LockLockTable();
 
@@ -836,8 +846,8 @@ HandleDeadLock(SIGNAL_ARGS)
 	}
 
 #ifdef LOCK_DEBUG
-    if (Debug_deadlocks)
-        DumpAllLocks();
+	if (Debug_deadlocks)
+		DumpAllLocks();
 #endif
 
 	if (!DeadLockCheck(MyProc))
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index 02528a30e678a48a42f8d6c1267e355a72775e31..d208a80d5cc97a7e52a974205c283310280b2cbf 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.36 2001/02/06 06:24:00 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.37 2001/03/22 03:59:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -59,14 +59,14 @@ PageInit(Page page, Size pageSize, Size specialSize)
 void
 PageZero(Page page)
 {
-	MemSet((char*)page + ((PageHeader)page)->pd_lower, 0,
-			((PageHeader)page)->pd_special - ((PageHeader)page)->pd_lower);
+	MemSet((char *) page + ((PageHeader) page)->pd_lower, 0,
+		((PageHeader) page)->pd_special - ((PageHeader) page)->pd_lower);
 }
 
 /* ----------------
  *		PageAddItem
  *
- *		Add an item to a page.  Return value is offset at which it was
+ *		Add an item to a page.	Return value is offset at which it was
  *		inserted, or InvalidOffsetNumber if there's not room to insert.
  *
  *		If offsetNumber is valid and <= current max offset in the page,
@@ -75,7 +75,7 @@ PageZero(Page page)
  *		If offsetNumber is not valid, then assign one by finding the first
  *		one that is both unused and deallocated.
  *
- *   !!! ELOG(ERROR) IS DISALLOWED HERE !!!
+ *	 !!! ELOG(ERROR) IS DISALLOWED HERE !!!
  *
  * ----------------
  */
@@ -125,10 +125,12 @@ PageAddItem(Page page,
 		}
 		else
 		{
+
 			/*
-			 * Don't actually do the shuffle till we've checked free space!
+			 * Don't actually do the shuffle till we've checked free
+			 * space!
 			 */
-			needshuffle = true;		/* need to increase "lower" */
+			needshuffle = true; /* need to increase "lower" */
 		}
 	}
 	else
@@ -162,7 +164,8 @@ PageAddItem(Page page,
 		return InvalidOffsetNumber;
 
 	/*
-	 * OK to insert the item.  First, shuffle the existing pointers if needed.
+	 * OK to insert the item.  First, shuffle the existing pointers if
+	 * needed.
 	 */
 	if (needshuffle)
 	{
@@ -284,12 +287,12 @@ PageRepairFragmentation(Page page, OffsetNumber *unused)
 	for (i = 0; i < nline; i++)
 	{
 		lp = ((PageHeader) page)->pd_linp + i;
-		if ((*lp).lp_flags & LP_DELETE)		/* marked for deletion */
+		if ((*lp).lp_flags & LP_DELETE) /* marked for deletion */
 			(*lp).lp_flags &= ~(LP_USED | LP_DELETE);
 		if ((*lp).lp_flags & LP_USED)
 			nused++;
 		else if (unused)
-			unused[i - nused] = (OffsetNumber)i;
+			unused[i - nused] = (OffsetNumber) i;
 	}
 
 	if (nused == 0)
@@ -347,7 +350,7 @@ PageRepairFragmentation(Page page, OffsetNumber *unused)
 		pfree(itemidbase);
 	}
 
-	return(nline - nused);
+	return (nline - nused);
 }
 
 /*
@@ -377,16 +380,16 @@ PageGetFreeSpace(Page page)
 void
 IndexPageCleanup(Buffer buffer)
 {
-	Page			page = (Page) BufferGetPage(buffer);
-	ItemId			lp;
-	OffsetNumber	maxoff;
-	OffsetNumber	i;
+	Page		page = (Page) BufferGetPage(buffer);
+	ItemId		lp;
+	OffsetNumber maxoff;
+	OffsetNumber i;
 
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (i = 0; i < maxoff; i++)
 	{
 		lp = ((PageHeader) page)->pd_linp + i;
-		if ((*lp).lp_flags & LP_DELETE)		/* marked for deletion */
+		if ((*lp).lp_flags & LP_DELETE) /* marked for deletion */
 		{
 			PageIndexTupleDelete(page, i + 1);
 			maxoff--;
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 179be5ab0e968c8b5a3d8ae3ea3f43c25d6e1f22..e4aca5aeee43e0843207b399a08a6dc1f93733e5 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.81 2001/01/24 19:43:08 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.82 2001/03/22 03:59:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,7 +76,7 @@ static int	_mdfd_getrelnfd(Relation reln);
 static MdfdVec *_mdfd_openseg(Relation reln, int segno, int oflags);
 static MdfdVec *_mdfd_getseg(Relation reln, int blkno);
 
-static int _mdfd_blind_getseg(RelFileNode rnode, int blkno);
+static int	_mdfd_blind_getseg(RelFileNode rnode, int blkno);
 
 static int	_fdvec_alloc(void);
 static void _fdvec_free(int);
@@ -135,13 +135,14 @@ mdcreate(Relation reln)
 
 	if (fd < 0)
 	{
-		int		save_errno = errno;
+		int			save_errno = errno;
 
 		/*
-		 * During bootstrap, there are cases where a system relation will be
-		 * accessed (by internal backend processes) before the bootstrap
-		 * script nominally creates it.  Therefore, allow the file to exist
-		 * already, but in bootstrap mode only.  (See also mdopen)
+		 * During bootstrap, there are cases where a system relation will
+		 * be accessed (by internal backend processes) before the
+		 * bootstrap script nominally creates it.  Therefore, allow the
+		 * file to exist already, but in bootstrap mode only.  (See also
+		 * mdopen)
 		 */
 		if (IsBootstrapProcessingMode())
 			fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
@@ -197,7 +198,7 @@ mdunlink(RelFileNode rnode)
 		char	   *segpath = (char *) palloc(strlen(path) + 12);
 		int			segno;
 
-		for (segno = 1; ; segno++)
+		for (segno = 1;; segno++)
 		{
 			sprintf(segpath, "%s.%d", path, segno);
 			if (unlink(segpath) < 0)
@@ -293,11 +294,13 @@ mdopen(Relation reln)
 
 	if (fd < 0)
 	{
+
 		/*
-		 * During bootstrap, there are cases where a system relation will be
-		 * accessed (by internal backend processes) before the bootstrap
-		 * script nominally creates it.  Therefore, accept mdopen() as a
-		 * substitute for mdcreate() in bootstrap mode only.  (See mdcreate)
+		 * During bootstrap, there are cases where a system relation will
+		 * be accessed (by internal backend processes) before the
+		 * bootstrap script nominally creates it.  Therefore, accept
+		 * mdopen() as a substitute for mdcreate() in bootstrap mode only.
+		 * (See mdcreate)
 		 */
 		if (IsBootstrapProcessingMode())
 			fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
@@ -666,12 +669,13 @@ mdnblocks(Relation reln)
 
 			if (v->mdfd_chain == (MdfdVec *) NULL)
 			{
+
 				/*
-				 * Because we pass O_CREAT, we will create the next segment
-				 * (with zero length) immediately, if the last segment is of
-				 * length REL_SEGSIZE.  This is unnecessary but harmless, and
-				 * testing for the case would take more cycles than it seems
-				 * worth.
+				 * Because we pass O_CREAT, we will create the next
+				 * segment (with zero length) immediately, if the last
+				 * segment is of length REL_SEGSIZE.  This is unnecessary
+				 * but harmless, and testing for the case would take more
+				 * cycles than it seems worth.
 				 */
 				v->mdfd_chain = _mdfd_openseg(reln, segno, O_CREAT);
 				if (v->mdfd_chain == (MdfdVec *) NULL)
@@ -700,8 +704,10 @@ mdtruncate(Relation reln, int nblocks)
 	int			curnblk;
 	int			fd;
 	MdfdVec    *v;
+
 #ifndef LET_OS_MANAGE_FILESIZE
 	int			priorblocks;
+
 #endif
 
 	/*
@@ -1004,14 +1010,16 @@ _mdfd_getseg(Relation reln, int blkno)
 
 		if (v->mdfd_chain == (MdfdVec *) NULL)
 		{
+
 			/*
-			 * We will create the next segment only if the target block
-			 * is within it.  This prevents Sorcerer's Apprentice syndrome
-			 * if a bug at higher levels causes us to be handed a ridiculously
-			 * large blkno --- otherwise we could create many thousands of
-			 * empty segment files before reaching the "target" block.  We
-			 * should never need to create more than one new segment per call,
-			 * so this restriction seems reasonable.
+			 * We will create the next segment only if the target block is
+			 * within it.  This prevents Sorcerer's Apprentice syndrome if
+			 * a bug at higher levels causes us to be handed a
+			 * ridiculously large blkno --- otherwise we could create many
+			 * thousands of empty segment files before reaching the
+			 * "target" block.	We should never need to create more than
+			 * one new segment per call, so this restriction seems
+			 * reasonable.
 			 */
 			v->mdfd_chain = _mdfd_openseg(reln, i, (segno == 1) ? O_CREAT : 0);
 
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index 10d6d6fc480391e5cb6d579f1ee7ab74226c22d7..d19abcd6254871e245782013b200732ea791b5c6 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.47 2001/01/24 19:43:08 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.48 2001/03/22 03:59:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,8 +39,8 @@ typedef struct f_smgr
 										   char *buffer);
 	int			(*smgr_flush) (Relation reln, BlockNumber blocknum,
 										   char *buffer);
-	int			(*smgr_blindwrt) (RelFileNode rnode, BlockNumber blkno, 
-										char *buffer, bool dofsync);
+	int			(*smgr_blindwrt) (RelFileNode rnode, BlockNumber blkno,
+											  char *buffer, bool dofsync);
 	int			(*smgr_markdirty) (Relation reln, BlockNumber blkno);
 	int			(*smgr_blindmarkdirty) (RelFileNode, BlockNumber blkno);
 	int			(*smgr_nblocks) (Relation reln);
@@ -60,7 +60,7 @@ static f_smgr smgrsw[] = {
 	/* magnetic disk */
 	{mdinit, NULL, mdcreate, mdunlink, mdextend, mdopen, mdclose,
 		mdread, mdwrite, mdflush, mdblindwrt, mdmarkdirty, mdblindmarkdirty,
-	mdnblocks, mdtruncate, mdcommit, mdabort, mdsync
+		mdnblocks, mdtruncate, mdcommit, mdabort, mdsync
 	},
 
 #ifdef STABLE_MEMORY_STORAGE
@@ -96,7 +96,7 @@ static int	NSmgr = lengthof(smgrsw);
  * that have been created or deleted in the current transaction.  When
  * a relation is created, we create the physical file immediately, but
  * remember it so that we can delete the file again if the current
- * transaction is aborted.  Conversely, a deletion request is NOT
+ * transaction is aborted.	Conversely, a deletion request is NOT
  * executed immediately, but is just entered in the list.  When and if
  * the transaction commits, we can delete the physical file.
  *
@@ -108,12 +108,12 @@ static int	NSmgr = lengthof(smgrsw);
 typedef struct PendingRelDelete
 {
 	RelFileNode relnode;		/* relation that may need to be deleted */
-	int16 which;				/* which storage manager? */
-	bool atCommit;				/* T=delete at commit; F=delete at abort */
-	struct PendingRelDelete *next; /* linked-list link */
+	int16		which;			/* which storage manager? */
+	bool		atCommit;		/* T=delete at commit; F=delete at abort */
+	struct PendingRelDelete *next;		/* linked-list link */
 } PendingRelDelete;
 
-static PendingRelDelete *pendingDeletes = NULL;	/* head of linked list */
+static PendingRelDelete *pendingDeletes = NULL; /* head of linked list */
 
 
 /*
@@ -133,7 +133,7 @@ smgrinit()
 			if ((*(smgrsw[i].smgr_init)) () == SM_FAIL)
 				elog(FATAL, "initialization failed on %s: %m",
 					 DatumGetCString(DirectFunctionCall1(smgrout,
-														 Int16GetDatum(i))));
+													 Int16GetDatum(i))));
 		}
 	}
 
@@ -155,7 +155,7 @@ smgrshutdown(void)
 			if ((*(smgrsw[i].smgr_shutdown)) () == SM_FAIL)
 				elog(FATAL, "shutdown failed on %s: %m",
 					 DatumGetCString(DirectFunctionCall1(smgrout,
-														 Int16GetDatum(i))));
+													 Int16GetDatum(i))));
 		}
 	}
 }
@@ -213,11 +213,11 @@ smgrunlink(int16 which, Relation reln)
 
 	/*
 	 * NOTE: if the relation was created in this transaction, it will now
-	 * be present in the pending-delete list twice, once with atCommit true
-	 * and once with atCommit false.  Hence, it will be physically deleted
-	 * at end of xact in either case (and the other entry will be ignored
-	 * by smgrDoPendingDeletes, so no error will occur).  We could instead
-	 * remove the existing list entry and delete the physical file
+	 * be present in the pending-delete list twice, once with atCommit
+	 * true and once with atCommit false.  Hence, it will be physically
+	 * deleted at end of xact in either case (and the other entry will be
+	 * ignored by smgrDoPendingDeletes, so no error will occur).  We could
+	 * instead remove the existing list entry and delete the physical file
 	 * immediately, but for now I'll keep the logic simple.
 	 */
 
@@ -259,7 +259,7 @@ smgropen(int16 which, Relation reln, bool failOK)
 	if (reln->rd_rel->relkind == RELKIND_VIEW)
 		return -1;
 	if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0)
-		if (! failOK)
+		if (!failOK)
 			elog(ERROR, "cannot open %s: %m", RelationGetRelationName(reln));
 
 	return fd;
@@ -475,17 +475,20 @@ smgrDoPendingDeletes(bool isCommit)
 		pendingDeletes = pending->next;
 		if (pending->atCommit == isCommit)
 		{
+
 			/*
 			 * Get rid of any leftover buffers for the rel (shouldn't be
-			 * any in the commit case, but there can be in the abort case).
+			 * any in the commit case, but there can be in the abort
+			 * case).
 			 */
 			DropRelFileNodeBuffers(pending->relnode);
+
 			/*
 			 * And delete the physical files.
 			 *
 			 * Note: we treat deletion failure as a NOTICE, not an error,
-			 * because we've already decided to commit or abort the current
-			 * xact.
+			 * because we've already decided to commit or abort the
+			 * current xact.
 			 */
 			if ((*(smgrsw[pending->which].smgr_unlink)) (pending->relnode) == SM_FAIL)
 				elog(NOTICE, "cannot unlink %u/%u: %m",
@@ -513,7 +516,7 @@ smgrcommit()
 			if ((*(smgrsw[i].smgr_commit)) () == SM_FAIL)
 				elog(FATAL, "transaction commit failed on %s: %m",
 					 DatumGetCString(DirectFunctionCall1(smgrout,
-														 Int16GetDatum(i))));
+													 Int16GetDatum(i))));
 		}
 	}
 
@@ -532,7 +535,7 @@ smgrabort()
 			if ((*(smgrsw[i].smgr_abort)) () == SM_FAIL)
 				elog(FATAL, "transaction abort failed on %s: %m",
 					 DatumGetCString(DirectFunctionCall1(smgrout,
-														 Int16GetDatum(i))));
+													 Int16GetDatum(i))));
 		}
 	}
 
@@ -551,7 +554,7 @@ smgrsync()
 			if ((*(smgrsw[i].smgr_sync)) () == SM_FAIL)
 				elog(STOP, "storage sync failed on %s: %m",
 					 DatumGetCString(DirectFunctionCall1(smgrout,
-														 Int16GetDatum(i))));
+													 Int16GetDatum(i))));
 		}
 	}
 
@@ -579,8 +582,8 @@ void
 smgr_undo(XLogRecPtr lsn, XLogRecord *record)
 {
 }
- 
+
 void
-smgr_desc(char *buf, uint8 xl_info, char* rec)
+smgr_desc(char *buf, uint8 xl_info, char *rec)
 {
 }
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c
index 6b266a244f7bd4ac8e46b7e70b4762f2c58b8220..1bd4d2339eb63fbf882d6f943fdc6e5cd4475d44 100644
--- a/src/backend/tcop/dest.c
+++ b/src/backend/tcop/dest.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.42 2001/01/24 19:43:09 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.43 2001/03/22 03:59:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -176,7 +176,7 @@ DestToFunction(CommandDest dest)
 {
 	switch (dest)
 	{
-		case Remote:
+			case Remote:
 			return printtup_create_DR(false);
 
 		case RemoteInternal:
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index 364cef07144654b6ce028008e1637913e96dd1e8..0d83c5104c4ff543c5b30e8775ffae830612bfea 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.46 2001/01/24 19:43:09 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.47 2001/03/22 03:59:47 momjian Exp $
  *
  * NOTES
  *	  This cruft is the server side of PQfn.
@@ -75,7 +75,7 @@
  * ----------------
  */
 static void
-SendFunctionResult(Datum retval, /* actual return value */
+SendFunctionResult(Datum retval,/* actual return value */
 				   bool retbyval,
 				   int retlen)	/* the length according to the catalogs */
 {
@@ -292,26 +292,29 @@ HandleFunctionRequest(void)
 	 * XXX FIXME: This protocol is misdesigned.
 	 *
 	 * We really do not want to elog() before having swallowed all of the
-	 * frontend's fastpath message; otherwise we will lose sync with the input
-	 * datastream.  What should happen is we absorb all of the input message
-	 * per protocol syntax, and *then* do error checking (including lookup of
-	 * the given function ID) and elog if appropriate.  Unfortunately, because
-	 * we cannot even read the message properly without knowing whether the
-	 * data types are pass-by-ref or pass-by-value, it's not all that easy to
-	 * do :-(.  The protocol should require the client to supply what it
-	 * thinks is the typbyval and typlen value for each arg, so that we can
-	 * read the data without having to do any lookups.  Then after we've read
-	 * the message, we should do the lookups, verify agreement of the actual
-	 * function arg types with what we received, and finally call the function.
+	 * frontend's fastpath message; otherwise we will lose sync with the
+	 * input datastream.  What should happen is we absorb all of the input
+	 * message per protocol syntax, and *then* do error checking
+	 * (including lookup of the given function ID) and elog if
+	 * appropriate.  Unfortunately, because we cannot even read the
+	 * message properly without knowing whether the data types are
+	 * pass-by-ref or pass-by-value, it's not all that easy to do :-(.
+	 * The protocol should require the client to supply what it thinks is
+	 * the typbyval and typlen value for each arg, so that we can read the
+	 * data without having to do any lookups.  Then after we've read the
+	 * message, we should do the lookups, verify agreement of the actual
+	 * function arg types with what we received, and finally call the
+	 * function.
 	 *
 	 * As things stand, not only will we lose sync for an invalid message
-	 * (such as requested function OID doesn't exist), but we may lose sync
-	 * for a perfectly valid message if we are in transaction-aborted state!
-	 * This can happen because our database lookup attempts may fail entirely
-	 * in abort state.
+	 * (such as requested function OID doesn't exist), but we may lose
+	 * sync for a perfectly valid message if we are in transaction-aborted
+	 * state! This can happen because our database lookup attempts may
+	 * fail entirely in abort state.
 	 *
 	 * Unfortunately I see no way to fix this without breaking a lot of
-	 * existing clients.  Maybe do it as part of next protocol version change.
+	 * existing clients.  Maybe do it as part of next protocol version
+	 * change.
 	 */
 
 	if (pq_getint(&tmp, 4))		/* function oid */
@@ -323,7 +326,8 @@ HandleFunctionRequest(void)
 	/*
 	 * This is where the one-back caching is done. If you want to save
 	 * more state, make this a loop around an array.  Given the relatively
-	 * short lifespan of the cache, not clear that there's any win possible.
+	 * short lifespan of the cache, not clear that there's any win
+	 * possible.
 	 */
 	fip = &last_fp;
 	if (!valid_fp_info(fid, fip))
@@ -365,9 +369,9 @@ HandleFunctionRequest(void)
 					elog(ERROR, "HandleFunctionRequest: bogus argsize %d",
 						 argsize);
 				/* I suspect this +1 isn't really needed - tgl 5/2000 */
-				p = palloc(argsize + VARHDRSZ + 1);	/* Added +1 to solve
-													 * memory leak - Peter
-													 * 98 Jan 6 */
+				p = palloc(argsize + VARHDRSZ + 1);		/* Added +1 to solve
+														 * memory leak - Peter
+														 * 98 Jan 6 */
 				VARATT_SIZEP(p) = argsize + VARHDRSZ;
 				if (pq_getbytes(VARDATA(p), argsize))
 					return EOF;
@@ -377,7 +381,7 @@ HandleFunctionRequest(void)
 				if (argsize != fip->arglen[i])
 					elog(ERROR, "HandleFunctionRequest: bogus argsize %d, should be %d",
 						 argsize, fip->arglen[i]);
-				p = palloc(argsize + 1); /* +1 in case argsize is 0 */
+				p = palloc(argsize + 1);		/* +1 in case argsize is 0 */
 				if (pq_getbytes(p, argsize))
 					return EOF;
 			}
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 2aa08a1c634f7371701029f2d08376a821734d03..745de3ce1a88da97afada1c7ccf97d155b273088 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.212 2001/03/14 18:24:34 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.213 2001/03/22 03:59:47 momjian Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -71,20 +71,20 @@
  * ----------------
  */
 
-extern int optind;
+extern int	optind;
 extern char *optarg;
 
 /*
  * for ps display
  */
-bool HostnameLookup;
-bool ShowPortNumber;
+bool		HostnameLookup;
+bool		ShowPortNumber;
 
-bool Log_connections = false;
+bool		Log_connections = false;
 
 CommandDest whereToSendOutput = Debug;
 
-static bool	dontExecute = false;
+static bool dontExecute = false;
 
 /* note: these declarations had better match tcopprot.h */
 DLLIMPORT sigjmp_buf Warn_restart;
@@ -342,9 +342,9 @@ ReadCommand(StringInfo inBuf)
  * but it is still needed for parsing of SQL function bodies.
  */
 List *
-pg_parse_and_rewrite(char *query_string,	/* string to execute */
-					 Oid *typev,			/* parameter types */
-					 int nargs)				/* number of parameters */
+pg_parse_and_rewrite(char *query_string,		/* string to execute */
+					 Oid *typev,/* parameter types */
+					 int nargs) /* number of parameters */
 {
 	List	   *raw_parsetree_list;
 	List	   *querytree_list;
@@ -363,7 +363,7 @@ pg_parse_and_rewrite(char *query_string,	/* string to execute */
 	querytree_list = NIL;
 	foreach(list_item, raw_parsetree_list)
 	{
-		Node   *parsetree = (Node *) lfirst(list_item);
+		Node	   *parsetree = (Node *) lfirst(list_item);
 
 		querytree_list = nconc(querytree_list,
 							   pg_analyze_and_rewrite(parsetree));
@@ -486,10 +486,14 @@ pg_analyze_and_rewrite(Node *parsetree)
 	}
 
 #ifdef COPY_PARSE_PLAN_TREES
-	/* Optional debugging check: pass querytree output through copyObject() */
+
+	/*
+	 * Optional debugging check: pass querytree output through
+	 * copyObject()
+	 */
 	new_list = (List *) copyObject(querytree_list);
 	/* This checks both copyObject() and the equal() routines... */
-	if (! equal(new_list, querytree_list))
+	if (!equal(new_list, querytree_list))
 		elog(NOTICE, "pg_analyze_and_rewrite: copyObject failed on parse tree");
 	else
 		querytree_list = new_list;
@@ -547,14 +551,15 @@ pg_plan_query(Query *querytree)
 #ifdef COPY_PARSE_PLAN_TREES
 	/* Optional debugging check: pass plan output through copyObject() */
 	{
-		Plan   *new_plan = (Plan *) copyObject(plan);
+		Plan	   *new_plan = (Plan *) copyObject(plan);
 
-		/* equal() currently does not have routines to compare Plan nodes,
+		/*
+		 * equal() currently does not have routines to compare Plan nodes,
 		 * so don't try to test equality here.  Perhaps fix someday?
 		 */
 #ifdef NOT_USED
 		/* This checks both copyObject() and the equal() routines... */
-		if (! equal(new_plan, plan))
+		if (!equal(new_plan, plan))
 			elog(NOTICE, "pg_plan_query: copyObject failed on plan tree");
 		else
 #endif
@@ -593,7 +598,7 @@ pg_plan_query(Query *querytree)
  *
  * The CurrentMemoryContext after starting a transaction command must be
  * appropriate for execution of individual queries (typically this will be
- * TransactionCommandContext).  Note that this routine resets that context
+ * TransactionCommandContext).	Note that this routine resets that context
  * after each individual query, so don't store anything there that
  * must outlive the call!
  *
@@ -612,9 +617,10 @@ pg_plan_query(Query *querytree)
  */
 
 void
-pg_exec_query_string(char *query_string,	/* string to execute */
-					 CommandDest dest,		/* where results should go */
-					 MemoryContext parse_context) /* context for parsetrees */
+pg_exec_query_string(char *query_string,		/* string to execute */
+					 CommandDest dest,	/* where results should go */
+					 MemoryContext parse_context)		/* context for
+														 * parsetrees */
 {
 	bool		xact_started;
 	MemoryContext oldcontext;
@@ -622,21 +628,21 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 			   *parsetree_item;
 
 	/*
-	 * Start up a transaction command.  All queries generated by the
-	 * query_string will be in this same command block, *unless* we find
-	 * a BEGIN/COMMIT/ABORT statement; we have to force a new xact command
-	 * after one of those, else bad things will happen in xact.c.
-	 * (Note that this will possibly change current memory context.)
+	 * Start up a transaction command.	All queries generated by the
+	 * query_string will be in this same command block, *unless* we find a
+	 * BEGIN/COMMIT/ABORT statement; we have to force a new xact command
+	 * after one of those, else bad things will happen in xact.c. (Note
+	 * that this will possibly change current memory context.)
 	 */
 	start_xact_command();
 	xact_started = true;
 
 	/*
-	 * parse_context *must* be different from the execution memory context,
-	 * else the context reset at the bottom of the loop will destroy the
-	 * parsetree list.  (We really ought to check that parse_context isn't a
-	 * child of CurrentMemoryContext either, but that would take more cycles
-	 * than it's likely to be worth.)
+	 * parse_context *must* be different from the execution memory
+	 * context, else the context reset at the bottom of the loop will
+	 * destroy the parsetree list.	(We really ought to check that
+	 * parse_context isn't a child of CurrentMemoryContext either, but
+	 * that would take more cycles than it's likely to be worth.)
 	 */
 	Assert(parse_context != CurrentMemoryContext);
 
@@ -646,8 +652,8 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 	oldcontext = MemoryContextSwitchTo(parse_context);
 
 	/*
-	 * Do basic parsing of the query or queries (this should be safe
-	 * even if we are in aborted transaction state!)
+	 * Do basic parsing of the query or queries (this should be safe even
+	 * if we are in aborted transaction state!)
 	 */
 	parsetree_list = pg_parse_query(query_string, NULL, 0);
 
@@ -661,10 +667,10 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 	 */
 	foreach(parsetree_item, parsetree_list)
 	{
-		Node   *parsetree = (Node *) lfirst(parsetree_item);
-		bool	isTransactionStmt;
-		List   *querytree_list,
-			   *querytree_item;
+		Node	   *parsetree = (Node *) lfirst(parsetree_item);
+		bool		isTransactionStmt;
+		List	   *querytree_list,
+				   *querytree_item;
 
 		/* Transaction control statements need some special handling */
 		isTransactionStmt = IsA(parsetree, TransactionStmt);
@@ -673,13 +679,13 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 		 * If we are in an aborted transaction, ignore all commands except
 		 * COMMIT/ABORT.  It is important that this test occur before we
 		 * try to do parse analysis, rewrite, or planning, since all those
-		 * phases try to do database accesses, which may fail in abort state.
-		 * (It might be safe to allow some additional utility commands in
-		 * this state, but not many...)
+		 * phases try to do database accesses, which may fail in abort
+		 * state. (It might be safe to allow some additional utility
+		 * commands in this state, but not many...)
 		 */
 		if (IsAbortedTransactionBlockState())
 		{
-			bool	allowit = false;
+			bool		allowit = false;
 
 			if (isTransactionStmt)
 			{
@@ -696,7 +702,7 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 				}
 			}
 
-			if (! allowit)
+			if (!allowit)
 			{
 				/* ----------------
 				 *	 the EndCommand() stuff is to tell the frontend
@@ -720,7 +726,7 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 		}
 
 		/* Make sure we are in a transaction command */
-		if (! xact_started)
+		if (!xact_started)
 		{
 			start_xact_command();
 			xact_started = true;
@@ -732,8 +738,8 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 		/*
 		 * OK to analyze and rewrite this query.
 		 *
-		 * Switch to appropriate context for constructing querytrees
-		 * (again, these must outlive the execution context).
+		 * Switch to appropriate context for constructing querytrees (again,
+		 * these must outlive the execution context).
 		 */
 		oldcontext = MemoryContextSwitchTo(parse_context);
 
@@ -753,13 +759,16 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 			Query	   *querytree = (Query *) lfirst(querytree_item);
 
 			/* Make sure we are in a transaction command */
-			if (! xact_started)
+			if (!xact_started)
 			{
 				start_xact_command();
 				xact_started = true;
 			}
 
-			/* If we got a cancel signal in analysis or prior command, quit */
+			/*
+			 * If we got a cancel signal in analysis or prior command,
+			 * quit
+			 */
 			CHECK_FOR_INTERRUPTS();
 
 			if (querytree->commandType == CMD_UTILITY)
@@ -819,27 +828,27 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 			/*
 			 * In a query block, we want to increment the command counter
 			 * between queries so that the effects of early queries are
-			 * visible to subsequent ones.  In particular we'd better
-			 * do so before checking constraints.
+			 * visible to subsequent ones.	In particular we'd better do
+			 * so before checking constraints.
 			 */
 			if (!isTransactionStmt)
 				CommandCounterIncrement();
 
 			/*
-			 * Clear the execution context to recover temporary
-			 * memory used by the query.  NOTE: if query string contains
+			 * Clear the execution context to recover temporary memory
+			 * used by the query.  NOTE: if query string contains
 			 * BEGIN/COMMIT transaction commands, execution context may
-			 * now be different from what we were originally passed;
-			 * so be careful to clear current context not "oldcontext".
+			 * now be different from what we were originally passed; so be
+			 * careful to clear current context not "oldcontext".
 			 */
 			Assert(parse_context != CurrentMemoryContext);
 
 			MemoryContextResetAndDeleteChildren(CurrentMemoryContext);
 
 			/*
-			 * If this was a transaction control statement, commit it
-			 * and arrange to start a new xact command for the next
-			 * command (if any).
+			 * If this was a transaction control statement, commit it and
+			 * arrange to start a new xact command for the next command
+			 * (if any).
 			 */
 			if (isTransactionStmt)
 			{
@@ -847,8 +856,9 @@ pg_exec_query_string(char *query_string,	/* string to execute */
 				xact_started = false;
 			}
 
-		} /* end loop over queries generated from a parsetree */
-	} /* end loop over parsetrees */
+		}						/* end loop over queries generated from a
+								 * parsetree */
+	}							/* end loop over parsetrees */
 
 	/*
 	 * Close down transaction statement, if one is open.
@@ -915,10 +925,10 @@ quickdie(SIGNAL_ARGS)
 	 * corrupted, so we don't want to try to clean up our transaction.
 	 * Just nail the windows shut and get out of town.
 	 *
-	 * Note we do exit(1) not exit(0).  This is to force the postmaster
-	 * into a system reset cycle if some idiot DBA sends a manual SIGQUIT
-	 * to a random backend.  This is necessary precisely because we don't
-	 * clean up our shared memory state.
+	 * Note we do exit(1) not exit(0).	This is to force the postmaster into
+	 * a system reset cycle if some idiot DBA sends a manual SIGQUIT to a
+	 * random backend.	This is necessary precisely because we don't clean
+	 * up our shared memory state.
 	 */
 
 	exit(1);
@@ -934,13 +944,14 @@ die(SIGNAL_ARGS)
 	int			save_errno = errno;
 
 	/* Don't joggle the elbow of proc_exit */
-	if (! proc_exit_inprogress)
+	if (!proc_exit_inprogress)
 	{
 		InterruptPending = true;
 		ProcDiePending = true;
+
 		/*
-		 * If it's safe to interrupt, and we're waiting for input or a lock,
-		 * service the interrupt immediately
+		 * If it's safe to interrupt, and we're waiting for input or a
+		 * lock, service the interrupt immediately
 		 */
 		if (ImmediateInterruptOK && InterruptHoldoffCount == 0 &&
 			CritSectionCount == 0)
@@ -968,15 +979,19 @@ QueryCancelHandler(SIGNAL_ARGS)
 {
 	int			save_errno = errno;
 
-	/* Don't joggle the elbow of proc_exit, nor an already-in-progress abort */
+	/*
+	 * Don't joggle the elbow of proc_exit, nor an already-in-progress
+	 * abort
+	 */
 	if (!proc_exit_inprogress && !InError)
 	{
 		InterruptPending = true;
 		QueryCancelPending = true;
+
 		/*
 		 * If it's safe to interrupt, and we're waiting for a lock,
-		 * service the interrupt immediately.  No point in interrupting
-		 * if we're waiting for input, however.
+		 * service the interrupt immediately.  No point in interrupting if
+		 * we're waiting for input, however.
 		 */
 		if (ImmediateInterruptOK && InterruptHoldoffCount == 0 &&
 			CritSectionCount == 0)
@@ -1032,14 +1047,14 @@ ProcessInterrupts(void)
 	if (ProcDiePending)
 	{
 		ProcDiePending = false;
-		QueryCancelPending = false;	/* ProcDie trumps QueryCancel */
-		ImmediateInterruptOK = false; /* not idle anymore */
+		QueryCancelPending = false;		/* ProcDie trumps QueryCancel */
+		ImmediateInterruptOK = false;	/* not idle anymore */
 		elog(FATAL, "This connection has been terminated by an administrator");
 	}
 	if (QueryCancelPending)
 	{
 		QueryCancelPending = false;
-		ImmediateInterruptOK = false; /* not idle anymore */
+		ImmediateInterruptOK = false;	/* not idle anymore */
 		elog(ERROR, "Query was cancelled.");
 	}
 	/* If we get here, do nothing (probably, QueryCancelPending was reset) */
@@ -1065,7 +1080,7 @@ usage(char *progname)
 	printf("  -F              turn fsync off\n");
 	printf("  -N              do not use newline as interactive query delimiter\n");
 	printf("  -o FILENAME     send stdout and stderr to given file\n");
-    printf("  -P              disable system indexes\n");
+	printf("  -P              disable system indexes\n");
 	printf("  -s              show statistics after each query\n");
 	printf("  -S SORT-MEM     set amount of memory for sorts (in kbytes)\n");
 	printf("Developer options:\n");
@@ -1082,7 +1097,7 @@ usage(char *progname)
 
 /* ----------------------------------------------------------------
  * PostgresMain
- *     postgres main loop -- all backends, interactive or otherwise start here
+ *	   postgres main loop -- all backends, interactive or otherwise start here
  *
  * argc/argv are the command line arguments to be used.  When being forked
  * by the postmaster, these are not the original argv array of the process.
@@ -1092,11 +1107,11 @@ usage(char *progname)
  * ----------------------------------------------------------------
  */
 int
-PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const char * username)
+PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const char *username)
 {
 	int			flag;
 
-	const char	   *DBName = NULL;
+	const char *DBName = NULL;
 	bool		secure = true;
 	int			errs = 0;
 
@@ -1106,25 +1121,25 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 	char	   *remote_host;
 	unsigned short remote_port;
 
-	char       *potential_DataDir = NULL;
+	char	   *potential_DataDir = NULL;
 
 	/*
-	 * Catch standard options before doing much else.  This even works
-	 * on systems without getopt_long.
+	 * Catch standard options before doing much else.  This even works on
+	 * systems without getopt_long.
 	 */
 	if (!IsUnderPostmaster && argc > 1)
 	{
-		if (strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0)
+		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
 		{
 			usage(argv[0]);
 			exit(0);
 		}
-		if (strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0)
+		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
 		{
 			puts("postgres (PostgreSQL) " PG_VERSION);
 			exit(0);
 		}
-	}		
+	}
 
 	/*
 	 * Fire up essential subsystems: error and memory management
@@ -1174,7 +1189,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 
 	optind = 1;					/* reset after postmaster's usage */
 
-	while ((flag = getopt(argc, argv,  "A:B:c:CD:d:Eef:FiLNOPo:p:S:st:v:W:x:-:")) != EOF)
+	while ((flag = getopt(argc, argv, "A:B:c:CD:d:Eef:FiLNOPo:p:S:st:v:W:x:-:")) != EOF)
 		switch (flag)
 		{
 			case 'A':
@@ -1210,7 +1225,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 			case 'd':			/* debug level */
 				DebugLvl = atoi(optarg);
 				if (DebugLvl >= 1);
-					Log_connections = true;
+				Log_connections = true;
 				if (DebugLvl >= 2)
 					Debug_print_query = true;
 				if (DebugLvl >= 3)
@@ -1438,26 +1453,27 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 
 			case 'c':
 			case '-':
-			{
-				char *name, *value;
-
-				ParseLongOption(optarg, &name, &value);
-				if (!value)
 				{
-					if (flag == '-')
-						elog(ERROR, "--%s requires argument", optarg);
-					else
-						elog(ERROR, "-c %s requires argument", optarg);
-				}
+					char	   *name,
+							   *value;
 
-				/* all options are allowed if not under postmaster */
-				SetConfigOption(name, value, 
-					(IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER);
-				free(name);
-				if (value)
-					free(value);
-				break;
-			}
+					ParseLongOption(optarg, &name, &value);
+					if (!value)
+					{
+						if (flag == '-')
+							elog(ERROR, "--%s requires argument", optarg);
+						else
+							elog(ERROR, "-c %s requires argument", optarg);
+					}
+
+					/* all options are allowed if not under postmaster */
+					SetConfigOption(name, value,
+					 (IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER);
+					free(name);
+					if (value)
+						free(value);
+					break;
+				}
 
 			default:
 				errs++;
@@ -1482,9 +1498,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		if (!potential_DataDir)
 		{
 			fprintf(stderr, "%s does not know where to find the database system "
-					"data.  You must specify the directory that contains the "
-					"database system either by specifying the -D invocation "
-					"option or by setting the PGDATA environment variable.\n\n",
+			   "data.  You must specify the directory that contains the "
+				"database system either by specifying the -D invocation "
+			 "option or by setting the PGDATA environment variable.\n\n",
 					argv[0]);
 			proc_exit(1);
 		}
@@ -1496,20 +1512,22 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 	 * Set up signal handlers and masks.
 	 *
 	 * Note that postmaster blocked all signals before forking child process,
-	 * so there is no race condition whereby we might receive a signal before
-	 * we have set up the handler.
+	 * so there is no race condition whereby we might receive a signal
+	 * before we have set up the handler.
 	 *
 	 * Also note: it's best not to use any signals that are SIG_IGNored in
-	 * the postmaster.  If such a signal arrives before we are able to change
-	 * the handler to non-SIG_IGN, it'll get dropped.  If necessary, make a
-	 * dummy handler in the postmaster to reserve the signal.
+	 * the postmaster.	If such a signal arrives before we are able to
+	 * change the handler to non-SIG_IGN, it'll get dropped.  If
+	 * necessary, make a dummy handler in the postmaster to reserve the
+	 * signal.
 	 */
 
 	pqsignal(SIGHUP, SigHupHandler);	/* set flag to read config file */
-	pqsignal(SIGINT, QueryCancelHandler); /* cancel current query */
+	pqsignal(SIGINT, QueryCancelHandler);		/* cancel current query */
 	pqsignal(SIGTERM, die);		/* cancel current query and exit */
-	pqsignal(SIGQUIT, quickdie); /* hard crash time */
-	pqsignal(SIGALRM, HandleDeadLock); /* check for deadlock after timeout */
+	pqsignal(SIGQUIT, quickdie);/* hard crash time */
+	pqsignal(SIGALRM, HandleDeadLock);	/* check for deadlock after
+										 * timeout */
 
 	/*
 	 * Ignore failure to write to frontend. Note: if frontend closes
@@ -1518,13 +1536,15 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 	 * midst of output during who-knows-what operation...
 	 */
 	pqsignal(SIGPIPE, SIG_IGN);
-	pqsignal(SIGUSR1, SIG_IGN);	/* this signal available for use */
+	pqsignal(SIGUSR1, SIG_IGN); /* this signal available for use */
 	pqsignal(SIGUSR2, Async_NotifyHandler);		/* flush also sinval cache */
 	pqsignal(SIGFPE, FloatExceptionHandler);
-	pqsignal(SIGCHLD, SIG_IGN);	/* ignored (may get this in system() calls) */
+	pqsignal(SIGCHLD, SIG_IGN); /* ignored (may get this in system()
+								 * calls) */
 
 	/*
-	 * Reset some signals that are accepted by postmaster but not by backend
+	 * Reset some signals that are accepted by postmaster but not by
+	 * backend
 	 */
 	pqsignal(SIGTTIN, SIG_DFL);
 	pqsignal(SIGTTOU, SIG_DFL);
@@ -1549,7 +1569,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		if (errs || argc != optind || DBName == NULL)
 		{
 			fprintf(stderr, "%s: invalid command line arguments\nTry -? for help.\n", argv[0]);
-			proc_exit(0);		/* not 1, that causes system-wide restart... */
+			proc_exit(0);		/* not 1, that causes system-wide
+								 * restart... */
 		}
 		pq_init();				/* initialize libpq at backend startup */
 		whereToSendOutput = Remote;
@@ -1576,7 +1597,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		/*
 		 * Create lockfile for data directory.
 		 */
-		if (! CreateDataDirLockFile(DataDir, false))
+		if (!CreateDataDirLockFile(DataDir, false))
 			proc_exit(1);
 
 		XLOGPathInit();
@@ -1613,7 +1634,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		if (MyProcPort->raddr.sa.sa_family == AF_INET)
 		{
 			struct hostent *host_ent;
-			char * host_addr;
+			char	   *host_addr;
 
 			remote_port = ntohs(MyProcPort->raddr.in.sin_port);
 			host_addr = inet_ntoa(MyProcPort->raddr.in.sin_addr);
@@ -1634,23 +1655,25 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 
 			if (ShowPortNumber)
 			{
-				char * str = palloc(strlen(remote_host) + 7);
+				char	   *str = palloc(strlen(remote_host) + 7);
+
 				sprintf(str, "%s:%hu", remote_host, remote_port);
 				pfree(remote_host);
 				remote_host = str;
 			}
 		}
-		else /* not AF_INET */
+		else
+/* not AF_INET */
 			remote_host = "[local]";
 
 
 		/*
 		 * Set process parameters for ps
 		 *
-		 * WARNING: On some platforms the environment will be moved
-		 * around to make room for the ps display string. So any
-		 * references to optarg or getenv() from above will be invalid
-		 * after this call. Better use strdup or something similar.
+		 * WARNING: On some platforms the environment will be moved around to
+		 * make room for the ps display string. So any references to
+		 * optarg or getenv() from above will be invalid after this call.
+		 * Better use strdup or something similar.
 		 */
 		init_ps_display(real_argc, real_argv, username, DBName, remote_host);
 		set_ps_display("startup");
@@ -1692,16 +1715,16 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 	if (!IsUnderPostmaster)
 	{
 		puts("\nPOSTGRES backend interactive interface ");
-		puts("$Revision: 1.212 $ $Date: 2001/03/14 18:24:34 $\n");
+		puts("$Revision: 1.213 $ $Date: 2001/03/22 03:59:47 $\n");
 	}
 
 	/*
 	 * Create the memory context we will use in the main loop.
 	 *
-	 * QueryContext is reset once per iteration of the main loop,
-	 * ie, upon completion of processing of each supplied query string.
-	 * It can therefore be used for any data that should live just as
-	 * long as the query string --- parse trees, for example.
+	 * QueryContext is reset once per iteration of the main loop, ie, upon
+	 * completion of processing of each supplied query string. It can
+	 * therefore be used for any data that should live just as long as the
+	 * query string --- parse trees, for example.
 	 */
 	QueryContext = AllocSetContextCreate(TopMemoryContext,
 										 "QueryContext",
@@ -1718,10 +1741,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 
 	if (sigsetjmp(Warn_restart, 1) != 0)
 	{
+
 		/*
 		 * NOTE: if you are tempted to add more code in this if-block,
-		 * consider the probability that it should be in AbortTransaction()
-		 * instead.
+		 * consider the probability that it should be in
+		 * AbortTransaction() instead.
 		 *
 		 * Make sure we're not interrupted while cleaning up.  Also forget
 		 * any pending QueryCancel request, since we're aborting anyway.
@@ -1776,9 +1800,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 
 	for (;;)
 	{
+
 		/*
-		 * Release storage left over from prior query cycle, and
-		 * create a new query input buffer in the cleared QueryContext.
+		 * Release storage left over from prior query cycle, and create a
+		 * new query input buffer in the cleared QueryContext.
 		 */
 		MemoryContextSwitchTo(QueryContext);
 		MemoryContextResetAndDeleteChildren(QueryContext);
@@ -1804,7 +1829,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		 *	 Then set up other stuff needed before blocking for input.
 		 * ----------------
 		 */
-		QueryCancelPending = false;	/* forget any earlier CANCEL signal */
+		QueryCancelPending = false;		/* forget any earlier CANCEL
+										 * signal */
 
 		EnableNotifyInterrupt();
 
@@ -1825,7 +1851,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		 * ----------------
 		 */
 		ImmediateInterruptOK = false;
-		QueryCancelPending = false;	/* forget any CANCEL signal */
+		QueryCancelPending = false;		/* forget any CANCEL signal */
 
 		DisableNotifyInterrupt();
 
@@ -1912,10 +1938,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 				 */
 			case 'X':
 			case EOF:
+
 				/*
 				 * NOTE: if you are tempted to add more code here, DON'T!
-				 * Whatever you had in mind to do should be set up as
-				 * an on_proc_exit or on_shmem_exit callback, instead.
+				 * Whatever you had in mind to do should be set up as an
+				 * on_proc_exit or on_shmem_exit callback, instead.
 				 * Otherwise it will fail to be called during other
 				 * backend-shutdown scenarios.
 				 */
@@ -1926,11 +1953,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 		}
 
 #ifdef MEMORY_CONTEXT_CHECKING
+
 		/*
 		 * Check all memory after each backend loop.  This is a rather
 		 * weird place to do it, perhaps.
 		 */
-		MemoryContextCheck(TopMemoryContext);	
+		MemoryContextCheck(TopMemoryContext);
 #endif
 	}							/* end of input-reading loop */
 
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c
index b36b9f6510c766ee63e8a8b5a8ca946fc5c91477..2dfc5a9ff1f1a96cad78e9d208c94f967020eb65 100644
--- a/src/backend/tcop/pquery.c
+++ b/src/backend/tcop/pquery.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.42 2001/02/27 22:07:34 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.43 2001/03/22 03:59:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -144,7 +144,11 @@ PreparePortal(char *portalName)
 	portal = GetPortalByName(portalName);
 	if (PortalIsValid(portal))
 	{
-		/* XXX Should we raise an error rather than closing the old portal? */
+
+		/*
+		 * XXX Should we raise an error rather than closing the old
+		 * portal?
+		 */
 		elog(NOTICE, "Closing pre-existing portal \"%s\"",
 			 portalName);
 		PortalDrop(&portal);
@@ -226,6 +230,7 @@ ProcessQuery(Query *parsetree,
 		oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
 		parsetree = copyObject(parsetree);
 		plan = copyObject(plan);
+
 		/*
 		 * We stay in portal's memory context for now, so that query desc,
 		 * EState, and plan startup info are also allocated in the portal
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 65b6baf535e12112c1b650ac032606b1dbaa9fc7..370d2d3bac712205a79da0efbc35439ceffec308 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.107 2001/01/27 10:19:52 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.108 2001/03/22 03:59:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,24 +52,25 @@
  * Error-checking support for DROP commands
  */
 
-struct kindstrings {
-	char kind;
-	char *indef_article;
-	char *name;
-	char *command;
+struct kindstrings
+{
+	char		kind;
+	char	   *indef_article;
+	char	   *name;
+	char	   *command;
 };
 
 static struct kindstrings kindstringarray[] = {
-	{ RELKIND_RELATION, "a", "table", "TABLE" },
-	{ RELKIND_SEQUENCE, "a", "sequence", "SEQUENCE" },
-	{ RELKIND_VIEW, "a", "view", "VIEW" },
-	{ RELKIND_INDEX, "an", "index", "INDEX" },
-	{ '\0', "a", "???", "???" }
+	{RELKIND_RELATION, "a", "table", "TABLE"},
+	{RELKIND_SEQUENCE, "a", "sequence", "SEQUENCE"},
+	{RELKIND_VIEW, "a", "view", "VIEW"},
+	{RELKIND_INDEX, "an", "index", "INDEX"},
+	{'\0', "a", "???", "???"}
 };
 
 
 static void
-DropErrorMsg(char* relname, char wrongkind, char rightkind)
+DropErrorMsg(char *relname, char wrongkind, char rightkind)
 {
 	struct kindstrings *rentry;
 	struct kindstrings *wentry;
@@ -218,12 +219,12 @@ ProcessUtility(Node *parsetree,
 			DefineRelation((CreateStmt *) parsetree, RELKIND_RELATION);
 
 			/*
-			 * Let AlterTableCreateToastTable decide if this
-			 * one needs a secondary relation too.
+			 * Let AlterTableCreateToastTable decide if this one needs a
+			 * secondary relation too.
 			 */
 			CommandCounterIncrement();
-			AlterTableCreateToastTable(((CreateStmt *)parsetree)->relname,
-										true);
+			AlterTableCreateToastTable(((CreateStmt *) parsetree)->relname,
+									   true);
 			break;
 
 		case T_DropStmt:
@@ -238,7 +239,7 @@ ProcessUtility(Node *parsetree,
 				{
 					relname = strVal(lfirst(arg));
 
-					switch(stmt->removeType)
+					switch (stmt->removeType)
 					{
 						case DROP_TABLE:
 							CheckDropPermissions(relname, RELKIND_RELATION);
@@ -268,8 +269,8 @@ ProcessUtility(Node *parsetree,
 								relationName = RewriteGetRuleEventRel(rulename);
 								aclcheck_result = pg_aclcheck(relationName, GetUserId(), ACL_RU);
 								if (aclcheck_result != ACLCHECK_OK)
-									elog(ERROR, "%s: %s", relationName, 
-											aclcheck_error_strings[aclcheck_result]);
+									elog(ERROR, "%s: %s", relationName,
+										 aclcheck_error_strings[aclcheck_result]);
 								RemoveRewriteRule(rulename);
 							}
 							break;
@@ -281,9 +282,9 @@ ProcessUtility(Node *parsetree,
 					}
 
 					/*
-					 * Make sure subsequent loop iterations will see results
-					 * of this one; needed if removing multiple rules for
-					 * same table, for example.
+					 * Make sure subsequent loop iterations will see
+					 * results of this one; needed if removing multiple
+					 * rules for same table, for example.
 					 */
 					CommandCounterIncrement();
 				}
@@ -402,7 +403,7 @@ ProcessUtility(Node *parsetree,
 					renameatt(relname,	/* relname */
 							  stmt->column,		/* old att name */
 							  stmt->newname,	/* new att name */
-							  interpretInhOption(stmt->inhOpt)); /* recursive? */
+							  interpretInhOption(stmt->inhOpt));		/* recursive? */
 				}
 			}
 			break;
@@ -423,29 +424,29 @@ ProcessUtility(Node *parsetree,
 				{
 					case 'A':	/* ADD COLUMN */
 						AlterTableAddColumn(stmt->relname,
-											interpretInhOption(stmt->inhOpt),
+										interpretInhOption(stmt->inhOpt),
 											(ColumnDef *) stmt->def);
 						break;
 					case 'T':	/* ALTER COLUMN */
 						AlterTableAlterColumn(stmt->relname,
-											  interpretInhOption(stmt->inhOpt),
+										interpretInhOption(stmt->inhOpt),
 											  stmt->name,
 											  stmt->def);
 						break;
 					case 'D':	/* ALTER DROP */
 						AlterTableDropColumn(stmt->relname,
-											 interpretInhOption(stmt->inhOpt),
+										interpretInhOption(stmt->inhOpt),
 											 stmt->name,
 											 stmt->behavior);
 						break;
 					case 'C':	/* ADD CONSTRAINT */
 						AlterTableAddConstraint(stmt->relname,
-												interpretInhOption(stmt->inhOpt),
+										interpretInhOption(stmt->inhOpt),
 												stmt->def);
 						break;
 					case 'X':	/* DROP CONSTRAINT */
 						AlterTableDropConstraint(stmt->relname,
-												 interpretInhOption(stmt->inhOpt),
+										interpretInhOption(stmt->inhOpt),
 												 stmt->name,
 												 stmt->behavior);
 						break;
@@ -872,10 +873,10 @@ ProcessUtility(Node *parsetree,
 						{
 							if (!allowSystemTableMods && IsSystemRelationName(relname))
 								elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -O -P options",
-								 relname);
+									 relname);
 							if (!IsIgnoringSystemIndexes())
 								elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -P -O options",
-								 relname);
+									 relname);
 						}
 						if (!pg_ownercheck(GetUserId(), relname, RELNAME))
 							elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
@@ -888,12 +889,12 @@ ProcessUtility(Node *parsetree,
 #ifdef	OLD_FILE_NAMING
 							if (!allowSystemTableMods && IsSystemRelationName(relname))
 								elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -O -P options",
-								 relname);
+									 relname);
 							if (!IsIgnoringSystemIndexes())
 								elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -P -O options",
 
-								 relname);
-#endif /* OLD_FILE_NAMING */
+									 relname);
+#endif	 /* OLD_FILE_NAMING */
 						}
 						if (!pg_ownercheck(GetUserId(), relname, RELNAME))
 							elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
diff --git a/src/backend/tioga/tgRecipe.c b/src/backend/tioga/tgRecipe.c
index d9100c5f10a0a3c1fea19335d8fe50b46b417a70..0a2dca7dd8afa93812a3438ec1978d1a3d45ee77 100644
--- a/src/backend/tioga/tgRecipe.c
+++ b/src/backend/tioga/tgRecipe.c
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.18 2001/01/24 19:43:12 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.19 2001/03/22 03:59:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,9 +44,9 @@ static Arr_TgString *TextArray2ArrTgString(char *str);
 	  "select * from Edge e where e.belongsTo = '%s'"
 
 /* static functions only used here */
-static void fillTgElement(TgElement * elem, PortalBuffer *pbuf, int tupno);
-static void fillTgNode(TgRecipe * r, TgNode * node, PortalBuffer *pbuf, int tupno);
-static TgRecipe *fillTgRecipe(PortalBuffer *pbuf, int tupno);
+static void fillTgElement(TgElement * elem, PortalBuffer * pbuf, int tupno);
+static void fillTgNode(TgRecipe * r, TgNode * node, PortalBuffer * pbuf, int tupno);
+static TgRecipe *fillTgRecipe(PortalBuffer * pbuf, int tupno);
 static void lookupEdges(TgRecipe * r, char *name);
 static void fillAllNodes(TgRecipe * r, char *name);
 static void fillAllElements(TgRecipe * r, char *name);
@@ -173,7 +173,7 @@ fillTgNode
 -------------------------------------- */
 
 void
-fillTgNode(TgRecipe * r, TgNode * node, PortalBuffer *pbuf, int tupno)
+fillTgNode(TgRecipe * r, TgNode * node, PortalBuffer * pbuf, int tupno)
 {
 	char	   *nodeType;
 	char	   *nodeElem;
@@ -258,7 +258,7 @@ fillTgElement
   ------------------------------------ */
 
 void
-fillTgElement(TgElement * elem, PortalBuffer *pbuf, int tupno)
+fillTgElement(TgElement * elem, PortalBuffer * pbuf, int tupno)
 {
 	char	   *srcLang,
 			   *elemType;
@@ -618,7 +618,7 @@ fillTgRecipe
 	and converts it to a C TgRecipe strcture
   ------------------------------------ */
 TgRecipe   *
-fillTgRecipe(PortalBuffer *pbuf, int tupno)
+fillTgRecipe(PortalBuffer * pbuf, int tupno)
 {
 	TgRecipe   *r;
 	int			i,
diff --git a/src/backend/tioga/tgRecipe.h b/src/backend/tioga/tgRecipe.h
index c52265d6051bdc8922f62ecb1fbf4d58d851f2bf..5b190f1725445a73cd2b0bff3e61e9ad1f4e8a90 100644
--- a/src/backend/tioga/tgRecipe.h
+++ b/src/backend/tioga/tgRecipe.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tgRecipe.h,v 1.15 2001/01/24 19:43:12 momjian Exp $
+ * $Id: tgRecipe.h,v 1.16 2001/03/22 03:59:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,6 +40,7 @@ typedef struct
 								 *
 								 *
 								 *
+								 *
 								 * geo-decls.h */
 
 #endif	 /* TIOGA_FRONTEND */
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 5a3b99f64a4f56bbe9d2396a453d3426ecb2d48d..10e2f13bc326996d4d1e1b60ec3ca27e1df1d377 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.57 2001/01/24 19:43:12 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.58 2001/03/22 03:59:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -262,7 +262,7 @@ aclitemin(PG_FUNCTION_ARGS)
 Datum
 aclitemout(PG_FUNCTION_ARGS)
 {
-	AclItem	   *aip = PG_GETARG_ACLITEM_P(0);
+	AclItem    *aip = PG_GETARG_ACLITEM_P(0);
 	char	   *p;
 	char	   *out;
 	HeapTuple	htup;
@@ -281,7 +281,7 @@ aclitemout(PG_FUNCTION_ARGS)
 			if (HeapTupleIsValid(htup))
 			{
 				strncat(p,
-						NameStr(((Form_pg_shadow) GETSTRUCT(htup))->usename),
+					NameStr(((Form_pg_shadow) GETSTRUCT(htup))->usename),
 						NAMEDATALEN);
 				ReleaseSysCache(htup);
 			}
@@ -291,7 +291,7 @@ aclitemout(PG_FUNCTION_ARGS)
 				char	   *tmp;
 
 				tmp = DatumGetCString(DirectFunctionCall1(int4out,
-									  Int32GetDatum((int32) aip->ai_id)));
+									 Int32GetDatum((int32) aip->ai_id)));
 				strcat(p, tmp);
 				pfree(tmp);
 			}
@@ -307,7 +307,7 @@ aclitemout(PG_FUNCTION_ARGS)
 				char	   *tmp;
 
 				tmp = DatumGetCString(DirectFunctionCall1(int4out,
-									  Int32GetDatum((int32) aip->ai_id)));
+									 Int32GetDatum((int32) aip->ai_id)));
 				strcat(p, tmp);
 				pfree(tmp);
 			}
@@ -473,9 +473,9 @@ aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg)
 	}
 
 	/*
-	 * if the adjusted entry has no permissions, delete it from the
-	 * list.  For example, this helps in removing entries for users who no
-	 * longer exist.  EXCEPTION: never remove the world entry.
+	 * if the adjusted entry has no permissions, delete it from the list.
+	 * For example, this helps in removing entries for users who no longer
+	 * exist.  EXCEPTION: never remove the world entry.
 	 */
 	if (new_aip[dst].ai_mode == 0 && dst > 0)
 	{
@@ -502,7 +502,7 @@ Datum
 aclinsert(PG_FUNCTION_ARGS)
 {
 	Acl		   *old_acl = PG_GETARG_ACL_P(0);
-	AclItem	   *mod_aip = PG_GETARG_ACLITEM_P(1);
+	AclItem    *mod_aip = PG_GETARG_ACLITEM_P(1);
 
 	PG_RETURN_ACL_P(aclinsert3(old_acl, mod_aip, ACL_MODECHG_EQL));
 }
@@ -511,7 +511,7 @@ Datum
 aclremove(PG_FUNCTION_ARGS)
 {
 	Acl		   *old_acl = PG_GETARG_ACL_P(0);
-	AclItem	   *mod_aip = PG_GETARG_ACLITEM_P(1);
+	AclItem    *mod_aip = PG_GETARG_ACLITEM_P(1);
 	Acl		   *new_acl;
 	AclItem    *old_aip,
 			   *new_aip;
@@ -575,7 +575,7 @@ Datum
 aclcontains(PG_FUNCTION_ARGS)
 {
 	Acl		   *acl = PG_GETARG_ACL_P(0);
-	AclItem	   *aip = PG_GETARG_ACLITEM_P(1);
+	AclItem    *aip = PG_GETARG_ACLITEM_P(1);
 	AclItem    *aidat;
 	int			i,
 				num;
@@ -599,7 +599,7 @@ aclcontains(PG_FUNCTION_ARGS)
 void
 ExecuteChangeACLStmt(ChangeACLStmt *stmt)
 {
-	AclItem		aclitem;
+	AclItem aclitem;
 	unsigned	modechg;
 	List	   *i;
 
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index d76fe6d64feffd1c8b30972ba3264b3554a3130b..84c674071c1c8170e1fa89da23a9e5e91637e881 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.69 2001/01/24 19:43:12 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.70 2001/03/22 03:59:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,29 +60,29 @@
 
 static int	ArrayCount(char *str, int *dim, int typdelim);
 static Datum *ReadArrayStr(char *arrayStr, int nitems, int ndim, int *dim,
-			  FmgrInfo *inputproc, Oid typelem, int32 typmod,
-			  char typdelim, int typlen, bool typbyval,
-			  char typalign, int *nbytes);
+			 FmgrInfo *inputproc, Oid typelem, int32 typmod,
+			 char typdelim, int typlen, bool typbyval,
+			 char typalign, int *nbytes);
 static void CopyArrayEls(char *p, Datum *values, int nitems,
-						 bool typbyval, int typlen, char typalign,
-						 bool freedata);
+			 bool typbyval, int typlen, char typalign,
+			 bool freedata);
 static void system_cache_lookup(Oid element_type, bool input, int *typlen,
-								bool *typbyval, char *typdelim, Oid *typelem,
-								Oid *proc, char *typalign);
+					bool *typbyval, char *typdelim, Oid *typelem,
+					Oid *proc, char *typalign);
 static Datum ArrayCast(char *value, bool byval, int len);
 static int	ArrayCastAndSet(Datum src, bool typbyval, int typlen, char *dest);
 static int	array_nelems_size(char *ptr, int eltsize, int nitems);
 static char *array_seek(char *ptr, int eltsize, int nitems);
 static int	array_copy(char *destptr, int eltsize, int nitems, char *srcptr);
-static int	array_slice_size(int ndim, int *dim, int *lb, char *arraydataptr,
-							 int eltsize, int *st, int *endp);
+static int array_slice_size(int ndim, int *dim, int *lb, char *arraydataptr,
+				 int eltsize, int *st, int *endp);
 static void array_extract_slice(int ndim, int *dim, int *lb,
-								char *arraydataptr, int eltsize,
-								int *st, int *endp, char *destPtr);
+					char *arraydataptr, int eltsize,
+					int *st, int *endp, char *destPtr);
 static void array_insert_slice(int ndim, int *dim, int *lb,
-							   char *origPtr, int origdatasize,
-							   char *destPtr, int eltsize,
-							   int *st, int *endp, char *srcPtr);
+				   char *origPtr, int origdatasize,
+				   char *destPtr, int eltsize,
+				   int *st, int *endp, char *srcPtr);
 
 
 /*---------------------------------------------------------------------
@@ -96,9 +96,11 @@ static void array_insert_slice(int ndim, int *dim, int *lb,
 Datum
 array_in(PG_FUNCTION_ARGS)
 {
-	char	   *string = PG_GETARG_CSTRING(0); /* external form */
-	Oid			element_type = PG_GETARG_OID(1); /* type of an array element */
-	int32		typmod = PG_GETARG_INT32(2); /* typmod for array elements */
+	char	   *string = PG_GETARG_CSTRING(0);	/* external form */
+	Oid			element_type = PG_GETARG_OID(1);		/* type of an array
+														 * element */
+	int32		typmod = PG_GETARG_INT32(2);	/* typmod for array
+												 * elements */
 	int			typlen;
 	bool		typbyval;
 	char		typdelim;
@@ -132,8 +134,8 @@ array_in(PG_FUNCTION_ARGS)
 	 * Otherwise, we require the input to be in curly-brace style, and we
 	 * prescan the input to determine dimensions.
 	 *
-	 * Dimension info takes the form of one or more [n] or [m:n] items.
-	 * The outer loop iterates once per dimension item.
+	 * Dimension info takes the form of one or more [n] or [m:n] items. The
+	 * outer loop iterates once per dimension item.
 	 */
 	p = string_save;
 	ndim = 0;
@@ -450,6 +452,7 @@ ReadArrayStr(char *arrayStr,
 								  ObjectIdGetDatum(typelem),
 								  Int32GetDatum(typmod));
 		p = ++q;
+
 		/*
 		 * if not at the end of the array skip white space
 		 */
@@ -460,6 +463,7 @@ ReadArrayStr(char *arrayStr,
 				q++;
 			}
 	}
+
 	/*
 	 * Initialize any unset items and compute total data space needed
 	 */
@@ -511,7 +515,7 @@ ReadArrayStr(char *arrayStr,
  * referenced by Datums after copying them.
  *
  * If the input data is of varlena type, the caller must have ensured that
- * the values are not toasted.  (Doing it here doesn't work since the 
+ * the values are not toasted.	(Doing it here doesn't work since the
  * caller has already allocated space for the array...)
  *----------
  */
@@ -601,7 +605,7 @@ array_out(PG_FUNCTION_ARGS)
 		itemvalue = fetch_att(p, typbyval, typlen);
 		values[i] = DatumGetCString(FunctionCall3(&outputproc,
 												  itemvalue,
-												  ObjectIdGetDatum(typelem),
+											   ObjectIdGetDatum(typelem),
 												  Int32GetDatum(-1)));
 		if (typlen > 0)
 			p += typlen;
@@ -706,6 +710,7 @@ array_dims(PG_FUNCTION_ARGS)
 		PG_RETURN_NULL();
 
 	nbytes = ARR_NDIM(v) * 33 + 1;
+
 	/*
 	 * 33 since we assume 15 digits per number + ':' +'[]'
 	 *
@@ -759,6 +764,7 @@ array_ref(ArrayType *array,
 
 	if (arraylen > 0)
 	{
+
 		/*
 		 * fixed-length arrays -- these are assumed to be 1-d, 0-based
 		 */
@@ -809,7 +815,7 @@ array_ref(ArrayType *array,
  * lowerIndx[] and upperIndx[].  These are generally just temporaries.
  *-----------------------------------------------------------------------------
  */
-ArrayType *
+ArrayType  *
 array_get_slice(ArrayType *array,
 				int nSubscripts,
 				int *upperIndx,
@@ -835,6 +841,7 @@ array_get_slice(ArrayType *array,
 
 	if (arraylen > 0)
 	{
+
 		/*
 		 * fixed-length arrays -- currently, cannot slice these because
 		 * parser labels output as being of the fixed-length array type!
@@ -866,8 +873,9 @@ array_get_slice(ArrayType *array,
 
 	/*
 	 * Check provided subscripts.  A slice exceeding the current array
-	 * limits is silently truncated to the array limits.  If we end up with
-	 * an empty slice, return NULL (should it be an empty array instead?)
+	 * limits is silently truncated to the array limits.  If we end up
+	 * with an empty slice, return NULL (should it be an empty array
+	 * instead?)
 	 */
 	if (ndim != nSubscripts || ndim <= 0 || ndim > MAXDIM)
 		RETURN_NULL(ArrayType *);
@@ -918,7 +926,7 @@ array_get_slice(ArrayType *array,
  * with NULL, which will probably not make him happy.
  *-----------------------------------------------------------------------------
  */
-ArrayType *
+ArrayType  *
 array_set(ArrayType *array,
 		  int nSubscripts,
 		  int *indx,
@@ -950,9 +958,10 @@ array_set(ArrayType *array,
 
 	if (arraylen > 0)
 	{
+
 		/*
-		 * fixed-length arrays -- these are assumed to be 1-d, 0-based.
-		 * We cannot extend them, either.
+		 * fixed-length arrays -- these are assumed to be 1-d, 0-based. We
+		 * cannot extend them, either.
 		 */
 		if (nSubscripts != 1)
 			elog(ERROR, "Invalid array subscripts");
@@ -994,9 +1003,7 @@ array_set(ArrayType *array,
 				extendbefore = true;
 			}
 			else
-			{
 				elog(ERROR, "Invalid array subscripts");
-			}
 		}
 		if (indx[i] >= (dim[i] + lb[i]))
 		{
@@ -1006,9 +1013,7 @@ array_set(ArrayType *array,
 				extendafter = true;
 			}
 			else
-			{
 				elog(ERROR, "Invalid array subscripts");
-			}
 		}
 	}
 
@@ -1085,7 +1090,7 @@ array_set(ArrayType *array,
  * with NULL, which will probably not make him happy.
  *----------------------------------------------------------------------------
  */
-ArrayType *
+ArrayType  *
 array_set_slice(ArrayType *array,
 				int nSubscripts,
 				int *upperIndx,
@@ -1118,6 +1123,7 @@ array_set_slice(ArrayType *array,
 
 	if (arraylen > 0)
 	{
+
 		/*
 		 * fixed-length arrays -- not got round to doing this...
 		 */
@@ -1141,8 +1147,8 @@ array_set_slice(ArrayType *array,
 	/*
 	 * Check provided subscripts.  A slice exceeding the current array
 	 * limits throws an error, *except* in the 1-D case where we will
-	 * extend the array as long as no hole is created.
-	 * An empty slice is an error, too.
+	 * extend the array as long as no hole is created. An empty slice is
+	 * an error, too.
 	 */
 	for (i = 0; i < ndim; i++)
 	{
@@ -1156,26 +1162,20 @@ array_set_slice(ArrayType *array,
 				lb[i] = lowerIndx[i];
 			}
 			else
-			{
 				elog(ERROR, "Invalid array subscripts");
-			}
 		}
 		if (upperIndx[i] >= (dim[i] + lb[i]))
 		{
 			if (ndim == 1 && lowerIndx[i] <= (dim[i] + lb[i]))
-			{
 				dim[i] = upperIndx[i] - lb[i] + 1;
-			}
 			else
-			{
 				elog(ERROR, "Invalid array subscripts");
-			}
 		}
 	}
 
 	/*
-	 * Make sure source array has enough entries.  Note we ignore the shape
-	 * of the source array and just read entries serially.
+	 * Make sure source array has enough entries.  Note we ignore the
+	 * shape of the source array and just read entries serially.
 	 */
 	mda_get_range(ndim, span, lowerIndx, upperIndx);
 	nsrcitems = ArrayGetNItems(ndim, span);
@@ -1192,24 +1192,27 @@ array_set_slice(ArrayType *array,
 	olddatasize = ARR_SIZE(array) - overheadlen;
 	if (ndim > 1)
 	{
+
 		/*
-		 * here we do not need to cope with extension of the array;
-		 * it would be a lot more complicated if we had to do so...
+		 * here we do not need to cope with extension of the array; it
+		 * would be a lot more complicated if we had to do so...
 		 */
 		olditemsize = array_slice_size(ndim, dim, lb, ARR_DATA_PTR(array),
 									   elmlen, lowerIndx, upperIndx);
-		lenbefore = lenafter = 0; /* keep compiler quiet */
+		lenbefore = lenafter = 0;		/* keep compiler quiet */
 	}
 	else
 	{
+
 		/*
-		 * here we must allow for possibility of slice larger than orig array
+		 * here we must allow for possibility of slice larger than orig
+		 * array
 		 */
-		int		oldlb = ARR_LBOUND(array)[0];
-		int		oldub = oldlb + ARR_DIMS(array)[0] - 1;
-		int		slicelb = MAX(oldlb, lowerIndx[0]);
-		int		sliceub = MIN(oldub, upperIndx[0]);
-		char   *oldarraydata = ARR_DATA_PTR(array);
+		int			oldlb = ARR_LBOUND(array)[0];
+		int			oldub = oldlb + ARR_DIMS(array)[0] - 1;
+		int			slicelb = MAX(oldlb, lowerIndx[0]);
+		int			sliceub = MIN(oldub, upperIndx[0]);
+		char	   *oldarraydata = ARR_DATA_PTR(array);
 
 		lenbefore = array_nelems_size(oldarraydata,
 									  elmlen,
@@ -1234,9 +1237,10 @@ array_set_slice(ArrayType *array,
 
 	if (ndim > 1)
 	{
+
 		/*
-		 * here we do not need to cope with extension of the array;
-		 * it would be a lot more complicated if we had to do so...
+		 * here we do not need to cope with extension of the array; it
+		 * would be a lot more complicated if we had to do so...
 		 */
 		array_insert_slice(ndim, dim, lb, ARR_DATA_PTR(array), olddatasize,
 						   ARR_DATA_PTR(newarray), elmlen,
@@ -1261,7 +1265,7 @@ array_set_slice(ArrayType *array,
 /*
  * array_map()
  *
- * Map an array through an arbitrary function.  Return a new array with
+ * Map an array through an arbitrary function.	Return a new array with
  * same dimensions and each source element transformed by fn().  Each
  * source element is passed as the first argument to fn(); additional
  * arguments to be passed to fn() can be specified by the caller.
@@ -1269,15 +1273,15 @@ array_set_slice(ArrayType *array,
  *
  * Parameters are:
  * * fcinfo: a function-call data structure pre-constructed by the caller
- *   to be ready to call the desired function, with everything except the
- *   first argument position filled in.  In particular, flinfo identifies
- *   the function fn(), and if nargs > 1 then argument positions after the
- *   first must be preset to the additional values to be passed.  The
- *   first argument position initially holds the input array value.
+ *	 to be ready to call the desired function, with everything except the
+ *	 first argument position filled in.  In particular, flinfo identifies
+ *	 the function fn(), and if nargs > 1 then argument positions after the
+ *	 first must be preset to the additional values to be passed.  The
+ *	 first argument position initially holds the input array value.
  * * inpType: OID of element type of input array.  This must be the same as,
- *   or binary-compatible with, the first argument type of fn().
- * * retType: OID of element type of output array.  This must be the same as,
- *   or binary-compatible with, the result type of fn().
+ *	 or binary-compatible with, the first argument type of fn().
+ * * retType: OID of element type of output array.	This must be the same as,
+ *	 or binary-compatible with, the result type of fn().
  *
  * NB: caller must assure that input array is not NULL.  Currently,
  * any additional parameters passed to fn() may not be specified as NULL
@@ -1344,9 +1348,9 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
 		/*
 		 * Apply the given function to source elt and extra args.
 		 *
-		 * We assume the extra args are non-NULL, so need not check
-		 * whether fn() is strict.  Would need to do more work here
-		 * to support arrays containing nulls, too.
+		 * We assume the extra args are non-NULL, so need not check whether
+		 * fn() is strict.	Would need to do more work here to support
+		 * arrays containing nulls, too.
 		 */
 		fcinfo->arg[0] = elt;
 		fcinfo->argnull[0] = false;
@@ -1374,7 +1378,10 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
 	result->ndim = ndim;
 	memcpy(ARR_DIMS(result), ARR_DIMS(v), 2 * ndim * sizeof(int));
 
-	/* Note: do not risk trying to pfree the results of the called function */
+	/*
+	 * Note: do not risk trying to pfree the results of the called
+	 * function
+	 */
 	CopyArrayEls(ARR_DATA_PTR(result), values, nitems,
 				 typbyval, typlen, typalign, false);
 	pfree(values);
@@ -1383,7 +1390,7 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
 }
 
 /*----------
- * construct_array  --- simple method for constructing an array object
+ * construct_array	--- simple method for constructing an array object
  *
  * elems: array of Datum items to become the array contents
  * nelems: number of items
@@ -1394,7 +1401,7 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
  * NULL element values are not supported.
  *----------
  */
-ArrayType *
+ArrayType  *
 construct_array(Datum *elems, int nelems,
 				bool elmbyval, int elmlen, char elmalign)
 {
diff --git a/src/backend/utils/adt/ascii.c b/src/backend/utils/adt/ascii.c
index ddc365f2004233366f0797ecc64131788d2f6078..bdcd24e44e0317dd562f4108415799d6f5d4aa40 100644
--- a/src/backend/utils/adt/ascii.c
+++ b/src/backend/utils/adt/ascii.c
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------
  * ascii.c
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.6 2001/01/24 19:43:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.7 2001/03/22 03:59:49 momjian Exp $
  *
  *	 Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
  *
@@ -33,21 +33,21 @@ multibyte_error(void)
 	elog(ERROR, "Multi-byte support is not enabled");
 }
 
-Datum 
+Datum
 to_ascii_encname(PG_FUNCTION_ARGS)
 {
 	multibyte_error();
 	return 0;					/* keep compiler quiet */
 }
 
-Datum 
+Datum
 to_ascii_enc(PG_FUNCTION_ARGS)
 {
 	multibyte_error();
 	return 0;					/* keep compiler quiet */
 }
 
-Datum 
+Datum
 to_ascii_default(PG_FUNCTION_ARGS)
 {
 	multibyte_error();
@@ -55,29 +55,29 @@ to_ascii_default(PG_FUNCTION_ARGS)
 }
 
 
-#else /* with MULTIBYTE */
+#else							/* with MULTIBYTE */
 
 
 static text *encode_to_ascii(text *data, int enc);
 
 /* ----------
- * to_ascii 
+ * to_ascii
  * ----------
  */
 char *
 pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *desc, int enc)
 {
-	unsigned char	*x 	= NULL;
-	unsigned char	*ascii	= NULL ;
-	int		range	= 0;
-	
-	/* 
-	 * relevant start for an encoding 
-	 */ 
-	#define RANGE_128	128	
-	#define RANGE_160	160
-	
-	
+	unsigned char *x = NULL;
+	unsigned char *ascii = NULL;
+	int			range = 0;
+
+	/*
+	 * relevant start for an encoding
+	 */
+#define RANGE_128	128
+#define RANGE_160	160
+
+
 	if (enc == LATIN1)
 	{
 		/* ----------
@@ -107,24 +107,24 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *desc, int
 	}
 	else
 	{
-		elog(ERROR, "pg_to_ascii(): unsupported encoding from %s", 
-						pg_encoding_to_char(enc));
+		elog(ERROR, "pg_to_ascii(): unsupported encoding from %s",
+			 pg_encoding_to_char(enc));
 	}
-	
+
 	/* ----------
 	 * Encode
 	 * ----------
 	 */
 	for (x = src; x <= src_end; x++)
 	{
-		if (*x < 128)			
+		if (*x < 128)
 			*desc++ = *x;
 		else if (*x < range)
-			*desc++ = ' ';  	/* bogus 128 to 'range' */
+			*desc++ = ' ';		/* bogus 128 to 'range' */
 		else
-			*desc++ = ascii[*x - range];	
-	}		
-	
+			*desc++ = ascii[*x - range];
+	}
+
 	return desc;
 }
 
@@ -136,11 +136,11 @@ static text *
 encode_to_ascii(text *data, int enc)
 {
 	pg_to_ascii(
-		(unsigned char *) VARDATA(data), 		/* src */
-		VARDATA(data) + VARSIZE(data),			/* src end */
-		(unsigned char *) VARDATA(data),		/* desc */	
-		enc);						/* encoding */
-	
+				(unsigned char *) VARDATA(data),		/* src */
+				VARDATA(data) + VARSIZE(data),	/* src end */
+				(unsigned char *) VARDATA(data),		/* desc */
+				enc);			/* encoding */
+
 	return data;
 }
 
@@ -152,30 +152,30 @@ Datum
 to_ascii_encname(PG_FUNCTION_ARGS)
 {
 	PG_RETURN_TEXT_P
-	( 
-		encode_to_ascii
-		( 
-			PG_GETARG_TEXT_P_COPY(0), 
-			pg_char_to_encoding( NameStr(*PG_GETARG_NAME(1)) ) 
-		)
-	);	
+	(
+	 encode_to_ascii
+	 (
+	  PG_GETARG_TEXT_P_COPY(0),
+	  pg_char_to_encoding(NameStr(*PG_GETARG_NAME(1)))
+	  )
+	);
 }
 
 /* ----------
  * convert to ASCII - enc is set as int4
  * ----------
  */
-Datum 
+Datum
 to_ascii_enc(PG_FUNCTION_ARGS)
 {
 	PG_RETURN_TEXT_P
-	( 
-		encode_to_ascii
-		( 
-			PG_GETARG_TEXT_P_COPY(0), 
-			PG_GETARG_INT32(1) 
-		)
-	);	
+	(
+	 encode_to_ascii
+	 (
+	  PG_GETARG_TEXT_P_COPY(0),
+	  PG_GETARG_INT32(1)
+	  )
+	);
 }
 
 /* ----------
@@ -185,14 +185,14 @@ to_ascii_enc(PG_FUNCTION_ARGS)
 Datum
 to_ascii_default(PG_FUNCTION_ARGS)
 {
-	PG_RETURN_TEXT_P 
-	( 
-		encode_to_ascii
-		( 
-			PG_GETARG_TEXT_P_COPY(0), 
-			GetDatabaseEncoding()
-		)
+	PG_RETURN_TEXT_P
+	(
+	 encode_to_ascii
+	 (
+	  PG_GETARG_TEXT_P_COPY(0),
+	  GetDatabaseEncoding()
+	  )
 	);
 }
 
-#endif /* MULTIBYTE */		
+#endif	 /* MULTIBYTE */
diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c
index 4f702b24595dcc25b9abd5ddb392a7f3437a765c..dba0fe6149254a9616d769b013646067f1532cac 100644
--- a/src/backend/utils/adt/bool.c
+++ b/src/backend/utils/adt/bool.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.24 2001/01/24 19:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.25 2001/03/22 03:59:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,8 +36,8 @@ boolin(PG_FUNCTION_ARGS)
 
 	switch (*b)
 	{
-			case 't':
-			case 'T':
+		case 't':
+		case 'T':
 			if (strncasecmp(b, "true", strlen(b)) == 0)
 				PG_RETURN_BOOL(true);
 			break;
@@ -187,7 +187,7 @@ isfalse(PG_FUNCTION_ARGS)
 
 	b = PG_GETARG_BOOL(0);
 
-	PG_RETURN_BOOL(! b);
+	PG_RETURN_BOOL(!b);
 }
 
 Datum
@@ -200,7 +200,7 @@ isnottrue(PG_FUNCTION_ARGS)
 
 	b = PG_GETARG_BOOL(0);
 
-	PG_RETURN_BOOL(! b);
+	PG_RETURN_BOOL(!b);
 }
 
 Datum
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index 7a3a5c11be97038cd6e25aa136bfcb81f6bf1866..dbcf881bf6c25f5b963e3d3d547a565aa73f16a8 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -9,7 +9,7 @@
  * workings can be found in the book "Software Solutions in C" by
  * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.49 2000/12/03 20:45:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.50 2001/03/22 03:59:49 momjian Exp $
  */
 
 #include "postgres.h"
@@ -82,20 +82,23 @@ cash_in(PG_FUNCTION_ARGS)
 				ssymbol,
 				psymbol,
 			   *nsymbol;
+
 #ifdef USE_LOCALE
 	struct lconv *lconvert = PGLC_localeconv();
+
 #endif
 
 #ifdef USE_LOCALE
+
 	/*
 	 * frac_digits will be CHAR_MAX in some locales, notably C.  However,
 	 * just testing for == CHAR_MAX is risky, because of compilers like
 	 * gcc that "helpfully" let you alter the platform-standard definition
 	 * of whether char is signed or not.  If we are so unfortunate as to
 	 * get compiled with a nonstandard -fsigned-char or -funsigned-char
-	 * switch, then our idea of CHAR_MAX will not agree with libc's.
-	 * The safest course is not to test for CHAR_MAX at all, but to impose
-	 * a range check for plausible frac_digits values.
+	 * switch, then our idea of CHAR_MAX will not agree with libc's. The
+	 * safest course is not to test for CHAR_MAX at all, but to impose a
+	 * range check for plausible frac_digits values.
 	 */
 	fpoint = lconvert->frac_digits;
 	if (fpoint < 0 || fpoint > 10)
@@ -238,8 +241,10 @@ cash_out(PG_FUNCTION_ARGS)
 				dsymbol,
 			   *nsymbol;
 	char		convention;
+
 #ifdef USE_LOCALE
 	struct lconv *lconvert = PGLC_localeconv();
+
 #endif
 
 #ifdef USE_LOCALE
@@ -249,8 +254,8 @@ cash_out(PG_FUNCTION_ARGS)
 		points = 2;				/* best guess in this case, I think */
 
 	/*
-	 * As with frac_digits, must apply a range check to mon_grouping
-	 * to avoid being fooled by variant CHAR_MAX values.
+	 * As with frac_digits, must apply a range check to mon_grouping to
+	 * avoid being fooled by variant CHAR_MAX values.
 	 */
 	mon_group = *lconvert->mon_grouping;
 	if (mon_group <= 0 || mon_group > 6)
@@ -680,7 +685,7 @@ cash_words(PG_FUNCTION_ARGS)
 		buf[0] = '\0';
 
 	m0 = value % 100;			/* cents */
-	m1 = (value / 100) % 1000; /* hundreds */
+	m1 = (value / 100) % 1000;	/* hundreds */
 	m2 = (value / 100000) % 1000;		/* thousands */
 	m3 = value / 100000000 % 1000;		/* millions */
 
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 35031e8187353d1855465665ddb52ab51f497acb..5e7d3c92f2e3790574ca553a86e83a43ea2400a0 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.55 2001/01/24 19:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.56 2001/03/22 03:59:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,7 +49,7 @@ date_in(PG_FUNCTION_ARGS)
 	char		lowstr[MAXDATELEN + 1];
 
 	if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
-		|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp) != 0))
+	 || (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp) != 0))
 		elog(ERROR, "Bad date external representation '%s'", str);
 
 	switch (dtype)
@@ -244,15 +244,15 @@ date_timestamp(PG_FUNCTION_ARGS)
 		if (utime == -1)
 			elog(ERROR, "Unable to convert date to tm");
 
-		result = utime + ((date2j(1970,1,1)-date2j(2000,1,1))*86400.0);
+		result = utime + ((date2j(1970, 1, 1) - date2j(2000, 1, 1)) * 86400.0);
 #else
-		result = dateVal*86400.0+CTimeZone;
+		result = dateVal * 86400.0 + CTimeZone;
 #endif
 	}
 	else
 	{
 		/* Outside of range for timezone support, so assume UTC */
-		result = dateVal*86400.0;
+		result = dateVal * 86400.0;
 	}
 
 	PG_RETURN_TIMESTAMP(result);
@@ -277,13 +277,9 @@ timestamp_date(PG_FUNCTION_ARGS)
 		elog(ERROR, "Unable to convert timestamp to date");
 
 	if (TIMESTAMP_IS_EPOCH(timestamp))
-	{
 		timestamp2tm(SetTimestamp(timestamp), NULL, tm, &fsec, NULL);
-	}
 	else if (TIMESTAMP_IS_CURRENT(timestamp))
-	{
 		timestamp2tm(SetTimestamp(timestamp), &tz, tm, &fsec, &tzn);
-	}
 	else
 	{
 		if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
@@ -538,8 +534,10 @@ time_smaller(PG_FUNCTION_ARGS)
 Datum
 overlaps_time(PG_FUNCTION_ARGS)
 {
-	/* The arguments are TimeADT, but we leave them as generic Datums
-	 * to avoid dereferencing nulls (TimeADT is pass-by-reference!)
+
+	/*
+	 * The arguments are TimeADT, but we leave them as generic Datums to
+	 * avoid dereferencing nulls (TimeADT is pass-by-reference!)
 	 */
 	Datum		ts1 = PG_GETARG_DATUM(0);
 	Datum		te1 = PG_GETARG_DATUM(1);
@@ -556,9 +554,9 @@ overlaps_time(PG_FUNCTION_ARGS)
 	(DatumGetTimeADT(t1) < DatumGetTimeADT(t2))
 
 	/*
-	 * If both endpoints of interval 1 are null, the result is null (unknown).
-	 * If just one endpoint is null, take ts1 as the non-null one.
-	 * Otherwise, take ts1 as the lesser endpoint.
+	 * If both endpoints of interval 1 are null, the result is null
+	 * (unknown). If just one endpoint is null, take ts1 as the non-null
+	 * one. Otherwise, take ts1 as the lesser endpoint.
 	 */
 	if (ts1IsNull)
 	{
@@ -572,7 +570,7 @@ overlaps_time(PG_FUNCTION_ARGS)
 	{
 		if (TIMEADT_GT(ts1, te1))
 		{
-			Datum	tt = ts1;
+			Datum		tt = ts1;
 
 			ts1 = te1;
 			te1 = tt;
@@ -592,7 +590,7 @@ overlaps_time(PG_FUNCTION_ARGS)
 	{
 		if (TIMEADT_GT(ts2, te2))
 		{
-			Datum	tt = ts2;
+			Datum		tt = ts2;
 
 			ts2 = te2;
 			te2 = tt;
@@ -605,7 +603,9 @@ overlaps_time(PG_FUNCTION_ARGS)
 	 */
 	if (TIMEADT_GT(ts1, ts2))
 	{
-		/* This case is ts1 < te2 OR te1 < te2, which may look redundant
+
+		/*
+		 * This case is ts1 < te2 OR te1 < te2, which may look redundant
 		 * but in the presence of nulls it's not quite completely so.
 		 */
 		if (te2IsNull)
@@ -614,7 +614,9 @@ overlaps_time(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te1IsNull)
 			PG_RETURN_NULL();
-		/* If te1 is not null then we had ts1 <= te1 above, and we just
+
+		/*
+		 * If te1 is not null then we had ts1 <= te1 above, and we just
 		 * found ts1 >= te2, hence te1 >= te2.
 		 */
 		PG_RETURN_BOOL(false);
@@ -628,15 +630,20 @@ overlaps_time(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te2IsNull)
 			PG_RETURN_NULL();
-		/* If te2 is not null then we had ts2 <= te2 above, and we just
+
+		/*
+		 * If te2 is not null then we had ts2 <= te2 above, and we just
 		 * found ts2 >= te1, hence te2 >= te1.
 		 */
 		PG_RETURN_BOOL(false);
 	}
 	else
 	{
-		/* For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
-		 * rather silly way of saying "true if both are nonnull, else null".
+
+		/*
+		 * For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
+		 * rather silly way of saying "true if both are nonnull, else
+		 * null".
 		 */
 		if (te1IsNull || te2IsNull)
 			PG_RETURN_NULL();
@@ -690,7 +697,7 @@ datetime_timestamp(PG_FUNCTION_ARGS)
 	Timestamp	result;
 
 	result = DatumGetTimestamp(DirectFunctionCall1(date_timestamp,
-												   DateADTGetDatum(date)));
+												 DateADTGetDatum(date)));
 	result += time;
 
 	PG_RETURN_TIMESTAMP(result);
@@ -895,62 +902,62 @@ timetz_out(PG_FUNCTION_ARGS)
 Datum
 timetz_eq(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) == (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) == (time2->time + time2->zone)));
 }
 
 Datum
 timetz_ne(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) != (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) != (time2->time + time2->zone)));
 }
 
 Datum
 timetz_lt(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) < (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) < (time2->time + time2->zone)));
 }
 
 Datum
 timetz_le(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) <= (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) <= (time2->time + time2->zone)));
 }
 
 Datum
 timetz_gt(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) > (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) > (time2->time + time2->zone)));
 }
 
 Datum
 timetz_ge(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
-	PG_RETURN_BOOL(((time1->time+time1->zone) >= (time2->time+time2->zone)));
+	PG_RETURN_BOOL(((time1->time + time1->zone) >= (time2->time + time2->zone)));
 }
 
 Datum
 timetz_cmp(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
 	if (DatumGetBool(DirectFunctionCall2(timetz_lt,
 										 TimeTzADTPGetDatum(time1),
@@ -969,7 +976,7 @@ timetz_cmp(PG_FUNCTION_ARGS)
 Datum
 timetz_hash(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *key = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *key = PG_GETARG_TIMETZADT_P(0);
 
 	/*
 	 * Specify hash length as sizeof(double) + sizeof(int4), not as
@@ -982,8 +989,8 @@ timetz_hash(PG_FUNCTION_ARGS)
 Datum
 timetz_larger(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
 	if (DatumGetBool(DirectFunctionCall2(timetz_gt,
 										 TimeTzADTPGetDatum(time1),
@@ -995,8 +1002,8 @@ timetz_larger(PG_FUNCTION_ARGS)
 Datum
 timetz_smaller(PG_FUNCTION_ARGS)
 {
-	TimeTzADT   *time1 = PG_GETARG_TIMETZADT_P(0);
-	TimeTzADT   *time2 = PG_GETARG_TIMETZADT_P(1);
+	TimeTzADT  *time1 = PG_GETARG_TIMETZADT_P(0);
+	TimeTzADT  *time2 = PG_GETARG_TIMETZADT_P(1);
 
 	if (DatumGetBool(DirectFunctionCall2(timetz_lt,
 										 TimeTzADTPGetDatum(time1),
@@ -1058,7 +1065,9 @@ timetz_mi_interval(PG_FUNCTION_ARGS)
 Datum
 overlaps_timetz(PG_FUNCTION_ARGS)
 {
-	/* The arguments are TimeTzADT *, but we leave them as generic Datums
+
+	/*
+	 * The arguments are TimeTzADT *, but we leave them as generic Datums
 	 * for convenience of notation --- and to avoid dereferencing nulls.
 	 */
 	Datum		ts1 = PG_GETARG_DATUM(0);
@@ -1076,9 +1085,9 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 	DatumGetBool(DirectFunctionCall2(timetz_lt,t1,t2))
 
 	/*
-	 * If both endpoints of interval 1 are null, the result is null (unknown).
-	 * If just one endpoint is null, take ts1 as the non-null one.
-	 * Otherwise, take ts1 as the lesser endpoint.
+	 * If both endpoints of interval 1 are null, the result is null
+	 * (unknown). If just one endpoint is null, take ts1 as the non-null
+	 * one. Otherwise, take ts1 as the lesser endpoint.
 	 */
 	if (ts1IsNull)
 	{
@@ -1092,7 +1101,7 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 	{
 		if (TIMETZ_GT(ts1, te1))
 		{
-			Datum	tt = ts1;
+			Datum		tt = ts1;
 
 			ts1 = te1;
 			te1 = tt;
@@ -1112,7 +1121,7 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 	{
 		if (TIMETZ_GT(ts2, te2))
 		{
-			Datum	tt = ts2;
+			Datum		tt = ts2;
 
 			ts2 = te2;
 			te2 = tt;
@@ -1125,7 +1134,9 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 	 */
 	if (TIMETZ_GT(ts1, ts2))
 	{
-		/* This case is ts1 < te2 OR te1 < te2, which may look redundant
+
+		/*
+		 * This case is ts1 < te2 OR te1 < te2, which may look redundant
 		 * but in the presence of nulls it's not quite completely so.
 		 */
 		if (te2IsNull)
@@ -1134,7 +1145,9 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te1IsNull)
 			PG_RETURN_NULL();
-		/* If te1 is not null then we had ts1 <= te1 above, and we just
+
+		/*
+		 * If te1 is not null then we had ts1 <= te1 above, and we just
 		 * found ts1 >= te2, hence te1 >= te2.
 		 */
 		PG_RETURN_BOOL(false);
@@ -1148,15 +1161,20 @@ overlaps_timetz(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te2IsNull)
 			PG_RETURN_NULL();
-		/* If te2 is not null then we had ts2 <= te2 above, and we just
+
+		/*
+		 * If te2 is not null then we had ts2 <= te2 above, and we just
 		 * found ts2 >= te1, hence te2 >= te1.
 		 */
 		PG_RETURN_BOOL(false);
 	}
 	else
 	{
-		/* For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
-		 * rather silly way of saying "true if both are nonnull, else null".
+
+		/*
+		 * For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
+		 * rather silly way of saying "true if both are nonnull, else
+		 * null".
 		 */
 		if (te1IsNull || te2IsNull)
 			PG_RETURN_NULL();
@@ -1219,7 +1237,7 @@ datetimetz_timestamp(PG_FUNCTION_ARGS)
 	TimeTzADT  *time = PG_GETARG_TIMETZADT_P(1);
 	Timestamp	result;
 
-	result = date*86400.0 + time->time + time->zone;
+	result = date * 86400.0 + time->time + time->zone;
 
 	PG_RETURN_TIMESTAMP(result);
 }
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 8e9299643ffc688d4fb755a5ca0a3adec6a6c8f4..8691fa49b9189fbff1293209596c2a229b44c59d 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.61 2001/03/14 20:12:10 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.62 2001/03/22 03:59:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,16 +25,16 @@
 #include "utils/datetime.h"
 
 static int DecodeNumber(int flen, char *field,
-						int fmask, int *tmask,
-						struct tm * tm, double *fsec, int *is2digits);
+			 int fmask, int *tmask,
+			 struct tm * tm, double *fsec, int *is2digits);
 static int DecodeNumberField(int len, char *str,
-							 int fmask, int *tmask,
-							 struct tm * tm, double *fsec, int *is2digits);
+				  int fmask, int *tmask,
+				  struct tm * tm, double *fsec, int *is2digits);
 static int DecodeTime(char *str, int fmask, int *tmask,
-					  struct tm * tm, double *fsec);
+		   struct tm * tm, double *fsec);
 static int	DecodeTimezone(char *str, int *tzp);
 static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
-static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
+static int	DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
 
 #define USE_DATE_CACHE 1
 #define ROUND_ALL 0
@@ -271,10 +271,13 @@ static datetkn deltatktbl[] = {
 	{"m", UNITS, DTK_MINUTE},	/* "minute" relative time units */
 	{"microsecon", UNITS, DTK_MICROSEC},		/* "microsecond" relative
 												 * time units */
-	{"mil", UNITS, DTK_MILLENNIUM},		/* "millennium" relative time units */
-	{"mils", UNITS, DTK_MILLENNIUM},	  /* "millennia" relative time units */
-	{"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative time units */
-	{DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative time units */
+	{"mil", UNITS, DTK_MILLENNIUM},		/* "millennium" relative time
+										 * units */
+	{"mils", UNITS, DTK_MILLENNIUM},	/* "millennia" relative time units */
+	{"millennia", UNITS, DTK_MILLENNIUM},		/* "millennia" relative
+												 * time units */
+	{DMILLENNIUM, UNITS, DTK_MILLENNIUM},		/* "millennium" relative
+												 * time units */
 	{"millisecon", UNITS, DTK_MILLISEC},		/* relative time units */
 	{"min", UNITS, DTK_MINUTE}, /* "minute" relative time units */
 	{"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */
@@ -876,14 +879,14 @@ DecodeDateTime(char **field, int *ftype, int nf,
 				tm->tm_year += 1900;
 				tm->tm_mon += 1;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 				*tzp = -(tm->tm_gmtoff);		/* tm_gmtoff is
 												 * Sun/DEC-ism */
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 				*tzp = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-# endif /* HAVE_INT_TIMEZONE */
+#endif	 /* HAVE_INT_TIMEZONE */
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 				*tzp = CTimeZone;
 #endif
 			}
@@ -1121,13 +1124,13 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 		mktime(tmp);
 		tm->tm_isdst = tmp->tm_isdst;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 		*tzp = -(tmp->tm_gmtoff);		/* tm_gmtoff is Sun/DEC-ism */
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 		*tzp = ((tmp->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-# endif
+#endif
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 		*tzp = CTimeZone;
 #endif
 	}
@@ -1492,7 +1495,7 @@ DecodeNumberField(int len, char *str, int fmask,
 		return -1;
 
 	return 0;
-}	/*  DecodeNumberField() */
+}	/* DecodeNumberField() */
 
 
 /* DecodeTimezone()
@@ -1674,20 +1677,26 @@ DecodeDateDelta(char **field, int *ftype, int nf, int *dtype, struct tm * tm, do
 				break;
 
 			case DTK_TZ:
+
 				/*
 				 * Timezone is a token with a leading sign character and
 				 * otherwise the same as a non-signed time field
 				 */
 				Assert((*field[i] == '-') || (*field[i] == '+'));
-				/* A single signed number ends up here, but will be rejected by DecodeTime().
-				 * So, work this out to drop through to DTK_NUMBER, which *can* tolerate this.
+
+				/*
+				 * A single signed number ends up here, but will be
+				 * rejected by DecodeTime(). So, work this out to drop
+				 * through to DTK_NUMBER, which *can* tolerate this.
 				 */
-				cp = field[i]+1;
+				cp = field[i] + 1;
 				while ((*cp != '\0') && (*cp != ':') && (*cp != '.'))
 					cp++;
 				if ((*cp == ':')
-					&& (DecodeTime((field[i]+1), fmask, &tmask, tm, fsec) == 0)) {
-					if (*field[i] == '-') {
+					&& (DecodeTime((field[i] + 1), fmask, &tmask, tm, fsec) == 0))
+				{
+					if (*field[i] == '-')
+					{
 						/* flip the sign on all fields */
 						tm->tm_hour = -tm->tm_hour;
 						tm->tm_min = -tm->tm_min;
@@ -1695,18 +1704,33 @@ DecodeDateDelta(char **field, int *ftype, int nf, int *dtype, struct tm * tm, do
 						*fsec = -(*fsec);
 					}
 
-					/* Set the next type to be a day, if units are not specified.
-					 * This handles the case of '1 +02:03' since we are reading right to left.
+					/*
+					 * Set the next type to be a day, if units are not
+					 * specified. This handles the case of '1 +02:03'
+					 * since we are reading right to left.
 					 */
 					type = DTK_DAY;
 					tmask = DTK_M(TZ);
 					break;
-				} else if (type == IGNORE) {
-					if (*cp == '.') {
-						/* Got a decimal point? Then assume some sort of seconds specification */
+				}
+				else if (type == IGNORE)
+				{
+					if (*cp == '.')
+					{
+
+						/*
+						 * Got a decimal point? Then assume some sort of
+						 * seconds specification
+						 */
 						type = DTK_SECOND;
-					} else if (*cp == '\0') {
-						/* Only a signed integer? Then must assume a timezone-like usage */
+					}
+					else if (*cp == '\0')
+					{
+
+						/*
+						 * Only a signed integer? Then must assume a
+						 * timezone-like usage
+						 */
 						type = DTK_HOUR;
 					}
 				}
@@ -1921,7 +1945,7 @@ DecodeUnits(int field, char *lowtoken, int *val)
  * Binary search -- from Knuth (6.2.1) Algorithm B.  Special case like this
  * is WAY faster than the generic bsearch().
  */
-static datetkn    *
+static datetkn *
 datebsearch(char *key, datetkn *base, unsigned int nel)
 {
 	datetkn    *last = base + nel - 1,
@@ -2166,7 +2190,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
 					if ((*tzn != NULL) && (tm->tm_isdst >= 0))
 					{
 						strcpy((str + 27), " ");
-						StrNCpy((str + 28), *tzn, MAXTZLEN+1);
+						StrNCpy((str + 28), *tzn, MAXTZLEN + 1);
 					}
 				}
 				else
@@ -2175,7 +2199,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
 					if ((*tzn != NULL) && (tm->tm_isdst >= 0))
 					{
 						strcpy((str + 24), " ");
-						StrNCpy((str + 25), *tzn, MAXTZLEN+1);
+						StrNCpy((str + 25), *tzn, MAXTZLEN + 1);
 					}
 				}
 
@@ -2207,10 +2231,11 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 	int			is_nonzero = FALSE;
 	char	   *cp = str;
 
-	/* The sign of year and month are guaranteed to match,
-	 * since they are stored internally as "month".
-	 * But we'll need to check for is_before and is_nonzero
-	 * when determining the signs of hour/minute/seconds fields.
+	/*
+	 * The sign of year and month are guaranteed to match, since they are
+	 * stored internally as "month". But we'll need to check for is_before
+	 * and is_nonzero when determining the signs of hour/minute/seconds
+	 * fields.
 	 */
 	switch (style)
 	{
@@ -2247,8 +2272,8 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 			if ((!is_nonzero) || (tm->tm_hour != 0) || (tm->tm_min != 0)
 				|| (tm->tm_sec != 0) || (fsec != 0))
 			{
-				int minus = ((tm->tm_hour < 0) || (tm->tm_min < 0)
-							 || (tm->tm_sec < 0) || (fsec < 0));
+				int			minus = ((tm->tm_hour < 0) || (tm->tm_min < 0)
+									 || (tm->tm_sec < 0) || (fsec < 0));
 
 				sprintf(cp, "%s%s%02d:%02d", (is_nonzero ? " " : ""),
 						(minus ? "-" : (is_before ? "+" : "")),
@@ -2283,7 +2308,8 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 
 			if (tm->tm_year != 0)
 			{
-				int year = tm->tm_year;
+				int			year = tm->tm_year;
+
 				if (tm->tm_year < 0)
 					year = -year;
 
@@ -2296,55 +2322,59 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 
 			if (tm->tm_mon != 0)
 			{
-				int mon = tm->tm_mon;
+				int			mon = tm->tm_mon;
+
 				if (is_before || ((!is_nonzero) && (tm->tm_mon < 0)))
 					mon = -mon;
 
 				sprintf(cp, "%s%d mon%s", (is_nonzero ? " " : ""), mon,
 						((mon != 1) ? "s" : ""));
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (tm->tm_mon < 0);
 				is_nonzero = TRUE;
 			}
 
 			if (tm->tm_mday != 0)
 			{
-				int day = tm->tm_mday;
+				int			day = tm->tm_mday;
+
 				if (is_before || ((!is_nonzero) && (tm->tm_mday < 0)))
 					day = -day;
 
 				sprintf(cp, "%s%d day%s", (is_nonzero ? " " : ""), day,
 						((day != 1) ? "s" : ""));
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (tm->tm_mday < 0);
 				is_nonzero = TRUE;
 			}
 			if (tm->tm_hour != 0)
 			{
-				int hour = tm->tm_hour;
+				int			hour = tm->tm_hour;
+
 				if (is_before || ((!is_nonzero) && (tm->tm_hour < 0)))
 					hour = -hour;
 
 				sprintf(cp, "%s%d hour%s", (is_nonzero ? " " : ""), hour,
 						((hour != 1) ? "s" : ""));
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (tm->tm_hour < 0);
 				is_nonzero = TRUE;
 			}
 
 			if (tm->tm_min != 0)
 			{
-				int min = tm->tm_min;
+				int			min = tm->tm_min;
+
 				if (is_before || ((!is_nonzero) && (tm->tm_min < 0)))
 					min = -min;
 
 				sprintf(cp, "%s%d min%s", (is_nonzero ? " " : ""), min,
 						((min != 1) ? "s" : ""));
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (tm->tm_min < 0);
 				is_nonzero = TRUE;
 			}
@@ -2352,7 +2382,8 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 			/* fractional seconds? */
 			if (fsec != 0)
 			{
-				double sec;
+				double		sec;
+
 				fsec += tm->tm_sec;
 				sec = fsec;
 				if (is_before || ((!is_nonzero) && (fsec < 0)))
@@ -2360,7 +2391,7 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 
 				sprintf(cp, "%s%.2f secs", (is_nonzero ? " " : ""), sec);
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (fsec < 0);
 				is_nonzero = TRUE;
 
@@ -2368,14 +2399,15 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 			}
 			else if (tm->tm_sec != 0)
 			{
-				int sec = tm->tm_sec;
+				int			sec = tm->tm_sec;
+
 				if (is_before || ((!is_nonzero) && (tm->tm_sec < 0)))
 					sec = -sec;
 
 				sprintf(cp, "%s%d sec%s", (is_nonzero ? " " : ""), sec,
 						((sec != 1) ? "s" : ""));
 				cp += strlen(cp);
-				if (! is_nonzero)
+				if (!is_nonzero)
 					is_before = (tm->tm_sec < 0);
 				is_nonzero = TRUE;
 			}
@@ -2383,7 +2415,7 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
 	}
 
 	/* identically zero? then put in a unitless zero... */
-	if (! is_nonzero)
+	if (!is_nonzero)
 	{
 		strcat(cp, "0");
 		cp += strlen(cp);
diff --git a/src/backend/utils/adt/datum.c b/src/backend/utils/adt/datum.c
index 9a1bffb81e4d21f6bba72173bf22dbb32538a4e8..d0766d15d709e5f9659efb97a550316e51b9ad8a 100644
--- a/src/backend/utils/adt/datum.c
+++ b/src/backend/utils/adt/datum.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.19 2001/01/24 19:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.20 2001/03/22 03:59:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -153,10 +153,11 @@ datumFree(Datum value, bool typByVal, int typLen)
 bool
 datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
 {
-	bool	res;
+	bool		res;
 
 	if (typByVal)
 	{
+
 		/*
 		 * just compare the two datums. NOTE: just comparing "len" bytes
 		 * will not do the work, because we do not know how these bytes
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index b02117d3a78836f61ebfe173c8a072a404353588..7a83ee6577ef9c6dc95de154fc5e9eca42d44cc4 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.69 2001/01/24 19:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.70 2001/03/22 03:59:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -56,7 +56,7 @@
 #include <limits.h>
 /* for finite() on Solaris */
 #ifdef HAVE_IEEEFP_H
-# include <ieeefp.h>
+#include <ieeefp.h>
 #endif
 
 #include "fmgr.h"
@@ -69,6 +69,7 @@
 
 #ifndef atof
 extern double atof(const char *p);
+
 #endif
 
 #ifndef HAVE_CBRT
@@ -78,8 +79,9 @@ static double cbrt(double x);
 #else
 #if !defined(nextstep)
 extern double cbrt(double x);
+
 #endif
-#endif /* HAVE_CBRT */
+#endif	 /* HAVE_CBRT */
 
 #ifndef HAVE_RINT
 #define rint my_rint
@@ -87,9 +89,10 @@ static double rint(double x);
 
 #else
 extern double rint(double x);
-#endif /* HAVE_RINT */
 
-#endif /* NeXT check */
+#endif	 /* HAVE_RINT */
+
+#endif	 /* NeXT check */
 
 
 static void CheckFloat4Val(double val);
@@ -1345,7 +1348,7 @@ setseed(PG_FUNCTION_ARGS)
  *		float8_accum	- accumulate for AVG(), STDDEV(), etc
  *		float4_accum	- same, but input data is float4
  *		float8_avg		- produce final result for float AVG()
- *		float8_variance	- produce final result for float VARIANCE()
+ *		float8_variance - produce final result for float VARIANCE()
  *		float8_stddev	- produce final result for float STDDEV()
  *
  * The transition datatype for all these aggregates is a 3-element array
@@ -1360,10 +1363,11 @@ setseed(PG_FUNCTION_ARGS)
 static float8 *
 check_float8_array(ArrayType *transarray, const char *caller)
 {
+
 	/*
-	 * We expect the input to be a 3-element float array; verify that.
-	 * We don't need to use deconstruct_array() since the array data
-	 * is just going to look like a C array of 3 float8 values.
+	 * We expect the input to be a 3-element float array; verify that. We
+	 * don't need to use deconstruct_array() since the array data is just
+	 * going to look like a C array of 3 float8 values.
 	 */
 	if (ARR_SIZE(transarray) != (ARR_OVERHEAD(1) + 3 * sizeof(float8)) ||
 		ARR_NDIM(transarray) != 1 ||
@@ -1398,7 +1402,7 @@ float8_accum(PG_FUNCTION_ARGS)
 	transdatums[2] = Float8GetDatumFast(sumX2);
 
 	result = construct_array(transdatums, 3,
-							 false /* float8 byval */, sizeof(float8), 'd');
+						 false /* float8 byval */ , sizeof(float8), 'd');
 
 	PG_RETURN_ARRAYTYPE_P(result);
 }
@@ -1433,7 +1437,7 @@ float4_accum(PG_FUNCTION_ARGS)
 	transdatums[2] = Float8GetDatumFast(sumX2);
 
 	result = construct_array(transdatums, 3,
-							 false /* float8 byval */, sizeof(float8), 'd');
+						 false /* float8 byval */ , sizeof(float8), 'd');
 
 	PG_RETURN_ARRAYTYPE_P(result);
 }
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index 4cdaaee765f8c21b0a2a83c91f0e4bc23c3c0b15..b499024550038d69692df6e9f9eda46847204000 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.9 2001/02/05 17:35:04 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.10 2001/03/22 03:59:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,10 +31,10 @@ static char *format_type_internal(Oid type_oid, int32 typemod);
 
 
 static char *
-psnprintf(size_t len, const char * fmt, ...)
+psnprintf(size_t len, const char *fmt,...)
 {
-	va_list ap;
-	char * buf;
+	va_list		ap;
+	char	   *buf;
 
 	buf = palloc(len);
 
@@ -136,7 +136,9 @@ format_type_internal(Oid type_oid, int32 typemod)
 			break;
 
 		case CHAROID:
-			/* This char type is the single-byte version. You have to
+
+			/*
+			 * This char type is the single-byte version. You have to
 			 * double-quote it to get at it in the parser.
 			 */
 			buf = pstrdup("\"char\"");
@@ -252,7 +254,7 @@ type_maximum_size(Oid type_oid, int32 typemod)
 			/* precision (ie, max # of digits) is in upper bits of typmod */
 			if (typemod > VARHDRSZ)
 			{
-				int		precision = ((typemod - VARHDRSZ) >> 16) & 0xffff;
+				int			precision = ((typemod - VARHDRSZ) >> 16) & 0xffff;
 
 				/* Numeric stores 2 decimal digits/byte, plus header */
 				return (precision + 1) / 2 + NUMERIC_HDRSZ;
@@ -262,7 +264,7 @@ type_maximum_size(Oid type_oid, int32 typemod)
 		case VARBITOID:
 		case ZPBITOID:
 			/* typemod is the (max) number of bits */
-			return (typemod + (BITS_PER_BYTE-1)) / BITS_PER_BYTE
+			return (typemod + (BITS_PER_BYTE - 1)) / BITS_PER_BYTE
 				+ 2 * sizeof(int32);
 	}
 
@@ -300,10 +302,10 @@ oidvectortypes(PG_FUNCTION_ARGS)
 	result = palloc(total);
 	result[0] = '\0';
 	left = total - 1;
-					
+
 	for (num = 0; num < numargs; num++)
 	{
-		char * typename = format_type_internal(oidArray[num], -1);
+		char	   *typename = format_type_internal(oidArray[num], -1);
 
 		if (left < strlen(typename) + 2)
 		{
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index bef39d2da53b0016e0c503f5de759dbc1dfeb53f..bebe8240144beb7a3d709f0a42cb7fef70f04f1a 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------
  * formatting.c
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.33 2001/02/27 08:13:28 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.34 2001/03/22 03:59:50 momjian Exp $
  *
  *
  *	 Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -47,14 +47,14 @@
  * TODO (7.2):
  *	- replace some global values by struct that handle it
  *	- check last used entry in the cache_search
- *	- better number building (formatting) 
+ *	- better number building (formatting)
  *	- add support for abstime
  *	- add support for roman number to standard number conversion
  *	- add support for number spelling
  *	- add support for string to string formatting (we must be better
- *	  than Oracle :-), 
- *		to_char('Hello', 'X X X X X') -> 'H e l l o' 
- * 
+ *	  than Oracle :-),
+ *		to_char('Hello', 'X X X X X') -> 'H e l l o'
+ *
  * -----------------------------------------------------------------------
  */
 
@@ -116,8 +116,8 @@
  * External (defined in PgSQL dt.c (timestamp utils))
  * ----------
  */
-extern char	*months[],		/* month abbreviation	*/
-		*days[];		/* full days		*/
+extern char *months[],			/* month abbreviation	*/
+		   *days[];				/* full days		*/
 
 /* ----------
  * Format parser structs
@@ -125,28 +125,28 @@ extern char	*months[],		/* month abbreviation	*/
  */
 typedef struct
 {
-	char	*name;			/* suffix string		*/
-	int	len,			/* suffix length		*/
-		id,			/* used in node->suffix */
-		type;			/* prefix / postfix			*/
+	char	   *name;			/* suffix string		*/
+	int			len,			/* suffix length		*/
+				id,				/* used in node->suffix */
+				type;			/* prefix / postfix			*/
 } KeySuffix;
 
 typedef struct
 {
-	char	*name;			/* keyword			*/
-					/* action for keyword		*/
-	int	len,			/* keyword length		*/
-		(*action) (),
-		id;			/* keyword id			*/
-	bool	isitdigit;		/* is expected output/input digit */	
+	char	   *name;			/* keyword			*/
+	/* action for keyword		*/
+	int			len,			/* keyword length		*/
+				(*action) (),
+				id;				/* keyword id			*/
+	bool		isitdigit;		/* is expected output/input digit */
 } KeyWord;
 
 typedef struct
 {
-	int	type;			/* node type			*/
-	KeyWord	*key;			/* if node type is KEYWORD	*/
-	int	character,		/* if node type is CHAR		*/
-		suffix;			/* keyword suffix		*/
+	int			type;			/* node type			*/
+	KeyWord    *key;			/* if node type is KEYWORD	*/
+	int			character,		/* if node type is CHAR		*/
+				suffix;			/* keyword suffix		*/
 } FormatNode;
 
 #define NODE_TYPE_END		1
@@ -249,7 +249,7 @@ static char *numth[] = {"st", "nd", "rd", "th", NULL};
  * Flags for DCH version
  * ----------
  */
-static int		DCH_global_flag = 0;
+static int	DCH_global_flag = 0;
 
 #define DCH_F_FX	0x01
 
@@ -262,15 +262,15 @@ static int		DCH_global_flag = 0;
  */
 typedef struct
 {
-	int	pre,		/* (count) numbers before decimal */
-		post,		/* (count) numbers after decimal  */
-		lsign,		/* want locales sign		  */
-		flag,		/* number parametrs		  */
-		pre_lsign_num,	/* tmp value for lsign		  */
-		multi,		/* multiplier for 'V'		  */
-		zero_start,	/* position of first zero	  */
-		zero_end,	/* position of last zero	  */
-		need_locale;	/* needs it locale		  */
+	int			pre,			/* (count) numbers before decimal */
+				post,			/* (count) numbers after decimal  */
+				lsign,			/* want locales sign		  */
+				flag,			/* number parametrs		  */
+				pre_lsign_num,	/* tmp value for lsign		  */
+				multi,			/* multiplier for 'V'		  */
+				zero_start,		/* position of first zero	  */
+				zero_end,		/* position of last zero	  */
+				need_locale;	/* needs it locale		  */
 } NUMDesc;
 
 /* ----------
@@ -280,14 +280,14 @@ typedef struct
 #define NUM_F_DECIMAL	0x01
 #define NUM_F_LDECIMAL	0x02
 #define NUM_F_ZERO	0x04
-#define NUM_F_BLANK	0x08
+#define NUM_F_BLANK 0x08
 #define NUM_F_FILLMODE	0x10
-#define NUM_F_LSIGN	0x20
+#define NUM_F_LSIGN 0x20
 #define NUM_F_BRACKET	0x40
-#define NUM_F_MINUS	0x80
+#define NUM_F_MINUS 0x80
 #define NUM_F_PLUS	0x100
-#define NUM_F_ROMAN	0x200
-#define NUM_F_MULTI	0x400
+#define NUM_F_ROMAN 0x200
+#define NUM_F_MULTI 0x400
 
 #define NUM_LSIGN_PRE	-1
 #define NUM_LSIGN_POST	1
@@ -299,20 +299,20 @@ typedef struct
  */
 #define IS_DECIMAL(_f)	((_f)->flag & NUM_F_DECIMAL)
 #define IS_LDECIMAL(_f) ((_f)->flag & NUM_F_LDECIMAL)
-#define IS_ZERO(_f)	((_f)->flag & NUM_F_ZERO)
+#define IS_ZERO(_f) ((_f)->flag & NUM_F_ZERO)
 #define IS_BLANK(_f)	((_f)->flag & NUM_F_BLANK)
 #define IS_FILLMODE(_f) ((_f)->flag & NUM_F_FILLMODE)
 #define IS_BRACKET(_f)	((_f)->flag & NUM_F_BRACKET)
 #define IS_MINUS(_f)	((_f)->flag & NUM_F_MINUS)
 #define IS_LSIGN(_f)	((_f)->flag & NUM_F_LSIGN)
-#define IS_PLUS(_f)	((_f)->flag & NUM_F_PLUS)
+#define IS_PLUS(_f) ((_f)->flag & NUM_F_PLUS)
 #define IS_ROMAN(_f)	((_f)->flag & NUM_F_ROMAN)
 #define IS_MULTI(_f)	((_f)->flag & NUM_F_MULTI)
 
 /* ----------
  * Format picture cache
  *	(cache size:
- *		Number part	= NUM_CACHE_SIZE * NUM_CACHE_FIELDS
+ *		Number part = NUM_CACHE_SIZE * NUM_CACHE_FIELDS
  *		Date-time part	= DCH_CACHE_SIZE * DCH_CACHE_FIELDS
  *	)
  * ----------
@@ -326,25 +326,25 @@ typedef struct
 {
 	FormatNode	format[DCH_CACHE_SIZE + 1];
 	char		str[DCH_CACHE_SIZE + 1];
-	int		age;
+	int			age;
 } DCHCacheEntry;
 
 typedef struct
 {
 	FormatNode	format[NUM_CACHE_SIZE + 1];
 	char		str[NUM_CACHE_SIZE + 1];
-	int		age;
+	int			age;
 	NUMDesc		Num;
 } NUMCacheEntry;
 
 /* global cache for --- date/time part */
-static DCHCacheEntry DCHCache[DCH_CACHE_FIELDS + 1];	
+static DCHCacheEntry DCHCache[DCH_CACHE_FIELDS + 1];
 
 static int	n_DCHCache = 0;		/* number of entries */
 static int	DCHCounter = 0;
 
 /* global cache for --- number part */
-static NUMCacheEntry NUMCache[NUM_CACHE_FIELDS + 1];	
+static NUMCacheEntry NUMCache[NUM_CACHE_FIELDS + 1];
 static NUMCacheEntry *last_NUMCacheEntry;
 
 static int	n_NUMCache = 0;		/* number of entries */
@@ -356,18 +356,38 @@ static int	NUMCounter = 0;
  * For char->date/time conversion
  * ----------
  */
-typedef struct {
-	int	hh, am, pm, mi, ss, ssss, d, dd, ddd, mm, yyyy, yyy, yy, y, 
-		bc, iw, ww, w, cc, q, j;
+typedef struct
+{
+	int			hh,
+				am,
+				pm,
+				mi,
+				ss,
+				ssss,
+				d,
+				dd,
+				ddd,
+				mm,
+				yyyy,
+				yyy,
+				yy,
+				y,
+				bc,
+				iw,
+				ww,
+				w,
+				cc,
+				q,
+				j;
 } TmFromChar;
 
-#define ZERO_tmfc( _X )	\
+#define ZERO_tmfc( _X ) \
 	do { \
 		(_X)->hh= (_X)->am= (_X)->pm= (_X)->mi= (_X)->ss= (_X)->ssss= \
 		(_X)->d= (_X)->dd= (_X)->ddd= (_X)->mm= (_X)->yyyy= (_X)->yyy= \
 		(_X)->yy= (_X)->y= (_X)->bc= (_X)->iw= (_X)->ww= (_X)->w= \
 		(_X)->cc= (_X)->q= (_X)->j= 0; \
-	} while(0) 
+	} while(0)
 
 #ifdef DEBUG_TO_FROM_CHAR
 
@@ -396,8 +416,10 @@ typedef struct {
  * Private global-modul definitions
  * ----------
  */
-static struct tm _tm, *tm = &_tm;
-static TmFromChar _tmfc, *tmfc = &_tmfc;
+static struct tm _tm,
+		   *tm = &_tm;
+static TmFromChar _tmfc,
+		   *tmfc = &_tmfc;
 static char *tzn;
 
 /* ----------
@@ -620,7 +642,7 @@ static KeyWord DCH_keywords[] = {
 	{"AM", 2, dch_time, DCH_AM, FALSE},
 	{"B.C.", 4, dch_date, DCH_B_C, FALSE},		/* B */
 	{"BC", 2, dch_date, DCH_BC, FALSE},
-	{"CC", 2, dch_date, DCH_CC, TRUE},		/* C */
+	{"CC", 2, dch_date, DCH_CC, TRUE},	/* C */
 	{"DAY", 3, dch_date, DCH_DAY, FALSE},		/* D */
 	{"DDD", 3, dch_date, DCH_DDD, TRUE},
 	{"DD", 2, dch_date, DCH_DD, TRUE},
@@ -632,8 +654,8 @@ static KeyWord DCH_keywords[] = {
 	{"HH24", 4, dch_time, DCH_HH24, TRUE},		/* H */
 	{"HH12", 4, dch_time, DCH_HH12, TRUE},
 	{"HH", 2, dch_time, DCH_HH, TRUE},
-	{"IW", 2, dch_date, DCH_IW, TRUE},		/* I */	
-	{"J", 1, dch_date, DCH_J, TRUE},		/* J */
+	{"IW", 2, dch_date, DCH_IW, TRUE},	/* I */
+	{"J", 1, dch_date, DCH_J, TRUE},	/* J */
 	{"MI", 2, dch_time, DCH_MI, TRUE},
 	{"MM", 2, dch_date, DCH_MM, TRUE},
 	{"MONTH", 5, dch_date, DCH_MONTH, FALSE},
@@ -642,12 +664,12 @@ static KeyWord DCH_keywords[] = {
 	{"Mon", 3, dch_date, DCH_Mon, FALSE},
 	{"P.M.", 4, dch_time, DCH_P_M, FALSE},		/* P */
 	{"PM", 2, dch_time, DCH_PM, FALSE},
-	{"Q", 1, dch_date, DCH_Q, TRUE},		/* Q */
-	{"RM", 2, dch_date, DCH_RM, FALSE},		/* R */
-	{"SSSS", 4, dch_time, DCH_SSSS, TRUE},	/* S */
+	{"Q", 1, dch_date, DCH_Q, TRUE},	/* Q */
+	{"RM", 2, dch_date, DCH_RM, FALSE}, /* R */
+	{"SSSS", 4, dch_time, DCH_SSSS, TRUE},		/* S */
 	{"SS", 2, dch_time, DCH_SS, TRUE},
-	{"TZ", 2, dch_time, DCH_TZ, FALSE},		/* T */
-	{"WW", 2, dch_date, DCH_WW, TRUE},		/* W */
+	{"TZ", 2, dch_time, DCH_TZ, FALSE}, /* T */
+	{"WW", 2, dch_date, DCH_WW, TRUE},	/* W */
 	{"W", 1, dch_date, DCH_W, TRUE},
 	{"Y,YYY", 5, dch_date, DCH_Y_YYY, TRUE},	/* Y */
 	{"YYYY", 4, dch_date, DCH_YYYY, TRUE},
@@ -660,7 +682,7 @@ static KeyWord DCH_keywords[] = {
 	{"am", 2, dch_time, DCH_am, FALSE},
 	{"b.c.", 4, dch_date, DCH_b_c, FALSE},		/* b */
 	{"bc", 2, dch_date, DCH_bc, FALSE},
-	{"cc", 2, dch_date, DCH_CC, TRUE},		/* c */
+	{"cc", 2, dch_date, DCH_CC, TRUE},	/* c */
 	{"day", 3, dch_date, DCH_day, FALSE},		/* d */
 	{"ddd", 3, dch_date, DCH_DDD, TRUE},
 	{"dd", 2, dch_date, DCH_DD, TRUE},
@@ -670,20 +692,20 @@ static KeyWord DCH_keywords[] = {
 	{"hh24", 4, dch_time, DCH_HH24, TRUE},		/* h */
 	{"hh12", 4, dch_time, DCH_HH12, TRUE},
 	{"hh", 2, dch_time, DCH_HH, TRUE},
-	{"iw", 2, dch_date, DCH_IW, TRUE},		/* i */
-	{"j", 1, dch_time, DCH_J, TRUE},		/* j */
-	{"mi", 2, dch_time, DCH_MI, TRUE},		/* m */
+	{"iw", 2, dch_date, DCH_IW, TRUE},	/* i */
+	{"j", 1, dch_time, DCH_J, TRUE},	/* j */
+	{"mi", 2, dch_time, DCH_MI, TRUE},	/* m */
 	{"mm", 2, dch_date, DCH_MM, TRUE},
 	{"month", 5, dch_date, DCH_month, FALSE},
 	{"mon", 3, dch_date, DCH_mon, FALSE},
 	{"p.m.", 4, dch_time, DCH_p_m, FALSE},		/* p */
 	{"pm", 2, dch_time, DCH_pm, FALSE},
-	{"q", 1, dch_date, DCH_Q, TRUE},		/* q */
-	{"rm", 2, dch_date, DCH_rm, FALSE},		/* r */
-	{"ssss", 4, dch_time, DCH_SSSS, TRUE},	/* s */
+	{"q", 1, dch_date, DCH_Q, TRUE},	/* q */
+	{"rm", 2, dch_date, DCH_rm, FALSE}, /* r */
+	{"ssss", 4, dch_time, DCH_SSSS, TRUE},		/* s */
 	{"ss", 2, dch_time, DCH_SS, TRUE},
-	{"tz", 2, dch_time, DCH_tz, FALSE},		/* t */
-	{"ww", 2, dch_date, DCH_WW, TRUE},		/* w */
+	{"tz", 2, dch_time, DCH_tz, FALSE}, /* t */
+	{"ww", 2, dch_date, DCH_WW, TRUE},	/* w */
 	{"w", 1, dch_date, DCH_W, TRUE},
 	{"y,yyy", 5, dch_date, DCH_Y_YYY, TRUE},	/* y */
 	{"yyyy", 4, dch_date, DCH_YYYY, TRUE},
@@ -794,32 +816,33 @@ static int	NUM_index[KeyWord_INDEX_SIZE] = {
  */
 typedef struct NUMProc
 {
-	int		type;			/* FROM_CHAR (TO_NUMBER) or TO_CHAR */
-
-	NUMDesc    	*Num;			/* number description		*/
-
-	int		sign,			/* '-' or '+'			*/
-			sign_wrote,		/* was sign write		*/
-			sign_pos,		/* pre number sign position */
-			num_count,		/* number of write digits	*/
-			num_in,			/* is inside number		*/
-			num_curr,		/* current position in number	*/
-			num_pre,		/* space before first number	*/
-
-			read_dec,		/* to_number - was read dec. point	*/
-			read_post;		/* to_number - number of dec. digit */
-
-	char		*number,		/* string with number	*/
-			*number_p,		/* pointer to current number pozition */
-			*inout,			/* in / out buffer	*/
-			*inout_p,		/* pointer to current inout pozition */
-			*last_relevant,		/* last relevant number after decimal point */
-
-			*L_negative_sign,/* Locale */
-			*L_positive_sign,
-			*decimal,
-			*L_thousands_sep,
-			*L_currency_symbol;
+	int			type;			/* FROM_CHAR (TO_NUMBER) or TO_CHAR */
+
+	NUMDesc    *Num;			/* number description		*/
+
+	int			sign,			/* '-' or '+'			*/
+				sign_wrote,		/* was sign write		*/
+				sign_pos,		/* pre number sign position */
+				num_count,		/* number of write digits	*/
+				num_in,			/* is inside number		*/
+				num_curr,		/* current position in number	*/
+				num_pre,		/* space before first number	*/
+
+				read_dec,		/* to_number - was read dec. point	*/
+				read_post;		/* to_number - number of dec. digit */
+
+	char	   *number,			/* string with number	*/
+			   *number_p,		/* pointer to current number pozition */
+			   *inout,			/* in / out buffer	*/
+			   *inout_p,		/* pointer to current inout pozition */
+			   *last_relevant,	/* last relevant number after decimal
+								 * point */
+
+			   *L_negative_sign,/* Locale */
+			   *L_positive_sign,
+			   *decimal,
+			   *L_thousands_sep,
+			   *L_currency_symbol;
 } NUMProc;
 
 
@@ -1093,11 +1116,11 @@ static void
 parse_format(FormatNode *node, char *str, KeyWord *kw,
 			 KeySuffix *suf, int *index, int ver, NUMDesc *Num)
 {
-	KeySuffix	*s;
-	FormatNode	*n;
-	int		node_set = 0,
-			suffix,
-			last = 0;
+	KeySuffix  *s;
+	FormatNode *n;
+	int			node_set = 0,
+				suffix,
+				last = 0;
 
 #ifdef DEBUG_TO_FROM_CHAR
 	elog(DEBUG_elog_output, "to_char/number(): run parser.");
@@ -1245,7 +1268,7 @@ DCH_processor(FormatNode *node, char *inout, int flag)
 	{
 		if (n->type == NODE_TYPE_ACTION)
 		{
-			int	len;
+			int			len;
 
 			/* ----------
 			 * Call node action function
@@ -1274,7 +1297,7 @@ DCH_processor(FormatNode *node, char *inout, int flag)
 				 * Skip blank space in FROM_CHAR's input
 				 * ----------
 				 */
-		        	if (isspace((unsigned char) n->character) && IS_FX == 0)
+				if (isspace((unsigned char) n->character) && IS_FX == 0)
 				{
 					while (*s != '\0' && isspace((unsigned char) *(s + 1)))
 						++s;
@@ -1341,18 +1364,19 @@ dump_node(FormatNode *node, int max)
 static char *
 get_th(char *num, int type)
 {
-	int	len = strlen(num),
-		last, seclast;
+	int			len = strlen(num),
+				last,
+				seclast;
 
 	last = *(num + (len - 1));
 	if (!isdigit((unsigned char) last))
 		elog(ERROR, "get_th: '%s' is not number.", num);
 
 	/*
-	 * All "teens" (<x>1[0-9]) get 'TH/th',
-	 * while <x>[02-9][123] still get 'ST/st', 'ND/nd', 'RD/rd', respectively
+	 * All "teens" (<x>1[0-9]) get 'TH/th', while <x>[02-9][123] still get
+	 * 'ST/st', 'ND/nd', 'RD/rd', respectively
 	 */
-	if ((len > 1) && ((seclast = num[len-2]) == '1'))
+	if ((len > 1) && ((seclast = num[len - 2]) == '1'))
 		last = 0;
 
 	switch (last)
@@ -1442,11 +1466,11 @@ str_tolower(char *buff)
 static int
 seq_search(char *name, char **array, int type, int max, int *len)
 {
-	char	*p,
-		*n,
-		**a;
-	int	last,
-		i;
+	char	   *p,
+			   *n,
+			  **a;
+	int			last,
+				i;
 
 	*len = 0;
 
@@ -1522,9 +1546,9 @@ seq_search(char *name, char **array, int type, int max, int *len)
 static void
 dump_index(KeyWord *k, int *index)
 {
-	int	i,
-		count = 0,
-		free_i = 0;
+	int			i,
+				count = 0,
+				free_i = 0;
 
 	elog(DEBUG_elog_output, "TO-FROM_CHAR: Dump KeyWord Index:");
 
@@ -1563,9 +1587,9 @@ dch_global(int arg, char *inout, int suf, int flag, FormatNode *node)
 {
 	switch (arg)
 	{
-		case DCH_FX:
-		DCH_global_flag |= DCH_F_FX;
-		break;
+			case DCH_FX:
+			DCH_global_flag |= DCH_F_FX;
+			break;
 	}
 	return -1;
 }
@@ -1579,29 +1603,29 @@ is_next_separator(FormatNode *n)
 {
 	if (n->type == NODE_TYPE_END)
 		return FALSE;
-	
+
 	if (n->type == NODE_TYPE_ACTION && S_THth(n->suffix))
 		return TRUE;
-	
-	/* 
-	 * Next node 
+
+	/*
+	 * Next node
 	 */
-	n++;	
-	
+	n++;
+
 	if (n->type == NODE_TYPE_END)
 		return FALSE;
-	
+
 	if (n->type == NODE_TYPE_ACTION)
 	{
 		if (n->key->isitdigit)
 			return FALSE;
-	
-		return TRUE;	
-	} 
+
+		return TRUE;
+	}
 	else if (isdigit((unsigned char) n->character))
 		return FALSE;
-	
-	return TRUE;		/* some non-digit input (separator) */	
+
+	return TRUE;				/* some non-digit input (separator) */
 }
 
 #define AMPM_ERROR	elog(ERROR, "to_timestamp(): bad AM/PM string")
@@ -1619,12 +1643,12 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 
 	switch (arg)
 	{
-		case DCH_A_M:	
+		case DCH_A_M:
 		case DCH_P_M:
 			if (flag == TO_CHAR)
 			{
-				strcpy(inout, ((tm->tm_hour > 11 
-					&& tm->tm_hour < 24) ? P_M_STR : A_M_STR));
+				strcpy(inout, ((tm->tm_hour > 11
+							  && tm->tm_hour < 24) ? P_M_STR : A_M_STR));
 				return 3;
 			}
 			else if (flag == FROM_CHAR)
@@ -1632,9 +1656,9 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 				if (strncmp(inout, P_M_STR, 4) == 0)
 					tmfc->pm = TRUE;
 				else if (strncmp(inout, A_M_STR, 4) == 0)
-					tmfc->am = TRUE;	
+					tmfc->am = TRUE;
 				else
-					AMPM_ERROR;	
+					AMPM_ERROR;
 				return 3;
 			}
 			break;
@@ -1642,8 +1666,8 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 		case DCH_PM:
 			if (flag == TO_CHAR)
 			{
-				strcpy(inout, ((tm->tm_hour > 11 
-					&& tm->tm_hour < 24) ? PM_STR : AM_STR));
+				strcpy(inout, ((tm->tm_hour > 11
+								&& tm->tm_hour < 24) ? PM_STR : AM_STR));
 				return 1;
 			}
 			else if (flag == FROM_CHAR)
@@ -1653,7 +1677,7 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 				else if (strncmp(inout, AM_STR, 2) == 0)
 					tmfc->am = TRUE;
 				else
-					AMPM_ERROR;	
+					AMPM_ERROR;
 				return 1;
 			}
 			break;
@@ -1661,8 +1685,8 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 		case DCH_p_m:
 			if (flag == TO_CHAR)
 			{
-				strcpy(inout, ((tm->tm_hour > 11 
-					&& tm->tm_hour < 24) ? p_m_STR : a_m_STR));
+				strcpy(inout, ((tm->tm_hour > 11
+							  && tm->tm_hour < 24) ? p_m_STR : a_m_STR));
 				return 3;
 			}
 			else if (flag == FROM_CHAR)
@@ -1672,7 +1696,7 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 				else if (strncmp(inout, a_m_STR, 4) == 0)
 					tmfc->am = TRUE;
 				else
-					AMPM_ERROR;	
+					AMPM_ERROR;
 				return 3;
 			}
 			break;
@@ -1681,7 +1705,7 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 			if (flag == TO_CHAR)
 			{
 				strcpy(inout, ((tm->tm_hour > 11
-					&& tm->tm_hour < 24) ? pm_STR : am_STR));
+								&& tm->tm_hour < 24) ? pm_STR : am_STR));
 				return 1;
 			}
 			else if (flag == FROM_CHAR)
@@ -1691,7 +1715,7 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 				else if (strncmp(inout, am_STR, 2) == 0)
 					tmfc->am = TRUE;
 				else
-					AMPM_ERROR;	
+					AMPM_ERROR;
 				return 1;
 			}
 			break;
@@ -1812,12 +1836,12 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 					str_numth(p_inout, inout, S_TH_TYPE(suf));
 				return strlen(p_inout) - 1;
 			}
-			else if (flag == FROM_CHAR) 
+			else if (flag == FROM_CHAR)
 			{
 				if (is_next_separator(node))
 					sscanf(inout, "%d", &tmfc->ssss);
 				else
-					sscanf(inout, "%05d", &tmfc->ssss);	
+					sscanf(inout, "%05d", &tmfc->ssss);
 				return int4len((int4) tmfc->ssss) - 1 + SKIP_THth(suf);
 			}
 			break;
@@ -1825,24 +1849,22 @@ dch_time(int arg, char *inout, int suf, int flag, FormatNode *node)
 		case DCH_TZ:
 			if (flag == TO_CHAR && tzn)
 			{
-				int siz = strlen(tzn);
-				
+				int			siz = strlen(tzn);
+
 				if (arg == DCH_TZ)
 					strcpy(inout, tzn);
-				else 
+				else
 				{
-					char *p = palloc(siz);
-					
+					char	   *p = palloc(siz);
+
 					strcpy(p, tzn);
 					strcpy(inout, str_tolower(p));
 					pfree(p);
 				}
 				return siz - 1;
-			} 
-			else if (flag == FROM_CHAR) 
-			{
+			}
+			else if (flag == FROM_CHAR)
 				elog(ERROR, "to_timestamp(): TZ/tz not supported.");
-			}	
 	}
 	return -1;
 }
@@ -1864,10 +1886,10 @@ do { \
 static int
 dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 {
-	char	buff[DCH_CACHE_SIZE],
-		*p_inout;
-	int	i,
-		len;
+	char		buff[DCH_CACHE_SIZE],
+			   *p_inout;
+	int			i,
+				len;
 
 	p_inout = inout;
 
@@ -1881,7 +1903,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 	{
 		if (arg == DCH_MONTH || arg == DCH_Month || arg == DCH_month)
 		{
-			tmfc->mm = seq_search(inout, months_full, ONE_UPPER, FULL_SIZ, &len) +1;
+			tmfc->mm = seq_search(inout, months_full, ONE_UPPER, FULL_SIZ, &len) + 1;
 			CHECK_SEQ_SEARCH(len, "MONTH/Month/month");
 			if (S_FM(suf))
 				return len - 1;
@@ -1891,7 +1913,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 		}
 		else if (arg == DCH_MON || arg == DCH_Mon || arg == DCH_mon)
 		{
-			tmfc->mm = seq_search(inout, months, ONE_UPPER, MAX_MON_LEN, &len) +1;
+			tmfc->mm = seq_search(inout, months, ONE_UPPER, MAX_MON_LEN, &len) + 1;
 			CHECK_SEQ_SEARCH(len, "MON/Mon/mon");
 			return 2;
 		}
@@ -1983,14 +2005,14 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 				return strlen(p_inout) - 1;
 			else
 				return 8;
-			
+
 		case DCH_Month:
 			sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]);
 			if (S_FM(suf))
 				return strlen(p_inout) - 1;
 			else
 				return 8;
-			
+
 		case DCH_month:
 			sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]);
 			*inout = tolower((unsigned char) *inout);
@@ -1998,12 +2020,12 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 				return strlen(p_inout) - 1;
 			else
 				return 8;
-			
+
 		case DCH_MON:
 			strcpy(inout, months[tm->tm_mon - 1]);
 			inout = str_toupper(inout);
 			return 2;
-			
+
 		case DCH_Mon:
 			strcpy(inout, months[tm->tm_mon - 1]);
 			return 2;
@@ -2149,7 +2171,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 			if (flag == TO_CHAR)
 			{
 				sprintf(inout, "%0*d", S_FM(suf) ? 0 : 2,
-						(tm->tm_yday-1) / 7 + 1);
+						(tm->tm_yday - 1) / 7 + 1);
 				if (S_THth(suf))
 					str_numth(p_inout, inout, S_TH_TYPE(suf));
 				if (S_FM(suf) || S_THth(suf))
@@ -2158,7 +2180,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 					return 1;
 
 			}
-			else if (flag == FROM_CHAR) 
+			else if (flag == FROM_CHAR)
 			{
 				if (S_FM(suf))
 				{
@@ -2176,7 +2198,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 			if (flag == TO_CHAR)
 			{
 				sprintf(inout, "%0*d", S_FM(suf) ? 0 : 2,
-					date2isoweek(tm->tm_year, tm->tm_mon, tm->tm_mday));
+					 date2isoweek(tm->tm_year, tm->tm_mon, tm->tm_mday));
 				if (S_THth(suf))
 					str_numth(p_inout, inout, S_TH_TYPE(suf));
 				if (S_FM(suf) || S_THth(suf))
@@ -2185,7 +2207,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 					return 1;
 
 			}
-			else if (flag == FROM_CHAR) 
+			else if (flag == FROM_CHAR)
 			{
 				if (S_FM(suf))
 				{
@@ -2198,7 +2220,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 					return 1 + SKIP_THth(suf);
 				}
 			}
-			break;	
+			break;
 		case DCH_Q:
 			if (flag == TO_CHAR)
 			{
@@ -2233,7 +2255,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 			else if (flag == FROM_CHAR)
 			{
 				sscanf(inout, "%d", &tmfc->cc);
-				return int4len((int4) tmfc->cc) + SKIP_THth(suf) -1;
+				return int4len((int4) tmfc->cc) + SKIP_THth(suf) - 1;
 			}
 			break;
 		case DCH_Y_YYY:
@@ -2277,7 +2299,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 					sscanf(inout, "%d", &tmfc->yyyy);
 				else
 					sscanf(inout, "%04d", &tmfc->yyyy);
-						
+
 				if (!S_FM(suf) && tmfc->yyyy <= 9999 && tmfc->yyyy >= -9999)
 					len = 4;
 				else
@@ -2391,7 +2413,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 		case DCH_W:
 			if (flag == TO_CHAR)
 			{
-				sprintf(inout, "%d", (tm->tm_mday-1) / 7 + 1);
+				sprintf(inout, "%d", (tm->tm_mday - 1) / 7 + 1);
 				if (S_THth(suf))
 				{
 					str_numth(p_inout, inout, S_TH_TYPE(suf));
@@ -2416,7 +2438,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
 			else if (flag == FROM_CHAR)
 			{
 				sscanf(inout, "%d", &tmfc->j);
-				return int4len((int4) tmfc->j) + SKIP_THth(suf) -1;
+				return int4len((int4) tmfc->j) + SKIP_THth(suf) - 1;
 			}
 			break;
 	}
@@ -2522,24 +2544,24 @@ Datum
 timestamp_to_char(PG_FUNCTION_ARGS)
 {
 	Timestamp	dt = PG_GETARG_TIMESTAMP(0);
-	text		*fmt = PG_GETARG_TEXT_P(1);
-	text		*result,
-			*result_tmp;
-			
-	FormatNode	*format;
-	char		*str;
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	text	   *result,
+			   *result_tmp;
+
+	FormatNode *format;
+	char	   *str;
 	double		fsec;
-	int		len = 0,
-			tz,
-			flag = 0,
-			x = 0;
+	int			len = 0,
+				tz,
+				flag = 0,
+				x = 0;
 
 	len = VARSIZE(fmt) - VARHDRSZ;
 
 	if (len <= 0 || TIMESTAMP_NOT_FINITE(dt))
 		PG_RETURN_NULL();
 
-	ZERO_tm(tm);	
+	ZERO_tm(tm);
 	tzn = NULL;
 
 	if (TIMESTAMP_IS_EPOCH(dt))
@@ -2613,7 +2635,7 @@ timestamp_to_char(PG_FUNCTION_ARGS)
 			 * ----------
 			 */
 			parse_format(ent->format, str, DCH_keywords,
-					 DCH_suff, DCH_index, DCH_TYPE, NULL);
+						 DCH_suff, DCH_index, DCH_TYPE, NULL);
 
 			(ent->format + len)->type = NODE_TYPE_END;	/* Paranoa? */
 
@@ -2642,7 +2664,7 @@ timestamp_to_char(PG_FUNCTION_ARGS)
 		pfree(result);
 		PG_RETURN_NULL();
 	}
-	
+
 	result_tmp = result;
 	result = (text *) palloc(len + 1 + VARHDRSZ);
 
@@ -2664,13 +2686,13 @@ timestamp_to_char(PG_FUNCTION_ARGS)
 Datum
 to_timestamp(PG_FUNCTION_ARGS)
 {
-	text		*date_txt = PG_GETARG_TEXT_P(0);
-	text		*fmt = PG_GETARG_TEXT_P(1);
-	FormatNode	*format;
-	int		flag = 0;
+	text	   *date_txt = PG_GETARG_TEXT_P(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	FormatNode *format;
+	int			flag = 0;
 	Timestamp	result;
-	char		*str;
-	char		*date_str;
+	char	   *str;
+	char	   *date_str;
 	int			len,
 				date_len,
 				fsec = 0,
@@ -2766,16 +2788,16 @@ to_timestamp(PG_FUNCTION_ARGS)
 	}
 
 	/* --------------------------------------------------------------
-	 * Convert values that user define for FROM_CHAR (to_date/to_timestamp) 
+	 * Convert values that user define for FROM_CHAR (to_date/to_timestamp)
 	 * to standard 'tm'
 	 * ----------
-	 */	
+	 */
 #ifdef DEBUG_TO_FROM_CHAR
 	NOTICE_TMFC;
-#endif	
-	if (tmfc->ssss) 
+#endif
+	if (tmfc->ssss)
 	{
-		int		x = tmfc->ssss;
+		int			x = tmfc->ssss;
 
 		tm->tm_hour = x / 3600;
 		x %= 3600;
@@ -2785,128 +2807,148 @@ to_timestamp(PG_FUNCTION_ARGS)
 	}
 
 	if (tmfc->cc)
-		tm->tm_year = (tmfc->cc-1) * 100;
+		tm->tm_year = (tmfc->cc - 1) * 100;
 
-	if (tmfc->ww) 
+	if (tmfc->ww)
 		tmfc->ddd = (tmfc->ww - 1) * 7 + 1;
 
-	if (tmfc->w) 
+	if (tmfc->w)
 		tmfc->dd = (tmfc->w - 1) * 7 + 1;
 
-	if (tmfc->ss)	tm->tm_sec = tmfc->ss;
-	if (tmfc->mi)	tm->tm_min = tmfc->mi;
-	if (tmfc->hh)	tm->tm_hour = tmfc->hh;
-	
-	if (tmfc->pm || tmfc->am) 
-	{ 
-		if (tm->tm_hour < 1 || tm->tm_hour > 12) 
-			elog(ERROR, "to_timestamp(): AM/PM hour must be between 1 and 12"); 
-		
+	if (tmfc->ss)
+		tm->tm_sec = tmfc->ss;
+	if (tmfc->mi)
+		tm->tm_min = tmfc->mi;
+	if (tmfc->hh)
+		tm->tm_hour = tmfc->hh;
+
+	if (tmfc->pm || tmfc->am)
+	{
+		if (tm->tm_hour < 1 || tm->tm_hour > 12)
+			elog(ERROR, "to_timestamp(): AM/PM hour must be between 1 and 12");
+
 		if (tmfc->pm && tm->tm_hour < 12)
 			tm->tm_hour += 12;
-			
+
 		else if (tmfc->am && tm->tm_hour == 12)
-			tm->tm_hour = 0;	
-	} 
+			tm->tm_hour = 0;
+	}
 
-	switch (tmfc->q) 
+	switch (tmfc->q)
 	{
-		case 1:	tm->tm_mday = 1; tm->tm_mon = 1;  break;
-		case 2:	tm->tm_mday = 1; tm->tm_mon = 4;  break;
-		case 3:	tm->tm_mday = 1; tm->tm_mon = 7;  break;
-		case 4:	tm->tm_mday = 1; tm->tm_mon = 10; break;
+		case 1:
+			tm->tm_mday = 1;
+			tm->tm_mon = 1;
+			break;
+		case 2:
+			tm->tm_mday = 1;
+			tm->tm_mon = 4;
+			break;
+		case 3:
+			tm->tm_mday = 1;
+			tm->tm_mon = 7;
+			break;
+		case 4:
+			tm->tm_mday = 1;
+			tm->tm_mon = 10;
+			break;
 	}
-	
-	if (tmfc->yyyy)	
+
+	if (tmfc->yyyy)
 		tm->tm_year = tmfc->yyyy;
 
 	else if (tmfc->y)
 	{
+
 		/*
-		 * 1-digit year:
-		 *	always +2000
+		 * 1-digit year: always +2000
 		 */
-		tm->tm_year = tmfc->y + 2000;	
-	}	
+		tm->tm_year = tmfc->y + 2000;
+	}
 	else if (tmfc->yy)
 	{
+
 		/*
-		 * 2-digit year:
-		 *	'00' ... '69'  = 2000 ... 2069
-		 *	'70' ... '99'  = 1970 ... 1999
-		 */	
+		 * 2-digit year: '00' ... '69'	= 2000 ... 2069 '70' ... '99'  =
+		 * 1970 ... 1999
+		 */
 		tm->tm_year = tmfc->yy;
-	
+
 		if (tm->tm_year < 70)
 			tm->tm_year += 2000;
-		else 
+		else
 			tm->tm_year += 1900;
 	}
 	else if (tmfc->yyy)
 	{
+
 		/*
-		 * 3-digit year:
-		 *	'100' ... '999' = 1100 ... 1999
-		 *	'000' ... '099' = 2000 ... 2099
+		 * 3-digit year: '100' ... '999' = 1100 ... 1999 '000' ... '099' =
+		 * 2000 ... 2099
 		 */
 		tm->tm_year = tmfc->yyy;
-	
+
 		if (tm->tm_year >= 100)
 			tm->tm_year += 1000;
-		else 
+		else
 			tm->tm_year += 2000;
 	}
 
-		
+
 	if (tmfc->bc)
 	{
 		if (tm->tm_year > 0)
 			tm->tm_year = -(tm->tm_year - 1);
 		else
 			elog(ERROR, "Inconsistant use of year %04d and 'BC'", tm->tm_year);
-	}	
-	
+	}
+
 	if (tmfc->j)
 		j2date(tmfc->j, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
-	
+
 	if (tmfc->iw)
 		isoweek2date(tmfc->iw, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
-		
-	if (tmfc->d)	tm->tm_wday = tmfc->d;
-	if (tmfc->dd)	tm->tm_mday = tmfc->dd;	
-	if (tmfc->ddd)	tm->tm_yday = tmfc->ddd;
-	if (tmfc->mm)	tm->tm_mon  = tmfc->mm;	
+
+	if (tmfc->d)
+		tm->tm_wday = tmfc->d;
+	if (tmfc->dd)
+		tm->tm_mday = tmfc->dd;
+	if (tmfc->ddd)
+		tm->tm_yday = tmfc->ddd;
+	if (tmfc->mm)
+		tm->tm_mon = tmfc->mm;
 
 	/*
 	 * we not ignore DDD
 	 */
-	if (tmfc->ddd && (tm->tm_mon <=1 || tm->tm_mday <=1))
+	if (tmfc->ddd && (tm->tm_mon <= 1 || tm->tm_mday <= 1))
 	{
 		/* count mday and mon from yday */
-		int *y, i;
-		
-		int ysum[2][13] = {
-    		{ 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 0 },
-    		{ 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 0 }};
-    		
- 		if (!tm->tm_year)
- 			elog(ERROR, "to_timestamp() cat't convert yday without year information");
- 		
- 		y = ysum[ isleap(tm->tm_year) ];	
- 			
- 		for (i=0; i <= 11; i++) 
- 		{
-			if (tm->tm_yday < y[i]) 
+		int		   *y,
+					i;
+
+		int			ysum[2][13] = {
+			{31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 0},
+		{31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 0}};
+
+		if (!tm->tm_year)
+			elog(ERROR, "to_timestamp() cat't convert yday without year information");
+
+		y = ysum[isleap(tm->tm_year)];
+
+		for (i = 0; i <= 11; i++)
+		{
+			if (tm->tm_yday < y[i])
 				break;
- 		}
- 		if (tm->tm_mon <=1)
- 			tm->tm_mon = i+1;
- 		
- 		if (tm->tm_mday <=1)
- 			tm->tm_mday = i == 0 ?	tm->tm_yday :
- 						tm->tm_yday - y[i-1];
+		}
+		if (tm->tm_mon <= 1)
+			tm->tm_mon = i + 1;
+
+		if (tm->tm_mday <= 1)
+			tm->tm_mday = i == 0 ? tm->tm_yday :
+				tm->tm_yday - y[i - 1];
 	}
-	
+
 	/* -------------------------------------------------------------- */
 
 #ifdef DEBUG_TO_FROM_CHAR
@@ -2920,21 +2962,21 @@ to_timestamp(PG_FUNCTION_ARGS)
 		tm->tm_year -= 1900;
 		tm->tm_mon -= 1;
 
-# ifdef DEBUG_TO_FROM_CHAR
+#ifdef DEBUG_TO_FROM_CHAR
 		elog(DEBUG_elog_output, "TO-FROM_CHAR: Call mktime()");
 		NOTICE_TM;
-# endif
+#endif
 		mktime(tm);
 		tm->tm_year += 1900;
 		tm->tm_mon += 1;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 		tz = -(tm->tm_gmtoff);	/* tm_gmtoff is Sun/DEC-ism */
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 		tz = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-# endif
+#endif
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 		tz = CTimeZone;
 #endif
 	}
@@ -2960,8 +3002,10 @@ to_timestamp(PG_FUNCTION_ARGS)
 Datum
 to_date(PG_FUNCTION_ARGS)
 {
-	/* Quick hack: since our inputs are just like to_timestamp,
-	 * hand over the whole input info struct...
+
+	/*
+	 * Quick hack: since our inputs are just like to_timestamp, hand over
+	 * the whole input info struct...
 	 */
 	return DirectFunctionCall1(timestamp_date, to_timestamp(fcinfo));
 }
@@ -2985,7 +3029,7 @@ do { \
 	(_n)->lsign		= 0;	\
 	(_n)->pre		= 0;	\
 	(_n)->post		= 0;	\
-	(_n)->pre_lsign_num	= 0;	\
+	(_n)->pre_lsign_num = 0;	\
 	(_n)->need_locale	= 0;	\
 	(_n)->multi		= 0;	\
 	(_n)->zero_start	= 0;	\
@@ -3021,10 +3065,11 @@ NUM_cache_getnew(char *str)
 
 		for (ent = NUMCache; ent <= (NUMCache + NUM_CACHE_FIELDS); ent++)
 		{
-			/* entry removed via NUM_cache_remove()
-			 * can be used here
+
+			/*
+			 * entry removed via NUM_cache_remove() can be used here
 			 */
-			if (*ent->str == '\0')  
+			if (*ent->str == '\0')
 			{
 				old = ent;
 				break;
@@ -3063,7 +3108,7 @@ NUM_cache_getnew(char *str)
 static NUMCacheEntry *
 NUM_cache_search(char *str)
 {
-	int i = 0;
+	int			i = 0;
 	NUMCacheEntry *ent;
 
 	/* counter overload check  - paranoa? */
@@ -3196,12 +3241,12 @@ NUM_cache(int len, NUMDesc *Num, char *pars_str, int *flag)
 static char *
 int_to_roman(int number)
 {
-	int	len = 0,
-		num = 0,
-		set = 0;
-	char	*p = NULL,
-		*result,
-		numstr[5];
+	int			len = 0,
+				num = 0,
+				set = 0;
+	char	   *p = NULL,
+			   *result,
+				numstr[5];
 
 	result = (char *) palloc(16);
 	*result = '\0';
@@ -3336,7 +3381,7 @@ static char *
 get_last_relevant_decnum(char *num)
 {
 	char	   *result,
-		   *p = strchr(num, '.');
+			   *p = strchr(num, '.');
 
 #ifdef DEBUG_TO_FROM_CHAR
 	elog(DEBUG_elog_output, "CALL: get_last_relevant_decnum()");
@@ -3483,7 +3528,7 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
 		}
 		else
 		{
-			int	x = strlen(Np->decimal);
+			int			x = strlen(Np->decimal);
 
 #ifdef DEBUG_TO_FROM_CHAR
 			elog(DEBUG_elog_output, "Try read locale point (%c).", *Np->inout_p);
@@ -3716,8 +3761,8 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
 			  int plen, int sign, int type)
 {
 	FormatNode *n;
-	NUMProc	_Np,
-		*Np = &_Np;
+	NUMProc		_Np,
+			   *Np = &_Np;
 
 	Np->Num = Num;
 	Np->type = type;
@@ -3802,9 +3847,9 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
 		{
 			if (IS_DECIMAL(Np->Num))
 				Np->last_relevant = get_last_relevant_decnum(
-							Np->number +
-							((Np->Num->zero_end - Np->num_pre > 0) ?
-							 Np->Num->zero_end - Np->num_pre : 0));
+															 Np->number +
+								 ((Np->Num->zero_end - Np->num_pre > 0) ?
+								  Np->Num->zero_end - Np->num_pre : 0));
 		}
 
 		if (!Np->sign_wrote && Np->num_pre == 0)
@@ -4168,7 +4213,7 @@ do { \
 	if (flag)							\
 		pfree(format);						\
 									\
-	/* ----------							\
+	/* ----------						  \
 	 * for result is allocated max memory, which current format-picture\
 	 * needs, now it must be re-allocate to result real size	\
 	 * ----------							\
@@ -4194,16 +4239,16 @@ do { \
 Datum
 numeric_to_number(PG_FUNCTION_ARGS)
 {
-	text	*value = PG_GETARG_TEXT_P(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
-	Datum	result;
+	text	   *value = PG_GETARG_TEXT_P(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
+	Datum		result;
 	FormatNode *format;
-	char	*numstr;
-	int	flag = 0;
-	int	len = 0;
-	int	scale,
-		precision;
+	char	   *numstr;
+	int			flag = 0;
+	int			len = 0;
+	int			scale,
+				precision;
 
 	len = VARSIZE(fmt) - VARHDRSZ;
 
@@ -4224,9 +4269,9 @@ numeric_to_number(PG_FUNCTION_ARGS)
 		pfree(format);
 
 	result = DirectFunctionCall3(numeric_in,
-			 CStringGetDatum(numstr),
-			 ObjectIdGetDatum(InvalidOid),
-			 Int32GetDatum(((precision << 16) | scale) + VARHDRSZ));
+								 CStringGetDatum(numstr),
+								 ObjectIdGetDatum(InvalidOid),
+				  Int32GetDatum(((precision << 16) | scale) + VARHDRSZ));
 	pfree(numstr);
 	return result;
 }
@@ -4238,20 +4283,20 @@ numeric_to_number(PG_FUNCTION_ARGS)
 Datum
 numeric_to_char(PG_FUNCTION_ARGS)
 {
-	Numeric	value = PG_GETARG_NUMERIC(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
+	Numeric		value = PG_GETARG_NUMERIC(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
 	FormatNode *format;
-	text	*result,
-		*result_tmp;
-	int	flag = 0;
-	int	len = 0,
-		plen = 0,
-		sign = 0;
-	char	*numstr,
-		*orgnum,
-		*p;
-	Numeric	x;
+	text	   *result,
+			   *result_tmp;
+	int			flag = 0;
+	int			len = 0,
+				plen = 0,
+				sign = 0;
+	char	   *numstr,
+			   *orgnum,
+			   *p;
+	Numeric		x;
 
 	NUM_TOCHAR_prepare;
 
@@ -4262,11 +4307,11 @@ numeric_to_char(PG_FUNCTION_ARGS)
 	if (IS_ROMAN(&Num))
 	{
 		x = DatumGetNumeric(DirectFunctionCall2(numeric_round,
-					NumericGetDatum(value),
-					Int32GetDatum(0)));
+												NumericGetDatum(value),
+												Int32GetDatum(0)));
 		numstr = orgnum =
 			int_to_roman(DatumGetInt32(DirectFunctionCall1(numeric_int4,
-													NumericGetDatum(x))));
+												   NumericGetDatum(x))));
 		pfree(x);
 	}
 	else
@@ -4276,16 +4321,16 @@ numeric_to_char(PG_FUNCTION_ARGS)
 		if (IS_MULTI(&Num))
 		{
 			Numeric		a = DatumGetNumeric(DirectFunctionCall1(int4_numeric,
-							Int32GetDatum(10)));
+													 Int32GetDatum(10)));
 			Numeric		b = DatumGetNumeric(DirectFunctionCall1(int4_numeric,
-							Int32GetDatum(Num.multi)));
+											  Int32GetDatum(Num.multi)));
 
 			x = DatumGetNumeric(DirectFunctionCall2(numeric_power,
 													NumericGetDatum(a),
 													NumericGetDatum(b)));
 			val = DatumGetNumeric(DirectFunctionCall2(numeric_mul,
-													  NumericGetDatum(value),
-													  NumericGetDatum(x)));
+												  NumericGetDatum(value),
+													NumericGetDatum(x)));
 			pfree(x);
 			pfree(a);
 			pfree(b);
@@ -4293,10 +4338,10 @@ numeric_to_char(PG_FUNCTION_ARGS)
 		}
 
 		x = DatumGetNumeric(DirectFunctionCall2(numeric_round,
-						NumericGetDatum(val),
-						Int32GetDatum(Num.post)));
+												NumericGetDatum(val),
+												Int32GetDatum(Num.post)));
 		orgnum = DatumGetCString(DirectFunctionCall1(numeric_out,
-						 NumericGetDatum(x)));
+													 NumericGetDatum(x)));
 		pfree(x);
 
 		if (*orgnum == '-')
@@ -4339,18 +4384,18 @@ numeric_to_char(PG_FUNCTION_ARGS)
 Datum
 int4_to_char(PG_FUNCTION_ARGS)
 {
-	int32	value = PG_GETARG_INT32(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
+	int32		value = PG_GETARG_INT32(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
 	FormatNode *format;
-	text	*result,
-		*result_tmp;
-	int	flag = 0;
-	int	len = 0,
-		plen = 0,
-		sign = 0;
-	char	*numstr,
-		*orgnum;
+	text	   *result,
+			   *result_tmp;
+	int			flag = 0;
+	int			len = 0,
+				plen = 0,
+				sign = 0;
+	char	   *numstr,
+			   *orgnum;
 
 	NUM_TOCHAR_prepare;
 
@@ -4359,21 +4404,19 @@ int4_to_char(PG_FUNCTION_ARGS)
 	 * ----------
 	 */
 	if (IS_ROMAN(&Num))
-	{
 		numstr = orgnum = int_to_roman(value);
-	}
 	else
 	{
 		if (IS_MULTI(&Num))
 		{
 			orgnum = DatumGetCString(DirectFunctionCall1(int4out,
-					Int32GetDatum(value * ((int32) pow((double) 10, (double) Num.multi)))));
+														 Int32GetDatum(value * ((int32) pow((double) 10, (double) Num.multi)))));
 			Num.pre += Num.multi;
 		}
 		else
 		{
 			orgnum = DatumGetCString(DirectFunctionCall1(int4out,
-					 Int32GetDatum(value)));
+												  Int32GetDatum(value)));
 		}
 		len = strlen(orgnum);
 
@@ -4387,7 +4430,7 @@ int4_to_char(PG_FUNCTION_ARGS)
 
 		if (Num.post)
 		{
-			int	i;
+			int			i;
 
 			numstr = (char *) palloc(len + Num.post + 2);
 			strcpy(numstr, orgnum + (*orgnum == '-' ? 1 : 0));
@@ -4423,18 +4466,18 @@ int4_to_char(PG_FUNCTION_ARGS)
 Datum
 int8_to_char(PG_FUNCTION_ARGS)
 {
-	int64	value = PG_GETARG_INT64(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
+	int64		value = PG_GETARG_INT64(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
 	FormatNode *format;
-	text	*result,
-		*result_tmp;
-	int	flag = 0;
-	int	len = 0,
-		plen = 0,
-		sign = 0;
-	char	*numstr,
-		*orgnum;
+	text	   *result,
+			   *result_tmp;
+	int			flag = 0;
+	int			len = 0,
+				plen = 0,
+				sign = 0;
+	char	   *numstr,
+			   *orgnum;
 
 	NUM_TOCHAR_prepare;
 
@@ -4446,7 +4489,7 @@ int8_to_char(PG_FUNCTION_ARGS)
 	{
 		/* Currently don't support int8 conversion to roman... */
 		numstr = orgnum = int_to_roman(DatumGetInt32(
-			DirectFunctionCall1(int84, Int64GetDatum(value))));
+					  DirectFunctionCall1(int84, Int64GetDatum(value))));
 	}
 	else
 	{
@@ -4455,14 +4498,14 @@ int8_to_char(PG_FUNCTION_ARGS)
 			double		multi = pow((double) 10, (double) Num.multi);
 
 			value = DatumGetInt64(DirectFunctionCall2(int8mul,
-						  Int64GetDatum(value),
-						  DirectFunctionCall1(dtoi8,
-						  Float8GetDatum(multi))));
+													Int64GetDatum(value),
+											   DirectFunctionCall1(dtoi8,
+												Float8GetDatum(multi))));
 			Num.pre += Num.multi;
 		}
 
 		orgnum = DatumGetCString(DirectFunctionCall1(int8out,
-						 Int64GetDatum(value)));
+												  Int64GetDatum(value)));
 		len = strlen(orgnum);
 
 		if (*orgnum == '-')
@@ -4475,7 +4518,7 @@ int8_to_char(PG_FUNCTION_ARGS)
 
 		if (Num.post)
 		{
-			int	i;
+			int			i;
 
 			numstr = (char *) palloc(len + Num.post + 2);
 			strcpy(numstr, orgnum + (*orgnum == '-' ? 1 : 0));
@@ -4511,19 +4554,19 @@ int8_to_char(PG_FUNCTION_ARGS)
 Datum
 float4_to_char(PG_FUNCTION_ARGS)
 {
-	float4	value = PG_GETARG_FLOAT4(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
+	float4		value = PG_GETARG_FLOAT4(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
 	FormatNode *format;
-	text	*result,
-		*result_tmp;
-	int	flag = 0;
-	int	len = 0,
-		plen = 0,
-		sign = 0;
-	char	*numstr,
-		*orgnum,
-		*p;
+	text	   *result,
+			   *result_tmp;
+	int			flag = 0;
+	int			len = 0,
+				plen = 0,
+				sign = 0;
+	char	   *numstr,
+			   *orgnum,
+			   *p;
 
 	NUM_TOCHAR_prepare;
 
@@ -4538,7 +4581,7 @@ float4_to_char(PG_FUNCTION_ARGS)
 
 		if (IS_MULTI(&Num))
 		{
-			float	multi = pow((double) 10, (double) Num.multi);
+			float		multi = pow((double) 10, (double) Num.multi);
 
 			val = value * multi;
 			Num.pre += Num.multi;
@@ -4591,19 +4634,19 @@ float4_to_char(PG_FUNCTION_ARGS)
 Datum
 float8_to_char(PG_FUNCTION_ARGS)
 {
-	float8	value = PG_GETARG_FLOAT8(0);
-	text	*fmt = PG_GETARG_TEXT_P(1);
-	NUMDesc	Num;
+	float8		value = PG_GETARG_FLOAT8(0);
+	text	   *fmt = PG_GETARG_TEXT_P(1);
+	NUMDesc		Num;
 	FormatNode *format;
-	text	*result,
-		*result_tmp;
-	int	flag = 0;
-	int	len = 0,
-		plen = 0,
-		sign = 0;
-	char	*numstr,
-		*orgnum,
-		*p;
+	text	   *result,
+			   *result_tmp;
+	int			flag = 0;
+	int			len = 0,
+				plen = 0,
+				sign = 0;
+	char	   *numstr,
+			   *orgnum,
+			   *p;
 
 	NUM_TOCHAR_prepare;
 
@@ -4618,7 +4661,7 @@ float8_to_char(PG_FUNCTION_ARGS)
 
 		if (IS_MULTI(&Num))
 		{
-			double	multi = pow((double) 10, (double) Num.multi);
+			double		multi = pow((double) 10, (double) Num.multi);
 
 			val = value * multi;
 			Num.pre += Num.multi;
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index ef3e28fc61d681b789482a38bb23c0fc838ecf98..aac191b377856163e190cdf1326f1c8c71e36227 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.57 2001/01/24 19:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.58 2001/03/22 03:59:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -484,11 +484,11 @@ box_ov(BOX *box1, BOX *box2)
 			 FPle(box1->low.x, box2->high.x)) ||
 			(FPge(box2->high.x, box1->high.x) &&
 			 FPle(box2->low.x, box1->high.x)))
-		&&
-		((FPge(box1->high.y, box2->high.y) &&
-		  FPle(box1->low.y, box2->high.y)) ||
-		 (FPge(box2->high.y, box1->high.y) &&
-		  FPle(box2->low.y, box1->high.y)));
+	&&
+	((FPge(box1->high.y, box2->high.y) &&
+	  FPle(box1->low.y, box2->high.y)) ||
+	 (FPge(box2->high.y, box1->high.y) &&
+	  FPle(box2->low.y, box1->high.y)));
 }
 
 /*		box_overleft	-		is the right edge of box1 to the left of
@@ -811,8 +811,10 @@ line_in(PG_FUNCTION_ARGS)
 {
 #ifdef ENABLE_LINE_TYPE
 	char	   *str = PG_GETARG_CSTRING(0);
+
 #endif
 	LINE	   *line;
+
 #ifdef ENABLE_LINE_TYPE
 	LSEG		lseg;
 	int			isopen;
@@ -838,8 +840,10 @@ line_out(PG_FUNCTION_ARGS)
 {
 #ifdef ENABLE_LINE_TYPE
 	LINE	   *line = PG_GETARG_LINE_P(0);
+
 #endif
 	char	   *result;
+
 #ifdef ENABLE_LINE_TYPE
 	LSEG		lseg;
 
@@ -996,9 +1000,9 @@ line_intersect(PG_FUNCTION_ARGS)
 	LINE	   *l1 = PG_GETARG_LINE_P(0);
 	LINE	   *l2 = PG_GETARG_LINE_P(1);
 
-	PG_RETURN_BOOL(! DatumGetBool(DirectFunctionCall2(line_parallel,
-													  LinePGetDatum(l1),
-													  LinePGetDatum(l2))));
+	PG_RETURN_BOOL(!DatumGetBool(DirectFunctionCall2(line_parallel,
+													 LinePGetDatum(l1),
+													 LinePGetDatum(l2))));
 }
 
 Datum
@@ -1089,9 +1093,9 @@ line_distance(PG_FUNCTION_ARGS)
 	float8		result;
 	Point	   *tmp;
 
-	if (! DatumGetBool(DirectFunctionCall2(line_parallel,
-										   LinePGetDatum(l1),
-										   LinePGetDatum(l2))))
+	if (!DatumGetBool(DirectFunctionCall2(line_parallel,
+										  LinePGetDatum(l1),
+										  LinePGetDatum(l2))))
 		PG_RETURN_FLOAT8(0.0);
 	if (FPzero(l1->B))			/* vertical? */
 		PG_RETURN_FLOAT8(fabs(l1->C - l2->C));
@@ -1131,9 +1135,10 @@ line_interpt_internal(LINE *l1, LINE *l2)
 				y;
 
 	/*
-	 * NOTE: if the lines are identical then we will find they are parallel
-	 * and report "no intersection".  This is a little weird, but since
-	 * there's no *unique* intersection, maybe it's appropriate behavior.
+	 * NOTE: if the lines are identical then we will find they are
+	 * parallel and report "no intersection".  This is a little weird, but
+	 * since there's no *unique* intersection, maybe it's appropriate
+	 * behavior.
 	 */
 	if (DatumGetBool(DirectFunctionCall2(line_parallel,
 										 LinePGetDatum(l1),
@@ -1226,7 +1231,7 @@ path_in(PG_FUNCTION_ARGS)
 		depth++;
 	}
 
-	size = offsetof(PATH, p[0]) + sizeof(path->p[0]) * npts;
+	size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * npts;
 	path = (PATH *) palloc(size);
 
 	path->size = size;
@@ -1321,7 +1326,7 @@ path_isopen(PG_FUNCTION_ARGS)
 {
 	PATH	   *path = PG_GETARG_PATH_P(0);
 
-	PG_RETURN_BOOL(! path->closed);
+	PG_RETURN_BOOL(!path->closed);
 }
 
 Datum
@@ -1434,7 +1439,7 @@ path_distance(PG_FUNCTION_ARGS)
 
 			tmp = DatumGetFloat8(DirectFunctionCall2(lseg_distance,
 													 LsegPGetDatum(&seg1),
-													 LsegPGetDatum(&seg2)));
+												  LsegPGetDatum(&seg2)));
 			if (!have_min || tmp < min)
 			{
 				min = tmp;
@@ -1443,7 +1448,7 @@ path_distance(PG_FUNCTION_ARGS)
 		}
 	}
 
-	if (! have_min)
+	if (!have_min)
 		PG_RETURN_NULL();
 
 	PG_RETURN_FLOAT8(min);
@@ -1992,9 +1997,10 @@ lseg_interpt(PG_FUNCTION_ARGS)
 	result = line_interpt_internal(&tmp1, &tmp2);
 	if (!PointerIsValid(result))
 		PG_RETURN_NULL();
+
 	/*
-	 * If the line intersection point isn't within l1 (or equivalently l2),
-	 * there is no valid segment intersection point at all.
+	 * If the line intersection point isn't within l1 (or equivalently
+	 * l2), there is no valid segment intersection point at all.
 	 */
 	if (!on_ps_internal(result, l1) ||
 		!on_ps_internal(result, l2))
@@ -2002,10 +2008,11 @@ lseg_interpt(PG_FUNCTION_ARGS)
 		pfree(result);
 		PG_RETURN_NULL();
 	}
+
 	/*
 	 * If there is an intersection, then check explicitly for matching
-	 *	endpoints since there may be rounding effects with annoying
-	 *	lsb residue. - tgl 1997-07-09
+	 * endpoints since there may be rounding effects with annoying lsb
+	 * residue. - tgl 1997-07-09
 	 */
 	if ((FPeq(l1->p[0].x, l2->p[0].x) && FPeq(l1->p[0].y, l2->p[0].y)) ||
 		(FPeq(l1->p[0].x, l2->p[1].x) && FPeq(l1->p[0].y, l2->p[1].y)))
@@ -2014,7 +2021,7 @@ lseg_interpt(PG_FUNCTION_ARGS)
 		result->y = l1->p[0].y;
 	}
 	else if ((FPeq(l1->p[1].x, l2->p[0].x) && FPeq(l1->p[1].y, l2->p[0].y)) ||
-			 (FPeq(l1->p[1].x, l2->p[1].x) && FPeq(l1->p[1].y, l2->p[1].y)))
+		  (FPeq(l1->p[1].x, l2->p[1].x) && FPeq(l1->p[1].y, l2->p[1].y)))
 	{
 		result->x = l1->p[1].x;
 		result->y = l1->p[1].y;
@@ -2048,7 +2055,7 @@ static double
 dist_pl_internal(Point *pt, LINE *line)
 {
 	return (line->A * pt->x + line->B * pt->y + line->C) /
-		HYPOT(line->A, line->B);
+	HYPOT(line->A, line->B);
 }
 
 Datum
@@ -2080,9 +2087,7 @@ dist_ps_internal(Point *pt, LSEG *lseg)
 		m = (double) DBL_MAX;
 	}
 	else
-	{
 		m = ((lseg->p[0].y - lseg->p[1].y) / (lseg->p[1].x - lseg->p[0].x));
-	}
 	ln = line_construct_pm(pt, m);
 
 #ifdef GEODEBUG
@@ -2188,9 +2193,7 @@ dist_sl(PG_FUNCTION_ARGS)
 				d2;
 
 	if (has_interpt_sl(lseg, line))
-	{
 		result = 0.0;
-	}
 	else
 	{
 		result = dist_pl_internal(&lseg->p[0], line);
@@ -2230,6 +2233,7 @@ dist_lb(PG_FUNCTION_ARGS)
 #ifdef NOT_USED
 	LINE	   *line = PG_GETARG_LINE_P(0);
 	BOX		   *box = PG_GETARG_BOX_P(1);
+
 #endif
 
 	/* think about this one for a while */
@@ -2243,7 +2247,7 @@ Datum
 dist_cpoly(PG_FUNCTION_ARGS)
 {
 	CIRCLE	   *circle = PG_GETARG_CIRCLE_P(0);
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(1);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(1);
 	float8		result;
 	float8		d;
 	int			i;
@@ -2430,7 +2434,7 @@ close_ps(PG_FUNCTION_ARGS)
 	xh = lseg->p[0].x < lseg->p[1].x;
 	yh = lseg->p[0].y < lseg->p[1].y;
 
-	if (FPeq(lseg->p[0].x, lseg->p[1].x))	/* vertical? */
+	if (FPeq(lseg->p[0].x, lseg->p[1].x))		/* vertical? */
 	{
 #ifdef GEODEBUG
 		printf("close_ps- segment is vertical\n");
@@ -2450,7 +2454,7 @@ close_ps(PG_FUNCTION_ARGS)
 		result->y = pt->y;
 		PG_RETURN_POINT_P(result);
 	}
-	else if (FPeq(lseg->p[0].y, lseg->p[1].y)) /* horizontal? */
+	else if (FPeq(lseg->p[0].y, lseg->p[1].y))	/* horizontal? */
 	{
 #ifdef GEODEBUG
 		printf("close_ps- segment is horizontal\n");
@@ -2484,7 +2488,7 @@ close_ps(PG_FUNCTION_ARGS)
 												 * lower end pt */
 #ifdef GEODEBUG
 		printf("close_ps below: tmp A %f  B %f   C %f    m %f\n",
-			   tmp->A,tmp->B,tmp->C, tmp->m);
+			   tmp->A, tmp->B, tmp->C, tmp->m);
 #endif
 		PG_RETURN_POINT_P(result);
 	}
@@ -2496,7 +2500,7 @@ close_ps(PG_FUNCTION_ARGS)
 												 * higher end pt */
 #ifdef GEODEBUG
 		printf("close_ps above: tmp A %f  B %f   C %f    m %f\n",
-			   tmp->A,tmp->B,tmp->C, tmp->m);
+			   tmp->A, tmp->B, tmp->C, tmp->m);
 #endif
 		PG_RETURN_POINT_P(result);
 	}
@@ -2508,7 +2512,7 @@ close_ps(PG_FUNCTION_ARGS)
 	tmp = line_construct_pm(pt, invm);
 #ifdef GEODEBUG
 	printf("close_ps- tmp A %f  B %f   C %f    m %f\n",
-		   tmp->A,tmp->B,tmp->C, tmp->m);
+		   tmp->A, tmp->B, tmp->C, tmp->m);
 #endif
 	result = interpt_sl(lseg, tmp);
 	Assert(result != NULL);
@@ -2545,12 +2549,12 @@ close_lseg(PG_FUNCTION_ARGS)
 	if ((d = dist_ps_internal(&l2->p[0], l1)) < dist)
 	{
 		result = DatumGetPointP(DirectFunctionCall2(close_ps,
-													PointPGetDatum(&l2->p[0]),
+											   PointPGetDatum(&l2->p[0]),
 													LsegPGetDatum(l1)));
 		memcpy(&point, result, sizeof(Point));
 		pfree(result);
 		result = DatumGetPointP(DirectFunctionCall2(close_ps,
-													PointPGetDatum(&point),
+												  PointPGetDatum(&point),
 													LsegPGetDatum(l2)));
 	}
 
@@ -2560,12 +2564,12 @@ close_lseg(PG_FUNCTION_ARGS)
 			pfree(result);
 
 		result = DatumGetPointP(DirectFunctionCall2(close_ps,
-													PointPGetDatum(&l2->p[1]),
+											   PointPGetDatum(&l2->p[1]),
 													LsegPGetDatum(l1)));
 		memcpy(&point, result, sizeof(Point));
 		pfree(result);
 		result = DatumGetPointP(DirectFunctionCall2(close_ps,
-													PointPGetDatum(&point),
+												  PointPGetDatum(&point),
 													LsegPGetDatum(l2)));
 	}
 
@@ -2752,6 +2756,7 @@ close_lb(PG_FUNCTION_ARGS)
 #ifdef NOT_USED
 	LINE	   *line = PG_GETARG_LINE_P(0);
 	BOX		   *box = PG_GETARG_BOX_P(1);
+
 #endif
 
 	/* think about this one for a while */
@@ -2858,11 +2863,11 @@ on_sl(PG_FUNCTION_ARGS)
 	LINE	   *line = PG_GETARG_LINE_P(1);
 
 	PG_RETURN_BOOL(DatumGetBool(DirectFunctionCall2(on_pl,
-												PointPGetDatum(&lseg->p[0]),
-												LinePGetDatum(line))) &&
+											 PointPGetDatum(&lseg->p[0]),
+												 LinePGetDatum(line))) &&
 				   DatumGetBool(DirectFunctionCall2(on_pl,
-												PointPGetDatum(&lseg->p[1]),
-												LinePGetDatum(line))));
+											 PointPGetDatum(&lseg->p[1]),
+												  LinePGetDatum(line))));
 }
 
 Datum
@@ -2872,11 +2877,11 @@ on_sb(PG_FUNCTION_ARGS)
 	BOX		   *box = PG_GETARG_BOX_P(1);
 
 	PG_RETURN_BOOL(DatumGetBool(DirectFunctionCall2(on_pb,
-												PointPGetDatum(&lseg->p[0]),
-												BoxPGetDatum(box))) &&
+											 PointPGetDatum(&lseg->p[0]),
+													BoxPGetDatum(box))) &&
 				   DatumGetBool(DirectFunctionCall2(on_pb,
-												PointPGetDatum(&lseg->p[1]),
-												BoxPGetDatum(box))));
+											 PointPGetDatum(&lseg->p[1]),
+													BoxPGetDatum(box))));
 }
 
 /*---------------------------------------------------------------------
@@ -3058,7 +3063,7 @@ poly_in(PG_FUNCTION_ARGS)
 	if ((npts = pair_count(str, ',')) <= 0)
 		elog(ERROR, "Bad polygon external representation '%s'", str);
 
-	size = offsetof(POLYGON, p[0]) + sizeof(poly->p[0]) * npts;
+	size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * npts;
 	poly = (POLYGON *) palloc(size);
 
 	MemSet((char *) poly, 0, size);		/* zero any holes */
@@ -3081,7 +3086,7 @@ poly_in(PG_FUNCTION_ARGS)
 Datum
 poly_out(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 
 	PG_RETURN_CSTRING(path_encode(TRUE, poly->npts, poly->p));
 }
@@ -3095,13 +3100,16 @@ poly_out(PG_FUNCTION_ARGS)
 Datum
 poly_left(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	result = polya->boundbox.high.x < polyb->boundbox.low.x;
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3116,13 +3124,16 @@ poly_left(PG_FUNCTION_ARGS)
 Datum
 poly_overleft(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	result = polya->boundbox.low.x <= polyb->boundbox.high.x;
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3137,13 +3148,16 @@ poly_overleft(PG_FUNCTION_ARGS)
 Datum
 poly_right(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	result = polya->boundbox.low.x > polyb->boundbox.high.x;
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3158,13 +3172,16 @@ poly_right(PG_FUNCTION_ARGS)
 Datum
 poly_overright(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	result = polya->boundbox.high.x > polyb->boundbox.low.x;
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3181,8 +3198,8 @@ poly_overright(PG_FUNCTION_ARGS)
 Datum
 poly_same(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	if (polya->npts != polyb->npts)
@@ -3190,7 +3207,10 @@ poly_same(PG_FUNCTION_ARGS)
 	else
 		result = plist_same(polya->npts, polya->p, polyb->p);
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3206,13 +3226,16 @@ poly_same(PG_FUNCTION_ARGS)
 Datum
 poly_overlap(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 
 	result = box_ov(&polya->boundbox, &polyb->boundbox);
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3226,8 +3249,8 @@ poly_overlap(PG_FUNCTION_ARGS)
 Datum
 poly_contain(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
 	bool		result;
 	int			i;
 
@@ -3275,7 +3298,10 @@ poly_contain(PG_FUNCTION_ARGS)
 		result = false;
 	}
 
-	/* Avoid leaking memory for toasted inputs ... needed for rtree indexes */
+	/*
+	 * Avoid leaking memory for toasted inputs ... needed for rtree
+	 * indexes
+	 */
 	PG_FREE_IF_COPY(polya, 0);
 	PG_FREE_IF_COPY(polyb, 1);
 
@@ -3310,7 +3336,7 @@ poly_contained(PG_FUNCTION_ARGS)
 Datum
 poly_contain_pt(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 	Point	   *p = PG_GETARG_POINT_P(1);
 
 	PG_RETURN_BOOL(point_inside(p, poly->npts, poly->p) != 0);
@@ -3320,7 +3346,7 @@ Datum
 pt_contained_poly(PG_FUNCTION_ARGS)
 {
 	Point	   *p = PG_GETARG_POINT_P(0);
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(1);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(1);
 
 	PG_RETURN_BOOL(point_inside(p, poly->npts, poly->p) != 0);
 }
@@ -3330,8 +3356,9 @@ Datum
 poly_distance(PG_FUNCTION_ARGS)
 {
 #ifdef NOT_USED
-	POLYGON	   *polya = PG_GETARG_POLYGON_P(0);
-	POLYGON	   *polyb = PG_GETARG_POLYGON_P(1);
+	POLYGON    *polya = PG_GETARG_POLYGON_P(0);
+	POLYGON    *polyb = PG_GETARG_POLYGON_P(1);
+
 #endif
 
 	elog(ERROR, "poly_distance not implemented");
@@ -3531,7 +3558,7 @@ path_add(PG_FUNCTION_ARGS)
 	if (p1->closed || p2->closed)
 		PG_RETURN_NULL();
 
-	size = offsetof(PATH, p[0]) + sizeof(p1->p[0]) * (p1->npts + p2->npts);
+	size = offsetof(PATH, p[0]) +sizeof(p1->p[0]) * (p1->npts + p2->npts);
 	result = (PATH *) palloc(size);
 
 	result->size = size;
@@ -3601,7 +3628,7 @@ path_mul_pt(PG_FUNCTION_ARGS)
 	for (i = 0; i < path->npts; i++)
 	{
 		p = DatumGetPointP(DirectFunctionCall2(point_mul,
-											   PointPGetDatum(&path->p[i]),
+											 PointPGetDatum(&path->p[i]),
 											   PointPGetDatum(point)));
 		path->p[i].x = p->x;
 		path->p[i].y = p->y;
@@ -3622,7 +3649,7 @@ path_div_pt(PG_FUNCTION_ARGS)
 	for (i = 0; i < path->npts; i++)
 	{
 		p = DatumGetPointP(DirectFunctionCall2(point_div,
-											   PointPGetDatum(&path->p[i]),
+											 PointPGetDatum(&path->p[i]),
 											   PointPGetDatum(point)));
 		path->p[i].x = p->x;
 		path->p[i].y = p->y;
@@ -3638,6 +3665,7 @@ path_center(PG_FUNCTION_ARGS)
 {
 #ifdef NOT_USED
 	PATH	   *path = PG_GETARG_PATH_P(0);
+
 #endif
 
 	elog(ERROR, "path_center not implemented");
@@ -3657,7 +3685,7 @@ path_poly(PG_FUNCTION_ARGS)
 	if (!path->closed)
 		elog(ERROR, "Open path cannot be converted to polygon");
 
-	size = offsetof(POLYGON, p[0]) + sizeof(poly->p[0]) * path->npts;
+	size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * path->npts;
 	poly = (POLYGON *) palloc(size);
 
 	poly->size = size;
@@ -3684,7 +3712,7 @@ path_poly(PG_FUNCTION_ARGS)
 Datum
 poly_npoints(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 
 	PG_RETURN_INT32(poly->npts);
 }
@@ -3693,7 +3721,7 @@ poly_npoints(PG_FUNCTION_ARGS)
 Datum
 poly_center(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 	Datum		result;
 	CIRCLE	   *circle;
 
@@ -3710,7 +3738,7 @@ poly_center(PG_FUNCTION_ARGS)
 Datum
 poly_box(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 	BOX		   *box;
 
 	if (poly->npts < 1)
@@ -3733,7 +3761,7 @@ box_poly(PG_FUNCTION_ARGS)
 	int			size;
 
 	/* map four corners of the box to a polygon */
-	size = offsetof(POLYGON, p[0]) + sizeof(poly->p[0]) * 4;
+	size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * 4;
 	poly = (POLYGON *) palloc(size);
 
 	poly->size = size;
@@ -3758,12 +3786,12 @@ box_poly(PG_FUNCTION_ARGS)
 Datum
 poly_path(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 	PATH	   *path;
 	int			size;
 	int			i;
 
-	size = offsetof(PATH, p[0]) + sizeof(path->p[0]) * poly->npts;
+	size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * poly->npts;
 	path = (PATH *) palloc(size);
 
 	path->size = size;
@@ -4133,7 +4161,7 @@ circle_mul_pt(PG_FUNCTION_ARGS)
 	result = circle_copy(circle);
 
 	p = DatumGetPointP(DirectFunctionCall2(point_mul,
-										   PointPGetDatum(&circle->center),
+										 PointPGetDatum(&circle->center),
 										   PointPGetDatum(point)));
 	result->center.x = p->x;
 	result->center.y = p->y;
@@ -4154,7 +4182,7 @@ circle_div_pt(PG_FUNCTION_ARGS)
 	result = circle_copy(circle);
 
 	p = DatumGetPointP(DirectFunctionCall2(point_div,
-										   PointPGetDatum(&circle->center),
+										 PointPGetDatum(&circle->center),
 										   PointPGetDatum(point)));
 	result->center.x = p->x;
 	result->center.y = p->y;
@@ -4381,7 +4409,7 @@ circle_poly(PG_FUNCTION_ARGS)
 Datum
 poly_circle(PG_FUNCTION_ARGS)
 {
-	POLYGON	   *poly = PG_GETARG_POLYGON_P(0);
+	POLYGON    *poly = PG_GETARG_POLYGON_P(0);
 	CIRCLE	   *circle;
 	int			i;
 
diff --git a/src/backend/utils/adt/inet_net_ntop.c b/src/backend/utils/adt/inet_net_ntop.c
index ecc83cab8148b9266f403504a7f5828436cb42e5..7332930095651156ecefcd1999c924366fb058ee 100644
--- a/src/backend/utils/adt/inet_net_ntop.c
+++ b/src/backend/utils/adt/inet_net_ntop.c
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.9 2000/11/10 20:13:25 tgl Exp $";
+static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.10 2001/03/22 03:59:51 momjian Exp $";
 
 #endif
 
@@ -56,7 +56,7 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size)
 {
 	switch (af)
 	{
-		case AF_INET:
+			case AF_INET:
 			return (inet_cidr_ntop_ipv4(src, bits, dst, size));
 		default:
 			errno = EAFNOSUPPORT;
@@ -157,7 +157,7 @@ inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
 {
 	switch (af)
 	{
-		case AF_INET:
+			case AF_INET:
 			return (inet_net_ntop_ipv4(src, bits, dst, size));
 		default:
 			errno = EAFNOSUPPORT;
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index 189cd384162996947e2cbc0033a6d2b732de7a10..00c99805c9e765ac1d5907422f0d42c5fee95371 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.45 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.46 2001/03/22 03:59:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,7 +63,7 @@ Datum
 int2out(PG_FUNCTION_ARGS)
 {
 	int16		arg1 = PG_GETARG_INT16(0);
-	char	   *result = (char *) palloc(7); /* sign, 5 digits, '\0' */
+	char	   *result = (char *) palloc(7);	/* sign, 5 digits, '\0' */
 
 	pg_itoa(arg1, result);
 	PG_RETURN_CSTRING(result);
@@ -180,7 +180,8 @@ Datum
 int44out(PG_FUNCTION_ARGS)
 {
 	int32	   *an_array = (int32 *) PG_GETARG_POINTER(0);
-	char	   *result = (char *) palloc(16 * 4); /* Allow 14 digits + sign */
+	char	   *result = (char *) palloc(16 * 4);		/* Allow 14 digits +
+														 * sign */
 	int			i;
 	char	   *walk;
 
@@ -219,7 +220,7 @@ Datum
 int4out(PG_FUNCTION_ARGS)
 {
 	int32		arg1 = PG_GETARG_INT32(0);
-	char	   *result = (char *) palloc(12); /* sign, 10 digits, '\0' */
+	char	   *result = (char *) palloc(12);	/* sign, 10 digits, '\0' */
 
 	pg_ltoa(arg1, result);
 	PG_RETURN_CSTRING(result);
@@ -257,7 +258,7 @@ Datum
 int2_text(PG_FUNCTION_ARGS)
 {
 	int16		arg1 = PG_GETARG_INT16(0);
-	text	   *result = (text *) palloc(7+VARHDRSZ); /* sign,5 digits, '\0' */
+	text	   *result = (text *) palloc(7 + VARHDRSZ); /* sign,5 digits, '\0' */
 
 	pg_itoa(arg1, VARDATA(result));
 	VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ;
@@ -288,7 +289,7 @@ Datum
 int4_text(PG_FUNCTION_ARGS)
 {
 	int32		arg1 = PG_GETARG_INT32(0);
-	text	   *result = (text *) palloc(12+VARHDRSZ); /* sign,10 digits,'\0' */
+	text	   *result = (text *) palloc(12 + VARHDRSZ);		/* sign,10 digits,'\0' */
 
 	pg_ltoa(arg1, VARDATA(result));
 	VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ;
@@ -960,4 +961,3 @@ int2shr(PG_FUNCTION_ARGS)
 
 	PG_RETURN_INT16(arg1 >> arg2);
 }
-
diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c
index a7df878c65ba371c4a156e7779fe02422edec0f6..3f286069b7d24eb73c13b51a92e396515b2b4d34 100644
--- a/src/backend/utils/adt/int8.c
+++ b/src/backend/utils/adt/int8.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.28 2001/01/26 22:50:26 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.29 2001/03/22 03:59:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -67,15 +67,15 @@ int8in(PG_FUNCTION_ARGS)
 	 * Do our own scan, rather than relying on sscanf which might be
 	 * broken for long long.
 	 */
-	while (*ptr && isspace((unsigned char) *ptr))	/* skip leading spaces */
+	while (*ptr && isspace((unsigned char) *ptr))		/* skip leading spaces */
 		ptr++;
 	if (*ptr == '-')			/* handle sign */
 		sign = -1, ptr++;
 	else if (*ptr == '+')
 		ptr++;
-	if (!isdigit((unsigned char) *ptr))		/* require at least one digit */
+	if (!isdigit((unsigned char) *ptr)) /* require at least one digit */
 		elog(ERROR, "Bad int8 external representation \"%s\"", str);
-	while (*ptr && isdigit((unsigned char) *ptr))	/* process digits */
+	while (*ptr && isdigit((unsigned char) *ptr))		/* process digits */
 	{
 		int64		newtmp = tmp * 10 + (*ptr++ - '0');
 
@@ -409,7 +409,7 @@ int8um(PG_FUNCTION_ARGS)
 {
 	int64		val = PG_GETARG_INT64(0);
 
-	PG_RETURN_INT64(- val);
+	PG_RETURN_INT64(-val);
 }
 
 Datum
@@ -702,10 +702,11 @@ dtoi8(PG_FUNCTION_ARGS)
 
 	/* Round val to nearest integer (but it's still in float form) */
 	val = rint(val);
+
 	/*
-	 * Does it fit in an int64?  Avoid assuming that we have handy constants
-	 * defined for the range boundaries, instead test for overflow by
-	 * reverse-conversion.
+	 * Does it fit in an int64?  Avoid assuming that we have handy
+	 * constants defined for the range boundaries, instead test for
+	 * overflow by reverse-conversion.
 	 */
 	result = (int64) val;
 
diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c
index 7bac7793fbafa8e6d417040261e5b0d159972286..f27bc067d6a305dd3950e76e27671493db88ef2c 100644
--- a/src/backend/utils/adt/like.c
+++ b/src/backend/utils/adt/like.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	$Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.44 2001/01/24 19:43:14 momjian Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.45 2001/03/22 03:59:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,10 +30,10 @@
 #define LIKE_ABORT						(-1)
 
 
-static int MatchText(unsigned char * t, int tlen,
-					 unsigned char * p, int plen);
-static int MatchTextIC(unsigned char * t, int tlen,
-					   unsigned char * p, int plen);
+static int MatchText(unsigned char *t, int tlen,
+		  unsigned char *p, int plen);
+static int MatchTextIC(unsigned char *t, int tlen,
+			unsigned char *p, int plen);
 
 
 #ifdef MULTIBYTE
@@ -42,19 +42,20 @@ static int MatchTextIC(unsigned char * t, int tlen,
  * as wide characters. If they match, returns 1 otherwise returns 0.
  *--------------------
  */
-static int wchareq(unsigned char *p1, unsigned char *p2)
+static int
+wchareq(unsigned char *p1, unsigned char *p2)
 {
-	int l;
+	int			l;
 
 	l = pg_mblen(p1);
-	if (pg_mblen(p2) != l) {
-		return(0);
-	}
-	while (l--) {
+	if (pg_mblen(p2) != l)
+		return (0);
+	while (l--)
+	{
 		if (*p1++ != *p2++)
-			return(0);
+			return (0);
 	}
-	return(1);
+	return (1);
 }
 
 /*--------------------
@@ -65,32 +66,38 @@ static int wchareq(unsigned char *p1, unsigned char *p2)
  */
 #define CHARMAX 0x80
 
-static int iwchareq(unsigned char *p1, unsigned char *p2)
+static int
+iwchareq(unsigned char *p1, unsigned char *p2)
 {
-	int c1[2], c2[2];
-	int l;
+	int			c1[2],
+				c2[2];
+	int			l;
 
-	/* short cut. if *p1 and *p2 is lower than CHARMAX, then
-	   we could assume they are ASCII */
+	/*
+	 * short cut. if *p1 and *p2 is lower than CHARMAX, then we could
+	 * assume they are ASCII
+	 */
 	if (*p1 < CHARMAX && *p2 < CHARMAX)
-		return(tolower(*p1) == tolower(*p2));
+		return (tolower(*p1) == tolower(*p2));
 
-	/* if one of them is an ASCII while the other is not, then
-	   they must be different characters
-	*/
+	/*
+	 * if one of them is an ASCII while the other is not, then they must
+	 * be different characters
+	 */
 	else if (*p1 < CHARMAX || *p2 < CHARMAX)
-		return(0);
+		return (0);
 
-	/* ok, p1 and p2 are both > CHARMAX, then they must be multi-byte
-	   characters
-	*/
+	/*
+	 * ok, p1 and p2 are both > CHARMAX, then they must be multi-byte
+	 * characters
+	 */
 	l = pg_mblen(p1);
-	(void)pg_mb2wchar_with_len(p1, (pg_wchar *)c1, l);
+	(void) pg_mb2wchar_with_len(p1, (pg_wchar *) c1, l);
 	c1[0] = tolower(c1[0]);
 	l = pg_mblen(p2);
-	(void)pg_mb2wchar_with_len(p2, (pg_wchar *)c2, l);
+	(void) pg_mb2wchar_with_len(p2, (pg_wchar *) c2, l);
 	c2[0] = tolower(c2[0]);
-	return(c1[0] == c2[0]);
+	return (c1[0] == c2[0]);
 }
 
 #endif
@@ -124,13 +131,15 @@ namelike(PG_FUNCTION_ARGS)
 	Name		str = PG_GETARG_NAME(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = NameStr(*str);
 	slen = strlen(s);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
 
@@ -143,13 +152,15 @@ namenlike(PG_FUNCTION_ARGS)
 	Name		str = PG_GETARG_NAME(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = NameStr(*str);
 	slen = strlen(s);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
 
@@ -162,13 +173,15 @@ textlike(PG_FUNCTION_ARGS)
 	text	   *str = PG_GETARG_TEXT_P(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = VARDATA(str);
-	slen = (VARSIZE(str)-VARHDRSZ);
+	slen = (VARSIZE(str) - VARHDRSZ);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
 
@@ -181,13 +194,15 @@ textnlike(PG_FUNCTION_ARGS)
 	text	   *str = PG_GETARG_TEXT_P(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = VARDATA(str);
-	slen = (VARSIZE(str)-VARHDRSZ);
+	slen = (VARSIZE(str) - VARHDRSZ);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
 
@@ -204,13 +219,15 @@ nameiclike(PG_FUNCTION_ARGS)
 	Name		str = PG_GETARG_NAME(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = NameStr(*str);
 	slen = strlen(s);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
 
@@ -223,13 +240,15 @@ nameicnlike(PG_FUNCTION_ARGS)
 	Name		str = PG_GETARG_NAME(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = NameStr(*str);
 	slen = strlen(s);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
 
@@ -242,13 +261,15 @@ texticlike(PG_FUNCTION_ARGS)
 	text	   *str = PG_GETARG_TEXT_P(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = VARDATA(str);
-	slen = (VARSIZE(str)-VARHDRSZ);
+	slen = (VARSIZE(str) - VARHDRSZ);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
 
@@ -261,13 +282,15 @@ texticnlike(PG_FUNCTION_ARGS)
 	text	   *str = PG_GETARG_TEXT_P(0);
 	text	   *pat = PG_GETARG_TEXT_P(1);
 	bool		result;
-	unsigned char   *s, *p;
-	int			slen, plen;
+	unsigned char *s,
+			   *p;
+	int			slen,
+				plen;
 
 	s = VARDATA(str);
-	slen = (VARSIZE(str)-VARHDRSZ);
+	slen = (VARSIZE(str) - VARHDRSZ);
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 
 	result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
 
@@ -284,14 +307,17 @@ like_escape(PG_FUNCTION_ARGS)
 	text	   *pat = PG_GETARG_TEXT_P(0);
 	text	   *esc = PG_GETARG_TEXT_P(1);
 	text	   *result;
-	unsigned char   *p, *e, *r;
-	int			plen, elen;
+	unsigned char *p,
+			   *e,
+			   *r;
+	int			plen,
+				elen;
 	bool		afterescape;
 
 	p = VARDATA(pat);
-	plen = (VARSIZE(pat)-VARHDRSZ);
+	plen = (VARSIZE(pat) - VARHDRSZ);
 	e = VARDATA(esc);
-	elen = (VARSIZE(esc)-VARHDRSZ);
+	elen = (VARSIZE(esc) - VARHDRSZ);
 
 	/*
 	 * Worst-case pattern growth is 2x --- unlikely, but it's hardly worth
@@ -302,6 +328,7 @@ like_escape(PG_FUNCTION_ARGS)
 
 	if (elen == 0)
 	{
+
 		/*
 		 * No escape character is wanted.  Double any backslashes in the
 		 * pattern to make them act like ordinary characters.
@@ -315,6 +342,7 @@ like_escape(PG_FUNCTION_ARGS)
 	}
 	else
 	{
+
 		/*
 		 * The specified escape must be only a single character.
 		 */
@@ -322,6 +350,7 @@ like_escape(PG_FUNCTION_ARGS)
 		if (elen != 0)
 			elog(ERROR, "ESCAPE string must be empty or one character");
 		e = VARDATA(esc);
+
 		/*
 		 * If specified escape is '\', just copy the pattern as-is.
 		 */
@@ -330,15 +359,16 @@ like_escape(PG_FUNCTION_ARGS)
 			memcpy(result, pat, VARSIZE(pat));
 			PG_RETURN_TEXT_P(result);
 		}
+
 		/*
-		 * Otherwise, convert occurrences of the specified escape character
-		 * to '\', and double occurrences of '\' --- unless they immediately
-		 * follow an escape character!
+		 * Otherwise, convert occurrences of the specified escape
+		 * character to '\', and double occurrences of '\' --- unless they
+		 * immediately follow an escape character!
 		 */
 		afterescape = false;
 		while (plen > 0)
 		{
-			if (CHAREQ(p,e) && !afterescape)
+			if (CHAREQ(p, e) && !afterescape)
 			{
 				*r++ = '\\';
 				NextChar(p, plen);
@@ -347,7 +377,7 @@ like_escape(PG_FUNCTION_ARGS)
 			else if (*p == '\\')
 			{
 				*r++ = '\\';
-				if (! afterescape)
+				if (!afterescape)
 					*r++ = '\\';
 				NextChar(p, plen);
 				afterescape = false;
@@ -413,7 +443,7 @@ like_escape(PG_FUNCTION_ARGS)
  */
 
 static int
-MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
+MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
 {
 	/* Fast path for match-everything pattern */
 	if ((plen == 1) && (*p == '%'))
@@ -425,7 +455,7 @@ MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
 		{
 			/* Next pattern char must match literally, whatever it is */
 			NextChar(p, plen);
-			if ((plen <= 0) || !CHAREQ(t,p))
+			if ((plen <= 0) || !CHAREQ(t, p))
 				return LIKE_FALSE;
 		}
 		else if (*p == '%')
@@ -439,22 +469,22 @@ MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
 				return LIKE_TRUE;
 
 			/*
-			 * Otherwise, scan for a text position at which we can
-			 * match the rest of the pattern.
+			 * Otherwise, scan for a text position at which we can match
+			 * the rest of the pattern.
 			 */
 			while (tlen > 0)
 			{
+
 				/*
-				 * Optimization to prevent most recursion: don't
-				 * recurse unless first pattern char might match this
-				 * text char.
+				 * Optimization to prevent most recursion: don't recurse
+				 * unless first pattern char might match this text char.
 				 */
-				if (CHAREQ(t,p) || (*p == '\\')  || (*p == '_'))
+				if (CHAREQ(t, p) || (*p == '\\') || (*p == '_'))
 				{
-					int matched = MatchText(t, tlen, p, plen);
+					int			matched = MatchText(t, tlen, p, plen);
 
 					if (matched != LIKE_FALSE)
-						return matched;		/* TRUE or ABORT */
+						return matched; /* TRUE or ABORT */
 				}
 
 				NextChar(t, tlen);
@@ -466,9 +496,11 @@ MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
 			 */
 			return LIKE_ABORT;
 		}
-		else if ((*p != '_') && !CHAREQ(t,p))
+		else if ((*p != '_') && !CHAREQ(t, p))
 		{
-			/* Not the single-character wildcard and no explicit match?
+
+			/*
+			 * Not the single-character wildcard and no explicit match?
 			 * Then time to quit...
 			 */
 			return LIKE_FALSE;
@@ -482,7 +514,8 @@ MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
 		return LIKE_FALSE;		/* end of pattern, but not of text */
 
 	/* End of input string.  Do we have matching pattern remaining? */
-	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of pattern */
+	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of
+										 * pattern */
 		NextChar(p, plen);
 	if (plen <= 0)
 		return LIKE_TRUE;
@@ -492,13 +525,13 @@ MatchText(unsigned char * t, int tlen, unsigned char * p, int plen)
 	 * start matching this pattern.
 	 */
 	return LIKE_ABORT;
-} /* MatchText() */
+}	/* MatchText() */
 
 /*
  * Same as above, but ignore case
  */
 static int
-MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
+MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
 {
 	/* Fast path for match-everything pattern */
 	if ((plen == 1) && (*p == '%'))
@@ -510,7 +543,7 @@ MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
 		{
 			/* Next pattern char must match literally, whatever it is */
 			NextChar(p, plen);
-			if ((plen <= 0) || !ICHAREQ(t,p))
+			if ((plen <= 0) || !ICHAREQ(t, p))
 				return LIKE_FALSE;
 		}
 		else if (*p == '%')
@@ -524,22 +557,22 @@ MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
 				return LIKE_TRUE;
 
 			/*
-			 * Otherwise, scan for a text position at which we can
-			 * match the rest of the pattern.
+			 * Otherwise, scan for a text position at which we can match
+			 * the rest of the pattern.
 			 */
 			while (tlen > 0)
 			{
+
 				/*
-				 * Optimization to prevent most recursion: don't
-				 * recurse unless first pattern char might match this
-				 * text char.
+				 * Optimization to prevent most recursion: don't recurse
+				 * unless first pattern char might match this text char.
 				 */
-				if (ICHAREQ(t,p) || (*p == '\\')  || (*p == '_'))
+				if (ICHAREQ(t, p) || (*p == '\\') || (*p == '_'))
 				{
-					int matched = MatchTextIC(t, tlen, p, plen);
+					int			matched = MatchTextIC(t, tlen, p, plen);
 
 					if (matched != LIKE_FALSE)
-						return matched;		/* TRUE or ABORT */
+						return matched; /* TRUE or ABORT */
 				}
 
 				NextChar(t, tlen);
@@ -551,9 +584,11 @@ MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
 			 */
 			return LIKE_ABORT;
 		}
-		else if ((*p != '_') && !ICHAREQ(t,p))
+		else if ((*p != '_') && !ICHAREQ(t, p))
 		{
-			/* Not the single-character wildcard and no explicit match?
+
+			/*
+			 * Not the single-character wildcard and no explicit match?
 			 * Then time to quit...
 			 */
 			return LIKE_FALSE;
@@ -567,7 +602,8 @@ MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
 		return LIKE_FALSE;		/* end of pattern, but not of text */
 
 	/* End of input string.  Do we have matching pattern remaining? */
-	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of pattern */
+	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of
+										 * pattern */
 		NextChar(p, plen);
 	if (plen <= 0)
 		return LIKE_TRUE;
@@ -577,4 +613,4 @@ MatchTextIC(unsigned char * t, int tlen, unsigned char * p, int plen)
 	 * start matching this pattern.
 	 */
 	return LIKE_ABORT;
-} /* MatchTextIC() */
+}	/* MatchTextIC() */
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c
index 17754588e9798c6486821bad1f953e4c8f0d6efb..0724abec5b2abc52977b7413037df66de048032f 100644
--- a/src/backend/utils/adt/mac.c
+++ b/src/backend/utils/adt/mac.c
@@ -1,7 +1,7 @@
 /*
  *	PostgreSQL type definitions for MAC addresses.
  *
- *	$Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.19 2000/12/08 23:57:03 tgl Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.20 2001/03/22 03:59:51 momjian Exp $
  */
 
 #include "postgres.h"
@@ -82,7 +82,7 @@ macaddr_in(PG_FUNCTION_ARGS)
 Datum
 macaddr_out(PG_FUNCTION_ARGS)
 {
-	macaddr	   *addr = PG_GETARG_MACADDR_P(0);
+	macaddr    *addr = PG_GETARG_MACADDR_P(0);
 	char	   *result;
 
 	result = (char *) palloc(32);
@@ -139,16 +139,16 @@ text_macaddr(PG_FUNCTION_ARGS)
 	char		str[18];
 	int			len;
 
-	len = (VARSIZE(addr)-VARHDRSZ);
+	len = (VARSIZE(addr) - VARHDRSZ);
 	if (len >= 18)
 		elog(ERROR, "Text is too long to convert to MAC address");
 
 	memmove(str, VARDATA(addr), len);
-	*(str+len) = '\0';
+	*(str + len) = '\0';
 
-    result = DirectFunctionCall1(macaddr_in, CStringGetDatum(str));
+	result = DirectFunctionCall1(macaddr_in, CStringGetDatum(str));
 
-	return(result);
+	return (result);
 }
 
 /*
@@ -173,8 +173,8 @@ macaddr_cmp_internal(macaddr *a1, macaddr *a2)
 Datum
 macaddr_cmp(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_INT32(macaddr_cmp_internal(a1, a2));
 }
@@ -186,8 +186,8 @@ macaddr_cmp(PG_FUNCTION_ARGS)
 Datum
 macaddr_lt(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) < 0);
 }
@@ -195,8 +195,8 @@ macaddr_lt(PG_FUNCTION_ARGS)
 Datum
 macaddr_le(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) <= 0);
 }
@@ -204,8 +204,8 @@ macaddr_le(PG_FUNCTION_ARGS)
 Datum
 macaddr_eq(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) == 0);
 }
@@ -213,8 +213,8 @@ macaddr_eq(PG_FUNCTION_ARGS)
 Datum
 macaddr_ge(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) >= 0);
 }
@@ -222,8 +222,8 @@ macaddr_ge(PG_FUNCTION_ARGS)
 Datum
 macaddr_gt(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) > 0);
 }
@@ -231,8 +231,8 @@ macaddr_gt(PG_FUNCTION_ARGS)
 Datum
 macaddr_ne(PG_FUNCTION_ARGS)
 {
-	macaddr	   *a1 = PG_GETARG_MACADDR_P(0);
-	macaddr	   *a2 = PG_GETARG_MACADDR_P(1);
+	macaddr    *a1 = PG_GETARG_MACADDR_P(0);
+	macaddr    *a2 = PG_GETARG_MACADDR_P(1);
 
 	PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) != 0);
 }
@@ -243,7 +243,7 @@ macaddr_ne(PG_FUNCTION_ARGS)
 Datum
 hashmacaddr(PG_FUNCTION_ARGS)
 {
-	macaddr	   *key = PG_GETARG_MACADDR_P(0);
+	macaddr    *key = PG_GETARG_MACADDR_P(0);
 
 	return hash_any((char *) key, sizeof(macaddr));
 }
@@ -255,8 +255,8 @@ hashmacaddr(PG_FUNCTION_ARGS)
 Datum
 macaddr_trunc(PG_FUNCTION_ARGS)
 {
-	macaddr	   *result;
-	macaddr	   *addr = PG_GETARG_MACADDR_P(0);
+	macaddr    *result;
+	macaddr    *addr = PG_GETARG_MACADDR_P(0);
 
 	result = (macaddr *) palloc(sizeof(macaddr));
 
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index d3a82eaf8a13c253c0b32656140cae59f98e1905..af08bda8789f4ecec850f4e1a64e1fe76b6aef39 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.21 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.22 2001/03/22 03:59:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,7 +53,7 @@ nonnullvalue(PG_FUNCTION_ARGS)
  *	   select * from TEMP where oidrand(TEMP.oid, 10)
  * will return about 1/10 of the tuples in TEMP
  *
- * NOTE: the OID input is not used at all.  It is there just because of
+ * NOTE: the OID input is not used at all.	It is there just because of
  * an old optimizer bug: a qual expression containing no variables was
  * mistakenly assumed to be a constant.  Pretending to access the row's OID
  * prevented the optimizer from treating the oidrand() result as constant.
@@ -66,6 +66,7 @@ oidrand(PG_FUNCTION_ARGS)
 {
 #ifdef NOT_USED
 	Oid			o = PG_GETARG_OID(0);
+
 #endif
 	int32		X = PG_GETARG_INT32(1);
 	bool		result;
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index 99dc95d4663268faa9692c6d650e3b2f3577c7e8..972ca7a67fa88d4693e36da5ef5091737f86f3c0 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.82 2001/02/21 22:03:00 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.83 2001/03/22 03:59:52 momjian Exp $
  *
  * NOTES
  *
@@ -162,7 +162,8 @@ GetCurrentAbsoluteTime(void)
 		CDayLight = tm->tm_isdst;
 		CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
 		strcpy(CTZName, tzname[tm->tm_isdst]);
-#else /* neither HAVE_TM_ZONE nor HAVE_INT_TIMEZONE */
+#else							/* neither HAVE_TM_ZONE nor
+								 * HAVE_INT_TIMEZONE */
 		CTimeZone = tb.timezone * 60;
 		CDayLight = (tb.dstflag != 0);
 
@@ -192,7 +193,8 @@ GetCurrentTime(struct tm * tm)
 void
 abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 {
-	time_t time = (time_t) _time;
+	time_t		time = (time_t) _time;
+
 #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
 	struct tm  *tx;
 
@@ -207,14 +209,14 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 	if (tzp != NULL)
 	{
 		tx = localtime((time_t *) &time);
-# ifdef NO_MKTIME_BEFORE_1970
+#ifdef NO_MKTIME_BEFORE_1970
 		if (tx->tm_year < 70 && tx->tm_isdst == 1)
 		{
 			time -= 3600;
 			tx = localtime((time_t *) &time);
 			tx->tm_isdst = 0;
 		}
-# endif
+#endif
 	}
 	else
 	{
@@ -229,7 +231,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 	tm->tm_sec = tx->tm_sec;
 	tm->tm_isdst = tx->tm_isdst;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 	tm->tm_gmtoff = tx->tm_gmtoff;
 	tm->tm_zone = tx->tm_zone;
 
@@ -243,11 +245,11 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 		 * Copy no more than MAXTZLEN bytes of timezone to tzn, in case it
 		 * contains an error message, which doesn't fit in the buffer
 		 */
-		StrNCpy(tzn, tm->tm_zone, MAXTZLEN+1);
+		StrNCpy(tzn, tm->tm_zone, MAXTZLEN + 1);
 		if (strlen(tm->tm_zone) > MAXTZLEN)
 			elog(NOTICE, "Invalid timezone \'%s\'", tm->tm_zone);
 	}
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 	if (tzp != NULL)
 		*tzp = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
 
@@ -258,12 +260,12 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 		 * Copy no more than MAXTZLEN bytes of timezone to tzn, in case it
 		 * contains an error message, which doesn't fit in the buffer
 		 */
-		StrNCpy(tzn, tzname[tm->tm_isdst], MAXTZLEN+1);
+		StrNCpy(tzn, tzname[tm->tm_isdst], MAXTZLEN + 1);
 		if (strlen(tzname[tm->tm_isdst]) > MAXTZLEN)
 			elog(NOTICE, "Invalid timezone \'%s\'", tzname[tm->tm_isdst]);
 	}
-# endif
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#endif
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 	if (tzp != NULL)
 		*tzp = tb.timezone * 60;
 
@@ -470,7 +472,7 @@ AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2)
 Datum
 abstime_finite(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	abstime = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
 
 	PG_RETURN_BOOL((abstime != INVALID_ABSTIME) &&
 				   (abstime != NOSTART_ABSTIME) &&
@@ -489,8 +491,8 @@ abstime_finite(PG_FUNCTION_ARGS)
 Datum
 abstimeeq(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -505,8 +507,8 @@ abstimeeq(PG_FUNCTION_ARGS)
 Datum
 abstimene(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -521,8 +523,8 @@ abstimene(PG_FUNCTION_ARGS)
 Datum
 abstimelt(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -537,8 +539,8 @@ abstimelt(PG_FUNCTION_ARGS)
 Datum
 abstimegt(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -553,8 +555,8 @@ abstimegt(PG_FUNCTION_ARGS)
 Datum
 abstimele(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -569,8 +571,8 @@ abstimele(PG_FUNCTION_ARGS)
 Datum
 abstimege(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	AbsoluteTime	t2 = PG_GETARG_ABSOLUTETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
 
 	if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
 		PG_RETURN_BOOL(false);
@@ -596,17 +598,11 @@ timestamp_abstime(PG_FUNCTION_ARGS)
 			   *tm = &tt;
 
 	if (TIMESTAMP_IS_INVALID(timestamp))
-	{
 		result = INVALID_ABSTIME;
-	}
 	else if (TIMESTAMP_IS_NOBEGIN(timestamp))
-	{
 		result = NOSTART_ABSTIME;
-	}
 	else if (TIMESTAMP_IS_NOEND(timestamp))
-	{
 		result = NOEND_ABSTIME;
-	}
 	else
 	{
 		if (TIMESTAMP_IS_RELATIVE(timestamp))
@@ -615,13 +611,9 @@ timestamp_abstime(PG_FUNCTION_ARGS)
 			result = tm2abstime(tm, 0);
 		}
 		else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) == 0)
-		{
 			result = tm2abstime(tm, 0);
-		}
 		else
-		{
 			result = INVALID_ABSTIME;
-		}
 	}
 
 	PG_RETURN_ABSOLUTETIME(result);
@@ -633,7 +625,7 @@ timestamp_abstime(PG_FUNCTION_ARGS)
 Datum
 abstime_timestamp(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	abstime = PG_GETARG_ABSOLUTETIME(0);
+	AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
 	Timestamp	result;
 
 	switch (abstime)
@@ -677,7 +669,7 @@ abstime_timestamp(PG_FUNCTION_ARGS)
 Datum
 reltimein(PG_FUNCTION_ARGS)
 {
-	char		*str = PG_GETARG_CSTRING(0);
+	char	   *str = PG_GETARG_CSTRING(0);
 	RelativeTime result;
 	struct tm	tt,
 			   *tm = &tt;
@@ -724,9 +716,7 @@ reltimeout(PG_FUNCTION_ARGS)
 	char		buf[MAXDATELEN + 1];
 
 	if (time == INVALID_RELTIME)
-	{
 		strcpy(buf, INVALID_RELTIME_STR);
-	}
 	else
 	{
 		reltime2tm(time, tm);
@@ -840,12 +830,12 @@ tintervalout(PG_FUNCTION_ARGS)
 	else
 	{
 		p = DatumGetCString(DirectFunctionCall1(nabstimeout,
-							AbsoluteTimeGetDatum(interval->data[0])));
+							   AbsoluteTimeGetDatum(interval->data[0])));
 		strcat(i_str, p);
 		pfree(p);
 		strcat(i_str, "\" \"");
 		p = DatumGetCString(DirectFunctionCall1(nabstimeout,
-							AbsoluteTimeGetDatum(interval->data[1])));
+							   AbsoluteTimeGetDatum(interval->data[1])));
 		strcat(i_str, p);
 		pfree(p);
 	}
@@ -868,9 +858,7 @@ interval_reltime(PG_FUNCTION_ARGS)
 	double		span;
 
 	if (INTERVAL_IS_INVALID(*interval))
-	{
 		time = INVALID_RELTIME;
-	}
 	else
 	{
 		if (interval->month == 0)
@@ -965,8 +953,8 @@ mktinterval(PG_FUNCTION_ARGS)
 Datum
 timepl(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == CURRENT_ABSTIME)
 		t1 = GetCurrentTransactionStartTime();
@@ -987,8 +975,8 @@ timepl(PG_FUNCTION_ARGS)
 Datum
 timemi(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t1 = PG_GETARG_ABSOLUTETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == CURRENT_ABSTIME)
 		t1 = GetCurrentTransactionStartTime();
@@ -1030,17 +1018,17 @@ abstimemi(AbsoluteTime t1, AbsoluteTime t2)
 Datum
 intinterval(PG_FUNCTION_ARGS)
 {
-	AbsoluteTime	t = PG_GETARG_ABSOLUTETIME(0);
-	TimeInterval	interval = PG_GETARG_TIMEINTERVAL(1);
+	AbsoluteTime t = PG_GETARG_ABSOLUTETIME(0);
+	TimeInterval interval = PG_GETARG_TIMEINTERVAL(1);
 
 	if (interval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME)
 	{
 		if (DatumGetBool(DirectFunctionCall2(abstimege,
-						 AbsoluteTimeGetDatum(t),
-						 AbsoluteTimeGetDatum(interval->data[0]))) &&
+											 AbsoluteTimeGetDatum(t),
+							 AbsoluteTimeGetDatum(interval->data[0]))) &&
 			DatumGetBool(DirectFunctionCall2(abstimele,
-						 AbsoluteTimeGetDatum(t),
-						 AbsoluteTimeGetDatum(interval->data[1]))))
+											 AbsoluteTimeGetDatum(t),
+							   AbsoluteTimeGetDatum(interval->data[1]))))
 			PG_RETURN_BOOL(true);
 	}
 	PG_RETURN_BOOL(false);
@@ -1086,8 +1074,8 @@ timenow(PG_FUNCTION_ARGS)
 Datum
 reltimeeq(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1097,8 +1085,8 @@ reltimeeq(PG_FUNCTION_ARGS)
 Datum
 reltimene(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1108,8 +1096,8 @@ reltimene(PG_FUNCTION_ARGS)
 Datum
 reltimelt(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1119,8 +1107,8 @@ reltimelt(PG_FUNCTION_ARGS)
 Datum
 reltimegt(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1130,8 +1118,8 @@ reltimegt(PG_FUNCTION_ARGS)
 Datum
 reltimele(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1141,8 +1129,8 @@ reltimele(PG_FUNCTION_ARGS)
 Datum
 reltimege(PG_FUNCTION_ARGS)
 {
-	RelativeTime	t1 = PG_GETARG_RELATIVETIME(0);
-	RelativeTime	t2 = PG_GETARG_RELATIVETIME(1);
+	RelativeTime t1 = PG_GETARG_RELATIVETIME(0);
+	RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
 
 	if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
@@ -1157,18 +1145,18 @@ reltimege(PG_FUNCTION_ARGS)
 Datum
 tintervalsame(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 
 	if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
 		PG_RETURN_BOOL(false);
 
 	if (DatumGetBool(DirectFunctionCall2(abstimeeq,
-										 AbsoluteTimeGetDatum(i1->data[0]),
-										 AbsoluteTimeGetDatum(i2->data[0]))) &&
+									   AbsoluteTimeGetDatum(i1->data[0]),
+								   AbsoluteTimeGetDatum(i2->data[0]))) &&
 		DatumGetBool(DirectFunctionCall2(abstimeeq,
-										 AbsoluteTimeGetDatum(i1->data[1]),
-										 AbsoluteTimeGetDatum(i2->data[1]))))
+									   AbsoluteTimeGetDatum(i1->data[1]),
+									 AbsoluteTimeGetDatum(i2->data[1]))))
 		PG_RETURN_BOOL(true);
 	PG_RETURN_BOOL(false);
 }
@@ -1181,8 +1169,8 @@ tintervalsame(PG_FUNCTION_ARGS)
 Datum
 tintervaleq(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1215,8 +1203,8 @@ tintervaleq(PG_FUNCTION_ARGS)
 Datum
 tintervalne(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1249,8 +1237,8 @@ tintervalne(PG_FUNCTION_ARGS)
 Datum
 tintervallt(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1283,8 +1271,8 @@ tintervallt(PG_FUNCTION_ARGS)
 Datum
 tintervalle(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1317,8 +1305,8 @@ tintervalle(PG_FUNCTION_ARGS)
 Datum
 tintervalgt(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1351,8 +1339,8 @@ tintervalgt(PG_FUNCTION_ARGS)
 Datum
 tintervalge(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 	AbsoluteTime t10,
 				t11,
 				t20,
@@ -1407,7 +1395,7 @@ tintervalleneq(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt == t);
 }
 
@@ -1421,7 +1409,7 @@ tintervallenne(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt != t);
 }
 
@@ -1435,7 +1423,7 @@ tintervallenlt(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt < t);
 }
 
@@ -1449,7 +1437,7 @@ tintervallengt(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt > t);
 }
 
@@ -1463,7 +1451,7 @@ tintervallenle(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt <= t);
 }
 
@@ -1477,7 +1465,7 @@ tintervallenge(PG_FUNCTION_ARGS)
 	if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME)
 		PG_RETURN_BOOL(false);
 	rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel,
-												  TimeIntervalGetDatum(i)));
+											   TimeIntervalGetDatum(i)));
 	PG_RETURN_BOOL(rt != INVALID_RELTIME && rt >= t);
 }
 
@@ -1487,17 +1475,17 @@ tintervallenge(PG_FUNCTION_ARGS)
 Datum
 tintervalct(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 
 	if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
 		PG_RETURN_BOOL(false);
 	if (DatumGetBool(DirectFunctionCall2(abstimele,
-										 AbsoluteTimeGetDatum(i1->data[0]),
-										 AbsoluteTimeGetDatum(i2->data[0]))) &&
+									   AbsoluteTimeGetDatum(i1->data[0]),
+								   AbsoluteTimeGetDatum(i2->data[0]))) &&
 		DatumGetBool(DirectFunctionCall2(abstimege,
-										 AbsoluteTimeGetDatum(i1->data[1]),
-										 AbsoluteTimeGetDatum(i2->data[1]))))
+									   AbsoluteTimeGetDatum(i1->data[1]),
+									 AbsoluteTimeGetDatum(i2->data[1]))))
 		PG_RETURN_BOOL(true);
 	PG_RETURN_BOOL(false);
 }
@@ -1508,17 +1496,17 @@ tintervalct(PG_FUNCTION_ARGS)
 Datum
 tintervalov(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i1 = PG_GETARG_TIMEINTERVAL(0);
-	TimeInterval	i2 = PG_GETARG_TIMEINTERVAL(1);
+	TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1);
 
 	if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
 		PG_RETURN_BOOL(false);
 	if (DatumGetBool(DirectFunctionCall2(abstimelt,
-										 AbsoluteTimeGetDatum(i1->data[1]),
-										 AbsoluteTimeGetDatum(i2->data[0]))) ||
+									   AbsoluteTimeGetDatum(i1->data[1]),
+								   AbsoluteTimeGetDatum(i2->data[0]))) ||
 		DatumGetBool(DirectFunctionCall2(abstimegt,
-										 AbsoluteTimeGetDatum(i1->data[0]),
-										 AbsoluteTimeGetDatum(i2->data[1]))))
+									   AbsoluteTimeGetDatum(i1->data[0]),
+									 AbsoluteTimeGetDatum(i2->data[1]))))
 		PG_RETURN_BOOL(false);
 	PG_RETURN_BOOL(true);
 }
@@ -1529,7 +1517,7 @@ tintervalov(PG_FUNCTION_ARGS)
 Datum
 tintervalstart(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i = PG_GETARG_TIMEINTERVAL(0);
 
 	if (i->status == T_INTERVAL_INVAL)
 		PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME);
@@ -1542,7 +1530,7 @@ tintervalstart(PG_FUNCTION_ARGS)
 Datum
 tintervalend(PG_FUNCTION_ARGS)
 {
-	TimeInterval	i = PG_GETARG_TIMEINTERVAL(0);
+	TimeInterval i = PG_GETARG_TIMEINTERVAL(0);
 
 	if (i->status == T_INTERVAL_INVAL)
 		PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME);
@@ -1835,7 +1823,7 @@ istinterval(char *i_string,
 	}
 	/* get the first date */
 	*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
-									CStringGetDatum(p)));
+													CStringGetDatum(p)));
 	/* rechange NULL at the end of the first date to a "'" */
 	*p1 = '"';
 	p = ++p1;
@@ -1863,7 +1851,7 @@ istinterval(char *i_string,
 	}
 	/* get the second date */
 	*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
-								  CStringGetDatum(p)));
+													CStringGetDatum(p)));
 	/* rechange NULL at the end of the first date to a ''' */
 	*p1 = '"';
 	p = ++p1;
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index 97e0825adf86d91266536af7fccfe1c9b7fe6bc0..56bc534c23011791fb089f622c4e56834d990b23 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -3,7 +3,7 @@
  *	is for IP V4 CIDR notation, but prepared for V6: just
  *	add the necessary bits where the comments indicate.
  *
- *	$Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.28 2000/12/22 18:00:20 tgl Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.29 2001/03/22 03:59:52 momjian Exp $
  *
  *	Jon Postel RIP 16 Oct 1998
  */
@@ -21,7 +21,7 @@
 
 
 static int32 network_cmp_internal(inet *a1, inet *a2);
-static int v4bitncmp(unsigned long a1, unsigned long a2, int bits);
+static int	v4bitncmp(unsigned long a1, unsigned long a2, int bits);
 static bool v4addressOK(unsigned long a1, int bits);
 
 /*
@@ -66,12 +66,12 @@ network_in(char *src, int type)
 	}
 
 	/*
-	 * Error check: CIDR values must not have any bits set beyond the masklen.
-	 * XXX this code is not IPV6 ready.
+	 * Error check: CIDR values must not have any bits set beyond the
+	 * masklen. XXX this code is not IPV6 ready.
 	 */
 	if (type)
 	{
-		if (! v4addressOK(ip_v4addr(dst), bits))
+		if (!v4addressOK(ip_v4addr(dst), bits))
 			elog(ERROR, "invalid CIDR value '%s': has bits set to right of mask", src);
 	}
 
@@ -116,7 +116,9 @@ inet_out(PG_FUNCTION_ARGS)
 	if (ip_family(src) == AF_INET)
 	{
 		/* It's an IP V4 address: */
-		/* Use inet style for both inet and cidr, since we don't want
+
+		/*
+		 * Use inet style for both inet and cidr, since we don't want
 		 * abbreviated CIDR style here.
 		 */
 		dst = inet_net_ntop(AF_INET, &ip_v4addr(src), ip_bits(src),
@@ -162,7 +164,7 @@ network_cmp_internal(inet *a1, inet *a2)
 {
 	if (ip_family(a1) == AF_INET && ip_family(a2) == AF_INET)
 	{
-		int		order;
+		int			order;
 
 		order = v4bitncmp(ip_v4addr(a1), ip_v4addr(a2),
 						  Min(ip_bits(a1), ip_bits(a2)));
@@ -260,7 +262,7 @@ network_sub(PG_FUNCTION_ARGS)
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
 		PG_RETURN_BOOL(ip_bits(a1) > ip_bits(a2)
-			&& v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0);
+		   && v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0);
 	}
 	else
 	{
@@ -280,7 +282,7 @@ network_subeq(PG_FUNCTION_ARGS)
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
 		PG_RETURN_BOOL(ip_bits(a1) >= ip_bits(a2)
-			&& v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0);
+		   && v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0);
 	}
 	else
 	{
@@ -300,7 +302,7 @@ network_sup(PG_FUNCTION_ARGS)
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
 		PG_RETURN_BOOL(ip_bits(a1) < ip_bits(a2)
-			&& v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0);
+		   && v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0);
 	}
 	else
 	{
@@ -320,7 +322,7 @@ network_supeq(PG_FUNCTION_ARGS)
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
 		PG_RETURN_BOOL(ip_bits(a1) <= ip_bits(a2)
-			&& v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0);
+		   && v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0);
 	}
 	else
 	{
@@ -456,8 +458,9 @@ network_broadcast(PG_FUNCTION_ARGS)
 		/* It's an IP V4 address: */
 		unsigned long mask = 0xffffffff;
 
-		/* Shifting by 32 or more bits does not yield portable results,
-		 * so don't try it.
+		/*
+		 * Shifting by 32 or more bits does not yield portable results, so
+		 * don't try it.
 		 */
 		if (ip_bits(ip) < 32)
 			mask >>= ip_bits(ip);
@@ -495,8 +498,9 @@ network_network(PG_FUNCTION_ARGS)
 		/* It's an IP V4 address: */
 		unsigned long mask = 0xffffffff;
 
-		/* Shifting by 32 or more bits does not yield portable results,
-		 * so don't try it.
+		/*
+		 * Shifting by 32 or more bits does not yield portable results, so
+		 * don't try it.
 		 */
 		if (ip_bits(ip) > 0)
 			mask <<= (32 - ip_bits(ip));
@@ -534,8 +538,9 @@ network_netmask(PG_FUNCTION_ARGS)
 		/* It's an IP V4 address: */
 		unsigned long mask = 0xffffffff;
 
-		/* Shifting by 32 or more bits does not yield portable results,
-		 * so don't try it.
+		/*
+		 * Shifting by 32 or more bits does not yield portable results, so
+		 * don't try it.
 		 */
 		if (ip_bits(ip) > 0)
 			mask <<= (32 - ip_bits(ip));
@@ -568,8 +573,9 @@ v4bitncmp(unsigned long a1, unsigned long a2, int bits)
 {
 	unsigned long mask;
 
-	/* Shifting by 32 or more bits does not yield portable results,
-	 * so don't try it.
+	/*
+	 * Shifting by 32 or more bits does not yield portable results, so
+	 * don't try it.
 	 */
 	if (bits > 0)
 		mask = (0xFFFFFFFFL << (32 - bits)) & 0xFFFFFFFFL;
@@ -592,8 +598,9 @@ v4addressOK(unsigned long a1, int bits)
 {
 	unsigned long mask;
 
-	/* Shifting by 32 or more bits does not yield portable results,
-	 * so don't try it.
+	/*
+	 * Shifting by 32 or more bits does not yield portable results, so
+	 * don't try it.
 	 */
 	if (bits > 0)
 		mask = (0xFFFFFFFFL << (32 - bits)) & 0xFFFFFFFFL;
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c
index 450cfb2484ad8c7016020032c022d3ca893c872f..ac596b1f1238cb6623c35fd33c816032a9f4dec6 100644
--- a/src/backend/utils/adt/not_in.c
+++ b/src/backend/utils/adt/not_in.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.25 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.26 2001/03/22 03:59:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ int4notin(PG_FUNCTION_ARGS)
 	/* make a null-terminated copy of text */
 	strlength = VARSIZE(relation_and_attr) - VARHDRSZ;
 	if (strlength >= sizeof(my_copy))
-		strlength = sizeof(my_copy)-1;
+		strlength = sizeof(my_copy) - 1;
 	memcpy(my_copy, VARDATA(relation_and_attr), strlength);
 	my_copy[strlength] = '\0';
 
@@ -110,8 +110,10 @@ Datum
 oidnotin(PG_FUNCTION_ARGS)
 {
 	Oid			the_oid = PG_GETARG_OID(0);
+
 #ifdef NOT_USED
 	text	   *relation_and_attr = PG_GETARG_TEXT_P(1);
+
 #endif
 
 	if (the_oid == InvalidOid)
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index d18d3003a0888bdf35e196b08554d167d757ff41..4a16741bb91e58319c8bab99857afa5104766699 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -5,7 +5,7 @@
  *
  *	1998 Jan Wieck
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.37 2001/03/14 16:50:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.38 2001/03/22 03:59:52 momjian Exp $
  *
  * ----------
  */
@@ -192,8 +192,10 @@ Datum
 numeric_in(PG_FUNCTION_ARGS)
 {
 	char	   *str = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
 	Oid			typelem = PG_GETARG_OID(1);
+
 #endif
 	int32		typmod = PG_GETARG_INT32(2);
 	NumericVar	value;
@@ -1865,8 +1867,8 @@ do_numeric_accum(ArrayType *transarray, Numeric newval)
 							   NumericGetDatum(newval));
 	sumX2 = DirectFunctionCall2(numeric_add, sumX2,
 								DirectFunctionCall2(numeric_mul,
-													NumericGetDatum(newval),
-													NumericGetDatum(newval)));
+												 NumericGetDatum(newval),
+											   NumericGetDatum(newval)));
 
 	transdatums[0] = N;
 	transdatums[1] = sumX;
@@ -2011,8 +2013,8 @@ numeric_variance(PG_FUNCTION_ARGS)
 	mul_var(&vsumX, &vsumX, &vsumX);	/* now vsumX contains sumX * sumX */
 	mul_var(&vN, &vsumX2, &vsumX2);		/* now vsumX2 contains N * sumX2 */
 	sub_var(&vsumX2, &vsumX, &vsumX2);	/* N * sumX2 - sumX * sumX */
-	mul_var(&vN, &vNminus1, &vNminus1);	/* N * (N - 1) */
-	div_var(&vsumX2, &vNminus1, &vsumX); /* variance */
+	mul_var(&vN, &vNminus1, &vNminus1); /* N * (N - 1) */
+	div_var(&vsumX2, &vNminus1, &vsumX);		/* variance */
 
 	res = make_result(&vsumX);
 
@@ -2078,9 +2080,9 @@ numeric_stddev(PG_FUNCTION_ARGS)
 	mul_var(&vsumX, &vsumX, &vsumX);	/* now vsumX contains sumX * sumX */
 	mul_var(&vN, &vsumX2, &vsumX2);		/* now vsumX2 contains N * sumX2 */
 	sub_var(&vsumX2, &vsumX, &vsumX2);	/* N * sumX2 - sumX * sumX */
-	mul_var(&vN, &vNminus1, &vNminus1);	/* N * (N - 1) */
-	div_var(&vsumX2, &vNminus1, &vsumX); /* variance */
-	sqrt_var(&vsumX, &vsumX);			/* stddev */
+	mul_var(&vN, &vNminus1, &vNminus1); /* N * (N - 1) */
+	div_var(&vsumX2, &vNminus1, &vsumX);		/* variance */
+	sqrt_var(&vsumX, &vsumX);	/* stddev */
 
 	res = make_result(&vsumX);
 
@@ -2096,9 +2098,9 @@ numeric_stddev(PG_FUNCTION_ARGS)
 /*
  * SUM transition functions for integer datatypes.
  *
- * We use a Numeric accumulator to avoid overflow.  Because SQL92 defines
+ * We use a Numeric accumulator to avoid overflow.	Because SQL92 defines
  * the SUM() of no values to be NULL, not zero, the initial condition of
- * the transition data value needs to be NULL.  This means we can't rely
+ * the transition data value needs to be NULL.	This means we can't rely
  * on ExecAgg to automatically insert the first non-null data value into
  * the transition data: it doesn't know how to do the type conversion.
  * The upshot is that these routines have to be marked non-strict and
@@ -3563,7 +3565,7 @@ exp_var(NumericVar *arg, NumericVar *result)
 	set_var_from_var(&const_one, &ifac);
 	set_var_from_var(&const_one, &ni);
 
-	for (i = 2; ; i++)
+	for (i = 2;; i++)
 	{
 		add_var(&ni, &const_one, &ni);
 		mul_var(&xpow, &x, &xpow);
@@ -3647,7 +3649,7 @@ ln_var(NumericVar *arg, NumericVar *result)
 
 	set_var_from_var(&const_one, &ni);
 
-	for (i = 2; ; i++)
+	for (i = 2;; i++)
 	{
 		add_var(&ni, &const_two, &ni);
 		mul_var(&xx, &x, &xx);
@@ -3820,6 +3822,7 @@ add_abs(NumericVar *var1, NumericVar *var2, NumericVar *result)
 				i1,
 				i2;
 	int			carry = 0;
+
 	/* copy these values into local vars for speed in inner loop */
 	int			var1ndigits = var1->ndigits;
 	int			var2ndigits = var2->ndigits;
@@ -3906,6 +3909,7 @@ sub_abs(NumericVar *var1, NumericVar *var2, NumericVar *result)
 				i1,
 				i2;
 	int			borrow = 0;
+
 	/* copy these values into local vars for speed in inner loop */
 	int			var1ndigits = var1->ndigits;
 	int			var2ndigits = var2->ndigits;
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index 11e779d45d6b4b6a1e2096718a97ed8c8a8e250f..92af2ab56cf546d2f2ed4cf221579a562d4f4d4c 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.44 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.45 2001/03/22 03:59:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,11 +63,11 @@ pg_atoi(char *s, int size, int c)
 		l = (long) 0;
 	else
 		l = strtol(s, &badp, 10);
+
 	/*
-	 * strtol() normally only sets ERANGE.  On some systems it also
-	 * may set EINVAL, which simply means it couldn't parse the
-	 * input string.  This is handled by the second "if" consistent
-	 * across platforms.
+	 * strtol() normally only sets ERANGE.	On some systems it also may
+	 * set EINVAL, which simply means it couldn't parse the input string.
+	 * This is handled by the second "if" consistent across platforms.
 	 */
 	if (errno && errno != EINVAL)
 		elog(ERROR, "pg_atoi: error reading \"%s\": %m", s);
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c
index 0cb4ea1a0a2f67130b98bdce5ef964f5e2d9277a..91dbf6c54ebdce6ed00c0c31268de81462726e1b 100644
--- a/src/backend/utils/adt/oid.c
+++ b/src/backend/utils/adt/oid.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.44 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.45 2001/03/22 03:59:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,11 +36,11 @@ oidin_subr(const char *funcname, const char *s, char **endloc)
 	cvt = strtoul(s, &endptr, 10);
 
 	/*
-	 * strtoul() normally only sets ERANGE.  On some systems it also
-	 * may set EINVAL, which simply means it couldn't parse the
-	 * input string.  This is handled by the second "if" consistent
-	 * across platforms.  Note that for historical reasons we accept
-	 * an empty string as meaning 0.
+	 * strtoul() normally only sets ERANGE.  On some systems it also may
+	 * set EINVAL, which simply means it couldn't parse the input string.
+	 * This is handled by the second "if" consistent across platforms.
+	 * Note that for historical reasons we accept an empty string as
+	 * meaning 0.
 	 */
 	if (errno && errno != EINVAL)
 		elog(ERROR, "%s: error reading \"%s\": %m",
@@ -67,21 +67,20 @@ oidin_subr(const char *funcname, const char *s, char **endloc)
 	result = (Oid) cvt;
 
 	/*
-	 * Cope with possibility that unsigned long is wider than Oid,
-	 * in which case strtoul will not raise an error for some values
-	 * that are out of the range of Oid.
+	 * Cope with possibility that unsigned long is wider than Oid, in
+	 * which case strtoul will not raise an error for some values that are
+	 * out of the range of Oid.
 	 *
-	 * For backwards compatibility, we want to accept inputs that
-	 * are given with a minus sign, so allow the input value if it
-	 * matches after either signed or unsigned extension to long.
+	 * For backwards compatibility, we want to accept inputs that are given
+	 * with a minus sign, so allow the input value if it matches after
+	 * either signed or unsigned extension to long.
 	 *
-	 * To ensure consistent results on 32-bit and 64-bit platforms,
-	 * make sure the error message is the same as if strtoul() had
-	 * returned ERANGE.
+	 * To ensure consistent results on 32-bit and 64-bit platforms, make sure
+	 * the error message is the same as if strtoul() had returned ERANGE.
 	 */
 #if OID_MAX != ULONG_MAX
 	if (cvt != (unsigned long) result &&
-	    cvt != (unsigned long) ((int) result))
+		cvt != (unsigned long) ((int) result))
 		elog(ERROR, "%s: error reading \"%s\": %s",
 			 funcname, s, strerror(ERANGE));
 #endif
@@ -235,8 +234,8 @@ oidgt(PG_FUNCTION_ARGS)
 Datum
 oidvectoreq(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 
 	PG_RETURN_BOOL(memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(Oid)) == 0);
 }
@@ -244,8 +243,8 @@ oidvectoreq(PG_FUNCTION_ARGS)
 Datum
 oidvectorne(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 
 	PG_RETURN_BOOL(memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(Oid)) != 0);
 }
@@ -253,8 +252,8 @@ oidvectorne(PG_FUNCTION_ARGS)
 Datum
 oidvectorlt(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 	int			i;
 
 	for (i = 0; i < INDEX_MAX_KEYS; i++)
@@ -266,8 +265,8 @@ oidvectorlt(PG_FUNCTION_ARGS)
 Datum
 oidvectorle(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 	int			i;
 
 	for (i = 0; i < INDEX_MAX_KEYS; i++)
@@ -279,8 +278,8 @@ oidvectorle(PG_FUNCTION_ARGS)
 Datum
 oidvectorge(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 	int			i;
 
 	for (i = 0; i < INDEX_MAX_KEYS; i++)
@@ -292,8 +291,8 @@ oidvectorge(PG_FUNCTION_ARGS)
 Datum
 oidvectorgt(PG_FUNCTION_ARGS)
 {
-	Oid			*arg1 = (Oid *) PG_GETARG_POINTER(0);
-	Oid			*arg2 = (Oid *) PG_GETARG_POINTER(1);
+	Oid		   *arg1 = (Oid *) PG_GETARG_POINTER(0);
+	Oid		   *arg2 = (Oid *) PG_GETARG_POINTER(1);
 	int			i;
 
 	for (i = 0; i < INDEX_MAX_KEYS; i++)
diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c
index 5a83c56687f6273952c5041db668e171886f2ab4..b91230b1f0a8e1ec19d5d9cb7aa4380cce367039 100644
--- a/src/backend/utils/adt/oracle_compat.c
+++ b/src/backend/utils/adt/oracle_compat.c
@@ -1,7 +1,7 @@
 /*
  *	Edmund Mergl <E.Mergl@bawue.de>
  *
- *	$Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.30 2000/12/07 23:22:56 tgl Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.31 2001/03/22 03:59:52 momjian Exp $
  *
  */
 
@@ -596,8 +596,8 @@ ascii(PG_FUNCTION_ARGS)
 Datum
 chr(PG_FUNCTION_ARGS)
 {
-	int32	cvalue = PG_GETARG_INT32(0);
-	text	*result;
+	int32		cvalue = PG_GETARG_INT32(0);
+	text	   *result;
 
 	result = (text *) palloc(VARHDRSZ + 1);
 	VARATT_SIZEP(result) = VARHDRSZ + 1;
@@ -616,20 +616,20 @@ chr(PG_FUNCTION_ARGS)
  *
  * Purpose:
  *
- *	Repeat string by val. 
+ *	Repeat string by val.
  *
  ********************************************************************/
 
 Datum
 repeat(PG_FUNCTION_ARGS)
 {
-	text	*string = PG_GETARG_TEXT_P(0);
-	int32	count = PG_GETARG_INT32(1);
-	text	*result;
-	int	slen,
-		tlen;
-	int	i;
-	char	*cp;
+	text	   *string = PG_GETARG_TEXT_P(0);
+	int32		count = PG_GETARG_INT32(1);
+	text	   *result;
+	int			slen,
+				tlen;
+	int			i;
+	char	   *cp;
 
 	if (count < 0)
 		count = 0;
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 6d30a53edcb4fcb9347cfef211a3e3213f1c64ab..faa81cd09afe550348d782b55ac27f0805ec9b3d 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -4,7 +4,7 @@
  *	 The PostgreSQL locale utils.
  *
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.8 2001/01/24 19:43:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.9 2001/03/22 03:59:52 momjian Exp $
  *
  *	 Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
  *
@@ -68,7 +68,7 @@ PGLC_debug_lc(PG_LocaleCategories * lc)
 		 lc->lc_collate,
 		 lc->lc_monetary
 #ifdef LC_MESSAGES
-		 , lc->lc_messages
+		 ,lc->lc_messages
 #endif
 	);
 }
@@ -116,7 +116,7 @@ PGLC_setlocale(PG_LocaleCategories * lc)
 
 /*------
  * Return the POSIX lconv struct (contains number/money formatting information)
- * with locale information for all categories.  Note that returned lconv
+ * with locale information for all categories.	Note that returned lconv
  * does not depend on currently active category settings, but on external
  * environment variables for locale.
  *
diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c
index fc93031b521eb0ee7a5d373ceedd55804fecaecd..f548775ad2f18807cbae3a39aa38c9d5bab434f6 100644
--- a/src/backend/utils/adt/pg_lzcompress.c
+++ b/src/backend/utils/adt/pg_lzcompress.c
@@ -1,7 +1,7 @@
 /* ----------
  * pg_lzcompress.c -
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.9 2000/10/03 03:11:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.10 2001/03/22 03:59:52 momjian Exp $
  *
  *		This is an implementation of LZ compression for PostgreSQL.
  *		It uses a simple history table and generates 2-3 byte tags
@@ -120,7 +120,7 @@
  *			8 times the size of the input!).
  *
  *			The compressor creates a table for 8192 lists of positions.
- *			For each input position (except the last 3), a hash key is 
+ *			For each input position (except the last 3), a hash key is
  *			built from the 4 next input bytes and the posiiton remembered
  *			in the appropriate list. Thus, the table points to linked
  *			lists of likely to be at least in the first 4 characters
@@ -152,7 +152,7 @@
  *
  *				- a match >= good_match is found
  *				- there are no more history entries to look at
- *              - the next history entry is already too far back
+ *				- the next history entry is already too far back
  *				  to be coded into a tag.
  *
  *			Finally the match algorithm checks that at least a match
@@ -286,18 +286,18 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
 #define pglz_hist_add(_hs,_he,_hn,_s,_e) {									\
 			int __hindex = pglz_hist_idx((_s),(_e));						\
 			if ((_he)[(_hn)].prev == NULL) {								\
-			    (_hs)[__hindex] = (_he)[(_hn)].next;						\
+				(_hs)[__hindex] = (_he)[(_hn)].next;						\
 			} else {														\
-			    (_he)[(_hn)].prev->next = (_he)[(_hn)].next;				\
+				(_he)[(_hn)].prev->next = (_he)[(_hn)].next;				\
 			}																\
 			if ((_he)[(_hn)].next != NULL) {								\
-			    (_he)[(_hn)].next->prev = (_he)[(_hn)].prev;				\
+				(_he)[(_hn)].next->prev = (_he)[(_hn)].prev;				\
 			}																\
 			(_he)[(_hn)].next = (_hs)[__hindex];							\
 			(_he)[(_hn)].prev = NULL;										\
 			(_he)[(_hn)].pos  = (_s);										\
 			if ((_hs)[__hindex] != NULL) {									\
-			    (_hs)[__hindex]->prev = &((_he)[(_hn)]);					\
+				(_hs)[__hindex]->prev = &((_he)[(_hn)]);					\
 			}																\
 			(_hs)[__hindex] = &((_he)[(_hn)]);								\
 			if (++(_hn) >= PGLZ_HISTORY_SIZE) {								\
@@ -476,7 +476,7 @@ pglz_find_match(PGLZ_HistEntry **hstart, char *input, char *end,
 int
 pglz_compress(char *source, int32 slen, PGLZ_Header *dest, PGLZ_Strategy *strategy)
 {
-	int            hist_next = 0;
+	int			hist_next = 0;
 
 	unsigned char *bp = ((unsigned char *) dest) + sizeof(PGLZ_Header);
 	unsigned char *bstart = bp;
diff --git a/src/backend/utils/adt/quote.c b/src/backend/utils/adt/quote.c
index 02aaac74134dbbecf2d7edc055cf5cff72bc5768..10999150a217cc363cd0919dee9dad77f39c00a4 100644
--- a/src/backend/utils/adt/quote.c
+++ b/src/backend/utils/adt/quote.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/quote.c,v 1.3 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/quote.c,v 1.4 2001/03/22 03:59:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,12 +35,10 @@ quote_ident(PG_FUNCTION_ARGS)
 	text	   *result;
 
 	if (quote_ident_required(t))
-	{
-	    result = do_quote_ident(t);
-	}
+		result = do_quote_ident(t);
 	else
 	{
-		result = (text *)palloc(VARSIZE(t));
+		result = (text *) palloc(VARSIZE(t));
 		memcpy(result, t, VARSIZE(t));
 	}
 
@@ -79,23 +77,26 @@ quote_literal(PG_FUNCTION_ARGS)
 static bool
 quote_ident_required(text *iptr)
 {
-    char   *cp;
-	char   *ep;
+	char	   *cp;
+	char	   *ep;
 
 	cp = VARDATA(iptr);
-    ep = VARDATA(iptr) + VARSIZE(iptr) - VARHDRSZ;
+	ep = VARDATA(iptr) + VARSIZE(iptr) - VARHDRSZ;
 
 	if (cp >= ep)
 		return true;
 
-    if (!(*cp == '_' || (*cp >= 'a' && *cp <= 'z')))
+	if (!(*cp == '_' || (*cp >= 'a' && *cp <= 'z')))
 		return true;
 
-	while((++cp) < ep)
+	while ((++cp) < ep)
 	{
-	    if (*cp >= 'a' && *cp <= 'z') continue;
-		if (*cp >= '0' && *cp <= '9') continue;
-		if (*cp == '_') continue;
+		if (*cp >= 'a' && *cp <= 'z')
+			continue;
+		if (*cp >= '0' && *cp <= '9')
+			continue;
+		if (*cp == '_')
+			continue;
 
 		return true;
 	}
@@ -107,29 +108,29 @@ quote_ident_required(text *iptr)
 static text *
 do_quote_ident(text *iptr)
 {
-    text   *result;
-	char   *cp1;
-	char   *cp2;
-	int		len;
+	text	   *result;
+	char	   *cp1;
+	char	   *cp2;
+	int			len;
 
-    len = VARSIZE(iptr) - VARHDRSZ;
-	result = (text *)palloc(len * 2 + VARHDRSZ + 2);
+	len = VARSIZE(iptr) - VARHDRSZ;
+	result = (text *) palloc(len * 2 + VARHDRSZ + 2);
 
 	cp1 = VARDATA(iptr);
 	cp2 = VARDATA(result);
 
 	*cp2++ = '"';
-	while(len-- > 0)
+	while (len-- > 0)
 	{
-	    if (*cp1 == '"')
+		if (*cp1 == '"')
 			*cp2++ = '"';
-	    if (*cp1 == '\\')
+		if (*cp1 == '\\')
 			*cp2++ = '\\';
-	    *cp2++ = *cp1++;
+		*cp2++ = *cp1++;
 	}
 	*cp2++ = '"';
 
-	VARATT_SIZEP(result) = cp2 - ((char *)result);
+	VARATT_SIZEP(result) = cp2 - ((char *) result);
 
 	return result;
 }
@@ -138,29 +139,29 @@ do_quote_ident(text *iptr)
 static text *
 do_quote_literal(text *lptr)
 {
-    text   *result;
-	char   *cp1;
-	char   *cp2;
-	int		len;
+	text	   *result;
+	char	   *cp1;
+	char	   *cp2;
+	int			len;
 
-    len = VARSIZE(lptr) - VARHDRSZ;
-	result = (text *)palloc(len * 2 + VARHDRSZ + 2);
+	len = VARSIZE(lptr) - VARHDRSZ;
+	result = (text *) palloc(len * 2 + VARHDRSZ + 2);
 
 	cp1 = VARDATA(lptr);
 	cp2 = VARDATA(result);
 
 	*cp2++ = '\'';
-	while(len-- > 0)
+	while (len-- > 0)
 	{
-	    if (*cp1 == '\'')
+		if (*cp1 == '\'')
 			*cp2++ = '\'';
-	    if (*cp1 == '\\')
+		if (*cp1 == '\\')
 			*cp2++ = '\\';
-	    *cp2++ = *cp1++;
+		*cp2++ = *cp1++;
 	}
 	*cp2++ = '\'';
 
-	VARATT_SIZEP(result) = cp2 - ((char *)result);
+	VARATT_SIZEP(result) = cp2 - ((char *) result);
 
 	return result;
 }
@@ -171,28 +172,31 @@ do_quote_literal(text *lptr)
 static bool
 quote_ident_required(text *iptr)
 {
-    char   *cp;
-	char   *ep;
+	char	   *cp;
+	char	   *ep;
 
 	cp = VARDATA(iptr);
-    ep = VARDATA(iptr) + VARSIZE(iptr) - VARHDRSZ;
+	ep = VARDATA(iptr) + VARSIZE(iptr) - VARHDRSZ;
 
 	if (cp >= ep)
 		return true;
 
-	if(pg_mblen(cp) != 1)
+	if (pg_mblen(cp) != 1)
 		return true;
-    if (!(*cp == '_' || (*cp >= 'a' && *cp <= 'z')))
+	if (!(*cp == '_' || (*cp >= 'a' && *cp <= 'z')))
 		return true;
 
-	while((++cp) < ep)
+	while ((++cp) < ep)
 	{
 		if (pg_mblen(cp) != 1)
 			return true;
 
-	    if (*cp >= 'a' && *cp <= 'z') continue;
-		if (*cp >= '0' && *cp <= '9') continue;
-		if (*cp == '_') continue;
+		if (*cp >= 'a' && *cp <= 'z')
+			continue;
+		if (*cp >= '0' && *cp <= '9')
+			continue;
+		if (*cp == '_')
+			continue;
 
 		return true;
 	}
@@ -204,41 +208,41 @@ quote_ident_required(text *iptr)
 static text *
 do_quote_ident(text *iptr)
 {
-    text   *result;
-	char   *cp1;
-	char   *cp2;
-	int		len;
-	int		wl;
+	text	   *result;
+	char	   *cp1;
+	char	   *cp2;
+	int			len;
+	int			wl;
 
-    len = VARSIZE(iptr) - VARHDRSZ;
-	result = (text *)palloc(len * 2 + VARHDRSZ + 2);
+	len = VARSIZE(iptr) - VARHDRSZ;
+	result = (text *) palloc(len * 2 + VARHDRSZ + 2);
 
 	cp1 = VARDATA(iptr);
 	cp2 = VARDATA(result);
 
 	*cp2++ = '"';
-	while(len > 0)
+	while (len > 0)
 	{
 		if ((wl = pg_mblen(cp1)) != 1)
 		{
 			len -= wl;
 
-			while(wl-- > 0)
+			while (wl-- > 0)
 				*cp2++ = *cp1++;
 			continue;
 		}
 
-	    if (*cp1 == '"')
+		if (*cp1 == '"')
 			*cp2++ = '"';
-	    if (*cp1 == '\\')
+		if (*cp1 == '\\')
 			*cp2++ = '\\';
-	    *cp2++ = *cp1++;
+		*cp2++ = *cp1++;
 
 		len--;
 	}
 	*cp2++ = '"';
 
-	VARATT_SIZEP(result) = cp2 - ((char *)result);
+	VARATT_SIZEP(result) = cp2 - ((char *) result);
 
 	return result;
 }
@@ -247,45 +251,43 @@ do_quote_ident(text *iptr)
 static text *
 do_quote_literal(text *lptr)
 {
-    text   *result;
-	char   *cp1;
-	char   *cp2;
-	int		len;
-	int		wl;
+	text	   *result;
+	char	   *cp1;
+	char	   *cp2;
+	int			len;
+	int			wl;
 
-    len = VARSIZE(lptr) - VARHDRSZ;
-	result = (text *)palloc(len * 2 + VARHDRSZ + 2);
+	len = VARSIZE(lptr) - VARHDRSZ;
+	result = (text *) palloc(len * 2 + VARHDRSZ + 2);
 
 	cp1 = VARDATA(lptr);
 	cp2 = VARDATA(result);
 
 	*cp2++ = '\'';
-	while(len > 0)
+	while (len > 0)
 	{
 		if ((wl = pg_mblen(cp1)) != 1)
 		{
 			len -= wl;
 
-			while(wl-- > 0)
+			while (wl-- > 0)
 				*cp2++ = *cp1++;
 			continue;
 		}
 
-	    if (*cp1 == '\'')
+		if (*cp1 == '\'')
 			*cp2++ = '\'';
-	    if (*cp1 == '\\')
+		if (*cp1 == '\\')
 			*cp2++ = '\\';
-	    *cp2++ = *cp1++;
+		*cp2++ = *cp1++;
 
 		len--;
 	}
 	*cp2++ = '\'';
 
-	VARATT_SIZEP(result) = cp2 - ((char *)result);
+	VARATT_SIZEP(result) = cp2 - ((char *) result);
 
 	return result;
 }
 
 #endif
-
-
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index b55cb3b42e75516488ec014e8517e58b1882ab5b..146ae742636604e1d3ef460e3a5e21f7dcc1e5d0 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.35 2001/03/19 22:27:46 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.36 2001/03/22 03:59:53 momjian Exp $
  *
  *		Alistair Crooks added the code for the regex caching
  *		agc - cached the regular expressions used - there's a good chance
@@ -121,6 +121,7 @@ RE_compile_and_execute(text *text_re, char *text, int cflags)
 	regcomp_result = pg95_regcomp(&rev[oldest].cre_re, re, cflags);
 	if (regcomp_result == 0)
 	{
+
 		/*
 		 * use malloc/free for the cre_s field because the storage has to
 		 * persist across transactions
@@ -197,10 +198,10 @@ nameregexne(PG_FUNCTION_ARGS)
 	Name		n = PG_GETARG_NAME(0);
 	text	   *p = PG_GETARG_TEXT_P(1);
 
-	PG_RETURN_BOOL(! fixedlen_regexeq(NameStr(*n),
-									  p,
-									  strlen(NameStr(*n)),
-									  REG_EXTENDED));
+	PG_RETURN_BOOL(!fixedlen_regexeq(NameStr(*n),
+									 p,
+									 strlen(NameStr(*n)),
+									 REG_EXTENDED));
 }
 
 Datum
@@ -221,15 +222,15 @@ textregexne(PG_FUNCTION_ARGS)
 	text	   *s = PG_GETARG_TEXT_P(0);
 	text	   *p = PG_GETARG_TEXT_P(1);
 
-	PG_RETURN_BOOL(! fixedlen_regexeq(VARDATA(s),
-									  p,
-									  VARSIZE(s) - VARHDRSZ,
-									  REG_EXTENDED));
+	PG_RETURN_BOOL(!fixedlen_regexeq(VARDATA(s),
+									 p,
+									 VARSIZE(s) - VARHDRSZ,
+									 REG_EXTENDED));
 }
 
 
 /*
- *  routines that use the regexp stuff, but ignore the case.
+ *	routines that use the regexp stuff, but ignore the case.
  *	for this, we use the REG_ICASE flag to pg95_regcomp
  */
 
@@ -252,10 +253,10 @@ texticregexne(PG_FUNCTION_ARGS)
 	text	   *s = PG_GETARG_TEXT_P(0);
 	text	   *p = PG_GETARG_TEXT_P(1);
 
-	PG_RETURN_BOOL(! fixedlen_regexeq(VARDATA(s),
-									  p,
-									  VARSIZE(s) - VARHDRSZ,
-									  REG_ICASE | REG_EXTENDED));
+	PG_RETURN_BOOL(!fixedlen_regexeq(VARDATA(s),
+									 p,
+									 VARSIZE(s) - VARHDRSZ,
+									 REG_ICASE | REG_EXTENDED));
 }
 
 Datum
@@ -276,8 +277,8 @@ nameicregexne(PG_FUNCTION_ARGS)
 	Name		n = PG_GETARG_NAME(0);
 	text	   *p = PG_GETARG_TEXT_P(1);
 
-	PG_RETURN_BOOL(! fixedlen_regexeq(NameStr(*n),
-									  p,
-									  strlen(NameStr(*n)),
-									  REG_ICASE | REG_EXTENDED));
+	PG_RETURN_BOOL(!fixedlen_regexeq(NameStr(*n),
+									 p,
+									 strlen(NameStr(*n)),
+									 REG_ICASE | REG_EXTENDED));
 }
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 6a772ee1b716338640a7235db9e8f107675ef4e8..1f3abde5f119ab8183165ec197ddc1f47a26d25d 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.60 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.61 2001/03/22 03:59:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ regprocin(PG_FUNCTION_ARGS)
 			result = (RegProcedure)
 				GetSysCacheOid(PROCOID,
 							   DirectFunctionCall1(oidin,
-											CStringGetDatum(pro_name_or_oid)),
+									   CStringGetDatum(pro_name_or_oid)),
 							   0, 0, 0);
 			if (!RegProcedureIsValid(result))
 				elog(ERROR, "No procedure with oid %s", pro_name_or_oid);
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 94d9b7313a14f2a7f4d19fe15738c1aaffa9b66c..db7f67ec601d3adcabba2afde359b93fac77df6e 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -9,7 +9,7 @@
  *	the backend does.  This works because the hashtable structures
  *	themselves are allocated by dynahash.c in its permanent DynaHashCxt,
  *	and the parse/plan node trees they point to are copied into
- *	TopMemoryContext using SPI_saveplan().  This is pretty ugly, since there
+ *	TopMemoryContext using SPI_saveplan().	This is pretty ugly, since there
  *	is no way to free a no-longer-needed plan tree, but then again we don't
  *	yet have any bookkeeping that would allow us to detect that a plan isn't
  *	needed anymore.  Improve it someday.
@@ -18,7 +18,7 @@
  * Portions Copyright (c) 2000-2001, PostgreSQL Global Development Group
  * Copyright 1999 Jan Wieck
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.21 2001/02/15 21:57:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.22 2001/03/22 03:59:53 momjian Exp $
  *
  * ----------
  */
@@ -535,7 +535,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
 	char		del_nulls[RI_MAX_NUMKEYS + 1];
 	bool		isnull;
 	int			i;
-	Oid         save_uid;
+	Oid			save_uid;
 
 	save_uid = GetUserId();
 
@@ -750,7 +750,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
 	char		upd_nulls[RI_MAX_NUMKEYS + 1];
 	bool		isnull;
 	int			i;
-	Oid         save_uid;
+	Oid			save_uid;
 
 	save_uid = GetUserId();
 
@@ -1611,7 +1611,7 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
 	char		upd_nulls[RI_MAX_NUMKEYS + 1];
 	bool		isnull;
 	int			i;
-	Oid         save_uid;
+	Oid			save_uid;
 
 	save_uid = GetUserId();
 
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 2dd460a442b8187a55f1379540ed9c13ed94c97a..c6db1c5b30fbfd01cf70de3fb8e590534fd57cae 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
  *				back to source text
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.73 2001/02/21 18:53:47 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.74 2001/03/22 03:59:53 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -82,7 +82,7 @@ typedef struct
 	List	   *rtable;			/* List of RangeTblEntry nodes */
 	List	   *namespace;		/* List of joinlist items (RangeTblRef and
 								 * JoinExpr nodes) */
-} deparse_namespace;
+}			deparse_namespace;
 
 
 /* ----------
@@ -118,15 +118,15 @@ static void get_delete_query_def(Query *query, deparse_context *context);
 static void get_utility_query_def(Query *query, deparse_context *context);
 static void get_basic_select_query(Query *query, deparse_context *context);
 static void get_setop_query(Node *setOp, Query *query,
-							deparse_context *context, bool toplevel);
+				deparse_context *context, bool toplevel);
 static bool simple_distinct(List *distinctClause, List *targetList);
 static void get_names_for_var(Var *var, deparse_context *context,
-							  char **refname, char **attname);
+				  char **refname, char **attname);
 static bool get_alias_for_case(CaseExpr *caseexpr, deparse_context *context,
-							   char **refname, char **attname);
+				   char **refname, char **attname);
 static bool find_alias_in_namespace(Node *nsnode, Node *expr,
-									List *rangetable, int levelsup,
-									char **refname, char **attname);
+						List *rangetable, int levelsup,
+						char **refname, char **attname);
 static bool phony_equal(Node *expr1, Node *expr2, int levelsup);
 static void get_rule_expr(Node *node, deparse_context *context);
 static void get_func_expr(Expr *expr, deparse_context *context);
@@ -135,7 +135,7 @@ static void get_const_expr(Const *constval, deparse_context *context);
 static void get_sublink_expr(Node *node, deparse_context *context);
 static void get_from_clause(Query *query, deparse_context *context);
 static void get_from_clause_item(Node *jtnode, Query *query,
-								 deparse_context *context);
+					 deparse_context *context);
 static bool tleIsArrayAssign(TargetEntry *tle);
 static char *quote_identifier(char *ident);
 static char *get_relation_name(Oid relid);
@@ -478,7 +478,7 @@ pg_get_indexdef(PG_FUNCTION_ARGS)
 		 * ----------
 		 */
 		appendStringInfo(&keybuf, "%s",
-				quote_identifier(get_relid_attribute_name(idxrec->indrelid,
+			  quote_identifier(get_relid_attribute_name(idxrec->indrelid,
 												idxrec->indkey[keyno])));
 
 		/* ----------
@@ -767,8 +767,8 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc)
 					 quote_identifier(get_relation_name(ev_class)));
 	if (ev_attr > 0)
 		appendStringInfo(buf, ".%s",
-						 quote_identifier(get_relid_attribute_name(ev_class,
-																   ev_attr)));
+					  quote_identifier(get_relid_attribute_name(ev_class,
+															  ev_attr)));
 
 	/* If the rule has an event qualification, add it */
 	if (ev_qual == NULL)
@@ -1043,9 +1043,7 @@ get_basic_select_query(Query *query, deparse_context *context)
 	if (query->distinctClause != NIL)
 	{
 		if (simple_distinct(query->distinctClause, query->targetList))
-		{
 			appendStringInfo(buf, " DISTINCT");
-		}
 		else
 		{
 			appendStringInfo(buf, " DISTINCT ON (");
@@ -1146,7 +1144,7 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
 	{
 		RangeTblRef *rtr = (RangeTblRef *) setOp;
 		RangeTblEntry *rte = rt_fetch(rtr->rtindex, query->rtable);
-		Query  *subquery = rte->subquery;
+		Query	   *subquery = rte->subquery;
 
 		Assert(subquery != NULL);
 		get_query_def(subquery, buf, context->namespaces);
@@ -1155,10 +1153,11 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
 	{
 		SetOperationStmt *op = (SetOperationStmt *) setOp;
 
-		/* Must suppress parens at top level of a setop tree because
-		 * of grammar limitations...
+		/*
+		 * Must suppress parens at top level of a setop tree because of
+		 * grammar limitations...
 		 */
-		if (! toplevel)
+		if (!toplevel)
 			appendStringInfo(buf, "(");
 		get_setop_query(op->larg, query, context, false);
 		switch (op->op)
@@ -1179,7 +1178,7 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
 		if (op->all)
 			appendStringInfo(buf, "ALL ");
 		get_setop_query(op->rarg, query, context, false);
-		if (! toplevel)
+		if (!toplevel)
 			appendStringInfo(buf, ")");
 	}
 	else
@@ -1201,7 +1200,7 @@ simple_distinct(List *distinctClause, List *targetList)
 	{
 		TargetEntry *tle = (TargetEntry *) lfirst(targetList);
 
-		if (! tle->resdom->resjunk)
+		if (!tle->resdom->resjunk)
 		{
 			if (distinctClause == NIL)
 				return false;
@@ -1288,9 +1287,7 @@ get_insert_query_def(Query *query, deparse_context *context)
 		appendStringInfoChar(buf, ')');
 	}
 	else
-	{
 		get_query_def(select_rte->subquery, buf, NIL);
-	}
 }
 
 
@@ -1326,12 +1323,13 @@ get_update_query_def(Query *query, deparse_context *context)
 
 		appendStringInfo(buf, sep);
 		sep = ", ";
+
 		/*
-		 * If the update expression is an array assignment, we mustn't
-		 * put out "attname =" here; it will come out of the display
-		 * of the ArrayRef node instead.
+		 * If the update expression is an array assignment, we mustn't put
+		 * out "attname =" here; it will come out of the display of the
+		 * ArrayRef node instead.
 		 */
-		if (! tleIsArrayAssign(tle))
+		if (!tleIsArrayAssign(tle))
 			appendStringInfo(buf, "%s = ",
 							 quote_identifier(tle->resdom->resname));
 		get_tle_expr(tle, context);
@@ -1389,6 +1387,7 @@ get_utility_query_def(Query *query, deparse_context *context)
 	if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
 	{
 		NotifyStmt *stmt = (NotifyStmt *) query->utilityStmt;
+
 		appendStringInfo(buf, "NOTIFY %s", quote_identifier(stmt->relname));
 	}
 	else
@@ -1428,8 +1427,8 @@ get_names_for_var(Var *var, deparse_context *context,
 
 	/*
 	 * Otherwise, fall back on the rangetable entry.  This should happen
-	 * only for uses of special RTEs like *NEW* and *OLD*, which won't
-	 * get placed in our namespace.
+	 * only for uses of special RTEs like *NEW* and *OLD*, which won't get
+	 * placed in our namespace.
 	 */
 	rte = rt_fetch(var->varno, dpns->rtable);
 	*refname = rte->eref->relname;
@@ -1448,9 +1447,9 @@ get_alias_for_case(CaseExpr *caseexpr, deparse_context *context,
 	int			sup;
 
 	/*
-	 * This could be done more efficiently if we first groveled through the
-	 * CASE to find varlevelsup values, but it's probably not worth the
-	 * trouble.  All this code will go away someday anyway ...
+	 * This could be done more efficiently if we first groveled through
+	 * the CASE to find varlevelsup values, but it's probably not worth
+	 * the trouble.  All this code will go away someday anyway ...
 	 */
 
 	sup = 0;
@@ -1525,6 +1524,7 @@ find_alias_in_namespace(Node *nsnode, Node *expr,
 				}
 				nlist = lnext(nlist);
 			}
+
 			/*
 			 * Tables within an aliased join are invisible from outside
 			 * the join, according to the scope rules of SQL92 (the join
@@ -1579,8 +1579,8 @@ phony_equal(Node *expr1, Node *expr2, int levelsup)
 		return false;
 	if (IsA(expr1, Var))
 	{
-		Var	   *a = (Var *) expr1;
-		Var	   *b = (Var *) expr2;
+		Var		   *a = (Var *) expr1;
+		Var		   *b = (Var *) expr2;
 
 		if (a->varno != b->varno)
 			return false;
@@ -1600,8 +1600,8 @@ phony_equal(Node *expr1, Node *expr2, int levelsup)
 	}
 	if (IsA(expr1, CaseExpr))
 	{
-		CaseExpr	   *a = (CaseExpr *) expr1;
-		CaseExpr	   *b = (CaseExpr *) expr2;
+		CaseExpr   *a = (CaseExpr *) expr1;
+		CaseExpr   *b = (CaseExpr *) expr2;
 
 		if (a->casetype != b->casetype)
 			return false;
@@ -1615,8 +1615,8 @@ phony_equal(Node *expr1, Node *expr2, int levelsup)
 	}
 	if (IsA(expr1, CaseWhen))
 	{
-		CaseWhen	   *a = (CaseWhen *) expr1;
-		CaseWhen	   *b = (CaseWhen *) expr2;
+		CaseWhen   *a = (CaseWhen *) expr1;
+		CaseWhen   *b = (CaseWhen *) expr2;
 
 		if (!phony_equal(a->expr, b->expr, levelsup))
 			return false;
@@ -1840,9 +1840,10 @@ get_rule_expr(Node *node, deparse_context *context)
 
 				/*
 				 * If we are doing UPDATE array[n] = expr, we need to
-				 * suppress any prefix on the array name.  Currently,
-				 * that is the only context in which we will see a non-null
-				 * refassgnexpr --- but someday a smarter test may be needed.
+				 * suppress any prefix on the array name.  Currently, that
+				 * is the only context in which we will see a non-null
+				 * refassgnexpr --- but someday a smarter test may be
+				 * needed.
 				 */
 				if (aref->refassgnexpr)
 					context->varprefix = false;
@@ -1880,7 +1881,7 @@ get_rule_expr(Node *node, deparse_context *context)
 				/* we do NOT parenthesize the arg expression, for now */
 				get_rule_expr(fselect->arg, context);
 				typetup = SearchSysCache(TYPEOID,
-										 ObjectIdGetDatum(exprType(fselect->arg)),
+								ObjectIdGetDatum(exprType(fselect->arg)),
 										 0, 0, 0);
 				if (!HeapTupleIsValid(typetup))
 					elog(ERROR, "cache lookup of type %u failed",
@@ -2163,9 +2164,9 @@ get_const_expr(Const *constval, deparse_context *context)
 	}
 
 	extval = DatumGetCString(OidFunctionCall3(typeStruct->typoutput,
-							 constval->constvalue,
-							 ObjectIdGetDatum(typeStruct->typelem),
-							 Int32GetDatum(-1)));
+											  constval->constvalue,
+								   ObjectIdGetDatum(typeStruct->typelem),
+											  Int32GetDatum(-1)));
 
 	switch (constval->consttype)
 	{
@@ -2317,16 +2318,16 @@ get_from_clause(Query *query, deparse_context *context)
 
 	/*
 	 * We use the query's jointree as a guide to what to print.  However,
-	 * we must ignore auto-added RTEs that are marked not inFromCl.
-	 * (These can only appear at the top level of the jointree, so it's
-	 * sufficient to check here.)
-	 * Also ignore the rule pseudo-RTEs for NEW and OLD.
+	 * we must ignore auto-added RTEs that are marked not inFromCl. (These
+	 * can only appear at the top level of the jointree, so it's
+	 * sufficient to check here.) Also ignore the rule pseudo-RTEs for NEW
+	 * and OLD.
 	 */
 	sep = " FROM ";
 
 	foreach(l, query->jointree->fromlist)
 	{
-		Node   *jtnode = (Node *) lfirst(l);
+		Node	   *jtnode = (Node *) lfirst(l);
 
 		if (IsA(jtnode, RangeTblRef))
 		{
@@ -2396,7 +2397,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
 					if (col != rte->alias->attrs)
 						appendStringInfo(buf, ", ");
 					appendStringInfo(buf, "%s",
-									 quote_identifier(strVal(lfirst(col))));
+								  quote_identifier(strVal(lfirst(col))));
 				}
 				appendStringInfoChar(buf, ')');
 			}
@@ -2435,7 +2436,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
 					 (int) j->jointype);
 		}
 		get_from_clause_item(j->rarg, query, context);
-		if (! j->isNatural)
+		if (!j->isNatural)
 		{
 			if (j->using)
 			{
@@ -2447,7 +2448,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
 					if (col != j->using)
 						appendStringInfo(buf, ", ");
 					appendStringInfo(buf, "%s",
-									 quote_identifier(strVal(lfirst(col))));
+								  quote_identifier(strVal(lfirst(col))));
 				}
 				appendStringInfoChar(buf, ')');
 			}
@@ -2475,7 +2476,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
 					if (col != j->alias->attrs)
 						appendStringInfo(buf, ", ");
 					appendStringInfo(buf, "%s",
-									 quote_identifier(strVal(lfirst(col))));
+								  quote_identifier(strVal(lfirst(col))));
 				}
 				appendStringInfoChar(buf, ')');
 			}
@@ -2503,6 +2504,7 @@ tleIsArrayAssign(TargetEntry *tle)
 	aref = (ArrayRef *) tle->expr;
 	if (aref->refassgnexpr == NULL)
 		return false;
+
 	/*
 	 * Currently, it should only be possible to see non-null refassgnexpr
 	 * if we are indeed looking at an "UPDATE array[n] = expr" situation.
@@ -2563,8 +2565,8 @@ quote_identifier(char *ident)
 		 * but the parser doesn't provide any easy way to test for whether
 		 * an identifier is safe or not... so be safe not sorry.
 		 *
-		 * Note: ScanKeywordLookup() does case-insensitive comparison,
-		 * but that's fine, since we already know we have all-lower-case.
+		 * Note: ScanKeywordLookup() does case-insensitive comparison, but
+		 * that's fine, since we already know we have all-lower-case.
 		 */
 		if (ScanKeywordLookup(ident) != NULL)
 			safe = false;
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 72be0f04722396c727fed8ee00ccc4f24c34cb7f..b7af8b9ca5ec2245b2571418f5203888fff47ed8 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.85 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.86 2001/03/22 03:59:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -61,18 +61,18 @@
 #define NOT_MOST_COMMON_RATIO  0.1
 
 static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
-							  Datum lobound, Datum hibound, Oid boundstypid,
-							  double *scaledlobound, double *scaledhibound);
+				  Datum lobound, Datum hibound, Oid boundstypid,
+				  double *scaledlobound, double *scaledhibound);
 static double convert_numeric_to_scalar(Datum value, Oid typid);
 static void convert_string_to_scalar(unsigned char *value,
-									 double *scaledvalue,
-									 unsigned char *lobound,
-									 double *scaledlobound,
-									 unsigned char *hibound,
-									 double *scaledhibound);
+						 double *scaledvalue,
+						 unsigned char *lobound,
+						 double *scaledlobound,
+						 unsigned char *hibound,
+						 double *scaledhibound);
 static double convert_one_string_to_scalar(unsigned char *value,
-										   int rangelo, int rangehi);
-static unsigned char * convert_string_datum(Datum value, Oid typid);
+							 int rangelo, int rangehi);
+static unsigned char *convert_string_datum(Datum value, Oid typid);
 static double convert_timevalue_to_scalar(Datum value, Oid typid);
 static void getattproperties(Oid relid, AttrNumber attnum,
 				 Oid *typid,
@@ -87,9 +87,9 @@ static bool getattstatistics(Oid relid, AttrNumber attnum,
 				 Datum *loval,
 				 Datum *hival);
 static Selectivity prefix_selectivity(char *prefix,
-									  Oid relid,
-									  AttrNumber attno,
-									  Oid datatype);
+				   Oid relid,
+				   AttrNumber attno,
+				   Oid datatype);
 static Selectivity pattern_selectivity(char *patt, Pattern_Type ptype);
 static bool string_lessthan(const char *str1, const char *str2,
 				Oid datatype);
@@ -102,7 +102,7 @@ static Datum string_to_datum(const char *str, Oid datatype);
  *
  * Note: this routine is also used to estimate selectivity for some
  * operators that are not "=" but have comparable selectivity behavior,
- * such as "~=" (geometric approximate-match).  Even for "=", we must
+ * such as "~=" (geometric approximate-match).	Even for "=", we must
  * keep in mind that the left and right datatypes may differ, so the type
  * of the given constant "value" may be different from the type of the
  * attribute.
@@ -165,7 +165,7 @@ eqsel(PG_FUNCTION_ARGS)
 				else
 					mostcommon = DatumGetBool(OidFunctionCall2(eqproc,
 															   value,
-															   commonval));
+															 commonval));
 
 				if (mostcommon)
 				{
@@ -264,15 +264,15 @@ neqsel(PG_FUNCTION_ARGS)
 	float8		result;
 
 	/*
-	 * We want 1 - eqsel() where the equality operator is the one associated
-	 * with this != operator, that is, its negator.
+	 * We want 1 - eqsel() where the equality operator is the one
+	 * associated with this != operator, that is, its negator.
 	 */
 	eqopid = get_negator(opid);
 	if (eqopid)
 	{
 		result = DatumGetFloat8(DirectFunctionCall5(eqsel,
-													ObjectIdGetDatum(eqopid),
-													ObjectIdGetDatum(relid),
+												ObjectIdGetDatum(eqopid),
+												 ObjectIdGetDatum(relid),
 													Int16GetDatum(attno),
 													value,
 													Int32GetDatum(flag)));
@@ -432,16 +432,16 @@ scalargtsel(PG_FUNCTION_ARGS)
 
 	/*
 	 * Compute selectivity of "<", then invert --- but only if we were
-	 * able to produce a non-default estimate.  Note that we get the
-	 * negator which strictly speaking means we are looking at "<="
-	 * for ">" or "<" for ">=".  We assume this won't matter.
+	 * able to produce a non-default estimate.	Note that we get the
+	 * negator which strictly speaking means we are looking at "<=" for
+	 * ">" or "<" for ">=".  We assume this won't matter.
 	 */
 	ltopid = get_negator(opid);
 	if (ltopid)
 	{
 		result = DatumGetFloat8(DirectFunctionCall5(scalarltsel,
-													ObjectIdGetDatum(ltopid),
-													ObjectIdGetDatum(relid),
+												ObjectIdGetDatum(ltopid),
+												 ObjectIdGetDatum(relid),
 													Int16GetDatum(attno),
 													value,
 													Int32GetDatum(flag)));
@@ -506,23 +506,28 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype)
 
 		if (pstatus == Pattern_Prefix_Exact)
 		{
-			/* Pattern specifies an exact match, so pretend operator is '=' */
-			Oid		eqopr = find_operator("=", ltype);
-			Datum	eqcon;
+
+			/*
+			 * Pattern specifies an exact match, so pretend operator is
+			 * '='
+			 */
+			Oid			eqopr = find_operator("=", ltype);
+			Datum		eqcon;
 
 			if (eqopr == InvalidOid)
 				elog(ERROR, "patternsel: no = operator for type %u", ltype);
 			eqcon = string_to_datum(prefix, ltype);
 			result = DatumGetFloat8(DirectFunctionCall5(eqsel,
-									ObjectIdGetDatum(eqopr),
-									ObjectIdGetDatum(relid),
-									Int16GetDatum(attno),
-									eqcon,
-									Int32GetDatum(SEL_CONSTANT|SEL_RIGHT)));
+												 ObjectIdGetDatum(eqopr),
+												 ObjectIdGetDatum(relid),
+													Int16GetDatum(attno),
+														eqcon,
+							   Int32GetDatum(SEL_CONSTANT | SEL_RIGHT)));
 			pfree(DatumGetPointer(eqcon));
 		}
 		else
 		{
+
 			/*
 			 * Not exact-match pattern.  We estimate selectivity of the
 			 * fixed prefix and remainder of pattern separately, then
@@ -648,6 +653,7 @@ eqjoinsel(PG_FUNCTION_ARGS)
 {
 #ifdef NOT_USED					/* see neqjoinsel() before removing me! */
 	Oid			opid = PG_GETARG_OID(0);
+
 #endif
 	Oid			relid1 = PG_GETARG_OID(1);
 	AttrNumber	attno1 = PG_GETARG_INT16(2);
@@ -701,8 +707,8 @@ neqjoinsel(PG_FUNCTION_ARGS)
 
 	/*
 	 * XXX we skip looking up the negator operator here because we know
-	 * eqjoinsel() won't look at it anyway.  If eqjoinsel() ever does look,
-	 * this routine will need to look more like neqsel() does.
+	 * eqjoinsel() won't look at it anyway.  If eqjoinsel() ever does
+	 * look, this routine will need to look more like neqsel() does.
 	 */
 	result = DatumGetFloat8(eqjoinsel(fcinfo));
 	result = 1.0 - result;
@@ -845,48 +851,48 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
 	switch (valuetypid)
 	{
 
-		/*
-		 * Built-in numeric types
-		 */
-		case BOOLOID:
-		case INT2OID:
-		case INT4OID:
-		case INT8OID:
-		case FLOAT4OID:
-		case FLOAT8OID:
-		case NUMERICOID:
-		case OIDOID:
-		case REGPROCOID:
+			/*
+			 * Built-in numeric types
+			 */
+			case BOOLOID:
+			case INT2OID:
+			case INT4OID:
+			case INT8OID:
+			case FLOAT4OID:
+			case FLOAT8OID:
+			case NUMERICOID:
+			case OIDOID:
+			case REGPROCOID:
 			*scaledvalue = convert_numeric_to_scalar(value, valuetypid);
 			*scaledlobound = convert_numeric_to_scalar(lobound, boundstypid);
 			*scaledhibound = convert_numeric_to_scalar(hibound, boundstypid);
 			return true;
 
-		/*
-		 * Built-in string types
-		 */
+			/*
+			 * Built-in string types
+			 */
 		case CHAROID:
 		case BPCHAROID:
 		case VARCHAROID:
 		case TEXTOID:
 		case NAMEOID:
-		{
-			unsigned char *valstr = convert_string_datum(value, valuetypid);
-			unsigned char *lostr = convert_string_datum(lobound, boundstypid);
-			unsigned char *histr = convert_string_datum(hibound, boundstypid);
-
-			convert_string_to_scalar(valstr, scaledvalue,
-									 lostr, scaledlobound,
-									 histr, scaledhibound);
-			pfree(valstr);
-			pfree(lostr);
-			pfree(histr);
-			return true;
-		}
+			{
+				unsigned char *valstr = convert_string_datum(value, valuetypid);
+				unsigned char *lostr = convert_string_datum(lobound, boundstypid);
+				unsigned char *histr = convert_string_datum(hibound, boundstypid);
+
+				convert_string_to_scalar(valstr, scaledvalue,
+										 lostr, scaledlobound,
+										 histr, scaledhibound);
+				pfree(valstr);
+				pfree(lostr);
+				pfree(histr);
+				return true;
+			}
 
-		/*
-		 * Built-in time types
-		 */
+			/*
+			 * Built-in time types
+			 */
 		case TIMESTAMPOID:
 		case ABSTIMEOID:
 		case DATEOID:
@@ -911,7 +917,7 @@ convert_numeric_to_scalar(Datum value, Oid typid)
 {
 	switch (typid)
 	{
-		case BOOLOID:
+			case BOOLOID:
 			return (double) DatumGetBool(value);
 		case INT2OID:
 			return (double) DatumGetInt16(value);
@@ -931,7 +937,9 @@ convert_numeric_to_scalar(Datum value, Oid typid)
 			/* we can treat OIDs as integers... */
 			return (double) DatumGetObjectId(value);
 	}
-	/* Can't get here unless someone tries to use scalarltsel/scalargtsel
+
+	/*
+	 * Can't get here unless someone tries to use scalarltsel/scalargtsel
 	 * on an operator with one numeric and one non-numeric operand.
 	 */
 	elog(ERROR, "convert_numeric_to_scalar: unsupported type %u", typid);
@@ -1007,7 +1015,9 @@ convert_string_to_scalar(unsigned char *value,
 		if (rangehi < '9')
 			rangehi = '9';
 	}
-	/* If range includes less than 10 chars, assume we have not got enough
+
+	/*
+	 * If range includes less than 10 chars, assume we have not got enough
 	 * data, and make it include regular ASCII set.
 	 */
 	if (rangehi - rangelo < 9)
@@ -1045,7 +1055,10 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
 	if (slen <= 0)
 		return 0.0;				/* empty string has scalar value 0 */
 
-	/* Since base is at least 10, need not consider more than about 20 chars */
+	/*
+	 * Since base is at least 10, need not consider more than about 20
+	 * chars
+	 */
 	if (slen > 20)
 		slen = 20;
 
@@ -1055,12 +1068,12 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
 	denom = base;
 	while (slen-- > 0)
 	{
-		int		ch = *value++;
+		int			ch = *value++;
 
 		if (ch < rangelo)
-			ch = rangelo-1;
+			ch = rangelo - 1;
 		else if (ch > rangehi)
-			ch = rangehi+1;
+			ch = rangehi + 1;
 		num += ((double) (ch - rangelo)) / denom;
 		denom *= base;
 	}
@@ -1078,10 +1091,12 @@ static unsigned char *
 convert_string_datum(Datum value, Oid typid)
 {
 	char	   *val;
+
 #ifdef USE_LOCALE
 	char	   *xfrmstr;
 	size_t		xfrmsize;
 	size_t		xfrmlen;
+
 #endif
 
 	switch (typid)
@@ -1094,25 +1109,27 @@ convert_string_datum(Datum value, Oid typid)
 		case BPCHAROID:
 		case VARCHAROID:
 		case TEXTOID:
-		{
-			char	   *str = (char *) VARDATA(DatumGetPointer(value));
-			int			strlength = VARSIZE(DatumGetPointer(value)) - VARHDRSZ;
+			{
+				char	   *str = (char *) VARDATA(DatumGetPointer(value));
+				int			strlength = VARSIZE(DatumGetPointer(value)) - VARHDRSZ;
 
-			val = (char *) palloc(strlength+1);
-			memcpy(val, str, strlength);
-			val[strlength] = '\0';
-			break;
-		}
+				val = (char *) palloc(strlength + 1);
+				memcpy(val, str, strlength);
+				val[strlength] = '\0';
+				break;
+			}
 		case NAMEOID:
-		{
-			NameData   *nm = (NameData *) DatumGetPointer(value);
+			{
+				NameData   *nm = (NameData *) DatumGetPointer(value);
 
-			val = pstrdup(NameStr(*nm));
-			break;
-		}
+				val = pstrdup(NameStr(*nm));
+				break;
+			}
 		default:
-			/* Can't get here unless someone tries to use scalarltsel
-			 * on an operator with one string and one non-string operand.
+
+			/*
+			 * Can't get here unless someone tries to use scalarltsel on
+			 * an operator with one string and one non-string operand.
 			 */
 			elog(ERROR, "convert_string_datum: unsupported type %u", typid);
 			return NULL;
@@ -1120,7 +1137,7 @@ convert_string_datum(Datum value, Oid typid)
 
 #ifdef USE_LOCALE
 	/* Guess that transformed string is not much bigger than original */
-	xfrmsize = strlen(val) + 32;		/* arbitrary pad value here... */
+	xfrmsize = strlen(val) + 32;/* arbitrary pad value here... */
 	xfrmstr = (char *) palloc(xfrmsize);
 	xfrmlen = strxfrm(xfrmstr, val, xfrmsize);
 	if (xfrmlen >= xfrmsize)
@@ -1145,7 +1162,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
 {
 	switch (typid)
 	{
-		case TIMESTAMPOID:
+			case TIMESTAMPOID:
 			return DatumGetTimestamp(value);
 		case ABSTIMEOID:
 			return DatumGetTimestamp(DirectFunctionCall1(abstime_timestamp,
@@ -1154,31 +1171,33 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
 			return DatumGetTimestamp(DirectFunctionCall1(date_timestamp,
 														 value));
 		case INTERVALOID:
-		{
-			Interval   *interval = DatumGetIntervalP(value);
+			{
+				Interval   *interval = DatumGetIntervalP(value);
 
-			/*
-			 * Convert the month part of Interval to days using
-			 * assumed average month length of 365.25/12.0 days.  Not
-			 * too accurate, but plenty good enough for our purposes.
-			 */
-			return interval->time +
-				interval->month * (365.25 / 12.0 * 24.0 * 60.0 * 60.0);
-		}
+				/*
+				 * Convert the month part of Interval to days using
+				 * assumed average month length of 365.25/12.0 days.  Not
+				 * too accurate, but plenty good enough for our purposes.
+				 */
+				return interval->time +
+					interval->month * (365.25 / 12.0 * 24.0 * 60.0 * 60.0);
+			}
 		case RELTIMEOID:
 			return DatumGetRelativeTime(value);
 		case TINTERVALOID:
-		{
-			TimeInterval interval = DatumGetTimeInterval(value);
+			{
+				TimeInterval interval = DatumGetTimeInterval(value);
 
-			if (interval->status != 0)
-				return interval->data[1] - interval->data[0];
-			return 0;			/* for lack of a better idea */
-		}
+				if (interval->status != 0)
+					return interval->data[1] - interval->data[0];
+				return 0;		/* for lack of a better idea */
+			}
 		case TIMEOID:
 			return DatumGetTimeADT(value);
 	}
-	/* Can't get here unless someone tries to use scalarltsel/scalargtsel
+
+	/*
+	 * Can't get here unless someone tries to use scalarltsel/scalargtsel
 	 * on an operator with one timevalue and one non-timevalue operand.
 	 */
 	elog(ERROR, "convert_timevalue_to_scalar: unsupported type %u", typid);
@@ -1305,7 +1324,7 @@ getattstatistics(Oid relid,
 		else
 		{
 			char	   *strval = DatumGetCString(DirectFunctionCall1(textout,
-																	 val));
+																   val));
 
 			*commonval = FunctionCall3(&inputproc,
 									   CStringGetDatum(strval),
@@ -1329,7 +1348,7 @@ getattstatistics(Oid relid,
 		else
 		{
 			char	   *strval = DatumGetCString(DirectFunctionCall1(textout,
-																	 val));
+																   val));
 
 			*loval = FunctionCall3(&inputproc,
 								   CStringGetDatum(strval),
@@ -1353,7 +1372,7 @@ getattstatistics(Oid relid,
 		else
 		{
 			char	   *strval = DatumGetCString(DirectFunctionCall1(textout,
-																	 val));
+																   val));
 
 			*hival = FunctionCall3(&inputproc,
 								   CStringGetDatum(strval),
@@ -1417,12 +1436,14 @@ like_fixed_prefix(char *patt, bool case_insensitive,
 			if (patt[pos] == '\0')
 				break;
 		}
+
 		/*
 		 * XXX I suspect isalpha() is not an adequately locale-sensitive
 		 * test for characters that can vary under case folding?
 		 */
 		if (case_insensitive && isalpha((unsigned char) patt[pos]))
 			break;
+
 		/*
 		 * NOTE: this code used to think that %% meant a literal %, but
 		 * textlike() itself does not think that, and the SQL92 spec
@@ -1436,7 +1457,8 @@ like_fixed_prefix(char *patt, bool case_insensitive,
 
 	/* in LIKE, an empty pattern is an exact match! */
 	if (patt[pos] == '\0')
-		return Pattern_Prefix_Exact;	/* reached end of pattern, so exact */
+		return Pattern_Prefix_Exact;	/* reached end of pattern, so
+										 * exact */
 
 	if (match_pos > 0)
 		return Pattern_Prefix_Partial;
@@ -1463,7 +1485,8 @@ regex_fixed_prefix(char *patt, bool case_insensitive,
 		return Pattern_Prefix_None;
 	}
 
-	/* If unquoted | is present at paren level 0 in pattern, then there
+	/*
+	 * If unquoted | is present at paren level 0 in pattern, then there
 	 * are multiple alternatives for the start of the string.
 	 */
 	paren_depth = 0;
@@ -1495,10 +1518,12 @@ regex_fixed_prefix(char *patt, bool case_insensitive,
 	/* note start at pos 1 to skip leading ^ */
 	for (pos = 1; patt[pos]; pos++)
 	{
+
 		/*
-		 * Check for characters that indicate multiple possible matches here.
-		 * XXX I suspect isalpha() is not an adequately locale-sensitive
-		 * test for characters that can vary under case folding?
+		 * Check for characters that indicate multiple possible matches
+		 * here. XXX I suspect isalpha() is not an adequately
+		 * locale-sensitive test for characters that can vary under case
+		 * folding?
 		 */
 		if (patt[pos] == '.' ||
 			patt[pos] == '(' ||
@@ -1506,9 +1531,11 @@ regex_fixed_prefix(char *patt, bool case_insensitive,
 			patt[pos] == '$' ||
 			(case_insensitive && isalpha((unsigned char) patt[pos])))
 			break;
+
 		/*
 		 * Check for quantifiers.  Except for +, this means the preceding
-		 * character is optional, so we must remove it from the prefix too!
+		 * character is optional, so we must remove it from the prefix
+		 * too!
 		 */
 		if (patt[pos] == '*' ||
 			patt[pos] == '?' ||
@@ -1573,7 +1600,7 @@ pattern_fixed_prefix(char *patt, Pattern_Type ptype,
 			break;
 		default:
 			elog(ERROR, "pattern_fixed_prefix: bogus ptype");
-			result = Pattern_Prefix_None; /* keep compiler quiet */
+			result = Pattern_Prefix_None;		/* keep compiler quiet */
 			break;
 	}
 	return result;
@@ -1596,7 +1623,7 @@ prefix_selectivity(char *prefix,
 				   AttrNumber attno,
 				   Oid datatype)
 {
-	Selectivity	prefixsel;
+	Selectivity prefixsel;
 	Oid			cmpopr;
 	Datum		prefixcon;
 	char	   *greaterstr;
@@ -1608,21 +1635,21 @@ prefix_selectivity(char *prefix,
 	prefixcon = string_to_datum(prefix, datatype);
 	/* Assume scalargtsel is appropriate for all supported types */
 	prefixsel = DatumGetFloat8(DirectFunctionCall5(scalargtsel,
-							   ObjectIdGetDatum(cmpopr),
-							   ObjectIdGetDatum(relid),
-							   Int16GetDatum(attno),
-							   prefixcon,
-							   Int32GetDatum(SEL_CONSTANT|SEL_RIGHT)));
+												ObjectIdGetDatum(cmpopr),
+												 ObjectIdGetDatum(relid),
+												   Int16GetDatum(attno),
+												   prefixcon,
+							   Int32GetDatum(SEL_CONSTANT | SEL_RIGHT)));
 	pfree(DatumGetPointer(prefixcon));
 
 	/*
-	 * If we can create a string larger than the prefix,
-	 * say "x < greaterstr".
+	 * If we can create a string larger than the prefix, say "x <
+	 * greaterstr".
 	 */
 	greaterstr = make_greater_string(prefix, datatype);
 	if (greaterstr)
 	{
-		Selectivity		topsel;
+		Selectivity topsel;
 
 		cmpopr = find_operator("<", datatype);
 		if (cmpopr == InvalidOid)
@@ -1631,28 +1658,28 @@ prefix_selectivity(char *prefix,
 		prefixcon = string_to_datum(greaterstr, datatype);
 		/* Assume scalarltsel is appropriate for all supported types */
 		topsel = DatumGetFloat8(DirectFunctionCall5(scalarltsel,
-								ObjectIdGetDatum(cmpopr),
-								ObjectIdGetDatum(relid),
-								Int16GetDatum(attno),
-								prefixcon,
-								Int32GetDatum(SEL_CONSTANT|SEL_RIGHT)));
+												ObjectIdGetDatum(cmpopr),
+												 ObjectIdGetDatum(relid),
+													Int16GetDatum(attno),
+													prefixcon,
+							   Int32GetDatum(SEL_CONSTANT | SEL_RIGHT)));
 		pfree(DatumGetPointer(prefixcon));
 		pfree(greaterstr);
 
 		/*
-		 * Merge the two selectivities in the same way as for
-		 * a range query (see clauselist_selectivity()).
+		 * Merge the two selectivities in the same way as for a range
+		 * query (see clauselist_selectivity()).
 		 */
 		prefixsel = topsel + prefixsel - 1.0;
 
 		/*
-		 * A zero or slightly negative prefixsel should be converted into a
-		 * small positive value; we probably are dealing with a very
+		 * A zero or slightly negative prefixsel should be converted into
+		 * a small positive value; we probably are dealing with a very
 		 * tight range and got a bogus result due to roundoff errors.
 		 * However, if prefixsel is very negative, then we probably have
 		 * default selectivity estimates on one or both sides of the
-		 * range.  In that case, insert a not-so-wildly-optimistic
-		 * default estimate.
+		 * range.  In that case, insert a not-so-wildly-optimistic default
+		 * estimate.
 		 */
 		if (prefixsel <= 0.0)
 		{
@@ -1660,8 +1687,8 @@ prefix_selectivity(char *prefix,
 			{
 
 				/*
-				 * No data available --- use a default estimate that
-				 * is small, but not real small.
+				 * No data available --- use a default estimate that is
+				 * small, but not real small.
 				 */
 				prefixsel = 0.01;
 			}
@@ -1691,15 +1718,16 @@ prefix_selectivity(char *prefix,
 
 #define FIXED_CHAR_SEL	0.04	/* about 1/25 */
 #define CHAR_RANGE_SEL	0.25
-#define ANY_CHAR_SEL	0.9		/* not 1, since it won't match end-of-string */
+#define ANY_CHAR_SEL	0.9		/* not 1, since it won't match
+								 * end-of-string */
 #define FULL_WILDCARD_SEL 5.0
 #define PARTIAL_WILDCARD_SEL 2.0
 
 static Selectivity
 like_selectivity(char *patt, bool case_insensitive)
 {
-	Selectivity		sel = 1.0;
-	int				pos;
+	Selectivity sel = 1.0;
+	int			pos;
 
 	/* Skip any leading %; it's already factored into initial sel */
 	pos = (*patt == '%') ? 1 : 0;
@@ -1730,17 +1758,17 @@ like_selectivity(char *patt, bool case_insensitive)
 static Selectivity
 regex_selectivity_sub(char *patt, int pattlen, bool case_insensitive)
 {
-	Selectivity		sel = 1.0;
-	int				paren_depth = 0;
-	int				paren_pos = 0; /* dummy init to keep compiler quiet */
-	int				pos;
+	Selectivity sel = 1.0;
+	int			paren_depth = 0;
+	int			paren_pos = 0;	/* dummy init to keep compiler quiet */
+	int			pos;
 
 	for (pos = 0; pos < pattlen; pos++)
 	{
 		if (patt[pos] == '(')
 		{
 			if (paren_depth == 0)
-				paren_pos = pos; /* remember start of parenthesized item */
+				paren_pos = pos;/* remember start of parenthesized item */
 			paren_depth++;
 		}
 		else if (patt[pos] == ')' && paren_depth > 0)
@@ -1753,9 +1781,10 @@ regex_selectivity_sub(char *patt, int pattlen, bool case_insensitive)
 		}
 		else if (patt[pos] == '|' && paren_depth == 0)
 		{
+
 			/*
-			 * If unquoted | is present at paren level 0 in pattern,
-			 * we have multiple alternatives; sum their probabilities.
+			 * If unquoted | is present at paren level 0 in pattern, we
+			 * have multiple alternatives; sum their probabilities.
 			 */
 			sel += regex_selectivity_sub(patt + (pos + 1),
 										 pattlen - (pos + 1),
@@ -1764,19 +1793,20 @@ regex_selectivity_sub(char *patt, int pattlen, bool case_insensitive)
 		}
 		else if (patt[pos] == '[')
 		{
-			bool	negclass = false;
+			bool		negclass = false;
 
 			if (patt[++pos] == '^')
 			{
 				negclass = true;
 				pos++;
 			}
-			if (patt[pos] == ']') /* ']' at start of class is not special */
+			if (patt[pos] == ']')		/* ']' at start of class is not
+										 * special */
 				pos++;
 			while (pos < pattlen && patt[pos] != ']')
 				pos++;
 			if (paren_depth == 0)
-				sel *= (negclass ? (1.0-CHAR_RANGE_SEL) : CHAR_RANGE_SEL);
+				sel *= (negclass ? (1.0 - CHAR_RANGE_SEL) : CHAR_RANGE_SEL);
 		}
 		else if (patt[pos] == '.')
 		{
@@ -1822,15 +1852,15 @@ regex_selectivity_sub(char *patt, int pattlen, bool case_insensitive)
 static Selectivity
 regex_selectivity(char *patt, bool case_insensitive)
 {
-	Selectivity		sel;
-	int				pattlen = strlen(patt);
+	Selectivity sel;
+	int			pattlen = strlen(patt);
 
 	/* If patt doesn't end with $, consider it to have a trailing wildcard */
-	if (pattlen > 0 && patt[pattlen-1] == '$' &&
-		(pattlen == 1 || patt[pattlen-2] != '\\'))
+	if (pattlen > 0 && patt[pattlen - 1] == '$' &&
+		(pattlen == 1 || patt[pattlen - 2] != '\\'))
 	{
 		/* has trailing $ */
-		sel = regex_selectivity_sub(patt, pattlen-1, case_insensitive);
+		sel = regex_selectivity_sub(patt, pattlen - 1, case_insensitive);
 	}
 	else
 	{
@@ -1893,6 +1923,7 @@ locale_is_like_safe(void)
 	localeptr = setlocale(LC_COLLATE, NULL);
 	if (!localeptr)
 		elog(STOP, "Invalid LC_COLLATE setting");
+
 	/*
 	 * Currently we accept only "C" and "POSIX" (do any systems still
 	 * return "POSIX"?).  Which other locales allow safe optimization?
@@ -1904,9 +1935,9 @@ locale_is_like_safe(void)
 	else
 		result = false;
 	return (bool) result;
-#else /* not USE_LOCALE */
-	return true;				/* We must be in C locale, which is OK */
-#endif /* USE_LOCALE */
+#else							/* not USE_LOCALE */
+				return true;	/* We must be in C locale, which is OK */
+#endif	 /* USE_LOCALE */
 }
 
 /*
@@ -2039,6 +2070,7 @@ find_operator(const char *opname, Oid datatype)
 static Datum
 string_to_datum(const char *str, Oid datatype)
 {
+
 	/*
 	 * We cheat a little by assuming that textin() will do for bpchar and
 	 * varchar constants too...
diff --git a/src/backend/utils/adt/sets.c b/src/backend/utils/adt/sets.c
index 11c5579fc209e9463515b9c00a8aa29d94329918..c48526a7ba155c314d79f010b71de670dd1849a4 100644
--- a/src/backend/utils/adt/sets.c
+++ b/src/backend/utils/adt/sets.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.36 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.37 2001/03/22 03:59:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -62,8 +62,8 @@ SetDefine(char *querystr, char *typename)
 							 false,		/* canCache (assume unsafe) */
 							 false,		/* isStrict (irrelevant, no args) */
 							 100,		/* byte_pct */
-							 0,			/* perbyte_cpu */
-							 0,			/* percall_cpu */
+							 0, /* perbyte_cpu */
+							 0, /* percall_cpu */
 							 100,		/* outin_ratio */
 							 NIL,		/* argList */
 							 whereToSendOutput);
@@ -165,8 +165,8 @@ seteval(PG_FUNCTION_ARGS)
 	}
 
 	/*
-	 * Evaluate the function.  NOTE: we need no econtext because there
-	 * are no arguments to evaluate.
+	 * Evaluate the function.  NOTE: we need no econtext because there are
+	 * no arguments to evaluate.
 	 */
 
 	/* ExecMakeFunctionResult assumes these are initialized at call: */
@@ -175,14 +175,14 @@ seteval(PG_FUNCTION_ARGS)
 
 	result = ExecMakeFunctionResult(fcache,
 									NIL,
-									NULL, /* no econtext, see above */
+									NULL,		/* no econtext, see above */
 									&isNull,
 									&isDone);
 
 	/*
-	 * If we're done with the results of this set function, get rid of
-	 * its func cache so that we will start from the top next time.
-	 * (Can you say "memory leak"?  This feature is a crock anyway...)
+	 * If we're done with the results of this set function, get rid of its
+	 * func cache so that we will start from the top next time. (Can you
+	 * say "memory leak"?  This feature is a crock anyway...)
 	 */
 	if (isDone != ExprMultipleResult)
 	{
@@ -197,7 +197,7 @@ seteval(PG_FUNCTION_ARGS)
 
 	if (isDone != ExprSingleResult)
 	{
-		ReturnSetInfo  *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
+		ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
 
 		if (rsi && IsA(rsi, ReturnSetInfo))
 			rsi->isDone = isDone;
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index 18bad89c48b3b351a8a05f428b37683709c51b52..7e3b4bfc257f8c64b5ab20f88083ab3763fe38fe 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.23 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.24 2001/03/22 03:59:54 momjian Exp $
  *
  * NOTES
  *	  input routine largely stolen from boxin().
@@ -21,8 +21,8 @@
 #include "access/heapam.h"
 #include "utils/builtins.h"
 
-#define DatumGetItemPointer(X)   ((ItemPointer) DatumGetPointer(X))
-#define ItemPointerGetDatum(X)   PointerGetDatum(X)
+#define DatumGetItemPointer(X)	 ((ItemPointer) DatumGetPointer(X))
+#define ItemPointerGetDatum(X)	 PointerGetDatum(X)
 #define PG_GETARG_ITEMPOINTER(n) DatumGetItemPointer(PG_GETARG_DATUM(n))
 #define PG_RETURN_ITEMPOINTER(x) return ItemPointerGetDatum(x)
 
@@ -70,7 +70,7 @@ tidin(PG_FUNCTION_ARGS)
 Datum
 tidout(PG_FUNCTION_ARGS)
 {
-	ItemPointer	itemPtr = PG_GETARG_ITEMPOINTER(0);
+	ItemPointer itemPtr = PG_GETARG_ITEMPOINTER(0);
 	BlockId		blockId;
 	BlockNumber blockNumber;
 	OffsetNumber offsetNumber;
@@ -97,8 +97,8 @@ tidout(PG_FUNCTION_ARGS)
 Datum
 tideq(PG_FUNCTION_ARGS)
 {
-	ItemPointer		arg1 = PG_GETARG_ITEMPOINTER(0);
-	ItemPointer		arg2 = PG_GETARG_ITEMPOINTER(1);
+	ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0);
+	ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1);
 
 	PG_RETURN_BOOL(BlockIdGetBlockNumber(&(arg1->ip_blkid)) ==
 				   BlockIdGetBlockNumber(&(arg2->ip_blkid)) &&
@@ -109,13 +109,14 @@ tideq(PG_FUNCTION_ARGS)
 Datum
 tidne(PG_FUNCTION_ARGS)
 {
-	ItemPointer		arg1 = PG_GETARG_ITEMPOINTER(0);
-	ItemPointer		arg2 = PG_GETARG_ITEMPOINTER(1);
+	ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0);
+	ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1);
 
 	PG_RETURN_BOOL(BlockIdGetBlockNumber(&(arg1->ip_blkid)) !=
 				   BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
 				   arg1->ip_posid != arg2->ip_posid);
 }
+
 #endif
 
 /*
@@ -126,11 +127,11 @@ tidne(PG_FUNCTION_ARGS)
 Datum
 currtid_byreloid(PG_FUNCTION_ARGS)
 {
-	Oid				reloid = PG_GETARG_OID(0);
-	ItemPointer		tid = PG_GETARG_ITEMPOINTER(1);
-	ItemPointer		result,
-					ret;
-	Relation		rel;
+	Oid			reloid = PG_GETARG_OID(0);
+	ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
+	ItemPointer result,
+				ret;
+	Relation	rel;
 
 	result = (ItemPointer) palloc(sizeof(ItemPointerData));
 	ItemPointerSetInvalid(result);
@@ -150,12 +151,12 @@ currtid_byreloid(PG_FUNCTION_ARGS)
 Datum
 currtid_byrelname(PG_FUNCTION_ARGS)
 {
-	text		   *relname = PG_GETARG_TEXT_P(0);
-	ItemPointer		tid = PG_GETARG_ITEMPOINTER(1);
-	ItemPointer		result,
-					ret;
-	char		   *str;
-	Relation		rel;
+	text	   *relname = PG_GETARG_TEXT_P(0);
+	ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
+	ItemPointer result,
+				ret;
+	char	   *str;
+	Relation	rel;
 
 	str = DatumGetCString(DirectFunctionCall1(textout,
 											  PointerGetDatum(relname)));
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index a01a790124f996d46af47a4b9da7bbb13cc7f099..7a2e6ea8bb0ab19bec3d9367a4302cddce97b82a 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.45 2001/02/13 14:32:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.46 2001/03/22 03:59:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -92,7 +92,7 @@ timestamp_in(PG_FUNCTION_ARGS)
 
 		default:
 			elog(ERROR, "Internal coding error, can't input timestamp '%s'", str);
-			TIMESTAMP_INVALID(result); /* keep compiler quiet */
+			TIMESTAMP_INVALID(result);	/* keep compiler quiet */
 	}
 
 	PG_RETURN_TIMESTAMP(result);
@@ -315,14 +315,14 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
 
 #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
 			tx = localtime(&utime);
-# ifdef NO_MKTIME_BEFORE_1970
+#ifdef NO_MKTIME_BEFORE_1970
 			if (tx->tm_year < 70 && tx->tm_isdst == 1)
 			{
 				utime -= 3600;
 				tx = localtime(&utime);
 				tx->tm_isdst = 0;
 			}
-# endif
+#endif
 			tm->tm_year = tx->tm_year + 1900;
 			tm->tm_mon = tx->tm_mon + 1;
 			tm->tm_mday = tx->tm_mday;
@@ -341,20 +341,20 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
 #endif
 			tm->tm_isdst = tx->tm_isdst;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 			tm->tm_gmtoff = tx->tm_gmtoff;
 			tm->tm_zone = tx->tm_zone;
 
 			*tzp = -(tm->tm_gmtoff);	/* tm_gmtoff is Sun/DEC-ism */
 			if (tzn != NULL)
 				*tzn = (char *) tm->tm_zone;
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 			*tzp = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
 			if (tzn != NULL)
 				*tzn = tzname[(tm->tm_isdst > 0)];
-# endif
+#endif
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 			*tzp = CTimeZone;	/* V7 conventions; don't know timezone? */
 			if (tzn != NULL)
 				*tzn = CTZName;
@@ -482,7 +482,7 @@ timestamp_finite(PG_FUNCTION_ARGS)
 {
 	Timestamp	timestamp = PG_GETARG_TIMESTAMP(0);
 
-	PG_RETURN_BOOL(! TIMESTAMP_NOT_FINITE(timestamp));
+	PG_RETURN_BOOL(!TIMESTAMP_NOT_FINITE(timestamp));
 }
 
 Datum
@@ -490,7 +490,7 @@ interval_finite(PG_FUNCTION_ARGS)
 {
 	Interval   *interval = PG_GETARG_INTERVAL_P(0);
 
-	PG_RETURN_BOOL(! INTERVAL_NOT_FINITE(*interval));
+	PG_RETURN_BOOL(!INTERVAL_NOT_FINITE(*interval));
 }
 
 
@@ -656,13 +656,9 @@ timestamp_cmp(PG_FUNCTION_ARGS)
 	Timestamp	dt2 = PG_GETARG_TIMESTAMP(1);
 
 	if (TIMESTAMP_IS_INVALID(dt1))
-	{
 		PG_RETURN_INT32(TIMESTAMP_IS_INVALID(dt2) ? 0 : 1);
-	}
 	else if (TIMESTAMP_IS_INVALID(dt2))
-	{
 		PG_RETURN_INT32(-1);
-	}
 	else
 	{
 		if (TIMESTAMP_IS_RELATIVE(dt1))
@@ -839,7 +835,9 @@ interval_hash(PG_FUNCTION_ARGS)
 Datum
 overlaps_timestamp(PG_FUNCTION_ARGS)
 {
-	/* The arguments are Timestamps, but we leave them as generic Datums
+
+	/*
+	 * The arguments are Timestamps, but we leave them as generic Datums
 	 * to avoid unnecessary conversions between value and reference forms
 	 * --- not to mention possible dereferences of null pointers.
 	 */
@@ -858,9 +856,9 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 	DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2))
 
 	/*
-	 * If both endpoints of interval 1 are null, the result is null (unknown).
-	 * If just one endpoint is null, take ts1 as the non-null one.
-	 * Otherwise, take ts1 as the lesser endpoint.
+	 * If both endpoints of interval 1 are null, the result is null
+	 * (unknown). If just one endpoint is null, take ts1 as the non-null
+	 * one. Otherwise, take ts1 as the lesser endpoint.
 	 */
 	if (ts1IsNull)
 	{
@@ -874,7 +872,7 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 	{
 		if (TIMESTAMP_GT(ts1, te1))
 		{
-			Datum	tt = ts1;
+			Datum		tt = ts1;
 
 			ts1 = te1;
 			te1 = tt;
@@ -894,7 +892,7 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 	{
 		if (TIMESTAMP_GT(ts2, te2))
 		{
-			Datum	tt = ts2;
+			Datum		tt = ts2;
 
 			ts2 = te2;
 			te2 = tt;
@@ -907,7 +905,9 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 	 */
 	if (TIMESTAMP_GT(ts1, ts2))
 	{
-		/* This case is ts1 < te2 OR te1 < te2, which may look redundant
+
+		/*
+		 * This case is ts1 < te2 OR te1 < te2, which may look redundant
 		 * but in the presence of nulls it's not quite completely so.
 		 */
 		if (te2IsNull)
@@ -916,7 +916,9 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te1IsNull)
 			PG_RETURN_NULL();
-		/* If te1 is not null then we had ts1 <= te1 above, and we just
+
+		/*
+		 * If te1 is not null then we had ts1 <= te1 above, and we just
 		 * found ts1 >= te2, hence te1 >= te2.
 		 */
 		PG_RETURN_BOOL(false);
@@ -930,15 +932,20 @@ overlaps_timestamp(PG_FUNCTION_ARGS)
 			PG_RETURN_BOOL(true);
 		if (te2IsNull)
 			PG_RETURN_NULL();
-		/* If te2 is not null then we had ts2 <= te2 above, and we just
+
+		/*
+		 * If te2 is not null then we had ts2 <= te2 above, and we just
 		 * found ts2 >= te1, hence te2 >= te1.
 		 */
 		PG_RETURN_BOOL(false);
 	}
 	else
 	{
-		/* For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
-		 * rather silly way of saying "true if both are nonnull, else null".
+
+		/*
+		 * For ts1 = ts2 the spec says te1 <> te2 OR te1 = te2, which is a
+		 * rather silly way of saying "true if both are nonnull, else
+		 * null".
 		 */
 		if (te1IsNull || te2IsNull)
 			PG_RETURN_NULL();
@@ -1086,13 +1093,14 @@ timestamp_pl_span(PG_FUNCTION_ARGS)
 					tm->tm_year += 1900;
 					tm->tm_mon += 1;
 
-# if defined(HAVE_TM_ZONE)
-					tz = -(tm->tm_gmtoff);	/* tm_gmtoff is Sun/DEC-ism */
-# elif defined(HAVE_INT_TIMEZONE)
+#if defined(HAVE_TM_ZONE)
+					tz = -(tm->tm_gmtoff);		/* tm_gmtoff is
+												 * Sun/DEC-ism */
+#elif defined(HAVE_INT_TIMEZONE)
 					tz = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-# endif
+#endif
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 					tz = CTimeZone;
 #endif
 				}
@@ -1129,8 +1137,8 @@ timestamp_mi_span(PG_FUNCTION_ARGS)
 	Interval   *span = PG_GETARG_INTERVAL_P(1);
 	Interval	tspan;
 
-	tspan.month = - span->month;
-	tspan.time = - span->time;
+	tspan.month = -span->month;
+	tspan.time = -span->time;
 
 	return DirectFunctionCall2(timestamp_pl_span,
 							   TimestampGetDatum(timestamp),
@@ -1351,18 +1359,19 @@ interval_accum(PG_FUNCTION_ARGS)
 					  &transdatums, &ndatums);
 	if (ndatums != 2)
 		elog(ERROR, "interval_accum: expected 2-element interval array");
+
 	/*
 	 * XXX memcpy, instead of just extracting a pointer, to work around
 	 * buggy array code: it won't ensure proper alignment of Interval
-	 * objects on machines where double requires 8-byte alignment.
-	 * That should be fixed, but in the meantime...
+	 * objects on machines where double requires 8-byte alignment. That
+	 * should be fixed, but in the meantime...
 	 */
 	memcpy(&sumX, DatumGetIntervalP(transdatums[0]), sizeof(Interval));
 	memcpy(&N, DatumGetIntervalP(transdatums[1]), sizeof(Interval));
 
 	newsum = DatumGetIntervalP(DirectFunctionCall2(interval_pl,
-												   IntervalPGetDatum(&sumX),
-												   IntervalPGetDatum(newval)));
+												IntervalPGetDatum(&sumX),
+											 IntervalPGetDatum(newval)));
 	N.time += 1;
 
 	transdatums[0] = IntervalPGetDatum(newsum);
@@ -1389,11 +1398,12 @@ interval_avg(PG_FUNCTION_ARGS)
 					  &transdatums, &ndatums);
 	if (ndatums != 2)
 		elog(ERROR, "interval_avg: expected 2-element interval array");
+
 	/*
 	 * XXX memcpy, instead of just extracting a pointer, to work around
 	 * buggy array code: it won't ensure proper alignment of Interval
-	 * objects on machines where double requires 8-byte alignment.
-	 * That should be fixed, but in the meantime...
+	 * objects on machines where double requires 8-byte alignment. That
+	 * should be fixed, but in the meantime...
 	 */
 	memcpy(&sumX, DatumGetIntervalP(transdatums[0]), sizeof(Interval));
 	memcpy(&N, DatumGetIntervalP(transdatums[1]), sizeof(Interval));
@@ -1439,9 +1449,7 @@ timestamp_age(PG_FUNCTION_ARGS)
 
 	if (TIMESTAMP_IS_INVALID(dt1)
 		|| TIMESTAMP_IS_INVALID(dt2))
-	{
 		TIMESTAMP_INVALID(result->time);
-	}
 	else if ((timestamp2tm(dt1, NULL, tm1, &fsec1, NULL) == 0)
 			 && (timestamp2tm(dt2, NULL, tm2, &fsec2, NULL) == 0))
 	{
@@ -1597,7 +1605,7 @@ interval_text(PG_FUNCTION_ARGS)
 	int			len;
 
 	str = DatumGetCString(DirectFunctionCall1(interval_out,
-											  IntervalPGetDatum(interval)));
+										   IntervalPGetDatum(interval)));
 
 	len = (strlen(str) + VARHDRSZ);
 
@@ -1662,7 +1670,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
 	if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 	up = VARDATA(units);
 	lp = lowunits;
 	for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
@@ -1672,9 +1680,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
 	type = DecodeUnits(0, lowunits, &val);
 
 	if (TIMESTAMP_NOT_FINITE(timestamp))
-	{
 		PG_RETURN_NULL();
-	}
 	else
 	{
 		dt = (TIMESTAMP_IS_RELATIVE(timestamp) ? SetTimestamp(timestamp) : timestamp);
@@ -1729,13 +1735,13 @@ timestamp_trunc(PG_FUNCTION_ARGS)
 				tm->tm_year += 1900;
 				tm->tm_mon += 1;
 
-# if defined(HAVE_TM_ZONE)
+#if defined(HAVE_TM_ZONE)
 				tz = -(tm->tm_gmtoff);	/* tm_gmtoff is Sun/DEC-ism */
-# elif defined(HAVE_INT_TIMEZONE)
+#elif defined(HAVE_INT_TIMEZONE)
 				tz = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
-# endif
+#endif
 
-#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
+#else							/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
 				tz = CTimeZone;
 #endif
 			}
@@ -1789,7 +1795,7 @@ interval_trunc(PG_FUNCTION_ARGS)
 	if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 	up = VARDATA(units);
 	lp = lowunits;
 	for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
@@ -1872,7 +1878,7 @@ interval_trunc(PG_FUNCTION_ARGS)
 	{
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 		PG_RETURN_NULL();
 	}
 
@@ -1885,75 +1891,80 @@ interval_trunc(PG_FUNCTION_ARGS)
  * karel 2000/08/07
  */
 void
-isoweek2date( int woy, int *year, int *mon, int *mday)
+isoweek2date(int woy, int *year, int *mon, int *mday)
 {
-	int     day0, day4, dayn;
-	
+	int			day0,
+				day4,
+				dayn;
+
 	if (!*year)
 		elog(ERROR, "isoweek2date(): can't convert without year information");
 
 	/* fourth day of current year */
 	day4 = date2j(*year, 1, 4);
-	
+
 	/* day0 == offset to first day of week (Monday) */
 	day0 = (j2day(day4 - 1) % 7);
 
 	dayn = ((woy - 1) * 7) + (day4 - day0);
-	
+
 	j2date(dayn, year, mon, mday);
 }
 
 /* date2isoweek()
- * 
+ *
  *	Returns ISO week number of year.
  */
 int
-date2isoweek(int year, int mon, int mday) 
+date2isoweek(int year, int mon, int mday)
 {
-	float8	result;
-	int	day0, day4, dayn;
-	
-	/* current day */	
+	float8		result;
+	int			day0,
+				day4,
+				dayn;
+
+	/* current day */
 	dayn = date2j(year, mon, mday);
-	
+
 	/* fourth day of current year */
 	day4 = date2j(year, 1, 4);
-	
+
 	/* day0 == offset to first day of week (Monday) */
 	day0 = (j2day(day4 - 1) % 7);
-	
-	/* We need the first week containing a Thursday,
-	 * otherwise this day falls into the previous year
-	 * for purposes of counting weeks
+
+	/*
+	 * We need the first week containing a Thursday, otherwise this day
+	 * falls into the previous year for purposes of counting weeks
 	 */
 	if (dayn < (day4 - day0))
 	{
 		day4 = date2j((year - 1), 1, 4);
-	
+
 		/* day0 == offset to first day of week (Monday) */
 		day0 = (j2day(day4 - 1) % 7);
 	}
-	
+
 	result = (((dayn - (day4 - day0)) / 7) + 1);
-	
-	/* Sometimes the last few days in a year will fall into
-	 * the first week of the next year, so check for this.
+
+	/*
+	 * Sometimes the last few days in a year will fall into the first week
+	 * of the next year, so check for this.
 	 */
 	if (result >= 53)
 	{
 		day4 = date2j((year + 1), 1, 4);
-	
+
 		/* day0 == offset to first day of week (Monday) */
 		day0 = (j2day(day4 - 1) % 7);
-		
+
 		if (dayn >= (day4 - day0))
 			result = (((dayn - (day4 - day0)) / 7) + 1);
 	}
 
 	return (int) result;
-} 
- 
- 
+}
+
+
 /* timestamp_part()
  * Extract specified field from timestamp.
  */
@@ -1980,7 +1991,7 @@ timestamp_part(PG_FUNCTION_ARGS)
 	if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 	up = VARDATA(units);
 	lp = lowunits;
 	for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
@@ -1992,9 +2003,7 @@ timestamp_part(PG_FUNCTION_ARGS)
 		type = DecodeSpecial(0, lowunits, &val);
 
 	if (TIMESTAMP_NOT_FINITE(timestamp))
-	{
 		PG_RETURN_NULL();
-	}
 	else
 	{
 		dt = (TIMESTAMP_IS_RELATIVE(timestamp) ? SetTimestamp(timestamp) : timestamp);
@@ -2096,7 +2105,7 @@ timestamp_part(PG_FUNCTION_ARGS)
 						elog(ERROR, "Unable to encode timestamp");
 
 					result = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday)
-							   - date2j(tm->tm_year, 1, 1) + 1);
+							  - date2j(tm->tm_year, 1, 1) + 1);
 					break;
 
 				default:
@@ -2138,7 +2147,7 @@ interval_part(PG_FUNCTION_ARGS)
 	if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 	up = VARDATA(units);
 	lp = lowunits;
 	for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
@@ -2213,7 +2222,7 @@ interval_part(PG_FUNCTION_ARGS)
 				default:
 					elog(ERROR, "Interval units '%s' not yet supported",
 						 DatumGetCString(DirectFunctionCall1(textout,
-													PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 					result = 0;
 			}
 
@@ -2237,7 +2246,7 @@ interval_part(PG_FUNCTION_ARGS)
 	{
 		elog(ERROR, "Interval units '%s' not recognized",
 			 DatumGetCString(DirectFunctionCall1(textout,
-												 PointerGetDatum(units))));
+											   PointerGetDatum(units))));
 		result = 0;
 	}
 
@@ -2283,9 +2292,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
 	type = DecodeSpecial(0, lowzone, &val);
 
 	if (TIMESTAMP_NOT_FINITE(timestamp))
-	{
 		PG_RETURN_NULL();
-	}
 	else if ((type == TZ) || (type == DTZ))
 	{
 		tm->tm_isdst = ((type == DTZ) ? 1 : 0);
@@ -2320,7 +2327,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
 	}
 
 	PG_RETURN_TEXT_P(result);
-} /* timestamp_zone() */
+}	/* timestamp_zone() */
 
 /* timestamp_izone()
  * Encode timestamp type with specified time interval as time zone.
@@ -2364,4 +2371,4 @@ timestamp_izone(PG_FUNCTION_ARGS)
 	memmove(VARDATA(result), buf, (len - VARHDRSZ));
 
 	PG_RETURN_TEXT_P(result);
-} /* timestamp_izone() */
+}	/* timestamp_izone() */
diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c
index adbdf4f8ca734859156f8d9936969c0a542ba864..775382568bb59cc2b718384b6639234cc2bf28df 100644
--- a/src/backend/utils/adt/varbit.c
+++ b/src/backend/utils/adt/varbit.c
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.15 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.16 2001/03/22 03:59:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,8 +51,10 @@ Datum
 zpbit_in(PG_FUNCTION_ARGS)
 {
 	char	   *input_string = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
 	Oid			typelem = PG_GETARG_OID(1);
+
 #endif
 	int32		atttypmod = PG_GETARG_INT32(2);
 	VarBit	   *result;			/* The resulting bit string			  */
@@ -79,9 +81,10 @@ zpbit_in(PG_FUNCTION_ARGS)
 	}
 	else
 	{
+
 		/*
-		 * Otherwise it's binary.  This allows things like cast('1001'
-		 * as bit) to work transparently.
+		 * Otherwise it's binary.  This allows things like cast('1001' as
+		 * bit) to work transparently.
 		 */
 		bit_not_hex = true;
 		sp = input_string;
@@ -214,8 +217,8 @@ zpbit_out(PG_FUNCTION_ARGS)
 	}
 
 	/*
-	 * Go back one step if we printed a hex number that was not part
-	 * of the bitstring anymore
+	 * Go back one step if we printed a hex number that was not part of
+	 * the bitstring anymore
 	 */
 	if (i > len)
 		r--;
@@ -263,12 +266,13 @@ _zpbit(PG_FUNCTION_ARGS)
 {
 	ArrayType  *v = (ArrayType *) PG_GETARG_VARLENA_P(0);
 	int32		len = PG_GETARG_INT32(1);
-	FunctionCallInfoData	locfcinfo;
+	FunctionCallInfoData locfcinfo;
+
 	/*
-	 * Since zpbit() is a built-in function, we should only need to
-	 * look it up once per run.
+	 * Since zpbit() is a built-in function, we should only need to look
+	 * it up once per run.
 	 */
-	static FmgrInfo			zpbit_finfo;
+	static FmgrInfo zpbit_finfo;
 
 	if (zpbit_finfo.fn_oid == InvalidOid)
 		fmgr_info(F_ZPBIT, &zpbit_finfo);
@@ -293,8 +297,10 @@ Datum
 varbit_in(PG_FUNCTION_ARGS)
 {
 	char	   *input_string = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
 	Oid			typelem = PG_GETARG_OID(1);
+
 #endif
 	int32		atttypmod = PG_GETARG_INT32(2);
 	VarBit	   *result;			/* The resulting bit string			  */
@@ -490,12 +496,13 @@ _varbit(PG_FUNCTION_ARGS)
 {
 	ArrayType  *v = (ArrayType *) PG_GETARG_VARLENA_P(0);
 	int32		len = PG_GETARG_INT32(1);
-	FunctionCallInfoData	locfcinfo;
+	FunctionCallInfoData locfcinfo;
+
 	/*
-	 * Since varbit() is a built-in function, we should only need to
-	 * look it up once per run.
+	 * Since varbit() is a built-in function, we should only need to look
+	 * it up once per run.
 	 */
-	static FmgrInfo			varbit_finfo;
+	static FmgrInfo varbit_finfo;
 
 	if (varbit_finfo.fn_oid == InvalidOid)
 		fmgr_info(F_VARBIT, &varbit_finfo);
@@ -765,7 +772,7 @@ bitsubstr(PG_FUNCTION_ARGS)
 
 	bitlen = VARBITLEN(arg);
 	/* If we do not have an upper bound, set bitlen */
-	if (l==-1)
+	if (l == -1)
 		l = bitlen;
 	e = s + l;
 	s1 = Max(s, 1);
@@ -780,6 +787,7 @@ bitsubstr(PG_FUNCTION_ARGS)
 	}
 	else
 	{
+
 		/*
 		 * OK, we've got a true substring starting at position s1-1 and
 		 * ending at position e1-1
@@ -823,7 +831,7 @@ bitsubstr(PG_FUNCTION_ARGS)
 	PG_RETURN_VARBIT_P(result);
 }
 
-/* bitlength, bitoctetlength 
+/* bitlength, bitoctetlength
  * Return the length of a bit string
  */
 Datum
@@ -986,7 +994,7 @@ bitnot(PG_FUNCTION_ARGS)
 	p = VARBITS(arg);
 	r = VARBITS(result);
 	for (; p < VARBITEND(arg); p++)
-		*r++ = ~ *p;
+		*r++ = ~*p;
 
 	/* Pad the result */
 	mask = BITMASK << VARBITPAD(result);
@@ -1076,8 +1084,8 @@ bitshiftright(PG_FUNCTION_ARGS)
 	/* Negative shift is a shift to the left */
 	if (shft < 0)
 		PG_RETURN_DATUM(DirectFunctionCall2(bitshiftleft,
-						    VarBitPGetDatum(arg),
-						    Int32GetDatum(-shft)));
+											VarBitPGetDatum(arg),
+											Int32GetDatum(-shft)));
 
 	result = (VarBit *) palloc(VARSIZE(arg));
 	VARATT_SIZEP(result) = VARSIZE(arg);
@@ -1121,7 +1129,7 @@ bitshiftright(PG_FUNCTION_ARGS)
 }
 
 /* This is not defined in any standard. We retain the natural ordering of
- * bits here, as it just seems more intuitive. 
+ * bits here, as it just seems more intuitive.
  */
 Datum
 bitfromint4(PG_FUNCTION_ARGS)
@@ -1130,19 +1138,21 @@ bitfromint4(PG_FUNCTION_ARGS)
 	VarBit	   *result;
 	bits8	   *r;
 	int			len;
-  
+
 	/* allocate enough space for the bits in an int4 */
-	len = VARBITTOTALLEN(sizeof(int4)*BITS_PER_BYTE);
+	len = VARBITTOTALLEN(sizeof(int4) * BITS_PER_BYTE);
 	result = (VarBit *) palloc(len);
 	VARATT_SIZEP(result) = len;
-	VARBITLEN(result) = sizeof(int4)*BITS_PER_BYTE;
-	/* masks and shifts here are just too painful and we know that an int4 has
-	 * got 4 bytes
+	VARBITLEN(result) = sizeof(int4) * BITS_PER_BYTE;
+
+	/*
+	 * masks and shifts here are just too painful and we know that an int4
+	 * has got 4 bytes
 	 */
 	r = VARBITS(result);
-	r[0] = (bits8) ((a >> (3*BITS_PER_BYTE)) & BITMASK);
-	r[1] = (bits8) ((a >> (2*BITS_PER_BYTE)) & BITMASK);
-	r[2] = (bits8) ((a >> (1*BITS_PER_BYTE)) & BITMASK);
+	r[0] = (bits8) ((a >> (3 * BITS_PER_BYTE)) & BITMASK);
+	r[1] = (bits8) ((a >> (2 * BITS_PER_BYTE)) & BITMASK);
+	r[2] = (bits8) ((a >> (1 * BITS_PER_BYTE)) & BITMASK);
 	r[3] = (bits8) (a & BITMASK);
 
 	PG_RETURN_VARBIT_P(result);
@@ -1156,7 +1166,7 @@ bittoint4(PG_FUNCTION_ARGS)
 	bits8	   *r;
 
 	/* Check that the bit string is not too long */
-	if (VARBITLEN(arg) > sizeof(int4)*BITS_PER_BYTE) 
+	if (VARBITLEN(arg) > sizeof(int4) * BITS_PER_BYTE)
 		elog(ERROR, "Bit string is too large to fit in an int4");
 	result = 0;
 	for (r = VARBITS(arg); r < VARBITEND(arg); r++)
@@ -1179,18 +1189,18 @@ bittoint4(PG_FUNCTION_ARGS)
 Datum
 bitposition(PG_FUNCTION_ARGS)
 {
-	VarBit		*substr = PG_GETARG_VARBIT_P(1);
-	VarBit		*arg = PG_GETARG_VARBIT_P(0);
-	int			substr_length, 
+	VarBit	   *substr = PG_GETARG_VARBIT_P(1);
+	VarBit	   *arg = PG_GETARG_VARBIT_P(0);
+	int			substr_length,
 				arg_length,
 				i,
 				is;
-	bits8		*s,				/* pointer into substring */
-				*p;				/* pointer into arg */
-	bits8		cmp,			/* shifted substring byte to compare */ 
-				mask1,          /* mask for substring byte shifted right */
-				mask2,          /* mask for substring byte shifted left */
-				end_mask,       /* pad mask for last substring byte */
+	bits8	   *s,				/* pointer into substring */
+			   *p;				/* pointer into arg */
+	bits8		cmp,			/* shifted substring byte to compare */
+				mask1,			/* mask for substring byte shifted right */
+				mask2,			/* mask for substring byte shifted left */
+				end_mask,		/* pad mask for last substring byte */
 				arg_mask;		/* pad mask for last argument byte */
 	bool		is_match;
 
@@ -1200,8 +1210,8 @@ bitposition(PG_FUNCTION_ARGS)
 
 	/* Argument has 0 length or substring longer than argument, return 0 */
 	if (arg_length == 0 || substr_length > arg_length)
-		PG_RETURN_INT32(0);	
-	
+		PG_RETURN_INT32(0);
+
 	/* 0-length means return 1 */
 	if (substr_length == 0)
 		PG_RETURN_INT32(1);
@@ -1209,23 +1219,26 @@ bitposition(PG_FUNCTION_ARGS)
 	/* Initialise the padding masks */
 	end_mask = BITMASK << VARBITPAD(substr);
 	arg_mask = BITMASK << VARBITPAD(arg);
-	for (i = 0; i < VARBITBYTES(arg) - VARBITBYTES(substr) + 1; i++) 
+	for (i = 0; i < VARBITBYTES(arg) - VARBITBYTES(substr) + 1; i++)
 	{
-		for (is = 0; is < BITS_PER_BYTE; is++) {
+		for (is = 0; is < BITS_PER_BYTE; is++)
+		{
 			is_match = true;
 			p = VARBITS(arg) + i;
 			mask1 = BITMASK >> is;
 			mask2 = ~mask1;
-			for (s = VARBITS(substr); 
-				 is_match && s < VARBITEND(substr); s++) 
+			for (s = VARBITS(substr);
+				 is_match && s < VARBITEND(substr); s++)
 			{
 				cmp = *s >> is;
-				if (s == VARBITEND(substr) - 1) 
+				if (s == VARBITEND(substr) - 1)
 				{
 					mask1 &= end_mask >> is;
-					if (p == VARBITEND(arg) - 1) {
+					if (p == VARBITEND(arg) - 1)
+					{
 						/* Check that there is enough of arg left */
-						if (mask1 & ~arg_mask) {
+						if (mask1 & ~arg_mask)
+						{
 							is_match = false;
 							break;
 						}
@@ -1237,21 +1250,24 @@ bitposition(PG_FUNCTION_ARGS)
 					break;
 				/* Move on to the next byte */
 				p++;
-				if (p == VARBITEND(arg)) {
+				if (p == VARBITEND(arg))
+				{
 					mask2 = end_mask << (BITS_PER_BYTE - is);
 					is_match = mask2 == 0;
 #if 0
-					elog(NOTICE,"S. %d %d em=%2x sm=%2x r=%d",
-						 i,is,end_mask,mask2,is_match);
+					elog(NOTICE, "S. %d %d em=%2x sm=%2x r=%d",
+						 i, is, end_mask, mask2, is_match);
 #endif
 					break;
 				}
 				cmp = *s << (BITS_PER_BYTE - is);
-				if (s == VARBITEND(substr) - 1) 
+				if (s == VARBITEND(substr) - 1)
 				{
 					mask2 &= end_mask << (BITS_PER_BYTE - is);
-					if (p == VARBITEND(arg) - 1) {
-						if (mask2 & ~arg_mask) {
+					if (p == VARBITEND(arg) - 1)
+					{
+						if (mask2 & ~arg_mask)
+						{
 							is_match = false;
 							break;
 						}
@@ -1262,7 +1278,7 @@ bitposition(PG_FUNCTION_ARGS)
 			}
 			/* Have we found a match */
 			if (is_match)
-				PG_RETURN_INT32(i*BITS_PER_BYTE + is + 1);
+				PG_RETURN_INT32(i * BITS_PER_BYTE + is + 1);
 		}
 	}
 	PG_RETURN_INT32(0);
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index acec5f0cf24488d873817a419a725915c71e15e4..37eeee4206c478bf379bcb3d97414b2e3bb8e46b 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.74 2001/02/10 02:31:27 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.75 2001/03/22 03:59:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -64,8 +64,10 @@ Datum
 bpcharin(PG_FUNCTION_ARGS)
 {
 	char	   *s = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
 	Oid			typelem = PG_GETARG_OID(1);
+
 #endif
 	int32		atttypmod = PG_GETARG_INT32(2);
 	BpChar	   *result;
@@ -82,9 +84,9 @@ bpcharin(PG_FUNCTION_ARGS)
 	else
 #ifdef MULTIBYTE
 	{
+
 		/*
-		 * truncate multi-byte string preserving multi-byte
-		 * boundary
+		 * truncate multi-byte string preserving multi-byte boundary
 		 */
 		len = pg_mbcliplen(s, atttypmod - VARHDRSZ, atttypmod - VARHDRSZ);
 	}
@@ -169,6 +171,7 @@ bpchar(PG_FUNCTION_ARGS)
 	r = VARDATA(result);
 
 #ifdef MULTIBYTE
+
 	/*
 	 * truncate multi-byte string in a way not to break multi-byte
 	 * boundary
@@ -214,18 +217,19 @@ _bpchar(PG_FUNCTION_ARGS)
 {
 	ArrayType  *v = (ArrayType *) PG_GETARG_VARLENA_P(0);
 	int32		len = PG_GETARG_INT32(1);
-	FunctionCallInfoData	locfcinfo;
+	FunctionCallInfoData locfcinfo;
+
 	/*
-	 * Since bpchar() is a built-in function, we should only need to
-	 * look it up once per run.
+	 * Since bpchar() is a built-in function, we should only need to look
+	 * it up once per run.
 	 */
-	static FmgrInfo			bpchar_finfo;
+	static FmgrInfo bpchar_finfo;
 
 	if (bpchar_finfo.fn_oid == InvalidOid)
 		fmgr_info(F_BPCHAR, &bpchar_finfo);
 
 	MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-    locfcinfo.flinfo = &bpchar_finfo;
+	locfcinfo.flinfo = &bpchar_finfo;
 	locfcinfo.nargs = 2;
 	/* We assume we are "strict" and need not worry about null inputs */
 	locfcinfo.arg[0] = PointerGetDatum(v);
@@ -280,7 +284,7 @@ bpchar_name(PG_FUNCTION_ARGS)
 
 	/* Truncate to max length for a Name */
 	if (len >= NAMEDATALEN)
-		len = NAMEDATALEN-1;
+		len = NAMEDATALEN - 1;
 
 	/* Remove trailing blanks */
 	while (len > 0)
@@ -335,17 +339,19 @@ Datum
 varcharin(PG_FUNCTION_ARGS)
 {
 	char	   *s = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
 	Oid			typelem = PG_GETARG_OID(1);
+
 #endif
 	int32		atttypmod = PG_GETARG_INT32(2);
-	VarChar	   *result;
+	VarChar    *result;
 	int			len;
 
 	len = strlen(s) + VARHDRSZ;
 	if (atttypmod >= (int32) VARHDRSZ && len > atttypmod)
 #ifdef MULTIBYTE
- 		len = pg_mbcliplen(s, len - VARHDRSZ, atttypmod - VARHDRSZ) + VARHDRSZ;
+		len = pg_mbcliplen(s, len - VARHDRSZ, atttypmod - VARHDRSZ) + VARHDRSZ;
 #else
 		len = atttypmod;		/* clip the string at max length */
 #endif
@@ -364,7 +370,7 @@ varcharin(PG_FUNCTION_ARGS)
 Datum
 varcharout(PG_FUNCTION_ARGS)
 {
-	VarChar	   *s = PG_GETARG_VARCHAR_P(0);
+	VarChar    *s = PG_GETARG_VARCHAR_P(0);
 	char	   *result;
 	int			len;
 
@@ -388,9 +394,9 @@ varcharout(PG_FUNCTION_ARGS)
 Datum
 varchar(PG_FUNCTION_ARGS)
 {
-	VarChar	   *s = PG_GETARG_VARCHAR_P(0);
+	VarChar    *s = PG_GETARG_VARCHAR_P(0);
 	int32		slen = PG_GETARG_INT32(1);
-	VarChar	   *result;
+	VarChar    *result;
 	int			len;
 
 	len = VARSIZE(s);
@@ -402,8 +408,7 @@ varchar(PG_FUNCTION_ARGS)
 #ifdef MULTIBYTE
 
 	/*
-	 * truncate multi-byte string preserving multi-byte
-	 * boundary
+	 * truncate multi-byte string preserving multi-byte boundary
 	 */
 	len = pg_mbcliplen(VARDATA(s), slen - VARHDRSZ, slen - VARHDRSZ);
 	slen = len + VARHDRSZ;
@@ -427,18 +432,19 @@ _varchar(PG_FUNCTION_ARGS)
 {
 	ArrayType  *v = (ArrayType *) PG_GETARG_VARLENA_P(0);
 	int32		len = PG_GETARG_INT32(1);
-	FunctionCallInfoData	locfcinfo;
+	FunctionCallInfoData locfcinfo;
+
 	/*
-	 * Since varchar() is a built-in function, we should only need to
-	 * look it up once per run.
+	 * Since varchar() is a built-in function, we should only need to look
+	 * it up once per run.
 	 */
-	static FmgrInfo			varchar_finfo;
+	static FmgrInfo varchar_finfo;
 
 	if (varchar_finfo.fn_oid == InvalidOid)
 		fmgr_info(F_VARCHAR, &varchar_finfo);
 
 	MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-    locfcinfo.flinfo = &varchar_finfo;
+	locfcinfo.flinfo = &varchar_finfo;
 	locfcinfo.nargs = 2;
 	/* We assume we are "strict" and need not worry about null inputs */
 	locfcinfo.arg[0] = PointerGetDatum(v);
@@ -468,6 +474,7 @@ Datum
 bpcharlen(PG_FUNCTION_ARGS)
 {
 	BpChar	   *arg = PG_GETARG_BPCHAR_P(0);
+
 #ifdef MULTIBYTE
 	unsigned char *s;
 	int			len,
@@ -656,7 +663,7 @@ bpcharcmp(PG_FUNCTION_ARGS)
 
 /*
  * bpchar needs a specialized hash function because we want to ignore
- * trailing blanks in comparisons.  (varchar can use plain hashvarlena.)
+ * trailing blanks in comparisons.	(varchar can use plain hashvarlena.)
  */
 Datum
 hashbpchar(PG_FUNCTION_ARGS)
@@ -685,7 +692,8 @@ hashbpchar(PG_FUNCTION_ARGS)
 Datum
 varcharlen(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg = PG_GETARG_VARCHAR_P(0);
+
 #ifdef MULTIBYTE
 	unsigned char *s;
 	int			len,
@@ -711,7 +719,7 @@ varcharlen(PG_FUNCTION_ARGS)
 Datum
 varcharoctetlen(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg = PG_GETARG_VARCHAR_P(0);
 
 	PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
 }
@@ -728,8 +736,8 @@ varcharoctetlen(PG_FUNCTION_ARGS)
 Datum
 varchareq(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	bool		result;
@@ -751,8 +759,8 @@ varchareq(PG_FUNCTION_ARGS)
 Datum
 varcharne(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	bool		result;
@@ -774,8 +782,8 @@ varcharne(PG_FUNCTION_ARGS)
 Datum
 varcharlt(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	int			cmp;
@@ -794,8 +802,8 @@ varcharlt(PG_FUNCTION_ARGS)
 Datum
 varcharle(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	int			cmp;
@@ -814,8 +822,8 @@ varcharle(PG_FUNCTION_ARGS)
 Datum
 varchargt(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	int			cmp;
@@ -834,8 +842,8 @@ varchargt(PG_FUNCTION_ARGS)
 Datum
 varcharge(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	int			cmp;
@@ -854,8 +862,8 @@ varcharge(PG_FUNCTION_ARGS)
 Datum
 varcharcmp(PG_FUNCTION_ARGS)
 {
-	VarChar	   *arg1 = PG_GETARG_VARCHAR_P(0);
-	VarChar	   *arg2 = PG_GETARG_VARCHAR_P(1);
+	VarChar    *arg1 = PG_GETARG_VARCHAR_P(0);
+	VarChar    *arg2 = PG_GETARG_VARCHAR_P(1);
 	int			len1,
 				len2;
 	int			cmp;
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index ba1ed5350ed64bfbc55d8fc61144f56d80c1f59d..efa6ab65527e2e37c002359a363c5ceb10c9807d 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.68 2001/02/10 02:31:27 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.69 2001/03/22 03:59:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -202,6 +202,7 @@ Datum
 textlen(PG_FUNCTION_ARGS)
 {
 	text	   *t = PG_GETARG_TEXT_P(0);
+
 #ifdef MULTIBYTE
 	unsigned char *s;
 	int			len,
@@ -236,10 +237,10 @@ textlen(PG_FUNCTION_ARGS)
 Datum
 textoctetlen(PG_FUNCTION_ARGS)
 {
-	struct varattrib   *t = (struct varattrib *) PG_GETARG_RAW_VARLENA_P(0);
+	struct varattrib *t = (struct varattrib *) PG_GETARG_RAW_VARLENA_P(0);
 
 	if (!VARATT_IS_EXTERNAL(t))
-	    PG_RETURN_INT32(VARATT_SIZE(t) - VARHDRSZ);
+		PG_RETURN_INT32(VARATT_SIZE(t) - VARHDRSZ);
 
 	PG_RETURN_INT32(t->va_content.va_external.va_extsize);
 }
@@ -320,9 +321,11 @@ text_substr(PG_FUNCTION_ARGS)
 	int32		n = PG_GETARG_INT32(2);
 	text	   *ret;
 	int			len;
+
 #ifdef MULTIBYTE
 	int			i;
 	char	   *p;
+
 #endif
 
 	len = VARSIZE(string) - VARHDRSZ;
@@ -392,9 +395,11 @@ textpos(PG_FUNCTION_ARGS)
 				len2;
 	pg_wchar   *p1,
 			   *p2;
+
 #ifdef MULTIBYTE
 	pg_wchar   *ps1,
 			   *ps2;
+
 #endif
 
 	if (VARSIZE(t2) <= VARHDRSZ)
@@ -843,7 +848,7 @@ text_name(PG_FUNCTION_ARGS)
 
 	/* Truncate oversize input */
 	if (len >= NAMEDATALEN)
-		len = NAMEDATALEN-1;
+		len = NAMEDATALEN - 1;
 
 #ifdef STRINGDEBUG
 	printf("text- convert string length %d (%d) ->%d\n",
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 1bedd565d03a60c02339be319bd015ca8dd18082..f843f2bb166d0fd7acaa6027e53d99b5ba9662d9 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.76 2001/02/22 18:39:19 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.77 2001/03/22 03:59:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,9 +31,9 @@
 
 static void CatCacheRemoveCTup(CatCache *cache, CatCTup *ct);
 static Index CatalogCacheComputeHashIndex(CatCache *cache,
-										  ScanKey cur_skey);
+							 ScanKey cur_skey);
 static Index CatalogCacheComputeTupleHashIndex(CatCache *cache,
-											   HeapTuple tuple);
+								  HeapTuple tuple);
 static void CatalogCacheInitializeCache(CatCache *cache);
 static Datum cc_hashname(PG_FUNCTION_ARGS);
 
@@ -88,8 +88,8 @@ GetCCHashFunc(Oid keytype)
 {
 	switch (keytype)
 	{
-		case BOOLOID:
-		case CHAROID:
+			case BOOLOID:
+			case CHAROID:
 			return hashchar;
 		case NAMEOID:
 			return cc_hashname;
@@ -125,7 +125,7 @@ cc_hashname(PG_FUNCTION_ARGS)
 	 */
 	NameData	my_n;
 
-	namestrcpy(&my_n, NameStr(* PG_GETARG_NAME(0)));
+	namestrcpy(&my_n, NameStr(*PG_GETARG_NAME(0)));
 
 	return DirectFunctionCall1(hashname, NameGetDatum(&my_n));
 }
@@ -141,15 +141,17 @@ cc_hashname(PG_FUNCTION_ARGS)
 void
 CreateCacheMemoryContext(void)
 {
-	/* Purely for paranoia, check that context doesn't exist;
-	 * caller probably did so already.
+
+	/*
+	 * Purely for paranoia, check that context doesn't exist; caller
+	 * probably did so already.
 	 */
 	if (!CacheMemoryContext)
 		CacheMemoryContext = AllocSetContextCreate(TopMemoryContext,
 												   "CacheMemoryContext",
-												   ALLOCSET_DEFAULT_MINSIZE,
-												   ALLOCSET_DEFAULT_INITSIZE,
-												   ALLOCSET_DEFAULT_MAXSIZE);
+												ALLOCSET_DEFAULT_MINSIZE,
+											   ALLOCSET_DEFAULT_INITSIZE,
+											   ALLOCSET_DEFAULT_MAXSIZE);
 }
 
 
@@ -157,7 +159,7 @@ CreateCacheMemoryContext(void)
  *		CatalogCacheInitializeCache
  *
  * This function does final initialization of a catcache: obtain the tuple
- * descriptor and set up the hash and equality function links.  We assume
+ * descriptor and set up the hash and equality function links.	We assume
  * that the relcache entry can be opened at this point!
  *
  */
@@ -201,8 +203,8 @@ CatalogCacheInitializeCache(CatCache *cache)
 	Assert(RelationIsValid(relation));
 
 	/*
-	 *	switch to the cache context so our allocations
-	 *	do not vanish at the end of a transaction
+	 * switch to the cache context so our allocations do not vanish at the
+	 * end of a transaction
 	 *
 	 */
 	if (!CacheMemoryContext)
@@ -211,13 +213,13 @@ CatalogCacheInitializeCache(CatCache *cache)
 	oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
 
 	/*
-	 *	copy the relcache's tuple descriptor to permanent cache storage
+	 * copy the relcache's tuple descriptor to permanent cache storage
 	 *
 	 */
 	tupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
 
 	/*
-	 *	return to the caller's memory context and close the rel
+	 * return to the caller's memory context and close the rel
 	 *
 	 */
 	MemoryContextSwitchTo(oldcxt);
@@ -228,7 +230,7 @@ CatalogCacheInitializeCache(CatCache *cache)
 				cache->cc_relname, cache->cc_nkeys);
 
 	/*
-	 *	initialize cache's key information
+	 * initialize cache's key information
 	 *
 	 */
 	for (i = 0; i < cache->cc_nkeys; ++i)
@@ -238,9 +240,7 @@ CatalogCacheInitializeCache(CatCache *cache)
 		CatalogCacheInitializeCache_DEBUG2;
 
 		if (cache->cc_key[i] > 0)
-		{
 			keytype = tupdesc->attrs[cache->cc_key[i] - 1]->atttypid;
-		}
 		else
 		{
 			if (cache->cc_key[i] != ObjectIdAttributeNumber)
@@ -249,6 +249,7 @@ CatalogCacheInitializeCache(CatCache *cache)
 		}
 
 		cache->cc_hashfunc[i] = GetCCHashFunc(keytype);
+
 		/*
 		 * If GetCCHashFunc liked the type, safe to index into eqproc[]
 		 */
@@ -268,7 +269,7 @@ CatalogCacheInitializeCache(CatCache *cache)
 	}
 
 	/*
-	 *	mark this cache fully initialized
+	 * mark this cache fully initialized
 	 *
 	 */
 	cache->cc_tupdesc = tupdesc;
@@ -293,22 +294,22 @@ CatalogCacheComputeHashIndex(CatCache *cache, ScanKey cur_skey)
 		case 4:
 			hashIndex ^=
 				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[3],
-							   cur_skey[3].sk_argument)) << 9;
+										  cur_skey[3].sk_argument)) << 9;
 			/* FALLTHROUGH */
 		case 3:
 			hashIndex ^=
 				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[2],
-							   cur_skey[2].sk_argument)) << 6;
+										  cur_skey[2].sk_argument)) << 6;
 			/* FALLTHROUGH */
 		case 2:
 			hashIndex ^=
 				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[1],
-							   cur_skey[1].sk_argument)) << 3;
+										  cur_skey[1].sk_argument)) << 3;
 			/* FALLTHROUGH */
 		case 1:
 			hashIndex ^=
 				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[0],
-							   cur_skey[0].sk_argument));
+											   cur_skey[0].sk_argument));
 			break;
 		default:
 			elog(FATAL, "CCComputeHashIndex: %d cc_nkeys", cache->cc_nkeys);
@@ -422,7 +423,7 @@ CatalogCacheIdInvalidate(int cacheId,
 	CatCache   *ccp;
 
 	/*
-	 *	sanity checks
+	 * sanity checks
 	 *
 	 */
 	Assert(hashIndex < NCCBUCK);
@@ -430,7 +431,7 @@ CatalogCacheIdInvalidate(int cacheId,
 	CACHE1_elog(DEBUG, "CatalogCacheIdInvalidate: called");
 
 	/*
-	 *	inspect caches to find the proper cache
+	 * inspect caches to find the proper cache
 	 *
 	 */
 	for (ccp = Caches; ccp; ccp = ccp->cc_next)
@@ -440,8 +441,9 @@ CatalogCacheIdInvalidate(int cacheId,
 
 		if (cacheId != ccp->id)
 			continue;
+
 		/*
-		 *	inspect the hash bucket until we find a match or exhaust
+		 * inspect the hash bucket until we find a match or exhaust
 		 *
 		 */
 		for (elt = DLGetHead(&ccp->cc_cache[hashIndex]); elt; elt = nextelt)
@@ -491,7 +493,7 @@ CatalogCacheIdInvalidate(int cacheId,
 void
 AtEOXact_CatCache(bool isCommit)
 {
-	CatCache *cache;
+	CatCache   *cache;
 
 	for (cache = Caches; cache; cache = cache->cc_next)
 	{
@@ -530,7 +532,7 @@ AtEOXact_CatCache(bool isCommit)
 void
 ResetSystemCache(void)
 {
-	CatCache *cache;
+	CatCache   *cache;
 
 	CACHE1_elog(DEBUG, "ResetSystemCache called");
 
@@ -617,7 +619,7 @@ do { \
 #define InitCatCache_DEBUG1
 #endif
 
-CatCache *
+CatCache   *
 InitCatCache(int id,
 			 char *relname,
 			 char *indname,
@@ -629,8 +631,8 @@ InitCatCache(int id,
 	int			i;
 
 	/*
-	 *	first switch to the cache context so our allocations
-	 *	do not vanish at the end of a transaction
+	 * first switch to the cache context so our allocations do not vanish
+	 * at the end of a transaction
 	 *
 	 */
 	if (!CacheMemoryContext)
@@ -639,15 +641,15 @@ InitCatCache(int id,
 	oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
 
 	/*
-	 *	allocate a new cache structure
+	 * allocate a new cache structure
 	 *
 	 */
 	cp = (CatCache *) palloc(sizeof(CatCache));
 	MemSet((char *) cp, 0, sizeof(CatCache));
 
 	/*
-	 *	initialize the cache buckets (each bucket is a list header)
-	 *	and the LRU tuple list
+	 * initialize the cache buckets (each bucket is a list header) and the
+	 * LRU tuple list
 	 *
 	 */
 	DLInitList(&cp->cc_lrulist);
@@ -655,17 +657,17 @@ InitCatCache(int id,
 		DLInitList(&cp->cc_cache[i]);
 
 	/*
-	 *	Caches is the pointer to the head of the list of all the
-	 *	system caches.	here we add the new cache to the top of the list.
+	 * Caches is the pointer to the head of the list of all the system
+	 * caches.	here we add the new cache to the top of the list.
 	 *
 	 */
 	cp->cc_next = Caches;		/* list of caches (single link) */
 	Caches = cp;
 
 	/*
-	 *	initialize the cache's relation information for the relation
-	 *	corresponding to this cache, and initialize some of the new
-	 *	cache's other internal fields.  But don't open the relation yet.
+	 * initialize the cache's relation information for the relation
+	 * corresponding to this cache, and initialize some of the new cache's
+	 * other internal fields.  But don't open the relation yet.
 	 *
 	 */
 	cp->cc_relname = relname;
@@ -679,14 +681,14 @@ InitCatCache(int id,
 		cp->cc_key[i] = key[i];
 
 	/*
-	 *	all done.  new cache is initialized.  print some debugging
-	 *	information, if appropriate.
+	 * all done.  new cache is initialized.  print some debugging
+	 * information, if appropriate.
 	 *
 	 */
 	InitCatCache_DEBUG1;
 
 	/*
-	 *	back to the old context before we return...
+	 * back to the old context before we return...
 	 *
 	 */
 	MemoryContextSwitchTo(oldcxt);
@@ -774,14 +776,14 @@ SearchCatCache(CatCache *cache,
 	MemoryContext oldcxt;
 
 	/*
-	 *	one-time startup overhead
+	 * one-time startup overhead
 	 *
 	 */
 	if (cache->cc_tupdesc == NULL)
 		CatalogCacheInitializeCache(cache);
 
 	/*
-	 *	initialize the search key information
+	 * initialize the search key information
 	 *
 	 */
 	memcpy(cur_skey, cache->cc_skey, sizeof(cur_skey));
@@ -791,13 +793,13 @@ SearchCatCache(CatCache *cache,
 	cur_skey[3].sk_argument = v4;
 
 	/*
-	 *	find the hash bucket in which to look for the tuple
+	 * find the hash bucket in which to look for the tuple
 	 *
 	 */
 	hash = CatalogCacheComputeHashIndex(cache, cur_skey);
 
 	/*
-	 *	scan the hash bucket until we find a match or exhaust our tuples
+	 * scan the hash bucket until we find a match or exhaust our tuples
 	 *
 	 */
 	for (elt = DLGetHead(&cache->cc_cache[hash]);
@@ -812,8 +814,8 @@ SearchCatCache(CatCache *cache,
 			continue;			/* ignore dead entries */
 
 		/*
-		 *	see if the cached tuple matches our key.
-		 *	(should we be worried about time ranges? -cim 10/2/90)
+		 * see if the cached tuple matches our key. (should we be worried
+		 * about time ranges? -cim 10/2/90)
 		 *
 		 */
 		HeapKeyTest(&ct->tuple,
@@ -821,16 +823,16 @@ SearchCatCache(CatCache *cache,
 					cache->cc_nkeys,
 					cur_skey,
 					res);
-		if (! res)
+		if (!res)
 			continue;
 
 		/*
-		 *	we found a tuple in the cache: bump its refcount, move it to
-		 *	the front of the LRU list, and return it.  We also move it
-		 *	to the front of the list for its hashbucket, in order to speed
-		 *	subsequent searches.  (The most frequently accessed elements
-		 *	in any hashbucket will tend to be near the front of the
-		 *	hashbucket's list.)
+		 * we found a tuple in the cache: bump its refcount, move it to
+		 * the front of the LRU list, and return it.  We also move it to
+		 * the front of the list for its hashbucket, in order to speed
+		 * subsequent searches.  (The most frequently accessed elements in
+		 * any hashbucket will tend to be near the front of the
+		 * hashbucket's list.)
 		 *
 		 */
 		ct->refcount++;
@@ -847,31 +849,30 @@ SearchCatCache(CatCache *cache,
 	}
 
 	/*
-	 *	Tuple was not found in cache, so we have to try and
-	 *	retrieve it directly from the relation.  If it's found,
-	 *	we add it to the cache.
+	 * Tuple was not found in cache, so we have to try and retrieve it
+	 * directly from the relation.	If it's found, we add it to the cache.
 	 *
-	 *	NOTE: it is possible for recursive cache lookups to occur while
-	 *	reading the relation --- for example, due to shared-cache-inval
-	 *	messages being processed during heap_open().  This is OK.  It's
-	 *	even possible for one of those lookups to find and enter the
-	 *	very same tuple we are trying to fetch here.  If that happens,
-	 *	we will enter a second copy of the tuple into the cache.  The
-	 *	first copy will never be referenced again, and will eventually
-	 *	age out of the cache, so there's no functional problem.  This case
-	 *	is rare enough that it's not worth expending extra cycles to detect.
+	 * NOTE: it is possible for recursive cache lookups to occur while
+	 * reading the relation --- for example, due to shared-cache-inval
+	 * messages being processed during heap_open().  This is OK.  It's
+	 * even possible for one of those lookups to find and enter the very
+	 * same tuple we are trying to fetch here.	If that happens, we will
+	 * enter a second copy of the tuple into the cache.  The first copy
+	 * will never be referenced again, and will eventually age out of the
+	 * cache, so there's no functional problem.  This case is rare enough
+	 * that it's not worth expending extra cycles to detect.
 	 *
 	 */
 
 	/*
-	 *	open the relation associated with the cache
+	 * open the relation associated with the cache
 	 *
 	 */
 	relation = heap_openr(cache->cc_relname, AccessShareLock);
 
 	/*
-	 *	Scan the relation to find the tuple.  If there's an index, and
-	 *	if it's safe to do so, use the index.  Else do a heap scan.
+	 * Scan the relation to find the tuple.  If there's an index, and if
+	 * it's safe to do so, use the index.  Else do a heap scan.
 	 *
 	 */
 	ct = NULL;
@@ -891,13 +892,13 @@ SearchCatCache(CatCache *cache,
 					cache->cc_relname);
 
 		/*
-		 * For an index scan, sk_attno has to be set to the index attribute
-		 * number(s), not the heap attribute numbers.  We assume that the
-		 * index corresponds exactly to the cache keys (or its first N
-		 * keys do, anyway).
+		 * For an index scan, sk_attno has to be set to the index
+		 * attribute number(s), not the heap attribute numbers.  We assume
+		 * that the index corresponds exactly to the cache keys (or its
+		 * first N keys do, anyway).
 		 */
 		for (i = 0; i < cache->cc_nkeys; ++i)
-			cur_skey[i].sk_attno = i+1;
+			cur_skey[i].sk_attno = i + 1;
 
 		idesc = index_openr(cache->cc_indname);
 		isd = index_beginscan(idesc, false, cache->cc_nkeys, cur_skey);
@@ -948,21 +949,21 @@ SearchCatCache(CatCache *cache,
 	}
 
 	/*
-	 *	close the relation
+	 * close the relation
 	 *
 	 */
 	heap_close(relation, AccessShareLock);
 
 	/*
-	 *	scan is complete.  if tup was found, we can add it to the cache.
+	 * scan is complete.  if tup was found, we can add it to the cache.
 	 *
 	 */
 	if (ct == NULL)
 		return NULL;
 
 	/*
-	 *	Finish initializing the CatCTup header, and add it to the
-	 *	linked lists.
+	 * Finish initializing the CatCTup header, and add it to the linked
+	 * lists.
 	 *
 	 */
 	CACHE1_elog(DEBUG, "SearchCatCache: found tuple");
@@ -977,8 +978,8 @@ SearchCatCache(CatCache *cache,
 	DLAddHead(&cache->cc_cache[hash], &ct->cache_elem);
 
 	/*
-	 *	If we've exceeded the desired size of this cache,
-	 *	try to throw away the least recently used entry.
+	 * If we've exceeded the desired size of this cache, try to throw away
+	 * the least recently used entry.
 	 *
 	 */
 	if (++cache->cc_ntup > cache->cc_maxtup)
@@ -1022,7 +1023,7 @@ SearchCatCache(CatCache *cache,
 void
 ReleaseCatCache(HeapTuple tuple)
 {
-	CatCTup	   *ct = (CatCTup *) (((char *) tuple) -
+	CatCTup    *ct = (CatCTup *) (((char *) tuple) -
 								  offsetof(CatCTup, tuple));
 
 	/* Safety checks to ensure we were handed a cache entry */
@@ -1038,9 +1039,9 @@ ReleaseCatCache(HeapTuple tuple)
 		)
 	{
 		/* We can find the associated cache using the dllist pointers */
-		Dllist *lru = DLGetListHdr(&ct->lrulist_elem);
-		CatCache *cache = (CatCache *) (((char *) lru) -
-										offsetof(CatCache, cc_lrulist));
+		Dllist	   *lru = DLGetListHdr(&ct->lrulist_elem);
+		CatCache   *cache = (CatCache *) (((char *) lru) -
+										  offsetof(CatCache, cc_lrulist));
 
 		CatCacheRemoveCTup(cache, ct);
 	}
@@ -1061,7 +1062,7 @@ ReleaseCatCache(HeapTuple tuple)
  *	the specified relation, find all catcaches it could be in, compute the
  *	correct hashindex for each such catcache, and call the specified function
  *	to record the cache id, hashindex, and tuple ItemPointer in inval.c's
- *	lists.  CatalogCacheIdInvalidate will be called later, if appropriate,
+ *	lists.	CatalogCacheIdInvalidate will be called later, if appropriate,
  *	using the recorded information.
  *
  *	Note that it is irrelevant whether the given tuple is actually loaded
@@ -1082,7 +1083,7 @@ PrepareToInvalidateCacheTuple(Relation relation,
 	CatCache   *ccp;
 
 	/*
-	 *	sanity checks
+	 * sanity checks
 	 *
 	 */
 	Assert(RelationIsValid(relation));
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 8c246a1a9fd05e08167ceb0f3a4c0f55ba3398cd..91bea5cfc71e26d53206ec5e752222b196f3c876 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.38 2001/01/24 19:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.39 2001/03/22 03:59:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,7 +45,10 @@ init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt)
 	if (nargs > FUNC_MAX_ARGS)
 		elog(ERROR, "init_fcache: too many arguments");
 
-	/* If function returns set, prepare a resultinfo node for communication */
+	/*
+	 * If function returns set, prepare a resultinfo node for
+	 * communication
+	 */
 	if (retval->func.fn_retset)
 	{
 		retval->fcinfo.resultinfo = (Node *) &(retval->rsinfo);
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 8d15188aaf012bbc9611e57193376175efe1f0dd..bb3c2822232dedd98e89d52e62d2d5e54f0c85d9 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -25,7 +25,7 @@
  *	so that they can flush obsolete entries from their caches.
  *
  *	We do not need to register EVERY tuple operation in this way, just those
- *	on tuples in relations that have associated catcaches.  Also, whenever
+ *	on tuples in relations that have associated catcaches.	Also, whenever
  *	we see an operation on a pg_class or pg_attribute tuple, we register
  *	a relcache flush operation for the relation described by that tuple.
  *
@@ -34,7 +34,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.41 2001/02/22 18:39:19 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.42 2001/03/22 03:59:57 momjian Exp $
  *
  * Note - this code is real crufty... badly needs a rewrite to improve
  * readability and portability.  (Shouldn't assume Oid == Index, for example)
@@ -136,8 +136,8 @@ static LocalInvalid RollbackStack = EmptyLocalInvalid;
 
 static InvalidationEntry InvalidationEntryAllocate(uint16 size);
 static void LocalInvalidInvalidate(LocalInvalid invalid,
-								   void (*function) (InvalidationMessage),
-								   bool freemember);
+					   void (*function) (InvalidationMessage),
+					   bool freemember);
 static LocalInvalid LocalInvalidRegister(LocalInvalid invalid,
 					 InvalidationEntry entry);
 static void DiscardInvalidStack(LocalInvalid *invalid);
@@ -269,14 +269,14 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 	InvalidationMessage message;
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 	CacheIdRegisterSpecifiedLocalInvalid_DEBUG1;
 
 	/*
-	 *	create a message describing the system catalog tuple
-	 *	we wish to invalidate.
+	 * create a message describing the system catalog tuple we wish to
+	 * invalidate.
 	 *
 	 */
 	message = (InvalidationMessage)
@@ -289,7 +289,7 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 	ItemPointerCopy(pointer, &message->any.catalog.pointerData);
 
 	/*
-	 *	Add message to linked list of unprocessed messages.
+	 * Add message to linked list of unprocessed messages.
 	 *
 	 */
 	invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
@@ -305,20 +305,22 @@ CacheIdRegisterLocalInvalid(int cacheId,
 							Index hashIndex,
 							ItemPointer pointer)
 {
+
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 	CacheIdRegisterLocalInvalid_DEBUG1;
 
 	/*
-	 *	Add message to InvalidForall linked list.
+	 * Add message to InvalidForall linked list.
 	 *
 	 */
 	InvalidForall = CacheIdRegisterSpecifiedLocalInvalid(InvalidForall,
 											cacheId, hashIndex, pointer);
+
 	/*
-	 *	Add message to InvalidLocal linked list.
+	 * Add message to InvalidLocal linked list.
 	 *
 	 */
 	InvalidLocal = CacheIdRegisterSpecifiedLocalInvalid(InvalidLocal,
@@ -336,13 +338,13 @@ CacheIdRegisterLocalRollback(int cacheId,
 {
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 	CacheIdRegisterLocalRollback_DEBUG1;
 
 	/*
-	 *	Add message to RollbackStack linked list.
+	 * Add message to RollbackStack linked list.
 	 *
 	 */
 	RollbackStack = CacheIdRegisterSpecifiedLocalInvalid(
@@ -360,7 +362,7 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 	InvalidationMessage message;
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -369,8 +371,8 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 #endif	 /* defined(INVALIDDEBUG) */
 
 	/*
-	 *	create a message describing the relation descriptor
-	 *	we wish to invalidate.
+	 * create a message describing the relation descriptor we wish to
+	 * invalidate.
 	 *
 	 */
 	message = (InvalidationMessage)
@@ -381,7 +383,7 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 	message->any.relation.objectId = objectId;
 
 	/*
-	 *	Add message to linked list of unprocessed messages.
+	 * Add message to linked list of unprocessed messages.
 	 *
 	 */
 	invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
@@ -395,8 +397,9 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
 static void
 RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
 {
+
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -405,13 +408,14 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
 #endif	 /* defined(INVALIDDEBUG) */
 
 	/*
-	 *	Add message to InvalidForall linked list.
+	 * Add message to InvalidForall linked list.
 	 *
 	 */
 	InvalidForall = RelationIdRegisterSpecifiedLocalInvalid(InvalidForall,
 												   relationId, objectId);
+
 	/*
-	 *	Add message to InvalidLocal linked list.
+	 * Add message to InvalidLocal linked list.
 	 *
 	 */
 	InvalidLocal = RelationIdRegisterSpecifiedLocalInvalid(InvalidLocal,
@@ -427,7 +431,7 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
 {
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -436,7 +440,7 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
 #endif	 /* defined(INVALIDDEBUG) */
 
 	/*
-	 *	Add message to RollbackStack linked list.
+	 * Add message to RollbackStack linked list.
 	 *
 	 */
 	RollbackStack = RelationIdRegisterSpecifiedLocalInvalid(
@@ -464,9 +468,10 @@ CacheIdInvalidate(Index cacheId,
 				  Index hashIndex,
 				  ItemPointer pointer)
 {
+
 	/*
-	 *	assume that if the item pointer is valid, then we are
-	 *	invalidating an item in the specified system catalog cache.
+	 * assume that if the item pointer is valid, then we are invalidating
+	 * an item in the specified system catalog cache.
 	 *
 	 */
 	if (ItemPointerIsValid(pointer))
@@ -478,8 +483,8 @@ CacheIdInvalidate(Index cacheId,
 	CacheIdInvalidate_DEBUG1;
 
 	/*
-	 *	if the cacheId is the oid of any of the following system relations,
-	 *	then assume we are invalidating a relation descriptor
+	 * if the cacheId is the oid of any of the following system relations,
+	 * then assume we are invalidating a relation descriptor
 	 *
 	 */
 	if (cacheId == RelOid_pg_class)
@@ -495,7 +500,7 @@ CacheIdInvalidate(Index cacheId,
 	}
 
 	/*
-	 *	Yow! the caller asked us to invalidate something else.
+	 * Yow! the caller asked us to invalidate something else.
 	 *
 	 */
 	elog(FATAL, "CacheIdInvalidate: cacheId=%d relation id?", cacheId);
@@ -630,13 +635,13 @@ PrepareToInvalidateRelationCache(Relation relation,
 	Oid			objectId;
 
 	/*
-	 *	get the relation object id
+	 * get the relation object id
 	 *
 	 */
 	relationId = RelationGetRelid(relation);
 
 	/*
-	 *	is it one of the ones we need to send an SI message for?
+	 * is it one of the ones we need to send an SI message for?
 	 *
 	 */
 	if (relationId == RelOid_pg_class)
@@ -647,7 +652,7 @@ PrepareToInvalidateRelationCache(Relation relation,
 		return;
 
 	/*
-	 *	register the relcache-invalidation action in the appropriate list
+	 * register the relcache-invalidation action in the appropriate list
 	 *
 	 */
 	Assert(PointerIsValid(function));
@@ -666,8 +671,9 @@ PrepareToInvalidateRelationCache(Relation relation,
 void
 DiscardInvalid(void)
 {
+
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -690,7 +696,7 @@ RegisterInvalid(bool send)
 	LocalInvalid invalid;
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -698,7 +704,7 @@ RegisterInvalid(bool send)
 #endif	 /* defined(INVALIDDEBUG) */
 
 	/*
-	 *	Process and free the current list of inval messages.
+	 * Process and free the current list of inval messages.
 	 *
 	 */
 
@@ -734,7 +740,7 @@ ImmediateLocalInvalidation(bool send)
 	LocalInvalid invalid;
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 #ifdef	INVALIDDEBUG
@@ -742,7 +748,7 @@ ImmediateLocalInvalidation(bool send)
 #endif	 /* defined(INVALIDDEBUG) */
 
 	/*
-	 *	Process and free the local list of inval messages.
+	 * Process and free the local list of inval messages.
 	 *
 	 */
 
@@ -792,8 +798,9 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
 							void (*RelationIdRegisterFunc) (Oid, Oid),
 							const char *funcname)
 {
+
 	/*
-	 *	sanity checks
+	 * sanity checks
 	 *
 	 */
 	Assert(RelationIsValid(relation));
@@ -803,16 +810,16 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
 		return;
 
 	/*
-	 *	We only need to worry about invalidation for tuples that are in
-	 *	system relations; user-relation tuples are never in catcaches
-	 *	and can't affect the relcache either.
+	 * We only need to worry about invalidation for tuples that are in
+	 * system relations; user-relation tuples are never in catcaches and
+	 * can't affect the relcache either.
 	 *
 	 */
 	if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
 		return;
 
 	/*
-	 *	debugging stuff
+	 * debugging stuff
 	 *
 	 */
 	PrepareForTupleInvalidation_DEBUG1;
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 4e04cfea7c4e51e964705adb1ae6d7b02c32dabf..4882094bee135d079154b97b95abba7ca1d3cc62 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.50 2001/01/24 19:43:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.51 2001/03/22 03:59:57 momjian Exp $
  *
  * NOTES
  *	  Eventually, the index information should go through here, too.
@@ -62,7 +62,7 @@ get_attname(Oid relid, AttrNumber attnum)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
-		char   *result;
+		char	   *result;
 
 		result = pstrdup(NameStr(att_tup->attname));
 		ReleaseSysCache(tp);
@@ -118,7 +118,7 @@ get_atttype(Oid relid, AttrNumber attnum)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
-		Oid		result;
+		Oid			result;
 
 		result = att_tup->atttypid;
 		ReleaseSysCache(tp);
@@ -144,7 +144,7 @@ get_attisset(Oid relid, char *attname)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
-		bool	result;
+		bool		result;
 
 		result = att_tup->attisset;
 		ReleaseSysCache(tp);
@@ -172,7 +172,7 @@ get_atttypmod(Oid relid, AttrNumber attnum)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
-		int32	result;
+		int32		result;
 
 		result = att_tup->atttypmod;
 		ReleaseSysCache(tp);
@@ -306,7 +306,7 @@ get_opcode(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		RegProcedure	result;
+		RegProcedure result;
 
 		result = optup->oprcode;
 		ReleaseSysCache(tp);
@@ -333,7 +333,7 @@ get_opname(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		char   *result;
+		char	   *result;
 
 		result = pstrdup(NameStr(optup->oprname));
 		ReleaseSysCache(tp);
@@ -412,7 +412,7 @@ op_hashjoinable(Oid opno, Oid ltype, Oid rtype)
 bool
 op_iscachable(Oid opno)
 {
-	RegProcedure	funcid = get_opcode(opno);
+	RegProcedure funcid = get_opcode(opno);
 
 	if (funcid == (RegProcedure) InvalidOid)
 		elog(ERROR, "Operator OID %u does not exist", opno);
@@ -436,7 +436,7 @@ get_commutator(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		Oid		result;
+		Oid			result;
 
 		result = optup->oprcom;
 		ReleaseSysCache(tp);
@@ -462,7 +462,7 @@ get_negator(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		Oid		result;
+		Oid			result;
 
 		result = optup->oprnegate;
 		ReleaseSysCache(tp);
@@ -488,7 +488,7 @@ get_oprrest(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		RegProcedure	result;
+		RegProcedure result;
 
 		result = optup->oprrest;
 		ReleaseSysCache(tp);
@@ -514,7 +514,7 @@ get_oprjoin(Oid opno)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-		RegProcedure	result;
+		RegProcedure result;
 
 		result = optup->oprjoin;
 		ReleaseSysCache(tp);
@@ -587,7 +587,7 @@ get_relnatts(Oid relid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
-		int		result;
+		int			result;
 
 		result = reltup->relnatts;
 		ReleaseSysCache(tp);
@@ -596,6 +596,7 @@ get_relnatts(Oid relid)
 	else
 		return InvalidAttrNumber;
 }
+
 #endif
 
 /*
@@ -616,7 +617,7 @@ get_rel_name(Oid relid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
-		char   *result;
+		char	   *result;
 
 		result = pstrdup(NameStr(reltup->relname));
 		ReleaseSysCache(tp);
@@ -644,7 +645,7 @@ get_typlen(Oid typid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
-		int16	result;
+		int16		result;
 
 		result = typtup->typlen;
 		ReleaseSysCache(tp);
@@ -671,7 +672,7 @@ get_typbyval(Oid typid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
-		bool	result;
+		bool		result;
 
 		result = typtup->typbyval;
 		ReleaseSysCache(tp);
@@ -687,7 +688,7 @@ get_typbyval(Oid typid)
  *		A two-fer: given the type OID, return both typlen and typbyval.
  *
  *		Since both pieces of info are needed to know how to copy a Datum,
- *		many places need both.  Might as well get them with one cache lookup
+ *		many places need both.	Might as well get them with one cache lookup
  *		instead of two.  Also, this routine raises an error instead of
  *		returning a bogus value when given a bad type OID.
  */
@@ -720,7 +721,7 @@ get_typalign(Oid typid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
-		char	result;
+		char		result;
 
 		result = typtup->typalign;
 		ReleaseSysCache(tp);
@@ -743,7 +744,7 @@ get_typstorage(Oid typid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
-		char	result;
+		char		result;
 
 		result = typtup->typstorage;
 		ReleaseSysCache(tp);
@@ -864,7 +865,7 @@ get_typtype(Oid typid)
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
-		char	result;
+		char		result;
 
 		result = typtup->typtype;
 		ReleaseSysCache(tp);
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index a2a539f5abff86fae23dc28fc9fa71b061b6b285..fc97f46910a14d8313cf6e7881af9537a6a20f24 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.128 2001/02/22 18:39:19 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.129 2001/03/22 03:59:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -135,7 +135,7 @@ typedef struct relidcacheent
 
 typedef struct relnodecacheent
 {
-	RelFileNode	relnode;
+	RelFileNode relnode;
 	Relation	reldesc;
 } RelNodeCacheEnt;
 
@@ -250,9 +250,11 @@ do { \
 /* non-export function prototypes */
 
 static void RelationClearRelation(Relation relation, bool rebuildIt);
+
 #ifdef	ENABLE_REINDEX_NAILED_RELATIONS
 static void RelationReloadClassinfo(Relation relation);
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+
+#endif	 /* ENABLE_REINDEX_NAILED_RELATIONS */
 static void RelationFlushRelation(Relation relation);
 static Relation RelationNameCacheGetRelation(const char *relationName);
 static void RelationCacheInvalidateWalker(Relation *relationPtr, Datum listp);
@@ -326,7 +328,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
 	ScanKeyData key;
 
 	/*
-	 *	form a scan key
+	 * form a scan key
 	 *
 	 */
 	switch (buildinfo.infotype)
@@ -351,7 +353,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
 	}
 
 	/*
-	 *	open pg_class and fetch a tuple
+	 * open pg_class and fetch a tuple
 	 *
 	 */
 	pg_class_desc = heap_openr(RelationRelationName, AccessShareLock);
@@ -359,18 +361,19 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
 	pg_class_tuple = heap_getnext(pg_class_scan, 0);
 
 	/*
-	 *	get set to return tuple
+	 * get set to return tuple
 	 *
 	 */
 	if (!HeapTupleIsValid(pg_class_tuple))
 		return_tuple = pg_class_tuple;
 	else
 	{
+
 		/*
-		 *	a satanic bug used to live here: pg_class_tuple used to be
-		 *	returned here without having the corresponding buffer pinned.
-		 *	so when the buffer gets replaced, all hell breaks loose.
-		 *	this bug is discovered and killed by wei on 9/27/91.
+		 * a satanic bug used to live here: pg_class_tuple used to be
+		 * returned here without having the corresponding buffer pinned.
+		 * so when the buffer gets replaced, all hell breaks loose. this
+		 * bug is discovered and killed by wei on 9/27/91.
 		 *
 		 */
 		return_tuple = heap_copytuple(pg_class_tuple);
@@ -390,9 +393,10 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
 	HeapTuple	return_tuple;
 
 	pg_class_desc = heap_openr(RelationRelationName, AccessShareLock);
+
 	/*
-	 * If the indexes of pg_class are deactivated
-	 * we have to call scan_pg_rel_seq() instead.
+	 * If the indexes of pg_class are deactivated we have to call
+	 * scan_pg_rel_seq() instead.
 	 */
 	if (!pg_class_desc->rd_rel->relhasindex)
 	{
@@ -404,12 +408,12 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
 	{
 		case INFO_RELID:
 			return_tuple = ClassOidIndexScan(pg_class_desc,
-											 ObjectIdGetDatum(buildinfo.i.info_id));
+								  ObjectIdGetDatum(buildinfo.i.info_id));
 			break;
 
 		case INFO_RELNAME:
 			return_tuple = ClassNameIndexScan(pg_class_desc,
-											  PointerGetDatum(buildinfo.i.info_name));
+								 PointerGetDatum(buildinfo.i.info_name));
 			break;
 
 		default:
@@ -445,14 +449,14 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
 	oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
 
 	/*
-	 *	allocate space for new relation descriptor, if needed
+	 * allocate space for new relation descriptor, if needed
 	 *
 	 */
 	if (relation == NULL)
 		relation = (Relation) palloc(sizeof(RelationData));
 
 	/*
-	 *	clear all fields of reldesc
+	 * clear all fields of reldesc
 	 *
 	 */
 	MemSet((char *) relation, 0, sizeof(RelationData));
@@ -461,14 +465,14 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
 	relation->rd_fd = -1;
 
 	/*
-	 *	Copy the relation tuple form
+	 * Copy the relation tuple form
 	 *
-	 *	We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
-	 *	relacl is NOT stored in the relcache --- there'd be little point
-	 *	in it, since we don't copy the tuple's nullvalues bitmap and hence
-	 *	wouldn't know if the value is valid ... bottom line is that relacl
-	 *	*cannot* be retrieved from the relcache.  Get it from the syscache
-	 *	if you need it.
+	 * We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
+	 * relacl is NOT stored in the relcache --- there'd be little point in
+	 * it, since we don't copy the tuple's nullvalues bitmap and hence
+	 * wouldn't know if the value is valid ... bottom line is that relacl
+	 * *cannot* be retrieved from the relcache.  Get it from the syscache
+	 * if you need it.
 	 *
 	 */
 	relationForm = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
@@ -538,7 +542,7 @@ SetConstrOfRelation(Relation relation,
 			constr->num_check = relation->rd_rel->relchecks;
 			constr->check = (ConstrCheck *)
 				MemoryContextAlloc(CacheMemoryContext,
-								   constr->num_check * sizeof(ConstrCheck));
+								constr->num_check * sizeof(ConstrCheck));
 			MemSet(constr->check, 0, constr->num_check * sizeof(ConstrCheck));
 			RelCheckFetch(relation);
 		}
@@ -571,7 +575,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 	constr->has_not_null = false;
 
 	/*
-	 *	form a scan key
+	 * form a scan key
 	 *
 	 */
 	ScanKeyEntryInitialize(&key, 0,
@@ -580,14 +584,14 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 						   ObjectIdGetDatum(RelationGetRelid(relation)));
 
 	/*
-	 *	open pg_attribute and begin a scan
+	 * open pg_attribute and begin a scan
 	 *
 	 */
 	pg_attribute_desc = heap_openr(AttributeRelationName, AccessShareLock);
 	pg_attribute_scan = heap_beginscan(pg_attribute_desc, 0, SnapshotNow, 1, &key);
 
 	/*
-	 *	add attribute data to relation->rd_att
+	 * add attribute data to relation->rd_att
 	 *
 	 */
 	need = relation->rd_rel->relnatts;
@@ -601,7 +605,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 		{
 			relation->rd_att->attrs[attp->attnum - 1] =
 				(Form_pg_attribute) MemoryContextAlloc(CacheMemoryContext,
-													   ATTRIBUTE_TUPLE_SIZE);
+												   ATTRIBUTE_TUPLE_SIZE);
 
 			memcpy((char *) (relation->rd_att->attrs[attp->attnum - 1]),
 				   (char *) attp,
@@ -621,7 +625,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 										   relation->rd_rel->relnatts *
 										   sizeof(AttrDefault));
 					MemSet(attrdef, 0,
-						   relation->rd_rel->relnatts * sizeof(AttrDefault));
+					   relation->rd_rel->relnatts * sizeof(AttrDefault));
 				}
 				attrdef[ndef].adnum = attp->attnum;
 				attrdef[ndef].adbin = NULL;
@@ -636,34 +640,32 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 			 need, (need == 1 ? "" : "s"), RelationGetRelid(relation));
 
 	/*
-	 *	end the scan and close the attribute relation
+	 * end the scan and close the attribute relation
 	 *
 	 */
 	heap_endscan(pg_attribute_scan);
 	heap_close(pg_attribute_desc, AccessShareLock);
 
 	/*
-	 *	The attcacheoff values we read from pg_attribute should all be -1
-	 *	("unknown").  Verify this if assert checking is on.  They will be
-	 *	computed when and if needed during tuple access.
+	 * The attcacheoff values we read from pg_attribute should all be -1
+	 * ("unknown").  Verify this if assert checking is on.	They will be
+	 * computed when and if needed during tuple access.
 	 *
 	 */
 #ifdef USE_ASSERT_CHECKING
 	{
-		int		i;
+		int			i;
 
 		for (i = 0; i < relation->rd_rel->relnatts; i++)
-		{
 			Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
-		}
 	}
 #endif
 
 	/*
-	 *	However, we can easily set the attcacheoff value for the first
-	 *	attribute: it must be zero.  This eliminates the need for special
-	 *	cases for attnum=1 that used to exist in fastgetattr() and
-	 *	index_getattr().
+	 * However, we can easily set the attcacheoff value for the first
+	 * attribute: it must be zero.	This eliminates the need for special
+	 * cases for attnum=1 that used to exist in fastgetattr() and
+	 * index_getattr().
 	 *
 	 */
 	relation->rd_att->attrs[0]->attcacheoff = 0;
@@ -693,18 +695,19 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
 	{
 #ifdef	_DROP_COLUMN_HACK__
 		bool		columnDropped = false;
+
 #endif	 /* _DROP_COLUMN_HACK__ */
 
 		atttup = AttributeRelidNumIndexScan(attrel,
-											ObjectIdGetDatum(RelationGetRelid(relation)),
+							ObjectIdGetDatum(RelationGetRelid(relation)),
 											Int32GetDatum(i));
 
 		if (!HeapTupleIsValid(atttup))
 		{
 #ifdef	_DROP_COLUMN_HACK__
 			atttup = AttributeRelidNumIndexScan(attrel,
-												ObjectIdGetDatum(RelationGetRelid(relation)),
-												Int32GetDatum(DROPPED_COLUMN_INDEX(i)));
+							ObjectIdGetDatum(RelationGetRelid(relation)),
+								 Int32GetDatum(DROPPED_COLUMN_INDEX(i)));
 			if (!HeapTupleIsValid(atttup))
 #endif	 /* _DROP_COLUMN_HACK__ */
 				elog(ERROR, "cannot find attribute %d of relation %s", i,
@@ -754,23 +757,21 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
 	heap_close(attrel, AccessShareLock);
 
 	/*
-	 *	The attcacheoff values we read from pg_attribute should all be -1
-	 *	("unknown").  Verify this if assert checking is on.  They will be
-	 *	computed when and if needed during tuple access.
+	 * The attcacheoff values we read from pg_attribute should all be -1
+	 * ("unknown").  Verify this if assert checking is on.	They will be
+	 * computed when and if needed during tuple access.
 	 *
 	 */
 #ifdef USE_ASSERT_CHECKING
 	for (i = 0; i < relation->rd_rel->relnatts; i++)
-	{
 		Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
-	}
 #endif
 
 	/*
-	 *	However, we can easily set the attcacheoff value for the first
-	 *	attribute: it must be zero.  This eliminates the need for special
-	 *	cases for attnum=1 that used to exist in fastgetattr() and
-	 *	index_getattr().
+	 * However, we can easily set the attcacheoff value for the first
+	 * attribute: it must be zero.	This eliminates the need for special
+	 * cases for attnum=1 that used to exist in fastgetattr() and
+	 * index_getattr().
 	 *
 	 */
 	relation->rd_att->attrs[0]->attcacheoff = 0;
@@ -790,7 +791,7 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
  * each relcache entry that has associated rules.  The context is used
  * just for rule info, not for any other subsidiary data of the relcache
  * entry, because that keeps the update logic in RelationClearRelation()
- * manageable.  The other subsidiary data structures are simple enough
+ * manageable.	The other subsidiary data structures are simple enough
  * to be easy to free explicitly, anyway.
  *
  */
@@ -815,14 +816,14 @@ RelationBuildRuleLock(Relation relation)
 	 */
 	rulescxt = AllocSetContextCreate(CacheMemoryContext,
 									 RelationGetRelationName(relation),
-									 0,	/* minsize */
-									 1024, /* initsize */
-									 1024);	/* maxsize */
+									 0, /* minsize */
+									 1024,		/* initsize */
+									 1024);		/* maxsize */
 	relation->rd_rulescxt = rulescxt;
 
 	/*
-	 *	form an array to hold the rewrite rules (the array is extended if
-	 *	necessary)
+	 * form an array to hold the rewrite rules (the array is extended if
+	 * necessary)
 	 *
 	 */
 	maxlocks = 4;
@@ -831,7 +832,7 @@ RelationBuildRuleLock(Relation relation)
 	numlocks = 0;
 
 	/*
-	 *	form a scan key
+	 * form a scan key
 	 *
 	 */
 	ScanKeyEntryInitialize(&key, 0,
@@ -840,7 +841,7 @@ RelationBuildRuleLock(Relation relation)
 						   ObjectIdGetDatum(RelationGetRelid(relation)));
 
 	/*
-	 *	open pg_rewrite and begin a scan
+	 * open pg_rewrite and begin a scan
 	 *
 	 */
 	pg_rewrite_desc = heap_openr(RewriteRelationName, AccessShareLock);
@@ -870,7 +871,7 @@ RelationBuildRuleLock(Relation relation)
 												  pg_rewrite_tupdesc,
 												  &isnull));
 		rule->isInstead = DatumGetBool(heap_getattr(pg_rewrite_tuple,
-													Anum_pg_rewrite_is_instead,
+											  Anum_pg_rewrite_is_instead,
 													pg_rewrite_tupdesc,
 													&isnull));
 
@@ -878,7 +879,7 @@ RelationBuildRuleLock(Relation relation)
 								  Anum_pg_rewrite_ev_action,
 								  pg_rewrite_tupdesc,
 								  &isnull);
-		Assert(! isnull);
+		Assert(!isnull);
 		ruleaction_str = DatumGetCString(DirectFunctionCall1(textout,
 															 ruleaction));
 		oldcxt = MemoryContextSwitchTo(rulescxt);
@@ -890,9 +891,9 @@ RelationBuildRuleLock(Relation relation)
 								   Anum_pg_rewrite_ev_qual,
 								   pg_rewrite_tupdesc,
 								   &isnull);
-		Assert(! isnull);
+		Assert(!isnull);
 		rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
-															  rule_evqual));
+														   rule_evqual));
 		oldcxt = MemoryContextSwitchTo(rulescxt);
 		rule->qual = (Node *) stringToNode(rule_evqual_str);
 		MemoryContextSwitchTo(oldcxt);
@@ -908,14 +909,14 @@ RelationBuildRuleLock(Relation relation)
 	}
 
 	/*
-	 *	end the scan and close the attribute relation
+	 * end the scan and close the attribute relation
 	 *
 	 */
 	heap_endscan(pg_rewrite_scan);
 	heap_close(pg_rewrite_desc, AccessShareLock);
 
 	/*
-	 *	form a RuleLock and insert into relation
+	 * form a RuleLock and insert into relation
 	 *
 	 */
 	rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock));
@@ -1022,58 +1023,58 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
 	MemoryContext oldcxt;
 
 	/*
-	 *	find the tuple in pg_class corresponding to the given relation id
+	 * find the tuple in pg_class corresponding to the given relation id
 	 *
 	 */
 	pg_class_tuple = ScanPgRelation(buildinfo);
 
 	/*
-	 *	if no such tuple exists, return NULL
+	 * if no such tuple exists, return NULL
 	 *
 	 */
 	if (!HeapTupleIsValid(pg_class_tuple))
 		return NULL;
 
 	/*
-	 *	get information from the pg_class_tuple
+	 * get information from the pg_class_tuple
 	 *
 	 */
 	relid = pg_class_tuple->t_data->t_oid;
 	relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
 
 	/*
-	 *	allocate storage for the relation descriptor,
-	 *	and copy pg_class_tuple to relation->rd_rel.
+	 * allocate storage for the relation descriptor, and copy
+	 * pg_class_tuple to relation->rd_rel.
 	 *
 	 */
 	relation = AllocateRelationDesc(oldrelation, relp);
 
 	/*
-	 *	now we can free the memory allocated for pg_class_tuple
+	 * now we can free the memory allocated for pg_class_tuple
 	 *
 	 */
 	heap_freetuple(pg_class_tuple);
 
 	/*
-	 *	initialize the relation's relation id (relation->rd_id)
+	 * initialize the relation's relation id (relation->rd_id)
 	 *
 	 */
 	RelationGetRelid(relation) = relid;
 
 	/*
-	 *	initialize relation->rd_refcnt
+	 * initialize relation->rd_refcnt
 	 *
 	 */
 	RelationSetReferenceCount(relation, 1);
 
 	/*
-	 *	 normal relations are not nailed into the cache
+	 * normal relations are not nailed into the cache
 	 *
 	 */
 	relation->rd_isnailed = false;
 
 	/*
-	 *	initialize the access method information (relation->rd_am)
+	 * initialize the access method information (relation->rd_am)
 	 *
 	 */
 	relam = relation->rd_rel->relam;
@@ -1082,13 +1083,13 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
 													  CacheMemoryContext);
 
 	/*
-	 *	initialize the tuple descriptor (relation->rd_att).
+	 * initialize the tuple descriptor (relation->rd_att).
 	 *
 	 */
 	RelationBuildTupleDesc(buildinfo, relation);
 
 	/*
-	 *	Fetch rules and triggers that affect this relation
+	 * Fetch rules and triggers that affect this relation
 	 *
 	 */
 	if (relation->rd_rel->relhasrules)
@@ -1105,14 +1106,14 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
 		relation->trigdesc = NULL;
 
 	/*
-	 *	initialize index strategy and support information for this relation
+	 * initialize index strategy and support information for this relation
 	 *
 	 */
 	if (OidIsValid(relam))
 		IndexedAccessMethodInitialize(relation);
 
 	/*
-	 *	initialize the relation lock manager information
+	 * initialize the relation lock manager information
 	 *
 	 */
 	RelationInitLockInfo(relation);		/* see lmgr.c */
@@ -1124,8 +1125,8 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
 	relation->rd_node.relNode = relation->rd_rel->relfilenode;
 
 	/*
-	 *	open the relation and assign the file descriptor returned
-	 *	by the storage manager code to rd_fd.
+	 * open the relation and assign the file descriptor returned by the
+	 * storage manager code to rd_fd.
 	 *
 	 */
 	if (relation->rd_rel->relkind != RELKIND_VIEW)
@@ -1134,8 +1135,8 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
 		relation->rd_fd = -1;
 
 	/*
-	 *	insert newly created relation into proper relcaches,
-	 *	restore memory context and return the new reldesc.
+	 * insert newly created relation into proper relcaches, restore memory
+	 * context and return the new reldesc.
 	 *
 	 */
 	oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -1203,36 +1204,36 @@ formrdesc(char *relationName,
 	int			i;
 
 	/*
-	 *	allocate new relation desc
+	 * allocate new relation desc
 	 *
 	 */
 	relation = (Relation) palloc(sizeof(RelationData));
 	MemSet((char *) relation, 0, sizeof(RelationData));
 
 	/*
-	 *	don't open the unix file yet..
+	 * don't open the unix file yet..
 	 *
 	 */
 	relation->rd_fd = -1;
 
 	/*
-	 *	initialize reference count
+	 * initialize reference count
 	 *
 	 */
 	RelationSetReferenceCount(relation, 1);
 
 	/*
-	 *	all entries built with this routine are nailed-in-cache
+	 * all entries built with this routine are nailed-in-cache
 	 *
 	 */
 	relation->rd_isnailed = true;
 
 	/*
-	 *	initialize relation tuple form
+	 * initialize relation tuple form
 	 *
-	 *	The data we insert here is pretty incomplete/bogus, but it'll
-	 *	serve to get us launched.  RelationCacheInitializePhase2() will
-	 *	read the real data from pg_class and replace what we've done here.
+	 * The data we insert here is pretty incomplete/bogus, but it'll serve to
+	 * get us launched.  RelationCacheInitializePhase2() will read the
+	 * real data from pg_class and replace what we've done here.
 	 *
 	 */
 	relation->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
@@ -1257,13 +1258,13 @@ formrdesc(char *relationName,
 	relation->rd_rel->relnatts = (int16) natts;
 
 	/*
-	 *	initialize attribute tuple form
+	 * initialize attribute tuple form
 	 *
 	 */
 	relation->rd_att = CreateTemplateTupleDesc(natts);
 
 	/*
-	 *	initialize tuple desc info
+	 * initialize tuple desc info
 	 *
 	 */
 	for (i = 0; i < natts; i++)
@@ -1275,13 +1276,13 @@ formrdesc(char *relationName,
 	}
 
 	/*
-	 *	initialize relation id
+	 * initialize relation id
 	 *
 	 */
 	RelationGetRelid(relation) = relation->rd_att->attrs[0]->attrelid;
 
 	/*
-	 *	initialize the relation's lock manager and RelFileNode information
+	 * initialize the relation's lock manager and RelFileNode information
 	 *
 	 */
 	RelationInitLockInfo(relation);		/* see lmgr.c */
@@ -1290,11 +1291,11 @@ formrdesc(char *relationName,
 		relation->rd_node.tblNode = InvalidOid;
 	else
 		relation->rd_node.tblNode = MyDatabaseId;
-	relation->rd_node.relNode = 
+	relation->rd_node.relNode =
 		relation->rd_rel->relfilenode = RelationGetRelid(relation);
 
 	/*
-	 *	initialize the rel-has-index flag, using hardwired knowledge
+	 * initialize the rel-has-index flag, using hardwired knowledge
 	 *
 	 */
 	relation->rd_rel->relhasindex = false;
@@ -1313,7 +1314,7 @@ formrdesc(char *relationName,
 	}
 
 	/*
-	 *	add new reldesc to relcache
+	 * add new reldesc to relcache
 	 *
 	 */
 	RelationCacheInsert(relation);
@@ -1336,7 +1337,7 @@ fixrdesc(char *relationName)
 	Relation	relation;
 
 	/*
-	 *	find the tuple in pg_class corresponding to the given relation name
+	 * find the tuple in pg_class corresponding to the given relation name
 	 *
 	 */
 	buildinfo.infotype = INFO_RELNAME;
@@ -1350,7 +1351,7 @@ fixrdesc(char *relationName)
 	relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
 
 	/*
-	 *	find the pre-made relcache entry (better be there!)
+	 * find the pre-made relcache entry (better be there!)
 	 *
 	 */
 	relation = RelationNameCacheGetRelation(relationName);
@@ -1359,8 +1360,8 @@ fixrdesc(char *relationName)
 			 relationName);
 
 	/*
-	 *	and copy pg_class_tuple to relation->rd_rel.
-	 *	(See notes in AllocateRelationDesc())
+	 * and copy pg_class_tuple to relation->rd_rel. (See notes in
+	 * AllocateRelationDesc())
 	 *
 	 */
 	Assert(relation->rd_rel != NULL);
@@ -1474,14 +1475,14 @@ RelationIdGetRelation(Oid relationId)
 	RelationBuildDescInfo buildinfo;
 
 	/*
-	 *	increment access statistics
+	 * increment access statistics
 	 *
 	 */
 	IncrHeapAccessStat(local_RelationIdGetRelation);
 	IncrHeapAccessStat(global_RelationIdGetRelation);
 
 	/*
-	 *	first try and get a reldesc from the cache
+	 * first try and get a reldesc from the cache
 	 *
 	 */
 	rd = RelationIdCacheGetRelation(relationId);
@@ -1489,8 +1490,8 @@ RelationIdGetRelation(Oid relationId)
 		return rd;
 
 	/*
-	 *	no reldesc in the cache, so have RelationBuildDesc()
-	 *	build one and add it.
+	 * no reldesc in the cache, so have RelationBuildDesc() build one and
+	 * add it.
 	 *
 	 */
 	buildinfo.infotype = INFO_RELID;
@@ -1514,15 +1515,15 @@ RelationNameGetRelation(const char *relationName)
 	RelationBuildDescInfo buildinfo;
 
 	/*
-	 *	increment access statistics
+	 * increment access statistics
 	 *
 	 */
 	IncrHeapAccessStat(local_RelationNameGetRelation);
 	IncrHeapAccessStat(global_RelationNameGetRelation);
 
 	/*
-	 *	if caller is looking for a temp relation, substitute its real name;
-	 *	we only index temp rels by their real names.
+	 * if caller is looking for a temp relation, substitute its real name;
+	 * we only index temp rels by their real names.
 	 *
 	 */
 	temprelname = get_temp_rel_by_username(relationName);
@@ -1530,7 +1531,7 @@ RelationNameGetRelation(const char *relationName)
 		relationName = temprelname;
 
 	/*
-	 *	first try and get a reldesc from the cache
+	 * first try and get a reldesc from the cache
 	 *
 	 */
 	rd = RelationNameCacheGetRelation(relationName);
@@ -1538,8 +1539,8 @@ RelationNameGetRelation(const char *relationName)
 		return rd;
 
 	/*
-	 *	no reldesc in the cache, so have RelationBuildDesc()
-	 *	build one and add it.
+	 * no reldesc in the cache, so have RelationBuildDesc() build one and
+	 * add it.
 	 *
 	 */
 	buildinfo.infotype = INFO_RELNAME;
@@ -1592,7 +1593,7 @@ RelationReloadClassinfo(Relation relation)
 {
 	RelationBuildDescInfo buildinfo;
 	HeapTuple	pg_class_tuple;
-	Form_pg_class	relp;
+	Form_pg_class relp;
 
 	if (!relation->rd_rel)
 		return;
@@ -1613,7 +1614,8 @@ RelationReloadClassinfo(Relation relation)
 
 	return;
 }
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+
+#endif	 /* ENABLE_REINDEX_NAILED_RELATIONS */
 
 /*
  * RelationClearRelation
@@ -1633,7 +1635,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
 	/*
 	 * Make sure smgr and lower levels close the relation's files, if they
 	 * weren't closed already.  If the relation is not getting deleted,
-	 * the next smgr access should reopen the files automatically.  This
+	 * the next smgr access should reopen the files automatically.	This
 	 * ensures that the low-level file access state is updated after, say,
 	 * a vacuum truncation.
 	 */
@@ -1648,7 +1650,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
 	{
 #ifdef	ENABLE_REINDEX_NAILED_RELATIONS
 		RelationReloadClassinfo(relation);
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+#endif	 /* ENABLE_REINDEX_NAILED_RELATIONS */
 		return;
 	}
 
@@ -1740,9 +1742,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
 			relation->rd_att = old_att;
 		}
 		else
-		{
 			FreeTupleDesc(old_att);
-		}
 		if (equalRuleLocks(old_rules, relation->rd_rules))
 		{
 			if (relation->rd_rulescxt)
@@ -1761,9 +1761,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
 			relation->trigdesc = old_trigdesc;
 		}
 		else
-		{
 			FreeTriggerDesc(old_trigdesc);
-		}
 		relation->rd_nblocks = old_nblocks;
 
 		/*
@@ -1787,6 +1785,7 @@ RelationFlushRelation(Relation relation)
 
 	if (relation->rd_myxactonly)
 	{
+
 		/*
 		 * Local rels should always be rebuilt, not flushed; the relcache
 		 * entry must live until RelationPurgeLocalRelation().
@@ -1912,7 +1911,7 @@ RelationFlushIndexes(Relation *r,
  *	 We do this in two phases: the first pass deletes deletable items, and
  *	 the second one rebuilds the rebuildable items.  This is essential for
  *	 safety, because HashTableWalk only copes with concurrent deletion of
- *	 the element it is currently visiting.  If a second SI overflow were to
+ *	 the element it is currently visiting.	If a second SI overflow were to
  *	 occur while we are walking the table, resulting in recursive entry to
  *	 this routine, we could crash because the inner invocation blows away
  *	 the entry next to be visited by the outer scan.  But this way is OK,
@@ -1923,8 +1922,8 @@ RelationFlushIndexes(Relation *r,
 void
 RelationCacheInvalidate(void)
 {
-	List   *rebuildList = NIL;
-	List   *l;
+	List	   *rebuildList = NIL;
+	List	   *l;
 
 	/* Phase 1 */
 	HashTableWalk(RelationNameCache,
@@ -1932,7 +1931,7 @@ RelationCacheInvalidate(void)
 				  PointerGetDatum(&rebuildList));
 
 	/* Phase 2: rebuild the items found to need rebuild in phase 1 */
-	foreach (l, rebuildList)
+	foreach(l, rebuildList)
 	{
 		Relation	relation = (Relation) lfirst(l);
 
@@ -1945,7 +1944,7 @@ static void
 RelationCacheInvalidateWalker(Relation *relationPtr, Datum listp)
 {
 	Relation	relation = *relationPtr;
-	List   **rebuildList = (List **) DatumGetPointer(listp);
+	List	  **rebuildList = (List **) DatumGetPointer(listp);
 
 	/* We can ignore xact-local relations, since they are never SI targets */
 	if (relation->rd_myxactonly)
@@ -2070,7 +2069,7 @@ RelationCacheInitialize(void)
 	HASHCTL		ctl;
 
 	/*
-	 *	switch to cache memory context
+	 * switch to cache memory context
 	 *
 	 */
 	if (!CacheMemoryContext)
@@ -2079,7 +2078,7 @@ RelationCacheInitialize(void)
 	oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
 
 	/*
-	 *	create global caches
+	 * create global caches
 	 *
 	 */
 	MemSet(&ctl, 0, (int) sizeof(ctl));
@@ -2095,14 +2094,14 @@ RelationCacheInitialize(void)
 	ctl.keysize = sizeof(RelFileNode);
 	ctl.hash = tag_hash;
 	RelationNodeCache = hash_create(INITRELCACHESIZE, &ctl,
-								  HASH_ELEM | HASH_FUNCTION);
+									HASH_ELEM | HASH_FUNCTION);
 
 	/*
-	 *	initialize the cache with pre-made relation descriptors
-	 *	for some of the more important system relations.  These
-	 *	relations should always be in the cache.
+	 * initialize the cache with pre-made relation descriptors for some of
+	 * the more important system relations.  These relations should always
+	 * be in the cache.
 	 *
-	 *	NB: see also the list in RelationCacheInitializePhase2().
+	 * NB: see also the list in RelationCacheInitializePhase2().
 	 *
 	 */
 	formrdesc(RelationRelationName, Natts_pg_class, Desc_pg_class);
@@ -2113,9 +2112,9 @@ RelationCacheInitialize(void)
 	formrdesc(LogRelationName, Natts_pg_log, Desc_pg_log);
 
 	/*
-	 * init_irels() used to be called here. It is changed to be called
-	 * in RelationCacheInitializePhase2() now so that transactional
-	 * control could guarantee the consistency.
+	 * init_irels() used to be called here. It is changed to be called in
+	 * RelationCacheInitializePhase2() now so that transactional control
+	 * could guarantee the consistency.
 	 */
 
 	MemoryContextSwitchTo(oldcxt);
@@ -2131,21 +2130,25 @@ RelationCacheInitialize(void)
 void
 RelationCacheInitializePhase2(void)
 {
+
 	/*
 	 * Get the real pg_class tuple for each nailed-in-cache relcache entry
 	 * that was made by RelationCacheInitialize(), and replace the phony
-	 * rd_rel entry made by formrdesc().  This is necessary so that we have,
-	 * for example, the correct toast-table info for tables that have such.
+	 * rd_rel entry made by formrdesc().  This is necessary so that we
+	 * have, for example, the correct toast-table info for tables that
+	 * have such.
 	 */
 	if (!IsBootstrapProcessingMode())
 	{
+
 		/*
 		 * Initialize critical system index relation descriptors, first.
 		 * They are to make building relation descriptors fast.
-		 * init_irels() used to be called in RelationCacheInitialize().
-		 * It is changed to be called here to be transaction safe.
+		 * init_irels() used to be called in RelationCacheInitialize(). It
+		 * is changed to be called here to be transaction safe.
 		 */
 		MemoryContext oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
+
 		init_irels();
 		MemoryContextSwitchTo(oldcxt);
 
@@ -2154,19 +2157,23 @@ RelationCacheInitializePhase2(void)
 		fixrdesc(AttributeRelationName);
 		fixrdesc(ProcedureRelationName);
 		fixrdesc(TypeRelationName);
-		/* We don't bother to update the entries for pg_variable or pg_log. */
+
+		/*
+		 * We don't bother to update the entries for pg_variable or
+		 * pg_log.
+		 */
 	}
 }
 
 /* used by XLogInitCache */
-void CreateDummyCaches(void);
-void DestroyDummyCaches(void);
+void		CreateDummyCaches(void);
+void		DestroyDummyCaches(void);
 
 void
 CreateDummyCaches(void)
 {
-	MemoryContext	oldcxt;
-	HASHCTL			ctl;
+	MemoryContext oldcxt;
+	HASHCTL		ctl;
 
 	if (!CacheMemoryContext)
 		CreateCacheMemoryContext();
@@ -2186,14 +2193,14 @@ CreateDummyCaches(void)
 	ctl.keysize = sizeof(RelFileNode);
 	ctl.hash = tag_hash;
 	RelationNodeCache = hash_create(INITRELCACHESIZE, &ctl,
-								  HASH_ELEM | HASH_FUNCTION);
+									HASH_ELEM | HASH_FUNCTION);
 	MemoryContextSwitchTo(oldcxt);
 }
 
 void
 DestroyDummyCaches(void)
 {
-	MemoryContext	oldcxt;
+	MemoryContext oldcxt;
 
 	if (!CacheMemoryContext)
 		return;
@@ -2293,8 +2300,8 @@ AttrDefaultFetch(Relation relation)
 					 RelationGetRelationName(relation));
 			else
 				attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
-								DatumGetCString(DirectFunctionCall1(textout,
-																	val)));
+							 DatumGetCString(DirectFunctionCall1(textout,
+																 val)));
 			break;
 		}
 		if (hasindex)
@@ -2399,8 +2406,8 @@ RelCheckFetch(Relation relation)
 			elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
 				 RelationGetRelationName(relation));
 		check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
-								DatumGetCString(DirectFunctionCall1(textout,
-																	val)));
+							 DatumGetCString(DirectFunctionCall1(textout,
+																 val)));
 		found++;
 		if (hasindex)
 			ReleaseBuffer(buffer);
@@ -2438,7 +2445,7 @@ RelCheckFetch(Relation relation)
  *
  * Since shared cache inval causes the relcache's copy of the list to go away,
  * we return a copy of the list palloc'd in the caller's context.  The caller
- * may freeList() the returned list after scanning it.  This is necessary
+ * may freeList() the returned list after scanning it.	This is necessary
  * since the caller will typically be doing syscache lookups on the relevant
  * indexes, and syscache lookup could cause SI messages to be processed!
  */
@@ -2468,7 +2475,7 @@ RelationGetIndexList(Relation relation)
 							   (bits16) 0x0,
 							   (AttrNumber) 1,
 							   (RegProcedure) F_OIDEQ,
-							   ObjectIdGetDatum(RelationGetRelid(relation)));
+						   ObjectIdGetDatum(RelationGetRelid(relation)));
 		sd = index_beginscan(irel, false, 1, &skey);
 	}
 	else
@@ -2477,18 +2484,18 @@ RelationGetIndexList(Relation relation)
 							   (bits16) 0x0,
 							   (AttrNumber) Anum_pg_index_indrelid,
 							   (RegProcedure) F_OIDEQ,
-							   ObjectIdGetDatum(RelationGetRelid(relation)));
+						   ObjectIdGetDatum(RelationGetRelid(relation)));
 		hscan = heap_beginscan(indrel, false, SnapshotNow, 1, &skey);
 	}
 
 	/*
-	 * We build the list we intend to return (in the caller's context) while
-	 * doing the scan.  After successfully completing the scan, we copy that
-	 * list into the relcache entry.  This avoids cache-context memory leakage
-	 * if we get some sort of error partway through.
+	 * We build the list we intend to return (in the caller's context)
+	 * while doing the scan.  After successfully completing the scan, we
+	 * copy that list into the relcache entry.	This avoids cache-context
+	 * memory leakage if we get some sort of error partway through.
 	 */
 	result = NIL;
-	
+
 	for (;;)
 	{
 		HeapTupleData tuple;
@@ -2806,6 +2813,7 @@ write_irels(void)
 	fd = PathNameOpenFile(tempfilename, O_WRONLY | O_CREAT | O_TRUNC | PG_BINARY, 0600);
 	if (fd < 0)
 	{
+
 		/*
 		 * We used to consider this a fatal error, but we might as well
 		 * continue with backend startup ...
@@ -2943,7 +2951,5 @@ write_irels(void)
 	 * previously-existing init file.
 	 */
 	if (rename(tempfilename, finalfilename) < 0)
-	{
 		elog(NOTICE, "Cannot rename init file %s to %s: %m\n\tContinuing anyway, but there's something wrong.", tempfilename, finalfilename);
-	}
 }
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 4a6a8c00bca5299a78fa3f6a6ec3e2cf0a6b697d..75ef3179202695a3fb7a5336b7bc4f3e24d3f3f5 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.59 2001/02/22 18:39:20 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.60 2001/03/22 03:59:57 momjian Exp $
  *
  * NOTES
  *	  These routines allow the parser/planner/executor to perform
@@ -60,7 +60,7 @@
 	In include/catalog/indexing.h, add a define for the number of indexes
 	on the relation, add define(s) for the index name(s), add an extern
 	array to hold the index names, and use DECLARE_UNIQUE_INDEX to define
-	the index.  Cache lookups return only one row, so the index should be
+	the index.	Cache lookups return only one row, so the index should be
 	unique in most cases.
 
 	In backend/catalog/indexing.c, initialize the relation array with
@@ -89,261 +89,262 @@ struct cachedesc
 
 static struct cachedesc cacheinfo[] = {
 	{AggregateRelationName,		/* AGGNAME */
-	 AggregateNameTypeIndex,
+		AggregateNameTypeIndex,
 		2,
 		{
 			Anum_pg_aggregate_aggname,
 			Anum_pg_aggregate_aggbasetype,
 			0,
 			0
-		}},
+	}},
 	{AccessMethodRelationName,	/* AMNAME */
-	 AmNameIndex,
+		AmNameIndex,
 		1,
 		{
 			Anum_pg_am_amname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{AccessMethodOperatorRelationName,	/* AMOPOPID */
-	 AccessMethodOpidIndex,
+		AccessMethodOpidIndex,
 		3,
 		{
 			Anum_pg_amop_amopclaid,
 			Anum_pg_amop_amopopr,
 			Anum_pg_amop_amopid,
 			0
-		}},
+	}},
 	{AccessMethodOperatorRelationName,	/* AMOPSTRATEGY */
-	 AccessMethodStrategyIndex,
+		AccessMethodStrategyIndex,
 		3,
 		{
 			Anum_pg_amop_amopid,
 			Anum_pg_amop_amopclaid,
 			Anum_pg_amop_amopstrategy,
 			0
-		}},
+	}},
 	{AttributeRelationName,		/* ATTNAME */
-	 AttributeRelidNameIndex,
+		AttributeRelidNameIndex,
 		2,
 		{
 			Anum_pg_attribute_attrelid,
 			Anum_pg_attribute_attname,
 			0,
 			0
-		}},
+	}},
 	{AttributeRelationName,		/* ATTNUM */
-	 AttributeRelidNumIndex,
+		AttributeRelidNumIndex,
 		2,
 		{
 			Anum_pg_attribute_attrelid,
 			Anum_pg_attribute_attnum,
 			0,
 			0
-		}},
+	}},
 	{OperatorClassRelationName, /* CLADEFTYPE */
-	 OpclassDeftypeIndex,
+		OpclassDeftypeIndex,
 		1,
 		{
 			Anum_pg_opclass_opcdeftype,
 			0,
 			0,
 			0
-		}},
+	}},
 	{OperatorClassRelationName, /* CLANAME */
-	 OpclassNameIndex,
+		OpclassNameIndex,
 		1,
 		{
 			Anum_pg_opclass_opcname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{GroupRelationName,			/* GRONAME */
-	 GroupNameIndex,
+		GroupNameIndex,
 		1,
 		{
 			Anum_pg_group_groname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{GroupRelationName,			/* GROSYSID */
-	 GroupSysidIndex,
+		GroupSysidIndex,
 		1,
 		{
 			Anum_pg_group_grosysid,
 			0,
 			0,
 			0
-		}},
+	}},
 	{IndexRelationName,			/* INDEXRELID */
-	 IndexRelidIndex,
+		IndexRelidIndex,
 		1,
 		{
 			Anum_pg_index_indexrelid,
 			0,
 			0,
 			0
-		}},
+	}},
 	{InheritsRelationName,		/* INHRELID */
-	 InheritsRelidSeqnoIndex,
+		InheritsRelidSeqnoIndex,
 		2,
 		{
 			Anum_pg_inherits_inhrelid,
 			Anum_pg_inherits_inhseqno,
 			0,
 			0
-		}},
+	}},
 	{LanguageRelationName,		/* LANGNAME */
-	 LanguageNameIndex,
+		LanguageNameIndex,
 		1,
 		{
 			Anum_pg_language_lanname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{LanguageRelationName,		/* LANGOID */
-	 LanguageOidIndex,
+		LanguageOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}},
+	}},
 	{ListenerRelationName,		/* LISTENREL */
-	 ListenerPidRelnameIndex,
+		ListenerPidRelnameIndex,
 		2,
 		{
 			Anum_pg_listener_pid,
 			Anum_pg_listener_relname,
 			0,
 			0
-		}},
+	}},
 	{OperatorRelationName,		/* OPERNAME */
-	 OperatorNameIndex,
+		OperatorNameIndex,
 		4,
 		{
 			Anum_pg_operator_oprname,
 			Anum_pg_operator_oprleft,
 			Anum_pg_operator_oprright,
 			Anum_pg_operator_oprkind
-		}},
+	}},
 	{OperatorRelationName,		/* OPEROID */
-	 OperatorOidIndex,
+		OperatorOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}},
+	}},
 	{ProcedureRelationName,		/* PROCNAME */
-	 ProcedureNameIndex,
+		ProcedureNameIndex,
 		3,
 		{
 			Anum_pg_proc_proname,
 			Anum_pg_proc_pronargs,
 			Anum_pg_proc_proargtypes,
 			0
-		}},
+	}},
 	{ProcedureRelationName,		/* PROCOID */
-	 ProcedureOidIndex,
+		ProcedureOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}},
+	}},
 	{RelationRelationName,		/* RELNAME */
-	 ClassNameIndex,
+		ClassNameIndex,
 		1,
 		{
 			Anum_pg_class_relname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{RelationRelationName,		/* RELOID */
-	 ClassOidIndex,
+		ClassOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}},
+	}},
 	{RewriteRelationName,		/* REWRITENAME */
-	 RewriteRulenameIndex,
+		RewriteRulenameIndex,
 		1,
 		{
 			Anum_pg_rewrite_rulename,
 			0,
 			0,
 			0
-		}},
+	}},
 	{RewriteRelationName,		/* RULEOID */
-	 RewriteOidIndex,
+		RewriteOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}},
+	}},
 	{ShadowRelationName,		/* SHADOWNAME */
-	 ShadowNameIndex,
+		ShadowNameIndex,
 		1,
 		{
 			Anum_pg_shadow_usename,
 			0,
 			0,
 			0
-		}},
+	}},
 	{ShadowRelationName,		/* SHADOWSYSID */
-	 ShadowSysidIndex,
+		ShadowSysidIndex,
 		1,
 		{
 			Anum_pg_shadow_usesysid,
 			0,
 			0,
 			0
-		}},
+	}},
 	{StatisticRelationName,		/* STATRELID */
-	 StatisticRelidAttnumIndex,
+		StatisticRelidAttnumIndex,
 		2,
 		{
 			Anum_pg_statistic_starelid,
 			Anum_pg_statistic_staattnum,
 			0,
 			0
-		}},
+	}},
 	{TypeRelationName,			/* TYPENAME */
-	 TypeNameIndex,
+		TypeNameIndex,
 		1,
 		{
 			Anum_pg_type_typname,
 			0,
 			0,
 			0
-		}},
+	}},
 	{TypeRelationName,			/* TYPEOID */
-	 TypeOidIndex,
+		TypeOidIndex,
 		1,
 		{
 			ObjectIdAttributeNumber,
 			0,
 			0,
 			0
-		}}
+	}}
 };
 
-static CatCache *SysCache[lengthof(cacheinfo)];
-static int SysCacheSize = lengthof(cacheinfo);
+static CatCache *SysCache[
+						  lengthof(cacheinfo)];
+static int	SysCacheSize = lengthof(cacheinfo);
 static bool CacheInitialized = false;
 
 
@@ -358,7 +359,7 @@ IsCacheInitialized(void)
  * InitCatalogCache - initialize the caches
  *
  * Note that no database access is done here; we only allocate memory
- * and initialize the cache structure.  Interrogation of the database
+ * and initialize the cache structure.	Interrogation of the database
  * to complete initialization of a cache happens only upon first use
  * of that cache.
  */
@@ -419,8 +420,8 @@ SearchSysCache(int cacheId,
 
 	/*
 	 * If someone tries to look up a relname, translate temp relation
-	 * names to real names.  Less obviously, apply the same translation
-	 * to type names, so that the type tuple of a temp table will be found
+	 * names to real names.  Less obviously, apply the same translation to
+	 * type names, so that the type tuple of a temp table will be found
 	 * when sought.  This is a kluge ... temp table substitution should be
 	 * happening at a higher level ...
 	 */
@@ -522,8 +523,8 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
 	/*
 	 * We just need to get the TupleDesc out of the cache entry, and then
 	 * we can apply heap_getattr().  We expect that the cache control data
-	 * is currently valid --- if the caller recently fetched the tuple, then
-	 * it should be.
+	 * is currently valid --- if the caller recently fetched the tuple,
+	 * then it should be.
 	 */
 	if (cacheId < 0 || cacheId >= SysCacheSize)
 		elog(ERROR, "SysCacheGetAttr: Bad cache id %d", cacheId);
diff --git a/src/backend/utils/cache/temprel.c b/src/backend/utils/cache/temprel.c
index b4ca06bbce63eca012548737a1dba97ec826b171..88dc606cb0e81edfe553b3eb6075077a256107c4 100644
--- a/src/backend/utils/cache/temprel.c
+++ b/src/backend/utils/cache/temprel.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.34 2001/01/24 19:43:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.35 2001/03/22 03:59:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
  *
  * When a temp table is created, normal entries are made for it in pg_class,
  * pg_type, etc using a unique "physical" relation name.  We also make an
- * entry in the temp table list maintained by this module.  Subsequently,
+ * entry in the temp table list maintained by this module.	Subsequently,
  * relname lookups are filtered through the temp table list, and attempts
  * to look up a temp table name are changed to look up the physical name.
  * This allows temp table names to mask a regular table of the same name
@@ -50,12 +50,13 @@ typedef struct TempTable
 	NameData	relname;		/* underlying unique name */
 	Oid			relid;			/* needed properties of rel */
 	char		relkind;
+
 	/*
-	 * If this entry was created during this xact, it should be deleted
-	 * at xact abort.  Conversely, if this entry was deleted during this
-	 * xact, it should be removed at xact commit.  We leave deleted entries
-	 * in the list until commit so that we can roll back if needed ---
-	 * but we ignore them for purposes of lookup!
+	 * If this entry was created during this xact, it should be deleted at
+	 * xact abort.	Conversely, if this entry was deleted during this
+	 * xact, it should be removed at xact commit.  We leave deleted
+	 * entries in the list until commit so that we can roll back if needed
+	 * --- but we ignore them for purposes of lookup!
 	 */
 	bool		created_in_cur_xact;
 	bool		deleted_in_cur_xact;
@@ -110,7 +111,11 @@ remove_temp_rel_by_relid(Oid relid)
 
 		if (temp_rel->relid == relid)
 			temp_rel->deleted_in_cur_xact = true;
-		/* Keep scanning 'cause there could be multiple matches; see RENAME */
+
+		/*
+		 * Keep scanning 'cause there could be multiple matches; see
+		 * RENAME
+		 */
 	}
 }
 
@@ -161,10 +166,10 @@ rename_temp_relation(const char *oldname,
 		 * xact.  One of these entries will be deleted at xact end.
 		 *
 		 * NOTE: the new mapping entry is inserted into the list just after
-		 * the old one.  We could alternatively insert it before the old one,
-		 * but that'd take more code.  It does need to be in one spot or the
-		 * other, to ensure that deletion of temp rels happens in the right
-		 * order during remove_all_temp_relations().
+		 * the old one.  We could alternatively insert it before the old
+		 * one, but that'd take more code.  It does need to be in one spot
+		 * or the other, to ensure that deletion of temp rels happens in
+		 * the right order during remove_all_temp_relations().
 		 */
 		oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
 
@@ -208,11 +213,11 @@ remove_all_temp_relations(void)
 	StartTransactionCommand();
 
 	/*
-	 * Scan the list and delete all entries not already deleted.
-	 * We need not worry about list entries getting deleted from under us,
-	 * because remove_temp_rel_by_relid() doesn't remove entries, only
-	 * mark them dead.  Note that entries will be deleted in reverse order
-	 * of creation --- that's critical for cases involving inheritance.
+	 * Scan the list and delete all entries not already deleted. We need
+	 * not worry about list entries getting deleted from under us, because
+	 * remove_temp_rel_by_relid() doesn't remove entries, only mark them
+	 * dead.  Note that entries will be deleted in reverse order of
+	 * creation --- that's critical for cases involving inheritance.
 	 */
 	foreach(l, temp_rels)
 	{
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index a8b6215930e2aa0bca11d9384743760d16a0641a..55c7e69c67bd05b914341a2fee515e46f29fe9e7 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.82 2001/03/10 04:21:51 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.83 2001/03/22 03:59:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,24 +52,24 @@ extern CommandDest whereToSendOutput;
  * 2 = syslog only
  * ... in theory anyway
  */
-int Use_syslog = 0;
-char *Syslog_facility;
-char *Syslog_ident;
+int			Use_syslog = 0;
+char	   *Syslog_facility;
+char	   *Syslog_ident;
 
 static void write_syslog(int level, const char *line);
 
 #else
-# define Use_syslog 0
+#define Use_syslog 0
 #endif
 
-bool Log_timestamp;
-bool Log_pid;
+bool		Log_timestamp;
+bool		Log_pid;
 
 #define TIMESTAMP_SIZE 20		/* format `YYYY-MM-DD HH:MM:SS ' */
 #define PID_SIZE 9				/* format `[123456] ' */
 
-static const char * print_timestamp(void);
-static const char * print_pid(void);
+static const char *print_timestamp(void);
+static const char *print_pid(void);
 
 static int	Debugfile = -1;
 static int	ElogDebugIndentLevel = 0;
@@ -93,9 +93,10 @@ static int	ElogDebugIndentLevel = 0;
  *--------------------
  */
 void
-elog(int lev, const char *fmt, ...)
+elog(int lev, const char *fmt,...)
 {
 	va_list		ap;
+
 	/*
 	 * The expanded format and final output message are dynamically
 	 * allocated if necessary, but not if they fit in the "reasonable
@@ -108,17 +109,19 @@ elog(int lev, const char *fmt, ...)
 	 * Note that we use malloc() not palloc() because we want to retain
 	 * control if we run out of memory.  palloc() would recursively call
 	 * elog(ERROR), which would be all right except if we are working on a
-	 * FATAL or REALLYFATAL error.  We'd lose track of the fatal condition
+	 * FATAL or REALLYFATAL error.	We'd lose track of the fatal condition
 	 * and report a mere ERROR to outer loop, which would be a Bad Thing.
-	 * So, we substitute an appropriate message in-place, without downgrading
-	 * the level if it's above ERROR.
+	 * So, we substitute an appropriate message in-place, without
+	 * downgrading the level if it's above ERROR.
 	 */
 	char		fmt_fixedbuf[128];
 	char		msg_fixedbuf[256];
 	char	   *fmt_buf = fmt_fixedbuf;
 	char	   *msg_buf = msg_fixedbuf;
+
 	/* this buffer is only used for strange values of lev: */
 	char		prefix_buf[32];
+
 	/* this buffer is only used if errno has a bogus value: */
 	char		errorstr_buf[32];
 	const char *errorstr;
@@ -128,6 +131,7 @@ elog(int lev, const char *fmt, ...)
 	int			indent = 0;
 	int			space_needed;
 	int			len;
+
 	/* size of the prefix needed for timestamp and pid, if enabled */
 	size_t		timestamp_size;
 
@@ -136,6 +140,7 @@ elog(int lev, const char *fmt, ...)
 
 	/* Save error str before calling any function that might change errno */
 	errorstr = strerror(errno);
+
 	/*
 	 * Some strerror()s return an empty string for out-of-range errno.
 	 * This is ANSI C spec compliant, but not exactly useful.
@@ -148,16 +153,18 @@ elog(int lev, const char *fmt, ...)
 
 	if (lev == ERROR || lev == FATAL)
 	{
+
 		/*
-		 * Convert initialization errors into fatal errors.
-		 * This is probably redundant, because Warn_restart_ready won't
-		 * be set anyway...
+		 * Convert initialization errors into fatal errors. This is
+		 * probably redundant, because Warn_restart_ready won't be set
+		 * anyway...
 		 */
 		if (IsInitProcessingMode())
 			lev = FATAL;
+
 		/*
-		 * If we are inside a critical section, all errors become STOP errors.
-		 * See miscadmin.h.
+		 * If we are inside a critical section, all errors become STOP
+		 * errors. See miscadmin.h.
 		 */
 		if (CritSectionCount > 0)
 			lev = STOP;
@@ -334,7 +341,7 @@ elog(int lev, const char *fmt, ...)
 	/* Write to syslog, if enabled */
 	if (Use_syslog >= 1)
 	{
-		int syslog_level;
+		int			syslog_level;
 
 		switch (lev)
 		{
@@ -360,7 +367,7 @@ elog(int lev, const char *fmt, ...)
 
 		write_syslog(syslog_level, msg_buf + timestamp_size);
 	}
-#endif /* ENABLE_SYSLOG */
+#endif	 /* ENABLE_SYSLOG */
 
 	/* syslog doesn't want a trailing newline, but other destinations do */
 	strcat(msg_buf, "\n");
@@ -379,10 +386,10 @@ elog(int lev, const char *fmt, ...)
 		char		msgtype;
 
 		/*
-		 * Since backend libpq may call palloc(), switch to a context where
-		 * there's fairly likely to be some free space.  After all the
-		 * pushups above, we don't want to drop the ball by running out of
-		 * space now...
+		 * Since backend libpq may call palloc(), switch to a context
+		 * where there's fairly likely to be some free space.  After all
+		 * the pushups above, we don't want to drop the ball by running
+		 * out of space now...
 		 */
 		oldcxt = MemoryContextSwitchTo(ErrorContext);
 
@@ -452,17 +459,19 @@ elog(int lev, const char *fmt, ...)
 		 * responsibility to see that this doesn't turn into infinite
 		 * recursion!)	But in the latter case, we exit with nonzero exit
 		 * code to indicate that something's pretty wrong.  We also want
-		 * to exit with nonzero exit code if not running under the postmaster
-		 * (for example, if we are being run from the initdb script, we'd
-		 * better return an error status).
+		 * to exit with nonzero exit code if not running under the
+		 * postmaster (for example, if we are being run from the initdb
+		 * script, we'd better return an error status).
 		 */
 		if (lev == FATAL || !Warn_restart_ready || proc_exit_inprogress)
 		{
+
 			/*
 			 * fflush here is just to improve the odds that we get to see
-			 * the error message, in case things are so hosed that proc_exit
-			 * crashes.  Any other code you might be tempted to add here
-			 * should probably be in an on_proc_exit callback instead.
+			 * the error message, in case things are so hosed that
+			 * proc_exit crashes.  Any other code you might be tempted to
+			 * add here should probably be in an on_proc_exit callback
+			 * instead.
 			 */
 			fflush(stdout);
 			fflush(stderr);
@@ -484,6 +493,7 @@ elog(int lev, const char *fmt, ...)
 
 	if (lev > FATAL)
 	{
+
 		/*
 		 * Serious crash time. Postmaster will observe nonzero process
 		 * exit status and kill the other backends too.
@@ -511,6 +521,7 @@ DebugFileOpen(void)
 
 	if (OutputFileName[0])
 	{
+
 		/*
 		 * A debug-output file name was given.
 		 *
@@ -530,6 +541,7 @@ DebugFileOpen(void)
 			elog(FATAL, "DebugFileOpen: %s reopen as stderr: %m",
 				 OutputFileName);
 		Debugfile = fileno(stderr);
+
 		/*
 		 * If the file is a tty and we're running under the postmaster,
 		 * try to send stdout there as well (if it isn't a tty then stderr
@@ -565,12 +577,12 @@ DebugFileOpen(void)
 /*
  * Return a timestamp string like
  *
- *   "2000-06-04 13:12:03 "
+ *	 "2000-06-04 13:12:03 "
  */
 static const char *
 print_timestamp(void)
 {
-	time_t curtime;
+	time_t		curtime;
 	static char buf[TIMESTAMP_SIZE + 1];
 
 	curtime = time(NULL);
@@ -587,7 +599,7 @@ print_timestamp(void)
 /*
  * Return a string like
  *
- *     "[123456] "
+ *	   "[123456] "
  *
  * with the current pid.
  */
@@ -596,7 +608,7 @@ print_pid(void)
 {
 	static char buf[PID_SIZE + 1];
 
-	snprintf(buf, PID_SIZE + 1, "[%d]      ", (int)MyProcPid);
+	snprintf(buf, PID_SIZE + 1, "[%d]      ", (int) MyProcPid);
 	return buf;
 }
 
@@ -605,7 +617,7 @@ print_pid(void)
 #ifdef ENABLE_SYSLOG
 
 #ifndef PG_SYSLOG_LIMIT
-# define PG_SYSLOG_LIMIT 128
+#define PG_SYSLOG_LIMIT 128
 #endif
 
 /*
@@ -619,32 +631,32 @@ print_pid(void)
 static void
 write_syslog(int level, const char *line)
 {
-	static bool	openlog_done = false;
+	static bool openlog_done = false;
 	static unsigned long seq = 0;
 	static int	syslog_fac = LOG_LOCAL0;
 
-	int len = strlen(line);
+	int			len = strlen(line);
 
 	if (Use_syslog == 0)
 		return;
 
 	if (!openlog_done)
 	{
-		if (strcasecmp(Syslog_facility,"LOCAL0") == 0) 
+		if (strcasecmp(Syslog_facility, "LOCAL0") == 0)
 			syslog_fac = LOG_LOCAL0;
-		if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL1") == 0)
 			syslog_fac = LOG_LOCAL1;
-		if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL2") == 0)
 			syslog_fac = LOG_LOCAL2;
-		if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL3") == 0)
 			syslog_fac = LOG_LOCAL3;
-		if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL4") == 0)
 			syslog_fac = LOG_LOCAL4;
-		if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL5") == 0)
 			syslog_fac = LOG_LOCAL5;
-		if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL6") == 0)
 			syslog_fac = LOG_LOCAL6;
-		if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
+		if (strcasecmp(Syslog_facility, "LOCAL7") == 0)
 			syslog_fac = LOG_LOCAL7;
 		openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
 		openlog_done = true;
@@ -658,16 +670,16 @@ write_syslog(int level, const char *line)
 
 	/* divide into multiple syslog() calls if message is too long */
 	/* or if the message contains embedded NewLine(s) '\n' */
-	if (len > PG_SYSLOG_LIMIT || strchr(line,'\n') != NULL )
+	if (len > PG_SYSLOG_LIMIT || strchr(line, '\n') != NULL)
 	{
-		int		chunk_nr = 0;
+		int			chunk_nr = 0;
 
 		while (len > 0)
 		{
-			char	buf[PG_SYSLOG_LIMIT+1];
-			int		buflen;
-			int		l;
-			int		i;
+			char		buf[PG_SYSLOG_LIMIT + 1];
+			int			buflen;
+			int			l;
+			int			i;
 
 			/* if we start at a newline, move ahead one char */
 			if (line[0] == '\n')
@@ -679,15 +691,15 @@ write_syslog(int level, const char *line)
 
 			strncpy(buf, line, PG_SYSLOG_LIMIT);
 			buf[PG_SYSLOG_LIMIT] = '\0';
-			if (strchr(buf,'\n') != NULL) 
-				*strchr(buf,'\n') = '\0';
+			if (strchr(buf, '\n') != NULL)
+				*strchr(buf, '\n') = '\0';
 
 			l = strlen(buf);
 #ifdef MULTIBYTE
-			/* trim to multibyte letter boundary */ 
+			/* trim to multibyte letter boundary */
 			buflen = pg_mbcliplen(buf, l, l);
 			if (buflen <= 0)
-			    return;
+				return;
 			buf[buflen] = '\0';
 			l = strlen(buf);
 #endif
@@ -701,7 +713,7 @@ write_syslog(int level, const char *line)
 				while (i > 0 && !isspace((unsigned char) buf[i]))
 					i--;
 
-				if (i <= 0)	/* couldn't divide word boundary */
+				if (i <= 0)		/* couldn't divide word boundary */
 					buflen = l;
 				else
 				{
@@ -724,4 +736,4 @@ write_syslog(int level, const char *line)
 	}
 }
 
-#endif /* ENABLE_SYSLOG */
+#endif	 /* ENABLE_SYSLOG */
diff --git a/src/backend/utils/error/exc.c b/src/backend/utils/error/exc.c
index f25e01254f5c683acf74a0c40a32d67c47cb8f51..ee64ecb5f0a3164b6561af4ab959155ed920662d 100644
--- a/src/backend/utils/error/exc.c
+++ b/src/backend/utils/error/exc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.36 2001/01/24 19:43:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.37 2001/03/22 03:59:58 momjian Exp $
  *
  * NOTE
  *	  XXX this code needs improvement--check for state violations and
@@ -112,6 +112,7 @@ ExcPrint(Exception *excP,
 
 	/* Save error str before calling any function that might change errno */
 	errorstr = strerror(errno);
+
 	/*
 	 * Some strerror()s return an empty string for out-of-range errno.
 	 * This is ANSI C spec compliant, but not exactly useful.
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index c2d25325c7da34242a47b25b78f1ce070e92dd35..49be6b37903bd2619b3847059b1e18e7f6a6b142 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.47 2001/01/24 19:43:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.48 2001/03/22 03:59:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -32,7 +32,9 @@ typedef struct df_files
 	ino_t		inode;			/* Inode number of file */
 	void	   *handle;			/* a handle for pg_dl* functions */
 	char		filename[1];	/* Full pathname of file */
-	/* we allocate the block big enough for actual length of pathname.
+
+	/*
+	 * we allocate the block big enough for actual length of pathname.
 	 * filename[] must be last item in struct!
 	 */
 } DynamicFileList;
@@ -48,7 +50,7 @@ static DynamicFileList *file_tail = (DynamicFileList *) NULL;
  * named funcname in it.  If the function is not found, we raise an error
  * if signalNotFound is true, else return (PGFunction) NULL.  Note that
  * errors in loading the library will provoke elog regardless of
- * signalNotFound. 
+ * signalNotFound.
  */
 PGFunction
 load_external_function(char *filename, char *funcname,
@@ -64,11 +66,12 @@ load_external_function(char *filename, char *funcname,
 	 */
 	for (file_scanner = file_list;
 		 file_scanner != (DynamicFileList *) NULL &&
-			 strcmp(filename, file_scanner->filename) != 0;
+		 strcmp(filename, file_scanner->filename) != 0;
 		 file_scanner = file_scanner->next)
 		;
 	if (file_scanner == (DynamicFileList *) NULL)
 	{
+
 		/*
 		 * Check for same files - different paths (ie, symlink or link)
 		 */
@@ -77,13 +80,14 @@ load_external_function(char *filename, char *funcname,
 
 		for (file_scanner = file_list;
 			 file_scanner != (DynamicFileList *) NULL &&
-				 !SAME_INODE(stat_buf, *file_scanner);
+			 !SAME_INODE(stat_buf, *file_scanner);
 			 file_scanner = file_scanner->next)
 			;
 	}
 
 	if (file_scanner == (DynamicFileList *) NULL)
 	{
+
 		/*
 		 * File not loaded yet.
 		 */
@@ -130,7 +134,7 @@ load_external_function(char *filename, char *funcname,
 
 /*
  * This function loads a shlib file without looking up any particular
- * function in it.  If the same shlib has previously been loaded,
+ * function in it.	If the same shlib has previously been loaded,
  * unload and reload it.
  */
 void
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index a0a412cbb6a5906aa5ea808e1ae9a2e07463f80b..08c35327d0282b3c7195c0852407f021330ab958 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.50 2001/02/10 02:31:27 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.51 2001/03/22 03:59:59 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,8 +40,10 @@
  */
 #if defined(__mc68000__) && defined(__ELF__)
 typedef int32 ((*func_ptr) ());
+
 #else
 typedef char *((*func_ptr) ());
+
 #endif
 
 /*
@@ -50,8 +52,8 @@ typedef char *((*func_ptr) ());
 typedef struct
 {
 	func_ptr	func;			/* Address of the oldstyle function */
-	bool		arg_toastable[FUNC_MAX_ARGS]; /* is n'th arg of a toastable
-											   * datatype? */
+	bool		arg_toastable[FUNC_MAX_ARGS];	/* is n'th arg of a
+												 * toastable datatype? */
 } Oldstyle_fnextra;
 
 
@@ -62,23 +64,24 @@ static Datum fmgr_untrusted(PG_FUNCTION_ARGS);
 
 
 /*
- * Lookup routines for builtin-function table.  We can search by either Oid
+ * Lookup routines for builtin-function table.	We can search by either Oid
  * or name, but search by Oid is much faster.
  */
 
 static const FmgrBuiltin *
 fmgr_isbuiltin(Oid id)
 {
-	int		low = 0;
-	int		high = fmgr_nbuiltins - 1;
+	int			low = 0;
+	int			high = fmgr_nbuiltins - 1;
 
-	/* Loop invariant: low is the first index that could contain target
+	/*
+	 * Loop invariant: low is the first index that could contain target
 	 * entry, and high is the last index that could contain it.
 	 */
 	while (low <= high)
 	{
-		int					i = (high + low) / 2;
-		const FmgrBuiltin  *ptr = &fmgr_builtins[i];
+		int			i = (high + low) / 2;
+		const FmgrBuiltin *ptr = &fmgr_builtins[i];
 
 		if (id == ptr->foid)
 			return ptr;
@@ -96,15 +99,15 @@ fmgr_isbuiltin(Oid id)
  * routine.
  */
 static const FmgrBuiltin *
-fmgr_lookupByName(const char *name) 
+fmgr_lookupByName(const char *name)
 {
-	int i;
+	int			i;
 
 	for (i = 0; i < fmgr_nbuiltins; i++)
 	{
 		if (strcmp(name, fmgr_builtins[i].funcName) == 0)
 			return fmgr_builtins + i;
-    }
+	}
 	return (const FmgrBuiltin *) NULL;
 }
 
@@ -126,8 +129,10 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
 
 	if ((fbp = fmgr_isbuiltin(functionId)) != NULL)
 	{
+
 		/*
-		 * Fast path for builtin functions: don't bother consulting pg_proc
+		 * Fast path for builtin functions: don't bother consulting
+		 * pg_proc
 		 */
 		finfo->fn_nargs = fbp->nargs;
 		finfo->fn_strict = fbp->strict;
@@ -160,18 +165,18 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
 	switch (procedureStruct->prolang)
 	{
 		case INTERNALlanguageId:
+
 			/*
-			 * For an ordinary builtin function, we should never get
-			 * here because the isbuiltin() search above will have
-			 * succeeded. However, if the user has done a CREATE
-			 * FUNCTION to create an alias for a builtin function, we
-			 * can end up here.  In that case we have to look up the
-			 * function by name.  The name of the internal function is
-			 * stored in prosrc (it doesn't have to be the same as the
-			 * name of the alias!)
+			 * For an ordinary builtin function, we should never get here
+			 * because the isbuiltin() search above will have succeeded.
+			 * However, if the user has done a CREATE FUNCTION to create
+			 * an alias for a builtin function, we can end up here.  In
+			 * that case we have to look up the function by name.  The
+			 * name of the internal function is stored in prosrc (it
+			 * doesn't have to be the same as the name of the alias!)
 			 */
 			prosrc = DatumGetCString(DirectFunctionCall1(textout,
-								PointerGetDatum(&procedureStruct->prosrc)));
+							 PointerGetDatum(&procedureStruct->prosrc)));
 			fbp = fmgr_lookupByName(prosrc);
 			if (fbp == NULL)
 				elog(ERROR, "fmgr_info: function %s not in internal table",
@@ -240,7 +245,11 @@ fmgr_info_C_lang(FmgrInfo *finfo, HeapTuple procedureTuple)
 		case 0:
 			/* Old style: need to use a handler */
 			finfo->fn_addr = fmgr_oldstyle;
-			/* OK to use palloc here because fn_mcxt is CurrentMemoryContext */
+
+			/*
+			 * OK to use palloc here because fn_mcxt is
+			 * CurrentMemoryContext
+			 */
 			fnextra = (Oldstyle_fnextra *) palloc(sizeof(Oldstyle_fnextra));
 			finfo->fn_extra = (void *) fnextra;
 			MemSet(fnextra, 0, sizeof(Oldstyle_fnextra));
@@ -290,10 +299,11 @@ fmgr_info_other_lang(FmgrInfo *finfo, HeapTuple procedureTuple)
 
 		fmgr_info(languageStruct->lanplcallfoid, &plfinfo);
 		finfo->fn_addr = plfinfo.fn_addr;
+
 		/*
-		 * If lookup of the PL handler function produced nonnull
-		 * fn_extra, complain --- it must be an oldstyle function!
-		 * We no longer support oldstyle PL handlers.
+		 * If lookup of the PL handler function produced nonnull fn_extra,
+		 * complain --- it must be an oldstyle function! We no longer
+		 * support oldstyle PL handlers.
 		 */
 		if (plfinfo.fn_extra != NULL)
 			elog(ERROR, "fmgr_info: language %u has old-style handler",
@@ -325,7 +335,7 @@ fetch_finfo_record(char *filename, char *funcname)
 	char	   *infofuncname;
 	PGFInfoFunction infofunc;
 	Pg_finfo_record *inforec;
-	static Pg_finfo_record default_inforec = { 0 };
+	static Pg_finfo_record default_inforec = {0};
 
 	/* Compute name of info func */
 	infofuncname = (char *) palloc(strlen(funcname) + 10);
@@ -343,7 +353,7 @@ fetch_finfo_record(char *filename, char *funcname)
 	}
 
 	/* Found, so call it */
-	inforec = (*infofunc)();
+	inforec = (*infofunc) ();
 
 	/* Validate result as best we can */
 	if (inforec == NULL)
@@ -399,10 +409,11 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
 	fnextra = (Oldstyle_fnextra *) fcinfo->flinfo->fn_extra;
 
 	/*
-	 * Result is NULL if any argument is NULL, but we still call the function
-	 * (peculiar, but that's the way it worked before, and after all this is
-	 * a backwards-compatibility wrapper).  Note, however, that we'll never
-	 * get here with NULL arguments if the function is marked strict.
+	 * Result is NULL if any argument is NULL, but we still call the
+	 * function (peculiar, but that's the way it worked before, and after
+	 * all this is a backwards-compatibility wrapper).	Note, however,
+	 * that we'll never get here with NULL arguments if the function is
+	 * marked strict.
 	 *
 	 * We also need to detoast any TOAST-ed inputs, since it's unlikely that
 	 * an old-style function knows about TOASTing.
@@ -425,12 +436,13 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
 			returnValue = (*user_fn) ();
 			break;
 		case 1:
+
 			/*
 			 * nullvalue() used to use isNull to check if arg is NULL;
-			 * perhaps there are other functions still out there that
-			 * also rely on this undocumented hack?
+			 * perhaps there are other functions still out there that also
+			 * rely on this undocumented hack?
 			 */
-			returnValue = (*user_fn) (fcinfo->arg[0], & fcinfo->isnull);
+			returnValue = (*user_fn) (fcinfo->arg[0], &fcinfo->isnull);
 			break;
 		case 2:
 			returnValue = (*user_fn) (fcinfo->arg[0], fcinfo->arg[1]);
@@ -534,16 +546,17 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
 									  fcinfo->arg[14], fcinfo->arg[15]);
 			break;
 		default:
+
 			/*
-			 * Increasing FUNC_MAX_ARGS doesn't automatically add cases
-			 * to the above code, so mention the actual value in this error
+			 * Increasing FUNC_MAX_ARGS doesn't automatically add cases to
+			 * the above code, so mention the actual value in this error
 			 * not FUNC_MAX_ARGS.  You could add cases to the above if you
 			 * needed to support old-style functions with many arguments,
 			 * but making 'em be new-style is probably a better idea.
 			 */
 			elog(ERROR, "fmgr_oldstyle: function %u: too many arguments (%d > %d)",
 				 fcinfo->flinfo->fn_oid, n_arguments, 16);
-			returnValue = NULL;	/* keep compiler quiet */
+			returnValue = NULL; /* keep compiler quiet */
 			break;
 	}
 
@@ -557,6 +570,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
 static Datum
 fmgr_untrusted(PG_FUNCTION_ARGS)
 {
+
 	/*
 	 * Currently these are unsupported.  Someday we might do something
 	 * like forking a subprocess to execute 'em.
@@ -573,20 +587,20 @@ fmgr_untrusted(PG_FUNCTION_ARGS)
 
 /* These are for invocation of a specifically named function with a
  * directly-computed parameter list.  Note that neither arguments nor result
- * are allowed to be NULL.  Also, the function cannot be one that needs to
+ * are allowed to be NULL.	Also, the function cannot be one that needs to
  * look at FmgrInfo, since there won't be any.
  */
 Datum
 DirectFunctionCall1(PGFunction func, Datum arg1)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 1;
 	fcinfo.arg[0] = arg1;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -599,15 +613,15 @@ DirectFunctionCall1(PGFunction func, Datum arg1)
 Datum
 DirectFunctionCall2(PGFunction func, Datum arg1, Datum arg2)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 2;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -621,8 +635,8 @@ Datum
 DirectFunctionCall3(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 3;
@@ -630,7 +644,7 @@ DirectFunctionCall3(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[1] = arg2;
 	fcinfo.arg[2] = arg3;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -644,8 +658,8 @@ Datum
 DirectFunctionCall4(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3, Datum arg4)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 4;
@@ -654,7 +668,7 @@ DirectFunctionCall4(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[2] = arg3;
 	fcinfo.arg[3] = arg4;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -668,8 +682,8 @@ Datum
 DirectFunctionCall5(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3, Datum arg4, Datum arg5)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 5;
@@ -679,7 +693,7 @@ DirectFunctionCall5(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[3] = arg4;
 	fcinfo.arg[4] = arg5;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -694,8 +708,8 @@ DirectFunctionCall6(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3, Datum arg4, Datum arg5,
 					Datum arg6)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 6;
@@ -706,7 +720,7 @@ DirectFunctionCall6(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[4] = arg5;
 	fcinfo.arg[5] = arg6;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -721,8 +735,8 @@ DirectFunctionCall7(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3, Datum arg4, Datum arg5,
 					Datum arg6, Datum arg7)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 7;
@@ -734,7 +748,7 @@ DirectFunctionCall7(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[5] = arg6;
 	fcinfo.arg[6] = arg7;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -749,8 +763,8 @@ DirectFunctionCall8(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg3, Datum arg4, Datum arg5,
 					Datum arg6, Datum arg7, Datum arg8)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 8;
@@ -763,7 +777,7 @@ DirectFunctionCall8(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[6] = arg7;
 	fcinfo.arg[7] = arg8;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -779,8 +793,8 @@ DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
 					Datum arg6, Datum arg7, Datum arg8,
 					Datum arg9)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
 	fcinfo.nargs = 9;
@@ -794,7 +808,7 @@ DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
 	fcinfo.arg[7] = arg8;
 	fcinfo.arg[8] = arg9;
 
-	result = (* func) (&fcinfo);
+	result = (*func) (&fcinfo);
 
 	/* Check for null result, since caller is clearly not expecting one */
 	if (fcinfo.isnull)
@@ -812,11 +826,11 @@ DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
 Datum
 FunctionCall1(FmgrInfo *flinfo, Datum arg1)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 1;
 	fcinfo.arg[0] = arg1;
 
@@ -833,11 +847,11 @@ FunctionCall1(FmgrInfo *flinfo, Datum arg1)
 Datum
 FunctionCall2(FmgrInfo *flinfo, Datum arg1, Datum arg2)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 2;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -856,11 +870,11 @@ Datum
 FunctionCall3(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 3;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -880,11 +894,11 @@ Datum
 FunctionCall4(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3, Datum arg4)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 4;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -905,11 +919,11 @@ Datum
 FunctionCall5(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3, Datum arg4, Datum arg5)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 5;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -932,11 +946,11 @@ FunctionCall6(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3, Datum arg4, Datum arg5,
 			  Datum arg6)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 6;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -960,11 +974,11 @@ FunctionCall7(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3, Datum arg4, Datum arg5,
 			  Datum arg6, Datum arg7)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 7;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -989,11 +1003,11 @@ FunctionCall8(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg3, Datum arg4, Datum arg5,
 			  Datum arg6, Datum arg7, Datum arg8)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 8;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1020,11 +1034,11 @@ FunctionCall9(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 			  Datum arg6, Datum arg7, Datum arg8,
 			  Datum arg9)
 {
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = flinfo;
+	fcinfo.flinfo = flinfo;
 	fcinfo.nargs = 9;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1049,21 +1063,21 @@ FunctionCall9(FmgrInfo *flinfo, Datum arg1, Datum arg2,
 
 /* These are for invocation of a function identified by OID with a
  * directly-computed parameter list.  Note that neither arguments nor result
- * are allowed to be NULL.  These are essentially fmgr_info() followed
- * by FunctionCallN().  If the same function is to be invoked repeatedly,
+ * are allowed to be NULL.	These are essentially fmgr_info() followed
+ * by FunctionCallN().	If the same function is to be invoked repeatedly,
  * do the fmgr_info() once and then use FunctionCallN().
  */
 Datum
 OidFunctionCall1(Oid functionId, Datum arg1)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 1;
 	fcinfo.arg[0] = arg1;
 
@@ -1080,14 +1094,14 @@ OidFunctionCall1(Oid functionId, Datum arg1)
 Datum
 OidFunctionCall2(Oid functionId, Datum arg1, Datum arg2)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 2;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1106,14 +1120,14 @@ Datum
 OidFunctionCall3(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 3;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1133,14 +1147,14 @@ Datum
 OidFunctionCall4(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3, Datum arg4)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 4;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1161,14 +1175,14 @@ Datum
 OidFunctionCall5(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3, Datum arg4, Datum arg5)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 5;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1191,14 +1205,14 @@ OidFunctionCall6(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3, Datum arg4, Datum arg5,
 				 Datum arg6)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 6;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1222,14 +1236,14 @@ OidFunctionCall7(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3, Datum arg4, Datum arg5,
 				 Datum arg6, Datum arg7)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 7;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1254,14 +1268,14 @@ OidFunctionCall8(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg3, Datum arg4, Datum arg5,
 				 Datum arg6, Datum arg7, Datum arg8)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 8;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1288,14 +1302,14 @@ OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2,
 				 Datum arg6, Datum arg7, Datum arg8,
 				 Datum arg9)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	Datum		result;
 
 	fmgr_info(functionId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = 9;
 	fcinfo.arg[0] = arg1;
 	fcinfo.arg[1] = arg2;
@@ -1332,15 +1346,15 @@ OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2,
 char *
 fmgr(Oid procedureId,...)
 {
-	FmgrInfo				flinfo;
-	FunctionCallInfoData	fcinfo;
-	int						n_arguments;
-	Datum					result;
+	FmgrInfo	flinfo;
+	FunctionCallInfoData fcinfo;
+	int			n_arguments;
+	Datum		result;
 
 	fmgr_info(procedureId, &flinfo);
 
 	MemSet(&fcinfo, 0, sizeof(fcinfo));
-    fcinfo.flinfo = &flinfo;
+	fcinfo.flinfo = &flinfo;
 	fcinfo.nargs = flinfo.fn_nargs;
 	n_arguments = fcinfo.nargs;
 
@@ -1430,7 +1444,7 @@ pg_detoast_datum_copy(struct varlena * datum)
 	else
 	{
 		/* Make a modifiable copy of the varlena object */
-		Size			len = VARSIZE(datum);
+		Size		len = VARSIZE(datum);
 		struct varlena *result = (struct varlena *) palloc(len);
 
 		memcpy(result, datum, len);
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index b13bd014490951a7c35f3e4325a64c655a0d7577..b3a991fdc5253f47053480ee3e08cf906d27c3d0 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.34 2001/01/24 19:43:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.35 2001/03/22 03:59:59 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -719,7 +719,7 @@ hash_seq_search(HASH_SEQ_STATUS *status)
 
 			curElem = GET_BUCKET(hashp, status->curIndex);
 			status->curIndex = curElem->next;
-			if (status->curIndex == INVALID_INDEX)	/* end of this bucket */
+			if (status->curIndex == INVALID_INDEX)		/* end of this bucket */
 				++status->curBucket;
 			return &(curElem->key);
 		}
diff --git a/src/backend/utils/hash/pg_crc.c b/src/backend/utils/hash/pg_crc.c
index 96413f3b8b4d094468d5da834d34b0096573ee76..22469bf5f5e2c0dace627970bbfbf3614500e959 100644
--- a/src/backend/utils/hash/pg_crc.c
+++ b/src/backend/utils/hash/pg_crc.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/hash/pg_crc.c,v 1.1 2001/03/13 01:17:06 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/hash/pg_crc.c,v 1.2 2001/03/22 03:59:59 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -281,7 +281,7 @@ const uint32 crc_table1[256] = {
 	0xD80C07CD, 0x9AFCE626
 };
 
-#else /* int64 works */
+#else							/* int64 works */
 
 const uint64 crc_table[256] = {
 	0x0000000000000000, 0x42F0E1EBA9EA3693,
@@ -414,4 +414,4 @@ const uint64 crc_table[256] = {
 	0xD80C07CD676F8394, 0x9AFCE626CE85B507
 };
 
-#endif /* INT64_IS_BUSTED */
+#endif	 /* INT64_IS_BUSTED */
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 43331badc7aab5432857263ca34169738f0af516..2a1a0aaaae4587c0c38d9cc395f46e420027c87a 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.54 2001/03/13 01:17:06 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.55 2001/03/22 03:59:59 momjian Exp $
  *
  * NOTES
  *	  Globals used all over the place should be declared here and not
@@ -79,7 +79,7 @@ char		DateFormat[20] = "%d-%m-%Y";		/* mjl: sizes! or better
 												 * malloc? XXX */
 char		FloatFormat[20] = "%f";
 
-bool        enableFsync = true;
+bool		enableFsync = true;
 bool		allowSystemTableMods = false;
 int			SortMem = 512;
 int			NBuffers = DEF_NBUFFERS;
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index f5824327c968c139e76639f94828b63057c9b215..a6dffbee1039a7f0841102646eb3ff253c2dd958 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.63 2001/03/18 18:22:08 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.64 2001/03/22 04:00:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -109,7 +109,7 @@ SetDatabaseName(const char *name)
 void
 SetDataDir(const char *dir)
 {
-	char *new;
+	char	   *new;
 
 	AssertArg(dir);
 	if (DataDir)
@@ -117,8 +117,8 @@ SetDataDir(const char *dir)
 
 	if (dir[0] != '/')
 	{
-		char *buf;
-		size_t buflen;
+		char	   *buf;
+		size_t		buflen;
 
 		buflen = MAXPGPATH;
 		for (;;)
@@ -147,13 +147,11 @@ SetDataDir(const char *dir)
 		free(buf);
 	}
 	else
-	{
 		new = strdup(dir);
-	}
 
 	if (!new)
 		elog(FATAL, "out of memory");
-	DataDir = new;		
+	DataDir = new;
 }
 
 
@@ -344,7 +342,7 @@ convertstr(unsigned char *buff, int len, int dest)
 
 
 /* ----------------------------------------------------------------
- * 	User ID things
+ *	User ID things
  *
  * The session user is determined at connection start and never
  * changes.  The current user may change when "setuid" functions
@@ -415,7 +413,7 @@ SetSessionUserIdFromUserName(const char *username)
 	if (!HeapTupleIsValid(userTup))
 		elog(FATAL, "user \"%s\" does not exist", username);
 
-	SetSessionUserId( ((Form_pg_shadow) GETSTRUCT(userTup))->usesysid );
+	SetSessionUserId(((Form_pg_shadow) GETSTRUCT(userTup))->usesysid);
 
 	ReleaseSysCache(userTup);
 }
@@ -436,7 +434,7 @@ GetUserName(Oid userid)
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "invalid user id %u", (unsigned) userid);
 
-	result = pstrdup( NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename) );
+	result = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename));
 
 	ReleaseSysCache(tuple);
 	return result;
@@ -502,12 +500,14 @@ CreateLockFile(const char *filename, bool amPostmaster,
 	 */
 	for (;;)
 	{
+
 		/*
 		 * Try to create the lock file --- O_EXCL makes this atomic.
 		 */
 		fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
 		if (fd >= 0)
 			break;				/* Success; exit the retry loop */
+
 		/*
 		 * Couldn't create the pid file. Probably it already exists.
 		 */
@@ -551,7 +551,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
 #ifdef __BEOS__
 				 && errno != EINVAL
 #endif
-				))
+				 ))
 			{
 				/* lockfile belongs to a live process */
 				fprintf(stderr, "Lock file \"%s\" already exists.\n",
@@ -571,11 +571,11 @@ CreateLockFile(const char *filename, bool amPostmaster,
 		}
 
 		/*
-		 * No, the creating process did not exist.  However, it could be that
-		 * the postmaster crashed (or more likely was kill -9'd by a clueless
-		 * admin) but has left orphan backends behind.  Check for this by
-		 * looking to see if there is an associated shmem segment that is
-		 * still in use.
+		 * No, the creating process did not exist.	However, it could be
+		 * that the postmaster crashed (or more likely was kill -9'd by a
+		 * clueless admin) but has left orphan backends behind.  Check for
+		 * this by looking to see if there is an associated shmem segment
+		 * that is still in use.
 		 */
 		if (isDDLock)
 		{
@@ -585,7 +585,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
 
 			ptr = strchr(buffer, '\n');
 			if (ptr != NULL &&
-				(ptr = strchr(ptr+1, '\n')) != NULL)
+				(ptr = strchr(ptr + 1, '\n')) != NULL)
 			{
 				ptr++;
 				if (sscanf(ptr, "%lu %lu", &shmKey, &shmId) == 2)
@@ -607,8 +607,8 @@ CreateLockFile(const char *filename, bool amPostmaster,
 
 		/*
 		 * Looks like nobody's home.  Unlink the file and try again to
-		 * create it.  Need a loop because of possible race condition against
-		 * other would-be creators.
+		 * create it.  Need a loop because of possible race condition
+		 * against other would-be creators.
 		 */
 		if (unlink(filename) < 0)
 			elog(FATAL, "Can't remove old lock file %s: %m"
@@ -621,11 +621,11 @@ CreateLockFile(const char *filename, bool amPostmaster,
 	 * Successfully created the file, now fill it.
 	 */
 	snprintf(buffer, sizeof(buffer), "%d\n%s\n",
-			 amPostmaster ? (int) my_pid : - ((int) my_pid),
+			 amPostmaster ? (int) my_pid : -((int) my_pid),
 			 DataDir);
 	if (write(fd, buffer, strlen(buffer)) != strlen(buffer))
 	{
-		int		save_errno = errno;
+		int			save_errno = errno;
 
 		close(fd);
 		unlink(filename);
@@ -645,10 +645,10 @@ CreateLockFile(const char *filename, bool amPostmaster,
 bool
 CreateDataDirLockFile(const char *datadir, bool amPostmaster)
 {
-	char	lockfile[MAXPGPATH];
+	char		lockfile[MAXPGPATH];
 
 	snprintf(lockfile, sizeof(lockfile), "%s/postmaster.pid", datadir);
-	if (! CreateLockFile(lockfile, amPostmaster, true, datadir))
+	if (!CreateLockFile(lockfile, amPostmaster, true, datadir))
 		return false;
 	/* Save name of lockfile for RecordSharedMemoryInLockFile */
 	strcpy(directoryLockFile, lockfile);
@@ -658,10 +658,10 @@ CreateDataDirLockFile(const char *datadir, bool amPostmaster)
 bool
 CreateSocketLockFile(const char *socketfile, bool amPostmaster)
 {
-	char	lockfile[MAXPGPATH];
+	char		lockfile[MAXPGPATH];
 
 	snprintf(lockfile, sizeof(lockfile), "%s.lock", socketfile);
-	if (! CreateLockFile(lockfile, amPostmaster, false, socketfile))
+	if (!CreateLockFile(lockfile, amPostmaster, false, socketfile))
 		return false;
 	/* Save name of lockfile for TouchSocketLockFile */
 	strcpy(socketLockFile, lockfile);
@@ -698,7 +698,7 @@ TouchSocketLockFile(void)
  * lock file (if we have created one).
  *
  * This may be called multiple times in the life of a postmaster, if we
- * delete and recreate shmem due to backend crash.  Therefore, be prepared
+ * delete and recreate shmem due to backend crash.	Therefore, be prepared
  * to overwrite existing information.  (As of 7.1, a postmaster only creates
  * one shm seg anyway; but for the purposes here, if we did have more than
  * one then any one of them would do anyway.)
@@ -712,8 +712,8 @@ RecordSharedMemoryInLockFile(IpcMemoryKey shmKey, IpcMemoryId shmId)
 	char		buffer[BLCKSZ];
 
 	/*
-	 * Do nothing if we did not create a lockfile (probably because we
-	 * are running standalone).
+	 * Do nothing if we did not create a lockfile (probably because we are
+	 * running standalone).
 	 */
 	if (directoryLockFile[0] == '\0')
 		return;
@@ -732,27 +732,30 @@ RecordSharedMemoryInLockFile(IpcMemoryKey shmKey, IpcMemoryId shmId)
 		return;
 	}
 	buffer[len] = '\0';
+
 	/*
 	 * Skip over first two lines (PID and path).
 	 */
 	ptr = strchr(buffer, '\n');
 	if (ptr == NULL ||
-		(ptr = strchr(ptr+1, '\n')) == NULL)
+		(ptr = strchr(ptr + 1, '\n')) == NULL)
 	{
 		elog(DEBUG, "Bogus data in %s", directoryLockFile);
 		close(fd);
 		return;
 	}
 	ptr++;
+
 	/*
 	 * Append shm key and ID.  Format to try to keep it the same length
 	 * always (trailing junk won't hurt, but might confuse humans).
 	 */
 	sprintf(ptr, "%9lu %9lu\n",
 			(unsigned long) shmKey, (unsigned long) shmId);
+
 	/*
-	 * And rewrite the data.  Since we write in a single kernel call,
-	 * this update should appear atomic to onlookers.
+	 * And rewrite the data.  Since we write in a single kernel call, this
+	 * update should appear atomic to onlookers.
 	 */
 	len = strlen(buffer);
 	if (lseek(fd, (off_t) 0, SEEK_SET) != 0 ||
@@ -781,16 +784,18 @@ void
 ValidatePgVersion(const char *path)
 {
 	char		full_path[MAXPGPATH];
-	FILE       *file;
+	FILE	   *file;
 	int			ret;
-	long        file_major, file_minor;
-	long        my_major = 0, my_minor = 0;
-	char       *endptr;
+	long		file_major,
+				file_minor;
+	long		my_major = 0,
+				my_minor = 0;
+	char	   *endptr;
 	const char *version_string = PG_VERSION;
 
 	my_major = strtol(version_string, &endptr, 10);
 	if (*endptr == '.')
-		my_minor = strtol(endptr+1, NULL, 10);
+		my_minor = strtol(endptr + 1, NULL, 10);
 
 	snprintf(full_path, MAXPGPATH, "%s/PG_VERSION", path);
 
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 0f9639de02b848c6a2f431e2611230132976e54d..ef5f09374af8478cce00aabbde530621619d1ae5 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.81 2001/02/16 18:50:40 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.82 2001/03/22 04:00:00 momjian Exp $
  *
  *
  *-------------------------------------------------------------------------
@@ -118,7 +118,7 @@ ReverifyMyDatabase(const char *name)
 	 * Also check that the database is currently allowing connections.
 	 */
 	dbform = (Form_pg_database) GETSTRUCT(tup);
-	if (! dbform->datallowconn)
+	if (!dbform->datallowconn)
 		elog(FATAL, "Database \"%s\" is not currently accepting connections",
 			 name);
 
@@ -175,6 +175,7 @@ InitCommunication(void)
 void
 BaseInit(void)
 {
+
 	/*
 	 * Attach to shared memory and semaphores, and initialize our
 	 * input/output/debugging file descriptors.
@@ -230,8 +231,8 @@ InitPostgres(const char *dbname, const char *username)
 		ValidatePgVersion(DataDir);
 
 		/*
-		 * Find oid and path of the database we're about to open.
-		 * Since we're not yet up and running we have to use the hackish
+		 * Find oid and path of the database we're about to open. Since
+		 * we're not yet up and running we have to use the hackish
 		 * GetRawDatabaseInfo.
 		 */
 		GetRawDatabaseInfo(dbname, &MyDatabaseId, datpath);
@@ -347,8 +348,8 @@ InitPostgres(const char *dbname, const char *username)
 
 	/*
 	 * Unless we are bootstrapping, double-check that InitMyDatabaseInfo()
-	 * got a correct result.  We can't do this until all the database-access
-	 * infrastructure is up.
+	 * got a correct result.  We can't do this until all the
+	 * database-access infrastructure is up.
 	 */
 	if (!bootstrap)
 		ReverifyMyDatabase(dbname);
@@ -359,14 +360,18 @@ InitPostgres(const char *dbname, const char *username)
 #endif
 
 	/*
-	 * Set up process-exit callbacks to remove temp relations and then
-	 * do pre-shutdown cleanup.  This should be last because we want
+	 * Set up process-exit callbacks to remove temp relations and then do
+	 * pre-shutdown cleanup.  This should be last because we want
 	 * shmem_exit to call these routines before the exit callbacks that
-	 * are registered by buffer manager, lock manager, etc.  We need
-	 * to run this code before we close down database access!
+	 * are registered by buffer manager, lock manager, etc.  We need to
+	 * run this code before we close down database access!
 	 */
 	on_shmem_exit(ShutdownPostgres, 0);
-	/* because callbacks are called in reverse order, this gets done first: */
+
+	/*
+	 * because callbacks are called in reverse order, this gets done
+	 * first:
+	 */
 	on_shmem_exit(remove_all_temp_relations, 0);
 
 	/* close the transaction we started above */
@@ -389,21 +394,24 @@ InitPostgres(const char *dbname, const char *username)
 static void
 ShutdownPostgres(void)
 {
+
 	/*
-	 * These operations are really just a minimal subset of AbortTransaction().
-	 * We don't want to do any inessential cleanup, since that just raises
-	 * the odds of failure --- but there's some stuff we need to do.
+	 * These operations are really just a minimal subset of
+	 * AbortTransaction(). We don't want to do any inessential cleanup,
+	 * since that just raises the odds of failure --- but there's some
+	 * stuff we need to do.
 	 *
 	 * Release any spinlocks or buffer context locks we might be holding.
-	 * This is a kluge to improve the odds that we won't get into a self-made
-	 * stuck-spinlock scenario while trying to shut down.
+	 * This is a kluge to improve the odds that we won't get into a
+	 * self-made stuck-spinlock scenario while trying to shut down.
 	 */
 	ProcReleaseSpins(NULL);
 	UnlockBuffers();
+
 	/*
-	 * In case a transaction is open, delete any files it created.  This
+	 * In case a transaction is open, delete any files it created.	This
 	 * has to happen before bufmgr shutdown, so having smgr register a
 	 * callback for it wouldn't work.
 	 */
-	smgrDoPendingDeletes(false); /* delete as though aborting xact */
+	smgrDoPendingDeletes(false);/* delete as though aborting xact */
 }
diff --git a/src/backend/utils/mb/conv.c b/src/backend/utils/mb/conv.c
index eaef3976b5eb685bac34ec62f34b41063500fda0..30b1a0d92a610a48dc01d4273c4c2998ca8a43a2 100644
--- a/src/backend/utils/mb/conv.c
+++ b/src/backend/utils/mb/conv.c
@@ -6,7 +6,7 @@
  * WIN1250 client encoding support contributed by Pavel Behal
  * SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya
  *
- * $Id: conv.c,v 1.23 2001/02/11 01:56:58 ishii Exp $
+ * $Id: conv.c,v 1.24 2001/03/22 04:00:01 momjian Exp $
  *
  *
  */
@@ -39,7 +39,7 @@
 #include "Unicode/utf8_to_big5.map"
 #include "Unicode/big5_to_utf8.map"
 
-#endif /* UNICODE_CONVERSION */
+#endif	 /* UNICODE_CONVERSION */
 
 /*
  * SJIS alternative code.
@@ -86,6 +86,7 @@ sjis2mic(unsigned char *sjis, unsigned char *p, int len)
 				i,
 				k,
 				k2;
+
 /* Eiji Tokuya patched end */
 	while (len > 0 && (c1 = *sjis++))
 	{
@@ -117,7 +118,7 @@ sjis2mic(unsigned char *sjis, unsigned char *p, int len)
 					{
 						k = ibmkanji[i].sjis;
 						c1 = (k >> 8) & 0xff;
-						c2 = k &  0xff;
+						c2 = k & 0xff;
 					}
 				}
 			}
@@ -132,7 +133,7 @@ sjis2mic(unsigned char *sjis, unsigned char *p, int len)
 				*p++ = c2 + ((c2 > 0x9e) ? 2 : 0x60) + (c2 < 0x80);
 			}
 /* Eiji Tokuya patched begin */
-			else if ((k >= 0xeb40 && k < 0xf040)||(k >= 0xfc4c && k <= 0xfcfc))
+			else if ((k >= 0xeb40 && k < 0xf040) || (k >= 0xfc4c && k <= 0xfcfc))
 			{
 				/* NEC selection IBM kanji - Other undecided justice */
 /* Eiji Tokuya patched end */
@@ -1144,7 +1145,7 @@ mic2win1250(unsigned char *mic, unsigned char *p, int len)
 static void
 ascii2utf(unsigned char *ascii, unsigned char *utf, int len)
 {
-  ascii2mic(ascii, utf, len);
+	ascii2mic(ascii, utf, len);
 }
 
 /*
@@ -1153,7 +1154,7 @@ ascii2utf(unsigned char *ascii, unsigned char *utf, int len)
 static void
 utf2ascii(unsigned char *utf, unsigned char *ascii, int len)
 {
-  mic2ascii(utf, ascii, len);
+	mic2ascii(utf, ascii, len);
 }
 
 /*
@@ -1162,14 +1163,12 @@ utf2ascii(unsigned char *utf, unsigned char *ascii, int len)
 static void
 latin1_to_utf(unsigned char *iso, unsigned char *utf, int len)
 {
-	unsigned short			c;
+	unsigned short c;
 
 	while (len-- > 0 && (c = *iso++))
 	{
 		if (c < 0x80)
-		{
 			*utf++ = c;
-		}
 		else
 		{
 			*utf++ = (c >> 6) | 0xc0;
@@ -1185,7 +1184,9 @@ latin1_to_utf(unsigned char *iso, unsigned char *utf, int len)
 static void
 utf_to_latin1(unsigned char *utf, unsigned char *iso, int len)
 {
-	unsigned short			c, c1, c2;
+	unsigned short c,
+				c1,
+				c2;
 
 	while (len > 0 && (c = *utf++))
 	{
@@ -1198,9 +1199,7 @@ utf_to_latin1(unsigned char *utf, unsigned char *iso, int len)
 			len -= 2;
 		}
 		else if ((c & 0xe0) == 0xe0)
-		{
 			elog(ERROR, "Could not convert UTF-8 to ISO8859-1");
-		}
 		else
 		{
 			*iso++ = c;
@@ -1214,46 +1213,50 @@ utf_to_latin1(unsigned char *utf, unsigned char *iso, int len)
  * comparison routine for bsearch()
  * this routine is intended for UTF-8 -> local code
  */
-static int compare1(const void *p1, const void *p2)
+static int
+compare1(const void *p1, const void *p2)
 {
-	unsigned int v1, v2;
+	unsigned int v1,
+				v2;
 
-	v1 = *(unsigned int *)p1;
-	v2 = ((pg_utf_to_local *)p2)->utf;
-	return(v1 - v2);
+	v1 = *(unsigned int *) p1;
+	v2 = ((pg_utf_to_local *) p2)->utf;
+	return (v1 - v2);
 }
 
 /*
  * comparison routine for bsearch()
  * this routine is intended for local code -> UTF-8
  */
-static int compare2(const void *p1, const void *p2)
+static int
+compare2(const void *p1, const void *p2)
 {
-	unsigned int v1, v2;
+	unsigned int v1,
+				v2;
 
-	v1 = *(unsigned int *)p1;
-	v2 = ((pg_local_to_utf *)p2)->code;
-	return(v1 - v2);
+	v1 = *(unsigned int *) p1;
+	v2 = ((pg_local_to_utf *) p2)->code;
+	return (v1 - v2);
 }
 
 /*
  * UTF-8 ---> local code
  *
  * utf: input UTF-8 string. Its length is limited by "len" parameter
- *      or a null terminater.
+ *		or a null terminater.
  * iso: pointer to the output.
  * map: the conversion map.
  * size: the size of the conversion map.
  */
 static void
 utf_to_local(unsigned char *utf, unsigned char *iso,
-			 pg_utf_to_local *map, int size, int len)
+			 pg_utf_to_local * map, int size, int len)
 {
 	unsigned int iutf;
-	int l;
+	int			l;
 	pg_utf_to_local *p;
 
-	for (;len > 0 && *utf; len -= l)
+	for (; len > 0 && *utf; len -= l)
 	{
 		l = pg_utf_mblen(utf);
 		if (l == 1)
@@ -1262,7 +1265,7 @@ utf_to_local(unsigned char *utf, unsigned char *iso,
 			continue;
 		}
 		else if (l == 2)
-		{ 
+		{
 			iutf = *utf++ << 8;
 			iutf |= *utf++;
 		}
@@ -1297,7 +1300,7 @@ utf_to_local(unsigned char *utf, unsigned char *iso,
 static void
 utf_to_latin2(unsigned char *utf, unsigned char *iso, int len)
 {
-  utf_to_local(utf, iso, ULmapISO8859_2, sizeof(ULmapISO8859_2)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, iso, ULmapISO8859_2, sizeof(ULmapISO8859_2) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1306,7 +1309,7 @@ utf_to_latin2(unsigned char *utf, unsigned char *iso, int len)
 static void
 utf_to_latin3(unsigned char *utf, unsigned char *iso, int len)
 {
-  utf_to_local(utf, iso, ULmapISO8859_3, sizeof(ULmapISO8859_3)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, iso, ULmapISO8859_3, sizeof(ULmapISO8859_3) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1315,7 +1318,7 @@ utf_to_latin3(unsigned char *utf, unsigned char *iso, int len)
 static void
 utf_to_latin4(unsigned char *utf, unsigned char *iso, int len)
 {
-  utf_to_local(utf, iso, ULmapISO8859_4, sizeof(ULmapISO8859_4)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, iso, ULmapISO8859_4, sizeof(ULmapISO8859_4) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1325,7 +1328,7 @@ static void
 utf_to_latin5(unsigned char *utf, unsigned char *iso, int len)
 
 {
-  utf_to_local(utf, iso, ULmapISO8859_5, sizeof(ULmapISO8859_5)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, iso, ULmapISO8859_5, sizeof(ULmapISO8859_5) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1333,20 +1336,18 @@ utf_to_latin5(unsigned char *utf, unsigned char *iso, int len)
  */
 static void
 local_to_utf(unsigned char *iso, unsigned char *utf,
-			 pg_local_to_utf *map, int size, int encoding, int len)
+			 pg_local_to_utf * map, int size, int encoding, int len)
 {
 	unsigned int iiso;
-	int l;
+	int			l;
 	pg_local_to_utf *p;
 	pg_encoding_conv_tbl *e;
 
 	e = pg_get_enc_ent(encoding);
 	if (e == 0)
-	{
 		elog(ERROR, "Invalid encoding number %d", encoding);
-	}
 
-	for (;len > 0 && *iso; len -= l)
+	for (; len > 0 && *iso; len -= l)
 	{
 		if (*iso < 0x80)
 		{
@@ -1358,11 +1359,9 @@ local_to_utf(unsigned char *iso, unsigned char *utf,
 		l = pg_encoding_mblen(encoding, iso);
 
 		if (l == 1)
-		{
 			iiso = *iso++;
-		}
 		else if (l == 2)
-		{ 
+		{
 			iiso = *iso++ << 8;
 			iiso |= *iso++;
 		}
@@ -1383,8 +1382,8 @@ local_to_utf(unsigned char *iso, unsigned char *utf,
 					sizeof(pg_local_to_utf), compare2);
 		if (p == NULL)
 		{
-			  elog(NOTICE, "local_to_utf: could not convert (0x%04x) %s to UTF-8. Ignored",
-			  iiso, e->name);
+			elog(NOTICE, "local_to_utf: could not convert (0x%04x) %s to UTF-8. Ignored",
+				 iiso, e->name);
 			continue;
 		}
 		if (p->utf & 0xff000000)
@@ -1405,7 +1404,7 @@ local_to_utf(unsigned char *iso, unsigned char *utf,
 static void
 latin2_to_utf(unsigned char *iso, unsigned char *utf, int len)
 {
-  local_to_utf(iso, utf, LUmapISO8859_2, sizeof(LUmapISO8859_2)/sizeof(pg_local_to_utf), LATIN2, len);
+	local_to_utf(iso, utf, LUmapISO8859_2, sizeof(LUmapISO8859_2) / sizeof(pg_local_to_utf), LATIN2, len);
 }
 
 /*
@@ -1414,7 +1413,7 @@ latin2_to_utf(unsigned char *iso, unsigned char *utf, int len)
 static void
 latin3_to_utf(unsigned char *iso, unsigned char *utf, int len)
 {
-  local_to_utf(iso, utf, LUmapISO8859_3, sizeof(LUmapISO8859_3)/sizeof(pg_local_to_utf), LATIN3, len);
+	local_to_utf(iso, utf, LUmapISO8859_3, sizeof(LUmapISO8859_3) / sizeof(pg_local_to_utf), LATIN3, len);
 }
 
 /*
@@ -1423,7 +1422,7 @@ latin3_to_utf(unsigned char *iso, unsigned char *utf, int len)
 static void
 latin4_to_utf(unsigned char *iso, unsigned char *utf, int len)
 {
-  local_to_utf(iso, utf, LUmapISO8859_4, sizeof(LUmapISO8859_4)/sizeof(pg_local_to_utf), LATIN4, len);
+	local_to_utf(iso, utf, LUmapISO8859_4, sizeof(LUmapISO8859_4) / sizeof(pg_local_to_utf), LATIN4, len);
 }
 
 /*
@@ -1432,7 +1431,7 @@ latin4_to_utf(unsigned char *iso, unsigned char *utf, int len)
 static void
 latin5_to_utf(unsigned char *iso, unsigned char *utf, int len)
 {
-  local_to_utf(iso, utf, LUmapISO8859_5, sizeof(LUmapISO8859_5)/sizeof(pg_local_to_utf), LATIN5, len);
+	local_to_utf(iso, utf, LUmapISO8859_5, sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf), LATIN5, len);
 }
 
 /*
@@ -1442,8 +1441,8 @@ static void
 utf_to_euc_jp(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapEUC_JP, 
-			   sizeof(ULmapEUC_JP)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapEUC_JP,
+				 sizeof(ULmapEUC_JP) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1453,7 +1452,7 @@ static void
 euc_jp_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapEUC_JP,
-				 sizeof(LUmapEUC_JP)/sizeof(pg_local_to_utf), EUC_JP, len);
+			 sizeof(LUmapEUC_JP) / sizeof(pg_local_to_utf), EUC_JP, len);
 }
 
 /*
@@ -1463,8 +1462,8 @@ static void
 utf_to_euc_cn(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapEUC_CN, 
-			   sizeof(ULmapEUC_CN)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapEUC_CN,
+				 sizeof(ULmapEUC_CN) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1474,7 +1473,7 @@ static void
 euc_cn_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapEUC_CN,
-				 sizeof(LUmapEUC_CN)/sizeof(pg_local_to_utf), EUC_CN, len);
+			 sizeof(LUmapEUC_CN) / sizeof(pg_local_to_utf), EUC_CN, len);
 }
 
 /*
@@ -1484,8 +1483,8 @@ static void
 utf_to_euc_kr(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapEUC_KR, 
-			   sizeof(ULmapEUC_KR)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapEUC_KR,
+				 sizeof(ULmapEUC_KR) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1495,7 +1494,7 @@ static void
 euc_kr_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapEUC_KR,
-				 sizeof(LUmapEUC_KR)/sizeof(pg_local_to_utf), EUC_KR, len);
+			 sizeof(LUmapEUC_KR) / sizeof(pg_local_to_utf), EUC_KR, len);
 }
 
 /*
@@ -1505,8 +1504,8 @@ static void
 utf_to_euc_tw(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapEUC_TW, 
-			   sizeof(ULmapEUC_TW)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapEUC_TW,
+				 sizeof(ULmapEUC_TW) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1516,7 +1515,7 @@ static void
 euc_tw_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapEUC_TW,
-				 sizeof(LUmapEUC_TW)/sizeof(pg_local_to_utf), EUC_TW, len);
+			 sizeof(LUmapEUC_TW) / sizeof(pg_local_to_utf), EUC_TW, len);
 }
 
 /*
@@ -1526,8 +1525,8 @@ static void
 utf_to_sjis(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapSJIS, 
-			   sizeof(ULmapSJIS)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapSJIS,
+				 sizeof(ULmapSJIS) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1537,7 +1536,7 @@ static void
 sjis_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapSJIS,
-				 sizeof(LUmapSJIS)/sizeof(pg_local_to_utf), SJIS, len);
+				 sizeof(LUmapSJIS) / sizeof(pg_local_to_utf), SJIS, len);
 }
 
 /*
@@ -1547,8 +1546,8 @@ static void
 utf_to_big5(unsigned char *utf, unsigned char *euc, int len)
 
 {
-	utf_to_local(utf, euc, ULmapBIG5, 
-			   sizeof(ULmapBIG5)/sizeof(pg_utf_to_local), len);
+	utf_to_local(utf, euc, ULmapBIG5,
+				 sizeof(ULmapBIG5) / sizeof(pg_utf_to_local), len);
 }
 
 /*
@@ -1558,85 +1557,85 @@ static void
 big5_to_utf(unsigned char *euc, unsigned char *utf, int len)
 {
 	local_to_utf(euc, utf, LUmapBIG5,
-				 sizeof(LUmapBIG5)/sizeof(pg_local_to_utf), BIG5, len);
+				 sizeof(LUmapBIG5) / sizeof(pg_local_to_utf), BIG5, len);
 }
 
 /*-----------------------------------------------------------------*/
 
 pg_encoding_conv_tbl pg_conv_tbl[] = {
 	{SQL_ASCII, "SQL_ASCII", 0, ascii2mic, mic2ascii,
-	 ascii2utf, utf2ascii},	/* SQL/ASCII */
+	ascii2utf, utf2ascii},		/* SQL/ASCII */
 	{EUC_JP, "EUC_JP", 0, euc_jp2mic, mic2euc_jp,
-	 euc_jp_to_utf, utf_to_euc_jp},		/* EUC_JP */
+	euc_jp_to_utf, utf_to_euc_jp},		/* EUC_JP */
 	{EUC_CN, "EUC_CN", 0, euc_cn2mic, mic2euc_cn,
-	 euc_cn_to_utf, utf_to_euc_cn},		/* EUC_CN */
+	euc_cn_to_utf, utf_to_euc_cn},		/* EUC_CN */
 	{EUC_KR, "EUC_KR", 0, euc_kr2mic, mic2euc_kr,
 	euc_kr_to_utf, utf_to_euc_kr},		/* EUC_KR */
 	{EUC_TW, "EUC_TW", 0, euc_tw2mic, mic2euc_tw,
-	 euc_tw_to_utf, utf_to_euc_tw},		/* EUC_TW */
+	euc_tw_to_utf, utf_to_euc_tw},		/* EUC_TW */
 	{UNICODE, "UNICODE", 0, 0, 0},		/* UNICODE */
 	{MULE_INTERNAL, "MULE_INTERNAL", 0, 0, 0},	/* MULE_INTERNAL */
 	{LATIN1, "LATIN1", 0, latin12mic, mic2latin1,
-	 latin1_to_utf, utf_to_latin1},				/* ISO 8859 Latin 1 */
+	latin1_to_utf, utf_to_latin1},		/* ISO 8859 Latin 1 */
 	{LATIN2, "LATIN2", 0, latin22mic, mic2latin2,
-	 latin2_to_utf, utf_to_latin2},				/* ISO 8859 Latin 2 */
+	latin2_to_utf, utf_to_latin2},		/* ISO 8859 Latin 2 */
 	{LATIN3, "LATIN3", 0, latin32mic, mic2latin3,
-	 latin3_to_utf, utf_to_latin3},				/* ISO 8859 Latin 3 */
+	latin3_to_utf, utf_to_latin3},		/* ISO 8859 Latin 3 */
 	{LATIN4, "LATIN4", 0, latin42mic, mic2latin4,
-	 latin4_to_utf, utf_to_latin4},				/* ISO 8859 Latin 4 */
+	latin4_to_utf, utf_to_latin4},		/* ISO 8859 Latin 4 */
 	{LATIN5, "LATIN5", 0, iso2mic, mic2iso,
-	 latin5_to_utf, utf_to_latin5},				/* ISO 8859 Latin 5 */
+	latin5_to_utf, utf_to_latin5},		/* ISO 8859 Latin 5 */
 	{KOI8, "KOI8", 0, koi2mic, mic2koi,
-	 0, 0},										/* KOI8-R */
+	0, 0},						/* KOI8-R */
 	{WIN, "WIN", 0, win2mic, mic2win,
-	 0,0},										/* CP1251 */
+	0, 0},						/* CP1251 */
 	{ALT, "ALT", 0, alt2mic, mic2alt,
-	 0,0},										/* CP866 */
+	0, 0},						/* CP866 */
 	{SJIS, "SJIS", 1, sjis2mic, mic2sjis,
-	 sjis_to_utf, utf_to_sjis},					/* SJIS */
+	sjis_to_utf, utf_to_sjis},	/* SJIS */
 	{BIG5, "BIG5", 1, big52mic, mic2big5,
-	 big5_to_utf, utf_to_big5},					/* Big5 */
+	big5_to_utf, utf_to_big5},	/* Big5 */
 	{WIN1250, "WIN1250", 1, win12502mic, mic2win1250,
-	 0,0},										/* WIN 1250 */
-	{-1, "", 0, 0, 0, 0}						/* end mark */
+	0, 0},						/* WIN 1250 */
+	{-1, "", 0, 0, 0, 0}		/* end mark */
 };
 
 #else
 
 pg_encoding_conv_tbl pg_conv_tbl[] = {
 	{SQL_ASCII, "SQL_ASCII", 0, ascii2mic, mic2ascii,
-	 0, 0},	/* SQL/ASCII */
+	0, 0},						/* SQL/ASCII */
 	{EUC_JP, "EUC_JP", 0, euc_jp2mic, mic2euc_jp,
-	 0, 0},		/* EUC_JP */
+	0, 0},						/* EUC_JP */
 	{EUC_CN, "EUC_CN", 0, euc_cn2mic, mic2euc_cn,
-	 0, 0},		/* EUC_CN */
+	0, 0},						/* EUC_CN */
 	{EUC_KR, "EUC_KR", 0, euc_kr2mic, mic2euc_kr},		/* EUC_KR */
 	{EUC_TW, "EUC_TW", 0, euc_tw2mic, mic2euc_tw},		/* EUC_TW */
 	{UNICODE, "UNICODE", 0, 0, 0},		/* UNICODE */
 	{MULE_INTERNAL, "MULE_INTERNAL", 0, 0, 0},	/* MULE_INTERNAL */
 	{LATIN1, "LATIN1", 0, latin12mic, mic2latin1,
-	 0, 0},				/* ISO 8859 Latin 1 */
+	0, 0},						/* ISO 8859 Latin 1 */
 	{LATIN2, "LATIN2", 0, latin22mic, mic2latin2,
-	 0, 0},				/* ISO 8859 Latin 2 */
+	0, 0},						/* ISO 8859 Latin 2 */
 	{LATIN3, "LATIN3", 0, latin32mic, mic2latin3,
-	 0, 0},				/* ISO 8859 Latin 3 */
+	0, 0},						/* ISO 8859 Latin 3 */
 	{LATIN4, "LATIN4", 0, latin42mic, mic2latin4,
-	 0, 0},				/* ISO 8859 Latin 4 */
+	0, 0},						/* ISO 8859 Latin 4 */
 	{LATIN5, "LATIN5", 0, iso2mic, mic2iso,
-	 0, 0},				/* ISO 8859 Latin 5 */
+	0, 0},						/* ISO 8859 Latin 5 */
 	{KOI8, "KOI8", 0, koi2mic, mic2koi,
-	 0, 0},										/* KOI8-R */
+	0, 0},						/* KOI8-R */
 	{WIN, "WIN", 0, win2mic, mic2win,
-	 0,0},										/* CP1251 */
+	0, 0},						/* CP1251 */
 	{ALT, "ALT", 0, alt2mic, mic2alt,
-	 0,0},										/* CP866 */
+	0, 0},						/* CP866 */
 	{SJIS, "SJIS", 1, sjis2mic, mic2sjis,
-	 0, 0},					/* SJIS */
+	0, 0},						/* SJIS */
 	{BIG5, "BIG5", 1, big52mic, mic2big5,
-	 0,0},										/* Big5 */
+	0, 0},						/* Big5 */
 	{WIN1250, "WIN1250", 1, win12502mic, mic2win1250,
-	 0,0},										/* WIN 1250 */
-	{-1, "", 0, 0, 0, 0}						/* end mark */
+	0, 0},						/* WIN 1250 */
+	{-1, "", 0, 0, 0, 0}		/* end mark */
 };
 
-#endif /* UNICODE_CONVERSION */
+#endif	 /* UNICODE_CONVERSION */
diff --git a/src/backend/utils/mb/liketest.c b/src/backend/utils/mb/liketest.c
index 3c2e9de75070e349c805e4e99d509470e4880ab8..5cb6860812c3bd02beb87cc5c936d61f87c19fd5 100644
--- a/src/backend/utils/mb/liketest.c
+++ b/src/backend/utils/mb/liketest.c
@@ -12,37 +12,42 @@
 #define UCHARMAX 0xff
 /*----------------------------------------------------------------*/
 
-static int wchareq(unsigned char *p1, unsigned char *p2)
+static int
+wchareq(unsigned char *p1, unsigned char *p2)
 {
-	int l;
+	int			l;
 
 	l = pg_mblen(p1);
-	if (pg_mblen(p2) != l) {
-		return(0);
-	}
-	while (l--) {
+	if (pg_mblen(p2) != l)
+		return (0);
+	while (l--)
+	{
 		if (*p1++ != *p2++)
-			return(0);
+			return (0);
 	}
-	return(1);
+	return (1);
 }
 
-static int iwchareq(unsigned char *p1, unsigned char *p2)
+static int
+iwchareq(unsigned char *p1, unsigned char *p2)
 {
-	int c1, c2;
-	int l;
+	int			c1,
+				c2;
+	int			l;
 
-	/* short cut. if *p1 and *p2 is lower than UCHARMAX, then
-	   we assume they are ASCII */
+	/*
+	 * short cut. if *p1 and *p2 is lower than UCHARMAX, then we assume
+	 * they are ASCII
+	 */
 	if (*p1 < UCHARMAX && *p2 < UCHARMAX)
-		return(tolower(*p1) == tolower(*p2));
+		return (tolower(*p1) == tolower(*p2));
 
 	if (*p1 < UCHARMAX)
 		c1 = tolower(*p1);
 	else
 	{
 		l = pg_mblen(p1);
-		(void)pg_mb2wchar_with_len(p1, (pg_wchar *)&c1, l);
+		(void) pg_mb2wchar_with_len(p1, (pg_wchar *) & c1, l);
 		c1 = tolower(c1);
 	}
 	if (*p2 < UCHARMAX)
@@ -50,10 +55,10 @@ static int iwchareq(unsigned char *p1, unsigned char *p2)
 	else
 	{
 		l = pg_mblen(p2);
-		(void)pg_mb2wchar_with_len(p2, (pg_wchar *)&c2, l);
+		(void) pg_mb2wchar_with_len(p2, (pg_wchar *) & c2, l);
 		c2 = tolower(c2);
 	}
-	return(c1 == c2);
+	return (c1 == c2);
 }
 
 #ifdef MULTIBYTE
@@ -69,23 +74,28 @@ static int iwchareq(unsigned char *p1, unsigned char *p2)
 static int
 MatchText(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 {
-	/* Fast path for match-everything pattern
-	 * Include weird case of escape character as a percent sign or underscore,
-	 * when presumably that wildcard character becomes a literal.
+
+	/*
+	 * Fast path for match-everything pattern Include weird case of escape
+	 * character as a percent sign or underscore, when presumably that
+	 * wildcard character becomes a literal.
 	 */
 	if ((plen == 1) && (*p == '%')
-		&& ! ((e != NULL) && (*e == '%')))
+		&& !((e != NULL) && (*e == '%')))
 		return LIKE_TRUE;
 
 	while ((tlen > 0) && (plen > 0))
 	{
-		/* If an escape character was specified and we find it here in the pattern,
-		 * then we'd better have an exact match for the next character.
+
+		/*
+		 * If an escape character was specified and we find it here in the
+		 * pattern, then we'd better have an exact match for the next
+		 * character.
 		 */
-		if ((e != NULL) && CHAREQ(p,e))
+		if ((e != NULL) && CHAREQ(p, e))
 		{
 			NextChar(p, plen);
-			if ((plen <= 0) || !CHAREQ(t,p))
+			if ((plen <= 0) || !CHAREQ(t, p))
 				return LIKE_FALSE;
 		}
 		else if (*p == '%')
@@ -99,23 +109,23 @@ MatchText(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 				return LIKE_TRUE;
 
 			/*
-			 * Otherwise, scan for a text position at which we can
-			 * match the rest of the pattern.
+			 * Otherwise, scan for a text position at which we can match
+			 * the rest of the pattern.
 			 */
 			while (tlen > 0)
 			{
+
 				/*
-				 * Optimization to prevent most recursion: don't
-				 * recurse unless first pattern char might match this
-				 * text char.
+				 * Optimization to prevent most recursion: don't recurse
+				 * unless first pattern char might match this text char.
 				 */
-				if (CHAREQ(t,p) || (*p == '_')
-					|| ((e != NULL) && CHAREQ(p,e)))
+				if (CHAREQ(t, p) || (*p == '_')
+					|| ((e != NULL) && CHAREQ(p, e)))
 				{
-					int matched = MatchText(t, tlen, p, plen, e);
+					int			matched = MatchText(t, tlen, p, plen, e);
 
 					if (matched != LIKE_FALSE)
-						return matched;		/* TRUE or ABORT */
+						return matched; /* TRUE or ABORT */
 				}
 
 				NextChar(t, tlen);
@@ -127,9 +137,11 @@ MatchText(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 			 */
 			return LIKE_ABORT;
 		}
-		else if ((*p != '_') && !CHAREQ(t,p))
+		else if ((*p != '_') && !CHAREQ(t, p))
 		{
-			/* Not the single-character wildcard and no explicit match?
+
+			/*
+			 * Not the single-character wildcard and no explicit match?
 			 * Then time to quit...
 			 */
 			return LIKE_FALSE;
@@ -143,7 +155,8 @@ MatchText(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 		return LIKE_FALSE;		/* end of pattern, but not of text */
 
 	/* End of input string.  Do we have matching pattern remaining? */
-	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of pattern */
+	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of
+										 * pattern */
 		NextChar(p, plen);
 	if (plen <= 0)
 		return LIKE_TRUE;
@@ -153,28 +166,33 @@ MatchText(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 	 * start matching this pattern.
 	 */
 	return LIKE_ABORT;
-} /* MatchText() */
+}	/* MatchText() */
 
 static int
 MatchTextLower(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 {
-	/* Fast path for match-everything pattern
-	 * Include weird case of escape character as a percent sign or underscore,
-	 * when presumably that wildcard character becomes a literal.
+
+	/*
+	 * Fast path for match-everything pattern Include weird case of escape
+	 * character as a percent sign or underscore, when presumably that
+	 * wildcard character becomes a literal.
 	 */
 	if ((plen == 1) && (*p == '%')
-		&& ! ((e != NULL) && (*e == '%')))
+		&& !((e != NULL) && (*e == '%')))
 		return LIKE_TRUE;
 
 	while ((tlen > 0) && (plen > 0))
 	{
-		/* If an escape character was specified and we find it here in the pattern,
-		 * then we'd better have an exact match for the next character.
+
+		/*
+		 * If an escape character was specified and we find it here in the
+		 * pattern, then we'd better have an exact match for the next
+		 * character.
 		 */
-		if ((e != NULL) && ICHAREQ(p,e))
+		if ((e != NULL) && ICHAREQ(p, e))
 		{
 			NextChar(p, plen);
-			if ((plen <= 0) || !ICHAREQ(t,p))
+			if ((plen <= 0) || !ICHAREQ(t, p))
 				return LIKE_FALSE;
 		}
 		else if (*p == '%')
@@ -188,23 +206,23 @@ MatchTextLower(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 				return LIKE_TRUE;
 
 			/*
-			 * Otherwise, scan for a text position at which we can
-			 * match the rest of the pattern.
+			 * Otherwise, scan for a text position at which we can match
+			 * the rest of the pattern.
 			 */
 			while (tlen > 0)
 			{
+
 				/*
-				 * Optimization to prevent most recursion: don't
-				 * recurse unless first pattern char might match this
-				 * text char.
+				 * Optimization to prevent most recursion: don't recurse
+				 * unless first pattern char might match this text char.
 				 */
-				if (ICHAREQ(t,p) || (*p == '_')
-					|| ((e != NULL) && ICHAREQ(p,e)))
+				if (ICHAREQ(t, p) || (*p == '_')
+					|| ((e != NULL) && ICHAREQ(p, e)))
 				{
-					int matched = MatchText(t, tlen, p, plen, e);
+					int			matched = MatchText(t, tlen, p, plen, e);
 
 					if (matched != LIKE_FALSE)
-						return matched;		/* TRUE or ABORT */
+						return matched; /* TRUE or ABORT */
 				}
 
 				NextChar(t, tlen);
@@ -216,10 +234,8 @@ MatchTextLower(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 			 */
 			return LIKE_ABORT;
 		}
-		else if ((*p != '_') && !ICHAREQ(t,p))
-		{
+		else if ((*p != '_') && !ICHAREQ(t, p))
 			return LIKE_FALSE;
-		}
 
 		NextChar(t, tlen);
 		NextChar(p, plen);
@@ -229,7 +245,8 @@ MatchTextLower(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 		return LIKE_FALSE;		/* end of pattern, but not of text */
 
 	/* End of input string.  Do we have matching pattern remaining? */
-	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of pattern */
+	while ((plen > 0) && (*p == '%'))	/* allow multiple %'s at end of
+										 * pattern */
 		NextChar(p, plen);
 	if (plen <= 0)
 		return LIKE_TRUE;
@@ -239,14 +256,16 @@ MatchTextLower(PG_CHAR * t, int tlen, PG_CHAR * p, int plen, char *e)
 	 * start matching this pattern.
 	 */
 	return LIKE_ABORT;
-} /* MatchTextLower() */
+}	/* MatchTextLower() */
 
 main()
 {
 	unsigned char *t = "��Z01��";
 	unsigned char *p = "_Z%";
-	int tlen, plen;
+	int			tlen,
+				plen;
+
 	tlen = strlen(t);
 	plen = strlen(p);
-	printf("%d\n",MatchTextLower(t,tlen,p,plen,"\\"));
+	printf("%d\n", MatchTextLower(t, tlen, p, plen, "\\"));
 }
diff --git a/src/backend/utils/mb/palloc.c b/src/backend/utils/mb/palloc.c
index e547e7a79e521f0539f2bbbb697f2bcaf8183beb..3e1b70aae9aa9a703e18ed0908b76b58fb59d5cd 100644
--- a/src/backend/utils/mb/palloc.c
+++ b/src/backend/utils/mb/palloc.c
@@ -4,7 +4,7 @@
 void
 elog(int lev, const char *fmt,...)
 {
-  printf(fmt);
+	printf(fmt);
 }
 
 MemoryContext CurrentMemoryContext;
diff --git a/src/backend/utils/mb/utftest.c b/src/backend/utils/mb/utftest.c
index 5f0f7f9fb7efec4fa241b84ad4827f0d26b78580..4588e2699c9cf052b268952e7212ca29bfd68cbf 100644
--- a/src/backend/utils/mb/utftest.c
+++ b/src/backend/utils/mb/utftest.c
@@ -1,5 +1,5 @@
 /*
- * $Id: utftest.c,v 1.4 2000/10/12 06:06:50 ishii Exp $
+ * $Id: utftest.c,v 1.5 2001/03/22 04:00:05 momjian Exp $
  */
 #include "conv.c"
 #include "wchar.c"
@@ -49,5 +49,5 @@ main()
 	}
 	printf("\n");
 
-	return(0);
+	return (0);
 }
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
index 6d10cad020a35aee49f408d5a288d37a3f8a3a90..f3d91e963f3bda78bea1071fb6fbd7dfa7159d08 100644
--- a/src/backend/utils/mb/wchar.c
+++ b/src/backend/utils/mb/wchar.c
@@ -1,7 +1,7 @@
 /*
  * conversion functions between pg_wchar and multi-byte streams.
  * Tatsuo Ishii
- * $Id: wchar.c,v 1.16 2001/03/08 00:24:34 tgl Exp $
+ * $Id: wchar.c,v 1.17 2001/03/22 04:00:05 momjian Exp $
  *
  * WIN1250 client encoding updated by Pavel Behal
  *
@@ -22,10 +22,10 @@
 /*
  * SQL/ASCII
  */
-static int pg_ascii2wchar_with_len
+static int	pg_ascii2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -34,7 +34,7 @@ static int pg_ascii2wchar_with_len
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 static int
@@ -47,10 +47,10 @@ pg_ascii_mblen(const unsigned char *s)
  * EUC
  */
 
-static int pg_euc2wchar_with_len
+static int	pg_euc2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -82,7 +82,7 @@ static int pg_euc2wchar_with_len
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 static int
@@ -104,10 +104,10 @@ pg_euc_mblen(const unsigned char *s)
 /*
  * EUC_JP
  */
-static int pg_eucjp2wchar_with_len
+static int	pg_eucjp2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	return(pg_euc2wchar_with_len(from, to, len));
+	return (pg_euc2wchar_with_len(from, to, len));
 }
 
 static int
@@ -119,10 +119,10 @@ pg_eucjp_mblen(const unsigned char *s)
 /*
  * EUC_KR
  */
-static int pg_euckr2wchar_with_len
+static int	pg_euckr2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	return(pg_euc2wchar_with_len(from, to, len));
+	return (pg_euc2wchar_with_len(from, to, len));
 }
 
 static int
@@ -134,10 +134,10 @@ pg_euckr_mblen(const unsigned char *s)
 /*
  * EUC_CN
  */
-static int pg_euccn2wchar_with_len
+static int	pg_euccn2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -170,7 +170,7 @@ static int pg_euccn2wchar_with_len
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 static int
@@ -188,10 +188,10 @@ pg_euccn_mblen(const unsigned char *s)
 /*
  * EUC_TW
  */
-static int pg_euctw2wchar_with_len
+static int	pg_euctw2wchar_with_len
 			(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -225,7 +225,7 @@ static int pg_euctw2wchar_with_len
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 static int
@@ -256,7 +256,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 	unsigned char c1,
 				c2,
 				c3;
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -292,7 +292,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 /*
@@ -321,7 +321,7 @@ pg_utf_mblen(const unsigned char *s)
 static int
 pg_mule2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -362,7 +362,7 @@ pg_mule2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 int
@@ -391,7 +391,7 @@ pg_mule_mblen(const unsigned char *s)
 static int
 pg_latin12wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 {
-	int cnt = 0;
+	int			cnt = 0;
 
 	while (len > 0 && *from)
 	{
@@ -400,7 +400,7 @@ pg_latin12wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
 		cnt++;
 	}
 	*to = 0;
-	return(cnt);
+	return (cnt);
 }
 
 static int
@@ -496,7 +496,7 @@ pg_mic_mblen(const unsigned char *mbstr)
 	return (pg_mule_mblen(mbstr));
 }
 
-/* 
+/*
  * Returns the byte length of a multi-byte word.
  */
 int
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index 85f16fec3471a0a4b5d09593258c68df2f245947..5e14ef778bd4ad4512101419068aa6531c420d5e 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.43 2001/01/24 19:43:16 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.44 2001/03/22 04:00:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -149,7 +149,8 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
 	sprintf(dbfname, "%s/global/%s", DataDir, DatabaseRelationName);
 #else
 	{
-		RelFileNode	rnode;
+		RelFileNode rnode;
+
 		rnode.tblNode = 0;
 		rnode.relNode = RelOid_pg_database;
 		dbfname = relpath(rnode);
@@ -182,8 +183,8 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
 
 	while ((nbytes = read(dbfd, pg, BLCKSZ)) == BLCKSZ)
 	{
-		OffsetNumber	max = PageGetMaxOffsetNumber(pg);
-		OffsetNumber	lineoff;
+		OffsetNumber max = PageGetMaxOffsetNumber(pg);
+		OffsetNumber lineoff;
 
 		/* look at each tuple on the page */
 		for (lineoff = FirstOffsetNumber; lineoff <= max; lineoff++)
@@ -202,7 +203,7 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
 			 * Check to see if tuple is valid (committed).
 			 *
 			 * XXX warning, will robinson: violation of transaction semantics
-			 * happens right here.  We cannot really determine if the tuple
+			 * happens right here.	We cannot really determine if the tuple
 			 * is valid without checking transaction commit status, and the
 			 * only way to do that at init time is to paw over pg_log by hand,
 			 * too.  Instead of checking, we assume that the inserting
@@ -222,7 +223,7 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
 			 * handle the password relation?
 			 *--------------------
 			 */
-			if (! PhonyHeapTupleSatisfiesNow(tup.t_data))
+			if (!PhonyHeapTupleSatisfiesNow(tup.t_data))
 				continue;
 
 			/*
@@ -236,7 +237,7 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
 				*db_id = tup.t_data->t_oid;
 				pathlen = VARSIZE(&(tup_db->datpath)) - VARHDRSZ;
 				if (pathlen >= MAXPGPATH)
-					pathlen = MAXPGPATH-1; /* pure paranoia */
+					pathlen = MAXPGPATH - 1;	/* pure paranoia */
 				strncpy(path, VARDATA(&(tup_db->datpath)), pathlen);
 				path[pathlen] = '\0';
 				goto done;
@@ -257,7 +258,7 @@ done:
  * PhonyHeapTupleSatisfiesNow --- cut-down tuple time qual test
  *
  * This is a simplified version of HeapTupleSatisfiesNow() that does not
- * depend on having transaction commit info available.  Any transaction
+ * depend on having transaction commit info available.	Any transaction
  * that touched the tuple is assumed committed unless later marked invalid.
  * (While we could think about more complex rules, this seems appropriate
  * for examining pg_database, since both CREATE DATABASE and DROP DATABASE
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d05bb75a2944b6b6d9d547a061290eb0cd59afd5..feceb5d95002edf24e9e359ea8f5413fdfe07513 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4,7 +4,7 @@
  * Support for grand unified configuration scheme, including SET
  * command, configuration file, and command line options.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.33 2001/03/16 05:44:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.34 2001/03/22 04:00:06 momjian Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -36,39 +36,42 @@
 
 /* XXX these should be in other modules' header files */
 extern bool Log_connections;
-extern int CheckPointTimeout;
-extern int CommitDelay;
-extern int CommitSiblings;
+extern int	CheckPointTimeout;
+extern int	CommitDelay;
+extern int	CommitSiblings;
 extern bool FixBTree;
 
 #ifdef ENABLE_SYSLOG
 extern char *Syslog_facility;
 extern char *Syslog_ident;
 static bool check_facility(const char *facility);
+
 #endif
 
 /*
  * Debugging options
  */
 #ifdef USE_ASSERT_CHECKING
-bool assert_enabled         = true;
+bool		assert_enabled = true;
+
 #endif
-bool Debug_print_query      = false;
-bool Debug_print_plan       = false;
-bool Debug_print_parse      = false;
-bool Debug_print_rewritten  = false;
-bool Debug_pretty_print     = false;
+bool		Debug_print_query = false;
+bool		Debug_print_plan = false;
+bool		Debug_print_parse = false;
+bool		Debug_print_rewritten = false;
+bool		Debug_pretty_print = false;
 
-bool Show_parser_stats      = false;
-bool Show_planner_stats     = false;
-bool Show_executor_stats    = false;
-bool Show_query_stats       = false; /* this is sort of all three above together */
-bool Show_btree_build_stats = false;
+bool		Show_parser_stats = false;
+bool		Show_planner_stats = false;
+bool		Show_executor_stats = false;
+bool		Show_query_stats = false;	/* this is sort of all three above
+										 * together */
+bool		Show_btree_build_stats = false;
 
-bool SQL_inheritance        = true;
+bool		SQL_inheritance = true;
 
 #ifndef PG_KRB_SRVTAB
-# define PG_KRB_SRVTAB ""
+#define PG_KRB_SRVTAB ""
 #endif
 
 
@@ -86,39 +89,39 @@ enum config_type
 struct config_generic
 {
 	const char *name;
-	GucContext  context;
-	void       *variable;
+	GucContext	context;
+	void	   *variable;
 };
 
 
 struct config_bool
 {
 	const char *name;
-	GucContext  context;
-	bool       *variable;
-	bool        default_val;
+	GucContext	context;
+	bool	   *variable;
+	bool		default_val;
 };
 
 
 struct config_int
 {
 	const char *name;
-	GucContext  context;
-	int        *variable;
-	int         default_val;
-	int         min;
-	int         max;
+	GucContext	context;
+	int		   *variable;
+	int			default_val;
+	int			min;
+	int			max;
 };
 
 
 struct config_real
 {
 	const char *name;
-	GucContext  context;
-	double     *variable;
-	double      default_val;
-	double      min;
-	double      max;
+	GucContext	context;
+	double	   *variable;
+	double		default_val;
+	double		min;
+	double		max;
 };
 
 /*
@@ -130,11 +133,11 @@ struct config_real
 struct config_string
 {
 	const char *name;
-	GucContext  context;
-	char      **variable;
+	GucContext	context;
+	char	  **variable;
 	const char *default_val;
-	bool       (*parse_hook)(const char *proposed);
-	void       (*assign_hook)(const char *newval);
+	bool		(*parse_hook) (const char *proposed);
+	void		(*assign_hook) (const char *newval);
 };
 
 
@@ -164,189 +167,189 @@ struct config_string
 /******** option names follow ********/
 
 static struct config_bool
-ConfigureNamesBool[] =
+			ConfigureNamesBool[] =
 {
-	{"enable_seqscan",          PGC_USERSET,    &enable_seqscan,        true},
-	{"enable_indexscan",        PGC_USERSET,    &enable_indexscan,      true},
-	{"enable_tidscan",          PGC_USERSET,    &enable_tidscan,        true},
-	{"enable_sort",             PGC_USERSET,    &enable_sort,           true},
-	{"enable_nestloop",         PGC_USERSET,    &enable_nestloop,       true},
-	{"enable_mergejoin",        PGC_USERSET,    &enable_mergejoin,      true},
-	{"enable_hashjoin",         PGC_USERSET,    &enable_hashjoin,       true},
-
-	{"ksqo",                    PGC_USERSET,    &_use_keyset_query_optimizer, false},
-	{"geqo",                    PGC_USERSET,    &enable_geqo,           true},
-
-	{"tcpip_socket",            PGC_POSTMASTER, &NetServer,             false},
-	{"ssl",                     PGC_POSTMASTER, &EnableSSL,             false},
-	{"fsync",                   PGC_SIGHUP,     &enableFsync,           true},
-	{"silent_mode",             PGC_POSTMASTER, &SilentMode,            false},
-
-	{"log_connections",         PGC_SIGHUP,     &Log_connections,       false},
-	{"log_timestamp",           PGC_SIGHUP,     &Log_timestamp,         false},
-	{"log_pid",                 PGC_SIGHUP,     &Log_pid,               false},
+	{"enable_seqscan", PGC_USERSET, &enable_seqscan, true},
+	{"enable_indexscan", PGC_USERSET, &enable_indexscan, true},
+	{"enable_tidscan", PGC_USERSET, &enable_tidscan, true},
+	{"enable_sort", PGC_USERSET, &enable_sort, true},
+	{"enable_nestloop", PGC_USERSET, &enable_nestloop, true},
+	{"enable_mergejoin", PGC_USERSET, &enable_mergejoin, true},
+	{"enable_hashjoin", PGC_USERSET, &enable_hashjoin, true},
+
+	{"ksqo", PGC_USERSET, &_use_keyset_query_optimizer, false},
+	{"geqo", PGC_USERSET, &enable_geqo, true},
+
+	{"tcpip_socket", PGC_POSTMASTER, &NetServer, false},
+	{"ssl", PGC_POSTMASTER, &EnableSSL, false},
+	{"fsync", PGC_SIGHUP, &enableFsync, true},
+	{"silent_mode", PGC_POSTMASTER, &SilentMode, false},
+
+	{"log_connections", PGC_SIGHUP, &Log_connections, false},
+	{"log_timestamp", PGC_SIGHUP, &Log_timestamp, false},
+	{"log_pid", PGC_SIGHUP, &Log_pid, false},
 
 #ifdef USE_ASSERT_CHECKING
-	{"debug_assertions",        PGC_USERSET,    &assert_enabled,        true},
+	{"debug_assertions", PGC_USERSET, &assert_enabled, true},
 #endif
 
-	{"debug_print_query",       PGC_USERSET,    &Debug_print_query,     false},
-	{"debug_print_parse",       PGC_USERSET,    &Debug_print_parse,     false},
-	{"debug_print_rewritten",   PGC_USERSET,    &Debug_print_rewritten, false},
-	{"debug_print_plan",        PGC_USERSET,    &Debug_print_plan,      false},
-	{"debug_pretty_print",      PGC_USERSET,    &Debug_pretty_print,    false},
+	{"debug_print_query", PGC_USERSET, &Debug_print_query, false},
+	{"debug_print_parse", PGC_USERSET, &Debug_print_parse, false},
+	{"debug_print_rewritten", PGC_USERSET, &Debug_print_rewritten, false},
+	{"debug_print_plan", PGC_USERSET, &Debug_print_plan, false},
+	{"debug_pretty_print", PGC_USERSET, &Debug_pretty_print, false},
 
-	{"show_parser_stats",       PGC_USERSET,    &Show_parser_stats,     false},
-	{"show_planner_stats",      PGC_USERSET,    &Show_planner_stats,    false},
-	{"show_executor_stats",     PGC_USERSET,    &Show_executor_stats,   false},
-	{"show_query_stats",        PGC_USERSET,    &Show_query_stats,      false},
+	{"show_parser_stats", PGC_USERSET, &Show_parser_stats, false},
+	{"show_planner_stats", PGC_USERSET, &Show_planner_stats, false},
+	{"show_executor_stats", PGC_USERSET, &Show_executor_stats, false},
+	{"show_query_stats", PGC_USERSET, &Show_query_stats, false},
 #ifdef BTREE_BUILD_STATS
-	{"show_btree_build_stats",  PGC_SUSET,      &Show_btree_build_stats, false},
+	{"show_btree_build_stats", PGC_SUSET, &Show_btree_build_stats, false},
 #endif
 
-	{"trace_notify",            PGC_USERSET,    &Trace_notify,          false},
+	{"trace_notify", PGC_USERSET, &Trace_notify, false},
 
 #ifdef LOCK_DEBUG
-	{"trace_locks",             PGC_SUSET,      &Trace_locks,           false},
-	{"trace_userlocks",         PGC_SUSET,      &Trace_userlocks,       false},
-	{"trace_spinlocks",         PGC_SUSET,      &Trace_spinlocks,       false},
-	{"debug_deadlocks",         PGC_SUSET,      &Debug_deadlocks,       false},
+	{"trace_locks", PGC_SUSET, &Trace_locks, false},
+	{"trace_userlocks", PGC_SUSET, &Trace_userlocks, false},
+	{"trace_spinlocks", PGC_SUSET, &Trace_spinlocks, false},
+	{"debug_deadlocks", PGC_SUSET, &Debug_deadlocks, false},
 #endif
 
-	{"hostname_lookup",         PGC_SIGHUP,     &HostnameLookup,        false},
-	{"show_source_port",        PGC_SIGHUP,     &ShowPortNumber,        false},
+	{"hostname_lookup", PGC_SIGHUP, &HostnameLookup, false},
+	{"show_source_port", PGC_SIGHUP, &ShowPortNumber, false},
 
-	{"sql_inheritance",         PGC_USERSET,    &SQL_inheritance,       true},
+	{"sql_inheritance", PGC_USERSET, &SQL_inheritance, true},
 
-	{"fixbtree",                PGC_POSTMASTER, &FixBTree,              true},
+	{"fixbtree", PGC_POSTMASTER, &FixBTree, true},
 
 	{NULL, 0, NULL, false}
 };
 
 
 static struct config_int
-ConfigureNamesInt[] =
+			ConfigureNamesInt[] =
 {
-	{"geqo_threshold",          PGC_USERSET,            &geqo_rels,
-	 DEFAULT_GEQO_RELS, 2, INT_MAX},
-	{"geqo_pool_size",          PGC_USERSET,            &Geqo_pool_size,
-	 DEFAULT_GEQO_POOL_SIZE, 0, MAX_GEQO_POOL_SIZE},
-	{"geqo_effort",             PGC_USERSET,            &Geqo_effort,
-	 1, 1, INT_MAX},
-	{"geqo_generations",        PGC_USERSET,            &Geqo_generations,
-	 0, 0, INT_MAX},
-	{"geqo_random_seed",        PGC_USERSET,            &Geqo_random_seed,
-	 -1, INT_MIN, INT_MAX},
-
-	{"deadlock_timeout",        PGC_POSTMASTER,         &DeadlockTimeout,
-	 1000, 0, INT_MAX},
+	{"geqo_threshold", PGC_USERSET, &geqo_rels,
+	DEFAULT_GEQO_RELS, 2, INT_MAX},
+	{"geqo_pool_size", PGC_USERSET, &Geqo_pool_size,
+	DEFAULT_GEQO_POOL_SIZE, 0, MAX_GEQO_POOL_SIZE},
+	{"geqo_effort", PGC_USERSET, &Geqo_effort,
+	1, 1, INT_MAX},
+	{"geqo_generations", PGC_USERSET, &Geqo_generations,
+	0, 0, INT_MAX},
+	{"geqo_random_seed", PGC_USERSET, &Geqo_random_seed,
+	-1, INT_MIN, INT_MAX},
+
+	{"deadlock_timeout", PGC_POSTMASTER, &DeadlockTimeout,
+	1000, 0, INT_MAX},
 
 #ifdef ENABLE_SYSLOG
-	{"syslog",                  PGC_SIGHUP,             &Use_syslog,
-	 0, 0, 2},
+	{"syslog", PGC_SIGHUP, &Use_syslog,
+	0, 0, 2},
 #endif
 
 	/*
-	 * Note: There is some postprocessing done in PostmasterMain() to
-	 * make sure the buffers are at least twice the number of
-	 * backends, so the constraints here are partially unused.
+	 * Note: There is some postprocessing done in PostmasterMain() to make
+	 * sure the buffers are at least twice the number of backends, so the
+	 * constraints here are partially unused.
 	 */
-	{"max_connections",         PGC_POSTMASTER,         &MaxBackends,
-	 DEF_MAXBACKENDS, 1, MAXBACKENDS},
-	{"shared_buffers",          PGC_POSTMASTER,         &NBuffers,
-	 DEF_NBUFFERS, 16, INT_MAX},
-	{"port",                    PGC_POSTMASTER,         &PostPortNumber,
-	 DEF_PGPORT, 1, 65535},
+	{"max_connections", PGC_POSTMASTER, &MaxBackends,
+	DEF_MAXBACKENDS, 1, MAXBACKENDS},
+	{"shared_buffers", PGC_POSTMASTER, &NBuffers,
+	DEF_NBUFFERS, 16, INT_MAX},
+	{"port", PGC_POSTMASTER, &PostPortNumber,
+	DEF_PGPORT, 1, 65535},
 
-	{"sort_mem",                PGC_USERSET,            &SortMem,
-	 512, 1, INT_MAX},
+	{"sort_mem", PGC_USERSET, &SortMem,
+	512, 1, INT_MAX},
 
-	{"debug_level",             PGC_USERSET,            &DebugLvl,
-	 0, 0, 16},
+	{"debug_level", PGC_USERSET, &DebugLvl,
+	0, 0, 16},
 
 #ifdef LOCK_DEBUG
-	{"trace_lock_oidmin",       PGC_SUSET,              &Trace_lock_oidmin,
-	 BootstrapObjectIdData, 1, INT_MAX},
-	{"trace_lock_table",        PGC_SUSET,              &Trace_lock_table,
-	 0, 0, INT_MAX},
+	{"trace_lock_oidmin", PGC_SUSET, &Trace_lock_oidmin,
+	BootstrapObjectIdData, 1, INT_MAX},
+	{"trace_lock_table", PGC_SUSET, &Trace_lock_table,
+	0, 0, INT_MAX},
 #endif
-	{"max_expr_depth",          PGC_USERSET,            &max_expr_depth,
-	 DEFAULT_MAX_EXPR_DEPTH, 10, INT_MAX},
+	{"max_expr_depth", PGC_USERSET, &max_expr_depth,
+	DEFAULT_MAX_EXPR_DEPTH, 10, INT_MAX},
 
-	{"unix_socket_permissions", PGC_POSTMASTER,         &Unix_socket_permissions,
-	 0777, 0000, 0777},
+	{"unix_socket_permissions", PGC_POSTMASTER, &Unix_socket_permissions,
+	0777, 0000, 0777},
 
-	{"checkpoint_segments",	PGC_SIGHUP,				&CheckPointSegments,
-	 3, 1, INT_MAX},
+	{"checkpoint_segments", PGC_SIGHUP, &CheckPointSegments,
+	3, 1, INT_MAX},
 
-	{"checkpoint_timeout",	PGC_SIGHUP,				&CheckPointTimeout,
-	 300, 30, 3600},
+	{"checkpoint_timeout", PGC_SIGHUP, &CheckPointTimeout,
+	300, 30, 3600},
 
-	{"wal_buffers",			PGC_POSTMASTER,			&XLOGbuffers,
-	 8, 4, INT_MAX},
+	{"wal_buffers", PGC_POSTMASTER, &XLOGbuffers,
+	8, 4, INT_MAX},
 
-	{"wal_files",			PGC_SIGHUP,				&XLOGfiles,
-	 0, 0, 64},
+	{"wal_files", PGC_SIGHUP, &XLOGfiles,
+	0, 0, 64},
 
-	{"wal_debug",			PGC_SUSET,				&XLOG_DEBUG,
-	 0, 0, 16},
+	{"wal_debug", PGC_SUSET, &XLOG_DEBUG,
+	0, 0, 16},
 
-	{"commit_delay",		PGC_USERSET,			&CommitDelay,
-	 0, 0, 100000},
+	{"commit_delay", PGC_USERSET, &CommitDelay,
+	0, 0, 100000},
 
-	{"commit_siblings",		PGC_USERSET,			&CommitSiblings,
-	 5, 1, 1000},
+	{"commit_siblings", PGC_USERSET, &CommitSiblings,
+	5, 1, 1000},
 
 	{NULL, 0, NULL, 0, 0, 0}
 };
 
 
 static struct config_real
-ConfigureNamesReal[] =
+			ConfigureNamesReal[] =
 {
-	{"effective_cache_size",      PGC_USERSET,          &effective_cache_size,
-	 DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX},
-	{"random_page_cost",          PGC_USERSET,          &random_page_cost,
-	 DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX},
-	{"cpu_tuple_cost",            PGC_USERSET,          &cpu_tuple_cost,
-	 DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX},
-	{"cpu_index_tuple_cost",      PGC_USERSET,          &cpu_index_tuple_cost,
-	 DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX},
-	{"cpu_operator_cost",         PGC_USERSET,          &cpu_operator_cost,
-	 DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX},
-
-	{"geqo_selection_bias",       PGC_USERSET,          &Geqo_selection_bias,
-	 DEFAULT_GEQO_SELECTION_BIAS,   MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS},
+	{"effective_cache_size", PGC_USERSET, &effective_cache_size,
+	DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX},
+	{"random_page_cost", PGC_USERSET, &random_page_cost,
+	DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX},
+	{"cpu_tuple_cost", PGC_USERSET, &cpu_tuple_cost,
+	DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX},
+	{"cpu_index_tuple_cost", PGC_USERSET, &cpu_index_tuple_cost,
+	DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX},
+	{"cpu_operator_cost", PGC_USERSET, &cpu_operator_cost,
+	DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX},
+
+	{"geqo_selection_bias", PGC_USERSET, &Geqo_selection_bias,
+	DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS},
 
 	{NULL, 0, NULL, 0.0, 0.0, 0.0}
 };
 
 
 static struct config_string
-ConfigureNamesString[] =
+			ConfigureNamesString[] =
 {
-	{"krb_server_keyfile",        PGC_POSTMASTER,       &pg_krb_server_keyfile,
-	 PG_KRB_SRVTAB, NULL, NULL},
+	{"krb_server_keyfile", PGC_POSTMASTER, &pg_krb_server_keyfile,
+	PG_KRB_SRVTAB, NULL, NULL},
 
 #ifdef ENABLE_SYSLOG
-	{"syslog_facility",           PGC_POSTMASTER,	    &Syslog_facility,
+	{"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
 	"LOCAL0", check_facility, NULL},
-	{"syslog_ident",              PGC_POSTMASTER,	    &Syslog_ident,
+	{"syslog_ident", PGC_POSTMASTER, &Syslog_ident,
 	"postgres", NULL, NULL},
 #endif
 
-	{"unix_socket_group",         PGC_POSTMASTER,       &Unix_socket_group,
-	 "", NULL, NULL},
+	{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
+	"", NULL, NULL},
 
-	{"unix_socket_directory",	  PGC_POSTMASTER,       &UnixSocketDir,
-	 "", NULL, NULL},
+	{"unix_socket_directory", PGC_POSTMASTER, &UnixSocketDir,
+	"", NULL, NULL},
 
-	{"virtual_host",			  PGC_POSTMASTER,		&VirtualHost,
-	 "", NULL, NULL},
+	{"virtual_host", PGC_POSTMASTER, &VirtualHost,
+	"", NULL, NULL},
 
-	{"wal_sync_method",			  PGC_SIGHUP,			&XLOG_sync_method,
-	 XLOG_sync_method_default,
-	 check_xlog_sync_method, assign_xlog_sync_method},
+	{"wal_sync_method", PGC_SIGHUP, &XLOG_sync_method,
+		XLOG_sync_method_default,
+	check_xlog_sync_method, assign_xlog_sync_method},
 
 	{NULL, 0, NULL, NULL, NULL, NULL}
 };
@@ -361,41 +364,41 @@ ConfigureNamesString[] =
  * the option there.
  */
 static enum config_type
-find_option(const char * name, struct config_generic ** record)
+find_option(const char *name, struct config_generic ** record)
 {
-	int i;
+	int			i;
 
 	Assert(name);
 
 	for (i = 0; ConfigureNamesBool[i].name; i++)
-		if (strcasecmp(ConfigureNamesBool[i].name, name)==0)
+		if (strcasecmp(ConfigureNamesBool[i].name, name) == 0)
 		{
 			if (record)
-				*record = (struct config_generic *)&ConfigureNamesBool[i];
+				*record = (struct config_generic *) & ConfigureNamesBool[i];
 			return PGC_BOOL;
 		}
 
 	for (i = 0; ConfigureNamesInt[i].name; i++)
-		if (strcasecmp(ConfigureNamesInt[i].name, name)==0)
+		if (strcasecmp(ConfigureNamesInt[i].name, name) == 0)
 		{
 			if (record)
-				*record = (struct config_generic *)&ConfigureNamesInt[i];
+				*record = (struct config_generic *) & ConfigureNamesInt[i];
 			return PGC_INT;
 		}
 
 	for (i = 0; ConfigureNamesReal[i].name; i++)
-		if (strcasecmp(ConfigureNamesReal[i].name, name)==0)
+		if (strcasecmp(ConfigureNamesReal[i].name, name) == 0)
 		{
 			if (record)
-				*record = (struct config_generic *)&ConfigureNamesReal[i];
+				*record = (struct config_generic *) & ConfigureNamesReal[i];
 			return PGC_REAL;
 		}
 
 	for (i = 0; ConfigureNamesString[i].name; i++)
-		if (strcasecmp(ConfigureNamesString[i].name, name)==0)
+		if (strcasecmp(ConfigureNamesString[i].name, name) == 0)
 		{
 			if (record)
-				*record = (struct config_generic *)&ConfigureNamesString[i];
+				*record = (struct config_generic *) & ConfigureNamesString[i];
 			return PGC_STRING;
 		}
 
@@ -411,7 +414,7 @@ find_option(const char * name, struct config_generic ** record)
 void
 ResetAllOptions(void)
 {
-	int i;
+	int			i;
 
 	for (i = 0; ConfigureNamesBool[i].name; i++)
 		*(ConfigureNamesBool[i].variable) = ConfigureNamesBool[i].default_val;
@@ -424,7 +427,7 @@ ResetAllOptions(void)
 
 	for (i = 0; ConfigureNamesString[i].name; i++)
 	{
-		char * str = NULL;
+		char	   *str = NULL;
 
 		if (ConfigureNamesString[i].default_val)
 		{
@@ -448,49 +451,49 @@ ResetAllOptions(void)
  * there.
  */
 static bool
-parse_bool(const char * value, bool * result)
+parse_bool(const char *value, bool *result)
 {
-	size_t len = strlen(value);
+	size_t		len = strlen(value);
 
-	if (strncasecmp(value, "true", len)==0)
+	if (strncasecmp(value, "true", len) == 0)
 	{
 		if (result)
 			*result = true;
 	}
-	else if (strncasecmp(value, "false", len)==0)
+	else if (strncasecmp(value, "false", len) == 0)
 	{
 		if (result)
 			*result = false;
 	}
 
-	else if (strncasecmp(value, "yes", len)==0)
+	else if (strncasecmp(value, "yes", len) == 0)
 	{
 		if (result)
 			*result = true;
 	}
-	else if (strncasecmp(value, "no", len)==0)
+	else if (strncasecmp(value, "no", len) == 0)
 	{
 		if (result)
 			*result = false;
 	}
 
-	else if (strcasecmp(value, "on")==0)
+	else if (strcasecmp(value, "on") == 0)
 	{
 		if (result)
 			*result = true;
 	}
-	else if (strcasecmp(value, "off")==0)
+	else if (strcasecmp(value, "off") == 0)
 	{
 		if (result)
 			*result = false;
 	}
 
-	else if (strcasecmp(value, "1")==0)
+	else if (strcasecmp(value, "1") == 0)
 	{
 		if (result)
 			*result = true;
 	}
-	else if (strcasecmp(value, "0")==0)
+	else if (strcasecmp(value, "0") == 0)
 	{
 		if (result)
 			*result = false;
@@ -510,17 +513,17 @@ parse_bool(const char * value, bool * result)
  * value there.
  */
 static bool
-parse_int(const char * value, int * result)
+parse_int(const char *value, int *result)
 {
-	long val;
-	char * endptr;
+	long		val;
+	char	   *endptr;
 
 	errno = 0;
 	val = strtol(value, &endptr, 0);
 	if (endptr == value || *endptr != '\0' || errno == ERANGE)
 		return false;
 	if (result)
-		*result = (int)val;
+		*result = (int) val;
 	return true;
 }
 
@@ -528,14 +531,14 @@ parse_int(const char * value, int * result)
 
 /*
  * Try to parse value as a floating point constant in the usual
- * format.  If the value parsed okay return true, else false.  If
+ * format.	If the value parsed okay return true, else false.  If
  * result is not NULL, return the semantic value there.
  */
 static bool
-parse_real(const char * value, double * result)
+parse_real(const char *value, double *result)
 {
-	double val;
-	char * endptr;
+	double		val;
+	char	   *endptr;
 
 	errno = 0;
 	val = strtod(value, &endptr);
@@ -569,12 +572,12 @@ parse_real(const char * value, double * result)
  * See also SetConfigOption for an external interface.
  */
 bool
-set_config_option(const char * name, const char * value, GucContext
+set_config_option(const char *name, const char *value, GucContext
 				  context, bool DoIt)
 {
-	struct config_generic * record;
+	struct config_generic *record;
 	enum config_type type;
-	int elevel;
+	int			elevel;
 
 	elevel = (context == PGC_SIGHUP) ? DEBUG : ERROR;
 
@@ -587,8 +590,8 @@ set_config_option(const char * name, const char * value, GucContext
 
 	/*
 	 * Check if the option can be set at this time. See guc.h for the
-	 * precise rules. Note that we don't want to throw errors if we're
-	 * in the SIGHUP context. In that case we just ignore the attempt.
+	 * precise rules. Note that we don't want to throw errors if we're in
+	 * the SIGHUP context. In that case we just ignore the attempt.
 	 */
 	if (record->context == PGC_POSTMASTER && context != PGC_POSTMASTER)
 	{
@@ -601,10 +604,13 @@ set_config_option(const char * name, const char * value, GucContext
 			 context != PGC_POSTMASTER)
 	{
 		elog(ERROR, "'%s' cannot be changed now", name);
-		/* Hmm, the idea of the SIGHUP context is "ought to be global,
-		 * but can be changed after postmaster start". But there's
-		 * nothing that prevents a crafty administrator from sending
-		 * SIGHUP signals to individual backends only. */
+
+		/*
+		 * Hmm, the idea of the SIGHUP context is "ought to be global, but
+		 * can be changed after postmaster start". But there's nothing
+		 * that prevents a crafty administrator from sending SIGHUP
+		 * signals to individual backends only.
+		 */
 	}
 	else if (record->context == PGC_BACKEND && context != PGC_BACKEND
 			 && context != PGC_POSTMASTER)
@@ -616,140 +622,139 @@ set_config_option(const char * name, const char * value, GucContext
 	}
 	else if (record->context == PGC_SUSET && (context == PGC_USERSET
 											  || context == PGC_BACKEND))
-	{
 		elog(ERROR, "permission denied");
-	}
 
 
 	/*
 	 * Evaluate value and set variable
 	 */
-	switch(type)
+	switch (type)
 	{
 		case PGC_BOOL:
-		{
-			struct config_bool * conf = (struct config_bool *)record;
-
-			if (value)
 			{
-				bool boolval;
-				if (!parse_bool(value, &boolval))
+				struct config_bool *conf = (struct config_bool *) record;
+
+				if (value)
 				{
-					elog(elevel, "option '%s' requires a boolean value", name);
-					return false;
+					bool		boolval;
+
+					if (!parse_bool(value, &boolval))
+					{
+						elog(elevel, "option '%s' requires a boolean value", name);
+						return false;
+					}
+					if (DoIt)
+						*conf->variable = boolval;
 				}
-				if (DoIt)
-					*conf->variable = boolval;
+				else if (DoIt)
+					*conf->variable = conf->default_val;
+				break;
 			}
-			else if (DoIt)
-				*conf->variable = conf->default_val;
-			break;
-		}
 
 		case PGC_INT:
-		{
-			struct config_int * conf = (struct config_int *)record;
-
-			if (value)
 			{
-				int intval;
+				struct config_int *conf = (struct config_int *) record;
 
-				if (!parse_int(value, &intval))
-				{
-					elog(elevel, "option '%s' expects an integer value", name);
-					return false;
-				}
-				if (intval < conf->min || intval > conf->max)
+				if (value)
 				{
-					elog(elevel, "option '%s' value %d is outside"
-						 " of permissible range [%d .. %d]",
-						 name, intval, conf->min, conf->max);
-					return false;
+					int			intval;
+
+					if (!parse_int(value, &intval))
+					{
+						elog(elevel, "option '%s' expects an integer value", name);
+						return false;
+					}
+					if (intval < conf->min || intval > conf->max)
+					{
+						elog(elevel, "option '%s' value %d is outside"
+							 " of permissible range [%d .. %d]",
+							 name, intval, conf->min, conf->max);
+						return false;
+					}
+					if (DoIt)
+						*conf->variable = intval;
 				}
-				if (DoIt)
-					*conf->variable = intval;
+				else if (DoIt)
+					*conf->variable = conf->default_val;
+				break;
 			}
-			else if (DoIt)
-				*conf->variable = conf->default_val;
-			break;
-		}
 
 		case PGC_REAL:
-		{
-			struct config_real * conf = (struct config_real *)record;
-
-			if (value)
 			{
-				double dval;
+				struct config_real *conf = (struct config_real *) record;
 
-				if (!parse_real(value, &dval))
+				if (value)
 				{
-					elog(elevel, "option '%s' expects a real number", name);
-					return false;
-				}
-				if (dval < conf->min || dval > conf->max)
-				{
-					elog(elevel, "option '%s' value %g is outside"
-						 " of permissible range [%g .. %g]",
-						 name, dval, conf->min, conf->max);
-					return false;
+					double		dval;
+
+					if (!parse_real(value, &dval))
+					{
+						elog(elevel, "option '%s' expects a real number", name);
+						return false;
+					}
+					if (dval < conf->min || dval > conf->max)
+					{
+						elog(elevel, "option '%s' value %g is outside"
+							 " of permissible range [%g .. %g]",
+							 name, dval, conf->min, conf->max);
+						return false;
+					}
+					if (DoIt)
+						*conf->variable = dval;
 				}
-				if (DoIt)
-					*conf->variable = dval;
+				else if (DoIt)
+					*conf->variable = conf->default_val;
+				break;
 			}
-			else if (DoIt)
-				*conf->variable = conf->default_val;
-			break;
-		}
 
 		case PGC_STRING:
-		{
-			struct config_string * conf = (struct config_string *)record;
-
-			if (value)
 			{
-				if (conf->parse_hook && !(conf->parse_hook)(value))
+				struct config_string *conf = (struct config_string *) record;
+
+				if (value)
 				{
-					elog(elevel, "invalid value for option '%s': '%s'", name, value);
-					return false;
+					if (conf->parse_hook && !(conf->parse_hook) (value))
+					{
+						elog(elevel, "invalid value for option '%s': '%s'", name, value);
+						return false;
+					}
+					if (DoIt)
+					{
+						char	   *str;
+
+						str = strdup(value);
+						if (str == NULL)
+						{
+							elog(elevel, "out of memory");
+							return false;
+						}
+						if (conf->assign_hook)
+							(conf->assign_hook) (str);
+						if (*conf->variable)
+							free(*conf->variable);
+						*conf->variable = str;
+					}
 				}
-				if (DoIt)
+				else if (DoIt)
 				{
-					char * str;
+					char	   *str;
 
-					str = strdup(value);
+					str = strdup(conf->default_val);
 					if (str == NULL)
 					{
 						elog(elevel, "out of memory");
 						return false;
 					}
 					if (conf->assign_hook)
-						(conf->assign_hook)(str);
+						(conf->assign_hook) (str);
 					if (*conf->variable)
 						free(*conf->variable);
 					*conf->variable = str;
 				}
+				break;
 			}
-			else if (DoIt)
-			{
-				char * str;
 
-				str = strdup(conf->default_val);
-				if (str == NULL)
-				{
-					elog(elevel, "out of memory");
-					return false;
-				}
-				if (conf->assign_hook)
-					(conf->assign_hook)(str);
-				if (*conf->variable)
-					free(*conf->variable);
-				*conf->variable = str;
-			}
-			break;
-		}
-
-		default: ;
+		default:;
 	}
 	return true;
 }
@@ -761,10 +766,10 @@ set_config_option(const char * name, const char * value, GucContext
  * this is just the wrapper to be called from the outside.
  */
 void
-SetConfigOption(const char * name, const char * value, GucContext
+SetConfigOption(const char *name, const char *value, GucContext
 				context)
 {
-	(void)set_config_option(name, value, context, true);
+	(void) set_config_option(name, value, context, true);
 }
 
 
@@ -780,9 +785,9 @@ SetConfigOption(const char * name, const char * value, GucContext
  * valid until the next call to configuration related functions.
  */
 const char *
-GetConfigOption(const char * name)
+GetConfigOption(const char *name)
 {
-	struct config_generic * record;
+	struct config_generic *record;
 	static char buffer[256];
 	enum config_type opttype;
 
@@ -790,21 +795,21 @@ GetConfigOption(const char * name)
 	if (opttype == PGC_NONE)
 		elog(ERROR, "Option '%s' is not recognized", name);
 
-	switch(opttype)
+	switch (opttype)
 	{
 		case PGC_BOOL:
-			return *((struct config_bool *)record)->variable ? "on" : "off";
+			return *((struct config_bool *) record)->variable ? "on" : "off";
 
 		case PGC_INT:
-			snprintf(buffer, 256, "%d", *((struct config_int *)record)->variable);
+			snprintf(buffer, 256, "%d", *((struct config_int *) record)->variable);
 			return buffer;
 
 		case PGC_REAL:
-			snprintf(buffer, 256, "%g", *((struct config_real *)record)->variable);
+			snprintf(buffer, 256, "%g", *((struct config_real *) record)->variable);
 			return buffer;
 
 		case PGC_STRING:
-			return *((struct config_string *)record)->variable;
+			return *((struct config_string *) record)->variable;
 
 		default:
 			;
@@ -822,10 +827,10 @@ GetConfigOption(const char * name)
  * there is no '=' in the input string then value will be NULL.
  */
 void
-ParseLongOption(const char * string, char ** name, char ** value)
+ParseLongOption(const char *string, char **name, char **value)
 {
-	size_t equal_pos;
-	char *cp;
+	size_t		equal_pos;
+	char	   *cp;
 
 	AssertArg(string);
 	AssertArg(name);
@@ -845,7 +850,8 @@ ParseLongOption(const char * string, char ** name, char ** value)
 		if (!*value)
 			elog(FATAL, "out of memory");
 	}
-	else						/* no equal sign in string */
+	else
+/* no equal sign in string */
 	{
 		*name = strdup(string);
 		if (!*name)
@@ -853,7 +859,7 @@ ParseLongOption(const char * string, char ** name, char ** value)
 		*value = NULL;
 	}
 
-	for(cp = *name; *cp; cp++)
+	for (cp = *name; *cp; cp++)
 		if (*cp == '-')
 			*cp = '_';
 }
@@ -864,14 +870,23 @@ ParseLongOption(const char * string, char ** name, char ** value)
 static bool
 check_facility(const char *facility)
 {
-	if (strcasecmp(facility,"LOCAL0") == 0) return true;
-	if (strcasecmp(facility,"LOCAL1") == 0) return true;
-	if (strcasecmp(facility,"LOCAL2") == 0) return true;
-	if (strcasecmp(facility,"LOCAL3") == 0) return true;
-	if (strcasecmp(facility,"LOCAL4") == 0) return true;
-	if (strcasecmp(facility,"LOCAL5") == 0) return true;
-	if (strcasecmp(facility,"LOCAL6") == 0) return true;
-	if (strcasecmp(facility,"LOCAL7") == 0) return true;
+	if (strcasecmp(facility, "LOCAL0") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL1") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL2") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL3") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL4") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL5") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL6") == 0)
+		return true;
+	if (strcasecmp(facility, "LOCAL7") == 0)
+		return true;
 	return false;
 }
+
 #endif
diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index a977ee11ed4800234ccd7273a42fccbd6877b072..4eb49fbeb64c9c8c4188e7f3ac1bd7563b7bfe63 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -5,7 +5,7 @@
  * to contain some useful information. Differs wildly across
  * platforms.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.3 2001/03/20 22:31:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.4 2001/03/22 04:00:06 momjian Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * various details abducted from various places
@@ -18,11 +18,11 @@
 
 
 #ifdef HAVE_SYS_PSTAT_H
-# include <sys/pstat.h>			/* for HP-UX */
+#include <sys/pstat.h>			/* for HP-UX */
 #endif
 #ifdef HAVE_PS_STRINGS
-# include <machine/vmparam.h>	/* for old BSD */
-# include <sys/exec.h>
+#include <machine/vmparam.h>	/* for old BSD */
+#include <sys/exec.h>
 #endif
 
 #include "miscadmin.h"
@@ -36,44 +36,44 @@ extern char **environ;
  * Alternative ways of updating ps display:
  *
  * PS_USE_SETPROCTITLE
- *     use the function setproctitle(const char *, ...)
- *     (newer BSD systems)
+ *	   use the function setproctitle(const char *, ...)
+ *	   (newer BSD systems)
  * PS_USE_PSTAT
- *     use the pstat(PSTAT_SETCMD, )
- *     (HPUX)
+ *	   use the pstat(PSTAT_SETCMD, )
+ *	   (HPUX)
  * PS_USE_PS_STRINGS
- *     assign PS_STRINGS->ps_argvstr = "string"
- *     (some BSD systems)
+ *	   assign PS_STRINGS->ps_argvstr = "string"
+ *	   (some BSD systems)
  * PS_USE_CHANGE_ARGV
- *     assign argv[0] = "string"
- *     (some other BSD systems)
+ *	   assign argv[0] = "string"
+ *	   (some other BSD systems)
  * PS_USE_CLOBBER_ARGV
- *     write over the argv and environment area
- *     (most SysV-like systems)
+ *	   write over the argv and environment area
+ *	   (most SysV-like systems)
  * PS_USE_NONE
- *     don't update ps display
- *     (This is the default, as it is safest.)
+ *	   don't update ps display
+ *	   (This is the default, as it is safest.)
  */
 #if defined(HAVE_SETPROCTITLE)
-# define PS_USE_SETPROCTITLE
+#define PS_USE_SETPROCTITLE
 #elif defined(HAVE_PSTAT) && defined(PSTAT_SETCMD)
-# define PS_USE_PSTAT
+#define PS_USE_PSTAT
 #elif defined(HAVE_PS_STRINGS)
-# define PS_USE_PS_STRINGS 
+#define PS_USE_PS_STRINGS
 #elif defined(BSD) || defined(__bsdi__) || defined(__hurd__)
-# define PS_USE_CHANGE_ARGV
+#define PS_USE_CHANGE_ARGV
 #elif defined(__linux__) || defined(_AIX4) || defined(_AIX3) || defined(__sgi) || (defined(sun) && !defined(BSD)) || defined(ultrix) || defined(__ksr__) || defined(__osf__) || defined(__QNX__) || defined(__svr4__) || defined(__svr5__)
-# define PS_USE_CLOBBER_ARGV
+#define PS_USE_CLOBBER_ARGV
 #else
-# define PS_USE_NONE
+#define PS_USE_NONE
 #endif
 
 
 /* Different systems want the buffer padded differently */
 #if defined(_AIX3) || defined(__linux__) || defined(__QNX__) || defined(__svr4__)
-# define PS_PADDING '\0'
+#define PS_PADDING '\0'
 #else
-# define PS_PADDING ' '
+#define PS_PADDING ' '
 #endif
 
 
@@ -83,12 +83,13 @@ extern char **environ;
 static char ps_buffer[PS_BUFFER_SIZE];
 static const size_t ps_buffer_size = PS_BUFFER_SIZE;
 
-#else  /* PS_USE_CLOBBER_ARGV */
-static char * ps_buffer; /* will point to argv area */
-static size_t ps_buffer_size; /* space determined at run time */
-#endif /* PS_USE_CLOBBER_ARGV */
+#else							/* PS_USE_CLOBBER_ARGV */
+static char *ps_buffer;			/* will point to argv area */
+static size_t ps_buffer_size;	/* space determined at run time */
 
-static size_t ps_buffer_fixed_size; /* size of the constant prefix */
+#endif	 /* PS_USE_CLOBBER_ARGV */
+
+static size_t ps_buffer_fixed_size;		/* size of the constant prefix */
 
 
 
@@ -97,30 +98,31 @@ static size_t ps_buffer_fixed_size; /* size of the constant prefix */
  */
 void
 init_ps_display(int argc, char *argv[],
-				const char * username, const char * dbname,
-				const char * host_info)
+				const char *username, const char *dbname,
+				const char *host_info)
 {
 #ifndef PS_USE_NONE
-    Assert(username);
-    Assert(dbname);
+	Assert(username);
+	Assert(dbname);
 
 	/* no ps display for stand-alone backend */
-    if (!IsUnderPostmaster)
-        return;
+	if (!IsUnderPostmaster)
+		return;
 
-# ifdef PS_USE_CHANGE_ARGV
+#ifdef PS_USE_CHANGE_ARGV
 	argv[0] = ps_buffer;
 	argv[1] = NULL;
-# endif /* PS_USE_CHANGE_ARGV */
+#endif	 /* PS_USE_CHANGE_ARGV */
 
-# ifdef PS_USE_CLOBBER_ARGV
-    /*
-     * If we're going to overwrite the argv area, count the space.
-     */
+#ifdef PS_USE_CLOBBER_ARGV
+
+	/*
+	 * If we're going to overwrite the argv area, count the space.
+	 */
 	{
-		char * end_of_area = NULL;
-		char **new_environ;
-		int i;
+		char	   *end_of_area = NULL;
+		char	  **new_environ;
+		int			i;
 
 		/*
 		 * check for contiguous argv strings
@@ -153,31 +155,34 @@ init_ps_display(int argc, char *argv[],
 		 */
 		for (i = 0; environ[i] != NULL; i++)
 			;
-		new_environ = malloc(sizeof (char *) * (i + 1));
+		new_environ = malloc(sizeof(char *) * (i + 1));
 		for (i = 0; environ[i] != NULL; i++)
-		new_environ[i] = strdup(environ[i]);
+			new_environ[i] = strdup(environ[i]);
 		new_environ[i] = NULL;
 		environ = new_environ;
 	}
-# endif /* PS_USE_CLOBBER_ARGV */
+#endif	 /* PS_USE_CLOBBER_ARGV */
 
 	/*
 	 * Make fixed prefix
 	 */
-# ifdef PS_USE_SETPROCTITLE
-	/* apparently setproctitle() already adds a `progname:' prefix to
-	 * the ps line */
+#ifdef PS_USE_SETPROCTITLE
+
+	/*
+	 * apparently setproctitle() already adds a `progname:' prefix to the
+	 * ps line
+	 */
 	snprintf(ps_buffer, ps_buffer_size,
 			 "%s %s %s ",
 			 username, dbname, host_info);
-# else
+#else
 	snprintf(ps_buffer, ps_buffer_size,
 			 "postgres: %s %s %s ",
 			 username, dbname, host_info);
-# endif
+#endif
 
-    ps_buffer_fixed_size = strlen(ps_buffer);
-#endif /* not PS_USE_NONE */
+	ps_buffer_fixed_size = strlen(ps_buffer);
+#endif	 /* not PS_USE_NONE */
 }
 
 
@@ -187,18 +192,18 @@ init_ps_display(int argc, char *argv[],
  * indication of what you're currently doing passed in the argument.
  */
 void
-set_ps_display(const char * value)
+set_ps_display(const char *value)
 {
 #ifndef PS_USE_NONE
 	/* no ps display for stand-alone backend */
 	if (!IsUnderPostmaster)
 		return;
 
-# ifdef PS_USE_CLOBBER_ARGV
+#ifdef PS_USE_CLOBBER_ARGV
 	/* If ps_buffer is a pointer, it might still be null */
 	if (!ps_buffer)
 		return;
-# endif
+#endif
 
 	/* Update ps_buffer to contain both fixed part and value */
 	StrNCpy(ps_buffer + ps_buffer_fixed_size, value,
@@ -206,42 +211,43 @@ set_ps_display(const char * value)
 
 	/* Transmit new setting to kernel, if necessary */
 
-# ifdef PS_USE_SETPROCTITLE
+#ifdef PS_USE_SETPROCTITLE
 	setproctitle("%s", ps_buffer);
-# endif
+#endif
 
-# ifdef PS_USE_PSTAT
-		{
-			union pstun pst;
+#ifdef PS_USE_PSTAT
+	{
+		union pstun pst;
 
-			pst.pst_command = ps_buffer;
-			pstat(PSTAT_SETCMD, pst, strlen(ps_buffer), 0, 0);
-		}
-# endif /* PS_USE_PSTAT */
+		pst.pst_command = ps_buffer;
+		pstat(PSTAT_SETCMD, pst, strlen(ps_buffer), 0, 0);
+	}
+#endif	 /* PS_USE_PSTAT */
 
-# ifdef PS_USE_PS_STRINGS
-		PS_STRINGS->ps_nargvstr = 1;
-		PS_STRINGS->ps_argvstr = ps_buffer;
-# endif /* PS_USE_PS_STRINGS */
+#ifdef PS_USE_PS_STRINGS
+	PS_STRINGS->ps_nargvstr = 1;
+	PS_STRINGS->ps_argvstr = ps_buffer;
+#endif	 /* PS_USE_PS_STRINGS */
 
-# ifdef PS_USE_CLOBBER_ARGV
-		{
-			char * cp;
-			/* pad unused memory */
-			for(cp = ps_buffer + strlen(ps_buffer);
-				cp < ps_buffer + ps_buffer_size;
-				cp++)
-				*cp = PS_PADDING;
-		}
-# endif /* PS_USE_CLOBBER_ARGV */
+#ifdef PS_USE_CLOBBER_ARGV
+	{
+		char	   *cp;
+
+		/* pad unused memory */
+		for (cp = ps_buffer + strlen(ps_buffer);
+			 cp < ps_buffer + ps_buffer_size;
+			 cp++)
+			*cp = PS_PADDING;
+	}
+#endif	 /* PS_USE_CLOBBER_ARGV */
 
-#endif /* not PS_USE_NONE */
+#endif	 /* not PS_USE_NONE */
 }
 
 
 /*
  * Returns what's currently in the ps display, in case someone needs
- * it.  Note that only the variable part is returned.
+ * it.	Note that only the variable part is returned.
  */
 const char *
 get_ps_display(void)
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index 666d8fd83f2b12368bee77a2648b2f788aac5b76..f66e021ad51cad2e2097b597d41896cf535dc9f8 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.40 2001/03/19 22:29:39 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.41 2001/03/22 04:00:07 momjian Exp $
  *
  * NOTE:
  *	This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -38,7 +38,7 @@
  *	request, even if it was much larger than necessary.  This led to more
  *	and more wasted space in allocated chunks over time.  To fix, get rid
  *	of the midrange behavior: we now handle only "small" power-of-2-size
- *	chunks as chunks.  Anything "large" is passed off to malloc().  Change
+ *	chunks as chunks.  Anything "large" is passed off to malloc().	Change
  *	the number of freelists to change the small/large boundary.
  *
  *
@@ -54,7 +54,7 @@
  *	Thus, if someone makes the common error of writing past what they've
  *	requested, the problem is likely to go unnoticed ... until the day when
  *	there *isn't* any wasted space, perhaps because of different memory
- *	alignment on a new platform, or some other effect.  To catch this sort
+ *	alignment on a new platform, or some other effect.	To catch this sort
  *	of problem, the MEMORY_CONTEXT_CHECKING option stores 0x7E just beyond
  *	the requested space whenever the request is less than the actual chunk
  *	size, and verifies that the byte is undamaged when the chunk is freed.
@@ -112,7 +112,7 @@
 #define ALLOC_BLOCKHDRSZ	MAXALIGN(sizeof(AllocBlockData))
 #define ALLOC_CHUNKHDRSZ	MAXALIGN(sizeof(AllocChunkData))
 
-typedef struct AllocBlockData *AllocBlock; /* forward reference */
+typedef struct AllocBlockData *AllocBlock;		/* forward reference */
 typedef struct AllocChunkData *AllocChunk;
 
 /*
@@ -126,15 +126,15 @@ typedef void *AllocPointer;
  */
 typedef struct AllocSetContext
 {
-	MemoryContextData header;		/* Standard memory-context fields */
+	MemoryContextData header;	/* Standard memory-context fields */
 	/* Info about storage allocated in this context: */
-	AllocBlock	blocks;				/* head of list of blocks in this set */
-	AllocChunk	freelist[ALLOCSET_NUM_FREELISTS]; /* free chunk lists */
+	AllocBlock	blocks;			/* head of list of blocks in this set */
+	AllocChunk	freelist[ALLOCSET_NUM_FREELISTS];		/* free chunk lists */
 	/* Allocation parameters for this context: */
-	Size		initBlockSize;		/* initial block size */
-	Size		maxBlockSize;		/* maximum block size */
-	AllocBlock	keeper;				/* if not NULL, keep this block
-									 * over resets */
+	Size		initBlockSize;	/* initial block size */
+	Size		maxBlockSize;	/* maximum block size */
+	AllocBlock	keeper;			/* if not NULL, keep this block over
+								 * resets */
 } AllocSetContext;
 
 typedef AllocSetContext *AllocSet;
@@ -204,8 +204,10 @@ static void *AllocSetRealloc(MemoryContext context, void *pointer, Size size);
 static void AllocSetInit(MemoryContext context);
 static void AllocSetReset(MemoryContext context);
 static void AllocSetDelete(MemoryContext context);
+
 #ifdef MEMORY_CONTEXT_CHECKING
 static void AllocSetCheck(MemoryContext context);
+
 #endif
 static void AllocSetStats(MemoryContext context);
 
@@ -240,7 +242,7 @@ static MemoryContextMethods AllocSetMethods = {
 #else
 #define AllocFreeInfo(_cxt, _chunk)
 #define AllocAllocInfo(_cxt, _chunk)
-#endif	
+#endif
 
 /* ----------
  * AllocSetFreeIndex -
@@ -300,6 +302,7 @@ AllocSetContextCreate(MemoryContext parent,
 											 &AllocSetMethods,
 											 parent,
 											 name);
+
 	/*
 	 * Make sure alloc parameters are reasonable, and save them.
 	 *
@@ -356,9 +359,10 @@ AllocSetContextCreate(MemoryContext parent,
 static void
 AllocSetInit(MemoryContext context)
 {
+
 	/*
-	 * Since MemoryContextCreate already zeroed the context node,
-	 * we don't have to do anything here: it's already OK.
+	 * Since MemoryContextCreate already zeroed the context node, we don't
+	 * have to do anything here: it's already OK.
 	 */
 }
 
@@ -397,7 +401,7 @@ AllocSetReset(MemoryContext context)
 		if (block == set->keeper)
 		{
 			/* Reset the block, but don't return it to malloc */
-			char   *datastart = ((char *) block) + ALLOC_BLOCKHDRSZ;
+			char	   *datastart = ((char *) block) + ALLOC_BLOCKHDRSZ;
 
 #ifdef CLOBBER_FREED_MEMORY
 			/* Wipe freed memory for debugging purposes */
@@ -505,8 +509,8 @@ AllocSetAlloc(MemoryContext context, Size size)
 #endif
 
 		/*
-		 * Stick the new block underneath the active allocation block,
-		 * so that we don't lose the use of the space remaining therein.
+		 * Stick the new block underneath the active allocation block, so
+		 * that we don't lose the use of the space remaining therein.
 		 */
 		if (set->blocks != NULL)
 		{
@@ -518,7 +522,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 			block->next = NULL;
 			set->blocks = block;
 		}
-		
+
 		AllocAllocInfo(set, chunk);
 		return AllocChunkGetPointer(chunk);
 	}
@@ -568,8 +572,8 @@ AllocSetAlloc(MemoryContext context, Size size)
 	Assert(chunk_size >= size);
 
 	/*
-	 * If there is enough room in the active allocation block,
-	 * we will put the chunk into that block.  Else must start a new one.
+	 * If there is enough room in the active allocation block, we will put
+	 * the chunk into that block.  Else must start a new one.
 	 */
 	if ((block = set->blocks) != NULL)
 	{
@@ -577,6 +581,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 
 		if (availspace < (chunk_size + ALLOC_CHUNKHDRSZ))
 		{
+
 			/*
 			 * The existing active (top) block does not have enough room
 			 * for the requested allocation, but it might still have a
@@ -591,17 +596,18 @@ AllocSetAlloc(MemoryContext context, Size size)
 			 */
 			while (availspace >= ((1 << ALLOC_MINBITS) + ALLOC_CHUNKHDRSZ))
 			{
-				Size	availchunk = availspace - ALLOC_CHUNKHDRSZ;
-				int		a_fidx = AllocSetFreeIndex(availchunk);
+				Size		availchunk = availspace - ALLOC_CHUNKHDRSZ;
+				int			a_fidx = AllocSetFreeIndex(availchunk);
 
 				/*
-				 * In most cases, we'll get back the index of the next larger
-				 * freelist than the one we need to put this chunk on.  The
-				 * exception is when availchunk is exactly a power of 2.
+				 * In most cases, we'll get back the index of the next
+				 * larger freelist than the one we need to put this chunk
+				 * on.	The exception is when availchunk is exactly a
+				 * power of 2.
 				 */
 				if (availchunk != (1 << (a_fidx + ALLOC_MINBITS)))
 				{
-					a_fidx--;	
+					a_fidx--;
 					Assert(a_fidx >= 0);
 					availchunk = (1 << (a_fidx + ALLOC_MINBITS));
 				}
@@ -613,7 +619,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 
 				chunk->size = availchunk;
 #ifdef MEMORY_CONTEXT_CHECKING
-				chunk->requested_size = 0; /* mark it free */
+				chunk->requested_size = 0;		/* mark it free */
 #endif
 				chunk->aset = (void *) set->freelist[a_fidx];
 				set->freelist[a_fidx] = chunk;
@@ -629,7 +635,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 	 */
 	if (block == NULL)
 	{
-		Size	required_size;
+		Size		required_size;
 
 		if (set->blocks == NULL)
 		{
@@ -687,7 +693,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 			elog(ERROR, "Memory exhausted in AllocSetAlloc(%lu)",
 				 (unsigned long) size);
 		}
-			
+
 		block->aset = set;
 		block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
 		block->endptr = ((char *) block) + blksize;
@@ -711,7 +717,7 @@ AllocSetAlloc(MemoryContext context, Size size)
 	/* set mark to catch clobber of "unused" space */
 	if (size < chunk->size)
 		((char *) AllocChunkGetPointer(chunk))[size] = 0x7E;
-#endif	
+#endif
 
 	AllocAllocInfo(set, chunk);
 	return AllocChunkGetPointer(chunk);
@@ -735,10 +741,11 @@ AllocSetFree(MemoryContext context, void *pointer)
 		if (((char *) pointer)[chunk->requested_size] != 0x7E)
 			elog(NOTICE, "AllocSetFree: detected write past chunk end in %s %p",
 				 set->header.name, chunk);
-#endif	
+#endif
 
 	if (chunk->size > ALLOC_CHUNK_LIMIT)
 	{
+
 		/*
 		 * Big chunks are certain to have been allocated as single-chunk
 		 * blocks.	Find the containing block and return it to malloc().
@@ -786,7 +793,7 @@ AllocSetFree(MemoryContext context, void *pointer)
 #ifdef MEMORY_CONTEXT_CHECKING
 		/* Reset requested_size to 0 in chunks that are on freelist */
 		chunk->requested_size = 0;
-#endif		
+#endif
 		set->freelist[fidx] = chunk;
 	}
 }
@@ -804,7 +811,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 	AllocChunk	chunk = AllocPointerGetChunk(pointer);
 	Size		oldsize = chunk->size;
 
-#ifdef MEMORY_CONTEXT_CHECKING		
+#ifdef MEMORY_CONTEXT_CHECKING
 	/* Test for someone scribbling on unused space in chunk */
 	if (chunk->requested_size < oldsize)
 		if (((char *) pointer)[chunk->requested_size] != 0x7E)
@@ -819,7 +826,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 	 */
 	if (oldsize >= size)
 	{
-#ifdef MEMORY_CONTEXT_CHECKING		
+#ifdef MEMORY_CONTEXT_CHECKING
 		chunk->requested_size = size;
 		/* set mark to catch clobber of "unused" space */
 		if (size < oldsize)
@@ -830,10 +837,11 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 
 	if (oldsize > ALLOC_CHUNK_LIMIT)
 	{
+
 		/*
-		 * The chunk must been allocated as a single-chunk block.  Find the
-		 * containing block and use realloc() to make it bigger with minimum
-		 * space wastage.
+		 * The chunk must been allocated as a single-chunk block.  Find
+		 * the containing block and use realloc() to make it bigger with
+		 * minimum space wastage.
 		 */
 		AllocBlock	block = set->blocks;
 		AllocBlock	prevblock = NULL;
@@ -873,7 +881,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 		else
 			prevblock->next = block;
 		chunk->size = chksize;
-		
+
 #ifdef MEMORY_CONTEXT_CHECKING
 		chunk->requested_size = size;
 		/* set mark to catch clobber of "unused" space */
@@ -885,14 +893,15 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 	}
 	else
 	{
+
 		/*
 		 * Small-chunk case.  If the chunk is the last one in its block,
 		 * there might be enough free space after it that we can just
-		 * enlarge the chunk in-place.  It's relatively painful to find
+		 * enlarge the chunk in-place.	It's relatively painful to find
 		 * the containing block in the general case, but we can detect
-		 * last-ness quite cheaply for the typical case where the chunk
-		 * is in the active (topmost) allocation block.  (At least with
-		 * the regression tests and code as of 1/2001, realloc'ing the last
+		 * last-ness quite cheaply for the typical case where the chunk is
+		 * in the active (topmost) allocation block.  (At least with the
+		 * regression tests and code as of 1/2001, realloc'ing the last
 		 * chunk of a non-topmost block hardly ever happens, so it's not
 		 * worth scanning the block list to catch that case.)
 		 *
@@ -908,12 +917,12 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 
 			chunk_end = (char *) chunk + (oldsize + ALLOC_CHUNKHDRSZ);
 			if (chunk_end == block->freeptr)
-			{ 
+			{
 				/* OK, it's last in block ... is there room? */
-				Size	freespace = block->endptr - block->freeptr;
-				int		fidx;
-				Size	newsize;
-				Size	delta;
+				Size		freespace = block->endptr - block->freeptr;
+				int			fidx;
+				Size		newsize;
+				Size		delta;
 
 				fidx = AllocSetFreeIndex(size);
 				newsize = 1 << (fidx + ALLOC_MINBITS);
@@ -924,7 +933,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
 					/* Yes, so just enlarge the chunk. */
 					block->freeptr += delta;
 					chunk->size += delta;
-#ifdef MEMORY_CONTEXT_CHECKING		
+#ifdef MEMORY_CONTEXT_CHECKING
 					chunk->requested_size = size;
 					/* set mark to catch clobber of "unused" space */
 					if (size < chunk->size)
@@ -982,7 +991,7 @@ AllocSetStats(MemoryContext context)
 		}
 	}
 	fprintf(stderr,
-			"%s: %ld total in %ld blocks; %ld free (%ld chunks); %ld used\n",
+		"%s: %ld total in %ld blocks; %ld free (%ld chunks); %ld used\n",
 			set->header.name, totalspace, nblocks, freespace, nchunks,
 			totalspace - freespace);
 }
@@ -990,7 +999,7 @@ AllocSetStats(MemoryContext context)
 
 #ifdef MEMORY_CONTEXT_CHECKING
 
-/* 
+/*
  * AllocSetCheck
  *		Walk through chunks and check consistency of memory.
  *
@@ -998,19 +1007,19 @@ AllocSetStats(MemoryContext context)
  * find yourself in an infinite loop when trouble occurs, because this
  * routine will be entered again when elog cleanup tries to release memory!
  */
-static void 
+static void
 AllocSetCheck(MemoryContext context)
 {
-	AllocSet	set = (AllocSet) context;	
-	char		*name = set->header.name;
+	AllocSet	set = (AllocSet) context;
+	char	   *name = set->header.name;
 	AllocBlock	block;
 
 	for (block = set->blocks; block != NULL; block = block->next)
-	{	
-		char	*bpoz = ((char *) block) + ALLOC_BLOCKHDRSZ;
-		long	blk_used = block->freeptr - bpoz;
-		long	blk_data = 0;
-		long	nchunks  = 0;
+	{
+		char	   *bpoz = ((char *) block) + ALLOC_BLOCKHDRSZ;
+		long		blk_used = block->freeptr - bpoz;
+		long		blk_data = 0;
+		long		nchunks = 0;
 
 		/*
 		 * Empty block - empty can be keeper-block only
@@ -1018,44 +1027,44 @@ AllocSetCheck(MemoryContext context)
 		if (!blk_used)
 		{
 			if (set->keeper != block)
-				elog(NOTICE, "AllocSetCheck: %s: empty block %p", 
+				elog(NOTICE, "AllocSetCheck: %s: empty block %p",
 					 name, block);
-		}	
-		
+		}
+
 		/*
 		 * Chunk walker
-		 */	
+		 */
 		while (bpoz < block->freeptr)
 		{
 			AllocChunk	chunk = (AllocChunk) bpoz;
 			Size		chsize,
 						dsize;
 			char	   *chdata_end;
-			
-			chsize = chunk->size; /* aligned chunk size */
-			dsize = chunk->requested_size;	/* real data */
+
+			chsize = chunk->size;		/* aligned chunk size */
+			dsize = chunk->requested_size;		/* real data */
 			chdata_end = ((char *) chunk) + (ALLOC_CHUNKHDRSZ + dsize);
-			
+
 			/*
 			 * Check chunk size
 			 */
 			if (dsize > chsize)
 				elog(NOTICE, "AllocSetCheck: %s: req size > alloc size for chunk %p in block %p",
-					 name, chunk, block);			
+					 name, chunk, block);
 			if (chsize < (1 << ALLOC_MINBITS))
 				elog(NOTICE, "AllocSetCheck: %s: bad size %lu for chunk %p in block %p",
 					 name, (unsigned long) chsize, chunk, block);
-						
+
 			/* single-chunk block? */
 			if (chsize > ALLOC_CHUNK_LIMIT &&
-			    chsize + ALLOC_CHUNKHDRSZ != blk_used)
+				chsize + ALLOC_CHUNKHDRSZ != blk_used)
 				elog(NOTICE, "AllocSetCheck: %s: bad single-chunk %p in block %p",
 					 name, chunk, block);
 
 			/*
-			 * If chunk is allocated, check for correct aset pointer.
-			 * (If it's free, the aset is the freelist pointer, which we
-			 * can't check as easily...)
+			 * If chunk is allocated, check for correct aset pointer. (If
+			 * it's free, the aset is the freelist pointer, which we can't
+			 * check as easily...)
 			 */
 			if (dsize > 0 && chunk->aset != (void *) set)
 				elog(NOTICE, "AllocSetCheck: %s: bogus aset link in block %p, chunk %p",
@@ -1063,14 +1072,14 @@ AllocSetCheck(MemoryContext context)
 
 			/*
 			 * Check for overwrite of "unallocated" space in chunk
-			 */		
+			 */
 			if (dsize > 0 && dsize < chsize && *chdata_end != 0x7E)
 				elog(NOTICE, "AllocSetCheck: %s: detected write past chunk end in block %p, chunk %p",
 					 name, block, chunk);
-			
+
 			blk_data += chsize;
 			nchunks++;
-			
+
 			bpoz += ALLOC_CHUNKHDRSZ + chsize;
 		}
 
@@ -1080,4 +1089,4 @@ AllocSetCheck(MemoryContext context)
 	}
 }
 
-#endif /* MEMORY_CONTEXT_CHECKING */
+#endif	 /* MEMORY_CONTEXT_CHECKING */
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index ab8434a05817023980619103fa3f6f23c3880f53..402e4010f76262f62d77a74c75dbb921619b524a 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.27 2001/02/06 01:53:53 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.28 2001/03/22 04:00:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -72,9 +72,10 @@ void
 MemoryContextInit(void)
 {
 	AssertState(TopMemoryContext == NULL);
+
 	/*
-	 * Initialize TopMemoryContext as an AllocSetContext with slow
-	 * growth rate --- we don't really expect much to be allocated in it.
+	 * Initialize TopMemoryContext as an AllocSetContext with slow growth
+	 * rate --- we don't really expect much to be allocated in it.
 	 *
 	 * (There is special-case code in MemoryContextCreate() for this call.)
 	 */
@@ -83,18 +84,20 @@ MemoryContextInit(void)
 											 8 * 1024,
 											 8 * 1024,
 											 8 * 1024);
+
 	/*
-	 * Not having any other place to point CurrentMemoryContext,
-	 * make it point to TopMemoryContext.  Caller should change this soon!
+	 * Not having any other place to point CurrentMemoryContext, make it
+	 * point to TopMemoryContext.  Caller should change this soon!
 	 */
 	CurrentMemoryContext = TopMemoryContext;
+
 	/*
-	 * Initialize ErrorContext as an AllocSetContext with slow
-	 * growth rate --- we don't really expect much to be allocated in it.
-	 * More to the point, require it to contain at least 8K at all times.
-	 * This is the only case where retained memory in a context is
-	 * *essential* --- we want to be sure ErrorContext still has some
-	 * memory even if we've run out elsewhere!
+	 * Initialize ErrorContext as an AllocSetContext with slow growth rate
+	 * --- we don't really expect much to be allocated in it. More to the
+	 * point, require it to contain at least 8K at all times. This is the
+	 * only case where retained memory in a context is *essential* --- we
+	 * want to be sure ErrorContext still has some memory even if we've
+	 * run out elsewhere!
 	 */
 	ErrorContext = AllocSetContextCreate(TopMemoryContext,
 										 "ErrorContext",
@@ -129,14 +132,12 @@ MemoryContextReset(MemoryContext context)
 void
 MemoryContextResetChildren(MemoryContext context)
 {
-	MemoryContext	child;
+	MemoryContext child;
 
 	AssertArg(MemoryContextIsValid(context));
 
 	for (child = context->firstchild; child != NULL; child = child->nextchild)
-	{
 		MemoryContextReset(child);
-	}
 }
 
 /*
@@ -146,7 +147,7 @@ MemoryContextResetChildren(MemoryContext context)
  *
  * The type-specific delete routine removes all subsidiary storage
  * for the context, but we have to delete the context node itself,
- * as well as recurse to get the children.  We must also delink the
+ * as well as recurse to get the children.	We must also delink the
  * node from its parent, if it has one.
  */
 void
@@ -159,23 +160,21 @@ MemoryContextDelete(MemoryContext context)
 	Assert(context != CurrentMemoryContext);
 
 	MemoryContextDeleteChildren(context);
+
 	/*
-	 * We delink the context from its parent before deleting it,
-	 * so that if there's an error we won't have deleted/busted
-	 * contexts still attached to the context tree.  Better a leak
-	 * than a crash.
+	 * We delink the context from its parent before deleting it, so that
+	 * if there's an error we won't have deleted/busted contexts still
+	 * attached to the context tree.  Better a leak than a crash.
 	 */
 	if (context->parent)
 	{
-		MemoryContext	parent = context->parent;
+		MemoryContext parent = context->parent;
 
 		if (context == parent->firstchild)
-		{
 			parent->firstchild = context->nextchild;
-		}
 		else
 		{
-			MemoryContext	child;
+			MemoryContext child;
 
 			for (child = parent->firstchild; child; child = child->nextchild)
 			{
@@ -200,14 +199,13 @@ void
 MemoryContextDeleteChildren(MemoryContext context)
 {
 	AssertArg(MemoryContextIsValid(context));
+
 	/*
-	 * MemoryContextDelete will delink the child from me,
-	 * so just iterate as long as there is a child.
+	 * MemoryContextDelete will delink the child from me, so just iterate
+	 * as long as there is a child.
 	 */
 	while (context->firstchild != NULL)
-	{
 		MemoryContextDelete(context->firstchild);
-	}
 }
 
 /*
@@ -237,15 +235,13 @@ MemoryContextResetAndDeleteChildren(MemoryContext context)
 void
 MemoryContextStats(MemoryContext context)
 {
-	MemoryContext	child;
+	MemoryContext child;
 
 	AssertArg(MemoryContextIsValid(context));
 
 	(*context->methods->stats) (context);
 	for (child = context->firstchild; child != NULL; child = child->nextchild)
-	{
 		MemoryContextStats(child);
-	}
 }
 
 
@@ -253,22 +249,21 @@ MemoryContextStats(MemoryContext context)
  * MemoryContextCheck
  *		Check all chunks in the named context.
  *
- * This is just a debugging utility, so it's not fancy.  
+ * This is just a debugging utility, so it's not fancy.
  */
 #ifdef MEMORY_CONTEXT_CHECKING
 void
 MemoryContextCheck(MemoryContext context)
 {
-	MemoryContext	child;
+	MemoryContext child;
 
 	AssertArg(MemoryContextIsValid(context));
 
 	(*context->methods->check) (context);
 	for (child = context->firstchild; child != NULL; child = child->nextchild)
-	{
 		MemoryContextCheck(child);
-	}
 }
+
 #endif
 
 /*
@@ -285,24 +280,26 @@ MemoryContextCheck(MemoryContext context)
 bool
 MemoryContextContains(MemoryContext context, void *pointer)
 {
-	StandardChunkHeader	   *header;
+	StandardChunkHeader *header;
 
 	/*
 	 * Try to detect bogus pointers handed to us, poorly though we can.
-	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at
-	 * an allocated chunk.
+	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
+	 * allocated chunk.
 	 */
 	if (pointer == NULL || pointer != (void *) MAXALIGN(pointer))
 		return false;
+
 	/*
 	 * OK, it's probably safe to look at the chunk header.
 	 */
 	header = (StandardChunkHeader *)
 		((char *) pointer - STANDARDCHUNKHEADERSIZE);
+
 	/*
 	 * If the context link doesn't match then we certainly have a
-	 * non-member chunk.  Also check for a reasonable-looking size
-	 * as extra guard against being fooled by bogus pointers.
+	 * non-member chunk.  Also check for a reasonable-looking size as
+	 * extra guard against being fooled by bogus pointers.
 	 */
 	if (header->context == context && AllocSizeIsValid(header->size))
 		return true;
@@ -347,7 +344,7 @@ MemoryContextContains(MemoryContext context, void *pointer)
  *
  * Normally, the context node and the name are allocated from
  * TopMemoryContext (NOT from the parent context, since the node must
- * survive resets of its parent context!).  However, this routine is itself
+ * survive resets of its parent context!).	However, this routine is itself
  * used to create TopMemoryContext!  If we see that TopMemoryContext is NULL,
  * we assume we are creating TopMemoryContext and use malloc() to allocate
  * the node.
@@ -363,8 +360,8 @@ MemoryContextCreate(NodeTag tag, Size size,
 					MemoryContext parent,
 					const char *name)
 {
-	MemoryContext	node;
-	Size			needed = size + strlen(name) + 1;
+	MemoryContext node;
+	Size		needed = size + strlen(name) + 1;
 
 	/* Get space for node and name */
 	if (TopMemoryContext != NULL)
@@ -431,15 +428,16 @@ MemoryContextAlloc(MemoryContext context, Size size)
 void
 pfree(void *pointer)
 {
-	StandardChunkHeader	   *header;
+	StandardChunkHeader *header;
 
 	/*
 	 * Try to detect bogus pointers handed to us, poorly though we can.
-	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at
-	 * an allocated chunk.
+	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
+	 * allocated chunk.
 	 */
 	Assert(pointer != NULL);
 	Assert(pointer == (void *) MAXALIGN(pointer));
+
 	/*
 	 * OK, it's probably safe to look at the chunk header.
 	 */
@@ -448,7 +446,7 @@ pfree(void *pointer)
 
 	AssertArg(MemoryContextIsValid(header->context));
 
-    (*header->context->methods->free_p) (header->context, pointer);
+	(*header->context->methods->free_p) (header->context, pointer);
 }
 
 /*
@@ -458,15 +456,16 @@ pfree(void *pointer)
 void *
 repalloc(void *pointer, Size size)
 {
-	StandardChunkHeader	   *header;
+	StandardChunkHeader *header;
 
 	/*
 	 * Try to detect bogus pointers handed to us, poorly though we can.
-	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at
-	 * an allocated chunk.
+	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
+	 * allocated chunk.
 	 */
 	Assert(pointer != NULL);
 	Assert(pointer == (void *) MAXALIGN(pointer));
+
 	/*
 	 * OK, it's probably safe to look at the chunk header.
 	 */
@@ -479,7 +478,7 @@ repalloc(void *pointer, Size size)
 		elog(ERROR, "repalloc: invalid request size %lu",
 			 (unsigned long) size);
 
-    return (*header->context->methods->realloc) (header->context,
+	return (*header->context->methods->realloc) (header->context,
 												 pointer, size);
 }
 
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index 63d3ed363cb94678a326b2fa08afcdf2e40ca450..a5534dc1cded1233521e2e3307e0d84e2c8cf68a 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.40 2001/02/27 22:07:34 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.41 2001/03/22 04:00:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -126,8 +126,8 @@ EnablePortalManager(void)
 	ctl.datasize = sizeof(Portal);
 
 	/*
-	 * use PORTALS_PER_USER, defined in utils/portal.h as a guess of
-	 * how many hash table entries to create, initially
+	 * use PORTALS_PER_USER, defined in utils/portal.h as a guess of how
+	 * many hash table entries to create, initially
 	 */
 	PortalHashTable = hash_create(PORTALS_PER_USER * 3, &ctl, HASH_ELEM);
 }
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 6dbcc701290fd3d0fbf4661074d30b543447904a..38f4c2fc91ed17844ebfd35e41f77b8d664e2b05 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -78,7 +78,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.13 2001/01/29 00:39:19 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.14 2001/03/22 04:00:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1851,7 +1851,7 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
 		else
 		{
 			compare = DatumGetInt32(FunctionCall2(&entry->sk_func,
-												  attrDatum1, attrDatum2));
+												attrDatum1, attrDatum2));
 		}
 
 		if (compare != 0)
diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c
index 48a8fbb0716f85873bbdb01fad233cadabd4bd5f..7621e572978b8d5205e4cc842e23a8a569907097 100644
--- a/src/backend/utils/sort/tuplestore.c
+++ b/src/backend/utils/sort/tuplestore.c
@@ -11,7 +11,7 @@
  * space limit specified by the caller.
  *
  * The (approximate) amount of memory allowed to the tuplestore is specified
- * in kilobytes by the caller.  We absorb tuples and simply store them in an
+ * in kilobytes by the caller.	We absorb tuples and simply store them in an
  * in-memory array as long as we haven't exceeded maxKBytes.  If we reach the
  * end of the input without exceeding maxKBytes, we just return tuples during
  * the read phase by scanning the tuple array sequentially.  If we do exceed
@@ -26,7 +26,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.2 2001/01/24 19:43:18 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.3 2001/03/22 04:00:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@
 #include "utils/tuplestore.h"
 
 /*
- * Possible states of a Tuplestore object.  These denote the states that
+ * Possible states of a Tuplestore object.	These denote the states that
  * persist between calls of Tuplestore routines.
  */
 typedef enum
@@ -66,12 +66,12 @@ struct Tuplestorestate
 	 * know it. They are set up by the tuplestore_begin_xxx routines.
 	 *
 	 * (Although tuplestore.c currently only supports heap tuples, I've
-	 * copied this part of tuplesort.c so that extension to other kinds
-	 * of objects will be easy if it's ever needed.)
+	 * copied this part of tuplesort.c so that extension to other kinds of
+	 * objects will be easy if it's ever needed.)
 	 *
-	 * Function to copy a supplied input tuple into palloc'd space. (NB:
-	 * we assume that a single pfree() is enough to release the tuple
-	 * later, so the representation must be "flat" in one palloc chunk.)
+	 * Function to copy a supplied input tuple into palloc'd space. (NB: we
+	 * assume that a single pfree() is enough to release the tuple later,
+	 * so the representation must be "flat" in one palloc chunk.)
 	 * state->availMem must be decreased by the amount of space used.
 	 */
 	void	   *(*copytup) (Tuplestorestate *state, void *tup);
@@ -95,7 +95,8 @@ struct Tuplestorestate
 
 	/*
 	 * This array holds pointers to tuples in memory if we are in state
-	 * INITIAL or READMEM.  In states WRITEFILE and READFILE it's not used.
+	 * INITIAL or READMEM.	In states WRITEFILE and READFILE it's not
+	 * used.
 	 */
 	void	  **memtuples;		/* array of pointers to palloc'd tuples */
 	int			memtupcount;	/* number of tuples currently present */
@@ -116,7 +117,7 @@ struct Tuplestorestate
 };
 
 #define COPYTUP(state,tup)	((*(state)->copytup) (state, tup))
-#define WRITETUP(state,tup)	((*(state)->writetup) (state, tup))
+#define WRITETUP(state,tup) ((*(state)->writetup) (state, tup))
 #define READTUP(state,len)	((*(state)->readtup) (state, len))
 #define LACKMEM(state)		((state)->availMem < 0)
 #define USEMEM(state,amt)	((state)->availMem -= (amt))
@@ -145,7 +146,7 @@ struct Tuplestorestate
  * the back length word (if present).
  *
  * The write/read routines can make use of the tuple description data
- * stored in the Tuplestorestate record, if needed.	They are also expected
+ * stored in the Tuplestorestate record, if needed. They are also expected
  * to adjust state->availMem by the amount of memory space (not tape space!)
  * released or consumed.  There is no error return from either writetup
  * or readtup; they should elog() on failure.
@@ -183,7 +184,7 @@ struct Tuplestorestate
 
 
 static Tuplestorestate *tuplestore_begin_common(bool randomAccess,
-												int maxKBytes);
+						int maxKBytes);
 static void dumptuples(Tuplestorestate *state);
 static unsigned int getlen(Tuplestorestate *state, bool eofOK);
 static void markrunend(Tuplestorestate *state);
@@ -222,7 +223,7 @@ tuplestore_begin_common(bool randomAccess, int maxKBytes)
 
 	state->memtupcount = 0;
 	if (maxKBytes > 0)
-		state->memtupsize = 1024; /* initial guess */
+		state->memtupsize = 1024;		/* initial guess */
 	else
 		state->memtupsize = 1;	/* won't really need any space */
 	state->memtuples = (void **) palloc(state->memtupsize * sizeof(void *));
@@ -270,14 +271,16 @@ tuplestore_end(Tuplestorestate *state)
 void
 tuplestore_puttuple(Tuplestorestate *state, void *tuple)
 {
+
 	/*
-	 * Copy the tuple.  (Must do this even in WRITEFILE case.)
+	 * Copy the tuple.	(Must do this even in WRITEFILE case.)
 	 */
 	tuple = COPYTUP(state, tuple);
 
 	switch (state->status)
 	{
 		case TSS_INITIAL:
+
 			/*
 			 * Stash the tuple in the in-memory array.
 			 */
@@ -321,7 +324,8 @@ tuplestore_donestoring(Tuplestorestate *state)
 {
 	switch (state->status)
 	{
-		case TSS_INITIAL:
+			case TSS_INITIAL:
+
 			/*
 			 * We were able to accumulate all the tuples within the
 			 * allowed amount of memory.  Just set up to scan them.
@@ -333,10 +337,12 @@ tuplestore_donestoring(Tuplestorestate *state)
 			state->status = TSS_READMEM;
 			break;
 		case TSS_WRITEFILE:
+
 			/*
 			 * Write the EOF marker.
 			 */
 			markrunend(state);
+
 			/*
 			 * Set up for reading from tape.
 			 */
@@ -361,7 +367,7 @@ tuplestore_donestoring(Tuplestorestate *state)
  */
 void *
 tuplestore_gettuple(Tuplestorestate *state, bool forward,
-				   bool *should_free)
+					bool *should_free)
 {
 	unsigned int tuplen;
 	void	   *tup;
@@ -434,7 +440,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
 				 * empty file.
 				 */
 				if (BufFileSeek(state->myfile, 0,
-								- (long) (2 * sizeof(unsigned int)),
+								-(long) (2 * sizeof(unsigned int)),
 								SEEK_CUR) != 0)
 					return NULL;
 				state->eof_reached = false;
@@ -448,7 +454,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
 				 * file.
 				 */
 				if (BufFileSeek(state->myfile, 0,
-								- (long) sizeof(unsigned int),
+								-(long) sizeof(unsigned int),
 								SEEK_CUR) != 0)
 					return NULL;
 				tuplen = getlen(state, false);
@@ -457,7 +463,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
 				 * Back up to get ending length word of tuple before it.
 				 */
 				if (BufFileSeek(state->myfile, 0,
-								- (long) (tuplen + 2 * sizeof(unsigned int)),
+							 -(long) (tuplen + 2 * sizeof(unsigned int)),
 								SEEK_CUR) != 0)
 				{
 
@@ -468,7 +474,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
 					 * but that is what in-memory case does).
 					 */
 					if (BufFileSeek(state->myfile, 0,
-									- (long) (tuplen + sizeof(unsigned int)),
+								 -(long) (tuplen + sizeof(unsigned int)),
 									SEEK_CUR) != 0)
 						elog(ERROR, "tuplestore_gettuple: bogus tuple len in backward scan");
 					return NULL;
@@ -483,7 +489,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
 			 * initial length word of the tuple, so back up to that point.
 			 */
 			if (BufFileSeek(state->myfile, 0,
-							- (long) tuplen,
+							-(long) tuplen,
 							SEEK_CUR) != 0)
 				elog(ERROR, "tuplestore_gettuple: bogus tuple len in backward scan");
 			tup = READTUP(state, tuplen);
@@ -504,9 +510,7 @@ dumptuples(Tuplestorestate *state)
 	int			i;
 
 	for (i = 0; i < state->memtupcount; i++)
-	{
 		WRITETUP(state, state->memtuples[i]);
-	}
 	state->memtupcount = 0;
 }
 
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index 2e7281265fc891a8d7006cd902f965befd1fee97..21d7ca2e2c2aa2c631131d41d241a47dc15612cd 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.53 2001/02/10 02:31:27 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.54 2001/03/22 04:00:11 momjian Exp $
  *
  * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
  *
@@ -16,8 +16,8 @@
  *	 - Added single. quote to twin single quote expansion for 'insert' string
  *	   mode.
  *
- * Modifications 14-Sep-2000 - pjw@rhyme.com.au 
- *	-	Added enum for findTypeByOid to specify how to handle OID and which 
+ * Modifications 14-Sep-2000 - pjw@rhyme.com.au
+ *	-	Added enum for findTypeByOid to specify how to handle OID and which
  *		string to return - formatted type, or base type. If the base type
  *		is returned then fmtId is called on the string.
  *
@@ -59,13 +59,17 @@ findTypeByOid(TypeInfo *tinfo, int numTypes, const char *oid, OidOptions opts)
 {
 	int			i;
 
-	if (strcmp(oid, "0") == 0) {
+	if (strcmp(oid, "0") == 0)
+	{
 
-		if ( (opts & zeroAsOpaque) != 0 ) {
+		if ((opts & zeroAsOpaque) != 0)
+		{
 
 			return g_opaque_type;
 
-		} else if ( (opts & zeroAsAny) != 0 ) {
+		}
+		else if ((opts & zeroAsAny) != 0)
+		{
 
 			return "'any'";
 
@@ -74,17 +78,17 @@ findTypeByOid(TypeInfo *tinfo, int numTypes, const char *oid, OidOptions opts)
 
 	for (i = 0; i < numTypes; i++)
 	{
-		if (strcmp(tinfo[i].oid, oid) == 0) {
-			if ( (opts & useBaseTypeName) != 0 ) {
-				return (char*) fmtId(tinfo[i].typname, false);
-			} else {
+		if (strcmp(tinfo[i].oid, oid) == 0)
+		{
+			if ((opts & useBaseTypeName) != 0)
+				return (char *) fmtId(tinfo[i].typname, false);
+			else
 				return tinfo[i].typedefn;
-			}
 		}
 	}
 
 	/* no suitable type name was found */
-	return(NULL);
+	return (NULL);
 }
 
 /*
@@ -111,7 +115,7 @@ findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
 			oid);
 
 	/* no suitable operator name was found */
-	return(NULL);
+	return (NULL);
 }
 
 
@@ -253,13 +257,13 @@ strInArray(const char *pattern, char **arr, int arr_size)
  */
 
 TableInfo  *
-dumpSchema(Archive  *fout,
-		    int *numTablesPtr,
-		    const char *tablename,
-		    const bool aclsSkip,
-		    const bool oids,
-		    const bool schemaOnly,
-		    const bool dataOnly)
+dumpSchema(Archive *fout,
+		   int *numTablesPtr,
+		   const char *tablename,
+		   const bool aclsSkip,
+		   const bool oids,
+		   const bool schemaOnly,
+		   const bool dataOnly)
 {
 	int			numTypes;
 	int			numFuncs;
@@ -342,7 +346,7 @@ dumpSchema(Archive  *fout,
 				g_comment_start, g_comment_end);
 
 	dumpTables(fout, tblinfo, numTables, indinfo, numIndices, inhinfo, numInherits,
-			   tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly);
+	   tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly);
 
 	if (fout && !dataOnly)
 	{
@@ -555,10 +559,12 @@ fmtId(const char *rawid, bool force_quotes)
 	appendPQExpBufferChar(id_return, '\"');
 	for (cp = rawid; *cp; cp++)
 	{
-		/* Did we find a double-quote in the string?
-		 * Then make this a double double-quote per SQL99.
-		 * Before, we put in a backslash/double-quote pair.
-		 * - thomas 2000-08-05 */
+
+		/*
+		 * Did we find a double-quote in the string? Then make this a
+		 * double double-quote per SQL99. Before, we put in a
+		 * backslash/double-quote pair. - thomas 2000-08-05
+		 */
 		if (*cp == '\"')
 		{
 			appendPQExpBufferChar(id_return, '\"');
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index 6593a7e56f68952dc9c34a9b7931629c86561fa3..12a6a56c7f6c30467d502678e56502407926f8df 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -7,24 +7,24 @@
  *	See the headers to pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.8 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.9 2001/03/22 04:00:11 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *	Initial version. 
+ *	Initial version.
  *
  *
  * Modifications - 28-Jul-2000 - pjw@rhyme.com.au (1.45)
  *
- * 		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
+ *		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
  *		Added code to dump 'Create Schema' statement (pg_dump)
  *		Don't bother to disable/enable triggers if we don't have a superuser (pg_restore)
  *		Cleaned up code for reconnecting to database.
@@ -47,62 +47,67 @@
 
 #include "libpq-fe.h"
 
-typedef enum _archiveFormat {
-    archUnknown = 0,
-    archCustom = 1,
-    archFiles = 2,
-    archTar = 3,
-    archNull = 4
+typedef enum _archiveFormat
+{
+	archUnknown = 0,
+	archCustom = 1,
+	archFiles = 2,
+	archTar = 3,
+	archNull = 4
 } ArchiveFormat;
 
 /*
- *  We may want to have so user-readbale data, but in the mean
- *  time this gives us some abstraction and type checking.
+ *	We may want to have so user-readbale data, but in the mean
+ *	time this gives us some abstraction and type checking.
  */
-typedef struct _Archive {
+typedef struct _Archive
+{
 	int			verbose;
-    /* The rest is private */
+	/* The rest is private */
 } Archive;
 
-typedef int     (*DataDumperPtr)(Archive* AH, char* oid, void* userArg);
+typedef int (*DataDumperPtr) (Archive *AH, char *oid, void *userArg);
 
-typedef struct _restoreOptions {
+typedef struct _restoreOptions
+{
 	int			create;			/* Issue commands to create the database */
-	int			noOwner;		/* Don't reconnect to database to match original object owner */
-	int			noReconnect;	/* Don't reconnect to database under any cirsumstances */
-	char		*superuser;		/* Username to use as superuser */
+	int			noOwner;		/* Don't reconnect to database to match
+								 * original object owner */
+	int			noReconnect;	/* Don't reconnect to database under any
+								 * cirsumstances */
+	char	   *superuser;		/* Username to use as superuser */
 	int			dataOnly;
 	int			dropSchema;
-	char		*filename;
+	char	   *filename;
 	int			schemaOnly;
 	int			verbose;
 	int			aclsSkip;
 	int			tocSummary;
-	char		*tocFile;
+	char	   *tocFile;
 	int			oidOrder;
 	int			origOrder;
 	int			rearrange;
 	int			format;
-	char		*formatName;
+	char	   *formatName;
 
 	int			selTypes;
 	int			selIndex;
 	int			selFunction;
 	int			selTrigger;
 	int			selTable;
-	char		*indexNames;
-	char		*functionNames;
-	char		*tableNames;
-	char		*triggerNames;
+	char	   *indexNames;
+	char	   *functionNames;
+	char	   *tableNames;
+	char	   *triggerNames;
 
 	int			useDB;
-	char		*dbname;
-	char		*pgport;
-	char		*pghost;
+	char	   *dbname;
+	char	   *pgport;
+	char	   *pghost;
 	int			ignoreVersion;
 	int			requirePassword;
 
-	int			*idWanted;
+	int		   *idWanted;
 	int			limitToList;
 	int			compression;
 
@@ -112,63 +117,60 @@ typedef struct _restoreOptions {
  * Main archiver interface.
  */
 
-extern void exit_horribly(Archive *AH, const char *fmt, ...);
+extern void exit_horribly(Archive *AH, const char *fmt,...);
 
 /* Lets the archibe know we have a DB connection to shutdown if it dies */
 
-PGconn* ConnectDatabase(Archive *AH,
-		const char* 	dbname,
-		const char*	pghost,
-		const char*	pgport,
-		const int	reqPwd,
-		const int	ignoreVersion);
+PGconn *ConnectDatabase(Archive *AH,
+				const char *dbname,
+				const char *pghost,
+				const char *pgport,
+				const int reqPwd,
+				const int ignoreVersion);
 
 
 /* Called to add a TOC entry */
-extern void	ArchiveEntry(Archive* AH, const char* oid, const char* name,
-			const char* desc, const char* (deps[]), const char* defn,
-			const char* dropStmt, const char* copyStmt, const char* owner, 
-			DataDumperPtr dumpFn, void* dumpArg);
+extern void ArchiveEntry(Archive *AH, const char *oid, const char *name,
+			 const char *desc, const char *(deps[]), const char *defn,
+		   const char *dropStmt, const char *copyStmt, const char *owner,
+			 DataDumperPtr dumpFn, void *dumpArg);
 
 /* Called to write *data* to the archive */
-extern int	WriteData(Archive* AH, const void* data, int dLen);
+extern int	WriteData(Archive *AH, const void *data, int dLen);
 
-/* 
-extern int 	StartBlobs(Archive* AH);
+/*
+extern int	StartBlobs(Archive* AH);
 extern int	EndBlobs(Archive* AH);
 */
-extern int	StartBlob(Archive* AH, int oid);
-extern int	EndBlob(Archive* AH, int oid);
+extern int	StartBlob(Archive *AH, int oid);
+extern int	EndBlob(Archive *AH, int oid);
 
-extern void	CloseArchive(Archive* AH);
+extern void CloseArchive(Archive *AH);
 
-extern void	RestoreArchive(Archive* AH, RestoreOptions *ropt);
+extern void RestoreArchive(Archive *AH, RestoreOptions *ropt);
 
 /* Open an existing archive */
-extern Archive* OpenArchive(const char* FileSpec, const ArchiveFormat fmt);
+extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
 
 /* Create a new archive */
-extern Archive* CreateArchive(const char* FileSpec, const ArchiveFormat fmt, 
-								const int compression);
+extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
+			  const int compression);
 
 /* The --list option */
-extern void	PrintTOCSummary(Archive* AH, RestoreOptions *ropt);
+extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
 
-extern RestoreOptions*		NewRestoreOptions(void);
+extern RestoreOptions *NewRestoreOptions(void);
 
 /* Rearrange TOC entries */
-extern void	MoveToStart(Archive* AH, char *oType);
-extern void 	MoveToEnd(Archive* AH, char *oType); 
-extern void	SortTocByOID(Archive* AH);
-extern void	SortTocByID(Archive* AH);
-extern void	SortTocFromFile(Archive* AH, RestoreOptions *ropt);
+extern void MoveToStart(Archive *AH, char *oType);
+extern void MoveToEnd(Archive *AH, char *oType);
+extern void SortTocByOID(Archive *AH);
+extern void SortTocByID(Archive *AH);
+extern void SortTocFromFile(Archive *AH, RestoreOptions *ropt);
 
 /* Convenience functions used only when writing DATA */
-extern int archputs(const char *s, Archive* AH);
-extern int archputc(const char c, Archive* AH);
-extern int archprintf(Archive* AH, const char *fmt, ...);
+extern int	archputs(const char *s, Archive *AH);
+extern int	archputc(const char c, Archive *AH);
+extern int	archprintf(Archive *AH, const char *fmt,...);
 
 #endif
-
-
-
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index cd0fd9c3125d521585613b9a5609e082f43269a9..adaf7c46d245f376db47793f24f742ae23dda2a8 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -8,18 +8,18 @@
  *
  * Copyright (c) 2000, Philip Warner
  *	Rights are granted to use this software in any way so long
- * 	as this notice is not removed.
+ *	as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.21 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.22 2001/03/22 04:00:11 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *		Initial version. 
+ *		Initial version.
  *
  * Modifications - 31-Jul-2000 - pjw@rhyme.com.au (1.46, 1.47)
  *		Fixed version number initialization in _allocAH (pg_backup_archiver.c)
@@ -29,9 +29,9 @@
  *		Added {Start,End}RestoreBlobs to allow extended TX during BLOB restore.
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
- *	  -	strdup() the current user just in case it's deallocated from it's TOC
- *      entry. Should *never* happen, but that's what they said about the 
- *      Titanic...
+ *	  - strdup() the current user just in case it's deallocated from it's TOC
+ *		entry. Should *never* happen, but that's what they said about the
+ *		Titanic...
  *
  *	  - Check results of IO routines more carefully.
  *
@@ -49,7 +49,7 @@
 #include "pg_backup_db.h"
 
 #include <string.h>
-#include <unistd.h> /* for dup */
+#include <unistd.h>				/* for dup */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -58,69 +58,75 @@
 #include "pqexpbuffer.h"
 #include "libpq/libpq-fs.h"
 
-static void		_SortToc(ArchiveHandle* AH, TocSortCompareFn fn);
-static int		_tocSortCompareByOIDNum(const void *p1, const void *p2);
-static int		_tocSortCompareByIDNum(const void *p1, const void *p2);
-static ArchiveHandle* 	_allocAH(const char* FileSpec, const ArchiveFormat fmt, 
-				const int compression, ArchiveMode mode);
-static int 		_printTocEntry(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt);
+static void _SortToc(ArchiveHandle *AH, TocSortCompareFn fn);
+static int	_tocSortCompareByOIDNum(const void *p1, const void *p2);
+static int	_tocSortCompareByIDNum(const void *p1, const void *p2);
+static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt,
+		 const int compression, ArchiveMode mode);
+static int	_printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 
-static void		_reconnectAsOwner(ArchiveHandle* AH, const char *dbname, TocEntry* te);
-static void		_reconnectAsUser(ArchiveHandle* AH, const char *dbname, char *user);
+static void _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te);
+static void _reconnectAsUser(ArchiveHandle *AH, const char *dbname, char *user);
 
-static int		_tocEntryRequired(TocEntry* te, RestoreOptions *ropt);
-static void		_disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
-static void		_enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
-static TocEntry*	_getTocEntry(ArchiveHandle* AH, int id);
-static void		_moveAfter(ArchiveHandle* AH, TocEntry* pos, TocEntry* te);
-static void		_moveBefore(ArchiveHandle* AH, TocEntry* pos, TocEntry* te);
-static int		_discoverArchiveFormat(ArchiveHandle* AH);
+static int	_tocEntryRequired(TocEntry *te, RestoreOptions *ropt);
+static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static TocEntry *_getTocEntry(ArchiveHandle *AH, int id);
+static void _moveAfter(ArchiveHandle *AH, TocEntry *pos, TocEntry *te);
+static void _moveBefore(ArchiveHandle *AH, TocEntry *pos, TocEntry *te);
+static int	_discoverArchiveFormat(ArchiveHandle *AH);
 
-static char	*progname = "Archiver";
+static char *progname = "Archiver";
 
-static void		_die_horribly(ArchiveHandle *AH, const char *fmt, va_list ap);
+static void _die_horribly(ArchiveHandle *AH, const char *fmt, va_list ap);
 
-static int 		_canRestoreBlobs(ArchiveHandle *AH);
-static int 		_restoringToDB(ArchiveHandle *AH);
+static int	_canRestoreBlobs(ArchiveHandle *AH);
+static int	_restoringToDB(ArchiveHandle *AH);
 
 /*
- *  Wrapper functions.
- * 
- *  The objective it to make writing new formats and dumpers as simple
- *  as possible, if necessary at the expense of extra function calls etc.
+ *	Wrapper functions.
+ *
+ *	The objective it to make writing new formats and dumpers as simple
+ *	as possible, if necessary at the expense of extra function calls etc.
  *
  */
 
 
 /* Create a new archive */
 /* Public */
-Archive* CreateArchive(const char* FileSpec, const ArchiveFormat fmt,
-                                const int compression)
+Archive    *
+CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
+			  const int compression)
 
 {
-    ArchiveHandle*	AH = _allocAH(FileSpec, fmt, compression, archModeWrite);
-    return (Archive*)AH;
+	ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, archModeWrite);
+
+	return (Archive *) AH;
 }
 
 /* Open an existing archive */
 /* Public */
-Archive* OpenArchive(const char* FileSpec, const ArchiveFormat fmt) 
+Archive    *
+OpenArchive(const char *FileSpec, const ArchiveFormat fmt)
 {
-    ArchiveHandle*      AH = _allocAH(FileSpec, fmt, 0, archModeRead);
-    return (Archive*)AH;
+	ArchiveHandle *AH = _allocAH(FileSpec, fmt, 0, archModeRead);
+
+	return (Archive *) AH;
 }
 
 /* Public */
-void	CloseArchive(Archive* AHX)
+void
+CloseArchive(Archive *AHX)
 {
-	int					res = 0;
-    ArchiveHandle*      AH = (ArchiveHandle*)AHX;
-    (*AH->ClosePtr)(AH);
+	int			res = 0;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+
+	(*AH->ClosePtr) (AH);
 
-    /* Close the output */
-    if (AH->gzOut)
+	/* Close the output */
+	if (AH->gzOut)
 		res = GZCLOSE(AH->OF);
-    else if (AH->OF != stdout)
+	else if (AH->OF != stdout)
 		res = fclose(AH->OF);
 
 	if (res != 0)
@@ -128,18 +134,19 @@ void	CloseArchive(Archive* AHX)
 }
 
 /* Public */
-void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
+void
+RestoreArchive(Archive *AHX, RestoreOptions *ropt)
 {
-    ArchiveHandle*	AH = (ArchiveHandle*) AHX;
-    TocEntry		*te = AH->toc->next;
-    int				reqs;
-    OutputContext	sav;
-	int				impliedDataOnly;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	TocEntry   *te = AH->toc->next;
+	int			reqs;
+	OutputContext sav;
+	int			impliedDataOnly;
 
 	AH->ropt = ropt;
 
 	if (ropt->create && ropt->noReconnect)
-		die_horribly(AH, "%s: --create and --no-reconnect are incompatible options\n",progname);
+		die_horribly(AH, "%s: --create and --no-reconnect are incompatible options\n", progname);
 
 	/*
 	 * If we're using a DB connection, then connect it.
@@ -150,11 +157,12 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 		if (AH->version < K_VERS_1_3)
 			die_horribly(AH, "Direct database connections are not supported in pre-1.3 archives");
 
-		ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport, 
-							ropt->requirePassword, ropt->ignoreVersion);
+		ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport,
+						ropt->requirePassword, ropt->ignoreVersion);
 
 		/*
-		 * If no superuser was specified then see if the current user will do...
+		 * If no superuser was specified then see if the current user will
+		 * do...
 		 */
 		if (!ropt->superuser)
 		{
@@ -165,20 +173,23 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 	}
 
 	/*
-	 * Work out if we have an implied data-only retore. This can happen if 
-	 * the dump was data only or if the user has used a toc list to exclude
-     * all of the schema data. All we do is look for schema entries - if none
-	 * are found then we set the dataOnly flag. 
+	 * Work out if we have an implied data-only retore. This can happen if
+	 * the dump was data only or if the user has used a toc list to
+	 * exclude all of the schema data. All we do is look for schema
+	 * entries - if none are found then we set the dataOnly flag.
 	 *
-	 * We could scan for wanted TABLE entries, but that is not the same as 
+	 * We could scan for wanted TABLE entries, but that is not the same as
 	 * dataOnly. At this stage, it seems unnecessary (6-Mar-2001).
-     */
-    if (!ropt->dataOnly) {
+	 */
+	if (!ropt->dataOnly)
+	{
 		te = AH->toc->next;
 		impliedDataOnly = 1;
-		while (te != AH->toc) {
+		while (te != AH->toc)
+		{
 			reqs = _tocEntryRequired(te, ropt);
-			if ( (reqs & 1) != 0 ) {  /* It's schema, and it's wanted */
+			if ((reqs & 1) != 0)
+			{					/* It's schema, and it's wanted */
 				impliedDataOnly = 0;
 				break;
 			}
@@ -189,31 +200,34 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 			ropt->dataOnly = impliedDataOnly;
 			ahlog(AH, 1, "Implied data-only restore\n");
 		}
-    }
+	}
 
 	if (!ropt->superuser)
 		fprintf(stderr, "\n%s: ******** WARNING ******** \n"
-							"        Data restoration may fail since any defined triggers\n"
-							"        can not be disabled (no superuser username specified).\n"
-							"        This is only a problem for restoration into a database\n"
-							"        with triggers already defined.\n\n", progname);
+		 "        Data restoration may fail since any defined triggers\n"
+		"        can not be disabled (no superuser username specified).\n"
+		"        This is only a problem for restoration into a database\n"
+				"        with triggers already defined.\n\n", progname);
 
 	/*
-	 *	Setup the output file if necessary.
+	 * Setup the output file if necessary.
 	 */
-    if (ropt->filename || ropt->compression)
+	if (ropt->filename || ropt->compression)
 		sav = SetOutput(AH, ropt->filename, ropt->compression);
 
-    ahprintf(AH, "--\n-- Selected TOC Entries:\n--\n");
+	ahprintf(AH, "--\n-- Selected TOC Entries:\n--\n");
 
-    /*
-     * Drop the items at the start, in reverse order 
+	/*
+	 * Drop the items at the start, in reverse order
 	 */
-    if (ropt->dropSchema) {
+	if (ropt->dropSchema)
+	{
 		te = AH->toc->prev;
-		while (te != AH->toc) {
+		while (te != AH->toc)
+		{
 			reqs = _tocEntryRequired(te, ropt);
-			if ( ( (reqs & 1) != 0) && te->dropStmt) {  /* We want the schema */
+			if (((reqs & 1) != 0) && te->dropStmt)
+			{					/* We want the schema */
 				ahlog(AH, 1, "Dropping %s %s\n", te->desc, te->name);
 				/* Reconnect if necessary */
 				_reconnectAsOwner(AH, "-", te);
@@ -222,18 +236,19 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 			}
 			te = te->prev;
 		}
-    }
+	}
 
 	/*
 	 * Now process each TOC entry
 	 */
-    te = AH->toc->next;
-    while (te != AH->toc) {
+	te = AH->toc->next;
+	while (te != AH->toc)
+	{
 
 		/* Work out what, if anything, we want from this entry */
 		reqs = _tocEntryRequired(te, ropt);
 
-		if ( (reqs & 1) != 0) /* We want the schema */
+		if ((reqs & 1) != 0)	/* We want the schema */
 		{
 			/* Reconnect if necessary */
 			_reconnectAsOwner(AH, "-", te);
@@ -242,67 +257,78 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 			_printTocEntry(AH, te, ropt);
 
 			/* If we created a DB, connect to it... */
-			if (strcmp(te->desc,"DATABASE") == 0)
+			if (strcmp(te->desc, "DATABASE") == 0)
 			{
-				ahlog(AH, 1, "Connecting to new DB '%s' as %s\n",te->name, te->owner);
+				ahlog(AH, 1, "Connecting to new DB '%s' as %s\n", te->name, te->owner);
 				_reconnectAsUser(AH, te->name, te->owner);
 			}
 		}
 
-		/* 
-		 * If we want data, and it has data, then restore that too 
+		/*
+		 * If we want data, and it has data, then restore that too
 		 */
-		if (AH->PrintTocDataPtr != NULL && (reqs & 2) != 0) {
+		if (AH->PrintTocDataPtr !=NULL && (reqs & 2) != 0)
+		{
 #ifndef HAVE_LIBZ
 			if (AH->compression != 0)
 				die_horribly(AH, "%s: Unable to restore data from a compressed archive\n", progname);
 #endif
 
 			ahprintf(AH, "--\n-- Data for TOC Entry ID %d (OID %s) %s %s\n--\n\n",
-						te->id, te->oid, te->desc, te->name);
+					 te->id, te->oid, te->desc, te->name);
 
 			/*
-			 * Maybe we can't do BLOBS, so check if this node is for BLOBS 
+			 * Maybe we can't do BLOBS, so check if this node is for BLOBS
 			 */
-			if ((strcmp(te->desc,"BLOBS") == 0) && !_canRestoreBlobs(AH))
+			if ((strcmp(te->desc, "BLOBS") == 0) && !_canRestoreBlobs(AH))
 			{
 				ahprintf(AH, "--\n-- SKIPPED \n--\n\n");
+
 				/*
-				 * This is a bit nasty - we assume, for the moment, that if a custom
-				 * output is used, then we don't want warnings.
+				 * This is a bit nasty - we assume, for the moment, that
+				 * if a custom output is used, then we don't want
+				 * warnings.
 				 */
 				if (!AH->CustomOutPtr)
 					fprintf(stderr, "%s: WARNING - skipping BLOB restoration\n", progname);
 
-			} else {
+			}
+			else
+			{
 
 				_disableTriggersIfNecessary(AH, te, ropt);
 
-				/* Reconnect if necessary (_disableTriggers may have reconnected) */
+				/*
+				 * Reconnect if necessary (_disableTriggers may have
+				 * reconnected)
+				 */
 				_reconnectAsOwner(AH, "-", te);
 
 				ahlog(AH, 1, "Restoring data for %s \n", te->name);
 
-				/* If we have a copy statement, use it. As of V1.3, these are separate 
-				 * to allow easy import from withing a database connection. Pre 1.3 
-				 * archives can not use DB connections and are sent to output only.
+				/*
+				 * If we have a copy statement, use it. As of V1.3, these
+				 * are separate to allow easy import from withing a
+				 * database connection. Pre 1.3 archives can not use DB
+				 * connections and are sent to output only.
 				 *
-				 * For V1.3+, the table data MUST have a copy statement so that 
-				 * we can go into appropriate mode with libpq.
+				 * For V1.3+, the table data MUST have a copy statement so
+				 * that we can go into appropriate mode with libpq.
 				 */
 				if (te->copyStmt && strlen(te->copyStmt) > 0)
 					ahprintf(AH, te->copyStmt);
 
-				(*AH->PrintTocDataPtr)(AH, te, ropt);
+				(*AH->PrintTocDataPtr) (AH, te, ropt);
 
 				_enableTriggersIfNecessary(AH, te, ropt);
 			}
 		}
 		te = te->next;
-    }
+	}
 
 	/*
-	 * Now use blobs_xref (if used) to fixup any refs for tables that we loaded
+	 * Now use blobs_xref (if used) to fixup any refs for tables that we
+	 * loaded
 	 */
 	if (_canRestoreBlobs(AH) && AH->createdBlobXref)
 	{
@@ -310,25 +336,25 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 		_disableTriggersIfNecessary(AH, NULL, ropt);
 
 		te = AH->toc->next;
-		while (te != AH->toc) {
+		while (te != AH->toc)
+		{
 
 			/* Is it table data? */
-			if (strcmp(te->desc, "TABLE DATA") == 0) {
+			if (strcmp(te->desc, "TABLE DATA") == 0)
+			{
 
 				ahlog(AH, 2, "Checking if we loaded %s\n", te->name);
 
 				reqs = _tocEntryRequired(te, ropt);
 
-				if ( (reqs & 2) != 0) /* We loaded the data */
+				if ((reqs & 2) != 0)	/* We loaded the data */
 				{
 					ahlog(AH, 1, "Fixing up BLOB ref for %s\n", te->name);
 					FixupBlobRefs(AH, te->name);
 				}
 			}
 			else
-			{
 				ahlog(AH, 2, "Ignoring BLOB xrefs for %s %s\n", te->desc, te->name);
-			}
 
 			te = te->next;
 		}
@@ -340,7 +366,7 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
 	/*
 	 * Clean up & we're done.
 	 */
-    if (ropt->filename)
+	if (ropt->filename)
 		ResetOutput(AH, sav);
 
 	if (ropt->useDB)
@@ -360,47 +386,53 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
  * Allocate a new RestoreOptions block.
  * This is mainly so we can initialize it, but also for future expansion,
  */
-RestoreOptions*		NewRestoreOptions(void)
+RestoreOptions *
+NewRestoreOptions(void)
 {
-	RestoreOptions* opts;
+	RestoreOptions *opts;
 
-	opts = (RestoreOptions*)calloc(1, sizeof(RestoreOptions));
+	opts = (RestoreOptions *) calloc(1, sizeof(RestoreOptions));
 
 	opts->format = archUnknown;
 
 	return opts;
 }
 
-static int _restoringToDB(ArchiveHandle *AH)
+static int
+_restoringToDB(ArchiveHandle *AH)
 {
 	return (AH->ropt->useDB && AH->connection);
 }
 
-static int _canRestoreBlobs(ArchiveHandle *AH)
+static int
+_canRestoreBlobs(ArchiveHandle *AH)
 {
 	return _restoringToDB(AH);
 }
 
-static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+static void
+_disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-	char	*oldUser = NULL;
+	char	   *oldUser = NULL;
 
 	/* Can't do much if we're connected & don't have a superuser */
-    /* Also, don't bother with triggers unless a data-only retore. */
-	if ( !ropt->dataOnly || (_restoringToDB(AH) && !ropt->superuser) )
+	/* Also, don't bother with triggers unless a data-only retore. */
+	if (!ropt->dataOnly || (_restoringToDB(AH) && !ropt->superuser))
 		return;
 
 	/*
-     * Reconnect as superuser if possible, since they are the only ones
+	 * Reconnect as superuser if possible, since they are the only ones
 	 * who can update pg_class...
 	 */
 	if (ropt->superuser)
 	{
 		if (!_restoringToDB(AH) || !ConnectedUserIsSuperuser(AH))
 		{
-			/* If we're not allowing changes for ownership, then remember the user
-			 * so we can change it back here. Otherwise, let _reconnectAsOwner
-			 * do what it has to do.
+
+			/*
+			 * If we're not allowing changes for ownership, then remember
+			 * the user so we can change it back here. Otherwise, let
+			 * _reconnectAsOwner do what it has to do.
 			 */
 			if (ropt->noOwner)
 				oldUser = strdup(ConnectedUser(AH));
@@ -411,24 +443,24 @@ static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, Restore
 	ahlog(AH, 1, "Disabling triggers\n");
 
 	/*
-     * Disable them. This is a hack. Needs to be done via an appropriate 'SET'
-	 * command when one is available.
+	 * Disable them. This is a hack. Needs to be done via an appropriate
+	 * 'SET' command when one is available.
 	 */
-    ahprintf(AH, "-- Disable triggers\n");
+	ahprintf(AH, "-- Disable triggers\n");
 
 	/*
 	 * Just update the AFFECTED table, if known.
 	 */
 
 	if (te && te->name && strlen(te->name) > 0)
-		ahprintf(AH, "UPDATE \"pg_class\" SET \"reltriggers\" = 0 WHERE \"relname\" = '%s';\n\n", 
-						te->name);
+		ahprintf(AH, "UPDATE \"pg_class\" SET \"reltriggers\" = 0 WHERE \"relname\" = '%s';\n\n",
+				 te->name);
 	else
 		ahprintf(AH, "UPDATE \"pg_class\" SET \"reltriggers\" = 0 WHERE \"relname\" !~ '^pg_';\n\n");
 
 	/*
-	 * Restore the user connection from the start of this procedure
-	 * if _reconnectAsOwner is disabled.
+	 * Restore the user connection from the start of this procedure if
+	 * _reconnectAsOwner is disabled.
 	 */
 	if (ropt->noOwner && oldUser)
 	{
@@ -437,13 +469,14 @@ static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, Restore
 	}
 }
 
-static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+static void
+_enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-	char		*oldUser = NULL;
+	char	   *oldUser = NULL;
 
 	/* Can't do much if we're connected & don't have a superuser */
 	/* Also, don't bother with triggers unless a data-only retore. */
-	if ( !ropt->dataOnly || (_restoringToDB(AH) && !ropt->superuser) )
+	if (!ropt->dataOnly || (_restoringToDB(AH) && !ropt->superuser))
 		return;
 
 	/*
@@ -454,9 +487,11 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
 	{
 		if (!_restoringToDB(AH) || !ConnectedUserIsSuperuser(AH))
 		{
-			/* If we're not allowing changes for ownership, then remember the user
-			 * so we can change it back here. Otherwise, let _reconnectAsOwner
-			 * do what it has to do
+
+			/*
+			 * If we're not allowing changes for ownership, then remember
+			 * the user so we can change it back here. Otherwise, let
+			 * _reconnectAsOwner do what it has to do
 			 */
 			if (ropt->noOwner)
 				oldUser = strdup(ConnectedUser(AH));
@@ -468,25 +503,27 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
 	ahlog(AH, 1, "Enabling triggers\n");
 
 	/*
-	 * Enable them. This is a hack. Needs to be done via an appropriate 'SET'
-	 * command when one is available.
+	 * Enable them. This is a hack. Needs to be done via an appropriate
+	 * 'SET' command when one is available.
 	 */
-    ahprintf(AH, "-- Enable triggers\n");
+	ahprintf(AH, "-- Enable triggers\n");
 	if (te && te->name && strlen(te->name) > 0)
 	{
 		ahprintf(AH, "UPDATE pg_class SET reltriggers = "
-				 "(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
+		"(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
 				 "WHERE relname = '%s';\n\n",
-				te->name);
-	} else {
+				 te->name);
+	}
+	else
+	{
 		ahprintf(AH, "UPDATE \"pg_class\" SET \"reltriggers\" = "
-				 "(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
+		"(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
 				 "WHERE \"relname\" !~ '^pg_';\n\n");
 	}
 
 	/*
-	 * Restore the user connection from the start of this procedure
-	 * if _reconnectAsOwner is disabled.
+	 * Restore the user connection from the start of this procedure if
+	 * _reconnectAsOwner is disabled.
 	 */
 	if (ropt->noOwner && oldUser)
 	{
@@ -500,82 +537,88 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
  */
 
 /* Public */
-int	WriteData(Archive* AHX, const void* data, int dLen)
+int
+WriteData(Archive *AHX, const void *data, int dLen)
 {
-    ArchiveHandle*      AH = (ArchiveHandle*)AHX;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
 
 	if (!AH->currToc)
 		die_horribly(AH, "%s: WriteData can not be called outside the context of "
-						"a DataDumper routine\n", progname);
+					 "a DataDumper routine\n", progname);
 
-    return (*AH->WriteDataPtr)(AH, data, dLen);
+	return (*AH->WriteDataPtr) (AH, data, dLen);
 }
 
 /*
- * Create a new TOC entry. The TOC was designed as a TOC, but is now the 
+ * Create a new TOC entry. The TOC was designed as a TOC, but is now the
  * repository for all metadata. But the name has stuck.
  */
 
 /* Public */
-void	ArchiveEntry(Archive* AHX, const char* oid, const char* name,
-			const char* desc, const char* (deps[]), const char* defn,
-			const char* dropStmt, const char* copyStmt, const char* owner,
-			DataDumperPtr dumpFn, void* dumpArg)
+void
+ArchiveEntry(Archive *AHX, const char *oid, const char *name,
+			 const char *desc, const char *(deps[]), const char *defn,
+		   const char *dropStmt, const char *copyStmt, const char *owner,
+			 DataDumperPtr dumpFn, void *dumpArg)
 {
-    ArchiveHandle*	AH = (ArchiveHandle*)AHX;
-    TocEntry*		newToc;
-
-    AH->lastID++;
-    AH->tocCount++;
-
-    newToc = (TocEntry*)calloc(1, sizeof(TocEntry));
-    if (!newToc)
-	die_horribly(AH, "Archiver: unable to allocate memory for TOC entry\n");
-
-    newToc->prev = AH->toc->prev;
-    newToc->next = AH->toc;
-    AH->toc->prev->next = newToc;
-    AH->toc->prev = newToc;
-
-    newToc->id = AH->lastID;
-    newToc->oid = strdup(oid);
-    newToc->oidVal = atoi(oid);
-    newToc->name = strdup(name);
-    newToc->desc = strdup(desc);
-    newToc->defn = strdup(defn);
-    newToc->dropStmt = strdup(dropStmt);
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	TocEntry   *newToc;
+
+	AH->lastID++;
+	AH->tocCount++;
+
+	newToc = (TocEntry *) calloc(1, sizeof(TocEntry));
+	if (!newToc)
+		die_horribly(AH, "Archiver: unable to allocate memory for TOC entry\n");
+
+	newToc->prev = AH->toc->prev;
+	newToc->next = AH->toc;
+	AH->toc->prev->next = newToc;
+	AH->toc->prev = newToc;
+
+	newToc->id = AH->lastID;
+	newToc->oid = strdup(oid);
+	newToc->oidVal = atoi(oid);
+	newToc->name = strdup(name);
+	newToc->desc = strdup(desc);
+	newToc->defn = strdup(defn);
+	newToc->dropStmt = strdup(dropStmt);
 	newToc->copyStmt = copyStmt ? strdup(copyStmt) : NULL;
-    newToc->owner = strdup(owner);
-    newToc->printed = 0;
-    newToc->formatData = NULL;
-    newToc->dataDumper = dumpFn,
-    newToc->dataDumperArg = dumpArg;
+	newToc->owner = strdup(owner);
+	newToc->printed = 0;
+	newToc->formatData = NULL;
+	newToc->dataDumper = dumpFn,
+		newToc->dataDumperArg = dumpArg;
 
-    newToc->hadDumper = dumpFn ? 1 : 0;
+	newToc->hadDumper = dumpFn ? 1 : 0;
 
-    if (AH->ArchiveEntryPtr != NULL) {
-		(*AH->ArchiveEntryPtr)(AH, newToc);
-    }
+	if (AH->ArchiveEntryPtr !=NULL)
+		(*AH->ArchiveEntryPtr) (AH, newToc);
 
-    /* printf("New toc owned by '%s', oid %d\n", newToc->owner, newToc->oidVal); */
+	/*
+	 * printf("New toc owned by '%s', oid %d\n", newToc->owner,
+	 * newToc->oidVal);
+	 */
 }
 
 /* Public */
-void PrintTOCSummary(Archive* AHX, RestoreOptions *ropt)
+void
+PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
 {
-    ArchiveHandle*	AH = (ArchiveHandle*) AHX;
-    TocEntry		*te = AH->toc->next;
-    OutputContext	sav;
-	char			*fmtName;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	TocEntry   *te = AH->toc->next;
+	OutputContext sav;
+	char	   *fmtName;
 
-    if (ropt->filename)
-	sav = SetOutput(AH, ropt->filename, ropt->compression);
+	if (ropt->filename)
+		sav = SetOutput(AH, ropt->filename, ropt->compression);
 
 	ahprintf(AH, ";\n; Archive created at %s", ctime(&AH->createDate));
 	ahprintf(AH, ";     dbname: %s\n;     TOC Entries: %d\n;     Compression: %d\n",
-				AH->archdbname, AH->tocCount, AH->compression);
+			 AH->archdbname, AH->tocCount, AH->compression);
 
-	switch (AH->format) {
+	switch (AH->format)
+	{
 		case archFiles:
 			fmtName = "FILES";
 			break;
@@ -592,16 +635,17 @@ void PrintTOCSummary(Archive* AHX, RestoreOptions *ropt)
 	ahprintf(AH, ";     Dump Version: %d.%d-%d\n", AH->vmaj, AH->vmin, AH->vrev);
 	ahprintf(AH, ";     Format: %s\n;\n", fmtName);
 
-    ahprintf(AH, ";\n; Selected TOC Entries:\n;\n");
+	ahprintf(AH, ";\n; Selected TOC Entries:\n;\n");
 
-    while (te != AH->toc) {
-	if (_tocEntryRequired(te, ropt) != 0)
-		ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->name, te->owner);
+	while (te != AH->toc)
+	{
+		if (_tocEntryRequired(te, ropt) != 0)
+			ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->name, te->owner);
 		te = te->next;
-    }
+	}
 
-    if (ropt->filename)
-	ResetOutput(AH, sav);
+	if (ropt->filename)
+		ResetOutput(AH, sav);
 }
 
 /***********
@@ -609,27 +653,29 @@ void PrintTOCSummary(Archive* AHX, RestoreOptions *ropt)
  ***********/
 
 /* Called by a dumper to signal start of a BLOB */
-int StartBlob(Archive* AHX, int oid)
+int
+StartBlob(Archive *AHX, int oid)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
 
-    if (!AH->StartBlobPtr)
+	if (!AH->StartBlobPtr)
 		die_horribly(AH, "%s: BLOB output not supported in chosen format\n", progname);
 
-    (*AH->StartBlobPtr)(AH, AH->currToc, oid);
+	(*AH->StartBlobPtr) (AH, AH->currToc, oid);
 
-    return 1;
+	return 1;
 }
 
 /* Called by a dumper to signal end of a BLOB */
-int EndBlob(Archive* AHX, int oid)
+int
+EndBlob(Archive *AHX, int oid)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
 
-    if (AH->EndBlobPtr)
-		(*AH->EndBlobPtr)(AH, AH->currToc, oid);
+	if (AH->EndBlobPtr)
+		(*AH->EndBlobPtr) (AH, AH->currToc, oid);
 
-    return 1;
+	return 1;
 }
 
 /**********
@@ -637,17 +683,19 @@ int EndBlob(Archive* AHX, int oid)
  **********/
 
 /*
- * Called by a format handler before any blobs are restored 
+ * Called by a format handler before any blobs are restored
  */
-void StartRestoreBlobs(ArchiveHandle* AH)
+void
+StartRestoreBlobs(ArchiveHandle *AH)
 {
 	AH->blobCount = 0;
 }
 
 /*
- * Called by a format handler after all blobs are restored 
+ * Called by a format handler after all blobs are restored
  */
-void EndRestoreBlobs(ArchiveHandle* AH)
+void
+EndRestoreBlobs(ArchiveHandle *AH)
 {
 	if (AH->txActive)
 	{
@@ -656,9 +704,7 @@ void EndRestoreBlobs(ArchiveHandle* AH)
 	}
 
 	if (AH->blobTxActive)
-	{
 		CommitTransactionXref(AH);
-	}
 
 	ahlog(AH, 1, "Restored %d BLOBs\n", AH->blobCount);
 }
@@ -667,7 +713,8 @@ void EndRestoreBlobs(ArchiveHandle* AH)
 /*
  * Called by a format handler to initiate restoration of a blob
  */
-void StartRestoreBlob(ArchiveHandle* AH, int oid)
+void
+StartRestoreBlob(ArchiveHandle *AH, int oid)
 {
 	int			loOid;
 
@@ -691,9 +738,7 @@ void StartRestoreBlob(ArchiveHandle* AH, int oid)
 		StartTransaction(AH);
 	}
 	if (!AH->blobTxActive)
-	{
 		StartTransactionXref(AH);
-	}
 
 	loOid = lo_creat(AH->connection, INV_READ | INV_WRITE);
 	if (loOid == 0)
@@ -707,18 +752,19 @@ void StartRestoreBlob(ArchiveHandle* AH, int oid)
 	if (AH->loFd == -1)
 		die_horribly(AH, "%s: unable to open BLOB\n", progname);
 
-    AH->writingBlob = 1;
+	AH->writingBlob = 1;
 }
 
-void EndRestoreBlob(ArchiveHandle* AH, int oid)
+void
+EndRestoreBlob(ArchiveHandle *AH, int oid)
 {
-    lo_close(AH->connection, AH->loFd);
-    AH->writingBlob = 0;
+	lo_close(AH->connection, AH->loFd);
+	AH->writingBlob = 0;
 
 	/*
 	 * Commit every BLOB_BATCH_SIZE blobs...
 	 */
-	if ( ((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount) 
+	if (((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount)
 	{
 		ahlog(AH, 2, "Committing BLOB transactions\n");
 		CommitTransaction(AH);
@@ -735,25 +781,27 @@ void EndRestoreBlob(ArchiveHandle* AH, int oid)
  */
 
 /* Public */
-void MoveToStart(Archive* AHX, char *oType) 
+void
+MoveToStart(Archive *AHX, char *oType)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
-    TocEntry	*te = AH->toc->next;
-    TocEntry	*newTe;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	TocEntry   *te = AH->toc->next;
+	TocEntry   *newTe;
 
-    while (te != AH->toc) {
+	while (te != AH->toc)
+	{
 		te->_moved = 0;
 		te = te->next;
-    }
-
-    te = AH->toc->prev;
-    while (te != AH->toc && !te->_moved) {
-	newTe = te->prev;
-	if (strcmp(te->desc, oType) == 0) {
-	    _moveAfter(AH, AH->toc, te);
 	}
+
+	te = AH->toc->prev;
+	while (te != AH->toc && !te->_moved)
+	{
+		newTe = te->prev;
+		if (strcmp(te->desc, oType) == 0)
+			_moveAfter(AH, AH->toc, te);
 		te = newTe;
-    }
+	}
 }
 
 
@@ -761,116 +809,124 @@ void MoveToStart(Archive* AHX, char *oType)
  * Move TOC entries of the specified type to the end of the TOC.
  */
 /* Public */
-void MoveToEnd(Archive* AHX, char *oType) 
+void
+MoveToEnd(Archive *AHX, char *oType)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
-    TocEntry	*te = AH->toc->next;
-    TocEntry	*newTe;
-
-    while (te != AH->toc) {
-	te->_moved = 0;
-	te = te->next;
-    }
-
-    te = AH->toc->next;
-    while (te != AH->toc && !te->_moved) {
-	newTe = te->next;
-	if (strcmp(te->desc, oType) == 0) {
-	    _moveBefore(AH, AH->toc, te);
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	TocEntry   *te = AH->toc->next;
+	TocEntry   *newTe;
+
+	while (te != AH->toc)
+	{
+		te->_moved = 0;
+		te = te->next;
 	}
+
+	te = AH->toc->next;
+	while (te != AH->toc && !te->_moved)
+	{
+		newTe = te->next;
+		if (strcmp(te->desc, oType) == 0)
+			_moveBefore(AH, AH->toc, te);
 		te = newTe;
-    }
+	}
 }
 
-/* 
+/*
  * Sort TOC by OID
  */
 /* Public */
-void SortTocByOID(Archive* AHX)
+void
+SortTocByOID(Archive *AHX)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
-    _SortToc(AH, _tocSortCompareByOIDNum);
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+
+	_SortToc(AH, _tocSortCompareByOIDNum);
 }
 
 /*
  * Sort TOC by ID
  */
 /* Public */
-void SortTocByID(Archive* AHX)
+void
+SortTocByID(Archive *AHX)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
-    _SortToc(AH, _tocSortCompareByIDNum);
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+
+	_SortToc(AH, _tocSortCompareByIDNum);
 }
 
-void SortTocFromFile(Archive* AHX, RestoreOptions *ropt)
+void
+SortTocFromFile(Archive *AHX, RestoreOptions *ropt)
 {
-    ArchiveHandle* AH = (ArchiveHandle*)AHX;
-    FILE	*fh;
-    char	buf[1024];
-    char	*cmnt;
-    char	*endptr;
-    int		id;
-    TocEntry	*te;
-    TocEntry	*tePrev;
-    int		i;
-
-    /* Allocate space for the 'wanted' array, and init it */
-    ropt->idWanted = (int*)malloc(sizeof(int)*AH->tocCount);
-    for ( i = 0 ; i < AH->tocCount ; i++ )
-	ropt->idWanted[i] = 0;
-
-    ropt->limitToList = 1;
-
-    /* Mark all entries as 'not moved' */
-    te = AH->toc->next;
-    while (te != AH->toc) {
-	te->_moved = 0;
-	te = te->next;
-    }
-
-    /* Set prev entry as head of list */
-    tePrev = AH->toc;
-
-    /* Setup the file */
-    fh = fopen(ropt->tocFile, PG_BINARY_R);
-	if (!fh)
-		die_horribly(AH, "%s: could not open TOC file\n", progname);
-
-    while (fgets(buf, 1024, fh) != NULL)
-    {
-	/* Find a comment */
-	cmnt = strchr(buf, ';');
-	if (cmnt == buf)
-	    continue;
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	FILE	   *fh;
+	char		buf[1024];
+	char	   *cmnt;
+	char	   *endptr;
+	int			id;
+	TocEntry   *te;
+	TocEntry   *tePrev;
+	int			i;
+
+	/* Allocate space for the 'wanted' array, and init it */
+	ropt->idWanted = (int *) malloc(sizeof(int) * AH->tocCount);
+	for (i = 0; i < AH->tocCount; i++)
+		ropt->idWanted[i] = 0;
+
+	ropt->limitToList = 1;
+
+	/* Mark all entries as 'not moved' */
+	te = AH->toc->next;
+	while (te != AH->toc)
+	{
+		te->_moved = 0;
+		te = te->next;
+	}
 
-	/* End string at comment */
-	if (cmnt != NULL)
-	    cmnt[0] = '\0';
+	/* Set prev entry as head of list */
+	tePrev = AH->toc;
 
-	/* Skip if all spaces */
-	if (strspn(buf, " \t") == strlen(buf))
-	    continue;
+	/* Setup the file */
+	fh = fopen(ropt->tocFile, PG_BINARY_R);
+	if (!fh)
+		die_horribly(AH, "%s: could not open TOC file\n", progname);
 
-	/* Get an ID */
-	id = strtol(buf, &endptr, 10);
-	if (endptr == buf)
+	while (fgets(buf, 1024, fh) != NULL)
 	{
-	    fprintf(stderr, "%s: WARNING - line ignored: %s\n", progname, buf);
-	    continue;
-	}
+		/* Find a comment */
+		cmnt = strchr(buf, ';');
+		if (cmnt == buf)
+			continue;
+
+		/* End string at comment */
+		if (cmnt != NULL)
+			cmnt[0] = '\0';
+
+		/* Skip if all spaces */
+		if (strspn(buf, " \t") == strlen(buf))
+			continue;
+
+		/* Get an ID */
+		id = strtol(buf, &endptr, 10);
+		if (endptr == buf)
+		{
+			fprintf(stderr, "%s: WARNING - line ignored: %s\n", progname, buf);
+			continue;
+		}
 
-	/* Find TOC entry */
-	te = _getTocEntry(AH, id);
-	if (!te) 
-	    die_horribly(AH, "%s: could not find entry for id %d\n",progname, id);
+		/* Find TOC entry */
+		te = _getTocEntry(AH, id);
+		if (!te)
+			die_horribly(AH, "%s: could not find entry for id %d\n", progname, id);
 
-	ropt->idWanted[id-1] = 1;
+		ropt->idWanted[id - 1] = 1;
 
-	_moveAfter(AH, tePrev, te);
-	tePrev = te;
-    }
+		_moveAfter(AH, tePrev, te);
+		tePrev = te;
+	}
 
-    if (fclose(fh) != 0)
+	if (fclose(fh) != 0)
 		die_horribly(AH, "%s: could not close TOC file\n", progname);
 }
 
@@ -880,41 +936,52 @@ void SortTocFromFile(Archive* AHX, RestoreOptions *ropt)
  **********************/
 
 /* Public */
-int archputs(const char *s, Archive* AH) {
-    return WriteData(AH, s, strlen(s));
+int
+archputs(const char *s, Archive *AH)
+{
+	return WriteData(AH, s, strlen(s));
 }
 
 /* Public */
-int archputc(const char c, Archive* AH) {
-    return WriteData(AH, &c, 1);
+int
+archputc(const char c, Archive *AH)
+{
+	return WriteData(AH, &c, 1);
 }
 
 /* Public */
-int archprintf(Archive* AH, const char *fmt, ...)
+int
+archprintf(Archive *AH, const char *fmt,...)
 {
-    char 	*p = NULL;
-    va_list 	ap;
-    int		bSize = strlen(fmt) + 256;
-    int		cnt = -1;
-
-    /* This is paranoid: deal with the possibility that vsnprintf is willing to ignore trailing null */
-    /* or returns > 0 even if string does not fit. It may be the case that it returns cnt = bufsize */ 
-    while (cnt < 0 || cnt >= (bSize-1) )
+	char	   *p = NULL;
+	va_list		ap;
+	int			bSize = strlen(fmt) + 256;
+	int			cnt = -1;
+
+	/*
+	 * This is paranoid: deal with the possibility that vsnprintf is
+	 * willing to ignore trailing null
+	 */
+
+	/*
+	 * or returns > 0 even if string does not fit. It may be the case that
+	 * it returns cnt = bufsize
+	 */
+	while (cnt < 0 || cnt >= (bSize - 1))
 	{
-		if (p != NULL) free(p);
+		if (p != NULL)
+			free(p);
 		bSize *= 2;
-		p = (char*)malloc(bSize);
+		p = (char *) malloc(bSize);
 		if (p == NULL)
-		{
 			exit_horribly(AH, "%s: could not allocate buffer for archprintf\n", progname);
-		}
 		va_start(ap, fmt);
 		cnt = vsnprintf(p, bSize, fmt, ap);
 		va_end(ap);
-    }
-    WriteData(AH, p, cnt);
-    free(p);
-    return cnt;
+	}
+	WriteData(AH, p, cnt);
+	free(p);
+	return cnt;
 }
 
 
@@ -922,107 +989,123 @@ int archprintf(Archive* AH, const char *fmt, ...)
  * Stuff below here should be 'private' to the archiver routines
  *******************************/
 
-OutputContext SetOutput(ArchiveHandle* AH, char *filename, int compression)
+OutputContext
+SetOutput(ArchiveHandle *AH, char *filename, int compression)
 {
-    OutputContext	sav;
+	OutputContext sav;
+
 #ifdef HAVE_LIBZ
-    char		fmode[10];
+	char		fmode[10];
+
 #endif
-    int			fn = 0;
-
-    /* Replace the AH output file handle */
-    sav.OF = AH->OF;
-    sav.gzOut = AH->gzOut;
-
-    if (filename) {
-	fn = 0;
-    } else if (AH->FH) {
-	fn = fileno(AH->FH);
-    } else if (AH->fSpec) {
-	fn = 0;
-	filename = AH->fSpec;
-    } else {
-	fn = fileno(stdout);
-    }
-
-    /* If compression explicitly requested, use gzopen */
+	int			fn = 0;
+
+	/* Replace the AH output file handle */
+	sav.OF = AH->OF;
+	sav.gzOut = AH->gzOut;
+
+	if (filename)
+		fn = 0;
+	else if (AH->FH)
+		fn = fileno(AH->FH);
+	else if (AH->fSpec)
+	{
+		fn = 0;
+		filename = AH->fSpec;
+	}
+	else
+		fn = fileno(stdout);
+
+	/* If compression explicitly requested, use gzopen */
 #ifdef HAVE_LIBZ
-    if (compression != 0)
-    {
+	if (compression != 0)
+	{
 		sprintf(fmode, "wb%d", compression);
-		if (fn) {
-			AH->OF = gzdopen(dup(fn), fmode); /* Don't use PG_BINARY_x since this is zlib */
-		} else {
-			AH->OF = gzopen(filename, fmode);
+		if (fn)
+		{
+			AH->OF = gzdopen(dup(fn), fmode);	/* Don't use PG_BINARY_x
+												 * since this is zlib */
 		}
+		else
+			AH->OF = gzopen(filename, fmode);
 		AH->gzOut = 1;
-    } else { /* Use fopen */
+	}
+	else
+	{							/* Use fopen */
 #endif
-		if (fn) {
+		if (fn)
 			AH->OF = fdopen(dup(fn), PG_BINARY_W);
-		} else {
+		else
 			AH->OF = fopen(filename, PG_BINARY_W);
-		}
 		AH->gzOut = 0;
 #ifdef HAVE_LIBZ
-    }
+	}
 #endif
 
 	if (!AH->OF)
 		die_horribly(AH, "%s: could not set output\n", progname);
 
-    return sav;
+	return sav;
 }
 
-void ResetOutput(ArchiveHandle* AH, OutputContext sav)
+void
+ResetOutput(ArchiveHandle *AH, OutputContext sav)
 {
-	int				res;
+	int			res;
 
-    if (AH->gzOut)
+	if (AH->gzOut)
 		res = GZCLOSE(AH->OF);
-    else
+	else
 		res = fclose(AH->OF);
 
 	if (res != 0)
 		die_horribly(AH, "%s: could not reset the output file\n", progname);
 
-    AH->gzOut = sav.gzOut;
-    AH->OF = sav.OF;
+	AH->gzOut = sav.gzOut;
+	AH->OF = sav.OF;
 }
 
 
 
 /*
- *  Print formatted text to the output file (usually stdout).
+ *	Print formatted text to the output file (usually stdout).
  */
-int ahprintf(ArchiveHandle* AH, const char *fmt, ...)
+int
+ahprintf(ArchiveHandle *AH, const char *fmt,...)
 {
-    char 	*p = NULL;
-    va_list 	ap;
-    int		bSize = strlen(fmt) + 256; /* Should be enough */
-    int		cnt = -1;
-
-    /* This is paranoid: deal with the possibility that vsnprintf is willing to ignore trailing null */
-    /* or returns > 0 even if string does not fit. It may be the case that it returns cnt = bufsize */ 
-    while (cnt < 0 || cnt >= (bSize - 1) )
+	char	   *p = NULL;
+	va_list		ap;
+	int			bSize = strlen(fmt) + 256;		/* Should be enough */
+	int			cnt = -1;
+
+	/*
+	 * This is paranoid: deal with the possibility that vsnprintf is
+	 * willing to ignore trailing null
+	 */
+
+	/*
+	 * or returns > 0 even if string does not fit. It may be the case that
+	 * it returns cnt = bufsize
+	 */
+	while (cnt < 0 || cnt >= (bSize - 1))
 	{
-		if (p != NULL) free(p);
+		if (p != NULL)
+			free(p);
 		bSize *= 2;
-		p = (char*)malloc(bSize);
+		p = (char *) malloc(bSize);
 		if (p == NULL)
-		{
 			die_horribly(AH, "%s: could not allocate buffer for ahprintf\n", progname);
-		}
 		va_start(ap, fmt);
 		cnt = vsnprintf(p, bSize, fmt, ap);
 		va_end(ap);
-    }
-    ahwrite(p, 1, cnt, AH);
-    free(p);
-    return cnt;
+	}
+	ahwrite(p, 1, cnt, AH);
+	free(p);
+	return cnt;
 }
 
-void ahlog(ArchiveHandle* AH, int level, const char *fmt, ...)
+void
+ahlog(ArchiveHandle *AH, int level, const char *fmt,...)
 {
 	va_list		ap;
 
@@ -1037,244 +1120,265 @@ void ahlog(ArchiveHandle* AH, int level, const char *fmt, ...)
 /*
  * Single place for logic which says 'We are restoring to a direct DB connection'.
  */
-int RestoringToDB(ArchiveHandle* AH)
+int
+RestoringToDB(ArchiveHandle *AH)
 {
 	return (AH->ropt && AH->ropt->useDB && AH->connection);
 }
 
 /*
- *  Write buffer to the output file (usually stdout). This is user for
- *  outputting 'restore' scripts etc. It is even possible for an archive
- * 	format to create a custom output routine to 'fake' a restore if it
+ *	Write buffer to the output file (usually stdout). This is user for
+ *	outputting 'restore' scripts etc. It is even possible for an archive
+ *	format to create a custom output routine to 'fake' a restore if it
  *	wants to generate a script (see TAR output).
  */
-int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle* AH)
+int
+ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
 {
-	int		res;
+	int			res;
 
-    if (AH->writingBlob)
+	if (AH->writingBlob)
 	{
-		res = lo_write(AH->connection, AH->loFd, (void*)ptr, size * nmemb);
+		res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb);
 		ahlog(AH, 5, "Wrote %d bytes of BLOB data (result = %d)\n", size * nmemb, res);
 		if (res < size * nmemb)
-			die_horribly(AH, "%s: could not write to large object (result = %d, expected %d)\n", 
-							progname, res, size * nmemb);
+			die_horribly(AH, "%s: could not write to large object (result = %d, expected %d)\n",
+						 progname, res, size * nmemb);
 
 		return res;
 	}
-    else if (AH->gzOut)
+	else if (AH->gzOut)
 	{
-		res = GZWRITE((void*)ptr, size, nmemb, AH->OF);
+		res = GZWRITE((void *) ptr, size, nmemb, AH->OF);
 		if (res != (nmemb * size))
 			die_horribly(AH, "%s: could not write to archive\n", progname);
 		return res;
 	}
-    else if (AH->CustomOutPtr)
+	else if (AH->CustomOutPtr)
 	{
-		res = AH->CustomOutPtr(AH, ptr, size * nmemb);
+		res = AH->CustomOutPtr (AH, ptr, size * nmemb);
+
 		if (res != (nmemb * size))
 			die_horribly(AH, "%s: could not write to custom output routine\n", progname);
 		return res;
 	}
 	else
 	{
+
 		/*
-		 * If we're doing a restore, and it's direct to DB, and we're connected
-	     * then send it to the DB.
-		 */	
+		 * If we're doing a restore, and it's direct to DB, and we're
+		 * connected then send it to the DB.
+		 */
 		if (RestoringToDB(AH))
-			return ExecuteSqlCommandBuf(AH, (void*)ptr, size*nmemb); /* Always 1, currently */
+			return ExecuteSqlCommandBuf(AH, (void *) ptr, size * nmemb);		/* Always 1, currently */
 		else
 		{
-			res = fwrite((void*)ptr, size, nmemb, AH->OF);
+			res = fwrite((void *) ptr, size, nmemb, AH->OF);
 			if (res != nmemb)
 				die_horribly(AH, "%s: could not write to output file (%d != %d)\n", progname, res, nmemb);
 			return res;
 		}
 	}
-}		
+}
 
 /* Common exit code */
-static void _die_horribly(ArchiveHandle *AH, const char *fmt, va_list ap)
+static void
+_die_horribly(ArchiveHandle *AH, const char *fmt, va_list ap)
 {
-    vfprintf(stderr, fmt, ap);
+	vfprintf(stderr, fmt, ap);
 
-    if (AH)
-	if (AH->connection)
-	    PQfinish(AH->connection);
+	if (AH)
+		if (AH->connection)
+			PQfinish(AH->connection);
 	if (AH->blobConnection)
 		PQfinish(AH->blobConnection);
 
-    exit(1);
+	exit(1);
 }
 
 /* External use */
-void exit_horribly(Archive *AH, const char *fmt, ...)
+void
+exit_horribly(Archive *AH, const char *fmt,...)
 {
-    va_list     ap;
+	va_list		ap;
 
-    va_start(ap, fmt);
-    _die_horribly((ArchiveHandle*)AH, fmt, ap);
+	va_start(ap, fmt);
+	_die_horribly((ArchiveHandle *) AH, fmt, ap);
 }
 
 /* Archiver use (just different arg declaration) */
-void die_horribly(ArchiveHandle *AH, const char *fmt, ...)
+void
+die_horribly(ArchiveHandle *AH, const char *fmt,...)
 {
-    va_list 	ap;
+	va_list		ap;
 
-    va_start(ap, fmt);
-    _die_horribly(AH, fmt, ap);
+	va_start(ap, fmt);
+	_die_horribly(AH, fmt, ap);
 }
 
 
-static void _moveAfter(ArchiveHandle* AH, TocEntry* pos, TocEntry* te)
+static void
+_moveAfter(ArchiveHandle *AH, TocEntry *pos, TocEntry *te)
 {
-    te->prev->next = te->next;
-    te->next->prev = te->prev;
+	te->prev->next = te->next;
+	te->next->prev = te->prev;
 
-    te->prev = pos;
-    te->next = pos->next;
+	te->prev = pos;
+	te->next = pos->next;
 
-    pos->next->prev = te;
-    pos->next = te;
+	pos->next->prev = te;
+	pos->next = te;
 
-    te->_moved = 1;
+	te->_moved = 1;
 }
 
-static void _moveBefore(ArchiveHandle* AH, TocEntry* pos, TocEntry* te)
+static void
+_moveBefore(ArchiveHandle *AH, TocEntry *pos, TocEntry *te)
 {
-    te->prev->next = te->next;
-    te->next->prev = te->prev;
+	te->prev->next = te->next;
+	te->next->prev = te->prev;
 
-    te->prev = pos->prev;
-    te->next = pos;
-    pos->prev->next = te;
-    pos->prev = te;
+	te->prev = pos->prev;
+	te->next = pos;
+	pos->prev->next = te;
+	pos->prev = te;
 
-    te->_moved = 1;
+	te->_moved = 1;
 }
 
-static TocEntry* _getTocEntry(ArchiveHandle* AH, int id)
+static TocEntry *
+_getTocEntry(ArchiveHandle *AH, int id)
 {
-    TocEntry    *te;
-
-    te = AH->toc->next;
-    while (te != AH->toc) {
-	if (te->id == id)
-	    return te;
-	te = te->next;
-    }
-    return NULL;
+	TocEntry   *te;
+
+	te = AH->toc->next;
+	while (te != AH->toc)
+	{
+		if (te->id == id)
+			return te;
+		te = te->next;
+	}
+	return NULL;
 }
 
-int	TocIDRequired(ArchiveHandle* AH, int id, RestoreOptions *ropt)
+int
+TocIDRequired(ArchiveHandle *AH, int id, RestoreOptions *ropt)
 {
-    TocEntry	*te = _getTocEntry(AH, id);
+	TocEntry   *te = _getTocEntry(AH, id);
 
-    if (!te)
-	return 0;
+	if (!te)
+		return 0;
 
-    return _tocEntryRequired(te, ropt);
+	return _tocEntryRequired(te, ropt);
 }
 
-int	WriteInt(ArchiveHandle* AH, int i)
+int
+WriteInt(ArchiveHandle *AH, int i)
 {
-    int b;
-
-    /* This is a bit yucky, but I don't want to make the 
-     * binary format very dependant on representation,	    
-     * and not knowing much about it, I write out a 
-     * sign byte. If you change this, don't forget to change the
-     * file version #, and modify readInt to read the new format
-     * AS WELL AS the old formats.
-     */ 
-
-    /* SIGN byte */
-    if (i < 0) {
-	(*AH->WriteBytePtr)(AH, 1);
+	int			b;
+
+	/*
+	 * This is a bit yucky, but I don't want to make the binary format
+	 * very dependant on representation, and not knowing much about it, I
+	 * write out a sign byte. If you change this, don't forget to change
+	 * the file version #, and modify readInt to read the new format AS
+	 * WELL AS the old formats.
+	 */
+
+	/* SIGN byte */
+	if (i < 0)
+	{
+		(*AH->WriteBytePtr) (AH, 1);
 		i = -i;
-    } else {
-		(*AH->WriteBytePtr)(AH, 0);
-    }
-    
-    for(b = 0 ; b < AH->intSize ; b++) {
-        (*AH->WriteBytePtr)(AH, i & 0xFF);
-        i = i / 256;
-    }
-
-    return AH->intSize + 1;
+	}
+	else
+		(*AH->WriteBytePtr) (AH, 0);
+
+	for (b = 0; b < AH->intSize; b++)
+	{
+		(*AH->WriteBytePtr) (AH, i & 0xFF);
+		i = i / 256;
+	}
+
+	return AH->intSize + 1;
 }
 
-int    	ReadInt(ArchiveHandle* AH)
+int
+ReadInt(ArchiveHandle *AH)
 {
-    int res = 0;
-    int bv, b;
-    int	sign = 0; /* Default positive */
-	int bitShift = 0;
+	int			res = 0;
+	int			bv,
+				b;
+	int			sign = 0;		/* Default positive */
+	int			bitShift = 0;
 
-    if (AH->version > K_VERS_1_0)
+	if (AH->version > K_VERS_1_0)
 		/* Read a sign byte */
-		sign = (*AH->ReadBytePtr)(AH);
+		sign = (*AH->ReadBytePtr) (AH);
 
-    for( b = 0 ; b < AH->intSize ; b++) {
-        bv = (*AH->ReadBytePtr)(AH) & 0xFF;
+	for (b = 0; b < AH->intSize; b++)
+	{
+		bv = (*AH->ReadBytePtr) (AH) & 0xFF;
 		if (bv != 0)
 			res = res + (bv << bitShift);
 		bitShift += 8;
-    }
+	}
 
-    if (sign)
-		res = - res;
+	if (sign)
+		res = -res;
 
-    return res;
+	return res;
 }
 
-int	WriteStr(ArchiveHandle* AH, char* c)
+int
+WriteStr(ArchiveHandle *AH, char *c)
 {
-    int res;
+	int			res;
 
 	if (c)
 	{
 		res = WriteInt(AH, strlen(c));
-		res += (*AH->WriteBufPtr)(AH, c, strlen(c));
+		res += (*AH->WriteBufPtr) (AH, c, strlen(c));
 	}
 	else
 		res = WriteInt(AH, -1);
 
-    return res;
+	return res;
 }
 
-char*	ReadStr(ArchiveHandle* AH)
+char *
+ReadStr(ArchiveHandle *AH)
 {
-    char*	buf;
-    int		l;
+	char	   *buf;
+	int			l;
 
-    l = ReadInt(AH);
+	l = ReadInt(AH);
 	if (l == -1)
 		buf = NULL;
 	else
 	{
-		buf = (char*)malloc(l+1);
+		buf = (char *) malloc(l + 1);
 		if (!buf)
-			die_horribly(AH, "%s: Unable to allocate sufficient memory in ReadStr - "													"requested %d (0x%x) bytes\n", progname, l, l);
+			die_horribly(AH, "%s: Unable to allocate sufficient memory in ReadStr - " "requested %d (0x%x) bytes\n", progname, l, l);
 
-		(*AH->ReadBufPtr)(AH, (void*)buf, l);
+		(*AH->ReadBufPtr) (AH, (void *) buf, l);
 		buf[l] = '\0';
 	}
 
-    return buf;
+	return buf;
 }
 
 static int
-_discoverArchiveFormat(ArchiveHandle* AH)
+_discoverArchiveFormat(ArchiveHandle *AH)
 {
-    FILE	*fh;
-    char	sig[6]; /* More than enough */
-    int		cnt;
-    int		wantClose = 0;
+	FILE	   *fh;
+	char		sig[6];			/* More than enough */
+	int			cnt;
+	int			wantClose = 0;
 
 	/*
-	 * fprintf(stderr, "%s: Attempting to ascertain archive format\n", progname);
+	 * fprintf(stderr, "%s: Attempting to ascertain archive format\n",
+	 * progname);
 	 */
 
 	if (AH->lookahead)
@@ -1285,26 +1389,27 @@ _discoverArchiveFormat(ArchiveHandle* AH)
 	AH->lookaheadLen = 0;
 	AH->lookaheadPos = 0;
 
-    if (AH->fSpec) {
+	if (AH->fSpec)
+	{
 		wantClose = 1;
 		fh = fopen(AH->fSpec, PG_BINARY_R);
-    } else {
+	}
+	else
 		fh = stdin;
-    }
 
-    if (!fh)
+	if (!fh)
 		die_horribly(AH, "Archiver: could not open input file\n");
 
-    cnt = fread(sig, 1, 5, fh);
+	cnt = fread(sig, 1, 5, fh);
 
-    if (cnt != 5)
-        die_horribly(AH, "%s: input file is too short, or is unreadable\n", progname);
+	if (cnt != 5)
+		die_horribly(AH, "%s: input file is too short, or is unreadable\n", progname);
 
-	/* Save it, just in case we need it later*/
+	/* Save it, just in case we need it later */
 	strncpy(&AH->lookahead[0], sig, 5);
 	AH->lookaheadLen = 5;
 
-    if (strncmp(sig, "PGDMP", 5) == 0)
+	if (strncmp(sig, "PGDMP", 5) == 0)
 	{
 		AH->vmaj = fgetc(fh);
 		AH->vmin = fgetc(fh);
@@ -1314,8 +1419,8 @@ _discoverArchiveFormat(ArchiveHandle* AH)
 		AH->lookahead[AH->lookaheadLen++] = AH->vmin;
 
 		/* Check header version; varies from V1.0 */
-		if (AH->vmaj > 1 || ( (AH->vmaj == 1) && (AH->vmin > 0) ) ) /* Version > 1.0 */
-		{	
+		if (AH->vmaj > 1 || ((AH->vmaj == 1) && (AH->vmin > 0)))		/* Version > 1.0 */
+		{
 			AH->vrev = fgetc(fh);
 			AH->lookahead[AH->lookaheadLen++] = AH->vrev;
 		}
@@ -1329,18 +1434,21 @@ _discoverArchiveFormat(ArchiveHandle* AH)
 		AH->lookahead[AH->lookaheadLen++] = AH->format;
 
 		/* Make a convenient integer <maj><min><rev>00 */
-		AH->version = ( (AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev ) * 256 + 0;
-	} else {
+		AH->version = ((AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev) * 256 + 0;
+	}
+	else
+	{
+
 		/*
-		 * *Maybe* we have a tar archive format file...
-		 * So, read first 512 byte header...
+		 * *Maybe* we have a tar archive format file... So, read first 512
+		 * byte header...
 		 */
 		cnt = fread(&AH->lookahead[AH->lookaheadLen], 1, 512 - AH->lookaheadLen, fh);
 		AH->lookaheadLen += cnt;
 
 		if (AH->lookaheadLen != 512)
 			die_horribly(AH, "%s: input file does not appear to be a valid archive (too short?)\n",
-							progname);
+						 progname);
 
 		if (!isValidTarHeader(AH->lookahead))
 			die_horribly(AH, "%s: input file does not appear to be a valid archive\n", progname);
@@ -1348,96 +1456,104 @@ _discoverArchiveFormat(ArchiveHandle* AH)
 		AH->format = archTar;
 	}
 
-    /* If we can't seek, then mark the header as read */
-    if (fseek(fh, 0, SEEK_SET) != 0) 
+	/* If we can't seek, then mark the header as read */
+	if (fseek(fh, 0, SEEK_SET) != 0)
 	{
+
 		/*
-		 * NOTE: Formats that use the looahead buffer can unset this in their Init routine.
+		 * NOTE: Formats that use the looahead buffer can unset this in
+		 * their Init routine.
 		 */
 		AH->readHeader = 1;
 	}
 	else
-		AH->lookaheadLen = 0; /* Don't bother since we've reset the file */
+		AH->lookaheadLen = 0;	/* Don't bother since we've reset the file */
 
 	/*
-	 *fprintf(stderr, "%s: read %d bytes into lookahead buffer\n", progname, AH->lookaheadLen);
+	 * fprintf(stderr, "%s: read %d bytes into lookahead buffer\n",
+	 * progname, AH->lookaheadLen);
 	 */
 
-    /* Close the file */
-    if (wantClose)
+	/* Close the file */
+	if (wantClose)
 		if (fclose(fh) != 0)
 			die_horribly(AH, "%s: could not close the input file after reading header\n", progname);
 
-    return AH->format;
+	return AH->format;
 }
 
 
 /*
  * Allocate an archive handle
  */
-static ArchiveHandle* _allocAH(const char* FileSpec, const ArchiveFormat fmt, 
-				const int compression, ArchiveMode mode) 
+static ArchiveHandle *
+_allocAH(const char *FileSpec, const ArchiveFormat fmt,
+		 const int compression, ArchiveMode mode)
 {
-    ArchiveHandle*	AH;
+	ArchiveHandle *AH;
 
 	/*
-	 *fprintf(stderr, "%s: allocating AH for %s, format %d\n", progname, FileSpec, fmt); 
+	 * fprintf(stderr, "%s: allocating AH for %s, format %d\n", progname,
+	 * FileSpec, fmt);
 	 */
 
-    AH = (ArchiveHandle*)calloc(1, sizeof(ArchiveHandle));
-    if (!AH) 
+	AH = (ArchiveHandle *) calloc(1, sizeof(ArchiveHandle));
+	if (!AH)
 		die_horribly(AH, "Archiver: Could not allocate archive handle\n");
 
-    AH->vmaj = K_VERS_MAJOR;
-    AH->vmin = K_VERS_MINOR;
+	AH->vmaj = K_VERS_MAJOR;
+	AH->vmin = K_VERS_MINOR;
 	AH->vrev = K_VERS_REV;
 
 	AH->createDate = time(NULL);
 
-    AH->intSize = sizeof(int);
-    AH->lastID = 0;
-    if (FileSpec) {
+	AH->intSize = sizeof(int);
+	AH->lastID = 0;
+	if (FileSpec)
+	{
 		AH->fSpec = strdup(FileSpec);
+
 		/*
 		 * Not used; maybe later....
 		 *
-		 * AH->workDir = strdup(FileSpec);
-		 * for(i=strlen(FileSpec) ; i > 0 ; i--)
-		 *   if (AH->workDir[i-1] == '/')
+		 * AH->workDir = strdup(FileSpec); for(i=strlen(FileSpec) ; i > 0 ;
+		 * i--) if (AH->workDir[i-1] == '/')
 		 */
-    } else {
+	}
+	else
 		AH->fSpec = NULL;
-    } 
 
-    AH->currUser = strdup(""); /* So it's valid, but we can free() it later if necessary */ 
+	AH->currUser = strdup("");	/* So it's valid, but we can free() it
+								 * later if necessary */
 
-    AH->toc = (TocEntry*)calloc(1, sizeof(TocEntry));
-    if (!AH->toc)
+	AH->toc = (TocEntry *) calloc(1, sizeof(TocEntry));
+	if (!AH->toc)
 		die_horribly(AH, "Archiver: Could not allocate TOC header\n");
 
-    AH->toc->next = AH->toc;
-    AH->toc->prev = AH->toc;
-    
-    AH->mode = mode;
-    AH->compression = compression;
+	AH->toc->next = AH->toc;
+	AH->toc->prev = AH->toc;
+
+	AH->mode = mode;
+	AH->compression = compression;
 
 	AH->pgCopyBuf = createPQExpBuffer();
 	AH->sqlBuf = createPQExpBuffer();
 
-    /* Open stdout with no compression for AH output handle */
-    AH->gzOut = 0;
-    AH->OF = stdout;
+	/* Open stdout with no compression for AH output handle */
+	AH->gzOut = 0;
+	AH->OF = stdout;
 
 	/*
-	 *fprintf(stderr, "%s: archive format is %d\n", progname, fmt);
+	 * fprintf(stderr, "%s: archive format is %d\n", progname, fmt);
 	 */
 
-    if (fmt == archUnknown)
+	if (fmt == archUnknown)
 		AH->format = _discoverArchiveFormat(AH);
 	else
 		AH->format = fmt;
 
-    switch (AH->format) {
+	switch (AH->format)
+	{
 
 		case archCustom:
 			InitArchiveFmt_Custom(AH);
@@ -1457,86 +1573,97 @@ static ArchiveHandle* _allocAH(const char* FileSpec, const ArchiveFormat fmt,
 
 		default:
 			die_horribly(AH, "Archiver: Unrecognized file format '%d'\n", fmt);
-    }
+	}
 
-    return AH;
+	return AH;
 }
 
 
-void WriteDataChunks(ArchiveHandle* AH)
+void
+WriteDataChunks(ArchiveHandle *AH)
 {
-    TocEntry		*te = AH->toc->next;
-	StartDataPtr	startPtr;
-	EndDataPtr		endPtr;
+	TocEntry   *te = AH->toc->next;
+	StartDataPtr startPtr;
+	EndDataPtr	endPtr;
 
-    while (te != AH->toc) {
-	if (te->dataDumper != NULL) {
-	    AH->currToc = te;
-	    /* printf("Writing data for %d (%x)\n", te->id, te); */
-
-		if (strcmp(te->desc, "BLOBS") == 0)
+	while (te != AH->toc)
+	{
+		if (te->dataDumper != NULL)
 		{
-			startPtr = AH->StartBlobsPtr;
-			endPtr = AH->EndBlobsPtr;
-		} else {
-			startPtr = AH->StartDataPtr;
-			endPtr = AH->EndDataPtr;
-		}
+			AH->currToc = te;
+			/* printf("Writing data for %d (%x)\n", te->id, te); */
 
-	    if (startPtr != NULL) {
-			(*startPtr)(AH, te);
-	    }
+			if (strcmp(te->desc, "BLOBS") == 0)
+			{
+				startPtr = AH->StartBlobsPtr;
+				endPtr = AH->EndBlobsPtr;
+			}
+			else
+			{
+				startPtr = AH->StartDataPtr;
+				endPtr = AH->EndDataPtr;
+			}
 
-	    /* printf("Dumper arg for %d is %x\n", te->id, te->dataDumperArg); */
-	    /*
-	     * The user-provided DataDumper routine needs to call AH->WriteData
-	     */
-	    (*te->dataDumper)((Archive*)AH, te->oid, te->dataDumperArg);
+			if (startPtr != NULL)
+				(*startPtr) (AH, te);
 
-	    if (endPtr != NULL) {
-			(*endPtr)(AH, te);
-	    }
-	    AH->currToc = NULL;
-	}
+			/*
+			 * printf("Dumper arg for %d is %x\n", te->id,
+			 * te->dataDumperArg);
+			 */
+
+			/*
+			 * The user-provided DataDumper routine needs to call
+			 * AH->WriteData
+			 */
+			(*te->dataDumper) ((Archive *) AH, te->oid, te->dataDumperArg);
+
+			if (endPtr != NULL)
+				(*endPtr) (AH, te);
+			AH->currToc = NULL;
+		}
 		te = te->next;
-    }
+	}
 }
 
-void WriteToc(ArchiveHandle* AH)
+void
+WriteToc(ArchiveHandle *AH)
 {
-    TocEntry	*te = AH->toc->next;
-
-    /* printf("%d TOC Entries to save\n", AH->tocCount); */
-
-    WriteInt(AH, AH->tocCount);
-    while (te != AH->toc) {
-	WriteInt(AH, te->id);
-	WriteInt(AH, te->dataDumper ? 1 : 0);
-	WriteStr(AH, te->oid);
-	WriteStr(AH, te->name);
-	WriteStr(AH, te->desc);
-	WriteStr(AH, te->defn);
-	WriteStr(AH, te->dropStmt);
-	WriteStr(AH, te->copyStmt);
-	WriteStr(AH, te->owner);
-	if (AH->WriteExtraTocPtr) {
-	    (*AH->WriteExtraTocPtr)(AH, te);
-	}
+	TocEntry   *te = AH->toc->next;
+
+	/* printf("%d TOC Entries to save\n", AH->tocCount); */
+
+	WriteInt(AH, AH->tocCount);
+	while (te != AH->toc)
+	{
+		WriteInt(AH, te->id);
+		WriteInt(AH, te->dataDumper ? 1 : 0);
+		WriteStr(AH, te->oid);
+		WriteStr(AH, te->name);
+		WriteStr(AH, te->desc);
+		WriteStr(AH, te->defn);
+		WriteStr(AH, te->dropStmt);
+		WriteStr(AH, te->copyStmt);
+		WriteStr(AH, te->owner);
+		if (AH->WriteExtraTocPtr)
+			(*AH->WriteExtraTocPtr) (AH, te);
 		te = te->next;
-    }
+	}
 }
 
-void ReadToc(ArchiveHandle* AH)
+void
+ReadToc(ArchiveHandle *AH)
 {
-    int 		i;
+	int			i;
 
-    TocEntry	*te = AH->toc->next;
+	TocEntry   *te = AH->toc->next;
 
-    AH->tocCount = ReadInt(AH);
+	AH->tocCount = ReadInt(AH);
 
-    for( i = 0 ; i < AH->tocCount ; i++) {
+	for (i = 0; i < AH->tocCount; i++)
+	{
 
-		te = (TocEntry*)calloc(1, sizeof(TocEntry));
+		te = (TocEntry *) calloc(1, sizeof(TocEntry));
 		te->id = ReadInt(AH);
 
 		/* Sanity check */
@@ -1556,9 +1683,8 @@ void ReadToc(ArchiveHandle* AH)
 
 		te->owner = ReadStr(AH);
 
-		if (AH->ReadExtraTocPtr) {
-			(*AH->ReadExtraTocPtr)(AH, te);
-		}
+		if (AH->ReadExtraTocPtr)
+			(*AH->ReadExtraTocPtr) (AH, te);
 
 		ahlog(AH, 3, "Read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->name);
 
@@ -1566,102 +1692,105 @@ void ReadToc(ArchiveHandle* AH)
 		AH->toc->prev->next = te;
 		AH->toc->prev = te;
 		te->next = AH->toc;
-    }
+	}
 }
 
-static int _tocEntryRequired(TocEntry* te, RestoreOptions *ropt)
+static int
+_tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
 {
-    int res = 3; /* Schema = 1, Data = 2, Both = 3 */
- 
-    /* If it's an ACL, maybe ignore it */
-    if (ropt->aclsSkip && strcmp(te->desc,"ACL") == 0)
+	int			res = 3;		/* Schema = 1, Data = 2, Both = 3 */
+
+	/* If it's an ACL, maybe ignore it */
+	if (ropt->aclsSkip && strcmp(te->desc, "ACL") == 0)
 		return 0;
 
-	if (!ropt->create && strcmp(te->desc,"DATABASE") == 0)
+	if (!ropt->create && strcmp(te->desc, "DATABASE") == 0)
 		return 0;
 
-    /* Check if tablename only is wanted */
-    if (ropt->selTypes)
-    {
-		if ( (strcmp(te->desc, "TABLE") == 0) || (strcmp(te->desc, "TABLE DATA") == 0) )
+	/* Check if tablename only is wanted */
+	if (ropt->selTypes)
+	{
+		if ((strcmp(te->desc, "TABLE") == 0) || (strcmp(te->desc, "TABLE DATA") == 0))
 		{
 			if (!ropt->selTable)
 				return 0;
 			if (ropt->tableNames && strcmp(ropt->tableNames, te->name) != 0)
 				return 0;
-		} else if (strcmp(te->desc, "INDEX") == 0) {
+		}
+		else if (strcmp(te->desc, "INDEX") == 0)
+		{
 			if (!ropt->selIndex)
 				return 0;
 			if (ropt->indexNames && strcmp(ropt->indexNames, te->name) != 0)
 				return 0;
-		} else if (strcmp(te->desc, "FUNCTION") == 0) {
+		}
+		else if (strcmp(te->desc, "FUNCTION") == 0)
+		{
 			if (!ropt->selFunction)
 				return 0;
 			if (ropt->functionNames && strcmp(ropt->functionNames, te->name) != 0)
 				return 0;
-		} else if (strcmp(te->desc, "TRIGGER") == 0) {
+		}
+		else if (strcmp(te->desc, "TRIGGER") == 0)
+		{
 			if (!ropt->selTrigger)
 				return 0;
 			if (ropt->triggerNames && strcmp(ropt->triggerNames, te->name) != 0)
 				return 0;
-		} else {
-			return 0;
 		}
+		else
+			return 0;
 	}
 
 	/* Special Case: If 'SEQUENCE SET' and schemaOnly, then not needed */
-	if (ropt->schemaOnly && (strcmp(te->desc, "SEQUENCE SET") == 0) )
+	if (ropt->schemaOnly && (strcmp(te->desc, "SEQUENCE SET") == 0))
 		return 0;
 
-    /* Mask it if we only want schema */
-    if (ropt->schemaOnly)
+	/* Mask it if we only want schema */
+	if (ropt->schemaOnly)
 		res = res & 1;
 
-    /* Mask it we only want data */
-    if (ropt->dataOnly && (strcmp(te->desc, "SEQUENCE SET") != 0) ) 
-       res = res & 2;
+	/* Mask it we only want data */
+	if (ropt->dataOnly && (strcmp(te->desc, "SEQUENCE SET") != 0))
+		res = res & 2;
 
-    /* Mask it if we don't have a schema contribition */
-    if (!te->defn || strlen(te->defn) == 0) 
+	/* Mask it if we don't have a schema contribition */
+	if (!te->defn || strlen(te->defn) == 0)
 		res = res & 2;
 
-    /* Mask it if we don't have a possible data contribition */
-    if (!te->hadDumper)
+	/* Mask it if we don't have a possible data contribition */
+	if (!te->hadDumper)
 		res = res & 1;
 
-    /* Finally, if we used a list, limit based on that as well */
-    if (ropt->limitToList && !ropt->idWanted[te->id - 1]) 
+	/* Finally, if we used a list, limit based on that as well */
+	if (ropt->limitToList && !ropt->idWanted[te->id - 1])
 		return 0;
 
-    return res;
+	return res;
 }
 
-static void _reconnectAsUser(ArchiveHandle* AH, const char *dbname, char *user)
+static void
+_reconnectAsUser(ArchiveHandle *AH, const char *dbname, char *user)
 {
 	if (AH->ropt && AH->ropt->noReconnect)
 		return;
 
 	if (user && strlen(user) != 0
-			&& ( (strcmp(AH->currUser, user) != 0) || (strcmp(dbname,"-") != 0)))
+	&& ((strcmp(AH->currUser, user) != 0) || (strcmp(dbname, "-") != 0)))
 	{
 		if (RestoringToDB(AH))
-		{
 			ReconnectDatabase(AH, dbname, user);
-		}
 		else
-		{
 			ahprintf(AH, "\\connect %s %s\n", dbname, user);
-		}
-		if (AH->currUser) 
-		{
+		if (AH->currUser)
 			free(AH->currUser);
-		}
 
 		AH->currUser = strdup(user);
-    } 
+	}
 }
 
-static void _reconnectAsOwner(ArchiveHandle* AH, const char *dbname, TocEntry* te) 
+static void
+_reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te)
 {
 	if (AH->ropt && AH->ropt->noOwner)
 		return;
@@ -1669,37 +1798,38 @@ static void _reconnectAsOwner(ArchiveHandle* AH, const char *dbname, TocEntry* t
 	_reconnectAsUser(AH, dbname, te->owner);
 }
 
-static int _printTocEntry(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt) 
+static int
+_printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-    ahprintf(AH, "--\n-- TOC Entry ID %d (OID %s)\n--\n-- Name: %s Type: %s Owner: %s\n",
-	    te->id, te->oid, te->name, te->desc, te->owner);
-    if (AH->PrintExtraTocPtr != NULL) {
-		(*AH->PrintExtraTocPtr)(AH, te);
-    }
-    ahprintf(AH, "--\n\n");
+	ahprintf(AH, "--\n-- TOC Entry ID %d (OID %s)\n--\n-- Name: %s Type: %s Owner: %s\n",
+			 te->id, te->oid, te->name, te->desc, te->owner);
+	if (AH->PrintExtraTocPtr !=NULL)
+		(*AH->PrintExtraTocPtr) (AH, te);
+	ahprintf(AH, "--\n\n");
 
 	ahprintf(AH, "%s\n", te->defn);
 
-    return 1;
+	return 1;
 }
 
-void WriteHead(ArchiveHandle* AH) 
+void
+WriteHead(ArchiveHandle *AH)
 {
-	struct tm		crtm;
+	struct tm	crtm;
 
-    (*AH->WriteBufPtr)(AH, "PGDMP", 5); 	/* Magic code */
-    (*AH->WriteBytePtr)(AH, AH->vmaj);
-    (*AH->WriteBytePtr)(AH, AH->vmin);
-    (*AH->WriteBytePtr)(AH, AH->vrev);
-    (*AH->WriteBytePtr)(AH, AH->intSize);
-    (*AH->WriteBytePtr)(AH, AH->format);
+	(*AH->WriteBufPtr) (AH, "PGDMP", 5);		/* Magic code */
+	(*AH->WriteBytePtr) (AH, AH->vmaj);
+	(*AH->WriteBytePtr) (AH, AH->vmin);
+	(*AH->WriteBytePtr) (AH, AH->vrev);
+	(*AH->WriteBytePtr) (AH, AH->intSize);
+	(*AH->WriteBytePtr) (AH, AH->format);
 
 #ifndef HAVE_LIBZ
-    if (AH->compression != 0)
-	fprintf(stderr, "%s: WARNING - requested compression not available in this installation - "
-		    "archive will be uncompressed \n", progname);
+	if (AH->compression != 0)
+		fprintf(stderr, "%s: WARNING - requested compression not available in this installation - "
+				"archive will be uncompressed \n", progname);
 
-    AH->compression = 0;
+	AH->compression = 0;
 
 #endif
 
@@ -1713,41 +1843,41 @@ void WriteHead(ArchiveHandle* AH)
 	WriteInt(AH, crtm.tm_mon);
 	WriteInt(AH, crtm.tm_year);
 	WriteInt(AH, crtm.tm_isdst);
-	WriteStr(AH, AH->dbname);	
+	WriteStr(AH, AH->dbname);
 }
 
-void ReadHead(ArchiveHandle* AH)
+void
+ReadHead(ArchiveHandle *AH)
 {
-    char		tmpMag[7];
-    int			fmt;
+	char		tmpMag[7];
+	int			fmt;
 	struct tm	crtm;
 
 	/* If we haven't already read the header... */
-    if (!AH->readHeader) {
+	if (!AH->readHeader)
+	{
 
-		(*AH->ReadBufPtr)(AH, tmpMag, 5);
+		(*AH->ReadBufPtr) (AH, tmpMag, 5);
 
-		if (strncmp(tmpMag,"PGDMP", 5) != 0)
+		if (strncmp(tmpMag, "PGDMP", 5) != 0)
 			die_horribly(AH, "Archiver: Did not fing magic PGDMP in file header\n");
 
-		AH->vmaj = (*AH->ReadBytePtr)(AH);
-		AH->vmin = (*AH->ReadBytePtr)(AH);
+		AH->vmaj = (*AH->ReadBytePtr) (AH);
+		AH->vmin = (*AH->ReadBytePtr) (AH);
 
-		if (AH->vmaj > 1 || ( (AH->vmaj == 1) && (AH->vmin > 0) ) ) /* Version > 1.0 */
-		{
-			AH->vrev = (*AH->ReadBytePtr)(AH);
-		} else {
+		if (AH->vmaj > 1 || ((AH->vmaj == 1) && (AH->vmin > 0)))		/* Version > 1.0 */
+			AH->vrev = (*AH->ReadBytePtr) (AH);
+		else
 			AH->vrev = 0;
-		}
 
-		AH->version = ( (AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev ) * 256 + 0;
+		AH->version = ((AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev) * 256 + 0;
 
 
 		if (AH->version < K_VERS_1_0 || AH->version > K_VERS_MAX)
-			die_horribly(AH, "%s: unsupported version (%d.%d) in file header\n", 
-					progname, AH->vmaj, AH->vmin);
+			die_horribly(AH, "%s: unsupported version (%d.%d) in file header\n",
+						 progname, AH->vmaj, AH->vmin);
 
-		AH->intSize = (*AH->ReadBytePtr)(AH);
+		AH->intSize = (*AH->ReadBytePtr) (AH);
 		if (AH->intSize > 32)
 			die_horribly(AH, "Archiver: sanity check on integer size (%d) failes\n", AH->intSize);
 
@@ -1755,27 +1885,27 @@ void ReadHead(ArchiveHandle* AH)
 			fprintf(stderr, "\n%s: WARNING - archive was made on a machine with larger integers, "
 					"some operations may fail\n", progname);
 
-		fmt = (*AH->ReadBytePtr)(AH);
+		fmt = (*AH->ReadBytePtr) (AH);
 
 		if (AH->format != fmt)
-			die_horribly(AH, "%s: expected format (%d) differs from format found in file (%d)\n", 
-					progname, AH->format, fmt);
-    }
+			die_horribly(AH, "%s: expected format (%d) differs from format found in file (%d)\n",
+						 progname, AH->format, fmt);
+	}
 
-    if (AH->version >= K_VERS_1_2)
-    {
+	if (AH->version >= K_VERS_1_2)
+	{
 		if (AH->version < K_VERS_1_4)
-			AH->compression = (*AH->ReadBytePtr)(AH);
+			AH->compression = (*AH->ReadBytePtr) (AH);
 		else
 			AH->compression = ReadInt(AH);
-    } else {
+	}
+	else
 		AH->compression = Z_DEFAULT_COMPRESSION;
-    }
 
 #ifndef HAVE_LIBZ
-    if (AH->compression != 0)
-		fprintf(stderr, "%s: WARNING - archive is compressed - any data will not be available\n", 
-					progname);
+	if (AH->compression != 0)
+		fprintf(stderr, "%s: WARNING - archive is compressed - any data will not be available\n",
+				progname);
 #endif
 
 	if (AH->version >= K_VERS_1_4)
@@ -1792,85 +1922,97 @@ void ReadHead(ArchiveHandle* AH)
 
 		AH->createDate = mktime(&crtm);
 
-		if (AH->createDate == (time_t)-1)
+		if (AH->createDate == (time_t) -1)
 			fprintf(stderr, "%s: WARNING - bad creation date in header\n", progname);
 	}
 
 }
 
 
-static void _SortToc(ArchiveHandle* AH, TocSortCompareFn fn)
+static void
+_SortToc(ArchiveHandle *AH, TocSortCompareFn fn)
 {
-    TocEntry**	tea;
-    TocEntry*	te;
-    int		i;
+	TocEntry  **tea;
+	TocEntry   *te;
+	int			i;
 
-    /* Allocate an array for quicksort (TOC size + head & foot) */
-    tea = (TocEntry**)malloc(sizeof(TocEntry*) * (AH->tocCount + 2) );
+	/* Allocate an array for quicksort (TOC size + head & foot) */
+	tea = (TocEntry **) malloc(sizeof(TocEntry *) * (AH->tocCount + 2));
+
+	/* Build array of toc entries, including header at start and end */
+	te = AH->toc;
+	for (i = 0; i <= AH->tocCount + 1; i++)
+	{
+
+		/*
+		 * printf("%d: %x (%x, %x) - %d\n", i, te, te->prev, te->next,
+		 * te->oidVal);
+		 */
+		tea[i] = te;
+		te = te->next;
+	}
 
-    /* Build array of toc entries, including header at start and end */
-    te = AH->toc;
-    for( i = 0 ; i <= AH->tocCount+1 ; i++) {
-	/* printf("%d: %x (%x, %x) - %d\n", i, te, te->prev, te->next, te->oidVal); */
-	tea[i] = te;
-	te = te->next;
-    }
+	/* Sort it, but ignore the header entries */
+	qsort(&(tea[1]), AH->tocCount, sizeof(TocEntry *), fn);
 
-    /* Sort it, but ignore the header entries */
-    qsort(&(tea[1]), AH->tocCount, sizeof(TocEntry*), fn);
+	/* Rebuild list: this works becuase we have headers at each end */
+	for (i = 1; i <= AH->tocCount; i++)
+	{
+		tea[i]->next = tea[i + 1];
+		tea[i]->prev = tea[i - 1];
+	}
 
-    /* Rebuild list: this works becuase we have headers at each end */
-    for( i = 1 ; i <= AH->tocCount ; i++) {
-	tea[i]->next = tea[i+1];
-	tea[i]->prev = tea[i-1];
-    }
 
+	te = AH->toc;
+	for (i = 0; i <= AH->tocCount + 1; i++)
+	{
 
-    te = AH->toc;
-    for( i = 0 ; i <= AH->tocCount+1 ; i++) {
-	/* printf("%d: %x (%x, %x) - %d\n", i, te, te->prev, te->next, te->oidVal); */
-	te = te->next;
-    }
+		/*
+		 * printf("%d: %x (%x, %x) - %d\n", i, te, te->prev, te->next,
+		 * te->oidVal);
+		 */
+		te = te->next;
+	}
 
 
-    AH->toc->next = tea[1];
-    AH->toc->prev = tea[AH->tocCount];
+	AH->toc->next = tea[1];
+	AH->toc->prev = tea[AH->tocCount];
 }
 
-static int	_tocSortCompareByOIDNum(const void* p1, const void* p2)
+static int
+_tocSortCompareByOIDNum(const void *p1, const void *p2)
 {
-    TocEntry*	te1 = *(TocEntry**)p1;
-    TocEntry*	te2 = *(TocEntry**)p2;
-    int		id1 = te1->oidVal;
-    int 	id2 = te2->oidVal;
+	TocEntry   *te1 = *(TocEntry **) p1;
+	TocEntry   *te2 = *(TocEntry **) p2;
+	int			id1 = te1->oidVal;
+	int			id2 = te2->oidVal;
 
-    /* printf("Comparing %d to %d\n", id1, id2); */
+	/* printf("Comparing %d to %d\n", id1, id2); */
 
-    if (id1 < id2) {
-	return -1;
-    } else if (id1 > id2) { 
-	return 1;
-    } else {
-	return _tocSortCompareByIDNum(te1, te2);
-    }
+	if (id1 < id2)
+		return -1;
+	else if (id1 > id2)
+		return 1;
+	else
+		return _tocSortCompareByIDNum(te1, te2);
 }
 
-static int	_tocSortCompareByIDNum(const void* p1, const void* p2)
+static int
+_tocSortCompareByIDNum(const void *p1, const void *p2)
 {
-    TocEntry*	te1 = *(TocEntry**)p1;
-    TocEntry*	te2 = *(TocEntry**)p2;
-    int		id1 = te1->id;
-    int 	id2 = te2->id;
+	TocEntry   *te1 = *(TocEntry **) p1;
+	TocEntry   *te2 = *(TocEntry **) p2;
+	int			id1 = te1->id;
+	int			id2 = te2->id;
 
-    /* printf("Comparing %d to %d\n", id1, id2); */
+	/* printf("Comparing %d to %d\n", id1, id2); */
 
-    if (id1 < id2) {
-	return -1;
-    } else if (id1 > id2) { 
-	return 1;
-    } else {
-	return 0;
-    }
+	if (id1 < id2)
+		return -1;
+	else if (id1 > id2)
+		return 1;
+	else
+		return 0;
 }
 
 /*
@@ -1881,4 +2023,3 @@ static int	_tocSortCompareByIDNum(const void* p1, const void* p2)
  *
  *insert into dump_blob_xref select 12345,lo_import(p || '/q.q') from pgdump_blob_path;
  */
-
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index fdf70f716f70938b991b4b86d89091a2b23512e4..fd9a0cf90110b185c1604cb99a4bf62db916c498 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -3,25 +3,25 @@
  * pg_backup_archiver.h
  *
  *	Private interface to the pg_dump archiver routines.
- *	It is NOT intended that these routines be called by any 
+ *	It is NOT intended that these routines be called by any
  *	dumper directly.
  *
  *	See the headers to pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.26 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.27 2001/03/22 04:00:12 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *		Initial version. 
+ *		Initial version.
  *
  * Modifications - 15-Sep-2000 - pjw@rhyme.com.au
  *	-	Added braceDepth to sqlparseInfo to handle braces in rule definitions.
@@ -49,21 +49,23 @@
 #define GZREAD(p, s, n, fh) fread(p, s, n, fh)
 #define Z_DEFAULT_COMPRESSION -1
 
-typedef struct _z_stream {
-    void	*next_in;
-    void	*next_out;
-    int		avail_in;
-    int		avail_out;
+typedef struct _z_stream
+{
+	void	   *next_in;
+	void	   *next_out;
+	int			avail_in;
+	int			avail_out;
 } z_stream;
 typedef z_stream *z_streamp;
+
 #endif
 
 #include "pg_backup.h"
 #include "libpq-fe.h"
 
 #define K_VERS_MAJOR 1
-#define K_VERS_MINOR 4 
-#define K_VERS_REV 30 
+#define K_VERS_MINOR 4
+#define K_VERS_REV 30
 
 /* Data block types */
 #define BLK_DATA 1
@@ -72,220 +74,239 @@ typedef z_stream *z_streamp;
 
 /* Some important version numbers (checked in code) */
 #define K_VERS_1_0 (( (1 * 256 + 0) * 256 + 0) * 256 + 0)
-#define K_VERS_1_2 (( (1 * 256 + 2) * 256 + 0) * 256 + 0) /* Allow No ZLIB */
-#define K_VERS_1_3 (( (1 * 256 + 3) * 256 + 0) * 256 + 0) /* BLOBs */
-#define K_VERS_1_4 (( (1 * 256 + 4) * 256 + 0) * 256 + 0) /* Date & name in header */
+#define K_VERS_1_2 (( (1 * 256 + 2) * 256 + 0) * 256 + 0)		/* Allow No ZLIB */
+#define K_VERS_1_3 (( (1 * 256 + 3) * 256 + 0) * 256 + 0)		/* BLOBs */
+#define K_VERS_1_4 (( (1 * 256 + 4) * 256 + 0) * 256 + 0)		/* Date & name in header */
 #define K_VERS_MAX (( (1 * 256 + 4) * 256 + 255) * 256 + 0)
 
 /* No of BLOBs to restore in 1 TX */
-#define BLOB_BATCH_SIZE	100
+#define BLOB_BATCH_SIZE 100
 
 struct _archiveHandle;
 struct _tocEntry;
 struct _restoreList;
 
-typedef void    (*ClosePtr)		(struct _archiveHandle* AH);
-typedef void	(*ArchiveEntryPtr)	(struct _archiveHandle* AH, struct _tocEntry* te);
- 
-typedef void	(*StartDataPtr)		(struct _archiveHandle* AH, struct _tocEntry* te);
-typedef int 	(*WriteDataPtr)		(struct _archiveHandle* AH, const void* data, int dLen);
-typedef void	(*EndDataPtr)		(struct _archiveHandle* AH, struct _tocEntry* te);
-
-typedef void	(*StartBlobsPtr)	(struct _archiveHandle* AH, struct _tocEntry* te);
-typedef void    (*StartBlobPtr)		(struct _archiveHandle* AH, struct _tocEntry* te, int oid);
-typedef void	(*EndBlobPtr)		(struct _archiveHandle* AH, struct _tocEntry* te, int oid);
-typedef void	(*EndBlobsPtr)		(struct _archiveHandle* AH, struct _tocEntry* te);
-
-typedef int		(*WriteBytePtr)		(struct _archiveHandle* AH, const int i);
-typedef int    	(*ReadBytePtr)		(struct _archiveHandle* AH);
-typedef int		(*WriteBufPtr)		(struct _archiveHandle* AH, const void* c, int len);
-typedef int		(*ReadBufPtr)		(struct _archiveHandle* AH, void* buf, int len);
-typedef void	(*SaveArchivePtr)	(struct _archiveHandle* AH);
-typedef void 	(*WriteExtraTocPtr)	(struct _archiveHandle* AH, struct _tocEntry* te);
-typedef void	(*ReadExtraTocPtr)	(struct _archiveHandle* AH, struct _tocEntry* te);
-typedef void	(*PrintExtraTocPtr)	(struct _archiveHandle* AH, struct _tocEntry* te);
-typedef void	(*PrintTocDataPtr)	(struct _archiveHandle* AH, struct _tocEntry* te, RestoreOptions *ropt);
-
-typedef int		(*CustomOutPtr)		(struct _archiveHandle* AH, const void* buf, int len);
-
-typedef int	(*TocSortCompareFn)	(const void* te1, const void *te2); 
-
-typedef enum _archiveMode {
-    archModeWrite,
-    archModeRead
+typedef void (*ClosePtr) (struct _archiveHandle * AH);
+typedef void (*ArchiveEntryPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+
+typedef void (*StartDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+typedef int (*WriteDataPtr) (struct _archiveHandle * AH, const void *data, int dLen);
+typedef void (*EndDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+
+typedef void (*StartBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+typedef void (*StartBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, int oid);
+typedef void (*EndBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, int oid);
+typedef void (*EndBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+
+typedef int (*WriteBytePtr) (struct _archiveHandle * AH, const int i);
+typedef int (*ReadBytePtr) (struct _archiveHandle * AH);
+typedef int (*WriteBufPtr) (struct _archiveHandle * AH, const void *c, int len);
+typedef int (*ReadBufPtr) (struct _archiveHandle * AH, void *buf, int len);
+typedef void (*SaveArchivePtr) (struct _archiveHandle * AH);
+typedef void (*WriteExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+typedef void (*ReadExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+typedef void (*PrintExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
+typedef void (*PrintTocDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te, RestoreOptions *ropt);
+
+typedef int (*CustomOutPtr) (struct _archiveHandle * AH, const void *buf, int len);
+
+typedef int (*TocSortCompareFn) (const void *te1, const void *te2);
+
+typedef enum _archiveMode
+{
+	archModeWrite,
+	archModeRead
 } ArchiveMode;
 
-typedef struct _outputContext {
-	void		*OF;
-	int		gzOut;
+typedef struct _outputContext
+{
+	void	   *OF;
+	int			gzOut;
 } OutputContext;
 
-typedef enum { 
+typedef enum
+{
 	SQL_SCAN = 0,
 	SQL_IN_SQL_COMMENT,
 	SQL_IN_EXT_COMMENT,
-	SQL_IN_QUOTE} sqlparseState;
-	
-typedef struct {
-	int					backSlash;
-	sqlparseState		state;
-	char				lastChar;
-	char				quoteChar;
-	int					braceDepth;
+	SQL_IN_QUOTE
+} sqlparseState;
+
+typedef struct
+{
+	int			backSlash;
+	sqlparseState state;
+	char		lastChar;
+	char		quoteChar;
+	int			braceDepth;
 } sqlparseInfo;
 
-typedef struct _archiveHandle {
-	Archive				public;				/* Public part of archive */
-	char				vmaj;				/* Version of file */
-	char				vmin;
-	char				vrev;
-	int					version;			/* Conveniently formatted version */
+typedef struct _archiveHandle
+{
+	Archive		public;			/* Public part of archive */
+	char		vmaj;			/* Version of file */
+	char		vmin;
+	char		vrev;
+	int			version;		/* Conveniently formatted version */
 
-	int					debugLevel;			/* Used for logging (currently only by --verbose) */
-	int					intSize;			/* Size of an integer in the archive */
-	ArchiveFormat		format;				/* Archive format */
+	int			debugLevel;		/* Used for logging (currently only by
+								 * --verbose) */
+	int			intSize;		/* Size of an integer in the archive */
+	ArchiveFormat format;		/* Archive format */
 
-	sqlparseInfo		sqlparse;
-	PQExpBuffer			sqlBuf;
+	sqlparseInfo sqlparse;
+	PQExpBuffer sqlBuf;
 
-	time_t				createDate;			/* Date archive created */
+	time_t		createDate;		/* Date archive created */
 
 	/*
-	 * Fields used when discovering header.
-	 * A format can always get the previous read bytes from here...
+	 * Fields used when discovering header. A format can always get the
+	 * previous read bytes from here...
 	 */
-	int					readHeader;			/* Used if file header has been read already */
-	char				*lookahead;			/* Buffer used when reading header to discover format */
-	int					lookaheadSize;		/* Size of allocated buffer */
-	int					lookaheadLen;		/* Length of data in lookahead */
-	int					lookaheadPos;		/* Current read position in lookahead buffer */
-
-	ArchiveEntryPtr		ArchiveEntryPtr;	/* Called for each metadata object */
-	StartDataPtr		StartDataPtr; 		/* Called when table data is about to be dumped */
-	WriteDataPtr		WriteDataPtr; 		/* Called to send some table data to the archive */
-	EndDataPtr			EndDataPtr; 		/* Called when table data dump is finished */
-	WriteBytePtr		WriteBytePtr;		/* Write a byte to output */
-	ReadBytePtr			ReadBytePtr;		/* Read a byte from an archive */
-	WriteBufPtr			WriteBufPtr;		/* Write a buffer of output to the archive */
-	ReadBufPtr			ReadBufPtr;			/* Read a buffer of input from the archive */
-	ClosePtr			ClosePtr;			/* Close the archive */
-	WriteExtraTocPtr	WriteExtraTocPtr;	/* Write extra TOC entry data associated with */
-											/* the current archive format */
-	ReadExtraTocPtr		ReadExtraTocPtr;	/* Read extr info associated with archie format */
-	PrintExtraTocPtr	PrintExtraTocPtr;	/* Extra TOC info for format */
-	PrintTocDataPtr		PrintTocDataPtr;	
-
-	StartBlobsPtr		StartBlobsPtr;
-	EndBlobsPtr			EndBlobsPtr;
-	StartBlobPtr		StartBlobPtr;
-	EndBlobPtr			EndBlobPtr;
-
-	CustomOutPtr		CustomOutPtr;		/* Alternate script output routine */
+	int			readHeader;		/* Used if file header has been read
+								 * already */
+	char	   *lookahead;		/* Buffer used when reading header to
+								 * discover format */
+	int			lookaheadSize;	/* Size of allocated buffer */
+	int			lookaheadLen;	/* Length of data in lookahead */
+	int			lookaheadPos;	/* Current read position in lookahead
+								 * buffer */
+
+	ArchiveEntryPtr ArchiveEntryPtr;	/* Called for each metadata object */
+	StartDataPtr StartDataPtr;	/* Called when table data is about to be
+								 * dumped */
+	WriteDataPtr WriteDataPtr;	/* Called to send some table data to the
+								 * archive */
+	EndDataPtr EndDataPtr;		/* Called when table data dump is finished */
+	WriteBytePtr WriteBytePtr;	/* Write a byte to output */
+	ReadBytePtr ReadBytePtr;	/* Read a byte from an archive */
+	WriteBufPtr WriteBufPtr;	/* Write a buffer of output to the archive */
+	ReadBufPtr ReadBufPtr;		/* Read a buffer of input from the archive */
+	ClosePtr ClosePtr;			/* Close the archive */
+	WriteExtraTocPtr WriteExtraTocPtr;	/* Write extra TOC entry data
+										 * associated with */
+	/* the current archive format */
+	ReadExtraTocPtr ReadExtraTocPtr;	/* Read extr info associated with
+										 * archie format */
+	PrintExtraTocPtr PrintExtraTocPtr;	/* Extra TOC info for format */
+	PrintTocDataPtr PrintTocDataPtr;
+
+	StartBlobsPtr StartBlobsPtr;
+	EndBlobsPtr EndBlobsPtr;
+	StartBlobPtr StartBlobPtr;
+	EndBlobPtr EndBlobPtr;
+
+	CustomOutPtr CustomOutPtr;	/* Alternate script output routine */
 
 	/* Stuff for direct DB connection */
-	char				username[100];
-	char				*dbname;			/* Name of db for connection */
-	char				*archdbname;		/* DB name *read* from archive */
-	char				*pghost;
-	char				*pgport;
-	PGconn				*connection;
-	PGconn				*blobConnection;	/* Connection for BLOB xref */
-	int					txActive;			/* Flag set if TX active on connection */
-	int					blobTxActive;		/* Flag set if TX active on blobConnection */
-	int					connectToDB;		/* Flag to indicate if direct DB connection is required */
-	int					pgCopyIn;			/* Currently in libpq 'COPY IN' mode. */
-	PQExpBuffer			pgCopyBuf;			/* Left-over data from incomplete lines in COPY IN */
-
-	int					loFd;				/* BLOB fd */
-	int					writingBlob;		/* Flag */
-	int					createdBlobXref;	/* Flag */
-	int					blobCount;			/* # of blobs restored */
-
-	int					lastID;				/* Last internal ID for a TOC entry */
-	char*				fSpec;				/* Archive File Spec */
-	FILE				*FH;				/* General purpose file handle */
-	void				*OF;
-	int					gzOut;				/* Output file */
-
-	struct _tocEntry*		toc;			/* List of TOC entries */
-	int						tocCount;		/* Number of TOC entries */
-	struct _tocEntry*		currToc; 		/* Used when dumping data */
-	char					*currUser;		/* Restore: current username in script */
-	int						compression;	/* Compression requested on open */
-	ArchiveMode				mode;			/* File mode - r or w */
-	void*					formatData;		/* Header data specific to file format */
-
-	RestoreOptions			*ropt;			/* Used to check restore options in ahwrite etc */
+	char		username[100];
+	char	   *dbname;			/* Name of db for connection */
+	char	   *archdbname;		/* DB name *read* from archive */
+	char	   *pghost;
+	char	   *pgport;
+	PGconn	   *connection;
+	PGconn	   *blobConnection; /* Connection for BLOB xref */
+	int			txActive;		/* Flag set if TX active on connection */
+	int			blobTxActive;	/* Flag set if TX active on blobConnection */
+	int			connectToDB;	/* Flag to indicate if direct DB
+								 * connection is required */
+	int			pgCopyIn;		/* Currently in libpq 'COPY IN' mode. */
+	PQExpBuffer pgCopyBuf;		/* Left-over data from incomplete lines in
+								 * COPY IN */
+
+	int			loFd;			/* BLOB fd */
+	int			writingBlob;	/* Flag */
+	int			createdBlobXref;/* Flag */
+	int			blobCount;		/* # of blobs restored */
+
+	int			lastID;			/* Last internal ID for a TOC entry */
+	char	   *fSpec;			/* Archive File Spec */
+	FILE	   *FH;				/* General purpose file handle */
+	void	   *OF;
+	int			gzOut;			/* Output file */
+
+	struct _tocEntry *toc;		/* List of TOC entries */
+	int			tocCount;		/* Number of TOC entries */
+	struct _tocEntry *currToc;	/* Used when dumping data */
+	char	   *currUser;		/* Restore: current username in script */
+	int			compression;	/* Compression requested on open */
+	ArchiveMode mode;			/* File mode - r or w */
+	void	   *formatData;		/* Header data specific to file format */
+
+	RestoreOptions *ropt;		/* Used to check restore options in
+								 * ahwrite etc */
 } ArchiveHandle;
 
-typedef struct _tocEntry {
-	struct _tocEntry* 	prev;
-	struct _tocEntry*	next;
-	int					id;
-	int					hadDumper;		/* Archiver was passed a dumper routine (used in restore) */
-	char*				oid;
-	int					oidVal;
-	char*				name;
-	char*				desc;
-	char*				defn;
-	char*				dropStmt;
-	char*				copyStmt;
-	char*				owner;
-	char**				depOid;
-	int					printed;		/* Indicates if entry defn has been dumped */
-	DataDumperPtr		dataDumper;		/* Routine to dump data for object */
-	void*				dataDumperArg;		/* Arg for above routine */
-	void*				formatData;		/* TOC Entry data specific to file format */
-
-	int					_moved;			/* Marker used when rearranging TOC */
+typedef struct _tocEntry
+{
+	struct _tocEntry *prev;
+	struct _tocEntry *next;
+	int			id;
+	int			hadDumper;		/* Archiver was passed a dumper routine
+								 * (used in restore) */
+	char	   *oid;
+	int			oidVal;
+	char	   *name;
+	char	   *desc;
+	char	   *defn;
+	char	   *dropStmt;
+	char	   *copyStmt;
+	char	   *owner;
+	char	  **depOid;
+	int			printed;		/* Indicates if entry defn has been dumped */
+	DataDumperPtr dataDumper;	/* Routine to dump data for object */
+	void	   *dataDumperArg;	/* Arg for above routine */
+	void	   *formatData;		/* TOC Entry data specific to file format */
+
+	int			_moved;			/* Marker used when rearranging TOC */
 
 } TocEntry;
 
 /* Used everywhere */
-extern void die_horribly(ArchiveHandle *AH, const char *fmt, ...);
+extern void die_horribly(ArchiveHandle *AH, const char *fmt,...);
 
-extern void WriteTOC(ArchiveHandle* AH);
-extern void ReadTOC(ArchiveHandle* AH);
-extern void WriteHead(ArchiveHandle* AH);
-extern void ReadHead(ArchiveHandle* AH);
-extern void WriteToc(ArchiveHandle* AH);
-extern void ReadToc(ArchiveHandle* AH);
-extern void WriteDataChunks(ArchiveHandle* AH);
+extern void WriteTOC(ArchiveHandle *AH);
+extern void ReadTOC(ArchiveHandle *AH);
+extern void WriteHead(ArchiveHandle *AH);
+extern void ReadHead(ArchiveHandle *AH);
+extern void WriteToc(ArchiveHandle *AH);
+extern void ReadToc(ArchiveHandle *AH);
+extern void WriteDataChunks(ArchiveHandle *AH);
 
-extern int TocIDRequired(ArchiveHandle* AH, int id, RestoreOptions *ropt);
+extern int	TocIDRequired(ArchiveHandle *AH, int id, RestoreOptions *ropt);
 
 /*
  * Mandatory routines for each supported format
  */
 
-extern int 				WriteInt(ArchiveHandle* AH, int i);
-extern int 				ReadInt(ArchiveHandle* AH);
-extern char* 			ReadStr(ArchiveHandle* AH);
-extern int 				WriteStr(ArchiveHandle* AH, char* s);
+extern int	WriteInt(ArchiveHandle *AH, int i);
+extern int	ReadInt(ArchiveHandle *AH);
+extern char *ReadStr(ArchiveHandle *AH);
+extern int	WriteStr(ArchiveHandle *AH, char *s);
 
-extern void				StartRestoreBlobs(ArchiveHandle* AH);
-extern void 			StartRestoreBlob(ArchiveHandle* AH, int oid);
-extern void 			EndRestoreBlob(ArchiveHandle* AH, int oid);
-extern void				EndRestoreBlobs(ArchiveHandle* AH);
+extern void StartRestoreBlobs(ArchiveHandle *AH);
+extern void StartRestoreBlob(ArchiveHandle *AH, int oid);
+extern void EndRestoreBlob(ArchiveHandle *AH, int oid);
+extern void EndRestoreBlobs(ArchiveHandle *AH);
 
-extern void 			InitArchiveFmt_Custom(ArchiveHandle* AH);
-extern void 			InitArchiveFmt_Files(ArchiveHandle* AH);
-extern void 			InitArchiveFmt_Null(ArchiveHandle* AH);
-extern void 			InitArchiveFmt_Tar(ArchiveHandle* AH);
+extern void InitArchiveFmt_Custom(ArchiveHandle *AH);
+extern void InitArchiveFmt_Files(ArchiveHandle *AH);
+extern void InitArchiveFmt_Null(ArchiveHandle *AH);
+extern void InitArchiveFmt_Tar(ArchiveHandle *AH);
 
-extern int 				isValidTarHeader(char *header);
+extern int	isValidTarHeader(char *header);
 
-extern OutputContext	SetOutput(ArchiveHandle* AH, char *filename, int compression);
-extern void 			ResetOutput(ArchiveHandle* AH, OutputContext savedContext);
-extern int 				RestoringToDB(ArchiveHandle* AH);
-extern int				ReconnectDatabase(ArchiveHandle *AH, const char* dbname, char *newUser);
-extern int				UserIsSuperuser(ArchiveHandle *AH, char* user);
-extern char*			ConnectedUser(ArchiveHandle *AH);
-extern int				ConnectedUserIsSuperuser(ArchiveHandle *AH);
+extern OutputContext SetOutput(ArchiveHandle *AH, char *filename, int compression);
+extern void ResetOutput(ArchiveHandle *AH, OutputContext savedContext);
+extern int	RestoringToDB(ArchiveHandle *AH);
+extern int	ReconnectDatabase(ArchiveHandle *AH, const char *dbname, char *newUser);
+extern int	UserIsSuperuser(ArchiveHandle *AH, char *user);
+extern char *ConnectedUser(ArchiveHandle *AH);
+extern int	ConnectedUserIsSuperuser(ArchiveHandle *AH);
 
-int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle* AH);
-int ahprintf(ArchiveHandle* AH, const char *fmt, ...);
+int			ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH);
+int			ahprintf(ArchiveHandle *AH, const char *fmt,...);
 
-void ahlog(ArchiveHandle* AH, int level, const char *fmt, ...);
+void		ahlog(ArchiveHandle *AH, int level, const char *fmt,...);
 
 #endif
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c
index e9117b8320c17647bebad48e4e4dfaec28948cf3..e58a9f15c36f6c8145b0f7f8968847577dace070 100644
--- a/src/bin/pg_dump/pg_backup_custom.c
+++ b/src/bin/pg_dump/pg_backup_custom.c
@@ -4,30 +4,30 @@
  *
  *	Implements the custom output format.
  *
- *  The comments with the routined in this code are a good place to 
- * 	understand how to write a new format.
+ *	The comments with the routined in this code are a good place to
+ *	understand how to write a new format.
  *
  *	See the headers to pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	and any liability will be limited to the time taken to fix any
- * 	related bug.
+ *	related bug.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.8 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.9 2001/03/22 04:00:12 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *	Initial version. 
+ *	Initial version.
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
  *
- *    - Check results of IO routines more carefully.
+ *	  - Check results of IO routines more carefully.
  *
  *-------------------------------------------------------------------------
  */
@@ -43,161 +43,165 @@
  *--------
  */
 
-static void     _ArchiveEntry(ArchiveHandle* AH, TocEntry* te);
-static void		_StartData(ArchiveHandle* AH, TocEntry* te);
-static int		_WriteData(ArchiveHandle* AH, const void* data, int dLen);
-static void     _EndData(ArchiveHandle* AH, TocEntry* te);
-static int      _WriteByte(ArchiveHandle* AH, const int i);
-static int      _ReadByte(ArchiveHandle* );
-static int      _WriteBuf(ArchiveHandle* AH, const void* buf, int len);
-static int    	_ReadBuf(ArchiveHandle* AH, void* buf, int len);
-static void     _CloseArchive(ArchiveHandle* AH);
-static void		_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt);
-static void		_WriteExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void		_ReadExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void		_PrintExtraToc(ArchiveHandle* AH, TocEntry* te);
-
-static void		_PrintData(ArchiveHandle* AH);
-static void     _skipData(ArchiveHandle* AH);
-static void		_skipBlobs(ArchiveHandle* AH);
-
-static void		_StartBlobs(ArchiveHandle* AH, TocEntry* te);
-static void		_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlobs(ArchiveHandle* AH, TocEntry* te);
-static void		_LoadBlobs(ArchiveHandle* AH);
+static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
+static void _StartData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteData(ArchiveHandle *AH, const void *data, int dLen);
+static void _EndData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteByte(ArchiveHandle *AH, const int i);
+static int	_ReadByte(ArchiveHandle *);
+static int	_WriteBuf(ArchiveHandle *AH, const void *buf, int len);
+static int	_ReadBuf(ArchiveHandle *AH, void *buf, int len);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
+
+static void _PrintData(ArchiveHandle *AH);
+static void _skipData(ArchiveHandle *AH);
+static void _skipBlobs(ArchiveHandle *AH);
+
+static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
+static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
+static void _LoadBlobs(ArchiveHandle *AH);
 
 /*------------
  * Buffers used in zlib compression and extra data stored in archive and
  * in TOC entries.
  *------------
  */
-#define zlibOutSize	4096
+#define zlibOutSize 4096
 #define zlibInSize	4096
 
-typedef struct {
-    z_streamp	zp;
-    char*	zlibOut;
-    char*	zlibIn;
-    int		inSize;
-    int		hasSeek;
-    int		filePos;
-    int		dataStart;
+typedef struct
+{
+	z_streamp	zp;
+	char	   *zlibOut;
+	char	   *zlibIn;
+	int			inSize;
+	int			hasSeek;
+	int			filePos;
+	int			dataStart;
 } lclContext;
 
-typedef struct {
-    int		dataPos;
-    int		dataLen;
+typedef struct
+{
+	int			dataPos;
+	int			dataLen;
 } lclTocEntry;
 
 
 /*------
- * Static declarations 
+ * Static declarations
  *------
  */
-static void		_readBlockHeader(ArchiveHandle *AH, int *type, int *id);
-static void     _StartDataCompressor(ArchiveHandle* AH, TocEntry* te);
-static void     _EndDataCompressor(ArchiveHandle* AH, TocEntry* te);
-static int		_getFilePos(ArchiveHandle* AH, lclContext* ctx);
-static int		_DoDeflate(ArchiveHandle* AH, lclContext* ctx, int flush);
+static void _readBlockHeader(ArchiveHandle *AH, int *type, int *id);
+static void _StartDataCompressor(ArchiveHandle *AH, TocEntry *te);
+static void _EndDataCompressor(ArchiveHandle *AH, TocEntry *te);
+static int	_getFilePos(ArchiveHandle *AH, lclContext *ctx);
+static int	_DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush);
 
-static char*	progname = "Archiver(custom)";
+static char *progname = "Archiver(custom)";
 
 
 
 /*
- *  Init routine required by ALL formats. This is a global routine
+ *	Init routine required by ALL formats. This is a global routine
  *	and should be declared in pg_backup_archiver.h
  *
  *	It's task is to create any extra archive context (using AH->formatData),
  *	and to initialize the supported function pointers.
  *
  *	It should also prepare whatever it's input source is for reading/writing,
- *	and in the case of a read mode connection, it should load the Header & TOC. 
+ *	and in the case of a read mode connection, it should load the Header & TOC.
  */
-void InitArchiveFmt_Custom(ArchiveHandle* AH) 
+void
+InitArchiveFmt_Custom(ArchiveHandle *AH)
 {
-    lclContext*		ctx;
-
-    /* Assuming static functions, this can be copied for each format. */
-    AH->ArchiveEntryPtr = _ArchiveEntry;
-    AH->StartDataPtr = _StartData;
-    AH->WriteDataPtr = _WriteData;
-    AH->EndDataPtr = _EndData;
-    AH->WriteBytePtr = _WriteByte;
-    AH->ReadBytePtr = _ReadByte;
-    AH->WriteBufPtr = _WriteBuf;
-    AH->ReadBufPtr = _ReadBuf;
-    AH->ClosePtr = _CloseArchive;
-    AH->PrintTocDataPtr = _PrintTocData;
-    AH->ReadExtraTocPtr = _ReadExtraToc;
-    AH->WriteExtraTocPtr = _WriteExtraToc;
-    AH->PrintExtraTocPtr = _PrintExtraToc;
-
-    AH->StartBlobsPtr = _StartBlobs;
-    AH->StartBlobPtr = _StartBlob;
-    AH->EndBlobPtr = _EndBlob;
-    AH->EndBlobsPtr = _EndBlobs;
-
-    /*
-     *	Set up some special context used in compressing data.
-    */
-    ctx = (lclContext*)malloc(sizeof(lclContext));
-    if (ctx == NULL)
-		die_horribly(AH, "%s: Unable to allocate archive context",progname);
-    AH->formatData = (void*)ctx;
-
-    ctx->zp = (z_streamp)malloc(sizeof(z_stream));
-    if (ctx->zp == NULL)
-	die_horribly(AH, "%s: unable to allocate zlib stream archive context",progname);
+	lclContext *ctx;
+
+	/* Assuming static functions, this can be copied for each format. */
+	AH->ArchiveEntryPtr = _ArchiveEntry;
+	AH->StartDataPtr = _StartData;
+	AH->WriteDataPtr = _WriteData;
+	AH->EndDataPtr = _EndData;
+	AH->WriteBytePtr = _WriteByte;
+	AH->ReadBytePtr = _ReadByte;
+	AH->WriteBufPtr = _WriteBuf;
+	AH->ReadBufPtr = _ReadBuf;
+	AH->ClosePtr = _CloseArchive;
+	AH->PrintTocDataPtr = _PrintTocData;
+	AH->ReadExtraTocPtr = _ReadExtraToc;
+	AH->WriteExtraTocPtr = _WriteExtraToc;
+	AH->PrintExtraTocPtr = _PrintExtraToc;
+
+	AH->StartBlobsPtr = _StartBlobs;
+	AH->StartBlobPtr = _StartBlob;
+	AH->EndBlobPtr = _EndBlob;
+	AH->EndBlobsPtr = _EndBlobs;
+
+	/*
+	 * Set up some special context used in compressing data.
+	 */
+	ctx = (lclContext *) malloc(sizeof(lclContext));
+	if (ctx == NULL)
+		die_horribly(AH, "%s: Unable to allocate archive context", progname);
+	AH->formatData = (void *) ctx;
+
+	ctx->zp = (z_streamp) malloc(sizeof(z_stream));
+	if (ctx->zp == NULL)
+		die_horribly(AH, "%s: unable to allocate zlib stream archive context", progname);
 
 	/*
 	 * zlibOutSize is the buffer size we tell zlib it can output to.  We
-	 * actually allocate one extra byte because some routines want to append
-	 * a trailing zero byte to the zlib output.  The input buffer is expansible
-	 * and is always of size ctx->inSize; zlibInSize is just the initial
-	 * default size for it.
+	 * actually allocate one extra byte because some routines want to
+	 * append a trailing zero byte to the zlib output.	The input buffer
+	 * is expansible and is always of size ctx->inSize; zlibInSize is just
+	 * the initial default size for it.
 	 */
-    ctx->zlibOut = (char*)malloc(zlibOutSize+1);
-    ctx->zlibIn = (char*)malloc(zlibInSize);
-    ctx->inSize = zlibInSize;
-    ctx->filePos = 0;
+	ctx->zlibOut = (char *) malloc(zlibOutSize + 1);
+	ctx->zlibIn = (char *) malloc(zlibInSize);
+	ctx->inSize = zlibInSize;
+	ctx->filePos = 0;
 
-    if (ctx->zlibOut == NULL || ctx->zlibIn == NULL)
-		die_horribly(AH, "%s: unable to allocate buffers in archive context",progname);
+	if (ctx->zlibOut == NULL || ctx->zlibIn == NULL)
+		die_horribly(AH, "%s: unable to allocate buffers in archive context", progname);
 
-    /*
-     * Now open the file
-    */
-    if (AH->mode == archModeWrite) {
+	/*
+	 * Now open the file
+	 */
+	if (AH->mode == archModeWrite)
+	{
 
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_W);
-		} else {
+		else
 			AH->FH = stdout;
-		}
 
 		if (!AH->FH)
-			die_horribly(AH, "%s: unable to open archive file %s",progname, AH->fSpec);
+			die_horribly(AH, "%s: unable to open archive file %s", progname, AH->fSpec);
 
 		ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0);
 
-	} else {
+	}
+	else
+	{
 
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_R);
-		} else {
+		else
 			AH->FH = stdin;
-		}
 		if (!AH->FH)
-			die_horribly(AH, "%s: unable to open archive file %s",progname, AH->fSpec);
+			die_horribly(AH, "%s: unable to open archive file %s", progname, AH->fSpec);
 
 		ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0);
 
 		ReadHead(AH);
 		ReadToc(AH);
 		ctx->dataStart = _getFilePos(AH, ctx);
-    }
+	}
 
 }
 
@@ -206,20 +210,20 @@ void InitArchiveFmt_Custom(ArchiveHandle* AH)
  *
  * Optional.
  *
- * Set up extrac format-related TOC data.  
+ * Set up extrac format-related TOC data.
 */
-static void	_ArchiveEntry(ArchiveHandle* AH, TocEntry* te) 
+static void
+_ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx;
+	lclTocEntry *ctx;
 
-    ctx = (lclTocEntry*)calloc(1, sizeof(lclTocEntry));
-    if (te->dataDumper) {
+	ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry));
+	if (te->dataDumper)
 		ctx->dataPos = -1;
-    } else {
+	else
 		ctx->dataPos = 0;
-    }
-    ctx->dataLen = 0;
-    te->formatData = (void*)ctx;
+	ctx->dataLen = 0;
+	te->formatData = (void *) ctx;
 
 }
 
@@ -232,12 +236,13 @@ static void	_ArchiveEntry(ArchiveHandle* AH, TocEntry* te)
  * Use the Archiver routines to write data - they are non-endian, and
  * maintain other important file information.
  */
-static void	_WriteExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    WriteInt(AH, ctx->dataPos);
-    WriteInt(AH, ctx->dataLen);
+	WriteInt(AH, ctx->dataPos);
+	WriteInt(AH, ctx->dataLen);
 }
 
 /*
@@ -248,17 +253,19 @@ static void	_WriteExtraToc(ArchiveHandle* AH, TocEntry* te)
  * Needs to match the order defined in _WriteExtraToc, and sould also
  * use the Archiver input routines.
  */
-static void	_ReadExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    if (ctx == NULL) {
-		ctx = (lclTocEntry*)malloc(sizeof(lclTocEntry));
-		te->formatData = (void*)ctx;
-    }
+	if (ctx == NULL)
+	{
+		ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry));
+		te->formatData = (void *) ctx;
+	}
 
-    ctx->dataPos = ReadInt( AH );
-    ctx->dataLen = ReadInt( AH );
+	ctx->dataPos = ReadInt(AH);
+	ctx->dataLen = ReadInt(AH);
 }
 
 /*
@@ -268,11 +275,12 @@ static void	_ReadExtraToc(ArchiveHandle* AH, TocEntry* te)
  * Optional.
  *
  */
-static void	_PrintExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    ahprintf(AH, "-- Data Pos: %d (Length %d)\n", ctx->dataPos, ctx->dataLen);
+	ahprintf(AH, "-- Data Pos: %d (Length %d)\n", ctx->dataPos, ctx->dataLen);
 }
 
 /*
@@ -285,22 +293,23 @@ static void	_PrintExtraToc(ArchiveHandle* AH, TocEntry* te)
  * Optional, but strongly recommended.
  *
  */
-static void	_StartData(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    tctx->dataPos = _getFilePos(AH, ctx);
+	tctx->dataPos = _getFilePos(AH, ctx);
 
-    _WriteByte(AH, BLK_DATA); /* Block type */
-    WriteInt(AH, te->id); /* For sanity check */
+	_WriteByte(AH, BLK_DATA);	/* Block type */
+	WriteInt(AH, te->id);		/* For sanity check */
 
-    _StartDataCompressor(AH, te);
+	_StartDataCompressor(AH, te);
 
 }
 
 /*
- * Called by archiver when dumper calls WriteData. This routine is 
+ * Called by archiver when dumper calls WriteData. This routine is
  * called for both BLOB and TABLE data; it is the responsibility of
  * the format to manage each kind of data using StartBlob/StartData.
  *
@@ -309,19 +318,21 @@ static void	_StartData(ArchiveHandle* AH, TocEntry* te)
  * Mandatory.
  *
  */
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen)
+static int
+_WriteData(ArchiveHandle *AH, const void *data, int dLen)
 {
-    lclContext*	ctx = (lclContext*)AH->formatData;
-    z_streamp	zp = ctx->zp;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	z_streamp	zp = ctx->zp;
 
-    zp->next_in = (void*)data;
-    zp->avail_in = dLen;
+	zp->next_in = (void *) data;
+	zp->avail_in = dLen;
 
-    while (zp->avail_in != 0) {
-	/* printf("Deflating %d bytes\n", dLen); */
+	while (zp->avail_in != 0)
+	{
+		/* printf("Deflating %d bytes\n", dLen); */
 		_DoDeflate(AH, ctx, 0);
-    }
-    return dLen;
+	}
+	return dLen;
 }
 
 /*
@@ -331,35 +342,37 @@ static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen)
  * Optional.
  *
  */
-static void	_EndData(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    _EndDataCompressor(AH, te);
+	_EndDataCompressor(AH, te);
 
-    tctx->dataLen = _getFilePos(AH, ctx) - tctx->dataPos;
+	tctx->dataLen = _getFilePos(AH, ctx) - tctx->dataPos;
 }
 
 /*
- * Called by the archiver when starting to save all BLOB DATA (not schema). 
+ * Called by the archiver when starting to save all BLOB DATA (not schema).
  * This routine should save whatever format-specific information is needed
- * to read the BLOBs back into memory. 
+ * to read the BLOBs back into memory.
  *
  * It is called just prior to the dumper's DataDumper routine.
  *
  * Optional, but strongly recommended.
  *
  */
-static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartBlobs(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    tctx->dataPos = _getFilePos(AH, ctx);
+	tctx->dataPos = _getFilePos(AH, ctx);
 
-    _WriteByte(AH, BLK_BLOBS); /* Block type */
-    WriteInt(AH, te->id); /* For sanity check */
+	_WriteByte(AH, BLK_BLOBS);	/* Block type */
+	WriteInt(AH, te->id);		/* For sanity check */
 
 }
 
@@ -370,13 +383,14 @@ static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
  *
  * Must save the passed OID for retrieval at restore-time.
  */
-static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-    if (oid == 0) 
-	die_horribly(AH, "%s: illegal OID for BLOB (%d)\n", progname, oid);
+	if (oid == 0)
+		die_horribly(AH, "%s: illegal OID for BLOB (%d)\n", progname, oid);
 
-    WriteInt(AH, oid);
-    _StartDataCompressor(AH, te);
+	WriteInt(AH, oid);
+	_StartDataCompressor(AH, te);
 }
 
 /*
@@ -385,91 +399,100 @@ static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
  * Optional.
  *
  */
-static void	_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-    _EndDataCompressor(AH, te);
+	_EndDataCompressor(AH, te);
 }
 
 /*
- * Called by the archiver when finishing saving all BLOB DATA. 
+ * Called by the archiver when finishing saving all BLOB DATA.
  *
  * Optional.
  *
  */
-static void	_EndBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndBlobs(ArchiveHandle *AH, TocEntry *te)
 {
 	/* Write out a fake zero OID to mark end-of-blobs. */
-    WriteInt(AH, 0);
+	WriteInt(AH, 0);
 }
 
 /*
  * Print data for a gievn TOC entry
 */
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
+static void
+_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-    lclContext* 	ctx = (lclContext*)AH->formatData;
-    int			id;
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
-    int			blkType;
-    int			found = 0;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			id;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+	int			blkType;
+	int			found = 0;
 
-    if (tctx->dataPos == 0) 
+	if (tctx->dataPos == 0)
 		return;
 
-    if (!ctx->hasSeek || tctx->dataPos < 0) {
+	if (!ctx->hasSeek || tctx->dataPos < 0)
+	{
 
-	/* Skip over unnecessary blocks until we get the one we want. */
+		/* Skip over unnecessary blocks until we get the one we want. */
 
-	found = 0;
+		found = 0;
 
-	_readBlockHeader(AH, &blkType, &id);
+		_readBlockHeader(AH, &blkType, &id);
 
-	while (id != te->id) {
+		while (id != te->id)
+		{
 
-	    if ( (TocIDRequired(AH, id, ropt) & 2) != 0)
-			die_horribly(AH, "%s: Dumping a specific TOC data block out of order is not supported"
-							" without on this input stream (fseek required)\n", progname);
+			if ((TocIDRequired(AH, id, ropt) & 2) != 0)
+				die_horribly(AH, "%s: Dumping a specific TOC data block out of order is not supported"
+							 " without on this input stream (fseek required)\n", progname);
 
-	    switch (blkType) {
+			switch (blkType)
+			{
 
-			case BLK_DATA:
+				case BLK_DATA:
 
-				_skipData(AH);
-				break;
+					_skipData(AH);
+					break;
 
-			case BLK_BLOBS:
+				case BLK_BLOBS:
 
-				_skipBlobs(AH);
-				break;
+					_skipBlobs(AH);
+					break;
 
-			default: /* Always have a default */
+				default:		/* Always have a default */
 
-				die_horribly(AH, "%s: unrecognized data block type while searching archive %d\n", 
-								progname, blkType);
-				break;
-	    }
+					die_horribly(AH, "%s: unrecognized data block type while searching archive %d\n",
+								 progname, blkType);
+					break;
+			}
 
-	    _readBlockHeader(AH, &blkType, &id);
+			_readBlockHeader(AH, &blkType, &id);
 
-	}
+		}
 
-    } else {
+	}
+	else
+	{
 
-	/* Grab it */
+		/* Grab it */
 
 		if (fseek(AH->FH, tctx->dataPos, SEEK_SET) != 0)
-			die_horribly(AH, "%s: error %d in file seek\n",progname, errno);
+			die_horribly(AH, "%s: error %d in file seek\n", progname, errno);
 
 		_readBlockHeader(AH, &blkType, &id);
 
-    }
+	}
 
-    /* Are we sane? */
-    if (id != te->id)
+	/* Are we sane? */
+	if (id != te->id)
 		die_horribly(AH, "%s: Found unexpected block ID (%d) when reading data - expected %d\n",
-						progname, id, te->id);
+					 progname, id, te->id);
 
-    switch (blkType) {
+	switch (blkType)
+	{
 
 		case BLK_DATA:
 
@@ -484,61 +507,67 @@ static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
 			_LoadBlobs(AH);
 			break;
 
-		default: /* Always have a default */
+		default:				/* Always have a default */
 
-			die_horribly(AH, "%s: unrecognized data block type %d while restoring archive\n", 
-							progname, blkType);
+			die_horribly(AH, "%s: unrecognized data block type %d while restoring archive\n",
+						 progname, blkType);
 			break;
-    }
+	}
 
-    ahprintf(AH, "\n\n");
+	ahprintf(AH, "\n\n");
 }
 
 /*
  * Print data from current file position.
 */
-static void	_PrintData(ArchiveHandle* AH)
+static void
+_PrintData(ArchiveHandle *AH)
 {
-    lclContext*	ctx = (lclContext*)AH->formatData;
-    z_streamp	zp = ctx->zp;
-    int		blkLen;
-    char*	in = ctx->zlibIn;
-    int		cnt;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	z_streamp	zp = ctx->zp;
+	int			blkLen;
+	char	   *in = ctx->zlibIn;
+	int			cnt;
+
 #ifdef HAVE_LIBZ
-    int         res;
-    char*	out = ctx->zlibOut;
+	int			res;
+	char	   *out = ctx->zlibOut;
+
 #endif
 
 #ifdef HAVE_LIBZ
 
-    res = Z_OK;
+	res = Z_OK;
 
-    if (AH->compression != 0) {
+	if (AH->compression != 0)
+	{
 		zp->zalloc = Z_NULL;
 		zp->zfree = Z_NULL;
 		zp->opaque = Z_NULL;
 
 		if (inflateInit(zp) != Z_OK)
 			die_horribly(AH, "%s: could not initialize compression library - %s\n", progname, zp->msg);
-    }
+	}
 
 #endif
 
-    blkLen = ReadInt(AH);
-    while (blkLen != 0) {
-		if (blkLen+1 > ctx->inSize) {
+	blkLen = ReadInt(AH);
+	while (blkLen != 0)
+	{
+		if (blkLen + 1 > ctx->inSize)
+		{
 			free(ctx->zlibIn);
 			ctx->zlibIn = NULL;
-			ctx->zlibIn = (char*)malloc(blkLen+1);
+			ctx->zlibIn = (char *) malloc(blkLen + 1);
 			if (!ctx->zlibIn)
 				die_horribly(AH, "%s: failed to allocate decompression buffer\n", progname);
 
-			ctx->inSize = blkLen+1;
+			ctx->inSize = blkLen + 1;
 			in = ctx->zlibIn;
 		}
 
 		cnt = fread(in, 1, blkLen, AH->FH);
-		if (cnt != blkLen) 
+		if (cnt != blkLen)
 			die_horribly(AH, "%s: could not read data block - expected %d, got %d\n", progname, blkLen, cnt);
 
 		ctx->filePos += blkLen;
@@ -548,9 +577,11 @@ static void	_PrintData(ArchiveHandle* AH)
 
 #ifdef HAVE_LIBZ
 
-		if (AH->compression != 0) {
+		if (AH->compression != 0)
+		{
 
-			while (zp->avail_in != 0) {
+			while (zp->avail_in != 0)
+			{
 				zp->next_out = out;
 				zp->avail_out = zlibOutSize;
 				res = inflate(zp, 0);
@@ -560,7 +591,9 @@ static void	_PrintData(ArchiveHandle* AH)
 				out[zlibOutSize - zp->avail_out] = '\0';
 				ahwrite(out, 1, zlibOutSize - zp->avail_out, AH);
 			}
-		} else {
+		}
+		else
+		{
 #endif
 			in[zp->avail_in] = '\0';
 			ahwrite(in, 1, zp->avail_in, AH);
@@ -572,14 +605,15 @@ static void	_PrintData(ArchiveHandle* AH)
 
 		blkLen = ReadInt(AH);
 
-    }
+	}
 
 #ifdef HAVE_LIBZ
-    if (AH->compression != 0) 
-    {
+	if (AH->compression != 0)
+	{
 		zp->next_in = NULL;
 		zp->avail_in = 0;
-		while (res != Z_STREAM_END) {
+		while (res != Z_STREAM_END)
+		{
 			zp->next_out = out;
 			zp->avail_out = zlibOutSize;
 			res = inflate(zp, 0);
@@ -589,25 +623,26 @@ static void	_PrintData(ArchiveHandle* AH)
 			out[zlibOutSize - zp->avail_out] = '\0';
 			ahwrite(out, 1, zlibOutSize - zp->avail_out, AH);
 		}
-    }
+	}
 #endif
 
 }
 
-static void	_LoadBlobs(ArchiveHandle* AH)
+static void
+_LoadBlobs(ArchiveHandle *AH)
 {
-    int		oid;
+	int			oid;
 
 	StartRestoreBlobs(AH);
 
-    oid = ReadInt(AH);
-    while(oid != 0)
-    {
+	oid = ReadInt(AH);
+	while (oid != 0)
+	{
 		StartRestoreBlob(AH, oid);
 		_PrintData(AH);
 		EndRestoreBlob(AH, oid);
 		oid = ReadInt(AH);
-    }
+	}
 
 	EndRestoreBlobs(AH);
 
@@ -616,49 +651,53 @@ static void	_LoadBlobs(ArchiveHandle* AH)
 /*
  * Skip the BLOBs from the current file position.
  * BLOBS are written sequentially as data blocks (see below).
- * Each BLOB is preceded by it's original OID. 
+ * Each BLOB is preceded by it's original OID.
  * A zero OID indicated the end of the BLOBS
  */
-static void	_skipBlobs(ArchiveHandle* AH)
+static void
+_skipBlobs(ArchiveHandle *AH)
 {
-    int		oid;
+	int			oid;
 
-    oid = ReadInt(AH);
-    while(oid != 0)
-    {
+	oid = ReadInt(AH);
+	while (oid != 0)
+	{
 		_skipData(AH);
 		oid = ReadInt(AH);
-    }
+	}
 }
 
 /*
  * Skip data from current file position.
- * Data blocks are formatted as an integer length, followed by data. 
+ * Data blocks are formatted as an integer length, followed by data.
  * A zero length denoted the end of the block.
 */
-static void	_skipData(ArchiveHandle* AH)
+static void
+_skipData(ArchiveHandle *AH)
 {
-    lclContext*	ctx = (lclContext*)AH->formatData;
-    int		blkLen;
-    char*	in = ctx->zlibIn;
-    int		cnt;
-
-    blkLen = ReadInt(AH);
-    while (blkLen != 0) {
-	if (blkLen > ctx->inSize) {
-	    free(ctx->zlibIn);
-	    ctx->zlibIn = (char*)malloc(blkLen);
-	    ctx->inSize = blkLen;
-	    in = ctx->zlibIn;
-	}
-	cnt = fread(in, 1, blkLen, AH->FH);
-	if (cnt != blkLen) 
-	    die_horribly(AH, "%s: could not read data block - expected %d, got %d\n", progname, blkLen, cnt);
-
-	ctx->filePos += blkLen;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			blkLen;
+	char	   *in = ctx->zlibIn;
+	int			cnt;
 
 	blkLen = ReadInt(AH);
-    }
+	while (blkLen != 0)
+	{
+		if (blkLen > ctx->inSize)
+		{
+			free(ctx->zlibIn);
+			ctx->zlibIn = (char *) malloc(blkLen);
+			ctx->inSize = blkLen;
+			in = ctx->zlibIn;
+		}
+		cnt = fread(in, 1, blkLen, AH->FH);
+		if (cnt != blkLen)
+			die_horribly(AH, "%s: could not read data block - expected %d, got %d\n", progname, blkLen, cnt);
+
+		ctx->filePos += blkLen;
+
+		blkLen = ReadInt(AH);
+	}
 
 }
 
@@ -671,18 +710,18 @@ static void	_skipData(ArchiveHandle* AH)
  * These routines are only used to read & write headers & TOC.
  *
  */
-static int	_WriteByte(ArchiveHandle* AH, const int i)
+static int
+_WriteByte(ArchiveHandle *AH, const int i)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = fputc(i, AH->FH);
-    if (res != EOF) {
+	res = fputc(i, AH->FH);
+	if (res != EOF)
 		ctx->filePos += 1;
-	} else {
-		die_horribly(AH, "%s: could not write byte./n",progname);
-    }
-    return res;
+	else
+		die_horribly(AH, "%s: could not write byte./n", progname);
+	return res;
 }
 
 /*
@@ -694,16 +733,16 @@ static int	_WriteByte(ArchiveHandle* AH, const int i)
  * These routines are only used to read & write headers & TOC.
  *
  */
-static int    	_ReadByte(ArchiveHandle* AH)
+static int
+_ReadByte(ArchiveHandle *AH)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = fgetc(AH->FH);
-    if (res != EOF) {
+	res = fgetc(AH->FH);
+	if (res != EOF)
 		ctx->filePos += 1;
-    }
-    return res;
+	return res;
 }
 
 /*
@@ -715,35 +754,39 @@ static int    	_ReadByte(ArchiveHandle* AH)
  * These routines are only used to read & write headers & TOC.
  *
  */
-static int	_WriteBuf(ArchiveHandle* AH, const void* buf, int len)
+static int
+_WriteBuf(ArchiveHandle *AH, const void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
-    res = fwrite(buf, 1, len, AH->FH);
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
+
+	res = fwrite(buf, 1, len, AH->FH);
 
 	if (res != len)
 		die_horribly(AH, "%s: write error in _WriteBuf (%d != %d)\n", progname, res, len);
 
-    ctx->filePos += res;
-    return res;
+	ctx->filePos += res;
+	return res;
 }
 
 /*
  * Read a block of bytes from the archive.
- * 
+ *
  * Mandatory.
- * 
+ *
  * Called by the archiver to read a block of bytes from the archive
  * These routines are only used to read & write headers & TOC.
  *
  */
-static int	_ReadBuf(ArchiveHandle* AH, void* buf, int len)
+static int
+_ReadBuf(ArchiveHandle *AH, void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int				res;
-    res = fread(buf, 1, len, AH->FH);
-    ctx->filePos += res;
-    return res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
+
+	res = fread(buf, 1, len, AH->FH);
+	ctx->filePos += res;
+	return res;
 }
 
 /*
@@ -751,42 +794,47 @@ static int	_ReadBuf(ArchiveHandle* AH, void* buf, int len)
  *
  * Mandatory.
  *
- * When writing the archive, this is the routine that actually starts 
- * the process of saving it to files. No data should be written prior 
+ * When writing the archive, this is the routine that actually starts
+ * the process of saving it to files. No data should be written prior
  * to this point, since the user could sort the TOC after creating it.
- * 
+ *
  * If an archive is to be written, this toutine must call:
  *		WriteHead			to save the archive header
- * 		WriteToc 			to save the TOC entries
+ *		WriteToc			to save the TOC entries
  *		WriteDataChunks		to save all DATA & BLOBs.
  *
  */
-static void	_CloseArchive(ArchiveHandle* AH)
+static void
+_CloseArchive(ArchiveHandle *AH)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			tpos;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			tpos;
 
-    if (AH->mode == archModeWrite) {
+	if (AH->mode == archModeWrite)
+	{
 		WriteHead(AH);
 		tpos = ftell(AH->FH);
 		WriteToc(AH);
 		ctx->dataStart = _getFilePos(AH, ctx);
 		WriteDataChunks(AH);
-		/* This is not an essential operation - it is really only
-	     * needed if we expect to be doing seeks to read the data back
-	   	 * - it may be ok to just use the existing self-consistent block
+
+		/*
+		 * This is not an essential operation - it is really only needed
+		 * if we expect to be doing seeks to read the data back - it may
+		 * be ok to just use the existing self-consistent block
 		 * formatting.
-	     */
-		if (ctx->hasSeek) {
+		 */
+		if (ctx->hasSeek)
+		{
 			fseek(AH->FH, tpos, SEEK_SET);
 			WriteToc(AH);
 		}
-    }
+	}
 
-    if (fclose(AH->FH) != 0)
-		die_horribly(AH, "%s: could not close archive file\n",progname);
+	if (fclose(AH->FH) != 0)
+		die_horribly(AH, "%s: could not close archive file\n", progname);
 
-    AH->FH = NULL; 
+	AH->FH = NULL;
 }
 
 /*--------------------------------------------------
@@ -797,32 +845,35 @@ static void	_CloseArchive(ArchiveHandle* AH)
 /*
  * Get the current position in the archive file.
  */
-static int	_getFilePos(ArchiveHandle* AH, lclContext* ctx) 
+static int
+_getFilePos(ArchiveHandle *AH, lclContext *ctx)
 {
-    int		pos;
-    if (ctx->hasSeek) {
+	int			pos;
+
+	if (ctx->hasSeek)
+	{
 		pos = ftell(AH->FH);
-		if (pos != ctx->filePos) {
+		if (pos != ctx->filePos)
 			fprintf(stderr, "Warning: ftell mismatch with filePos\n");
-		}
-    } else {
+	}
+	else
 		pos = ctx->filePos;
-    }
-    return pos;
+	return pos;
 }
 
 /*
- * Read a data block header. The format changed in V1.3, so we 
+ * Read a data block header. The format changed in V1.3, so we
  * put the code here for simplicity.
  */
-static void _readBlockHeader(ArchiveHandle *AH, int *type, int *id)
+static void
+_readBlockHeader(ArchiveHandle *AH, int *type, int *id)
 {
-    if (AH->version < K_VERS_1_3)
+	if (AH->version < K_VERS_1_3)
 		*type = BLK_DATA;
-    else
+	else
 		*type = _ReadByte(AH);;
 
-    *id = ReadInt(AH);
+	*id = ReadInt(AH);
 }
 
 /*
@@ -830,35 +881,36 @@ static void _readBlockHeader(ArchiveHandle *AH, int *type, int *id)
  * StartData & StartBlob. The buffers are setup in the Init routine.
  *
  */
-static void	_StartDataCompressor(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartDataCompressor(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    z_streamp   	zp = ctx->zp;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	z_streamp	zp = ctx->zp;
 
 #ifdef HAVE_LIBZ
 
-    if (AH->compression < 0 || AH->compression > 9) {
+	if (AH->compression < 0 || AH->compression > 9)
 		AH->compression = Z_DEFAULT_COMPRESSION;
-    }
 
-    if (AH->compression != 0) {
-	zp->zalloc = Z_NULL;
-	zp->zfree = Z_NULL;
-	zp->opaque = Z_NULL;
+	if (AH->compression != 0)
+	{
+		zp->zalloc = Z_NULL;
+		zp->zfree = Z_NULL;
+		zp->opaque = Z_NULL;
 
-	if (deflateInit(zp, AH->compression) != Z_OK)
-	    die_horribly(AH, "%s: could not initialize compression library - %s\n",progname, zp->msg);
-    }
+		if (deflateInit(zp, AH->compression) != Z_OK)
+			die_horribly(AH, "%s: could not initialize compression library - %s\n", progname, zp->msg);
+	}
 
 #else
 
-    AH->compression = 0;
+	AH->compression = 0;
 
 #endif
 
-    /* Just be paranoid - maybe End is called after Start, with no Write */
-    zp->next_out = ctx->zlibOut;
-    zp->avail_out = zlibOutSize;
+	/* Just be paranoid - maybe End is called after Start, with no Write */
+	zp->next_out = ctx->zlibOut;
+	zp->avail_out = zlibOutSize;
 }
 
 /*
@@ -867,42 +919,51 @@ static void	_StartDataCompressor(ArchiveHandle* AH, TocEntry* te)
  * In the case of Z0, or no zlib, just write the raw data.
  *
  */
-static int	_DoDeflate(ArchiveHandle* AH, lclContext* ctx, int flush) 
+static int
+_DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
 {
-    z_streamp   zp = ctx->zp;
+	z_streamp	zp = ctx->zp;
 
 #ifdef HAVE_LIBZ
-    char*	out = ctx->zlibOut;
-    int		res = Z_OK;
+	char	   *out = ctx->zlibOut;
+	int			res = Z_OK;
 
-    if (AH->compression != 0) 
-    {
+	if (AH->compression != 0)
+	{
 		res = deflate(zp, flush);
 		if (res == Z_STREAM_ERROR)
-			die_horribly(AH, "%s: could not compress data - %s\n",progname, zp->msg);
+			die_horribly(AH, "%s: could not compress data - %s\n", progname, zp->msg);
 
-		if 	(      ( (flush == Z_FINISH) && (zp->avail_out < zlibOutSize) )
-			|| (zp->avail_out == 0) 
+		if (((flush == Z_FINISH) && (zp->avail_out < zlibOutSize))
+			|| (zp->avail_out == 0)
 			|| (zp->avail_in != 0)
-			) 
+			)
 		{
+
 			/*
-		   	 * Extra paranoia: avoid zero-length chunks since a zero 
+			 * Extra paranoia: avoid zero-length chunks since a zero
 			 * length chunk is the EOF marker. This should never happen
-		     * but...
+			 * but...
 			 */
-			if (zp->avail_out < zlibOutSize) {
-				/* printf("Wrote %d byte deflated chunk\n", zlibOutSize - zp->avail_out); */
+			if (zp->avail_out < zlibOutSize)
+			{
+
+				/*
+				 * printf("Wrote %d byte deflated chunk\n", zlibOutSize -
+				 * zp->avail_out);
+				 */
 				WriteInt(AH, zlibOutSize - zp->avail_out);
 				if (fwrite(out, 1, zlibOutSize - zp->avail_out, AH->FH) != (zlibOutSize - zp->avail_out))
-					die_horribly(AH, "%s: could not write compressed chunk\n",progname);
+					die_horribly(AH, "%s: could not write compressed chunk\n", progname);
 				ctx->filePos += zlibOutSize - zp->avail_out;
 			}
 			zp->next_out = out;
 			zp->avail_out = zlibOutSize;
 		}
-    } else {
+	}
+	else
 #endif
+	{
 		if (zp->avail_in > 0)
 		{
 			WriteInt(AH, zp->avail_in);
@@ -910,7 +971,9 @@ static int	_DoDeflate(ArchiveHandle* AH, lclContext* ctx, int flush)
 				die_horribly(AH, "%s: could not write uncompressed chunk\n", progname);
 			ctx->filePos += zp->avail_in;
 			zp->avail_in = 0;
-		} else {
+		}
+		else
+		{
 #ifdef HAVE_LIBZ
 			if (flush == Z_FINISH)
 				res = Z_STREAM_END;
@@ -918,35 +981,37 @@ static int	_DoDeflate(ArchiveHandle* AH, lclContext* ctx, int flush)
 		}
 
 
-#ifdef HAVE_LIBZ
-    }
+	}
 
-    return res;
+#ifdef HAVE_LIBZ
+	return res;
 #else
-    return 1;
+	return 1;
 #endif
 
 }
 
 /*
- * Terminate zlib context and flush it's buffers. If no zlib 
+ * Terminate zlib context and flush it's buffers. If no zlib
  * then just return.
  *
  */
-static void	_EndDataCompressor(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndDataCompressor(ArchiveHandle *AH, TocEntry *te)
 {
 
 #ifdef HAVE_LIBZ
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    z_streamp		zp = ctx->zp;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	z_streamp	zp = ctx->zp;
+	int			res;
 
-    if (AH->compression != 0)
-    {
+	if (AH->compression != 0)
+	{
 		zp->next_in = NULL;
 		zp->avail_in = 0;
 
-		do { 	
+		do
+		{
 			/* printf("Ending data output\n"); */
 			res = _DoDeflate(AH, ctx, Z_FINISH);
 		} while (res != Z_STREAM_END);
@@ -959,5 +1024,3 @@ static void	_EndDataCompressor(ArchiveHandle* AH, TocEntry* te)
 	/* Send the end marker */
 	WriteInt(AH, 0);
 }
-
-
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index 3e3976bc741a66b26ff6c9b82b534c31b3819f8d..9b747a2572430b2296bd6b4c4efe6cad16e014a2 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -2,16 +2,16 @@
  *
  * pg_backup_db.c
  *
- *  Implements the basic DB functions used by the archiver.
+ *	Implements the basic DB functions used by the archiver.
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.15 2001/03/19 02:35:28 pjw Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.16 2001/03/22 04:00:12 momjian Exp $
  *
  * NOTES
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
  *
- *    - Check results of PQ routines more carefully.
+ *	  - Check results of PQ routines more carefully.
  *
  * Modifications - 19-Mar-2001 - pjw@rhyme.com.au
  *
@@ -38,12 +38,12 @@
 #include "strdup.h"
 #endif
 
-static const char	*progname = "Archiver(db)";
+static const char *progname = "Archiver(db)";
 
-static void 	_prompt_for_password(char *username, char *password);
-static void 	_check_database_version(ArchiveHandle *AH, bool ignoreVersion);
-static PGconn*	_connectDB(ArchiveHandle *AH, const char* newdbname, char *newUser);
-static int		_executeSqlCommand(ArchiveHandle* AH, PGconn *conn, PQExpBuffer qry, char *desc);
+static void _prompt_for_password(char *username, char *password);
+static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion);
+static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser);
+static int	_executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc);
 
 
 static void
@@ -55,7 +55,8 @@ _prompt_for_password(char *username, char *password)
 
 #ifdef HAVE_TERMIOS_H
 	struct termios t_orig,
-				   t;
+				t;
+
 #endif
 
 	/*
@@ -118,10 +119,10 @@ static void
 _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
 {
 	PGresult   *res;
-	double      myversion;
+	double		myversion;
 	const char *remoteversion_str;
-	double      remoteversion;
-	PGconn		*conn = AH->connection;
+	double		remoteversion;
+	PGconn	   *conn = AH->connection;
 
 	myversion = strtod(PG_VERSION, NULL);
 	res = PQexec(conn, "SELECT version()");
@@ -130,7 +131,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
 		PQntuples(res) != 1)
 
 		die_horribly(AH, "check_database_version(): command failed.  "
-				"Explanation from backend: '%s'.\n", PQerrorMessage(conn));
+			  "Explanation from backend: '%s'.\n", PQerrorMessage(conn));
 
 	remoteversion_str = PQgetvalue(res, 0, 0);
 	remoteversion = strtod(remoteversion_str + 11, NULL);
@@ -142,21 +143,22 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
 			fprintf(stderr, "Proceeding despite version mismatch.\n");
 		else
 			die_horribly(AH, "Aborting because of version mismatch.\n"
-				    "Use --ignore-version if you think it's safe to proceed anyway.\n");	
+						 "Use --ignore-version if you think it's safe to proceed anyway.\n");
 	}
 	PQclear(res);
 }
 
-/* 
+/*
  * Check if a given user is a superuser.
  */
-int UserIsSuperuser(ArchiveHandle *AH, char* user)
+int
+UserIsSuperuser(ArchiveHandle *AH, char *user)
 {
-	PQExpBuffer			qry = createPQExpBuffer();
-	PGresult			*res;
-	int					i_usesuper;
-	int					ntups;
-	int					isSuper;
+	PQExpBuffer qry = createPQExpBuffer();
+	PGresult   *res;
+	int			i_usesuper;
+	int			ntups;
+	int			isSuper;
 
 	/* Get the superuser setting */
 	appendPQExpBuffer(qry, "select usesuper from pg_user where usename = '%s'", user);
@@ -164,11 +166,11 @@ int UserIsSuperuser(ArchiveHandle *AH, char* user)
 
 	if (!res)
 		die_horribly(AH, "%s: null result checking superuser status of %s.\n",
-					progname, user);
+					 progname, user);
 
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 		die_horribly(AH, "%s: Could not check superuser status of %s. Explanation from backend: %s\n",
-					progname, user, PQerrorMessage(AH->connection));
+					 progname, user, PQerrorMessage(AH->connection));
 
 	ntups = PQntuples(res);
 
@@ -184,28 +186,31 @@ int UserIsSuperuser(ArchiveHandle *AH, char* user)
 	return isSuper;
 }
 
-int ConnectedUserIsSuperuser(ArchiveHandle *AH)
+int
+ConnectedUserIsSuperuser(ArchiveHandle *AH)
 {
 	return UserIsSuperuser(AH, PQuser(AH->connection));
 }
 
-char* ConnectedUser(ArchiveHandle *AH)
+char *
+ConnectedUser(ArchiveHandle *AH)
 {
 	return PQuser(AH->connection);
 }
 
 /*
- * Reconnect the DB associated with the archive handle 
+ * Reconnect the DB associated with the archive handle
  */
-int ReconnectDatabase(ArchiveHandle *AH, const char* newdbname, char *newUser)
+int
+ReconnectDatabase(ArchiveHandle *AH, const char *newdbname, char *newUser)
 {
-	PGconn		*newConn;
-	char		*dbname;
+	PGconn	   *newConn;
+	char	   *dbname;
 
-	if (!newdbname || (strcmp(newdbname, "-") == 0) )
+	if (!newdbname || (strcmp(newdbname, "-") == 0))
 		dbname = PQdb(AH->connection);
 	else
-		dbname = (char*)newdbname;
+		dbname = (char *) newdbname;
 
 	/* Let's see if the request is already satisfied */
 	if (strcmp(PQuser(AH->connection), newUser) == 0 && strcmp(newdbname, PQdb(AH->connection)) == 0)
@@ -223,26 +228,27 @@ int ReconnectDatabase(ArchiveHandle *AH, const char* newdbname, char *newUser)
 /*
  * Connect to the db again.
  */
-static PGconn* _connectDB(ArchiveHandle *AH, const char* reqdb, char *requser)
+static PGconn *
+_connectDB(ArchiveHandle *AH, const char *reqdb, char *requser)
 {
 	int			need_pass;
-	PGconn		*newConn;
+	PGconn	   *newConn;
 	char		password[100];
-	char		*pwparam = NULL;
+	char	   *pwparam = NULL;
 	int			badPwd = 0;
 	int			noPwd = 0;
-	char		*newdb;
-	char		*newuser;
+	char	   *newdb;
+	char	   *newuser;
 
-	if (!reqdb || (strcmp(reqdb, "-") == 0) )
+	if (!reqdb || (strcmp(reqdb, "-") == 0))
 		newdb = PQdb(AH->connection);
 	else
-		newdb = (char*)reqdb;
+		newdb = (char *) reqdb;
 
 	if (!requser || (strlen(requser) == 0))
 		newuser = PQuser(AH->connection);
 	else
-		newuser = (char*)requser;
+		newuser = (char *) requser;
 
 	ahlog(AH, 1, "Connecting to %s as %s\n", newdb, newuser);
 
@@ -250,8 +256,8 @@ static PGconn* _connectDB(ArchiveHandle *AH, const char* reqdb, char *requser)
 	{
 		need_pass = false;
 		newConn = PQsetdbLogin(PQhost(AH->connection), PQport(AH->connection),
-								NULL, NULL, newdb, 
-								newuser, pwparam);
+							   NULL, NULL, newdb,
+							   newuser, pwparam);
 		if (!newConn)
 			die_horribly(AH, "%s: Failed to reconnect (PQsetdbLogin failed).\n", progname);
 
@@ -259,9 +265,9 @@ static PGconn* _connectDB(ArchiveHandle *AH, const char* reqdb, char *requser)
 		{
 			noPwd = (strcmp(PQerrorMessage(newConn), "fe_sendauth: no password supplied\n") == 0);
 			badPwd = (strncmp(PQerrorMessage(newConn), "Password authentication failed for user", 39)
-						== 0);
+					  == 0);
 
-			if (noPwd || badPwd) 
+			if (noPwd || badPwd)
 			{
 
 				if (badPwd)
@@ -271,7 +277,7 @@ static PGconn* _connectDB(ArchiveHandle *AH, const char* reqdb, char *requser)
 
 				need_pass = true;
 				_prompt_for_password(newuser, password);
-				pwparam = password; 
+				pwparam = password;
 			}
 			else
 				die_horribly(AH, "%s: Could not reconnect. %s\n", progname, PQerrorMessage(newConn));
@@ -283,22 +289,23 @@ static PGconn* _connectDB(ArchiveHandle *AH, const char* reqdb, char *requser)
 }
 
 
-PGconn* ConnectDatabase(Archive *AHX, 
-		const char* 	dbname,
-		const char* 	pghost,
-		const char* 	pgport,
-		const int		reqPwd,
-		const int		ignoreVersion)
+PGconn *
+ConnectDatabase(Archive *AHX,
+				const char *dbname,
+				const char *pghost,
+				const char *pgport,
+				const int reqPwd,
+				const int ignoreVersion)
 {
-	ArchiveHandle	*AH = (ArchiveHandle*)AHX;
-	char			connect_string[512] = "";
-	char			tmp_string[128];
-	char			password[100];
+	ArchiveHandle *AH = (ArchiveHandle *) AHX;
+	char		connect_string[512] = "";
+	char		tmp_string[128];
+	char		password[100];
 
 	if (AH->connection)
 		die_horribly(AH, "%s: already connected to database\n", progname);
 
-	if (!dbname && !(dbname = getenv("PGDATABASE")) ) 
+	if (!dbname && !(dbname = getenv("PGDATABASE")))
 		die_horribly(AH, "%s: no database name specified\n", progname);
 
 	AH->dbname = strdup(dbname);
@@ -310,7 +317,7 @@ PGconn* ConnectDatabase(Archive *AHX,
 		strcat(connect_string, tmp_string);
 	}
 	else
-	    AH->pghost = NULL;
+		AH->pghost = NULL;
 
 	if (pgport != NULL)
 	{
@@ -319,7 +326,7 @@ PGconn* ConnectDatabase(Archive *AHX,
 		strcat(connect_string, tmp_string);
 	}
 	else
-	    AH->pgport = NULL;
+		AH->pgport = NULL;
 
 	sprintf(tmp_string, "dbname=%s ", AH->dbname);
 	strcat(connect_string, tmp_string);
@@ -342,16 +349,16 @@ PGconn* ConnectDatabase(Archive *AHX,
 	/* check to see that the backend connection was successfully made */
 	if (PQstatus(AH->connection) == CONNECTION_BAD)
 		die_horribly(AH, "Connection to database '%s' failed.\n%s\n",
-						AH->dbname, PQerrorMessage(AH->connection));
+					 AH->dbname, PQerrorMessage(AH->connection));
 
 	/* check for version mismatch */
 	_check_database_version(AH, ignoreVersion);
 
 	/*
-     * AH->currUser = PQuser(AH->connection);
-	 *	
-	 * Removed because it prevented an initial \connect
-	 * when dumping to SQL in pg_dump.
+	 * AH->currUser = PQuser(AH->connection);
+	 *
+	 * Removed because it prevented an initial \connect when dumping to SQL
+	 * in pg_dump.
 	 */
 
 	return AH->connection;
@@ -359,26 +366,28 @@ PGconn* ConnectDatabase(Archive *AHX,
 
 /* Public interface */
 /* Convenience function to send a query. Monitors result to handle COPY statements */
-int ExecuteSqlCommand(ArchiveHandle* AH, PQExpBuffer qry, char *desc)
+int
+ExecuteSqlCommand(ArchiveHandle *AH, PQExpBuffer qry, char *desc)
 {
 	return _executeSqlCommand(AH, AH->connection, qry, desc);
 }
 
-/* 
+/*
  * Handle command execution. This is used to execute a command on more than one connection,
  * but the 'pgCopyIn' setting assumes the COPY commands are ONLY executed on the primary
  * setting...an error will be raised otherwise.
  */
-static int _executeSqlCommand(ArchiveHandle* AH, PGconn *conn, PQExpBuffer qry, char *desc)
+static int
+_executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc)
 {
-	PGresult		*res;
+	PGresult   *res;
 
 	/* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */
 	res = PQexec(conn, qry->data);
 	if (!res)
 		die_horribly(AH, "%s: %s. No result from backend.\n", progname, desc);
 
-    if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK)
+	if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
 		if (PQresultStatus(res) == PGRES_COPY_IN)
 		{
@@ -387,9 +396,9 @@ static int _executeSqlCommand(ArchiveHandle* AH, PGconn *conn, PQExpBuffer qry,
 
 			AH->pgCopyIn = 1;
 		}
-		else 
+		else
 			die_horribly(AH, "%s: %s. Code = %d. Explanation from backend: '%s'.\n",
-						progname, desc, PQresultStatus(res), PQerrorMessage(AH->connection));
+						 progname, desc, PQresultStatus(res), PQerrorMessage(AH->connection));
 	}
 
 	PQclear(res);
@@ -398,42 +407,52 @@ static int _executeSqlCommand(ArchiveHandle* AH, PGconn *conn, PQExpBuffer qry,
 }
 
 /* Convenience function to send one or more queries. Monitors result to handle COPY statements */
-int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
+int
+ExecuteSqlCommandBuf(ArchiveHandle *AH, void *qryv, int bufLen)
 {
-	int				loc;
-	int				pos = 0;
-	int				sPos = 0;
-	char			*qry = (char*)qryv;
-	int				isEnd = 0;
-	char			*eos = qry + bufLen;
+	int			loc;
+	int			pos = 0;
+	int			sPos = 0;
+	char	   *qry = (char *) qryv;
+	int			isEnd = 0;
+	char	   *eos = qry + bufLen;
 
-	/* fprintf(stderr, "\n\n*****\n Buffer:\n\n%s\n*******************\n\n", qry); */
+	/*
+	 * fprintf(stderr, "\n\n*****\n
+	 * Buffer:\n\n%s\n*******************\n\n", qry);
+	 */
 
 	/* If we're in COPY IN mode, then just break it into lines and send... */
-	if (AH->pgCopyIn) {
-		for(;;) {
+	if (AH->pgCopyIn)
+	{
+		for (;;)
+		{
 
 			/* Find a lf */
 			loc = strcspn(&qry[pos], "\n") + pos;
 			pos = 0;
 
 			/* If no match, then wait */
-			if (loc >= (eos - qry)) /* None found */
+			if (loc >= (eos - qry))		/* None found */
 			{
 				appendBinaryPQExpBuffer(AH->pgCopyBuf, qry, (eos - qry));
 				break;
 			};
 
-		    /* fprintf(stderr, "Found cr at %d, prev char was %c, next was %c\n", loc, qry[loc-1], qry[loc+1]); */
-	
+			/*
+			 * fprintf(stderr, "Found cr at %d, prev char was %c, next was
+			 * %c\n", loc, qry[loc-1], qry[loc+1]);
+			 */
+
 			/* Count the number of preceding slashes */
 			sPos = loc;
-			while (sPos > 0 && qry[sPos-1] == '\\')
+			while (sPos > 0 && qry[sPos - 1] == '\\')
 				sPos--;
 
 			sPos = loc - sPos;
 
-			/* If an odd number of preceding slashes, then \n was escaped 
+			/*
+			 * If an odd number of preceding slashes, then \n was escaped
 			 * so set the next search pos, and restart (if any left).
 			 */
 			if ((sPos & 1) == 1)
@@ -451,19 +470,26 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
 				/* We got a good cr */
 				qry[loc] = '\0';
 				appendPQExpBuffer(AH->pgCopyBuf, "%s\n", qry);
-				qry += loc + 1; 
+				qry += loc + 1;
 				isEnd = (strcmp(AH->pgCopyBuf->data, "\\.\n") == 0);
 
-				/* fprintf(stderr, "Sending '%s' via COPY (at end = %d)\n\n", AH->pgCopyBuf->data, isEnd); */ 
-				
+				/*
+				 * fprintf(stderr, "Sending '%s' via COPY (at end =
+				 * %d)\n\n", AH->pgCopyBuf->data, isEnd);
+				 */
+
 				if (PQputline(AH->connection, AH->pgCopyBuf->data) != 0)
 					die_horribly(AH, "%s: error returned by PQputline\n", progname);
 
 				resetPQExpBuffer(AH->pgCopyBuf);
 
-				/* fprintf(stderr, "Buffer is '%s'\n", AH->pgCopyBuf->data); */
+				/*
+				 * fprintf(stderr, "Buffer is '%s'\n",
+				 * AH->pgCopyBuf->data);
+				 */
 
-				if(isEnd) {
+				if (isEnd)
+				{
 					if (PQendcopy(AH->connection) != 0)
 						die_horribly(AH, "%s: error returned by PQendcopy\n", progname);
 
@@ -481,58 +507,60 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
 	}
 
 	/* We may have finished Copy In, and have a non-empty buffer */
-	if (!AH->pgCopyIn) {
+	if (!AH->pgCopyIn)
+	{
 
-		/* 
-		 * The following is a mini state machine to assess then of of an SQL statement.
-		 * It really only needs to parse good SQL, or at least that's the theory...
-		 * End-of-statement is assumed to be an unquoted, un commented semi-colon.
+		/*
+		 * The following is a mini state machine to assess then of of an
+		 * SQL statement. It really only needs to parse good SQL, or at
+		 * least that's the theory... End-of-statement is assumed to be an
+		 * unquoted, un commented semi-colon.
 		 */
 
-		/* fprintf(stderr, "Buffer at start is: '%s'\n\n", AH->sqlBuf->data); */
+		/*
+		 * fprintf(stderr, "Buffer at start is: '%s'\n\n",
+		 * AH->sqlBuf->data);
+		 */
 
-		for(pos=0; pos < (eos - qry); pos++)
+		for (pos = 0; pos < (eos - qry); pos++)
 		{
 			appendPQExpBufferChar(AH->sqlBuf, qry[pos]);
 			/* fprintf(stderr, " %c",qry[pos]); */
 
-			switch (AH->sqlparse.state) {
+			switch (AH->sqlparse.state)
+			{
 
-				case SQL_SCAN: /* Default state == 0, set in _allocAH */
+				case SQL_SCAN:	/* Default state == 0, set in _allocAH */
 
 					if (qry[pos] == ';' && AH->sqlparse.braceDepth == 0)
 					{
 						/* Send It & reset the buffer */
-						/* fprintf(stderr, "    sending: '%s'\n\n", AH->sqlBuf->data); */
+
+						/*
+						 * fprintf(stderr, "    sending: '%s'\n\n",
+						 * AH->sqlBuf->data);
+						 */
 						ExecuteSqlCommand(AH, AH->sqlBuf, "Could not execute query");
 						resetPQExpBuffer(AH->sqlBuf);
 						AH->sqlparse.lastChar = '\0';
-					} 
-					else 
+					}
+					else
 					{
 						if (qry[pos] == '"' || qry[pos] == '\'')
-						{	
+						{
 							/* fprintf(stderr,"[startquote]\n"); */
 							AH->sqlparse.state = SQL_IN_QUOTE;
 							AH->sqlparse.quoteChar = qry[pos];
 							AH->sqlparse.backSlash = 0;
-						} 
+						}
 						else if (qry[pos] == '-' && AH->sqlparse.lastChar == '-')
-						{
 							AH->sqlparse.state = SQL_IN_SQL_COMMENT;
-						} 
 						else if (qry[pos] == '*' && AH->sqlparse.lastChar == '/')
-						{
 							AH->sqlparse.state = SQL_IN_EXT_COMMENT;
-						} 
-						else if ( qry[pos] == '(' )
-						{
+						else if (qry[pos] == '(')
 							AH->sqlparse.braceDepth++;
-						}
 						else if (qry[pos] == ')')
-						{
 							AH->sqlparse.braceDepth--;
-						}
 
 						AH->sqlparse.lastChar = qry[pos];
 					}
@@ -557,8 +585,8 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
 					{
 						/* fprintf(stderr,"[endquote]\n"); */
 						AH->sqlparse.state = SQL_SCAN;
-					} 
-					else 
+					}
+					else
 					{
 
 						if (qry[pos] == '\\')
@@ -567,9 +595,9 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
 								AH->sqlparse.backSlash = !AH->sqlparse.backSlash;
 							else
 								AH->sqlparse.backSlash = 1;
-							} else {
-								AH->sqlparse.backSlash = 0;
 						}
+						else
+							AH->sqlparse.backSlash = 0;
 					}
 					break;
 
@@ -583,33 +611,37 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
 	return 1;
 }
 
-void FixupBlobRefs(ArchiveHandle *AH, char *tablename)
+void
+FixupBlobRefs(ArchiveHandle *AH, char *tablename)
 {
-	PQExpBuffer		tblQry = createPQExpBuffer();
-	PGresult		*res, *uRes;
-	int				i, n;
-	char			*attr;
+	PQExpBuffer tblQry = createPQExpBuffer();
+	PGresult   *res,
+			   *uRes;
+	int			i,
+				n;
+	char	   *attr;
 
 	if (strcmp(tablename, BLOB_XREF_TABLE) == 0)
 		return;
 
 	appendPQExpBuffer(tblQry, "SELECT a.attname FROM pg_class c, pg_attribute a, pg_type t "
-								" WHERE a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid "
-								" AND t.typname = 'oid' AND c.relname = '%s';", tablename);
+	 " WHERE a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid "
+			  " AND t.typname = 'oid' AND c.relname = '%s';", tablename);
 
 	res = PQexec(AH->blobConnection, tblQry->data);
 	if (!res)
 		die_horribly(AH, "%s: could not find OID attrs of %s. Explanation from backend '%s'\n",
-						progname, tablename, PQerrorMessage(AH->connection));
+					 progname, tablename, PQerrorMessage(AH->connection));
 
-	if ((n = PQntuples(res)) == 0) {
+	if ((n = PQntuples(res)) == 0)
+	{
 		/* We're done */
 		ahlog(AH, 1, "No OID attributes in table %s\n", tablename);
 		PQclear(res);
 		return;
 	}
 
-	for (i = 0 ; i < n ; i++)
+	for (i = 0; i < n; i++)
 	{
 		attr = PQgetvalue(res, i, 0);
 
@@ -618,28 +650,28 @@ void FixupBlobRefs(ArchiveHandle *AH, char *tablename)
 		resetPQExpBuffer(tblQry);
 
 		/*
-		 * We should use coalesce here (rather than 'exists'), but it seems to 
-		 * be broken in 7.0.2 (weird optimizer strategy)
+		 * We should use coalesce here (rather than 'exists'), but it
+		 * seems to be broken in 7.0.2 (weird optimizer strategy)
 		 */
-		appendPQExpBuffer(tblQry, "UPDATE \"%s\" SET \"%s\" = ",tablename, attr);
+		appendPQExpBuffer(tblQry, "UPDATE \"%s\" SET \"%s\" = ", tablename, attr);
 		appendPQExpBuffer(tblQry, " (SELECT x.newOid FROM \"%s\" x WHERE x.oldOid = \"%s\".\"%s\")",
-									BLOB_XREF_TABLE, tablename, attr);
+						  BLOB_XREF_TABLE, tablename, attr);
 		appendPQExpBuffer(tblQry, " where exists"
-									"(select * from %s x where x.oldOid = \"%s\".\"%s\");",
-									BLOB_XREF_TABLE, tablename, attr);
+				  "(select * from %s x where x.oldOid = \"%s\".\"%s\");",
+						  BLOB_XREF_TABLE, tablename, attr);
 
 		ahlog(AH, 10, " - sql:\n%s\n", tblQry->data);
 
 		uRes = PQexec(AH->blobConnection, tblQry->data);
 		if (!uRes)
 			die_horribly(AH, "%s: could not update attr %s of table %s. Explanation from backend '%s'\n",
-								progname, attr, tablename, PQerrorMessage(AH->blobConnection));
+						 progname, attr, tablename, PQerrorMessage(AH->blobConnection));
 
-		if ( PQresultStatus(uRes) != PGRES_COMMAND_OK )
+		if (PQresultStatus(uRes) != PGRES_COMMAND_OK)
 			die_horribly(AH, "%s: error while updating attr %s of table %s (result = %d)."
-								" Explanation from backend '%s'\n",
-								progname, attr, tablename, PQresultStatus(uRes), 
-								PQerrorMessage(AH->blobConnection));
+						 " Explanation from backend '%s'\n",
+						 progname, attr, tablename, PQresultStatus(uRes),
+						 PQerrorMessage(AH->blobConnection));
 
 		PQclear(uRes);
 	}
@@ -651,15 +683,14 @@ void FixupBlobRefs(ArchiveHandle *AH, char *tablename)
 /**********
  *	Convenient SQL calls
  **********/
-void CreateBlobXrefTable(ArchiveHandle* AH)
+void
+CreateBlobXrefTable(ArchiveHandle *AH)
 {
-	PQExpBuffer		qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
 	/* IF we don't have a BLOB connection, then create one */
 	if (!AH->blobConnection)
-	{
 		AH->blobConnection = _connectDB(AH, NULL, NULL);
-	}
 
 	ahlog(AH, 1, "Creating table for BLOBS xrefs\n");
 
@@ -673,18 +704,20 @@ void CreateBlobXrefTable(ArchiveHandle* AH)
 	_executeSqlCommand(AH, AH->blobConnection, qry, "can not create index on BLOB xref table '" BLOB_XREF_TABLE "'");
 }
 
-void InsertBlobXref(ArchiveHandle* AH, int old, int new)
+void
+InsertBlobXref(ArchiveHandle *AH, int old, int new)
 {
-	PQExpBuffer 	qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
 	appendPQExpBuffer(qry, "Insert Into %s(oldOid, newOid) Values (%d, %d);", BLOB_XREF_TABLE, old, new);
 
 	_executeSqlCommand(AH, AH->blobConnection, qry, "can not create BLOB xref entry");
 }
 
-void StartTransaction(ArchiveHandle* AH)
+void
+StartTransaction(ArchiveHandle *AH)
 {
-	PQExpBuffer		qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
 	appendPQExpBuffer(qry, "Begin;");
 
@@ -692,9 +725,10 @@ void StartTransaction(ArchiveHandle* AH)
 	AH->txActive = true;
 }
 
-void StartTransactionXref(ArchiveHandle* AH)
+void
+StartTransactionXref(ArchiveHandle *AH)
 {
-	PQExpBuffer		qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
 	appendPQExpBuffer(qry, "Begin;");
 
@@ -702,19 +736,21 @@ void StartTransactionXref(ArchiveHandle* AH)
 	AH->blobTxActive = true;
 }
 
-void CommitTransaction(ArchiveHandle* AH)
+void
+CommitTransaction(ArchiveHandle *AH)
 {
-    PQExpBuffer     qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
-    appendPQExpBuffer(qry, "Commit;");
+	appendPQExpBuffer(qry, "Commit;");
 
-    ExecuteSqlCommand(AH, qry, "can not commit database transaction");
+	ExecuteSqlCommand(AH, qry, "can not commit database transaction");
 	AH->txActive = false;
 }
 
-void CommitTransactionXref(ArchiveHandle* AH)
+void
+CommitTransactionXref(ArchiveHandle *AH)
 {
-	PQExpBuffer		qry = createPQExpBuffer();
+	PQExpBuffer qry = createPQExpBuffer();
 
 	appendPQExpBuffer(qry, "Commit;");
 
diff --git a/src/bin/pg_dump/pg_backup_db.h b/src/bin/pg_dump/pg_backup_db.h
index d7903d2bcd05f2e19590f1cdd5853eefe4d48183..44500e72c12dba1f006d9af2fbefed19fe869302 100644
--- a/src/bin/pg_dump/pg_backup_db.h
+++ b/src/bin/pg_dump/pg_backup_db.h
@@ -2,19 +2,18 @@
  *	Definitions for pg_backup_db.c
  *
  *	IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.h,v 1.3 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.h,v 1.4 2001/03/22 04:00:13 momjian Exp $
  */
 
-#define BLOB_XREF_TABLE "dump_blob_xref" /* MUST be lower case */
+#define BLOB_XREF_TABLE "dump_blob_xref"		/* MUST be lower case */
 
 extern void FixupBlobRefs(ArchiveHandle *AH, char *tablename);
-extern int ExecuteSqlCommand(ArchiveHandle* AH, PQExpBuffer qry, char *desc);
-extern int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qry, int bufLen);
-
-extern void CreateBlobXrefTable(ArchiveHandle* AH);
-extern void InsertBlobXref(ArchiveHandle* AH, int old, int new);
-extern void StartTransaction(ArchiveHandle* AH);
-extern void StartTransactionXref(ArchiveHandle* AH);
-extern void CommitTransaction(ArchiveHandle* AH);
-extern void CommitTransactionXref(ArchiveHandle* AH);
+extern int	ExecuteSqlCommand(ArchiveHandle *AH, PQExpBuffer qry, char *desc);
+extern int	ExecuteSqlCommandBuf(ArchiveHandle *AH, void *qry, int bufLen);
 
+extern void CreateBlobXrefTable(ArchiveHandle *AH);
+extern void InsertBlobXref(ArchiveHandle *AH, int old, int new);
+extern void StartTransaction(ArchiveHandle *AH);
+extern void StartTransactionXref(ArchiveHandle *AH);
+extern void CommitTransaction(ArchiveHandle *AH);
+extern void CommitTransactionXref(ArchiveHandle *AH);
diff --git a/src/bin/pg_dump/pg_backup_files.c b/src/bin/pg_dump/pg_backup_files.c
index d4746a966a1dfb539b562fc130a093cc67e3b4e1..9a5a7797a17faa6092f808d0b6e3ab54bf2cd128 100644
--- a/src/bin/pg_dump/pg_backup_files.c
+++ b/src/bin/pg_dump/pg_backup_files.c
@@ -12,23 +12,23 @@
  *	See the headers to pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.7 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.8 2001/03/22 04:00:13 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *	Initial version. 
+ *	Initial version.
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
  *
- *    - Check results of IO routines more carefully.
+ *	  - Check results of IO routines more carefully.
  *
  *-------------------------------------------------------------------------
  */
@@ -39,114 +39,117 @@
 #include <stdlib.h>
 #include <string.h>
 
-static void     _ArchiveEntry(ArchiveHandle* AH, TocEntry* te);
-static void	_StartData(ArchiveHandle* AH, TocEntry* te);
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen);
-static void     _EndData(ArchiveHandle* AH, TocEntry* te);
-static int      _WriteByte(ArchiveHandle* AH, const int i);
-static int      _ReadByte(ArchiveHandle* );
-static int      _WriteBuf(ArchiveHandle* AH, const void* buf, int len);
-static int    	_ReadBuf(ArchiveHandle* AH, void* buf, int len);
-static void     _CloseArchive(ArchiveHandle* AH);
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt);
-static void	_WriteExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void	_ReadExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void	_PrintExtraToc(ArchiveHandle* AH, TocEntry* te);
-
-static void 	_StartBlobs(ArchiveHandle* AH, TocEntry* te);
-static void		_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlobs(ArchiveHandle* AH, TocEntry* te);
+static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
+static void _StartData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteData(ArchiveHandle *AH, const void *data, int dLen);
+static void _EndData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteByte(ArchiveHandle *AH, const int i);
+static int	_ReadByte(ArchiveHandle *);
+static int	_WriteBuf(ArchiveHandle *AH, const void *buf, int len);
+static int	_ReadBuf(ArchiveHandle *AH, void *buf, int len);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
+
+static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
+static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
 
 #define K_STD_BUF_SIZE 1024
 
-typedef struct {
-    int		hasSeek;
-    int		filePos;
-	FILE	*blobToc;
+typedef struct
+{
+	int			hasSeek;
+	int			filePos;
+	FILE	   *blobToc;
 } lclContext;
 
-typedef struct {
+typedef struct
+{
 #ifdef HAVE_LIBZ
-    gzFile	*FH;
+	gzFile	   *FH;
 #else
-    FILE	*FH;
+	FILE	   *FH;
 #endif
-    char	*filename;
+	char	   *filename;
 } lclTocEntry;
 
-static char* progname = "Archiver(files)";
-static void _LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt);
-static void _getBlobTocEntry(ArchiveHandle* AH, int *oid, char *fname);
+static char *progname = "Archiver(files)";
+static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
+static void _getBlobTocEntry(ArchiveHandle *AH, int *oid, char *fname);
 
 /*
- *  Initializer
+ *	Initializer
  */
-void InitArchiveFmt_Files(ArchiveHandle* AH) 
+void
+InitArchiveFmt_Files(ArchiveHandle *AH)
 {
-    lclContext*		ctx;
-
-    /* Assuming static functions, this can be copied for each format. */
-    AH->ArchiveEntryPtr = _ArchiveEntry;
-    AH->StartDataPtr = _StartData;
-    AH->WriteDataPtr = _WriteData;
-    AH->EndDataPtr = _EndData;
-    AH->WriteBytePtr = _WriteByte;
-    AH->ReadBytePtr = _ReadByte;
-    AH->WriteBufPtr = _WriteBuf;
-    AH->ReadBufPtr = _ReadBuf;
-    AH->ClosePtr = _CloseArchive;
-    AH->PrintTocDataPtr = _PrintTocData;
-    AH->ReadExtraTocPtr = _ReadExtraToc;
-    AH->WriteExtraTocPtr = _WriteExtraToc;
-    AH->PrintExtraTocPtr = _PrintExtraToc;
-
-    AH->StartBlobsPtr = _StartBlobs;
-    AH->StartBlobPtr = _StartBlob;
-    AH->EndBlobPtr = _EndBlob;
-    AH->EndBlobsPtr = _EndBlobs;
-
-    /*
-     *	Set up some special context used in compressing data.
-    */
-    ctx = (lclContext*)malloc(sizeof(lclContext));
-    AH->formatData = (void*)ctx;
-    ctx->filePos = 0;
-
-    /*
-     * Now open the TOC file
-     */
-    if (AH->mode == archModeWrite) {
+	lclContext *ctx;
+
+	/* Assuming static functions, this can be copied for each format. */
+	AH->ArchiveEntryPtr = _ArchiveEntry;
+	AH->StartDataPtr = _StartData;
+	AH->WriteDataPtr = _WriteData;
+	AH->EndDataPtr = _EndData;
+	AH->WriteBytePtr = _WriteByte;
+	AH->ReadBytePtr = _ReadByte;
+	AH->WriteBufPtr = _WriteBuf;
+	AH->ReadBufPtr = _ReadBuf;
+	AH->ClosePtr = _CloseArchive;
+	AH->PrintTocDataPtr = _PrintTocData;
+	AH->ReadExtraTocPtr = _ReadExtraToc;
+	AH->WriteExtraTocPtr = _WriteExtraToc;
+	AH->PrintExtraTocPtr = _PrintExtraToc;
+
+	AH->StartBlobsPtr = _StartBlobs;
+	AH->StartBlobPtr = _StartBlob;
+	AH->EndBlobPtr = _EndBlob;
+	AH->EndBlobsPtr = _EndBlobs;
+
+	/*
+	 * Set up some special context used in compressing data.
+	 */
+	ctx = (lclContext *) malloc(sizeof(lclContext));
+	AH->formatData = (void *) ctx;
+	ctx->filePos = 0;
+
+	/*
+	 * Now open the TOC file
+	 */
+	if (AH->mode == archModeWrite)
+	{
 
 		fprintf(stderr, "\n*************************************************************\n"
-						"* WARNING: This format is for demonstration purposes. It is   *\n"
-						"*          not intended for general use. Files will be dumped *\n"
-						"*          into the current working directory.                *\n"
-						"***************************************************************\n\n");
+				"* WARNING: This format is for demonstration purposes. It is   *\n"
+				"*          not intended for general use. Files will be dumped *\n"
+				"*          into the current working directory.                *\n"
+				"***************************************************************\n\n");
 
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_W);
-		} else {
+		else
 			AH->FH = stdout;
-		}
 
 		if (AH->FH == NULL)
 			die_horribly(NULL, "%s: Could not open output file\n", progname);
 
 		ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0);
 
-		if (AH->compression < 0 || AH->compression > 9) {
+		if (AH->compression < 0 || AH->compression > 9)
 			AH->compression = Z_DEFAULT_COMPRESSION;
-		}
 
 
-    } else { /* Read Mode */
+	}
+	else
+	{							/* Read Mode */
 
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_R);
-		} else {
+		else
 			AH->FH = stdin;
-		}
 
 		if (AH->FH == NULL)
 			die_horribly(NULL, "%s: Could not open input file\n", progname);
@@ -155,85 +158,93 @@ void InitArchiveFmt_Files(ArchiveHandle* AH)
 
 		ReadHead(AH);
 		ReadToc(AH);
-		fclose(AH->FH); /* Nothing else in the file... */
-    }
+		fclose(AH->FH);			/* Nothing else in the file... */
+	}
 
 }
 
 /*
  * - Start a new TOC entry
- *   Setup the output file name.
+ *	 Setup the output file name.
  */
-static void	_ArchiveEntry(ArchiveHandle* AH, TocEntry* te) 
+static void
+_ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx;
-    char			fn[K_STD_BUF_SIZE];
+	lclTocEntry *ctx;
+	char		fn[K_STD_BUF_SIZE];
 
-    ctx = (lclTocEntry*)malloc(sizeof(lclTocEntry));
-    if (te->dataDumper) {
+	ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry));
+	if (te->dataDumper)
+	{
 #ifdef HAVE_LIBZ
-		if (AH->compression == 0) {
+		if (AH->compression == 0)
 			sprintf(fn, "%d.dat", te->id);
-		} else {
+		else
 			sprintf(fn, "%d.dat.gz", te->id);
-		}
 #else
 		sprintf(fn, "%d.dat", te->id);
 #endif
 		ctx->filename = strdup(fn);
-    } else {
+	}
+	else
+	{
 		ctx->filename = NULL;
 		ctx->FH = NULL;
-    }
-    te->formatData = (void*)ctx;
+	}
+	te->formatData = (void *) ctx;
 }
 
-static void	_WriteExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    if (ctx->filename) {
+	if (ctx->filename)
 		WriteStr(AH, ctx->filename);
-    } else {
+	else
 		WriteStr(AH, "");
-    }
 }
 
-static void	_ReadExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    if (ctx == NULL) {
-		ctx = (lclTocEntry*)malloc(sizeof(lclTocEntry));
-		te->formatData = (void*)ctx;
-    }
+	if (ctx == NULL)
+	{
+		ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry));
+		te->formatData = (void *) ctx;
+	}
 
-    ctx->filename = ReadStr(AH);
-    if (strlen(ctx->filename) == 0) {
+	ctx->filename = ReadStr(AH);
+	if (strlen(ctx->filename) == 0)
+	{
 		free(ctx->filename);
 		ctx->filename = NULL;
-    }
-    ctx->FH = NULL;
+	}
+	ctx->FH = NULL;
 }
 
-static void	_PrintExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    ahprintf(AH, "-- File: %s\n", ctx->filename);
+	ahprintf(AH, "-- File: %s\n", ctx->filename);
 }
 
-static void	_StartData(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
-    char		fmode[10];
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+	char		fmode[10];
 
-    sprintf(fmode, "wb%d", AH->compression);
+	sprintf(fmode, "wb%d", AH->compression);
 
 #ifdef HAVE_LIBZ
-    tctx->FH = gzopen(tctx->filename, fmode);
+	tctx->FH = gzopen(tctx->filename, fmode);
 #else
-    tctx->FH = fopen(tctx->filename, PG_BINARY_W);
+	tctx->FH = fopen(tctx->filename, PG_BINARY_W);
 #endif
 
 	if (tctx->FH == NULL)
@@ -241,77 +252,81 @@ static void	_StartData(ArchiveHandle* AH, TocEntry* te)
 
 }
 
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen)
+static int
+_WriteData(ArchiveHandle *AH, const void *data, int dLen)
 {
-    lclTocEntry*	tctx = (lclTocEntry*)AH->currToc->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) AH->currToc->formatData;
 
-    GZWRITE((void*)data, 1, dLen, tctx->FH);
+	GZWRITE((void *) data, 1, dLen, tctx->FH);
 
-    return dLen;
+	return dLen;
 }
 
-static void	_EndData(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    /* Close the file */
-    GZCLOSE(tctx->FH);
-    tctx->FH = NULL;
+	/* Close the file */
+	GZCLOSE(tctx->FH);
+	tctx->FH = NULL;
 }
 
-/* 
- * Print data for a given file 
+/*
+ * Print data for a given file
  */
-static void	_PrintFileData(ArchiveHandle* AH, char *filename, RestoreOptions *ropt)
+static void
+_PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
 {
-    char		buf[4096];
-    int			cnt;
+	char		buf[4096];
+	int			cnt;
 
-    if (!filename) 
+	if (!filename)
 		return;
 
 #ifdef HAVE_LIBZ
-    AH->FH = gzopen(filename,"rb");
+	AH->FH = gzopen(filename, "rb");
 #else
-    AH->FH = fopen(filename,PG_BINARY_R);
+	AH->FH = fopen(filename, PG_BINARY_R);
 #endif
 
 	if (AH->FH == NULL)
 		die_horribly(AH, "%s: Could not open data file for input\n", progname);
 
-    while ( (cnt = GZREAD(buf, 1, 4095, AH->FH)) > 0) {
+	while ((cnt = GZREAD(buf, 1, 4095, AH->FH)) > 0)
+	{
 		buf[cnt] = '\0';
 		ahwrite(buf, 1, cnt, AH);
-    }
+	}
 
-    GZCLOSE(AH->FH);
+	GZCLOSE(AH->FH);
 }
 
 
 /*
  * Print data for a given TOC entry
 */
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
+static void
+_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    if (!tctx->filename) 
+	if (!tctx->filename)
 		return;
 
 	if (strcmp(te->desc, "BLOBS") == 0)
 		_LoadBlobs(AH, ropt);
 	else
-	{
 		_PrintFileData(AH, tctx->filename, ropt);
-	}
 }
 
-static void _getBlobTocEntry(ArchiveHandle* AH, int *oid, char fname[K_STD_BUF_SIZE])
+static void
+_getBlobTocEntry(ArchiveHandle *AH, int *oid, char fname[K_STD_BUF_SIZE])
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	char			blobTe[K_STD_BUF_SIZE];
-	int				fpos;
-	int				eos;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		blobTe[K_STD_BUF_SIZE];
+	int			fpos;
+	int			eos;
 
 	if (fgets(&blobTe[0], K_STD_BUF_SIZE - 1, ctx->blobToc) != NULL)
 	{
@@ -319,42 +334,45 @@ static void _getBlobTocEntry(ArchiveHandle* AH, int *oid, char fname[K_STD_BUF_S
 
 		fpos = strcspn(blobTe, " ");
 
-		strncpy(fname, &blobTe[fpos+1], K_STD_BUF_SIZE - 1);
+		strncpy(fname, &blobTe[fpos + 1], K_STD_BUF_SIZE - 1);
 
-		eos = strlen(fname)-1;
+		eos = strlen(fname) - 1;
 
 		if (fname[eos] == '\n')
 			fname[eos] = '\0';
 
-	} else {
+	}
+	else
+	{
 
 		*oid = 0;
 		fname[0] = '\0';
 	}
 }
 
-static void	_LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt)
+static void
+_LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
 {
-    int				oid;
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	char			fname[K_STD_BUF_SIZE];
+	int			oid;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		fname[K_STD_BUF_SIZE];
 
 	StartRestoreBlobs(AH);
 
 	ctx->blobToc = fopen("blobs.toc", PG_BINARY_R);
 
-	if (ctx->blobToc == NULL) 
+	if (ctx->blobToc == NULL)
 		die_horribly(AH, "%s: Could not open BLOB TOC for input\n", progname);
 
 	_getBlobTocEntry(AH, &oid, fname);
 
-    while(oid != 0)
-    {
+	while (oid != 0)
+	{
 		StartRestoreBlob(AH, oid);
 		_PrintFileData(AH, fname, ropt);
 		EndRestoreBlob(AH, oid);
 		_getBlobTocEntry(AH, &oid, fname);
-    }
+	}
 
 	fclose(ctx->blobToc);
 
@@ -362,62 +380,68 @@ static void	_LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt)
 }
 
 
-static int	_WriteByte(ArchiveHandle* AH, const int i)
+static int
+_WriteByte(ArchiveHandle *AH, const int i)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
 
-    if (fputc(i, AH->FH) == EOF)
+	if (fputc(i, AH->FH) == EOF)
 		die_horribly(AH, "%s: could not write byte\n", progname);
 
 	ctx->filePos += 1;
 
-    return 1;
+	return 1;
 }
 
-static int    	_ReadByte(ArchiveHandle* AH)
+static int
+_ReadByte(ArchiveHandle *AH)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = fgetc(AH->FH);
-    if (res != EOF) {
+	res = fgetc(AH->FH);
+	if (res != EOF)
 		ctx->filePos += 1;
-    }
-    return res;
+	return res;
 }
 
-static int	_WriteBuf(ArchiveHandle* AH, const void* buf, int len)
+static int
+_WriteBuf(ArchiveHandle *AH, const void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
-    res = fwrite(buf, 1, len, AH->FH);
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
+
+	res = fwrite(buf, 1, len, AH->FH);
 	if (res != len)
 		die_horribly(AH, "%s: write error in _WriteBuf (%d != %d)\n", progname, res, len);
 
-    ctx->filePos += res;
-    return res;
+	ctx->filePos += res;
+	return res;
 }
 
-static int	_ReadBuf(ArchiveHandle* AH, void* buf, int len)
+static int
+_ReadBuf(ArchiveHandle *AH, void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = fread(buf, 1, len, AH->FH);
-    ctx->filePos += res;
-    return res;
+	res = fread(buf, 1, len, AH->FH);
+	ctx->filePos += res;
+	return res;
 }
 
-static void	_CloseArchive(ArchiveHandle* AH)
+static void
+_CloseArchive(ArchiveHandle *AH)
 {
-    if (AH->mode == archModeWrite) {
+	if (AH->mode == archModeWrite)
+	{
 		WriteHead(AH);
 		WriteToc(AH);
 		fclose(AH->FH);
 		WriteDataChunks(AH);
-    }
+	}
 
-    AH->FH = NULL; 
+	AH->FH = NULL;
 }
 
 
@@ -427,19 +451,20 @@ static void	_CloseArchive(ArchiveHandle* AH)
  */
 
 /*
- * Called by the archiver when starting to save all BLOB DATA (not schema). 
+ * Called by the archiver when starting to save all BLOB DATA (not schema).
  * This routine should save whatever format-specific information is needed
- * to read the BLOBs back into memory. 
+ * to read the BLOBs back into memory.
  *
  * It is called just prior to the dumper's DataDumper routine.
  *
  * Optional, but strongly recommended.
  *
  */
-static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartBlobs(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-	char			fname[K_STD_BUF_SIZE];
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		fname[K_STD_BUF_SIZE];
 
 	sprintf(fname, "blobs.toc");
 	ctx->blobToc = fopen(fname, PG_BINARY_W);
@@ -456,15 +481,16 @@ static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
  *
  * Must save the passed OID for retrieval at restore-time.
  */
-static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
-	char			fmode[10];
-	char			fname[255];
-	char			*sfx;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+	char		fmode[10];
+	char		fname[255];
+	char	   *sfx;
 
-    if (oid == 0) 
+	if (oid == 0)
 		die_horribly(AH, "%s: illegal OID for BLOB (%d)\n", progname, oid);
 
 	if (AH->compression != 0)
@@ -472,15 +498,15 @@ static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
 	else
 		sfx = "";
 
-    sprintf(fmode, "wb%d", AH->compression);
+	sprintf(fmode, "wb%d", AH->compression);
 	sprintf(fname, "blob_%d.dat%s", oid, sfx);
 
 	fprintf(ctx->blobToc, "%d %s\n", oid, fname);
 
 #ifdef HAVE_LIBZ
-    tctx->FH = gzopen(fname, fmode);
+	tctx->FH = gzopen(fname, fmode);
 #else
-    tctx->FH = fopen(fname, PG_BINARY_W);
+	tctx->FH = fopen(fname, PG_BINARY_W);
 #endif
 
 	if (tctx->FH == NULL)
@@ -493,27 +519,28 @@ static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
  * Optional.
  *
  */
-static void	_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-	lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
 	GZCLOSE(tctx->FH);
 }
 
 /*
- * Called by the archiver when finishing saving all BLOB DATA. 
+ * Called by the archiver when finishing saving all BLOB DATA.
  *
  * Optional.
  *
  */
-static void	_EndBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndBlobs(ArchiveHandle *AH, TocEntry *te)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+
 	/* Write out a fake zero OID to mark end-of-blobs. */
-    /* WriteInt(AH, 0); */
+	/* WriteInt(AH, 0); */
 
 	fclose(ctx->blobToc);
 
 }
-
-
diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_null.c
index 96232f5734cb0db655283a1e7ceac097ec0a31fe..1c3a09784e45411e67ac1845df96478a88585fc2 100644
--- a/src/bin/pg_dump/pg_backup_null.c
+++ b/src/bin/pg_dump/pg_backup_null.c
@@ -2,30 +2,30 @@
  *
  * pg_backup_null.c
  *
- *	Implementation of an archive that is never saved; it is used by 
+ *	Implementation of an archive that is never saved; it is used by
  *	pg_dump to output output a plain text SQL script instead of save
  *	a real archive.
  *
  *	See the headers to pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.4 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.5 2001/03/22 04:00:13 momjian Exp $
  *
  * Modifications - 09-Jul-2000 - pjw@rhyme.com.au
  *
- *	Initial version. 
+ *	Initial version.
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
  *
- *    - Check results of IO routines more carefully.
+ *	  - Check results of IO routines more carefully.
  *
  *
  *-------------------------------------------------------------------------
@@ -36,33 +36,34 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h> /* for dup */
+#include <unistd.h>				/* for dup */
 
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen);
-static void     _EndData(ArchiveHandle* AH, TocEntry* te);
-static int      _WriteByte(ArchiveHandle* AH, const int i);
-static int      _WriteBuf(ArchiveHandle* AH, const void* buf, int len);
-static void     _CloseArchive(ArchiveHandle* AH);
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt);
+static int	_WriteData(ArchiveHandle *AH, const void *data, int dLen);
+static void _EndData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteByte(ArchiveHandle *AH, const int i);
+static int	_WriteBuf(ArchiveHandle *AH, const void *buf, int len);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 
 /*
- *  Initializer
+ *	Initializer
  */
-void InitArchiveFmt_Null(ArchiveHandle* AH) 
+void
+InitArchiveFmt_Null(ArchiveHandle *AH)
 {
-    /* Assuming static functions, this can be copied for each format. */
-    AH->WriteDataPtr = _WriteData;
-    AH->EndDataPtr = _EndData;
-    AH->WriteBytePtr = _WriteByte;
-    AH->WriteBufPtr = _WriteBuf;
-    AH->ClosePtr = _CloseArchive;
-    AH->PrintTocDataPtr = _PrintTocData;
+	/* Assuming static functions, this can be copied for each format. */
+	AH->WriteDataPtr = _WriteData;
+	AH->EndDataPtr = _EndData;
+	AH->WriteBytePtr = _WriteByte;
+	AH->WriteBufPtr = _WriteBuf;
+	AH->ClosePtr = _CloseArchive;
+	AH->PrintTocDataPtr = _PrintTocData;
 
-    /*
-     * Now prevent reading...
-     */
-    if (AH->mode == archModeRead)
-	die_horribly(AH, "%s: This format can not be read\n");
+	/*
+	 * Now prevent reading...
+	 */
+	if (AH->mode == archModeRead)
+		die_horribly(AH, "%s: This format can not be read\n");
 
 }
 
@@ -71,20 +72,22 @@ void InitArchiveFmt_Null(ArchiveHandle* AH)
  */
 
 /*------
- * Called by dumper via archiver from within a data dump routine 
+ * Called by dumper via archiver from within a data dump routine
  * As at V1.3, this is only called for COPY FROM dfata, and BLOB data
  *------
  */
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen)
+static int
+_WriteData(ArchiveHandle *AH, const void *data, int dLen)
 {
-    /* Just send it to output */
-    ahwrite(data, 1, dLen, AH);
-    return dLen;
+	/* Just send it to output */
+	ahwrite(data, 1, dLen, AH);
+	return dLen;
 }
 
-static void	_EndData(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndData(ArchiveHandle *AH, TocEntry *te)
 {
-    ahprintf(AH, "\n\n");
+	ahprintf(AH, "\n\n");
 }
 
 /*------
@@ -92,30 +95,33 @@ static void	_EndData(ArchiveHandle* AH, TocEntry* te)
  * just sends the data for a given TOC entry to the output.
  *------
  */
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
+static void
+_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-    if (*te->dataDumper)
+	if (*te->dataDumper)
 	{
 		AH->currToc = te;
-		(*te->dataDumper)((Archive*)AH, te->oid, te->dataDumperArg);
+		(*te->dataDumper) ((Archive *) AH, te->oid, te->dataDumperArg);
 		AH->currToc = NULL;
 	}
 }
 
-static int	_WriteByte(ArchiveHandle* AH, const int i)
+static int
+_WriteByte(ArchiveHandle *AH, const int i)
 {
-    /* Don't do anything */
-    return 0;
+	/* Don't do anything */
+	return 0;
 }
 
-static int	_WriteBuf(ArchiveHandle* AH, const void* buf, int len)
+static int
+_WriteBuf(ArchiveHandle *AH, const void *buf, int len)
 {
-    /* Don't do anything */
-    return len;
+	/* Don't do anything */
+	return len;
 }
 
-static void	_CloseArchive(ArchiveHandle* AH)
+static void
+_CloseArchive(ArchiveHandle *AH)
 {
-    /* Nothing to do */
+	/* Nothing to do */
 }
-
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 76d1e6c743d82cf4312993c64aed67224f03e221..9dbf862fc4b6a92d074c0b0f6e231f51f4dee640 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -8,23 +8,23 @@
  *	See the headers to pg_backup_files & pg_restore for more details.
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.11 2001/03/19 02:35:28 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.12 2001/03/22 04:00:13 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
- *	Initial version. 
+ *	Initial version.
  *
  * Modifications - 04-Jan-2001 - pjw@rhyme.com.au
  *
- *    - Check results of IO routines more carefully.
+ *	  - Check results of IO routines more carefully.
  *
  *-------------------------------------------------------------------------
  */
@@ -38,270 +38,302 @@
 #include <ctype.h>
 #include <unistd.h>
 
-static void     _ArchiveEntry(ArchiveHandle* AH, TocEntry* te);
-static void		_StartData(ArchiveHandle* AH, TocEntry* te);
-static int		_WriteData(ArchiveHandle* AH, const void* data, int dLen);
-static void     _EndData(ArchiveHandle* AH, TocEntry* te);
-static int      _WriteByte(ArchiveHandle* AH, const int i);
-static int      _ReadByte(ArchiveHandle* );
-static int      _WriteBuf(ArchiveHandle* AH, const void* buf, int len);
-static int    	_ReadBuf(ArchiveHandle* AH, void* buf, int len);
-static void     _CloseArchive(ArchiveHandle* AH);
-static void		_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt);
-static void		_WriteExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void		_ReadExtraToc(ArchiveHandle* AH, TocEntry* te);
-static void		_PrintExtraToc(ArchiveHandle* AH, TocEntry* te);
-
-static void 	_StartBlobs(ArchiveHandle* AH, TocEntry* te);
-static void		_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid);
-static void		_EndBlobs(ArchiveHandle* AH, TocEntry* te);
+static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
+static void _StartData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteData(ArchiveHandle *AH, const void *data, int dLen);
+static void _EndData(ArchiveHandle *AH, TocEntry *te);
+static int	_WriteByte(ArchiveHandle *AH, const int i);
+static int	_ReadByte(ArchiveHandle *);
+static int	_WriteBuf(ArchiveHandle *AH, const void *buf, int len);
+static int	_ReadBuf(ArchiveHandle *AH, void *buf, int len);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
+static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
+
+static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
+static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
+static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
 
 #define K_STD_BUF_SIZE 1024
 
 
 #ifdef HAVE_LIBZ
-	/* typedef gzFile	ThingFile; */
-	typedef FILE    ThingFile;
+ /* typedef gzFile	 ThingFile; */
+typedef FILE ThingFile;
+
 #else
-	typedef	FILE	ThingFile;
+typedef FILE ThingFile;
+
 #endif
 
-typedef struct {
-	ThingFile   	*zFH;
-	FILE			*nFH;
-	FILE    		*tarFH;
-	FILE			*tmpFH;
-	char			*targetFile;
-	char			mode;
-	int				pos;
-	int				fileLen;
-	ArchiveHandle	*AH;
+typedef struct
+{
+	ThingFile  *zFH;
+	FILE	   *nFH;
+	FILE	   *tarFH;
+	FILE	   *tmpFH;
+	char	   *targetFile;
+	char		mode;
+	int			pos;
+	int			fileLen;
+	ArchiveHandle *AH;
 } TAR_MEMBER;
 
-typedef struct {
+typedef struct
+{
 	int			hasSeek;
-    int			filePos;
-	TAR_MEMBER	*blobToc;
-	FILE		*tarFH;
+	int			filePos;
+	TAR_MEMBER *blobToc;
+	FILE	   *tarFH;
 	int			tarFHpos;
 	int			tarNextMember;
-	TAR_MEMBER	*FH;
+	TAR_MEMBER *FH;
 	int			isSpecialScript;
-	TAR_MEMBER	*scriptTH;
+	TAR_MEMBER *scriptTH;
 } lclContext;
 
-typedef struct {
-	TAR_MEMBER	*TH;
-    char		*filename;
+typedef struct
+{
+	TAR_MEMBER *TH;
+	char	   *filename;
 } lclTocEntry;
 
-static char* progname = "Archiver(tar)";
+static char *progname = "Archiver(tar)";
+
+static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
 
-static void 			_LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt);
+static TAR_MEMBER *tarOpen(ArchiveHandle *AH, const char *filename, char mode);
+static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
 
-static TAR_MEMBER*		tarOpen(ArchiveHandle *AH, const char *filename, char mode);
-static void 			tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
 #ifdef __NOT_USED__
-static char* 			tarGets(char *buf, int len, TAR_MEMBER* th);
+static char *tarGets(char *buf, int len, TAR_MEMBER *th);
+
 #endif
-static int 				tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt, ...);
+static int	tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt,...);
 
-static void 			_tarAddFile(ArchiveHandle *AH, TAR_MEMBER* th);
-static int 				_tarChecksum(char *th);
-static TAR_MEMBER*		_tarPositionTo(ArchiveHandle *AH, const char *filename);
-static int				tarRead(void *buf, int len, TAR_MEMBER *th);
-static int				tarWrite(const void *buf, int len, TAR_MEMBER *th);
-static void				_tarWriteHeader(TAR_MEMBER* th);
-static int				_tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th);
-static int				_tarReadRaw(ArchiveHandle *AH, void *buf, int len, TAR_MEMBER *th, FILE *fh);
+static void _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th);
+static int	_tarChecksum(char *th);
+static TAR_MEMBER *_tarPositionTo(ArchiveHandle *AH, const char *filename);
+static int	tarRead(void *buf, int len, TAR_MEMBER *th);
+static int	tarWrite(const void *buf, int len, TAR_MEMBER *th);
+static void _tarWriteHeader(TAR_MEMBER *th);
+static int	_tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th);
+static int	_tarReadRaw(ArchiveHandle *AH, void *buf, int len, TAR_MEMBER *th, FILE *fh);
 
-static int				_scriptOut(ArchiveHandle *AH, const void *buf, int len);
+static int	_scriptOut(ArchiveHandle *AH, const void *buf, int len);
 
 /*
- *  Initializer
+ *	Initializer
  */
-void InitArchiveFmt_Tar(ArchiveHandle* AH) 
+void
+InitArchiveFmt_Tar(ArchiveHandle *AH)
 {
-    lclContext*		ctx;
-
-    /* Assuming static functions, this can be copied for each format. */
-    AH->ArchiveEntryPtr = _ArchiveEntry;
-    AH->StartDataPtr = _StartData;
-    AH->WriteDataPtr = _WriteData;
-    AH->EndDataPtr = _EndData;
-    AH->WriteBytePtr = _WriteByte;
-    AH->ReadBytePtr = _ReadByte;
-    AH->WriteBufPtr = _WriteBuf;
-    AH->ReadBufPtr = _ReadBuf;
-    AH->ClosePtr = _CloseArchive;
-    AH->PrintTocDataPtr = _PrintTocData;
-    AH->ReadExtraTocPtr = _ReadExtraToc;
-    AH->WriteExtraTocPtr = _WriteExtraToc;
-    AH->PrintExtraTocPtr = _PrintExtraToc;
-
-    AH->StartBlobsPtr = _StartBlobs;
-    AH->StartBlobPtr = _StartBlob;
-    AH->EndBlobPtr = _EndBlob;
-    AH->EndBlobsPtr = _EndBlobs;
-
-    /*
-     *	Set up some special context used in compressing data.
-    */
-    ctx = (lclContext*)malloc(sizeof(lclContext));
-    AH->formatData = (void*)ctx;
-    ctx->filePos = 0;
-
-    /*
-     * Now open the TOC file
-     */
-    if (AH->mode == archModeWrite) {
-
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+	lclContext *ctx;
+
+	/* Assuming static functions, this can be copied for each format. */
+	AH->ArchiveEntryPtr = _ArchiveEntry;
+	AH->StartDataPtr = _StartData;
+	AH->WriteDataPtr = _WriteData;
+	AH->EndDataPtr = _EndData;
+	AH->WriteBytePtr = _WriteByte;
+	AH->ReadBytePtr = _ReadByte;
+	AH->WriteBufPtr = _WriteBuf;
+	AH->ReadBufPtr = _ReadBuf;
+	AH->ClosePtr = _CloseArchive;
+	AH->PrintTocDataPtr = _PrintTocData;
+	AH->ReadExtraTocPtr = _ReadExtraToc;
+	AH->WriteExtraTocPtr = _WriteExtraToc;
+	AH->PrintExtraTocPtr = _PrintExtraToc;
+
+	AH->StartBlobsPtr = _StartBlobs;
+	AH->StartBlobPtr = _StartBlob;
+	AH->EndBlobPtr = _EndBlob;
+	AH->EndBlobsPtr = _EndBlobs;
+
+	/*
+	 * Set up some special context used in compressing data.
+	 */
+	ctx = (lclContext *) malloc(sizeof(lclContext));
+	AH->formatData = (void *) ctx;
+	ctx->filePos = 0;
+
+	/*
+	 * Now open the TOC file
+	 */
+	if (AH->mode == archModeWrite)
+	{
+
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			ctx->tarFH = fopen(AH->fSpec, PG_BINARY_W);
-		} else {
+		else
 			ctx->tarFH = stdout;
-		}
 
-		if (ctx->tarFH == NULL) 
+		if (ctx->tarFH == NULL)
 			die_horribly(NULL, "%s: Could not open TOC file for output.\n", progname);
 
 		ctx->tarFHpos = 0;
 
-		/* Make unbuffered since we will dup() it, and the buffers screw each other */
+		/*
+		 * Make unbuffered since we will dup() it, and the buffers screw
+		 * each other
+		 */
 		/* setvbuf(ctx->tarFH, NULL, _IONBF, 0); */
 
 		ctx->hasSeek = (fseek(ctx->tarFH, 0, SEEK_CUR) == 0);
 
-		if (AH->compression < 0 || AH->compression > 9) {
+		if (AH->compression < 0 || AH->compression > 9)
 			AH->compression = Z_DEFAULT_COMPRESSION;
-		}
 
 		/* Don't compress into tar files unless asked to do so */
 		if (AH->compression == Z_DEFAULT_COMPRESSION)
 			AH->compression = 0;
 
-		/* We don't support compression because reading the files back is not possible since
-		 * gzdopen uses buffered IO which totally screws file positioning.
+		/*
+		 * We don't support compression because reading the files back is
+		 * not possible since gzdopen uses buffered IO which totally
+		 * screws file positioning.
 		 */
 		if (AH->compression != 0)
 			die_horribly(NULL, "%s: Compression not supported in TAR output\n", progname);
 
-    } else { /* Read Mode */
+	}
+	else
+	{							/* Read Mode */
 
-		if (AH->fSpec && strcmp(AH->fSpec,"") != 0) {
+		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			ctx->tarFH = fopen(AH->fSpec, PG_BINARY_R);
-		} else {
+		else
 			ctx->tarFH = stdin;
-		}
 
 		if (ctx->tarFH == NULL)
 			die_horribly(NULL, "%s: Could not open TOC file for input\n", progname);
 
-		/* Make unbuffered since we will dup() it, and the buffers screw each other */
+		/*
+		 * Make unbuffered since we will dup() it, and the buffers screw
+		 * each other
+		 */
 		/* setvbuf(ctx->tarFH, NULL, _IONBF, 0); */
 
 		ctx->tarFHpos = 0;
 
 		ctx->hasSeek = (fseek(ctx->tarFH, 0, SEEK_CUR) == 0);
 
-		/* Forcibly unmark the header as read since we use the lookahead buffer */
+		/*
+		 * Forcibly unmark the header as read since we use the lookahead
+		 * buffer
+		 */
 		AH->readHeader = 0;
 
-		ctx->FH = (void*)tarOpen(AH, "toc.dat", 'r');
+		ctx->FH = (void *) tarOpen(AH, "toc.dat", 'r');
 		ReadHead(AH);
 		ReadToc(AH);
-		tarClose(AH, ctx->FH); /* Nothing else in the file... */
-    }
+		tarClose(AH, ctx->FH);	/* Nothing else in the file... */
+	}
 
 }
 
 /*
  * - Start a new TOC entry
- *   Setup the output file name.
+ *	 Setup the output file name.
  */
-static void	_ArchiveEntry(ArchiveHandle* AH, TocEntry* te) 
+static void
+_ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx;
-    char			fn[K_STD_BUF_SIZE];
+	lclTocEntry *ctx;
+	char		fn[K_STD_BUF_SIZE];
 
-    ctx = (lclTocEntry*)malloc(sizeof(lclTocEntry));
-    if (te->dataDumper) {
+	ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry));
+	if (te->dataDumper)
+	{
 #ifdef HAVE_LIBZ
-		if (AH->compression == 0) {
+		if (AH->compression == 0)
 			sprintf(fn, "%d.dat", te->id);
-		} else {
+		else
 			sprintf(fn, "%d.dat.gz", te->id);
-		}
 #else
 		sprintf(fn, "%d.dat", te->id);
 #endif
 		ctx->filename = strdup(fn);
-    } else {
+	}
+	else
+	{
 		ctx->filename = NULL;
 		ctx->TH = NULL;
-    }
-    te->formatData = (void*)ctx;
+	}
+	te->formatData = (void *) ctx;
 }
 
-static void	_WriteExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    if (ctx->filename) {
+	if (ctx->filename)
 		WriteStr(AH, ctx->filename);
-    } else {
+	else
 		WriteStr(AH, "");
-    }
 }
 
-static void	_ReadExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    if (ctx == NULL) {
-		ctx = (lclTocEntry*)malloc(sizeof(lclTocEntry));
-		te->formatData = (void*)ctx;
-    }
+	if (ctx == NULL)
+	{
+		ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry));
+		te->formatData = (void *) ctx;
+	}
 
-    ctx->filename = ReadStr(AH);
-    if (strlen(ctx->filename) == 0) {
+	ctx->filename = ReadStr(AH);
+	if (strlen(ctx->filename) == 0)
+	{
 		free(ctx->filename);
 		ctx->filename = NULL;
-    }
-    ctx->TH = NULL;
+	}
+	ctx->TH = NULL;
 }
 
-static void	_PrintExtraToc(ArchiveHandle* AH, TocEntry* te)
+static void
+_PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	ctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-    ahprintf(AH, "-- File: %s\n", ctx->filename);
+	ahprintf(AH, "-- File: %s\n", ctx->filename);
 }
 
-static void	_StartData(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
 	tctx->TH = tarOpen(AH, tctx->filename, 'w');
 }
 
-static TAR_MEMBER* tarOpen(ArchiveHandle *AH, const char *filename, char mode)
+static TAR_MEMBER *
+tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	TAR_MEMBER		*tm;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	TAR_MEMBER *tm;
+
 #ifdef HAVE_LIBZ
-	char            fmode[10];
+	char		fmode[10];
+
 #endif
 
 	if (mode == 'r')
 	{
 		tm = _tarPositionTo(AH, filename);
-		if (!tm) /* Not found */
+		if (!tm)				/* Not found */
 		{
-			if (filename) /* Couldn't find the requested file. Future: DO SEEK(0) and retry. */
+			if (filename)		/* Couldn't find the requested file.
+								 * Future: DO SEEK(0) and retry. */
 				die_horribly(AH, "%s: unable to find file '%s' in archive\n", progname, filename);
-			else /* Any file OK, non left, so return NULL */
+			else
+/* Any file OK, non left, so return NULL */
 				return NULL;
 		}
 
@@ -311,7 +343,7 @@ static TAR_MEMBER* tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 			tm->nFH = ctx->tarFH;
 		else
 			die_horribly(AH, "%s: compression support is disabled in this format\n", progname);
-			/* tm->zFH = gzdopen(dup(fileno(ctx->tarFH)), "rb"); */
+		/* tm->zFH = gzdopen(dup(fileno(ctx->tarFH)), "rb"); */
 
 #else
 
@@ -319,12 +351,14 @@ static TAR_MEMBER* tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 
 #endif
 
-	} else {
+	}
+	else
+	{
 		tm = calloc(1, sizeof(TAR_MEMBER));
 
 		tm->tmpFH = tmpfile();
 
-		if (tm->tmpFH == NULL) 
+		if (tm->tmpFH == NULL)
 			die_horribly(AH, "%s: could not generate temp file name.\n", progname);
 
 #ifdef HAVE_LIBZ
@@ -336,7 +370,8 @@ static TAR_MEMBER* tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 			if (tm->zFH == NULL)
 				die_horribly(AH, "%s: could not gzdopen temp file.\n", progname);
 
-		} else 
+		}
+		else
 			tm->nFH = tm->tmpFH;
 
 #else
@@ -356,8 +391,10 @@ static TAR_MEMBER* tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 
 }
 
-static void tarClose(ArchiveHandle *AH, TAR_MEMBER* th)
+static void
+tarClose(ArchiveHandle *AH, TAR_MEMBER *th)
 {
+
 	/*
 	 * Close the GZ file since we dup'd. This will flush the buffers.
 	 */
@@ -366,13 +403,14 @@ static void tarClose(ArchiveHandle *AH, TAR_MEMBER* th)
 			die_horribly(AH, "%s: could not close tar member\n", progname);
 
 	if (th->mode == 'w')
-		_tarAddFile(AH, th); /* This will close the temp file */
-	/* else
-	 *		Nothing to do for normal read since we don't dup() normal
-	 *		file handle, and we don't use temp files.
+		_tarAddFile(AH, th);	/* This will close the temp file */
+
+	/*
+	 * else Nothing to do for normal read since we don't dup() normal file
+	 * handle, and we don't use temp files.
 	 */
 
-	if (th->targetFile) 
+	if (th->targetFile)
 		free(th->targetFile);
 
 	th->nFH = NULL;
@@ -380,12 +418,13 @@ static void tarClose(ArchiveHandle *AH, TAR_MEMBER* th)
 }
 
 #ifdef __NOT_USED__
-static char* tarGets(char *buf, int len, TAR_MEMBER* th)
+static char *
+tarGets(char *buf, int len, TAR_MEMBER *th)
 {
-	char			*s;
-	int				cnt = 0;
-	char			c = ' ';
-	int				eof = 0;
+	char	   *s;
+	int			cnt = 0;
+	char		c = ' ';
+	int			eof = 0;
 
 	/* Can't read past logical EOF */
 	if (len > (th->fileLen - th->pos))
@@ -393,7 +432,8 @@ static char* tarGets(char *buf, int len, TAR_MEMBER* th)
 
 	while (cnt < len && c != '\n')
 	{
-		if (_tarReadRaw(th->AH, &c, 1, th, NULL) <= 0) {
+		if (_tarReadRaw(th->AH, &c, 1, th, NULL) <= 0)
+		{
 			eof = 1;
 			break;
 		}
@@ -410,30 +450,32 @@ static char* tarGets(char *buf, int len, TAR_MEMBER* th)
 
 	if (s)
 	{
-		len =  strlen(s);
+		len = strlen(s);
 		th->pos += len;
 	}
 
 	return s;
 }
+
 #endif
 
-/* 
+/*
  * Just read bytes from the archive. This is the low level read routine
  * that is used for ALL reads on a tar file.
  */
-static int _tarReadRaw(ArchiveHandle *AH, void *buf, int len, TAR_MEMBER *th, FILE *fh)
+static int
+_tarReadRaw(ArchiveHandle *AH, void *buf, int len, TAR_MEMBER *th, FILE *fh)
 {
-	lclContext		*ctx = (lclContext*)AH->formatData;
-	int				avail;
-	int				used = 0;
-	int				res = 0;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			avail;
+	int			used = 0;
+	int			res = 0;
 
 	avail = AH->lookaheadLen - AH->lookaheadPos;
 	if (avail > 0)
 	{
 		/* We have some lookahead bytes to use */
-		if (avail >= len) /* Just use the lookahead buffer */
+		if (avail >= len)		/* Just use the lookahead buffer */
 			used = len;
 		else
 			used = avail;
@@ -450,30 +492,32 @@ static int _tarReadRaw(ArchiveHandle *AH, void *buf, int len, TAR_MEMBER *th, FI
 	if (len > 0)
 	{
 		if (fh)
-			res = fread(&((char*)buf)[used], 1, len, fh);
+			res = fread(&((char *) buf)[used], 1, len, fh);
 		else if (th)
 		{
 			if (th->zFH)
-				res = GZREAD(&((char*)buf)[used], 1, len, th->zFH);
+				res = GZREAD(&((char *) buf)[used], 1, len, th->zFH);
 			else
-				res = fread(&((char*)buf)[used], 1, len, th->nFH);
-		} 
+				res = fread(&((char *) buf)[used], 1, len, th->nFH);
+		}
 		else
-			die_horribly(AH, "%s: neither th nor fh specified in tarReadRaw\n",progname);
+			die_horribly(AH, "%s: neither th nor fh specified in tarReadRaw\n", progname);
 	}
 
-	/* 
-     * fprintf(stderr, "%s: requested %d bytes, got %d from lookahead and %d from file\n", progname, reqLen, used, res);
+	/*
+	 * fprintf(stderr, "%s: requested %d bytes, got %d from lookahead and
+	 * %d from file\n", progname, reqLen, used, res);
 	 */
 
 	ctx->tarFHpos += res + used;
 
 	return (res + used);
 }
-		
-static int tarRead(void *buf, int len, TAR_MEMBER *th)
+
+static int
+tarRead(void *buf, int len, TAR_MEMBER *th)
 {
-	int res;
+	int			res;
 
 	if (th->pos + len > th->fileLen)
 		len = th->fileLen - th->pos;
@@ -488,12 +532,13 @@ static int tarRead(void *buf, int len, TAR_MEMBER *th)
 	return res;
 }
 
-static int tarWrite(const void *buf, int len, TAR_MEMBER *th)
+static int
+tarWrite(const void *buf, int len, TAR_MEMBER *th)
 {
-	int	res;
+	int			res;
 
 	if (th->zFH != 0)
-		res = GZWRITE((void*)buf, 1, len, th->zFH);
+		res = GZWRITE((void *) buf, 1, len, th->zFH);
 	else
 		res = fwrite(buf, 1, len, th->nFH);
 
@@ -504,60 +549,67 @@ static int tarWrite(const void *buf, int len, TAR_MEMBER *th)
 	return res;
 }
 
-static int	_WriteData(ArchiveHandle* AH, const void* data, int dLen)
+static int
+_WriteData(ArchiveHandle *AH, const void *data, int dLen)
 {
-    lclTocEntry*	tctx = (lclTocEntry*)AH->currToc->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) AH->currToc->formatData;
 
-	dLen = tarWrite((void*)data, dLen, tctx->TH);
+	dLen = tarWrite((void *) data, dLen, tctx->TH);
 
-    return dLen;
+	return dLen;
 }
 
-static void	_EndData(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndData(ArchiveHandle *AH, TocEntry *te)
 {
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
-    /* Close the file */
-    tarClose(AH, tctx->TH);
-    tctx->TH = NULL;
+	/* Close the file */
+	tarClose(AH, tctx->TH);
+	tctx->TH = NULL;
 }
 
-/* 
- * Print data for a given file 
+/*
+ * Print data for a given file
  */
-static void	_PrintFileData(ArchiveHandle* AH, char *filename, RestoreOptions *ropt)
+static void
+_PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-    char			buf[4096];
-    int				cnt;
-	TAR_MEMBER		*th;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		buf[4096];
+	int			cnt;
+	TAR_MEMBER *th;
 
-    if (!filename) 
+	if (!filename)
 		return;
 
 	th = tarOpen(AH, filename, 'r');
 	ctx->FH = th;
 
-    while ( (cnt = tarRead(buf, 4095, th)) > 0) {
+	while ((cnt = tarRead(buf, 4095, th)) > 0)
+	{
 		buf[cnt] = '\0';
 		ahwrite(buf, 1, cnt, AH);
-    }
+	}
 
-    tarClose(AH, th);
+	tarClose(AH, th);
 }
 
 
 /*
  * Print data for a given TOC entry
 */
-static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
+static void
+_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-    lclTocEntry*	tctx = (lclTocEntry*) te->formatData;
-	char			*tmpCopy;
-	int				i, pos1, pos2;
-
-    if (!tctx->filename) 
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+	char	   *tmpCopy;
+	int			i,
+				pos1,
+				pos2;
+
+	if (!tctx->filename)
 		return;
 
 	if (ctx->isSpecialScript)
@@ -570,12 +622,12 @@ static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
 
 		/* Get a copy of the COPY statement and clean it up */
 		tmpCopy = strdup(te->copyStmt);
-		for (i=0 ; i < strlen(tmpCopy) ; i++)
+		for (i = 0; i < strlen(tmpCopy); i++)
 			tmpCopy[i] = tolower((unsigned char) tmpCopy[i]);
 
 		/*
-		 * This is very nasty; we don't know if the archive used WITH OIDS, so
-		 * we search the string for it in a paranoid sort of way.
+		 * This is very nasty; we don't know if the archive used WITH
+		 * OIDS, so we search the string for it in a paranoid sort of way.
 		 */
 		if (strncmp(tmpCopy, "copy ", 5) != 0)
 			die_horribly(AH, "%s: COPY statment badly formatted - could not find 'copy' in '%s'\n", progname, tmpCopy);
@@ -583,23 +635,23 @@ static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
 		pos1 = 5;
 		for (pos1 = 5; pos1 < strlen(tmpCopy); pos1++)
 			if (tmpCopy[pos1] != ' ')
-				break;	
+				break;
 
 		if (tmpCopy[pos1] == '"')
 			pos1 += 2;
-		
+
 		pos1 += strlen(te->name);
 
-		for (pos2 = pos1 ; pos2 < strlen(tmpCopy) ; pos2++)
+		for (pos2 = pos1; pos2 < strlen(tmpCopy); pos2++)
 			if (strncmp(&tmpCopy[pos2], "from stdin", 10) == 0)
 				break;
 
 		if (pos2 >= strlen(tmpCopy))
 			die_horribly(AH, "%s: COPY statment badly formatted - could not find 'from stdin' in '%s' starting at %d\n",
-							progname, tmpCopy, pos1);
+						 progname, tmpCopy, pos1);
 
-		ahwrite(tmpCopy, 1, pos2, AH); /* 'copy "table" [with oids]' */
-		ahprintf(AH, " from '$$PATH$$/%s' %s", tctx->filename, &tmpCopy[pos2+10]);
+		ahwrite(tmpCopy, 1, pos2, AH);	/* 'copy "table" [with oids]' */
+		ahprintf(AH, " from '$$PATH$$/%s' %s", tctx->filename, &tmpCopy[pos2 + 10]);
 
 		return;
 	}
@@ -607,9 +659,7 @@ static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
 	if (strcmp(te->desc, "BLOBS") == 0)
 		_LoadBlobs(AH, ropt);
 	else
-	{
 		_PrintFileData(AH, tctx->filename, ropt);
-	}
 }
 
 /* static void _getBlobTocEntry(ArchiveHandle* AH, int *oid, char fname[K_STD_BUF_SIZE])
@@ -640,30 +690,32 @@ static void	_PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
  *}
  */
 
-static void	_LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt)
+static void
+_LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
 {
-    int				oid;
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	TAR_MEMBER		*th;	
-	int				cnt;
-	char			buf[4096];
+	int			oid;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	TAR_MEMBER *th;
+	int			cnt;
+	char		buf[4096];
 
 	StartRestoreBlobs(AH);
 
-	th = tarOpen(AH, NULL, 'r'); /* Open next file */
+	th = tarOpen(AH, NULL, 'r');/* Open next file */
 	while (th != NULL)
 	{
 		ctx->FH = th;
 
 		oid = atoi(&th->targetFile[5]);
 
-		if (strncmp(th->targetFile, "blob_",5) == 0 && oid != 0)
+		if (strncmp(th->targetFile, "blob_", 5) == 0 && oid != 0)
 		{
 			ahlog(AH, 1, " - Restoring BLOB oid %d\n", oid);
 
 			StartRestoreBlob(AH, oid);
 
-			while ( (cnt = tarRead(buf, 4095, th)) > 0) {
+			while ((cnt = tarRead(buf, 4095, th)) > 0)
+			{
 				buf[cnt] = '\0';
 				ahwrite(buf, 1, cnt, AH);
 			}
@@ -680,60 +732,65 @@ static void	_LoadBlobs(ArchiveHandle* AH, RestoreOptions *ropt)
 }
 
 
-static int	_WriteByte(ArchiveHandle* AH, const int i)
+static int
+_WriteByte(ArchiveHandle *AH, const int i)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int				res;
-	char			b = i; /* Avoid endian problems */
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
+	char		b = i;			/* Avoid endian problems */
 
-    res = tarWrite(&b, 1, ctx->FH);
-    if (res != EOF) {
+	res = tarWrite(&b, 1, ctx->FH);
+	if (res != EOF)
 		ctx->filePos += res;
-    }
-    return res;
+	return res;
 }
 
-static int    	_ReadByte(ArchiveHandle* AH)
+static int
+_ReadByte(ArchiveHandle *AH)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int				res;
-	char			c = '\0';
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
+	char		c = '\0';
 
-    res = tarRead(&c, 1, ctx->FH);
-    if (res != EOF) {
+	res = tarRead(&c, 1, ctx->FH);
+	if (res != EOF)
 		ctx->filePos += res;
-    }
-    return c;
+	return c;
 }
 
-static int	_WriteBuf(ArchiveHandle* AH, const void* buf, int len)
+static int
+_WriteBuf(ArchiveHandle *AH, const void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int				res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = tarWrite((void*)buf, len, ctx->FH);
-    ctx->filePos += res;
-    return res;
+	res = tarWrite((void *) buf, len, ctx->FH);
+	ctx->filePos += res;
+	return res;
 }
 
-static int	_ReadBuf(ArchiveHandle* AH, void* buf, int len)
+static int
+_ReadBuf(ArchiveHandle *AH, void *buf, int len)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-    int			res;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	int			res;
 
-    res = tarRead(buf, len, ctx->FH);
-    ctx->filePos += res;
-    return res;
+	res = tarRead(buf, len, ctx->FH);
+	ctx->filePos += res;
+	return res;
 }
 
-static void	_CloseArchive(ArchiveHandle* AH)
+static void
+_CloseArchive(ArchiveHandle *AH)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	TAR_MEMBER		*th;
-	RestoreOptions	*ropt;
-	int				savVerbose, i;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	TAR_MEMBER *th;
+	RestoreOptions *ropt;
+	int			savVerbose,
+				i;
 
-    if (AH->mode == archModeWrite) {
+	if (AH->mode == archModeWrite)
+	{
 
 		/*
 		 * Write the Header & TOC to the archive FIRST
@@ -742,32 +799,33 @@ static void	_CloseArchive(ArchiveHandle* AH)
 		ctx->FH = th;
 		WriteHead(AH);
 		WriteToc(AH);
-		tarClose(AH, th); /* Not needed any more */
+		tarClose(AH, th);		/* Not needed any more */
 
 		/*
 		 * Now send the data (tables & blobs)
 		 */
 		WriteDataChunks(AH);
 
-		/* 
-		 * Now this format wants to append a script which does a full restore
-		 * if the files have been extracted.
+		/*
+		 * Now this format wants to append a script which does a full
+		 * restore if the files have been extracted.
 		 */
 		th = tarOpen(AH, "restore.sql", 'w');
 		tarPrintf(AH, th, "create temporary table pgdump_restore_path(p text);\n");
-		tarPrintf(AH, th, 	"--\n"
-							"-- NOTE:\n"
-							"--\n"
-							"-- File paths need to be edited. Search for $$PATH$$ and\n"
-							"-- replace it with the path to the directory containing\n"
-							"-- the extracted data files.\n"
-							"--\n"
-							"-- Edit the following to match the path where the\n"
-							"-- tar archive has been extracted.\n"
-							"--\n");
+		tarPrintf(AH, th, "--\n"
+				  "-- NOTE:\n"
+				  "--\n"
+			 "-- File paths need to be edited. Search for $$PATH$$ and\n"
+			  "-- replace it with the path to the directory containing\n"
+				  "-- the extracted data files.\n"
+				  "--\n"
+				  "-- Edit the following to match the path where the\n"
+				  "-- tar archive has been extracted.\n"
+				  "--\n");
 		tarPrintf(AH, th, "insert into pgdump_restore_path values('/tmp');\n\n");
 
 		AH->CustomOutPtr = _scriptOut;
+
 		ctx->isSpecialScript = 1;
 		ctx->scriptTH = th;
 
@@ -779,27 +837,29 @@ static void	_CloseArchive(ArchiveHandle* AH)
 		savVerbose = AH->public.verbose;
 		AH->public.verbose = 0;
 
-		RestoreArchive((Archive*)AH, ropt);
+		RestoreArchive((Archive *) AH, ropt);
 
 		AH->public.verbose = savVerbose;
 
 		tarClose(AH, th);
 
 		/* Add a block of NULLs since it's de-rigeur. */
-		for(i=0; i<512; i++) 
+		for (i = 0; i < 512; i++)
 		{
 			if (fputc(0, ctx->tarFH) == EOF)
 				die_horribly(AH, "%s: could not write null block at end of TAR archive.\n", progname);
 		}
 
-    }
+	}
 
-    AH->FH = NULL; 
+	AH->FH = NULL;
 }
 
-static int _scriptOut(ArchiveHandle *AH, const void *buf, int len)
+static int
+_scriptOut(ArchiveHandle *AH, const void *buf, int len)
 {
-	lclContext*			ctx = (lclContext*)AH->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+
 	return tarWrite(buf, len, ctx->scriptTH);
 }
 
@@ -808,19 +868,20 @@ static int _scriptOut(ArchiveHandle *AH, const void *buf, int len)
  */
 
 /*
- * Called by the archiver when starting to save all BLOB DATA (not schema). 
+ * Called by the archiver when starting to save all BLOB DATA (not schema).
  * This routine should save whatever format-specific information is needed
- * to read the BLOBs back into memory. 
+ * to read the BLOBs back into memory.
  *
  * It is called just prior to the dumper's DataDumper routine.
  *
  * Optional, but strongly recommended.
  *
  */
-static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_StartBlobs(ArchiveHandle *AH, TocEntry *te)
 {
-    lclContext*		ctx = (lclContext*)AH->formatData;
-	char			fname[K_STD_BUF_SIZE];
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		fname[K_STD_BUF_SIZE];
 
 	sprintf(fname, "blobs.toc");
 	ctx->blobToc = tarOpen(AH, fname, 'w');
@@ -834,14 +895,15 @@ static void	_StartBlobs(ArchiveHandle* AH, TocEntry* te)
  *
  * Must save the passed OID for retrieval at restore-time.
  */
-static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
-	lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
-	char			fname[255];
-	char			*sfx;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+	char		fname[255];
+	char	   *sfx;
 
-    if (oid == 0) 
+	if (oid == 0)
 		die_horribly(AH, "%s: illegal OID for BLOB (%d)\n", progname, oid);
 
 	if (AH->compression != 0)
@@ -863,24 +925,27 @@ static void	_StartBlob(ArchiveHandle* AH, TocEntry* te, int oid)
  * Optional.
  *
  */
-static void	_EndBlob(ArchiveHandle* AH, TocEntry* te, int oid)
+static void
+_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
 {
-	lclTocEntry*	tctx = (lclTocEntry*)te->formatData;
+	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
 	tarClose(AH, tctx->TH);
 }
 
 /*
- * Called by the archiver when finishing saving all BLOB DATA. 
+ * Called by the archiver when finishing saving all BLOB DATA.
  *
  * Optional.
  *
  */
-static void	_EndBlobs(ArchiveHandle* AH, TocEntry* te)
+static void
+_EndBlobs(ArchiveHandle *AH, TocEntry *te)
 {
-	lclContext*		ctx = (lclContext*)AH->formatData;
+	lclContext *ctx = (lclContext *) AH->formatData;
+
 	/* Write out a fake zero OID to mark end-of-blobs. */
-    /* WriteInt(AH, 0); */
+	/* WriteInt(AH, 0); */
 
 	tarClose(AH, ctx->blobToc);
 
@@ -893,24 +958,31 @@ static void	_EndBlobs(ArchiveHandle* AH, TocEntry* te)
  *------------
  */
 
-static int tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt, ...)
+static int
+tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt,...)
 {
-	char		*p = NULL;
+	char	   *p = NULL;
 	va_list		ap;
-	int			bSize = strlen(fmt) + 256; /* Should be enough */
+	int			bSize = strlen(fmt) + 256;		/* Should be enough */
 	int			cnt = -1;
 
-	/* This is paranoid: deal with the possibility that vsnprintf is willing to ignore trailing null */
-	/* or returns > 0 even if string does not fit. It may be the case that it returns cnt = bufsize */
-	while (cnt < 0 || cnt >= (bSize - 1) )
+	/*
+	 * This is paranoid: deal with the possibility that vsnprintf is
+	 * willing to ignore trailing null
+	 */
+
+	/*
+	 * or returns > 0 even if string does not fit. It may be the case that
+	 * it returns cnt = bufsize
+	 */
+	while (cnt < 0 || cnt >= (bSize - 1))
 	{
-		if (p != NULL) free(p);
+		if (p != NULL)
+			free(p);
 		bSize *= 2;
-		p = (char*)malloc(bSize);
+		p = (char *) malloc(bSize);
 		if (p == NULL)
-		{
 			die_horribly(AH, "%s: could not allocate buffer for tarPrintf\n", progname);
-		}
 		va_start(ap, fmt);
 		cnt = vsnprintf(p, bSize, fmt, ap);
 		va_end(ap);
@@ -920,20 +992,24 @@ static int tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt, ...)
 	return cnt;
 }
 
-static int _tarChecksum(char *header)
+static int
+_tarChecksum(char *header)
 {
-	int i, sum;
+	int			i,
+				sum;
+
 	sum = 0;
-	for(i = 0; i < 512; i++)
+	for (i = 0; i < 512; i++)
 		if (i < 148 || i >= 156)
 			sum += 0xFF & header[i];
-	return sum + 256; /* Assume 8 blanks in checksum field */
+	return sum + 256;			/* Assume 8 blanks in checksum field */
 }
 
-int isValidTarHeader(char *header)
+int
+isValidTarHeader(char *header)
 {
-	int sum;
-	int chk = _tarChecksum(header);
+	int			sum;
+	int			chk = _tarChecksum(header);
 
 	sscanf(&header[148], "%8o", &sum);
 
@@ -941,15 +1017,17 @@ int isValidTarHeader(char *header)
 }
 
 /* Given the member, write the TAR header & copy the file */
-static void _tarAddFile(ArchiveHandle *AH, TAR_MEMBER* th)
+static void
+_tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
 {
-	lclContext	*ctx = (lclContext*)AH->formatData;
-	FILE		*tmp = th->tmpFH; /* Grab it for convenience */
+	lclContext *ctx = (lclContext *) AH->formatData;
+	FILE	   *tmp = th->tmpFH;/* Grab it for convenience */
 	char		buf[32768];
 	int			cnt;
 	int			len = 0;
 	int			res;
-	int			i, pad;
+	int			i,
+				pad;
 
 	/*
 	 * Find file len & go back to start.
@@ -960,48 +1038,52 @@ static void _tarAddFile(ArchiveHandle *AH, TAR_MEMBER* th)
 
 	_tarWriteHeader(th);
 
-	while ( (cnt = fread(&buf[0], 1, 32767, tmp)) > 0)
+	while ((cnt = fread(&buf[0], 1, 32767, tmp)) > 0)
 	{
 		res = fwrite(&buf[0], 1, cnt, th->tarFH);
-		if (res != cnt) 
+		if (res != cnt)
 			die_horribly(AH, "%s: write error appending to TAR archive (%d != %d).\n", progname, res, cnt);
 		len += res;
 	}
 
-	if (fclose(tmp) != 0) /* This *should* delete it... */
+	if (fclose(tmp) != 0)		/* This *should* delete it... */
 		die_horribly(AH, "%s: Could not close tar member (fclose failed).\n", progname);
 
 	if (len != th->fileLen)
 		die_horribly(AH, "%s: Actual file length does not match expected (%d vs. %d).\n",
-						progname, len, th->pos);
+					 progname, len, th->pos);
 
 	pad = ((len + 511) & ~511) - len;
-    for (i=0 ; i < pad ; i++)
+	for (i = 0; i < pad; i++)
 	{
-		if (fputc('\0',th->tarFH) == EOF) 
+		if (fputc('\0', th->tarFH) == EOF)
 			die_horribly(AH, "%s: Could not output padding at end of tar member.\n", progname);
-	}	
+	}
 
 	ctx->tarFHpos += len + pad;
 }
 
 /* Locate the file in the archive, read header and position to data */
-static TAR_MEMBER* _tarPositionTo(ArchiveHandle *AH, const char *filename)
+static TAR_MEMBER *
+_tarPositionTo(ArchiveHandle *AH, const char *filename)
 {
-	lclContext		*ctx = (lclContext*)AH->formatData;
-	TAR_MEMBER*		th = calloc(1, sizeof(TAR_MEMBER));
-	char			c;
-	char			header[512];
-	int				i, len, blks, id;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	TAR_MEMBER *th = calloc(1, sizeof(TAR_MEMBER));
+	char		c;
+	char		header[512];
+	int			i,
+				len,
+				blks,
+				id;
 
 	th->AH = AH;
 
 	/* Go to end of current file, if any */
 	if (ctx->tarFHpos != 0)
 	{
-		ahlog(AH, 4, "Moving from %d (%x) to next member at file position %d (%x)\n", 
-				ctx->tarFHpos, ctx->tarFHpos,
-				ctx->tarNextMember, ctx->tarNextMember);
+		ahlog(AH, 4, "Moving from %d (%x) to next member at file position %d (%x)\n",
+			  ctx->tarFHpos, ctx->tarFHpos,
+			  ctx->tarNextMember, ctx->tarNextMember);
 
 		while (ctx->tarFHpos < ctx->tarNextMember)
 			_tarReadRaw(AH, &c, 1, NULL, ctx->tarFH);
@@ -1016,28 +1098,29 @@ static TAR_MEMBER* _tarPositionTo(ArchiveHandle *AH, const char *filename)
 	{
 		if (filename)
 			die_horribly(AH, "%s: unable to find header for %s\n", progname, filename);
-		else /* We're just scanning the archibe for the next file, so return null */
+		else
+/* We're just scanning the archibe for the next file, so return null */
 		{
 			free(th);
 			return NULL;
 		}
 	}
 
-    while(filename != NULL && strcmp(th->targetFile, filename) != 0)
+	while (filename != NULL && strcmp(th->targetFile, filename) != 0)
 	{
 		ahlog(AH, 4, "Skipping member %s\n", th->targetFile);
 
 		id = atoi(th->targetFile);
 		if ((TocIDRequired(AH, id, AH->ropt) & 2) != 0)
 			die_horribly(AH, "%s: dumping data out of order is not supported in this archive format: "
-								"%s is required, but comes before %s in the archive file.\n",
-							progname, th->targetFile, filename);
+			"%s is required, but comes before %s in the archive file.\n",
+						 progname, th->targetFile, filename);
 
 		/* Header doesn't match, so read to next header */
-		len = ((th->fileLen + 511) & ~511); /* Padded length */
-		blks = len >> 9; /* # of 512 byte blocks */
+		len = ((th->fileLen + 511) & ~511);		/* Padded length */
+		blks = len >> 9;		/* # of 512 byte blocks */
 
-		for(i=0 ; i < blks ; i++)
+		for (i = 0; i < blks; i++)
 			_tarReadRaw(AH, &header[0], 512, NULL, ctx->tarFH);
 
 		if (!_tarGetHeader(AH, th))
@@ -1052,23 +1135,26 @@ static TAR_MEMBER* _tarPositionTo(ArchiveHandle *AH, const char *filename)
 }
 
 /* Read & verify a header */
-static int _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th)
+static int
+_tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
 {
-	lclContext		*ctx = (lclContext*)AH->formatData;
-	char			h[512];
-	char			name[100];
-	int				sum, chk;
-	int				len;
-	int				hPos;
-	int				i;
-	bool			gotBlock = false;
+	lclContext *ctx = (lclContext *) AH->formatData;
+	char		h[512];
+	char		name[100];
+	int			sum,
+				chk;
+	int			len;
+	int			hPos;
+	int			i;
+	bool		gotBlock = false;
 
 	while (!gotBlock)
 	{
+
 		/*
-		 * if ( ftell(ctx->tarFH) != ctx->tarFHpos)
-		 *		die_horribly(AH, "%s: mismatch in actual vs. predicted file pos - %d vs. %d\n",
-		 *						progname, ftell(ctx->tarFH), ctx->tarFHpos);
+		 * if ( ftell(ctx->tarFH) != ctx->tarFHpos) die_horribly(AH, "%s:
+		 * mismatch in actual vs. predicted file pos - %d vs. %d\n",
+		 * progname, ftell(ctx->tarFH), ctx->tarFHpos);
 		 */
 
 		/* Save the pos for reporting purposes */
@@ -1076,7 +1162,7 @@ static int _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th)
 
 		/* Read a 512 byte block, return EOF, exit if short */
 		len = _tarReadRaw(AH, &h[0], 512, NULL, ctx->tarFH);
-		if (len == 0) /* EOF */
+		if (len == 0)			/* EOF */
 			return 0;
 
 		if (len != 512)
@@ -1086,18 +1172,19 @@ static int _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th)
 		chk = _tarChecksum(&h[0]);
 
 		/*
-		 * If the checksum failed, see if it is a null block.
-		 * If so, then just try with next block...
+		 * If the checksum failed, see if it is a null block. If so, then
+		 * just try with next block...
 		 */
 
-		if (chk == sum) {
+		if (chk == sum)
 			gotBlock = true;
-		} else {
-			for( i = 0 ; i < 512 ; i++)
+		else
+		{
+			for (i = 0; i < 512; i++)
 			{
-				if (h[0] != 0) 
+				if (h[0] != 0)
 				{
-					gotBlock = true;	
+					gotBlock = true;
 					break;
 				}
 			}
@@ -1112,8 +1199,8 @@ static int _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th)
 
 	if (chk != sum)
 		die_horribly(AH, "%s: corrupt tar header found in %s "
-						"(expected %d (%o), computed %d (%o)) file position %d (%x)\n", 
-						progname, &name[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
+		  "(expected %d (%o), computed %d (%o)) file position %d (%x)\n",
+					 progname, &name[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
 
 	th->targetFile = strdup(name);
 	th->fileLen = len;
@@ -1121,14 +1208,15 @@ static int _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER* th)
 	return 1;
 }
 
-static void _tarWriteHeader(TAR_MEMBER* th)
+static void
+_tarWriteHeader(TAR_MEMBER *th)
 {
 	char		h[512];
 	int			i;
 	int			lastSum = 0;
 	int			sum;
 
-	for (i = 0 ; i < 512 ; i++)
+	for (i = 0; i < 512; i++)
 		h[i] = '\0';
 
 	/* Name 100 */
@@ -1147,7 +1235,7 @@ static void _tarWriteHeader(TAR_MEMBER* th)
 	sprintf(&h[124], "%10o ", th->fileLen);
 
 	/* Mod Time 12 */
-	sprintf(&h[136], "%10o ", (int)time(NULL));
+	sprintf(&h[136], "%10o ", (int) time(NULL));
 
 	/* Checksum 8 */
 	sprintf(&h[148], "%6o ", lastSum);
@@ -1161,16 +1249,17 @@ static void _tarWriteHeader(TAR_MEMBER* th)
 	/* Magic 8 */
 	sprintf(&h[257], "ustar  ");
 
-	/* GNU Version...
-	 * sprintf(&h[257], "ustar");
-	 * sprintf(&h[263], "00");
-	*/
+	/*
+	 * GNU Version... sprintf(&h[257], "ustar"); sprintf(&h[263], "00");
+	 */
 
 	/* User 32 */
-	sprintf(&h[265], "%.31s", ""); /* How do I get username reliably? Do I need to? */
+	sprintf(&h[265], "%.31s", "");		/* How do I get username reliably?
+										 * Do I need to? */
 
 	/* Group 32 */
-	sprintf(&h[297], "%.31s", ""); /* How do I get group reliably? Do I need to? */
+	sprintf(&h[297], "%.31s", "");		/* How do I get group reliably? Do
+										 * I need to? */
 
 	/* Maj Dev 8 */
 	/* sprintf(&h[329], "%6o ", 0); */
@@ -1179,14 +1268,13 @@ static void _tarWriteHeader(TAR_MEMBER* th)
 	/* sprintf(&h[337], "%6o ", 0); */
 
 
-	while ( (sum = _tarChecksum(h)) != lastSum)
+	while ((sum = _tarChecksum(h)) != lastSum)
 	{
 		sprintf(&h[148], "%6o ", sum);
 		lastSum = sum;
 	}
 
-	if (fwrite(h, 1, 512, th->tarFH) != 512) {
+	if (fwrite(h, 1, 512, th->tarFH) != 512)
 		die_horribly(th->AH, "%s: unable to write tar header\n", progname);
-	}
 
 }
diff --git a/src/bin/pg_dump/pg_backup_tar.h b/src/bin/pg_dump/pg_backup_tar.h
index d53de290982a257fd7cd8660f1ecd90f9d3e48a0..a183e248996f91560e842ba47c5f3c06e805a015 100644
--- a/src/bin/pg_dump/pg_backup_tar.h
+++ b/src/bin/pg_dump/pg_backup_tar.h
@@ -1,36 +1,34 @@
-/* 
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.h,v 1.2 2001/03/19 02:35:29 pjw Exp $
+/*
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.h,v 1.3 2001/03/22 04:00:14 momjian Exp $
  *
  * TAR Header
  *
- * Offset   Length   Contents
- *   0    100 bytes  File name ('\0' terminated, 99 maxmum length)
- * 100      8 bytes  File mode (in octal ascii)
- * 108      8 bytes  User ID (in octal ascii)
- * 116      8 bytes  Group ID (in octal ascii)
- * 124     12 bytes  File size (s) (in octal ascii)
- * 136     12 bytes  Modify time (in octal ascii)
- * 148      8 bytes  Header checksum (in octal ascii)
- * 156      1 bytes  Link flag
- * 157    100 bytes  Linkname ('\0' terminated, 99 maxmum length)
- * 257      8 bytes  Magic ("ustar  \0")
- * 265     32 bytes  User name ('\0' terminated, 31 maxmum length)
- * 297     32 bytes  Group name ('\0' terminated, 31 maxmum length)
- * 329      8 bytes  Major device ID (in octal ascii)
- * 337      8 bytes  Minor device ID (in octal ascii)
- * 345    167 bytes  Padding
- * 512   (s+p)bytes  File contents (s+p) := (((s) + 511) & ~511), round up to 512 bytes
+ * Offset	Length	 Contents
+ *	 0	  100 bytes  File name ('\0' terminated, 99 maxmum length)
+ * 100		8 bytes  File mode (in octal ascii)
+ * 108		8 bytes  User ID (in octal ascii)
+ * 116		8 bytes  Group ID (in octal ascii)
+ * 124	   12 bytes  File size (s) (in octal ascii)
+ * 136	   12 bytes  Modify time (in octal ascii)
+ * 148		8 bytes  Header checksum (in octal ascii)
+ * 156		1 bytes  Link flag
+ * 157	  100 bytes  Linkname ('\0' terminated, 99 maxmum length)
+ * 257		8 bytes  Magic ("ustar  \0")
+ * 265	   32 bytes  User name ('\0' terminated, 31 maxmum length)
+ * 297	   32 bytes  Group name ('\0' terminated, 31 maxmum length)
+ * 329		8 bytes  Major device ID (in octal ascii)
+ * 337		8 bytes  Minor device ID (in octal ascii)
+ * 345	  167 bytes  Padding
+ * 512	 (s+p)bytes  File contents (s+p) := (((s) + 511) & ~511), round up to 512 bytes
  */
 
 /* The linkflag defines the type of file */
-#define  LF_OLDNORMAL '\0'       /* Normal disk file, Unix compatible */
-#define  LF_NORMAL    '0'        /* Normal disk file */
-#define  LF_LINK      '1'        /* Link to previously dumped file */
-#define  LF_SYMLINK   '2'        /* Symbolic link */
-#define  LF_CHR       '3'        /* Character special file */
-#define  LF_BLK       '4'        /* Block special file */
-#define  LF_DIR       '5'        /* Directory */
-#define  LF_FIFO      '6'        /* FIFO special file */
-#define  LF_CONTIG    '7'        /* Contiguous file */
-
-
+#define  LF_OLDNORMAL '\0'		/* Normal disk file, Unix compatible */
+#define  LF_NORMAL	  '0'		/* Normal disk file */
+#define  LF_LINK	  '1'		/* Link to previously dumped file */
+#define  LF_SYMLINK   '2'		/* Symbolic link */
+#define  LF_CHR		  '3'		/* Character special file */
+#define  LF_BLK		  '4'		/* Block special file */
+#define  LF_DIR		  '5'		/* Directory */
+#define  LF_FIFO	  '6'		/* FIFO special file */
+#define  LF_CONTIG	  '7'		/* Contiguous file */
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index c61293783693d5b3a406db0eab3ef6c51f331985..a461f18e4af411170bd52b8443104072e6c0cd13 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -2,7 +2,7 @@
  *
  * pg_dump.c
  *	  pg_dump is an utility for dumping out a postgres database
- *    into a script file.
+ *	  into a script file.
  *
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.195 2001/03/19 02:35:29 pjw Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.196 2001/03/22 04:00:14 momjian Exp $
  *
  * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
  *
@@ -55,7 +55,7 @@
  *		   output formats and simple rearrangement of order.
  *		 - Discouraged operations more appropriate to the 'restore'
  *		   operation. (eg. -c "clear schema" - now always dumps
- *		   commands, but pg_restore can be told not to output them). 
+ *		   commands, but pg_restore can be told not to output them).
  *		 - Added RI warnings to the 'as insert strings' output mode
  *		 - Added a small number of comments
  *		 - Added a -Z option for compression level on compressed formats
@@ -68,7 +68,7 @@
  *
  * Modifications - 28-Jul-2000 - pjw@rhyme.com.au (1.45)
  *
- * 		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
+ *		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
  *		Added code to dump 'Create Schema' statement (pg_dump)
  *		Don't bother to disable/enable triggers if we don't have a superuser (pg_restore)
  *		Cleaned up code for reconnecting to database.
@@ -79,10 +79,10 @@
  *		Fixed minor bug in language dumping code: expbuffres were not being reset.
  *		Fixed version number initialization in _allocAH (pg_backup_archiver.c)
  *
- * Modifications - 14-Sep-2000 - pjw@rhyme.com.au 
+ * Modifications - 14-Sep-2000 - pjw@rhyme.com.au
  *		Use symbols for tests on relkind (ie. use RELKIND_VIEW, not 'v')
- * 		Support for relkind = RELKIND_VIEW.
- * 		Fix bug in support for -b option (== --blobs).
+ *		Support for relkind = RELKIND_VIEW.
+ *		Fix bug in support for -b option (== --blobs).
  *		Dump views as views (using 'create view').
  *		Remove 'isViewRule' since we check the relkind when getting tables.
  *		Now uses temp table 'pgdump_oid' rather than 'pg_dump_oid' (errors otherwise).
@@ -91,8 +91,8 @@
  *
  *	  - Be more paranoid when getting views: call get_viewdef in separate statement
  *		so we can be more informative in error messages.
- *	  - Support for 'isstrict' procedure attribute. 
- *	  - Disable --blobs and --table since (a) it's a pain to get ONLY the blobs for the 
+ *	  - Support for 'isstrict' procedure attribute.
+ *	  - Disable --blobs and --table since (a) it's a pain to get ONLY the blobs for the
  *		table with the currently implementation, and (b) it's not clear how to restore
  *		a partial BLOB backup (given the current OID-based BLOB implementation).
  *
@@ -103,13 +103,13 @@
  *
  * Modifications - 13-Feb-2001 - pjw@rhyme.com.au
  *
- *    - Fix help output: replace 'f' with 't' and change desc.
- *    - Add extra arg to formatStringLiteral to specify how to handle LF & TAB.
- *      I opted for encoding them except in procedure bodies.
+ *	  - Fix help output: replace 'f' with 't' and change desc.
+ *	  - Add extra arg to formatStringLiteral to specify how to handle LF & TAB.
+ *		I opted for encoding them except in procedure bodies.
  *	  - Dump relevant parts of sequences only when doing schemaOnly & dataOnly
  *	  - Prevent double-dumping of sequences when dataOnly.
  *
- * Modifications - 19-Mar-2001 - pjw@rhyme.com.au 
+ * Modifications - 19-Mar-2001 - pjw@rhyme.com.au
  *
  *	  - Remove fmtId calls for all ArchiveEntry name fields. This fixes
  *		quoting problems in trigger enable/disable code for mixed case
@@ -155,12 +155,14 @@
 #define atooid(x)  ((Oid) strtoul((x), NULL, 10))
 
 
-typedef enum _formatLiteralOptions {
-        CONV_ALL = 0,
-        PASS_LFTAB = 3	/* NOTE: 1 and 2 are reserved in case we want to make a mask. */ 
-						/* We could make this a bit mask for control chars, but I don't */
-						/* see any value in making it more complex...the current code */
-						/* only checks for 'opts == CONV_ALL' anyway. */
+typedef enum _formatLiteralOptions
+{
+	CONV_ALL = 0,
+	PASS_LFTAB = 3				/* NOTE: 1 and 2 are reserved in case we
+								 * want to make a mask. */
+	/* We could make this a bit mask for control chars, but I don't */
+	/* see any value in making it more complex...the current code */
+	/* only checks for 'opts == CONV_ALL' anyway. */
 } formatLiteralOptions;
 
 static void dumpComment(Archive *outfile, const char *target, const char *oid);
@@ -174,14 +176,14 @@ static void formatStringLiteral(PQExpBuffer buf, const char *str, const formatLi
 static void clearTableInfo(TableInfo *, int);
 static void dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 			TypeInfo *tinfo, int numTypes);
-static Oid	findLastBuiltinOid(const char*);
+static Oid	findLastBuiltinOid(const char *);
 static void setMaxOid(Archive *fout);
 
 static void AddAcl(char *aclbuf, const char *keyword);
 static char *GetPrivileges(const char *s);
 
-static int dumpBlobs(Archive *AH, char*, void*);
-static int dumpDatabase(Archive *AH);
+static int	dumpBlobs(Archive *AH, char *, void *);
+static int	dumpDatabase(Archive *AH);
 static PQExpBuffer getPKconstraint(TableInfo *tblInfo, IndInfo *indInfo);
 
 extern char *optarg;
@@ -192,7 +194,7 @@ extern int	optind,
 bool		g_verbose;			/* User wants verbose narration of our
 								 * activities. */
 Oid			g_last_builtin_oid; /* value of the last builtin oid */
-Archive	   *g_fout;				/* the script file */
+Archive    *g_fout;				/* the script file */
 PGconn	   *g_conn;				/* the database connection */
 
 bool		force_quotes;		/* User wants to suppress double-quotes */
@@ -209,9 +211,10 @@ char		g_comment_start[10];
 char		g_comment_end[10];
 
 
-typedef struct _dumpContext {
-	TableInfo	*tblinfo;
-	int		tblidx;
+typedef struct _dumpContext
+{
+	TableInfo  *tblinfo;
+	int			tblidx;
 	bool		oids;
 } DumpContext;
 
@@ -225,61 +228,61 @@ help(const char *progname)
 
 #ifdef HAVE_GETOPT_LONG
 	puts(
-		"  -a, --data-only          dump out only the data, not the schema\n"
-		"  -b, --blobs              dump out blob data\n"
-	   	"  -c, --clean              clean (drop) schema prior to create\n"
-		"  -C, --create             output commands to create database\n"
-		"  -d, --inserts            dump data as INSERT, rather than COPY, commands\n"
-		"  -D, --attribute-inserts  dump data as INSERT commands with attribute names\n"
-		"  -f, --file=FILENAME      specify output file name\n"
-		"  -F, --format {c|t|p}     output file format (custom, tar, plain text)\n"
-		"  -h, --host=HOSTNAME      server host name\n"
-		"  -i, --ignore-version     proceed when database version != pg_dump version\n"
-		"  -n, --no-quotes          suppress most quotes around identifiers\n"
-		"  -N, --quotes             enable most quotes around identifiers\n"
-		"  -o, --oids               dump object ids (oids)\n"
-		"  -O, --no-owner           do not output \\connect commands in plain text\n"
-		"                           format\n"
-		"  -p, --port=PORT          server port number\n"
-		"  -R, --no-reconnect       disable ALL reconnections to the database in\n"
-		"                           plain text format\n"
-		"  -s, --schema-only        dump out only the schema, no data\n"
-		"  -S, --superuser=NAME     specify the superuser user name to use in plain\n"
-		"                           text format\n"
-		"  -t, --table=TABLE        dump for this table only (* for all)\n"
-		"  -u, --password           use password authentication\n"
-		"  -v, --verbose            verbose\n"
-		"  -x, --no-acl             do not dump ACL's (grant/revoke)\n"
-		"  -Z, --compress {0-9}     compression level for compressed formats\n"
+	"  -a, --data-only          dump out only the data, not the schema\n"
+		 "  -b, --blobs              dump out blob data\n"
+	   "  -c, --clean              clean (drop) schema prior to create\n"
+		 "  -C, --create             output commands to create database\n"
+		 "  -d, --inserts            dump data as INSERT, rather than COPY, commands\n"
+		 "  -D, --attribute-inserts  dump data as INSERT commands with attribute names\n"
+		 "  -f, --file=FILENAME      specify output file name\n"
+		 "  -F, --format {c|t|p}     output file format (custom, tar, plain text)\n"
+		 "  -h, --host=HOSTNAME      server host name\n"
+		 "  -i, --ignore-version     proceed when database version != pg_dump version\n"
+	"  -n, --no-quotes          suppress most quotes around identifiers\n"
+	 "  -N, --quotes             enable most quotes around identifiers\n"
+		 "  -o, --oids               dump object ids (oids)\n"
+		 "  -O, --no-owner           do not output \\connect commands in plain text\n"
+		 "                           format\n"
+		 "  -p, --port=PORT          server port number\n"
+		 "  -R, --no-reconnect       disable ALL reconnections to the database in\n"
+		 "                           plain text format\n"
+		 "  -s, --schema-only        dump out only the schema, no data\n"
+		 "  -S, --superuser=NAME     specify the superuser user name to use in plain\n"
+		 "                           text format\n"
+	  "  -t, --table=TABLE        dump for this table only (* for all)\n"
+		 "  -u, --password           use password authentication\n"
+		 "  -v, --verbose            verbose\n"
+		 "  -x, --no-acl             do not dump ACL's (grant/revoke)\n"
+		 "  -Z, --compress {0-9}     compression level for compressed formats\n"
 		);
 #else
 	puts(
-		"  -a                       dump out only the data, no schema\n"
-		"  -b                       dump out blob data\n"
-		"  -c                       clean (drop) schema prior to create\n"
-		"  -C                       output commands to create database\n"
-		"  -d                       dump data as INSERT, rather than COPY, commands\n"
-		"  -D                       dump data as INSERT commands with attribute names\n"
-		"  -f FILENAME              specify output file name\n"
-		"  -F {c|t|p}               output file format (custom, tar, plain text)\n"
-		"  -h HOSTNAME              server host name\n"
-		"  -i                       proceed when database version != pg_dump version\n"
-		"  -n                       suppress most quotes around identifiers\n"
-		"  -N                       enable most quotes around identifiers\n"
-		"  -o                       dump object ids (oids)\n"
-		"  -O                       do not output \\connect commands in plain text\n"
-		"                           format\n"
-		"  -p PORT                  server port number\n"
-		"  -R                       disable ALL reconnections to the database in\n"
-		"                           plain text format\n"
-		"  -s                       dump out only the schema, no data\n"
-		"  -S NAME                  specify the superuser user name to use in plain\n"
-		"                           text format\n"
-		"  -t TABLE                 dump for this table only (* for all)\n"
-		"  -u                       use password authentication\n"
-		"  -v                       verbose\n"
-		"  -x                       do not dump ACL's (grant/revoke)\n"
-		"  -Z {0-9}                 compression level for compressed formats\n"
+		 "  -a                       dump out only the data, no schema\n"
+		 "  -b                       dump out blob data\n"
+	   "  -c                       clean (drop) schema prior to create\n"
+		 "  -C                       output commands to create database\n"
+		 "  -d                       dump data as INSERT, rather than COPY, commands\n"
+		 "  -D                       dump data as INSERT commands with attribute names\n"
+		 "  -f FILENAME              specify output file name\n"
+		 "  -F {c|t|p}               output file format (custom, tar, plain text)\n"
+		 "  -h HOSTNAME              server host name\n"
+		 "  -i                       proceed when database version != pg_dump version\n"
+	"  -n                       suppress most quotes around identifiers\n"
+	 "  -N                       enable most quotes around identifiers\n"
+		 "  -o                       dump object ids (oids)\n"
+		 "  -O                       do not output \\connect commands in plain text\n"
+		 "                           format\n"
+		 "  -p PORT                  server port number\n"
+		 "  -R                       disable ALL reconnections to the database in\n"
+		 "                           plain text format\n"
+		 "  -s                       dump out only the schema, no data\n"
+		 "  -S NAME                  specify the superuser user name to use in plain\n"
+		 "                           text format\n"
+	  "  -t TABLE                 dump for this table only (* for all)\n"
+		 "  -u                       use password authentication\n"
+		 "  -v                       verbose\n"
+		 "  -x                       do not dump ACL's (grant/revoke)\n"
+		 "  -Z {0-9}                 compression level for compressed formats\n"
 		);
 #endif
 	puts("If no database name is not supplied, then the PGDATABASE environment\nvariable value is used.\n");
@@ -313,11 +316,11 @@ exit_nicely(PGconn *conn)
  *	  to be dumped.
  */
 
-static int 
-dumpClasses_nodumpData(Archive *fout, char* oid, void *dctxv)
+static int
+dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
 {
-	const DumpContext	*dctx = (DumpContext*)dctxv; 	
-	const char 	*classname = dctx->tblinfo[dctx->tblidx].relname;
+	const DumpContext *dctx = (DumpContext *) dctxv;
+	const char *classname = dctx->tblinfo[dctx->tblidx].relname;
 	const bool	oids = dctx->oids;
 
 	PGresult   *res;
@@ -326,16 +329,17 @@ dumpClasses_nodumpData(Archive *fout, char* oid, void *dctxv)
 	bool		copydone;
 	char		copybuf[COPYBUFSIZ];
 
-    if (g_verbose)
-        fprintf(stderr, "%s dumping out the contents of table %s\n", g_comment_start, classname);
+	if (g_verbose)
+		fprintf(stderr, "%s dumping out the contents of table %s\n", g_comment_start, classname);
 
 	if (oids == true)
 	{
-		/* 
+
+		/*
 		 * archprintf(fout, "COPY %s WITH OIDS FROM stdin;\n",
-		 *		fmtId(classname, force_quotes));
+		 * fmtId(classname, force_quotes));
 		 *
-		 *  - Not used as of V1.3 (needs to be in ArchiveEntry call)
+		 * - Not used as of V1.3 (needs to be in ArchiveEntry call)
 		 *
 		 */
 
@@ -344,8 +348,10 @@ dumpClasses_nodumpData(Archive *fout, char* oid, void *dctxv)
 	}
 	else
 	{
-		/* 
-		 *archprintf(fout, "COPY %s FROM stdin;\n", fmtId(classname, force_quotes));
+
+		/*
+		 * archprintf(fout, "COPY %s FROM stdin;\n", fmtId(classname,
+		 * force_quotes));
 		 *
 		 * - Not used as of V1.3 (needs to be in ArchiveEntry call)
 		 *
@@ -404,45 +410,50 @@ dumpClasses_nodumpData(Archive *fout, char* oid, void *dctxv)
 					}
 				}
 
-				/* 
+				/*
 				 * THROTTLE:
 				 *
-				 * There was considerable discussion in late July, 2000 regarding slowing down
-				 * pg_dump when backing up large tables. Users with both slow & fast (muti-processor)
-				 * machines experienced performance degradation when doing a backup.
+				 * There was considerable discussion in late July, 2000
+				 * regarding slowing down pg_dump when backing up large
+				 * tables. Users with both slow & fast (muti-processor)
+				 * machines experienced performance degradation when doing
+				 * a backup.
 				 *
-				 * Initial attempts based on sleeping for a number of ms for each ms of work were deemed
-				 * too complex, then a simple 'sleep in each loop' implementation was suggested. The latter
-				 * failed because the loop was too tight. Finally, the following was implemented:
+				 * Initial attempts based on sleeping for a number of ms for
+				 * each ms of work were deemed too complex, then a simple
+				 * 'sleep in each loop' implementation was suggested. The
+				 * latter failed because the loop was too tight. Finally,
+				 * the following was implemented:
 				 *
-				 * If throttle is non-zero, then
-				 * 		See how long since the last sleep.
-				 *		Work out how long to sleep (based on ratio).
-				 * 		If sleep is more than 100ms, then 
-			     *			sleep 
-				 *			reset timer
-				 *		EndIf
+				 * If throttle is non-zero, then See how long since the last
+				 * sleep. Work out how long to sleep (based on ratio). If
+				 * sleep is more than 100ms, then sleep reset timer EndIf
 				 * EndIf
 				 *
-				 * where the throttle value was the number of ms to sleep per ms of work. The calculation was 
-				 * done in each loop.
+				 * where the throttle value was the number of ms to sleep per
+				 * ms of work. The calculation was done in each loop.
 				 *
-				 * Most of the hard work is done in the backend, and this solution still did not work 
-				 * particularly well: on slow machines, the ratio was 50:1, and on medium paced machines, 1:1,
-				 * and on fast multi-processor machines, it had little or no effect, for reasons that were unclear.
+				 * Most of the hard work is done in the backend, and this
+				 * solution still did not work particularly well: on slow
+				 * machines, the ratio was 50:1, and on medium paced
+				 * machines, 1:1, and on fast multi-processor machines, it
+				 * had little or no effect, for reasons that were unclear.
 				 *
 				 * Further discussion ensued, and the proposal was dropped.
 				 *
-				 * For those people who want this feature, it can be implemented using gettimeofday in each
-				 * loop, calculating the time since last sleep, multiplying that by the sleep ratio, then
-				 * if the result is more than a preset 'minimum sleep time' (say 100ms), call the 'select'
-				 * function to sleep for a subsecond period ie.
+				 * For those people who want this feature, it can be
+				 * implemented using gettimeofday in each loop,
+				 * calculating the time since last sleep, multiplying that
+				 * by the sleep ratio, then if the result is more than a
+				 * preset 'minimum sleep time' (say 100ms), call the
+				 * 'select' function to sleep for a subsecond period ie.
 				 *
-				 *        select(0, NULL, NULL, NULL, &tvi);
+				 * select(0, NULL, NULL, NULL, &tvi);
 				 *
-				 * This will return after the interval specified in the structure tvi. Fianally, call
-				 * gettimeofday again to save the 'last sleep time'.
-				 */	
+				 * This will return after the interval specified in the
+				 * structure tvi. Fianally, call gettimeofday again to
+				 * save the 'last sleep time'.
+				 */
 			}
 			archprintf(fout, "\\.\n");
 		}
@@ -464,10 +475,10 @@ dumpClasses_nodumpData(Archive *fout, char* oid, void *dctxv)
 }
 
 static int
-dumpClasses_dumpData(Archive *fout, char* oid, void *dctxv)
+dumpClasses_dumpData(Archive *fout, char *oid, void *dctxv)
 {
-	const DumpContext	*dctx = (DumpContext*)dctxv;
-	const char			*classname = dctx->tblinfo[dctx->tblidx].relname;
+	const DumpContext *dctx = (DumpContext *) dctxv;
+	const char *classname = dctx->tblinfo[dctx->tblidx].relname;
 
 	PGresult   *res;
 	PQExpBuffer q = createPQExpBuffer();
@@ -479,8 +490,8 @@ dumpClasses_dumpData(Archive *fout, char* oid, void *dctxv)
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		fprintf(stderr, "dumpClasses(): command failed.  Explanation from backend: '%s'.\n", 
-					PQerrorMessage(g_conn));
+		fprintf(stderr, "dumpClasses(): command failed.  Explanation from backend: '%s'.\n",
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 	for (tuple = 0; tuple < PQntuples(res); tuple++)
@@ -518,7 +529,7 @@ dumpClasses_dumpData(Archive *fout, char* oid, void *dctxv)
 				case FLOAT8OID:/* float types */
 					/* These types are printed without quotes */
 					archprintf(fout, "%s",
-							PQgetvalue(res, tuple, field));
+							   PQgetvalue(res, tuple, field));
 					break;
 				case ZPBITOID:
 				case VARBITOID:
@@ -556,19 +567,23 @@ formatStringLiteral(PQExpBuffer buf, const char *str, const formatLiteralOptions
 	appendPQExpBufferChar(buf, '\'');
 	while (*str)
 	{
-		char	ch = *str++;
+		char		ch = *str++;
 
 		if (ch == '\\' || ch == '\'')
 		{
-			appendPQExpBufferChar(buf, ch);	/* double these */
+			appendPQExpBufferChar(buf, ch);		/* double these */
 			appendPQExpBufferChar(buf, ch);
 		}
 		else if ((unsigned char) ch < (unsigned char) ' ' &&
-				(		opts == CONV_ALL
-					|| 	(ch != '\n' && ch != '\t')
-				))
+				 (opts == CONV_ALL
+				  || (ch != '\n' && ch != '\t')
+				  ))
 		{
-			/* generate octal escape for control chars other than whitespace */
+
+			/*
+			 * generate octal escape for control chars other than
+			 * whitespace
+			 */
 			appendPQExpBufferChar(buf, '\\');
 			appendPQExpBufferChar(buf, ((ch >> 6) & 3) + '0');
 			appendPQExpBufferChar(buf, ((ch >> 3) & 7) + '0');
@@ -586,18 +601,18 @@ formatStringLiteral(PQExpBuffer buf, const char *str, const formatLiteralOptions
  */
 static void
 dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
-			const char *onlytable, const bool oids, const bool force_quotes)
+		 const char *onlytable, const bool oids, const bool force_quotes)
 {
 
-	int				i;
-	char	   		*all_only;
-	DataDumperPtr	dumpFn;
-	DumpContext		*dumpCtx;
-	char			*oidsPart;
-	char			copyBuf[512];
-	char			*copyStmt;
-
-	if (onlytable == NULL || (strlen(onlytable) == 0) )
+	int			i;
+	char	   *all_only;
+	DataDumperPtr dumpFn;
+	DumpContext *dumpCtx;
+	char	   *oidsPart;
+	char		copyBuf[512];
+	char	   *copyStmt;
+
+	if (onlytable == NULL || (strlen(onlytable) == 0))
 		all_only = "all";
 	else
 		all_only = "only";
@@ -611,9 +626,9 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
 	if (g_verbose)
 		fprintf(stderr, "%s preparing to dump out the contents of %s %d table%s/sequence%s %s\n",
 				g_comment_start, all_only,
-				(onlytable == NULL || (strlen(onlytable) == 0)) ? numTables : 1,
-				(onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "", 
-				(onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "",
+		 (onlytable == NULL || (strlen(onlytable) == 0)) ? numTables : 1,
+			  (onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "",
+			  (onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "",
 				g_comment_end);
 
 	for (i = 0; i < numTables; i++)
@@ -635,12 +650,12 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
 
 			/* becomeUser(fout, tblinfo[i].usename); */
 
-			dumpCtx = (DumpContext*)malloc(sizeof(DumpContext));
-			dumpCtx->tblinfo = (TableInfo*)tblinfo;
+			dumpCtx = (DumpContext *) malloc(sizeof(DumpContext));
+			dumpCtx->tblinfo = (TableInfo *) tblinfo;
 			dumpCtx->tblidx = i;
 			dumpCtx->oids = oids;
 
-			if (!dumpData) /* Dump/restore using COPY */
+			if (!dumpData)		/* Dump/restore using COPY */
 			{
 				dumpFn = dumpClasses_nodumpData;
 				/* dumpClasses_nodumpData(fout, classname, oids); */
@@ -648,7 +663,8 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
 						oidsPart);
 				copyStmt = copyBuf;
 			}
-			else /* Restore using INSERT */
+			else
+/* Restore using INSERT */
 			{
 				dumpFn = dumpClasses_dumpData;
 				/* dumpClasses_dumpData(fout, classname); */
@@ -656,8 +672,8 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
 			}
 
 			ArchiveEntry(fout, tblinfo[i].oid, tblinfo[i].relname,
-							"TABLE DATA", NULL, "", "", copyStmt, tblinfo[i].usename,
-							dumpFn, dumpCtx);
+				"TABLE DATA", NULL, "", "", copyStmt, tblinfo[i].usename,
+						 dumpFn, dumpCtx);
 		}
 	}
 }
@@ -685,14 +701,14 @@ main(int argc, char **argv)
 	int			outputBlobs = 0;
 	int			outputNoOwner = 0;
 	int			outputNoReconnect = 0;
-	char		*outputSuperuser = NULL;
+	char	   *outputSuperuser = NULL;
 
-	RestoreOptions	*ropt;
+	RestoreOptions *ropt;
 
 #ifdef HAVE_GETOPT_LONG
 	static struct option long_options[] = {
 		{"data-only", no_argument, NULL, 'a'},
-		{"blobs", no_argument, NULL, 'b' },
+		{"blobs", no_argument, NULL, 'b'},
 		{"clean", no_argument, NULL, 'c'},
 		{"create", no_argument, NULL, 'C'},
 		{"file", required_argument, NULL, 'f'},
@@ -744,12 +760,12 @@ main(int argc, char **argv)
 
 	if (argc > 1)
 	{
-		if (strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0)
+		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
 		{
 			help(progname);
 			exit(0);
 		}
-		if (strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0)
+		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
 		{
 			version();
 			exit(0);
@@ -774,10 +790,10 @@ main(int argc, char **argv)
 				break;
 
 			case 'c':			/* clean (i.e., drop) schema prior to
- 								 * create */
+								 * create */
 				outputClean = 1;
- 				break;
- 
+				break;
+
 			case 'C':			/* Create DB */
 
 				outputCreate = 1;
@@ -839,7 +855,8 @@ main(int argc, char **argv)
 				schemaOnly = true;
 				break;
 
-			case 'S':			/* Username for superuser in plain text output */
+			case 'S':			/* Username for superuser in plain text
+								 * output */
 				outputSuperuser = strdup(optarg);
 				break;
 
@@ -866,8 +883,11 @@ main(int argc, char **argv)
 							if (isupper((unsigned char) tablename[i]))
 								tablename[i] = tolower((unsigned char) tablename[i]);
 
-						/* '*' is a special case meaning ALL tables, but only if unquoted */
-						if (strcmp(tablename,"*") == 0)
+						/*
+						 * '*' is a special case meaning ALL tables, but
+						 * only if unquoted
+						 */
+						if (strcmp(tablename, "*") == 0)
 							tablename[0] = '\0';
 
 					}
@@ -898,7 +918,7 @@ main(int argc, char **argv)
 #ifndef HAVE_GETOPT_LONG
 			case '-':
 				fprintf(stderr, "%s was compiled without support for long options.\n"
-				   "Use --help for help on invocation options.\n", progname);
+				"Use --help for help on invocation options.\n", progname);
 				exit(1);
 				break;
 #endif
@@ -908,23 +928,24 @@ main(int argc, char **argv)
 		}
 	}
 
-	if (optind < (argc - 1)) {
+	if (optind < (argc - 1))
+	{
 		fprintf(stderr,
 				"%s: extra parameters found on command line after '%s' (first is '%s').\n"
-			    "Please respecify command.\nUse --help for help on invocation options.\n",
-				progname, argv[optind], argv[optind+1]);
+				"Please respecify command.\nUse --help for help on invocation options.\n",
+				progname, argv[optind], argv[optind + 1]);
 		exit(1);
 	}
 
 	if (dataOnly && schemaOnly)
 	{
 		fprintf(stderr,
-				"%s: 'Schema Only' and 'Data Only' are incompatible options.\n",
+		 "%s: 'Schema Only' and 'Data Only' are incompatible options.\n",
 				progname);
 		exit(1);
 	}
 
-	if (outputBlobs && tablename != NULL && strlen(tablename) > 0 )
+	if (outputBlobs && tablename != NULL && strlen(tablename) > 0)
 	{
 		fprintf(stderr,
 				"%s: BLOB output is not supported for a single table. Use all tables or a full dump instead.\n",
@@ -940,16 +961,17 @@ main(int argc, char **argv)
 		exit(1);
 	}
 
-	if (outputBlobs == true && (format[0] == 'p' || format[0] == 'P') )
+	if (outputBlobs == true && (format[0] == 'p' || format[0] == 'P'))
 	{
 		fprintf(stderr,
-			"%s: BLOB output is not supported for plain text dump files. Use a different output format.\n",
-			progname);
+				"%s: BLOB output is not supported for plain text dump files. Use a different output format.\n",
+				progname);
 		exit(1);
 	}
 
 	/* open the output file */
-	switch (format[0]) {
+	switch (format[0])
+	{
 
 		case 'c':
 		case 'C':
@@ -974,14 +996,14 @@ main(int argc, char **argv)
 
 		default:
 			fprintf(stderr,
-				"%s: invalid output format '%s' specified\n", progname, format);
-		    exit(1);	
+					"%s: invalid output format '%s' specified\n", progname, format);
+			exit(1);
 	}
 
 	if (g_fout == NULL)
 	{
 		fprintf(stderr,
-			 "%s: could not open output file named %s for writing\n",
+				"%s: could not open output file named %s for writing\n",
 				progname, filename);
 		exit(1);
 	}
@@ -991,7 +1013,10 @@ main(int argc, char **argv)
 
 	dbname = argv[optind];
 
-	/* Open the database using the Archiver, so it knows about it. Errors mean death */
+	/*
+	 * Open the database using the Archiver, so it knows about it. Errors
+	 * mean death
+	 */
 	g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, use_password, ignore_version);
 
 	/*
@@ -1002,14 +1027,14 @@ main(int argc, char **argv)
 
 		res = PQexec(g_conn, "begin");
 		if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
-		    exit_horribly(g_fout, "BEGIN command failed. Explanation from backend: '%s'.\n",
-				PQerrorMessage(g_conn));
+			exit_horribly(g_fout, "BEGIN command failed. Explanation from backend: '%s'.\n",
+						  PQerrorMessage(g_conn));
 
 		PQclear(res);
 		res = PQexec(g_conn, "set transaction isolation level serializable");
 		if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
-		    exit_horribly(g_fout, "SET TRANSACTION command failed. Explanation from backend: '%s'.\n",
-				PQerrorMessage(g_conn));
+			exit_horribly(g_fout, "SET TRANSACTION command failed. Explanation from backend: '%s'.\n",
+						  PQerrorMessage(g_conn));
 
 		PQclear(res);
 	}
@@ -1024,17 +1049,15 @@ main(int argc, char **argv)
 		setMaxOid(g_fout);
 
 	if (g_verbose)
-			fprintf(stderr, "%s last builtin oid is %u %s\n",
-					g_comment_start, g_last_builtin_oid, g_comment_end);
+		fprintf(stderr, "%s last builtin oid is %u %s\n",
+				g_comment_start, g_last_builtin_oid, g_comment_end);
 	tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsSkip, oids, schemaOnly, dataOnly);
 
 	if (!schemaOnly)
-	{
-	    dumpClasses(tblinfo, numTables, g_fout, tablename, oids, force_quotes);
-	}
+		dumpClasses(tblinfo, numTables, g_fout, tablename, oids, force_quotes);
 
 	if (outputBlobs)
-		ArchiveEntry(g_fout, "0", "BLOBS", "BLOBS", NULL, "", "", "", "", dumpBlobs, 0); 
+		ArchiveEntry(g_fout, "0", "BLOBS", "BLOBS", NULL, "", "", "", "", dumpBlobs, 0);
 
 	if (!dataOnly)				/* dump indexes and triggers at the end
 								 * for performance */
@@ -1054,10 +1077,10 @@ main(int argc, char **argv)
 	MoveToEnd(g_fout, "RULE");
 	MoveToEnd(g_fout, "SEQUENCE SET");
 
-	if (plainText) 
+	if (plainText)
 	{
 		ropt = NewRestoreOptions();
-		ropt->filename = (char*)filename;
+		ropt->filename = (char *) filename;
 		ropt->dropSchema = outputClean;
 		ropt->aclsSkip = aclsSkip;
 		ropt->superuser = outputSuperuser;
@@ -1071,9 +1094,9 @@ main(int argc, char **argv)
 			ropt->superuser = PQuser(g_conn);
 
 		if (compressLevel == -1)
-		    ropt->compression = 0;
+			ropt->compression = 0;
 		else
-		    ropt->compression = compressLevel;
+			ropt->compression = compressLevel;
 
 		RestoreArchive(g_fout, ropt);
 	}
@@ -1090,30 +1113,30 @@ main(int argc, char **argv)
  *	dump the database definition
  *
  */
-static int 
+static int
 dumpDatabase(Archive *AH)
 {
-	PQExpBuffer		dbQry = createPQExpBuffer();
-	PQExpBuffer		delQry = createPQExpBuffer();
-	PQExpBuffer		creaQry = createPQExpBuffer();
-	PGresult		*res;
-	int				ntups;
-	int				i_dba;
+	PQExpBuffer dbQry = createPQExpBuffer();
+	PQExpBuffer delQry = createPQExpBuffer();
+	PQExpBuffer creaQry = createPQExpBuffer();
+	PGresult   *res;
+	int			ntups;
+	int			i_dba;
 
 	if (g_verbose)
 		fprintf(stderr, "%s saving database definition\n", g_comment_start);
 
 	/* Get the dba */
 	appendPQExpBuffer(dbQry, "select (select usename from pg_user where datdba = usesysid) as dba from pg_database"
-							" where datname = ");
+					  " where datname = ");
 	formatStringLiteral(dbQry, PQdb(g_conn), CONV_ALL);
 
 	res = PQexec(g_conn, dbQry->data);
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		fprintf(stderr, "getDatabase(): SELECT failed.  Explanation from backend: '%s'.\n", 
-						PQerrorMessage(g_conn));
+		fprintf(stderr, "getDatabase(): SELECT failed.  Explanation from backend: '%s'.\n",
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -1129,10 +1152,10 @@ dumpDatabase(Archive *AH)
 	appendPQExpBuffer(delQry, "Drop Database \"%s\";\n", PQdb(g_conn));
 	i_dba = PQfnumber(res, "dba");
 
-	ArchiveEntry(AH, "0" /* OID */, PQdb(g_conn) /* Name */, "DATABASE", NULL, 
-						creaQry->data /* Create */, delQry->data /*Del*/,
-						"" /* Copy */, PQgetvalue(res, 0, i_dba) /*Owner*/, 
-						NULL /* Dumper */, NULL /* Dumper Arg */);	
+	ArchiveEntry(AH, "0" /* OID */ , PQdb(g_conn) /* Name */ , "DATABASE", NULL,
+				 creaQry->data /* Create */ , delQry->data /* Del */ ,
+				 "" /* Copy */ , PQgetvalue(res, 0, i_dba) /* Owner */ ,
+				 NULL /* Dumper */ , NULL /* Dumper Arg */ );
 
 	PQclear(res);
 
@@ -1146,47 +1169,48 @@ dumpDatabase(Archive *AH)
  *
  */
 
-#define loBufSize 16384 
+#define loBufSize 16384
 #define loFetchSize 1000
 
-static int 
-dumpBlobs(Archive *AH, char* junkOid, void *junkVal)
+static int
+dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
 {
-	PQExpBuffer		oidQry = createPQExpBuffer();
-	PQExpBuffer		oidFetchQry = createPQExpBuffer();
-	PGresult		*res;
-	int				i;
-	int				loFd;
-	char			buf[loBufSize];
-	int				cnt;
-	int				blobOid;
+	PQExpBuffer oidQry = createPQExpBuffer();
+	PQExpBuffer oidFetchQry = createPQExpBuffer();
+	PGresult   *res;
+	int			i;
+	int			loFd;
+	char		buf[loBufSize];
+	int			cnt;
+	int			blobOid;
 
 	if (g_verbose)
 		fprintf(stderr, "%s saving BLOBs\n", g_comment_start);
 
 	/* Cursor to get all BLOB tables */
-    appendPQExpBuffer(oidQry, "Declare blobOid Cursor for SELECT DISTINCT loid FROM pg_largeobject");
+	appendPQExpBuffer(oidQry, "Declare blobOid Cursor for SELECT DISTINCT loid FROM pg_largeobject");
 
 	res = PQexec(g_conn, oidQry->data);
 	if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
 	{
-		fprintf(stderr, "dumpBlobs(): Declare Cursor failed.  Explanation from backend: '%s'.\n", 
-										PQerrorMessage(g_conn));
+		fprintf(stderr, "dumpBlobs(): Declare Cursor failed.  Explanation from backend: '%s'.\n",
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
 	/* Fetch for cursor */
 	appendPQExpBuffer(oidFetchQry, "Fetch %d in blobOid", loFetchSize);
 
-	do {
+	do
+	{
 		/* Do a fetch */
 		PQclear(res);
 		res = PQexec(g_conn, oidFetchQry->data);
 
 		if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
 		{
-		    fprintf(stderr, "dumpBlobs(): Fetch Cursor failed.  Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
-		    exit_nicely(g_conn);
+			fprintf(stderr, "dumpBlobs(): Fetch Cursor failed.  Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			exit_nicely(g_conn);
 		}
 
 		/* Process the tuples, if any */
@@ -1198,22 +1222,24 @@ dumpBlobs(Archive *AH, char* junkOid, void *junkVal)
 			if (loFd == -1)
 			{
 				fprintf(stderr, "dumpBlobs(): Could not open large object.  "
-									"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+						"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 				exit_nicely(g_conn);
 			}
 
 			StartBlob(AH, blobOid);
 
 			/* Now read it in chunks, sending data to archive */
-			do {
+			do
+			{
 				cnt = lo_read(g_conn, loFd, buf, loBufSize);
-				if (cnt < 0) {
+				if (cnt < 0)
+				{
 					fprintf(stderr, "dumpBlobs(): Error reading large object. "
-								" Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+							" Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 					exit_nicely(g_conn);
 				}
 
-				WriteData(AH, buf, cnt); 
+				WriteData(AH, buf, cnt);
 
 			} while (cnt > 0);
 
@@ -1273,11 +1299,11 @@ getTypes(int *numTypes)
 	 */
 
 	appendPQExpBuffer(query, "SELECT pg_type.oid, typowner, typname, typlen, typprtlen, "
-		"typinput, typoutput, typreceive, typsend, typelem, typdelim, "
-		"typdefault, typrelid, typbyval, "
-		"(select usename from pg_user where typowner = usesysid) as usename, "
-		"format_type(pg_type.oid, NULL) as typedefn "
-		"from pg_type" );
+		  "typinput, typoutput, typreceive, typsend, typelem, typdelim, "
+					  "typdefault, typrelid, typbyval, "
+	"(select usename from pg_user where typowner = usesysid) as usename, "
+					  "format_type(pg_type.oid, NULL) as typedefn "
+					  "from pg_type");
 
 	res = PQexec(g_conn, query->data);
 	if (!res ||
@@ -1327,7 +1353,7 @@ getTypes(int *numTypes)
 		tinfo[i].typedefn = strdup(PQgetvalue(res, i, i_typedefn));
 
 		if (strlen(tinfo[i].usename) == 0)
-			fprintf(stderr, "WARNING: owner of type '%s' appears to be invalid\n",tinfo[i].typname);
+			fprintf(stderr, "WARNING: owner of type '%s' appears to be invalid\n", tinfo[i].typname);
 
 		if (strcmp(PQgetvalue(res, i, i_typbyval), "f") == 0)
 			tinfo[i].passedbyvalue = 0;
@@ -1392,9 +1418,9 @@ getOperators(int *numOprs)
 
 	appendPQExpBuffer(query, "SELECT pg_operator.oid, oprname, oprkind, oprcode, "
 			   "oprleft, oprright, oprcom, oprnegate, oprrest, oprjoin, "
-					"oprcanhash, oprlsortop, oprrsortop, "
-					"(select usename from pg_user where oprowner = usesysid) as usename "
-					"from pg_operator");
+					  "oprcanhash, oprlsortop, oprrsortop, "
+	"(select usename from pg_user where oprowner = usesysid) as usename "
+					  "from pg_operator");
 
 	res = PQexec(g_conn, query->data);
 	if (!res ||
@@ -1443,7 +1469,7 @@ getOperators(int *numOprs)
 
 		if (strlen(oprinfo[i].usename) == 0)
 			fprintf(stderr, "WARNING: owner of operator '%s' appears to be invalid\n",
-						oprinfo[i].oprname);
+					oprinfo[i].oprname);
 
 	}
 
@@ -1553,8 +1579,9 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
 				free(tblinfo[i].typnames[j]);
 		}
 
-		if (tblinfo[i].triggers) {
-			for (j = 0; j < tblinfo[i].ntrig ; j++)
+		if (tblinfo[i].triggers)
+		{
+			for (j = 0; j < tblinfo[i].ntrig; j++)
 			{
 				if (tblinfo[i].triggers[j].tgsrc)
 					free(tblinfo[i].triggers[j].tgsrc);
@@ -1738,18 +1765,18 @@ getAggregates(int *numAggs)
 	/* find all user-defined aggregates */
 
 	appendPQExpBuffer(query,
-						"SELECT pg_aggregate.oid, aggname, aggtransfn, "
-						"aggfinalfn, aggtranstype, aggbasetype, "
-						"agginitval, "
-						"(select usename from pg_user where aggowner = usesysid) as usename "
-						"from pg_aggregate" );
+					  "SELECT pg_aggregate.oid, aggname, aggtransfn, "
+					  "aggfinalfn, aggtranstype, aggbasetype, "
+					  "agginitval, "
+	"(select usename from pg_user where aggowner = usesysid) as usename "
+					  "from pg_aggregate");
 
 	res = PQexec(g_conn, query->data);
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
 		fprintf(stderr, "getAggregates(): SELECT failed.  Explanation from backend: '%s'.\n",
-					PQerrorMessage(g_conn));
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -1779,7 +1806,7 @@ getAggregates(int *numAggs)
 		agginfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
 		if (strlen(agginfo[i].usename) == 0)
 			fprintf(stderr, "WARNING: owner of aggregate '%s' appears to be invalid\n",
-						agginfo[i].aggname);
+					agginfo[i].aggname);
 
 	}
 
@@ -1824,18 +1851,18 @@ getFuncs(int *numFuncs)
 	appendPQExpBuffer(query,
 		   "SELECT pg_proc.oid, proname, prolang, pronargs, prorettype, "
 					  "proretset, proargtypes, prosrc, probin, "
-					  "(select usename from pg_user where proowner = usesysid) as usename, "
+	"(select usename from pg_user where proowner = usesysid) as usename, "
 					  "proiscachable, proisstrict "
 					  "from pg_proc "
-				 "where pg_proc.oid > '%u'::oid",
+					  "where pg_proc.oid > '%u'::oid",
 					  g_last_builtin_oid);
 
 	res = PQexec(g_conn, query->data);
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		fprintf(stderr, "getFuncs(): SELECT failed.  Explanation from backend: '%s'.\n", 
-					PQerrorMessage(g_conn));
+		fprintf(stderr, "getFuncs(): SELECT failed.  Explanation from backend: '%s'.\n",
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -1873,12 +1900,12 @@ getFuncs(int *numFuncs)
 		finfo[i].nargs = atoi(PQgetvalue(res, i, i_pronargs));
 		finfo[i].lang = atoi(PQgetvalue(res, i, i_prolang));
 		finfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
-		finfo[i].iscachable = (strcmp(PQgetvalue(res, i, i_iscachable),"t") == 0);
-		finfo[i].isstrict = (strcmp(PQgetvalue(res, i, i_isstrict),"t") == 0);
+		finfo[i].iscachable = (strcmp(PQgetvalue(res, i, i_iscachable), "t") == 0);
+		finfo[i].isstrict = (strcmp(PQgetvalue(res, i, i_isstrict), "t") == 0);
 
 		if (strlen(finfo[i].usename) == 0)
 			fprintf(stderr, "WARNING: owner of function '%s' appears to be invalid\n",
-						finfo[i].proname);
+					finfo[i].proname);
 
 		if (finfo[i].nargs < 0 || finfo[i].nargs > FUNC_MAX_ARGS)
 		{
@@ -1941,21 +1968,21 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 	 */
 
 	appendPQExpBuffer(query,
-			   "SELECT pg_class.oid, relname, relkind, relacl, "
-					  "(select usename from pg_user where relowner = usesysid) as usename, "
+					  "SELECT pg_class.oid, relname, relkind, relacl, "
+	"(select usename from pg_user where relowner = usesysid) as usename, "
 					  "relchecks, reltriggers, relhasindex "
 					  "from pg_class "
 					  "where relname !~ '^pg_' "
 					  "and relkind in ('%c', '%c', '%c') "
 					  "order by oid",
-				RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
+					  RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
 
 	res = PQexec(g_conn, query->data);
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		fprintf(stderr, "getTables(): SELECT failed.  Explanation from backend: '%s'.\n", 
-					PQerrorMessage(g_conn));
+		fprintf(stderr, "getTables(): SELECT failed.  Explanation from backend: '%s'.\n",
+				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -1986,7 +2013,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 
 		if (strlen(tblinfo[i].usename) == 0)
 			fprintf(stderr, "WARNING: owner of table '%s' appears to be invalid\n",
-						tblinfo[i].relname);
+					tblinfo[i].relname);
 
 		/* Get view definition */
 		if (strcmp(PQgetvalue(res, i, i_relkind), relkindview) == 0)
@@ -2001,30 +2028,32 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 			if (!res2 || PQresultStatus(res2) != PGRES_TUPLES_OK)
 			{
 				fprintf(stderr, "getTables(): SELECT (for VIEW DEFINITION) failed.  "
-							"Explanation from backend: %s",
-							PQerrorMessage(g_conn));
+						"Explanation from backend: %s",
+						PQerrorMessage(g_conn));
 				exit_nicely(g_conn);
 			}
 
-			if (PQntuples(res2) != 1) 
+			if (PQntuples(res2) != 1)
 			{
 				if (PQntuples(res2) < 1)
 				{
 					fprintf(stderr, "getTables(): SELECT (for VIEW %s) returned no definitions",
-								tblinfo[i].relname);
-				} else {
+							tblinfo[i].relname);
+				}
+				else
+				{
 					fprintf(stderr, "getTables(): SELECT (for VIEW %s) returned more than 1 definition",
-								tblinfo[i].relname);
+							tblinfo[i].relname);
 				}
 				exit_nicely(g_conn);
 			}
 
 			tblinfo[i].viewdef = strdup(PQgetvalue(res2, 0, 0));
 
-			if (strlen(tblinfo[i].viewdef) == 0) 
+			if (strlen(tblinfo[i].viewdef) == 0)
 			{
 				fprintf(stderr, "getTables(): SELECT (for VIEW %s) returned empty definition",
-							tblinfo[i].relname);
+						tblinfo[i].relname);
 				exit_nicely(g_conn);
 			}
 		}
@@ -2048,7 +2077,10 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 						tblinfo[i].relname,
 						g_comment_end);
 
-			/* XXXX: Use LOJ maybe - need to compare with subsequent query for non-inherited */
+			/*
+			 * XXXX: Use LOJ maybe - need to compare with subsequent query
+			 * for non-inherited
+			 */
 			resetPQExpBuffer(query);
 			appendPQExpBuffer(query, "SELECT rcname from pg_relcheck, pg_inherits as i "
 							  "where rcrelid = '%s'::oid "
@@ -2064,7 +2096,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 				PQresultStatus(res2) != PGRES_TUPLES_OK)
 			{
 				fprintf(stderr, "getTables(): SELECT (for inherited CHECK) failed.  "
-							"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+						"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 				exit_nicely(g_conn);
 			}
 			ntups2 = PQntuples(res2);
@@ -2158,17 +2190,17 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 				exit_nicely(g_conn);
 			}
 
-			if (PQntuples(res2) > 1) {
+			if (PQntuples(res2) > 1)
+			{
 				fprintf(stderr, "getTables(): SELECT (for PRIMARY KEY) produced more than one row on table %s.\n",
 						tblinfo[i].relname);
 				exit_nicely(g_conn);
 			}
 
-			if (PQntuples(res2) == 1) {
+			if (PQntuples(res2) == 1)
 				tblinfo[i].pkIndexOid = strdup(PQgetvalue(res2, 0, 0));
-			} else {
+			else
 				tblinfo[i].pkIndexOid = NULL;
-			}
 
 		}
 		else
@@ -2178,7 +2210,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 		if (tblinfo[i].pkIndexOid != NULL)
 		{
 			PGresult   *res2;
-			int		   n;
+			int			n;
 
 			resetPQExpBuffer(query);
 			appendPQExpBuffer(query,
@@ -2200,7 +2232,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 			{
 				fprintf(stderr,
 						"getTables(): SELECT (for PRIMARY KEY NAME) failed for table %s. "
-							"This is impossible but object with OID == %s have %d primary keys.\n",
+						"This is impossible but object with OID == %s have %d primary keys.\n",
 						tblinfo[i].relname,
 						tblinfo[i].oid,
 						n);
@@ -2210,7 +2242,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 			/* Sanity check on LOJ */
 			if (PQgetisnull(res2, 0, 0))
 			{
-				fprintf(stderr,"getTables(): SELECT (for PRIMARY KEY NAME) on table %s returned NULL value.\n",
+				fprintf(stderr, "getTables(): SELECT (for PRIMARY KEY NAME) on table %s returned NULL value.\n",
 						tblinfo[i].relname);
 				exit_nicely(g_conn);
 			}
@@ -2259,7 +2291,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 				PQresultStatus(res2) != PGRES_TUPLES_OK)
 			{
 				fprintf(stderr, "getTables(): SELECT (for TRIGGER) failed.  "
-							"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+						"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 				exit_nicely(g_conn);
 			}
 			ntups2 = PQntuples(res2);
@@ -2280,7 +2312,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 			i_tgdeferrable = PQfnumber(res2, "tgdeferrable");
 			i_tginitdeferred = PQfnumber(res2, "tginitdeferred");
 
-			tblinfo[i].triggers = (TrigInfo*) malloc(ntups2 * sizeof(TrigInfo));
+			tblinfo[i].triggers = (TrigInfo *) malloc(ntups2 * sizeof(TrigInfo));
 			resetPQExpBuffer(query);
 			for (i2 = 0; i2 < ntups2; i2++)
 			{
@@ -2339,16 +2371,17 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 					r = PQexec(g_conn, query->data);
 					if (!r || PQresultStatus(r) != PGRES_TUPLES_OK)
 					{
-						fprintf(stderr, "getTables(): SELECT (funcname) failed for trigger %s.  Explanation from backend: '%s'.\n", 
-									PQgetvalue(res2, i2, i_tgname), PQerrorMessage(g_conn));
+						fprintf(stderr, "getTables(): SELECT (funcname) failed for trigger %s.  Explanation from backend: '%s'.\n",
+								PQgetvalue(res2, i2, i_tgname), PQerrorMessage(g_conn));
 						exit_nicely(g_conn);
 					}
 
 					/* Sanity: Check we got only one tuple */
 					numFuncs = PQntuples(r);
-					if (numFuncs != 1) {
-						fprintf(stderr, "getTables(): SELECT (funcname) for trigger %s returned %d tuples. Expected 1.\n", 
-									PQgetvalue(res2, i2, i_tgname), numFuncs);
+					if (numFuncs != 1)
+					{
+						fprintf(stderr, "getTables(): SELECT (funcname) for trigger %s returned %d tuples. Expected 1.\n",
+								PQgetvalue(res2, i2, i_tgname), numFuncs);
 						exit_nicely(g_conn);
 					}
 
@@ -2359,10 +2392,10 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 					tgfunc = strdup(finfo[findx].proname);
 
 				appendPQExpBuffer(delqry, "DROP TRIGGER %s ",
-									fmtId(PQgetvalue(res2, i2, i_tgname),
-									force_quotes));
+								  fmtId(PQgetvalue(res2, i2, i_tgname),
+										force_quotes));
 				appendPQExpBuffer(delqry, "ON %s;\n",
-									fmtId(tblinfo[i].relname, force_quotes));
+								fmtId(tblinfo[i].relname, force_quotes));
 
 				resetPQExpBuffer(query);
 				if (tgisconstraint)
@@ -2469,7 +2502,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 								fmtId(tblinfo[i].relname, force_quotes));
 				tblinfo[i].triggers[i2].tgcomment = strdup(query->data);
 				tblinfo[i].triggers[i2].oid = strdup(PQgetvalue(res2, i2, i_tgoid));
-				tblinfo[i].triggers[i2].tgname = strdup(fmtId(PQgetvalue(res2, i2, i_tgname),false));
+				tblinfo[i].triggers[i2].tgname = strdup(fmtId(PQgetvalue(res2, i2, i_tgname), false));
 				tblinfo[i].triggers[i2].tgdel = strdup(delqry->data);
 
 				if (tgfunc)
@@ -2478,9 +2511,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
 			PQclear(res2);
 		}
 		else
-		{
 			tblinfo[i].triggers = NULL;
-		}
 
 	}
 
@@ -2519,7 +2550,7 @@ getInherits(int *numInherits)
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		fprintf(stderr, "getInherits(): SELECT failed.  Explanation from backend: '%s'.\n", 
+		fprintf(stderr, "getInherits(): SELECT failed.  Explanation from backend: '%s'.\n",
 				PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
@@ -2592,7 +2623,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
 		appendPQExpBuffer(q, "SELECT a.oid as attoid, a.attnum, a.attname, t.typname, a.atttypmod, "
 						  "a.attnotnull, a.atthasdef, format_type(a.atttypid, a.atttypmod) as atttypedefn "
 						  "from pg_attribute a LEFT OUTER JOIN pg_type t ON a.atttypid = t.oid "
-				   "where a.attrelid = '%s'::oid "
+						  "where a.attrelid = '%s'::oid "
 						  "and a.attnum > 0 order by attnum",
 						  tblinfo[i].oid);
 		res = PQexec(g_conn, q->data);
@@ -2600,7 +2631,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
 			PQresultStatus(res) != PGRES_TUPLES_OK)
 		{
 			fprintf(stderr, "getTableAttrs(): SELECT failed.  "
-					"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 			exit_nicely(g_conn);
 		}
 
@@ -2670,9 +2701,10 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
 
 				/* Sanity: Check we got only one tuple */
 				numAttr = PQntuples(res2);
-				if (numAttr != 1) {
-					fprintf(stderr, "getTableAttrs(): SELECT (for DEFAULT) for attr %s returned %d tuples. Expected 1.\n", 
-										tblinfo[i].attnames[j], numAttr);
+				if (numAttr != 1)
+				{
+					fprintf(stderr, "getTableAttrs(): SELECT (for DEFAULT) for attr %s returned %d tuples. Expected 1.\n",
+							tblinfo[i].attnames[j], numAttr);
 					exit_nicely(g_conn);
 				}
 
@@ -2730,7 +2762,7 @@ getIndices(int *numIndices)
 	appendPQExpBuffer(query,
 					  "SELECT i.oid, t1.oid as indoid, t1.relname as indexrelname, t2.relname as indrelname, "
 					  "i.indproc, i.indkey, i.indclass, "
-					  "a.amname as indamname, i.indisunique, i.indisprimary "
+				  "a.amname as indamname, i.indisunique, i.indisprimary "
 					"from pg_index i, pg_class t1, pg_class t2, pg_am a "
 				   "WHERE t1.oid = i.indexrelid and t2.oid = i.indrelid "
 					  "and t1.relam = a.oid and i.indexrelid > '%u'::oid "
@@ -2742,7 +2774,7 @@ getIndices(int *numIndices)
 		PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
 		fprintf(stderr, "getIndices(): SELECT failed.  "
-					"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -2833,8 +2865,8 @@ dumpComment(Archive *fout, const char *target, const char *oid)
 		formatStringLiteral(query, PQgetvalue(res, 0, i_description), PASS_LFTAB);
 		appendPQExpBuffer(query, ";\n");
 
-		ArchiveEntry(fout, oid, target, "COMMENT", NULL, query->data, "" /*Del*/,
-					   "" /* Copy */, "" /*Owner*/, NULL, NULL);	
+		ArchiveEntry(fout, oid, target, "COMMENT", NULL, query->data, "" /* Del */ ,
+					 "" /* Copy */ , "" /* Owner */ , NULL, NULL);
 
 	}
 
@@ -2905,7 +2937,7 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
 {
 	int			i;
 	PQExpBuffer q = createPQExpBuffer();
-	PQExpBuffer	delq = createPQExpBuffer();
+	PQExpBuffer delq = createPQExpBuffer();
 	int			funcInd;
 
 	for (i = 0; i < numTypes; i++)
@@ -2979,7 +3011,7 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
 			appendPQExpBuffer(q, ");\n");
 
 		ArchiveEntry(fout, tinfo[i].oid, tinfo[i].typname, "TYPE", NULL,
-						q->data, delq->data, "", tinfo[i].usename, NULL, NULL);
+				  q->data, delq->data, "", tinfo[i].usename, NULL, NULL);
 
 		/*** Dump Type Comments ***/
 
@@ -3054,7 +3086,7 @@ dumpProcLangs(Archive *fout, FuncInfo *finfo, int numFuncs,
 		if (fidx >= numFuncs)
 		{
 			fprintf(stderr, "dumpProcLangs(): handler procedure for "
-						"language %s not found\n", PQgetvalue(res, i, i_lanname));
+			   "language %s not found\n", PQgetvalue(res, i, i_lanname));
 			exit_nicely(g_conn);
 		}
 
@@ -3077,7 +3109,7 @@ dumpProcLangs(Archive *fout, FuncInfo *finfo, int numFuncs,
 		appendPQExpBuffer(defqry, ";\n");
 
 		ArchiveEntry(fout, PQgetvalue(res, i, i_oid), lanname, "PROCEDURAL LANGUAGE",
-			    NULL, defqry->data, delqry->data, "", "", NULL, NULL);
+				   NULL, defqry->data, delqry->data, "", "", NULL, NULL);
 
 		resetPQExpBuffer(defqry);
 		resetPQExpBuffer(delqry);
@@ -3125,10 +3157,10 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 	int			i_lanname;
 	char		query[256];
 
-	char		*listSep;
-	char		*listSepComma = ",";
-	char		*listSepNone = "";
-	char		*rettypename;
+	char	   *listSep;
+	char	   *listSepComma = ",";
+	char	   *listSepNone = "";
+	char	   *rettypename;
 
 	if (finfo[i].dumped)
 		return;
@@ -3142,23 +3174,23 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 	res = PQexec(g_conn, query);
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK)
-  	{
+	{
 		fprintf(stderr, "dumpOneFunc(): SELECT for procedural language failed.  Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
-  	}
+	}
 	nlangs = PQntuples(res);
 
 	if (nlangs != 1)
-  	{
+	{
 		fprintf(stderr, "dumpOneFunc(): procedural language for function %s not found\n", finfo[i].proname);
 		exit_nicely(g_conn);
-  	}
-  
+	}
+
 	i_lanname = PQfnumber(res, "lanname");
 
 	/*
-	 * See backend/commands/define.c for details of how the 'AS' clause
-	 * is used.
+	 * See backend/commands/define.c for details of how the 'AS' clause is
+	 * used.
 	 */
 	if (strcmp(finfo[i].probin, "-") != 0)
 	{
@@ -3180,14 +3212,14 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 	}
 
 	strcpy(func_lang, PQgetvalue(res, 0, i_lanname));
-  
+
 	PQclear(res);
- 
+
 	resetPQExpBuffer(fn);
 	appendPQExpBuffer(fn, "%s (", fmtId(finfo[i].proname, force_quotes));
 	for (j = 0; j < finfo[i].nargs; j++)
 	{
-		char			*typname;
+		char	   *typname;
 
 		typname = findTypeByOid(tinfo, numTypes, finfo[i].argtypes[j], zeroAsOpaque);
 		if (typname == NULL)
@@ -3205,17 +3237,17 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 			return;
 		}
 
-		appendPQExpBuffer(fn, "%s%s", 
-							(j > 0) ? "," : "", 
-							typname);
+		appendPQExpBuffer(fn, "%s%s",
+						  (j > 0) ? "," : "",
+						  typname);
 		appendPQExpBuffer(fnlist, "%s%s",
-							(j > 0) ? "," : "", 
-							typname );
+						  (j > 0) ? "," : "",
+						  typname);
 	}
 	appendPQExpBuffer(fn, ")");
 
 	resetPQExpBuffer(delqry);
-	appendPQExpBuffer(delqry, "DROP FUNCTION %s;\n", fn->data );
+	appendPQExpBuffer(delqry, "DROP FUNCTION %s;\n", fn->data);
 
 	rettypename = findTypeByOid(tinfo, numTypes, finfo[i].prorettype, zeroAsOpaque);
 
@@ -3226,33 +3258,35 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 
 		fprintf(stderr, "Reason: return type name (oid %s) not found.\n",
 				finfo[i].prorettype);
-			resetPQExpBuffer(q);
-			resetPQExpBuffer(fn);
-			resetPQExpBuffer(delqry);
-			resetPQExpBuffer(fnlist);
-			resetPQExpBuffer(asPart);
-			return;
+		resetPQExpBuffer(q);
+		resetPQExpBuffer(fn);
+		resetPQExpBuffer(delqry);
+		resetPQExpBuffer(fnlist);
+		resetPQExpBuffer(asPart);
+		return;
 	}
 
 	resetPQExpBuffer(q);
-	appendPQExpBuffer(q, "CREATE FUNCTION %s ", fn->data );
+	appendPQExpBuffer(q, "CREATE FUNCTION %s ", fn->data);
 	appendPQExpBuffer(q, "RETURNS %s%s %s LANGUAGE ",
 					  (finfo[i].retset) ? "SETOF " : "",
 					  rettypename,
 					  asPart->data);
 	formatStringLiteral(q, func_lang, CONV_ALL);
 
-	if (finfo[i].iscachable || finfo[i].isstrict) /* OR in new attrs here */
+	if (finfo[i].iscachable || finfo[i].isstrict)		/* OR in new attrs here */
 	{
 		appendPQExpBuffer(q, " WITH (");
 		listSep = listSepNone;
 
-		if (finfo[i].iscachable) {
+		if (finfo[i].iscachable)
+		{
 			appendPQExpBuffer(q, "%s iscachable", listSep);
 			listSep = listSepComma;
 		}
 
-		if (finfo[i].isstrict) {
+		if (finfo[i].isstrict)
+		{
 			appendPQExpBuffer(q, "%s isstrict", listSep);
 			listSep = listSepComma;
 		}
@@ -3262,7 +3296,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
 	appendPQExpBuffer(q, ";\n");
 
 	ArchiveEntry(fout, finfo[i].oid, fn->data, "FUNCTION", NULL, q->data, delqry->data,
-					"", finfo[i].usename, NULL, NULL);
+				 "", finfo[i].usename, NULL, NULL);
 
 	/*** Dump Function Comments ***/
 
@@ -3303,7 +3337,7 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 
 	for (i = 0; i < numOperators; i++)
 	{
-	    char *name;
+		char	   *name;
 
 		resetPQExpBuffer(leftarg);
 		resetPQExpBuffer(rightarg);
@@ -3332,21 +3366,21 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 		if (strcmp(oprinfo[i].oprkind, "r") == 0 ||
 			strcmp(oprinfo[i].oprkind, "b") == 0)
 		{
-		    name = findTypeByOid(tinfo, numTypes, 
-								  oprinfo[i].oprleft, zeroAsOpaque);
+			name = findTypeByOid(tinfo, numTypes,
+								 oprinfo[i].oprleft, zeroAsOpaque);
 			if (name == NULL)
 			{
 				OPR_NOTICE(oprleft);
 				continue;
 			}
-			appendPQExpBuffer(leftarg, ",\n\tLEFTARG = %s ",name);
+			appendPQExpBuffer(leftarg, ",\n\tLEFTARG = %s ", name);
 		}
 
 		if (strcmp(oprinfo[i].oprkind, "l") == 0 ||
 			strcmp(oprinfo[i].oprkind, "b") == 0)
 		{
-		    name = findTypeByOid(tinfo, numTypes, 
-								  oprinfo[i].oprright, zeroAsOpaque);
+			name = findTypeByOid(tinfo, numTypes,
+								 oprinfo[i].oprright, zeroAsOpaque);
 			if (name == NULL)
 			{
 				OPR_NOTICE(oprright);
@@ -3385,7 +3419,7 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 
 		if (!(strcmp(oprinfo[i].oprlsortop, "0") == 0))
 		{
-			name = 	findOprByOid(oprinfo, numOperators, oprinfo[i].oprlsortop);
+			name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprlsortop);
 			if (name == NULL)
 			{
 				OPR_NOTICE(oprlsortop);
@@ -3396,7 +3430,7 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 
 		if (!(strcmp(oprinfo[i].oprrsortop, "0") == 0))
 		{
-			name = 	findOprByOid(oprinfo, numOperators, oprinfo[i].oprrsortop);
+			name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprrsortop);
 			if (name == NULL)
 			{
 				OPR_NOTICE(oprrsortop);
@@ -3407,9 +3441,9 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 
 		resetPQExpBuffer(delq);
 		appendPQExpBuffer(delq, "DROP OPERATOR %s (%s", oprinfo[i].oprname,
-					findTypeByOid(tinfo, numTypes, oprinfo[i].oprleft, zeroAsOpaque) );
+		findTypeByOid(tinfo, numTypes, oprinfo[i].oprleft, zeroAsOpaque));
 		appendPQExpBuffer(delq, ", %s);\n",
-					findTypeByOid(tinfo, numTypes, oprinfo[i].oprright, zeroAsOpaque) );
+						  findTypeByOid(tinfo, numTypes, oprinfo[i].oprright, zeroAsOpaque));
 
 		resetPQExpBuffer(q);
 		appendPQExpBuffer(q,
@@ -3422,13 +3456,13 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
 						  commutator->data,
 						  negator->data,
 						  restrictor->data,
-						(strcmp(oprinfo[i].oprcanhash, "t") == 0) ? ",\n\tHASHES" : "",
+		  (strcmp(oprinfo[i].oprcanhash, "t") == 0) ? ",\n\tHASHES" : "",
 						  join->data,
 						  sort1->data,
 						  sort2->data);
 
 		ArchiveEntry(fout, oprinfo[i].oid, oprinfo[i].oprname, "OPERATOR", NULL,
-						q->data, delq->data, "", oprinfo[i].usename, NULL, NULL);
+				q->data, delq->data, "", oprinfo[i].usename, NULL, NULL);
 	}
 }
 
@@ -3455,7 +3489,7 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
 
 	for (i = 0; i < numAggs; i++)
 	{
-		char *name;
+		char	   *name;
 
 		resetPQExpBuffer(details);
 
@@ -3493,7 +3527,7 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
 
 		resetPQExpBuffer(aggSig);
 		appendPQExpBuffer(aggSig, "%s %s", agginfo[i].aggname,
-							findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype, zeroAsOpaque + useBaseTypeName));
+						  findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype, zeroAsOpaque + useBaseTypeName));
 
 		resetPQExpBuffer(delq);
 		appendPQExpBuffer(delq, "DROP AGGREGATE %s;\n", aggSig->data);
@@ -3504,7 +3538,7 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
 						  details->data);
 
 		ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "AGGREGATE", NULL,
-						q->data, delq->data, "", agginfo[i].usename, NULL, NULL);
+				q->data, delq->data, "", agginfo[i].usename, NULL, NULL);
 
 		/*** Dump Aggregate Comments ***/
 
@@ -3564,19 +3598,22 @@ GetPrivileges(const char *s)
 }
 
 /*
- * The name says it all; a function to append a string is the dest 
+ * The name says it all; a function to append a string is the dest
  * is big enough. If not, it does a realloc.
  */
-static void strcatalloc(char **dest, int *dSize, char *src)
+static void
+strcatalloc(char **dest, int *dSize, char *src)
 {
-    int dLen = strlen(*dest);
-    int sLen = strlen(src);
-    if ( (dLen + sLen) >= *dSize) {
-	*dSize = (dLen + sLen) * 2;
-	*dest = realloc(*dest, *dSize);
-    }
-    strcpy(*dest + dLen, src);
-} 
+	int			dLen = strlen(*dest);
+	int			sLen = strlen(src);
+
+	if ((dLen + sLen) >= *dSize)
+	{
+		*dSize = (dLen + sLen) * 2;
+		*dest = realloc(*dest, *dSize);
+	}
+	strcpy(*dest + dLen, src);
+}
 
 
 /*
@@ -3588,14 +3625,14 @@ static void strcatalloc(char **dest, int *dSize, char *src)
 static void
 dumpACL(Archive *fout, TableInfo tbinfo)
 {
-	const char 	*acls = tbinfo.relacl;
-	char	   	*aclbuf,
+	const char *acls = tbinfo.relacl;
+	char	   *aclbuf,
 			   *tok,
 			   *eqpos,
 			   *priv;
-	char		*sql;
+	char	   *sql;
 	char		tmp[1024];
-	int		sSize = 4096;
+	int			sSize = 4096;
 
 	if (strlen(acls) == 0)
 		return;					/* table has default permissions */
@@ -3603,13 +3640,13 @@ dumpACL(Archive *fout, TableInfo tbinfo)
 	/*
 	 * Allocate a larginsh buffer for the output SQL.
 	 */
-	sql = (char*)malloc(sSize);
+	sql = (char *) malloc(sSize);
 
 	/*
 	 * Revoke Default permissions for PUBLIC. Is this actually necessary,
 	 * or is it just a waste of time?
 	 */
-	sprintf(sql,	"REVOKE ALL on %s from PUBLIC;\n",
+	sprintf(sql, "REVOKE ALL on %s from PUBLIC;\n",
 			fmtId(tbinfo.relname, force_quotes));
 
 	/* Make a working copy of acls so we can use strtok */
@@ -3644,7 +3681,7 @@ dumpACL(Archive *fout, TableInfo tbinfo)
 		priv = GetPrivileges(eqpos + 1);
 		if (*priv)
 		{
-			sprintf(tmp,	"GRANT %s on %s to ",
+			sprintf(tmp, "GRANT %s on %s to ",
 					priv, fmtId(tbinfo.relname, force_quotes));
 			strcatalloc(&sql, &sSize, tmp);
 
@@ -3770,13 +3807,13 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
 
 						/* Attr name & type */
 						appendPQExpBuffer(q, "%s %s",
-							fmtId(tblinfo[i].attnames[j], force_quotes),
-							tblinfo[i].atttypedefns[j]);
+							 fmtId(tblinfo[i].attnames[j], force_quotes),
+										  tblinfo[i].atttypedefns[j]);
 
 						/* Default value */
 						if (tblinfo[i].adef_expr[j] != NULL)
 							appendPQExpBuffer(q, " DEFAULT %s",
-										  tblinfo[i].adef_expr[j]);
+											  tblinfo[i].adef_expr[j]);
 
 						/* Not Null constraint */
 						if (tblinfo[i].notnull[j])
@@ -3795,31 +3832,31 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
 						appendPQExpBuffer(q, ",\n\t");
 
 					appendPQExpBuffer(q, "%s",
-								  tblinfo[i].check_expr[k]);
+									  tblinfo[i].check_expr[k]);
 				}
 
 				/* Primary Key */
 				if (tblinfo[i].pkIndexOid != NULL)
 				{
-					PQExpBuffer	consDef;
+					PQExpBuffer consDef;
 
 					/* Find the corresponding index */
 					for (k = 0; k < numIndices; k++)
 					{
-						if (strcmp(indinfo[k].oid, tblinfo[i].pkIndexOid) == 0) 
+						if (strcmp(indinfo[k].oid, tblinfo[i].pkIndexOid) == 0)
 							break;
 					}
 
 					if (k >= numIndices)
 					{
 						fprintf(stderr, "dumpTables(): failed sanity check, could not find index (%s) for PK constraint\n",
-									tblinfo[i].pkIndexOid);
+								tblinfo[i].pkIndexOid);
 						exit_nicely(g_conn);
 					}
 
 					consDef = getPKconstraint(&tblinfo[i], &indinfo[k]);
 
-					if ( (actual_atts + tblinfo[i].ncheck) > 0)
+					if ((actual_atts + tblinfo[i].ncheck) > 0)
 						appendPQExpBuffer(q, ",\n\t");
 
 					appendPQExpBuffer(q, "%s", consDef->data);
@@ -3836,8 +3873,8 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
 					for (k = 0; k < numParents; k++)
 					{
 						appendPQExpBuffer(q, "%s%s",
-									  (k > 0) ? ", " : "",
-									  fmtId(parentRels[k], force_quotes));
+										  (k > 0) ? ", " : "",
+									 fmtId(parentRels[k], force_quotes));
 					}
 					appendPQExpBuffer(q, ")");
 				}
@@ -3845,11 +3882,12 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
 				appendPQExpBuffer(q, ";\n");
 			}
 
-			if (!dataOnly) {
+			if (!dataOnly)
+			{
 
 				ArchiveEntry(fout, tblinfo[i].oid, tblinfo[i].relname,
-								reltypename, NULL, q->data, delq->data, "", tblinfo[i].usename,
-								NULL, NULL);
+							 reltypename, NULL, q->data, delq->data, "", tblinfo[i].usename,
+							 NULL, NULL);
 
 				if (!aclsSkip)
 					dumpACL(fout, tblinfo[i]);
@@ -3877,16 +3915,17 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
 	}
 }
 
-static PQExpBuffer getPKconstraint(TableInfo *tblInfo, IndInfo *indInfo)
+static PQExpBuffer
+getPKconstraint(TableInfo *tblInfo, IndInfo *indInfo)
 {
-	PQExpBuffer 	pkBuf = createPQExpBuffer();
-	int				k;
-	int				indkey;
+	PQExpBuffer pkBuf = createPQExpBuffer();
+	int			k;
+	int			indkey;
 
-   	resetPQExpBuffer(pkBuf);
+	resetPQExpBuffer(pkBuf);
 
 	appendPQExpBuffer(pkBuf, "Constraint %s Primary Key (",
-						tblInfo->primary_key_name);
+					  tblInfo->primary_key_name);
 
 
 	for (k = 0; k < INDEX_MAX_KEYS; k++)
@@ -3903,8 +3942,8 @@ static PQExpBuffer getPKconstraint(TableInfo *tblInfo, IndInfo *indInfo)
 			attname = tblInfo->attnames[indkey];
 
 		appendPQExpBuffer(pkBuf, "%s%s",
-							(k == 0) ? "" : ", ", 
-							fmtId(attname, force_quotes));
+						  (k == 0) ? "" : ", ",
+						  fmtId(attname, force_quotes));
 	}
 
 	appendPQExpBuffer(pkBuf, ")");
@@ -3954,21 +3993,25 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 /*
  *			***PK: Enable this code when ALTER TABLE supports PK constraints. ***
  *
- *			PQExpBuffer	consDef = getPKconstraint(&tblinfo[tableInd], &indinfo[i]);
+ *			PQExpBuffer consDef = getPKconstraint(&tblinfo[tableInd], &indinfo[i]);
  *
  *			resetPQExpBuffer(attlist);
  *
- *			appendPQExpBuffer(attlist, "Alter Table %s Add %s;", 
+ *			appendPQExpBuffer(attlist, "Alter Table %s Add %s;",
  *								fmtId(tblinfo[tableInd].relname, force_quotes),
  *								consDef->data);
  *
- *			ArchiveEntry(fout, indinfo[i].oid, tblinfo[tableInd].primary_key_name, "CONSTRAINT", NULL, 
+ *			ArchiveEntry(fout, indinfo[i].oid, tblinfo[tableInd].primary_key_name, "CONSTRAINT", NULL,
  *							attlist->data, "",
  *							"", tblinfo[tableInd].usename, NULL, NULL);
  *
  *			destroyPQExpBuffer(consDef);
  */
-			/* Don't need to do anything else for this system-generated index */
+
+			/*
+			 * Don't need to do anything else for this system-generated
+			 * index
+			 */
 			continue;
 		}
 
@@ -3977,7 +4020,7 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 			funcname = NULL;
 		else
 		{
-			int		numFuncs;
+			int			numFuncs;
 
 			/*
 			 * the funcname is an oid which we use to find the name of the
@@ -4000,9 +4043,10 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 
 			/* Sanity: Check we got only one tuple */
 			numFuncs = PQntuples(res);
-			if (numFuncs != 1) {
-				fprintf(stderr, "dumpIndices(): SELECT (funcname) for index %s returned %d tuples. Expected 1.\n", 
-								indinfo[i].indrelname, numFuncs);
+			if (numFuncs != 1)
+			{
+				fprintf(stderr, "dumpIndices(): SELECT (funcname) for index %s returned %d tuples. Expected 1.\n",
+						indinfo[i].indrelname, numFuncs);
 				exit_nicely(g_conn);
 			}
 
@@ -4013,7 +4057,7 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 		/* convert opclass oid(s) into names */
 		for (nclass = 0; nclass < INDEX_MAX_KEYS; nclass++)
 		{
-			int		numRows;
+			int			numRows;
 
 			indclass = atoi(indinfo[i].indclass[nclass]);
 			if (indclass == 0)
@@ -4027,15 +4071,16 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 			if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
 			{
 				fprintf(stderr, "dumpIndices(): SELECT (classname) failed.  "
-									"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+						"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 				exit_nicely(g_conn);
 			}
 
 			/* Sanity: Check we got only one tuple */
 			numRows = PQntuples(res);
-			if (numRows != 1) {
-				fprintf(stderr, "dumpIndices(): SELECT (classname) for index %s returned %d tuples. Expected 1.\n", 
-									indinfo[i].indrelname, numRows);
+			if (numRows != 1)
+			{
+				fprintf(stderr, "dumpIndices(): SELECT (classname) for index %s returned %d tuples. Expected 1.\n",
+						indinfo[i].indrelname, numRows);
 				exit_nicely(g_conn);
 			}
 
@@ -4086,7 +4131,7 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 			}
 		}
 
-		if (!tablename || (strcmp(indinfo[i].indrelname, tablename) == 0) || (strlen(tablename) == 0) )
+		if (!tablename || (strcmp(indinfo[i].indrelname, tablename) == 0) || (strlen(tablename) == 0))
 		{
 
 			/*
@@ -4105,16 +4150,16 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 
 			resetPQExpBuffer(q);
 			appendPQExpBuffer(q, "CREATE %s INDEX %s on %s using %s (",
-					(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
-					id1->data,
-					id2->data,
-					indinfo[i].indamname);
+			  (strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
+							  id1->data,
+							  id2->data,
+							  indinfo[i].indamname);
 			if (funcname)
 			{
 				/* need 2 printf's here cuz fmtId has static return area */
 				appendPQExpBuffer(q, " %s", fmtId(funcname, false));
-				appendPQExpBuffer(q, " (%s) %s );\n", attlist->data, 
-									fmtId(classname[0], force_quotes));
+				appendPQExpBuffer(q, " (%s) %s );\n", attlist->data,
+								  fmtId(classname[0], force_quotes));
 				free(funcname);
 				free(classname[0]);
 			}
@@ -4124,7 +4169,7 @@ dumpIndices(Archive *fout, IndInfo *indinfo, int numIndices,
 			/* Dump Index Comments */
 
 			ArchiveEntry(fout, tblinfo[tableInd].oid, id1->data, "INDEX", NULL, q->data, delq->data,
-							"", tblinfo[tableInd].usename, NULL, NULL);
+						 "", tblinfo[tableInd].usename, NULL, NULL);
 
 			resetPQExpBuffer(q);
 			appendPQExpBuffer(q, "INDEX %s", id1->data);
@@ -4208,17 +4253,17 @@ dumpTuples(PGresult *res, FILE *fout, int *attrmap)
 static void
 setMaxOid(Archive *fout)
 {
-	PGresult   	*res;
-	Oid		max_oid;
+	PGresult   *res;
+	Oid			max_oid;
 	char		sql[1024];
-	int		pos;
+	int			pos;
 
 	res = PQexec(g_conn, "CREATE TEMPORARY TABLE pgdump_oid (dummy int4)");
 	if (!res ||
 		PQresultStatus(res) != PGRES_COMMAND_OK)
 	{
 		fprintf(stderr, "Can not create pgdump_oid table.  "
-					"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 	PQclear(res);
@@ -4227,7 +4272,7 @@ setMaxOid(Archive *fout)
 		PQresultStatus(res) != PGRES_COMMAND_OK)
 	{
 		fprintf(stderr, "Can not insert into pgdump_oid table.  "
-					"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 	max_oid = atol(PQoidStatus(res));
@@ -4242,7 +4287,7 @@ setMaxOid(Archive *fout)
 		PQresultStatus(res) != PGRES_COMMAND_OK)
 	{
 		fprintf(stderr, "Can not drop pgdump_oid table.  "
-							"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
+			"Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 	PQclear(res);
@@ -4250,10 +4295,10 @@ setMaxOid(Archive *fout)
 		fprintf(stderr, "%s maximum system oid is %u %s\n",
 				g_comment_start, max_oid, g_comment_end);
 	pos = snprintf(sql, 1024, "CREATE TEMPORARY TABLE pgdump_oid (dummy int4);\n");
-	pos = pos + snprintf(sql+pos, 1024-pos, "COPY pgdump_oid WITH OIDS FROM stdin;\n");
-	pos = pos + snprintf(sql+pos, 1024-pos, "%-d\t0\n", max_oid);
-	pos = pos + snprintf(sql+pos, 1024-pos, "\\.\n");
-	pos = pos + snprintf(sql+pos, 1024-pos, "DROP TABLE pgdump_oid;\n");
+	pos = pos + snprintf(sql + pos, 1024 - pos, "COPY pgdump_oid WITH OIDS FROM stdin;\n");
+	pos = pos + snprintf(sql + pos, 1024 - pos, "%-d\t0\n", max_oid);
+	pos = pos + snprintf(sql + pos, 1024 - pos, "\\.\n");
+	pos = pos + snprintf(sql + pos, 1024 - pos, "DROP TABLE pgdump_oid;\n");
 
 	ArchiveEntry(fout, "0", "Max OID", "<Init>", NULL, sql, "", "", "", NULL, NULL);
 }
@@ -4265,7 +4310,7 @@ setMaxOid(Archive *fout)
  */
 
 static Oid
-findLastBuiltinOid(const char* dbname)
+findLastBuiltinOid(const char *dbname)
 {
 	PGresult   *res;
 	int			ntups;
@@ -4327,7 +4372,7 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
 	if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
 		fprintf(stderr, "dumpSequence(%s): SELECT failed.  "
-					"Explanation from backend: '%s'.\n", tbinfo.relname, PQerrorMessage(g_conn));
+				"Explanation from backend: '%s'.\n", tbinfo.relname, PQerrorMessage(g_conn));
 		exit_nicely(g_conn);
 	}
 
@@ -4358,10 +4403,10 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
 	called = *t;
 
 	/*
-	 * The logic we use for restoring sequences is as follows:
-	 *		- 	Add a basic CREATE SEQUENCE statement 
-	 *			(use last_val for start if called == 'f', else use min_val for start_val).
-	 *		-	Add a 'SETVAL(seq, last_val, iscalled)' at restore-time iff we load data
+	 * The logic we use for restoring sequences is as follows: -   Add a
+	 * basic CREATE SEQUENCE statement (use last_val for start if called
+	 * == 'f', else use min_val for start_val). -	Add a 'SETVAL(seq,
+	 * last_val, iscalled)' at restore-time iff we load data
 	 */
 
 	if (!dataOnly)
@@ -4373,15 +4418,15 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
 
 		resetPQExpBuffer(query);
 		appendPQExpBuffer(query,
-					  "CREATE SEQUENCE %s start %d increment %d maxvalue %d "
+				  "CREATE SEQUENCE %s start %d increment %d maxvalue %d "
 						  "minvalue %d  cache %d %s;\n",
-						fmtId(tbinfo.relname, force_quotes), 
+						  fmtId(tbinfo.relname, force_quotes),
 						  (called == 't') ? minv : last,
 						  incby, maxv, minv, cache,
 						  (cycled == 't') ? "cycle" : "");
 
 		ArchiveEntry(fout, tbinfo.oid, tbinfo.relname, "SEQUENCE", NULL,
-						query->data, delqry->data, "", tbinfo.usename, NULL, NULL);
+			  query->data, delqry->data, "", tbinfo.usename, NULL, NULL);
 	}
 
 	if (!schemaOnly)
@@ -4392,7 +4437,7 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
 		appendPQExpBuffer(query, ", %d, '%c');\n", last, called);
 
 		ArchiveEntry(fout, tbinfo.oid, tbinfo.relname, "SEQUENCE SET", NULL,
-						query->data, "" /* Del */, "", "", NULL, NULL);
+					 query->data, "" /* Del */ , "", "", NULL, NULL);
 	}
 
 	if (!dataOnly)
@@ -4419,14 +4464,14 @@ dumpTriggers(Archive *fout, const char *tablename,
 
 	for (i = 0; i < numTables; i++)
 	{
-		if (tablename && (strcmp(tblinfo[i].relname, tablename) != 0) && (strlen(tablename) > 0) )
+		if (tablename && (strcmp(tblinfo[i].relname, tablename) != 0) && (strlen(tablename) > 0))
 			continue;
 
 		for (j = 0; j < tblinfo[i].ntrig; j++)
 		{
 			ArchiveEntry(fout, tblinfo[i].triggers[j].oid, tblinfo[i].triggers[j].tgname,
-						"TRIGGER", NULL, tblinfo[i].triggers[j].tgsrc, "", "", 
-						tblinfo[i].usename, NULL, NULL);
+				   "TRIGGER", NULL, tblinfo[i].triggers[j].tgsrc, "", "",
+						 tblinfo[i].usename, NULL, NULL);
 			dumpComment(fout, tblinfo[i].triggers[j].tgcomment, tblinfo[i].triggers[j].oid);
 		}
 	}
@@ -4457,13 +4502,12 @@ dumpRules(Archive *fout, const char *tablename,
 	 */
 	for (t = 0; t < numTables; t++)
 	{
-		if (tablename && (strcmp(tblinfo[t].relname, tablename) != 0) && (strlen(tablename) > 0) )
+		if (tablename && (strcmp(tblinfo[t].relname, tablename) != 0) && (strlen(tablename) > 0))
 			continue;
 
 		/*
-		 * Get all rules defined for this table
-		 * We include pg_rules in the cross since it filters out
-		 * all view rules (pjw 15-Sep-2000).
+		 * Get all rules defined for this table We include pg_rules in the
+		 * cross since it filters out all view rules (pjw 15-Sep-2000).
 		 *
 		 * XXXX: Use LOJ here
 		 */
@@ -4477,7 +4521,7 @@ dumpRules(Archive *fout, const char *tablename,
 		appendPQExpBuffer(query,
 						  "    AND pg_rewrite.ev_class = pg_class.oid "
 						  "    AND pg_rules.tablename = pg_class.relname "
-						  "    AND pg_rules.rulename = pg_rewrite.rulename "
+					   "    AND pg_rules.rulename = pg_rewrite.rulename "
 						  "ORDER BY pg_rewrite.oid");
 		res = PQexec(g_conn, query->data);
 		if (!res ||
@@ -4501,8 +4545,8 @@ dumpRules(Archive *fout, const char *tablename,
 		for (i = 0; i < nrules; i++)
 		{
 			ArchiveEntry(fout, PQgetvalue(res, i, i_oid), PQgetvalue(res, i, i_rulename),
-							"RULE", NULL, PQgetvalue(res, i, i_definition),
-							"", "", PQgetvalue(res, i, i_owner), NULL, NULL);
+						 "RULE", NULL, PQgetvalue(res, i, i_definition),
+						 "", "", PQgetvalue(res, i, i_owner), NULL, NULL);
 
 			/* Dump rule comments */
 
@@ -4515,4 +4559,3 @@ dumpRules(Archive *fout, const char *tablename,
 		PQclear(res);
 	}
 }
-
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 74882213464e9fd937cf985043e4e8c2c526ec9b..ae481cfa80c61cfbe061fc6af573a2e1413ea6d2 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_dump.h,v 1.58 2001/02/10 02:31:27 tgl Exp $
+ * $Id: pg_dump.h,v 1.59 2001/03/22 04:00:15 momjian Exp $
  *
  * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
  *
@@ -19,8 +19,8 @@
  *	 in pg_dump.c
  *
  * Modifications - 14-Sep-2000 - pjw@rhyme.com.au
- *	- 	Added typedefn fields to typeinfo and relinfo
- * 	- 	Added enum for findTypeByOid to allow special handling of
+ *	-	Added typedefn fields to typeinfo and relinfo
+ *	-	Added enum for findTypeByOid to allow special handling of
  *		'0' OID.
  *
  *-------------------------------------------------------------------------
@@ -114,9 +114,9 @@ typedef struct _tableInfo
 	int			ncheck;			/* # of CHECK expressions */
 	char	  **check_expr;		/* [CONSTRAINT name] CHECK expressions */
 	int			ntrig;			/* # of triggers */
-	TrigInfo	*triggers;		/* Triggers on the table */
+	TrigInfo   *triggers;		/* Triggers on the table */
 	char	   *pkIndexOid;		/* Primary Key index OID */
-	char	   *primary_key_name;	/* PRIMARY KEY name, if any */
+	char	   *primary_key_name;		/* PRIMARY KEY name, if any */
 } TableInfo;
 
 typedef struct _inhInfo
@@ -209,10 +209,11 @@ extern void dumpSchemaIdx(Archive *fout,
 			  TableInfo *tblinfo,
 			  int numTables);
 
-typedef enum _OidOptions {
+typedef enum _OidOptions
+{
 	zeroAsOpaque = 1,
 	zeroAsAny = 2,
-    useBaseTypeName = 1024
+	useBaseTypeName = 1024
 } OidOptions;
 
 extern char *findTypeByOid(TypeInfo *tinfo, int numTypes, const char *oid, OidOptions opts);
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 073930c23fe9fa6791f723967b61110540a8015d..7b4ec4c1f1a4655f8a8b13f5375ecda7537201be 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -2,7 +2,7 @@
  *
  * pg_restore.c
  *	pg_restore is an utility extracting postgres database definitions
- *	from a backup archive created by pg_dump using the archiver 
+ *	from a backup archive created by pg_dump using the archiver
  *	interface.
  *
  *	pg_restore will read the backup archive and
@@ -19,22 +19,22 @@
  * the output script is SQL that is understood by PostgreSQL
  *
  * Basic process in a restore operation is:
- * 
- * 	Open the Archive and read the TOC.
- * 	Set flags in TOC entries, and *maybe* reorder them.
- * 	Generate script to stdout
- * 	Exit
+ *
+ *	Open the Archive and read the TOC.
+ *	Set flags in TOC entries, and *maybe* reorder them.
+ *	Generate script to stdout
+ *	Exit
  *
  * Copyright (c) 2000, Philip Warner
- *      Rights are granted to use this software in any way so long
- *      as this notice is not removed.
+ *		Rights are granted to use this software in any way so long
+ *		as this notice is not removed.
  *
  *	The author is not responsible for loss or damages that may
  *	result from it's use.
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.18 2001/03/19 02:35:29 pjw Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.19 2001/03/22 04:00:15 momjian Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
@@ -42,7 +42,7 @@
  *
  * Modifications - 28-Jul-2000 - pjw@rhyme.com.au (1.45)
  *
- * 		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
+ *		Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
  *		Added code to dump 'Create Schema' statement (pg_dump)
  *		Don't bother to disable/enable triggers if we don't have a superuser (pg_restore)
  *		Cleaned up code for reconnecting to database.
@@ -69,54 +69,56 @@
 #include <termios.h>
 #endif
 
-#ifdef HAVE_GETOPT_H 
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
 
 /* Forward decls */
 static void usage(const char *progname);
-static char* _cleanupName(char* name);
+static char *_cleanupName(char *name);
 
 typedef struct option optType;
 
 #ifdef HAVE_GETOPT_LONG
-struct option cmdopts[] = {	
-				{ "clean", 0, NULL, 'c' },
-				{ "create", 0, NULL, 'C' },
-				{ "data-only", 0, NULL, 'a' },
-				{ "dbname", 1, NULL, 'd' },
-				{ "file", 1, NULL, 'f' },
-				{ "format", 1, NULL, 'F' },
-				{ "function", 2, NULL, 'P' },
-				{ "host", 1, NULL, 'h' },
-				{ "ignore-version", 0, NULL, 'i'},
-				{ "index", 2, NULL, 'I'},
-				{ "list", 0, NULL, 'l'},
-				{ "no-acl", 0, NULL, 'x' },
-				{ "no-owner", 0, NULL, 'O'},
-				{ "no-reconnect", 0, NULL, 'R' },
-				{ "port", 1, NULL, 'p' },
-				{ "oid-order", 0, NULL, 'o'},
-				{ "orig-order", 0, NULL, 'N'},
-				{ "password", 0, NULL, 'u' },
-				{ "rearrange", 0, NULL, 'r'},
-				{ "schema-only", 0, NULL, 's' },
-				{ "superuser", 1, NULL, 'S' },
-				{ "table", 2, NULL, 't'},
-				{ "trigger", 2, NULL, 'T' },
-				{ "use-list", 1, NULL, 'L'},
-				{ "verbose", 0, NULL, 'v' },
-				{ NULL, 0, NULL, 0}
-			    };
+struct option cmdopts[] = {
+	{"clean", 0, NULL, 'c'},
+	{"create", 0, NULL, 'C'},
+	{"data-only", 0, NULL, 'a'},
+	{"dbname", 1, NULL, 'd'},
+	{"file", 1, NULL, 'f'},
+	{"format", 1, NULL, 'F'},
+	{"function", 2, NULL, 'P'},
+	{"host", 1, NULL, 'h'},
+	{"ignore-version", 0, NULL, 'i'},
+	{"index", 2, NULL, 'I'},
+	{"list", 0, NULL, 'l'},
+	{"no-acl", 0, NULL, 'x'},
+	{"no-owner", 0, NULL, 'O'},
+	{"no-reconnect", 0, NULL, 'R'},
+	{"port", 1, NULL, 'p'},
+	{"oid-order", 0, NULL, 'o'},
+	{"orig-order", 0, NULL, 'N'},
+	{"password", 0, NULL, 'u'},
+	{"rearrange", 0, NULL, 'r'},
+	{"schema-only", 0, NULL, 's'},
+	{"superuser", 1, NULL, 'S'},
+	{"table", 2, NULL, 't'},
+	{"trigger", 2, NULL, 'T'},
+	{"use-list", 1, NULL, 'L'},
+	{"verbose", 0, NULL, 'v'},
+	{NULL, 0, NULL, 0}
+};
+
 #endif
 
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
-	RestoreOptions	*opts;
-	char		*progname;
-	int		c;
-	Archive*    	AH;
-	char		*fileSpec = NULL;
+	RestoreOptions *opts;
+	char	   *progname;
+	int			c;
+	Archive    *AH;
+	char	   *fileSpec = NULL;
 	extern int	optind;
 	extern char *optarg;
 
@@ -126,12 +128,12 @@ int main(int argc, char **argv)
 
 	if (argc > 1)
 	{
-		if (strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0)
+		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
 		{
 			usage(progname);
 			exit(0);
 		}
-		if (strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0)
+		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
 		{
 			puts("pg_restore (PostgreSQL) " PG_VERSION);
 			exit(0);
@@ -167,8 +169,8 @@ int main(int argc, char **argv)
 				opts->filename = strdup(optarg);
 				break;
 			case 'F':
-				if (strlen(optarg) != 0) 
-				    opts->formatName = strdup(optarg);
+				if (strlen(optarg) != 0)
+					opts->formatName = strdup(optarg);
 				break;
 			case 'h':
 				if (strlen(optarg) != 0)
@@ -205,17 +207,17 @@ int main(int argc, char **argv)
 			case 'R':
 				opts->noReconnect = 1;
 				break;
-			case 'P': /* Function */
+			case 'P':			/* Function */
 				opts->selTypes = 1;
 				opts->selFunction = 1;
 				opts->functionNames = optarg ? strdup(optarg) : NULL;
 				break;
-			case 'I': /* Index */
+			case 'I':			/* Index */
 				opts->selTypes = 1;
 				opts->selIndex = 1;
 				opts->indexNames = _cleanupName(optarg);
 				break;
-			case 'T': /* Trigger */
+			case 'T':			/* Trigger */
 				opts->selTypes = 1;
 				opts->selTrigger = 1;
 				opts->triggerNames = _cleanupName(optarg);
@@ -249,15 +251,16 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (optind < argc) {
-	    fileSpec = argv[optind];
-	} else {
-	    fileSpec = NULL;
-	}
+	if (optind < argc)
+		fileSpec = argv[optind];
+	else
+		fileSpec = NULL;
 
-    if (opts->formatName) { 
+	if (opts->formatName)
+	{
 
-		switch (opts->formatName[0]) {
+		switch (opts->formatName[0])
+		{
 
 			case 'c':
 			case 'C':
@@ -276,25 +279,26 @@ int main(int argc, char **argv)
 
 			default:
 				fprintf(stderr, "%s: Unknown archive format '%s', please specify 't' or 'c'\n",
-							progname, opts->formatName);
-				exit (1);
+						progname, opts->formatName);
+				exit(1);
 		}
-    } 
+	}
 
-    AH = OpenArchive(fileSpec, opts->format);
+	AH = OpenArchive(fileSpec, opts->format);
 
 	/* Let the archiver know how noisy to be */
 	AH->verbose = opts->verbose;
 
-    if (opts->tocFile)
+	if (opts->tocFile)
 		SortTocFromFile(AH, opts);
 
-    if (opts->oidOrder)
+	if (opts->oidOrder)
 		SortTocByOID(AH);
-    else if (opts->origOrder)
+	else if (opts->origOrder)
 		SortTocByID(AH);
 
-    if (opts->rearrange) {
+	if (opts->rearrange)
+	{
 		MoveToStart(AH, "<Init>");
 		MoveToEnd(AH, "TABLE DATA");
 		MoveToEnd(AH, "BLOBS");
@@ -302,23 +306,23 @@ int main(int argc, char **argv)
 		MoveToEnd(AH, "TRIGGER");
 		MoveToEnd(AH, "RULE");
 		MoveToEnd(AH, "SEQUENCE SET");
-    }
+	}
 
 	/* Database MUST be at start */
 	MoveToStart(AH, "DATABASE");
 
-    if (opts->tocSummary) {
+	if (opts->tocSummary)
 		PrintTOCSummary(AH, opts);
-    } else {
+	else
 		RestoreArchive(AH, opts);
-    }
 
-    CloseArchive(AH);
+	CloseArchive(AH);
 
-    return 1;
+	return 1;
 }
 
-static void usage(const char *progname)
+static void
+usage(const char *progname)
 {
 	printf("%s restores a PostgreSQL database from an archive created by pg_dump.\n\n"
 		   "Usage:\n  %s [options] [file]\n\n"
@@ -326,92 +330,92 @@ static void usage(const char *progname)
 		   progname, progname);
 #ifdef HAVE_GETOPT_LONG
 	puts(
-	    "  -a, --data-only          restore only the data, no schema\n"
-	    "  -c, --clean              clean (drop) schema prior to create\n"
-		"  -C, --create             output commands to create the database\n"
-		"  -d, --dbname=NAME        specify database name\n"
-	    "  -f, --file=FILENAME      script output file name\n"
-	    "  -F, --format {c|f}       specify backup file format\n"
-		"  -h, --host HOSTNAME      server host name\n"
-	    "  -i, --index[=NAME]       restore indices or named index\n"
-	    "  -l, --list               dump summarized TOC for this file\n"
-		"  -L, --use-list=FILENAME  use specified table of contents for ordering\n"
-		"                           output from this file\n"
-		"  -N, --orig-order         restore in original dump order\n"
-	    "  -o, --oid-order          restore in oid order\n"
-		"  -O, --no-owner           do not reconnect to database to match\n"
-		"                           object owner\n"
-		"  -p, --port PORT          server port number\n"
-		"  -P, --function[=NAME]    restore functions or named function\n"
-	    "  -r, --rearrange          rearrange output to put indexes etc. at end\n"
-		"  -R, --no-reconnect       disallow ALL reconnections to the database\n"
-	    "  -s, --schema-only        restore only the schema, no data\n"
-		"  -S, --superuser=NAME     specify the superuser user name to use for\n"
-		"                           disabling triggers\n"
-	    "  -t, --table[=TABLE]      restore this table only\n"
-	    "  -T, --trigger[=NAME]     restore triggers or named trigger\n"
-		"  -u, --password           use password authentication\n"
-	    "  -v, --verbose            verbose\n"
-	    "  -x, --no-acl             skip dumping of ACLs (grant/revoke)\n");
-
-#else /* not HAVE_GETOPT_LONG */
+		 "  -a, --data-only          restore only the data, no schema\n"
+	   "  -c, --clean              clean (drop) schema prior to create\n"
+	"  -C, --create             output commands to create the database\n"
+		 "  -d, --dbname=NAME        specify database name\n"
+		 "  -f, --file=FILENAME      script output file name\n"
+		 "  -F, --format {c|f}       specify backup file format\n"
+		 "  -h, --host HOSTNAME      server host name\n"
+		 "  -i, --index[=NAME]       restore indices or named index\n"
+		 "  -l, --list               dump summarized TOC for this file\n"
+		 "  -L, --use-list=FILENAME  use specified table of contents for ordering\n"
+		 "                           output from this file\n"
+		 "  -N, --orig-order         restore in original dump order\n"
+		 "  -o, --oid-order          restore in oid order\n"
+	 "  -O, --no-owner           do not reconnect to database to match\n"
+		 "                           object owner\n"
+		 "  -p, --port PORT          server port number\n"
+	   "  -P, --function[=NAME]    restore functions or named function\n"
+		 "  -r, --rearrange          rearrange output to put indexes etc. at end\n"
+		 "  -R, --no-reconnect       disallow ALL reconnections to the database\n"
+		 "  -s, --schema-only        restore only the schema, no data\n"
+		 "  -S, --superuser=NAME     specify the superuser user name to use for\n"
+		 "                           disabling triggers\n"
+		 "  -t, --table[=TABLE]      restore this table only\n"
+		 "  -T, --trigger[=NAME]     restore triggers or named trigger\n"
+		 "  -u, --password           use password authentication\n"
+		 "  -v, --verbose            verbose\n"
+	 "  -x, --no-acl             skip dumping of ACLs (grant/revoke)\n");
+
+#else							/* not HAVE_GETOPT_LONG */
 
 	puts(
-	    "  -a                       restore only the data, no schema\n"
-	    "  -c                       clean (drop) schema prior to create\n"
-		"  -C                       output commands to create the database\n"
-		"  -d NAME                  specify database name\n"
-	    "  -f FILENAME              script output file name\n"
-	    "  -F {c|f}                 specify backup file format\n"
-		"  -h HOSTNAME              server host name\n"
-	    "  -i NAME                  restore indices or named index\n"
-	    "  -l                       dump summarized TOC for this file\n"
-		"  -L FILENAME              use specified table of contents for ordering\n"
-		"                           output from this file\n"
-		"  -N                       restore in original dump order\n"
-	    "  -o                       restore in oid order\n"
-		"  -O                       do not output reconnect to database to match\n"
-		"                           object owner\n"
-		"  -p PORT                  server port number\n"
-		"  -P NAME                  restore functions or named function\n"
-	    "  -r                       rearrange output to put indexes etc at end\n"
-		"  -R                       disallow ALL reconnections to the database\n"
-	    "  -s                       restore only the schema, no data\n"
-		"  -S NAME                  specify the superuser user name to use for\n"
-		"                           disabling triggers\n"
-	    "  -t NAME                  restore this table only\n"
-	    "  -T NAME                  restore triggers or named trigger\n"
-		"  -u                       use password authentication\n"
-	    "  -v                       verbose\n"
-	    "  -x                       skip dumping of ACLs (grant/revoke)\n");
+		 "  -a                       restore only the data, no schema\n"
+	   "  -c                       clean (drop) schema prior to create\n"
+	"  -C                       output commands to create the database\n"
+		 "  -d NAME                  specify database name\n"
+		 "  -f FILENAME              script output file name\n"
+		 "  -F {c|f}                 specify backup file format\n"
+		 "  -h HOSTNAME              server host name\n"
+		 "  -i NAME                  restore indices or named index\n"
+		 "  -l                       dump summarized TOC for this file\n"
+		 "  -L FILENAME              use specified table of contents for ordering\n"
+		 "                           output from this file\n"
+		 "  -N                       restore in original dump order\n"
+		 "  -o                       restore in oid order\n"
+		 "  -O                       do not output reconnect to database to match\n"
+		 "                           object owner\n"
+		 "  -p PORT                  server port number\n"
+	   "  -P NAME                  restore functions or named function\n"
+		 "  -r                       rearrange output to put indexes etc at end\n"
+		 "  -R                       disallow ALL reconnections to the database\n"
+		 "  -s                       restore only the schema, no data\n"
+		 "  -S NAME                  specify the superuser user name to use for\n"
+		 "                           disabling triggers\n"
+		 "  -t NAME                  restore this table only\n"
+		 "  -T NAME                  restore triggers or named trigger\n"
+		 "  -u                       use password authentication\n"
+		 "  -v                       verbose\n"
+	 "  -x                       skip dumping of ACLs (grant/revoke)\n");
 #endif
 	puts("If [file] is not supplied, then standard input is used.\n");
 	puts("Report bugs to <pgsql-bugs@postgresql.org>.");
 }
 
 
-static char* _cleanupName(char* name)
+static char *
+_cleanupName(char *name)
 {
-    int		i;
+	int			i;
 
-    if (!name || ! name[0])
+	if (!name || !name[0])
 		return NULL;
 
-    name = strdup(name);
+	name = strdup(name);
 
-    if (name[0] == '"')
-    {
+	if (name[0] == '"')
+	{
 		strcpy(name, &name[1]);
 		if (name[0] && *(name + strlen(name) - 1) == '"')
 			*(name + strlen(name) - 1) = '\0';
-    }
-    /* otherwise, convert table name to lowercase... */
-    else
-    {
+	}
+	/* otherwise, convert table name to lowercase... */
+	else
+	{
 		for (i = 0; name[i]; i++)
 			if (isupper((unsigned char) name[i]))
 				name[i] = tolower((unsigned char) name[i]);
-    }
-    return name;
+	}
+	return name;
 }
-
diff --git a/src/bin/pg_id/pg_id.c b/src/bin/pg_id/pg_id.c
index 41bd6733c33aa8710688e83145ba78ec68d10f66..975e8bbce7db732442808861ce6af37809307eac 100644
--- a/src/bin/pg_id/pg_id.c
+++ b/src/bin/pg_id/pg_id.c
@@ -6,7 +6,7 @@
  *
  * Copyright (C) 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.19 2001/03/01 05:05:29 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.20 2001/03/22 04:00:16 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -94,9 +94,9 @@ main(int argc, char *argv[])
 		puts(pw->pw_name);
 	else
 #ifdef __BEOS__
- 		if (pw->pw_uid==0)
- 			printf("1\n");
- 		else
+	if (pw->pw_uid == 0)
+		printf("1\n");
+	else
 #endif
 		printf("%d\n", (int) pw->pw_uid);
 
diff --git a/src/bin/pg_passwd/pg_passwd.c b/src/bin/pg_passwd/pg_passwd.c
index 65622ea00db2af3acb43550c5d52ec98f2cc0496..4c9790b6778e6117ca6b3f19095bb6aa4bd4b3f7 100644
--- a/src/bin/pg_passwd/pg_passwd.c
+++ b/src/bin/pg_passwd/pg_passwd.c
@@ -25,17 +25,17 @@ extern char *crypt(const char *, const char *);
  *
  * Postgres usernames are assumed to be less than NAMEDATALEN chars long.
  */
-#define CLEAR_PASSWD_LEN 8			/* not including null */
-#define CRYPTED_PASSWD_LEN 13		/* not including null */
+#define CLEAR_PASSWD_LEN 8		/* not including null */
+#define CRYPTED_PASSWD_LEN 13	/* not including null */
 
-const char * progname;
+const char *progname;
 
 static void usage(void);
 static void read_pwd_file(char *filename);
 static void write_pwd_file(char *filename, char *bkname);
-static void encrypt_pwd(char key[CLEAR_PASSWD_LEN+1],
-						char salt[3],
-						char passwd[CRYPTED_PASSWD_LEN+1]);
+static void encrypt_pwd(char key[CLEAR_PASSWD_LEN + 1],
+			char salt[3],
+			char passwd[CRYPTED_PASSWD_LEN + 1]);
 static void prompt_for_username(char *username);
 static void prompt_for_password(char *prompt, char *password);
 
@@ -140,7 +140,7 @@ try_again:
 			if (strcmp(pwds[i].uname, pwds[npwds].uname) == 0)
 			{
 				fprintf(stderr, "Duplicate username %s in entry %d\n",
-						pwds[npwds].uname, npwds+1);
+						pwds[npwds].uname, npwds + 1);
 				exit(1);
 			}
 		}
@@ -220,9 +220,9 @@ link_again:
 }
 
 static void
-encrypt_pwd(char key[CLEAR_PASSWD_LEN+1],
+encrypt_pwd(char key[CLEAR_PASSWD_LEN + 1],
 			char salt[3],
-			char passwd[CRYPTED_PASSWD_LEN+1])
+			char passwd[CRYPTED_PASSWD_LEN + 1])
 {
 	int			n;
 
@@ -302,7 +302,7 @@ prompt_for_password(char *prompt, char *password)
 	printf(prompt);
 	fflush(stdout);
 
-	if (fgets(password, CLEAR_PASSWD_LEN+1, stdin) == NULL)
+	if (fgets(password, CLEAR_PASSWD_LEN + 1, stdin) == NULL)
 		password[0] = '\0';
 
 #ifdef HAVE_TERMIOS_H
@@ -332,7 +332,7 @@ prompt_for_password(char *prompt, char *password)
 int
 main(int argc, char *argv[])
 {
-	char       *filename;
+	char	   *filename;
 	char		bkname[MAXPGPATH];
 	char		username[NAMEDATALEN];
 	char		salt[3];
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index a81f222f39dbde6eca74bf378ed3f7bc410307dc..f763c339cb16c21e82c468cd8fd2acf7b4477baa 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.47 2001/02/17 10:03:33 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.48 2001/03/22 04:00:18 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -141,7 +141,7 @@ HandleSlashCmds(const char *line,
 
 		status = exec_command(new_cmd, my_line + 1, &continue_parse, query_buf);
 
-#if 0 /* turned out to be too annoying */
+#if 0							/* turned out to be too annoying */
 		if (status != CMD_UNKNOWN && isalpha((unsigned char) new_cmd[0]))
 			psql_error("Warning: this syntax is deprecated\n");
 #endif
@@ -186,7 +186,7 @@ exec_command(const char *cmd,
 	backslashResult status = CMD_SKIP_LINE;
 	char	   *string,
 			   *string_cpy,
-		       *val;
+			   *val;
 
 	/*
 	 * The 'string' variable will be overwritten to point to the next
@@ -310,7 +310,7 @@ exec_command(const char *cmd,
 			case 'i':
 			case 's':
 			case 'S':
-					success = listTables(&cmd[1], name, show_verbose);
+				success = listTables(&cmd[1], name, show_verbose);
 				break;
 			default:
 				status = CMD_UNKNOWN;
@@ -494,7 +494,7 @@ exec_command(const char *cmd,
 				success = false;
 			}
 			else
-			    success = do_lo_import(opt1, opt2);
+				success = do_lo_import(opt1, opt2);
 		}
 
 		else if (strcmp(cmd + 3, "list") == 0)
@@ -818,6 +818,7 @@ scan_option(char **string, enum option_type type, char *quote)
 
 	switch (options_string[pos])
 	{
+
 			/*
 			 * Double quoted string
 			 */
@@ -1038,8 +1039,8 @@ scan_option(char **string, enum option_type type, char *quote)
 			break;
 
 			/*
-			 * | could be the beginning of a pipe
-			 * if so, take rest of line as command
+			 * | could be the beginning of a pipe if so, take rest of line
+			 * as command
 			 */
 		case '|':
 			if (type == OT_FILEPIPE)
@@ -1166,13 +1167,11 @@ unescape(const unsigned char *source, size_t len)
 
 		else
 		{
-			int	i;
-			const unsigned char	*mp = p;
+			int			i;
+			const unsigned char *mp = p;
 
-			for (i = 0;i < PQmblen(p, pset.encoding);i++)
-			{
-			    *tmp++ = *mp++;
-			}
+			for (i = 0; i < PQmblen(p, pset.encoding); i++)
+				*tmp++ = *mp++;
 			esc = false;
 		}
 	}
@@ -1406,7 +1405,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
 	const char *fname;
 	bool		error = false;
 	int			fd;
-	
+
 #ifndef WIN32
 	struct stat before,
 				after;
@@ -1430,7 +1429,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
 #endif
 		fname = (const char *) fnametmp;
 
-		fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0600);
+		fd = open(fname, O_WRONLY | O_CREAT | O_EXCL, 0600);
 		if (fd != -1)
 			stream = fdopen(fd, "w");
 
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 5ea17a8ab803f4d937f76625f2a349a7ae3272ae..d89d7bec3603f24caddd82eda0edb7cb6dd8b7f4 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.17 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.18 2001/03/22 04:00:19 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "copy.h"
@@ -80,7 +80,7 @@ parse_slash_copy(const char *args)
 	{
 		psql_error("\\copy: arguments required\n");
 		return NULL;
-	}		
+	}
 
 	if (!(result = calloc(1, sizeof(struct copy_options))))
 	{
@@ -403,7 +403,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
 	int			bufleft;
 	int			c = 0;
 	int			ret;
-	unsigned int linecount=0;
+	unsigned int linecount = 0;
 
 #ifdef USE_ASSERT_CHECKING
 	assert(copy_in_state);
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 3e53bb5d353bf945d2dcabca459395ec3d755dae..d31d68bbbed27c43e7847e35583fe578553c6cff 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.27 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.28 2001/03/22 04:00:19 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "describe.h"
@@ -117,7 +117,7 @@ describeFunctions(const char *name, bool verbose)
 		strcat(buf,
 			   "\nFROM pg_proc p,  pg_language l, pg_user u\n"
 			   "WHERE p.prolang = l.oid AND p.proowner = u.usesysid\n"
-		"  AND p.prorettype <> 0 and (pronargs = 0 or oidvectortypes(p.proargtypes) <> '')\n");
+			   "  AND p.prorettype <> 0 and (pronargs = 0 or oidvectortypes(p.proargtypes) <> '')\n");
 
 	if (name)
 	{
@@ -630,7 +630,7 @@ describeTableDetails(const char *name, bool desc)
 														 * afterwards */
 		/* Type */
 		cells[i * cols + 1] = PQgetvalue(res, i, 1);	/* don't free this
-														 * either*/
+														 * either */
 
 		/* Extra: not null and default */
 		/* (I'm cutting off the 'default' string at 128) */
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5454210c02cb7f9342a857688df7906a634eab1d..10392766512a265c65fb2baa4412fe0d206b0fdd 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.36 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.37 2001/03/22 04:00:20 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "help.h"
@@ -265,11 +265,11 @@ helpSQL(const char *topic)
 		for (i = 0; i < items_per_column; i++)
 		{
 			printf("  %-26s%-26s",
-					VALUE_OR_NULL(QL_HELP[i].cmd),
-					VALUE_OR_NULL(QL_HELP[i + items_per_column].cmd));
+				   VALUE_OR_NULL(QL_HELP[i].cmd),
+				   VALUE_OR_NULL(QL_HELP[i + items_per_column].cmd));
 			if (i + 2 * items_per_column < QL_HELP_COUNT)
 				printf("%-26s",
-					VALUE_OR_NULL(QL_HELP[i + 2 * items_per_column].cmd));
+				   VALUE_OR_NULL(QL_HELP[i + 2 * items_per_column].cmd));
 			fputc('\n', stdout);
 		}
 	}
@@ -278,11 +278,11 @@ helpSQL(const char *topic)
 	{
 		int			i;
 		bool		help_found = false;
-		size_t      len;
+		size_t		len;
 
 		/* don't care about trailing spaces */
 		len = strlen(topic);
-		while (topic[len-1] == ' ')
+		while (topic[len - 1] == ' ')
 			len--;
 
 		for (i = 0; QL_HELP[i].cmd; i++)
@@ -302,7 +302,7 @@ helpSQL(const char *topic)
 		}
 
 		if (!help_found)
-			printf("No help available for '%-.*s'.\nTry \\h with no arguments to see available help.\n", (int)len, topic);
+			printf("No help available for '%-.*s'.\nTry \\h with no arguments to see available help.\n", (int) len, topic);
 	}
 }
 
diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c
index fdf1d4085e388653c51b6da7893c426deca084e7..03004ef8d7098d0f5d394edc8902b79f4acf615a 100644
--- a/src/bin/psql/large_obj.c
+++ b/src/bin/psql/large_obj.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.13 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.14 2001/03/22 04:00:20 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "large_obj.h"
@@ -328,7 +328,7 @@ do_lo_list(void)
 	printQueryOpt myopt = pset.popt;
 
 	strcpy(buf,
-	"SELECT loid as \"ID\", obj_description(loid) as \"Description\"\n"
+	  "SELECT loid as \"ID\", obj_description(loid) as \"Description\"\n"
 		   "FROM (SELECT DISTINCT loid FROM pg_largeobject) x\n"
 		   "ORDER BY \"ID\"");
 
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index 0f29027fd4a64847ff56d7383e700bb254c7e25d..919a9f5513f1c576ce60605a314d5f20580c5628 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.36 2001/02/28 20:39:42 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.37 2001/03/22 04:00:21 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "mainloop.h"
@@ -19,6 +19,7 @@
 #ifndef WIN32
 #include <setjmp.h>
 sigjmp_buf	main_loop_jmp;
+
 #endif
 
 
@@ -285,14 +286,14 @@ MainLoop(FILE *source)
 			else
 				bslash_count = 0;
 
-		rescan:
+	rescan:
+
 			/*
-			 *	It is important to place the in_* test routines
-			 * 	before the in_* detection routines.
-			 *	i.e. we have to test if we are in a quote before
-			 *	testing for comments. bjm  2000-06-30
+			 * It is important to place the in_* test routines before the
+			 * in_* detection routines. i.e. we have to test if we are in
+			 * a quote before testing for comments. bjm  2000-06-30
 			 */
-			
+
 			/* in quote? */
 			if (in_quote)
 			{
@@ -307,9 +308,7 @@ MainLoop(FILE *source)
 				if (line[i] == '*' && line[i + thislen] == '/')
 				{
 					if (xcdepth > 0)
-					{
 						xcdepth--;
-					}
 					else
 					{
 						in_xcomment = false;
@@ -317,9 +316,7 @@ MainLoop(FILE *source)
 					}
 				}
 				else if (line[i] == '/' && line[i + thislen] == '*')
-				{
 					xcdepth++;
-				}
 			}
 
 			/* start of extended comment? */
@@ -393,7 +390,7 @@ MainLoop(FILE *source)
 					line = new;
 					len = strlen(new);
 
-					goto rescan;	/* reparse the just substituted */
+					goto rescan;/* reparse the just substituted */
 				}
 				else
 				{
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index b72fa2172e81bfc2b53a318072ddf84432c796c0..56f15427a317114a83dd7e3dfbc39dc5e8208b02 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.17 2001/03/01 18:52:50 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.18 2001/03/22 04:00:22 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "print.h"
@@ -252,7 +252,7 @@ const char *opt_align, bool opt_barebones, unsigned short int opt_border,
 		if (strlen(title) >= total_w)
 			fprintf(fout, "%s\n", title);
 		else
-			fprintf(fout, "%-*s%s\n", (int)(total_w - strlen(title)) / 2, "", title);
+			fprintf(fout, "%-*s%s\n", (int) (total_w - strlen(title)) / 2, "", title);
 	}
 
 	/* print headers */
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index a59ecde628e9e4b7317def5da937273ece7b8664..08db1902676cff656ae05d34eb594752862180b1 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.17 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.18 2001/03/22 04:00:22 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "prompt.h"
@@ -20,8 +20,8 @@
 #endif
 
 #ifdef HAVE_UNIX_SOCKETS
-# include <unistd.h>
-# include <netdb.h>
+#include <unistd.h>
+#include <netdb.h>
 #endif
 
 /*--------------------------
@@ -104,7 +104,7 @@ localhost(int type, char *buf, int siz)
 	return buf;
 }
 
-#endif /* HAVE_UNIX_SOCKETS */
+#endif	 /* HAVE_UNIX_SOCKETS */
 
 
 char *
@@ -182,7 +182,7 @@ get_prompt(promptStatus_t status)
 							else
 								localhost(DOMAINNAME, buf, MAX_PROMPT_SIZE);
 						}
-#endif /* HAVE_UNIX_SOCKETS */
+#endif	 /* HAVE_UNIX_SOCKETS */
 					}
 					break;
 					/* DB server port number */
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 3852edbbab1b1e11e22aeff05e5032a8b4dde693..55ad9692c66d666ce00365f089cab671136ac5b6 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.44 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.45 2001/03/22 04:00:23 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -82,7 +82,8 @@ static void
 
 #ifdef USE_SSL
 static void
-            printSSLInfo(void);
+			printSSLInfo(void);
+
 #endif
 
 
@@ -108,17 +109,17 @@ main(int argc, char *argv[])
 
 	if (argc > 1)
 	{
-		if (strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0)
+		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
 		{
 			usage();
 			exit(EXIT_SUCCESS);
 		}
-		if (strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0)
+		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
 		{
 			showVersion();
 			exit(EXIT_SUCCESS);
 		}
-	}		
+	}
 
 	pset.cur_cmd_source = stdin;
 	pset.cur_cmd_interactive = false;
@@ -279,7 +280,7 @@ main(int argc, char *argv[])
 				   "Type:  \\copyright for distribution terms\n"
 				   "       \\h for help with SQL commands\n"
 				   "       \\? for help on internal slash commands\n"
-				   "       \\g or terminate with semicolon to execute query\n"
+			  "       \\g or terminate with semicolon to execute query\n"
 				   "       \\q to quit\n\n", pset.progname);
 #ifdef USE_SSL
 			printSSLInfo();
@@ -672,18 +673,19 @@ showVersion(void)
  * Prints information about the current SSL connection, if SSL is in use
  */
 #ifdef USE_SSL
-static void 
+static void
 printSSLInfo(void)
 {
-	int sslbits = -1;
-	SSL *ssl;
+	int			sslbits = -1;
+	SSL		   *ssl;
 
 	ssl = PQgetssl(pset.db);
 	if (!ssl)
-		return; /* no SSL */
+		return;					/* no SSL */
 
 	SSL_get_cipher_bits(ssl, &sslbits);
 	printf("SSL enabled connection. Chiper: %s, bits: %i\n\n",
-		   SSL_get_cipher(ssl),sslbits);
+		   SSL_get_cipher(ssl), sslbits);
 }
+
 #endif
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 8528310b18f0ed36384019ddc5ba0bf4c89c1c14..c74326d4ca5543592e562edad20a6e174954aef2 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.27 2001/02/26 00:50:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.28 2001/03/22 04:00:23 momjian Exp $
  */
 
 /*----------------------------------------------------------------------
@@ -20,9 +20,9 @@
  * you can turn off tab completion in your ~/.inputrc (or else
  * ${INPUTRC}) file so:
  *
- *   $if psql
- *   set disable-completion on
- *   $endif
+ *	 $if psql
+ *	 set disable-completion on
+ *	 $endif
  *
  * See `man 3 readline' or `info readline' for the full details. Also,
  * hence the
@@ -30,15 +30,15 @@
  * BUGS:
  *
  * - If you split your queries across lines, this whole things gets
- *   confused. (To fix this, one would have to read psql's query
- *   buffer rather than readline's line buffer, which would require
- *   some major revisions of things.)
+ *	 confused. (To fix this, one would have to read psql's query
+ *	 buffer rather than readline's line buffer, which would require
+ *	 some major revisions of things.)
  *
  * - Table or attribute names with spaces in it will equally confuse
- *   it.
+ *	 it.
  *
  * - Quotes, parenthesis, and other funny characters are not handled
- *   all that gracefully.
+ *	 all that gracefully.
  *----------------------------------------------------------------------
  */
 
@@ -208,7 +208,11 @@ psql_completion(char *text, int start, int end)
 		"client_encoding",
 		"server_encoding",
 		"random_seed",
-		/* the rest should match USERSET entries in backend/utils/misc/guc.c */
+
+		/*
+		 * the rest should match USERSET entries in
+		 * backend/utils/misc/guc.c
+		 */
 		"enable_seqscan",
 		"enable_indexscan",
 		"enable_tidscan",
@@ -304,7 +308,11 @@ psql_completion(char *text, int start, int end)
 
 		COMPLETE_WITH_LIST(list_ALTER);
 	}
-	/* If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or RENAME */
+
+	/*
+	 * If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or
+	 * RENAME
+	 */
 	else if (strcasecmp(prev3_wd, "ALTER") == 0 && strcasecmp(prev2_wd, "TABLE") == 0)
 	{
 		char	   *list_ALTER2[] = {"ADD", "ALTER", "RENAME", NULL};
@@ -320,15 +328,16 @@ psql_completion(char *text, int start, int end)
 	else if (strcasecmp(prev3_wd, "ALTER") == 0 && strcasecmp(prev2_wd, "GROUP") == 0)
 	{
 		char	   *list_ALTERGROUP[] = {"ADD", "DROP", NULL};
+
 		COMPLETE_WITH_LIST(list_ALTERGROUP);
 	}
 	/* complete ALTER GROUP <foo> ADD|DROP with USER */
 	else if (strcasecmp(prev4_wd, "ALTER") == 0 && strcasecmp(prev3_wd, "GROUP") == 0
-			 && (strcasecmp(prev_wd, "ADD")==0 || strcasecmp(prev_wd, "DROP")==0))
+			 && (strcasecmp(prev_wd, "ADD") == 0 || strcasecmp(prev_wd, "DROP") == 0))
 		COMPLETE_WITH_CONST("USER");
 	/* complete {ALTER} GROUP <foo> ADD|DROP USER with a user name */
 	else if (strcasecmp(prev4_wd, "GROUP") == 0
-			 && (strcasecmp(prev2_wd, "ADD")==0 || strcasecmp(prev2_wd, "DROP")==0)
+			 && (strcasecmp(prev2_wd, "ADD") == 0 || strcasecmp(prev2_wd, "DROP") == 0)
 			 && strcasecmp(prev_wd, "USER") == 0)
 		COMPLETE_WITH_QUERY(Query_for_list_of_users);
 
@@ -358,16 +367,17 @@ psql_completion(char *text, int start, int end)
 	}
 
 /* COMMENT */
-	else if (strcasecmp(prev_wd, "COMMENT")==0)
+	else if (strcasecmp(prev_wd, "COMMENT") == 0)
 		COMPLETE_WITH_CONST("ON");
-	else if (strcasecmp(prev2_wd, "COMMENT")==0 && strcasecmp(prev_wd, "ON")==0)
+	else if (strcasecmp(prev2_wd, "COMMENT") == 0 && strcasecmp(prev_wd, "ON") == 0)
 	{
-		char * list_COMMENT[] =
+		char	   *list_COMMENT[] =
 		{"DATABASE", "INDEX", "RULE", "SEQUENCE", "TABLE", "TYPE", "VIEW",
-		 "COLUMN", "AGGREGATE", "FUNCTION", "OPERATOR", "TRIGGER", NULL};
+		"COLUMN", "AGGREGATE", "FUNCTION", "OPERATOR", "TRIGGER", NULL};
+
 		COMPLETE_WITH_LIST(list_COMMENT);
 	}
-	else if (strcasecmp(prev4_wd, "COMMENT")==0 && strcasecmp(prev3_wd, "ON")==0)
+	else if (strcasecmp(prev4_wd, "COMMENT") == 0 && strcasecmp(prev3_wd, "ON") == 0)
 		COMPLETE_WITH_CONST("IS");
 
 /* COPY */
@@ -578,22 +588,23 @@ psql_completion(char *text, int start, int end)
 	/* (If you want more with LOCK, you better think about it yourself.) */
 
 /* NOTIFY */
-	else if (strcasecmp(prev_wd, "NOTIFY")==0)
+	else if (strcasecmp(prev_wd, "NOTIFY") == 0)
 		COMPLETE_WITH_QUERY("SELECT relname FROM pg_listener WHERE substr(relname,1,%d)='%s'");
 
 /* REINDEX */
 	else if (strcasecmp(prev_wd, "REINDEX") == 0)
 	{
-		char *list_REINDEX[] = {"TABLE", "DATABASE", "INDEX", NULL};
+		char	   *list_REINDEX[] = {"TABLE", "DATABASE", "INDEX", NULL};
+
 		COMPLETE_WITH_LIST(list_REINDEX);
 	}
-	else if (strcasecmp(prev2_wd, "REINDEX")==0)
+	else if (strcasecmp(prev2_wd, "REINDEX") == 0)
 	{
-		if (strcasecmp(prev_wd, "TABLE")==0)
+		if (strcasecmp(prev_wd, "TABLE") == 0)
 			COMPLETE_WITH_QUERY(Query_for_list_of_tables);
-		else if (strcasecmp(prev_wd, "DATABASE")==0)
+		else if (strcasecmp(prev_wd, "DATABASE") == 0)
 			COMPLETE_WITH_QUERY(Query_for_list_of_databases);
-		else if (strcasecmp(prev_wd, "INDEX")==0)
+		else if (strcasecmp(prev_wd, "INDEX") == 0)
 			COMPLETE_WITH_QUERY(Query_for_list_of_indexes);
 	}
 
@@ -628,9 +639,10 @@ psql_completion(char *text, int start, int end)
 			 strcasecmp(prev_wd, "READ") == 0)
 		COMPLETE_WITH_CONST("COMMITTED");
 	/* Complete SET CONSTRAINTS <foo> with DEFERRED|IMMEDIATE */
-	else if (strcasecmp(prev3_wd, "SET")==0 && strcasecmp(prev2_wd, "CONSTRAINTS")==0)
+	else if (strcasecmp(prev3_wd, "SET") == 0 && strcasecmp(prev2_wd, "CONSTRAINTS") == 0)
 	{
-		char *constraint_list[] = {"DEFERRED", "IMMEDIATE", NULL};
+		char	   *constraint_list[] = {"DEFERRED", "IMMEDIATE", NULL};
+
 		COMPLETE_WITH_LIST(constraint_list);
 	}
 	/* Complete SET <var> with "TO" */
@@ -662,11 +674,11 @@ psql_completion(char *text, int start, int end)
 	}
 
 /* TRUNCATE */
-	else if (strcasecmp(prev_wd, "TRUNCATE")==0)
+	else if (strcasecmp(prev_wd, "TRUNCATE") == 0)
 		COMPLETE_WITH_QUERY(Query_for_list_of_tables);
 
 /* UNLISTEN */
-	else if (strcasecmp(prev_wd, "UNLISTEN")==0)
+	else if (strcasecmp(prev_wd, "UNLISTEN") == 0)
 		COMPLETE_WITH_QUERY("SELECT relname FROM pg_listener WHERE substr(relname,1,%d)='%s' UNION SELECT '*'::text");
 
 /* UPDATE */
@@ -719,9 +731,7 @@ psql_completion(char *text, int start, int end)
 			 strcmp(prev_wd, "\\s") == 0 ||
 		   strcmp(prev_wd, "\\w") == 0 || strcmp(prev_wd, "\\write") == 0
 		)
-	{
 		matches = completion_matches(text, filename_completion_function);
-	}
 
 
 	/*
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index c033d4c3d08a534cc60c48c31f972fd27fefd257..f3498ffd2b640b2ee32ca7999944866d03afd66d 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -194,7 +194,7 @@ extern StrategyNumber RelationGetGISTStrategy(Relation, AttrNumber, RegProcedure
 
 extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void gist_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void gist_desc(char *buf, uint8 xl_info, char* rec);
+extern void gist_desc(char *buf, uint8 xl_info, char *rec);
 
 /* gistget.c */
 extern Datum gistgettuple(PG_FUNCTION_ARGS);
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 5cab47fa0bf8d424b96914d28b074bcac675ca42..871629a122051c3dec2723ae1581c72d5211a95b 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: hash.h,v 1.37 2001/01/24 19:43:19 momjian Exp $
+ * $Id: hash.h,v 1.38 2001/03/22 04:00:27 momjian Exp $
  *
  * NOTES
  *		modeled after Margo Seltzer's hash implementation for unix.
@@ -335,6 +335,6 @@ extern void _hash_checkpage(Page page, int flags);
 /* hash.c */
 extern void hash_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void hash_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void hash_desc(char *buf, uint8 xl_info, char* rec);
+extern void hash_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif	 /* HASH_H */
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 5ab8a694743ccfa6a6fcc0c2355aa367ae4a610f..4c499151b3e3e62fc1767db20972a12fb814d9bb 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heapam.h,v 1.62 2001/01/24 19:43:19 momjian Exp $
+ * $Id: heapam.h,v 1.63 2001/03/22 04:00:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,12 +136,12 @@ extern Datum nocachegetattr(HeapTuple tup, int attnum,
 	)																\
 )
 
-#else /* defined(DISABLE_COMPLEX_MACRO) */
+#else							/* defined(DISABLE_COMPLEX_MACRO) */
 
 extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
-						 bool *isnull);
+			bool *isnull);
 
-#endif /* defined(DISABLE_COMPLEX_MACRO) */
+#endif	 /* defined(DISABLE_COMPLEX_MACRO) */
 
 
 /* ----------------
@@ -211,13 +211,13 @@ extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
 extern int	heap_mark4update(Relation relation, HeapTuple tup, Buffer *userbuf);
 extern void simple_heap_delete(Relation relation, ItemPointer tid);
 extern void simple_heap_update(Relation relation, ItemPointer otid,
-							   HeapTuple tup);
+				   HeapTuple tup);
 extern void heap_markpos(HeapScanDesc scan);
 extern void heap_restrpos(HeapScanDesc scan);
 
 extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void heap_undo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void heap_desc(char *buf, uint8 xl_info, char* rec);
+extern void heap_desc(char *buf, uint8 xl_info, char *rec);
 
 /* in common/heaptuple.c */
 extern Size ComputeDataSize(TupleDesc tupleDesc, Datum *value, char *nulls);
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 76306b67bb6cf0b6b339d31459f93c8f595500d9..8b330d82ec863a770275f3fc4137498e80db22cb 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: htup.h,v 1.46 2001/02/21 19:07:04 momjian Exp $
+ * $Id: htup.h,v 1.47 2001/03/22 04:00:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,7 +25,7 @@
  * a tuple, plus the size of the null-values bitmap (at 1 bit per column),
  * plus MAXALIGN alignment, must fit into t_hoff which is uint8.  On most
  * machines the absolute upper limit without making t_hoff wider would be
- * about 1700.  Note, however, that depending on column data types you will
+ * about 1700.	Note, however, that depending on column data types you will
  * likely also be running into the disk-block-based limit on overall tuple
  * size if you have more than a thousand or so columns.  TOAST won't help.
  */
@@ -33,7 +33,7 @@
 
 /*
  * This is the on-disk copy of the tuple.
- * 
+ *
  * To avoid wasting space, the attributes should be layed out in such a
  * way to reduce structure padding.
  */
@@ -55,7 +55,7 @@ typedef struct HeapTupleHeaderData
 
 	uint8		t_hoff;			/* sizeof() tuple header */
 
-								/* ^ - 31 bytes - ^ */
+	/* ^ - 31 bytes - ^ */
 
 	bits8		t_bits[MinHeapTupleBitmapSize / 8];
 	/* bit map of NULLs */
@@ -69,41 +69,41 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
  * XLOG allows to store some information in high 4 bits of log
  * record xl_info field
  */
-#define	XLOG_HEAP_INSERT	0x00
-#define	XLOG_HEAP_DELETE	0x10
-#define	XLOG_HEAP_UPDATE	0x20
-#define	XLOG_HEAP_MOVE		0x30
-#define	XLOG_HEAP_CLEAN		0x40
+#define XLOG_HEAP_INSERT	0x00
+#define XLOG_HEAP_DELETE	0x10
+#define XLOG_HEAP_UPDATE	0x20
+#define XLOG_HEAP_MOVE		0x30
+#define XLOG_HEAP_CLEAN		0x40
 #define XLOG_HEAP_OPMASK	0x70
 /*
  * When we insert 1st item on new page in INSERT/UPDATE
  * we can (and we do) restore entire page in redo
  */
-#define	XLOG_HEAP_INIT_PAGE	0x80
+#define XLOG_HEAP_INIT_PAGE 0x80
 
 /*
  * All what we need to find changed tuple (18 bytes)
  */
 typedef struct xl_heaptid
 {
-	RelFileNode			node;
-	ItemPointerData		tid;		/* changed tuple id */
+	RelFileNode node;
+	ItemPointerData tid;		/* changed tuple id */
 } xl_heaptid;
 
 /* This is what we need to know about delete */
 typedef struct xl_heap_delete
 {
-	xl_heaptid			target;		/* deleted tuple id */
+	xl_heaptid	target;			/* deleted tuple id */
 } xl_heap_delete;
 
-#define	SizeOfHeapDelete	(offsetof(xl_heaptid, tid) + SizeOfIptrData)
+#define SizeOfHeapDelete	(offsetof(xl_heaptid, tid) + SizeOfIptrData)
 
 typedef struct xl_heap_header
 {
-	Oid					t_oid;
-	int16				t_natts;
-	uint8				t_hoff;
-	uint8				mask;		/* low 8 bits of t_infomask */
+	Oid			t_oid;
+	int16		t_natts;
+	uint8		t_hoff;
+	uint8		mask;			/* low 8 bits of t_infomask */
 } xl_heap_header;
 
 #define SizeOfHeapHeader	(offsetof(xl_heap_header, mask) + sizeof(uint8))
@@ -111,7 +111,7 @@ typedef struct xl_heap_header
 /* This is what we need to know about insert */
 typedef struct xl_heap_insert
 {
-	xl_heaptid			target;		/* inserted tuple id */
+	xl_heaptid	target;			/* inserted tuple id */
 	/* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */
 } xl_heap_insert;
 
@@ -120,8 +120,8 @@ typedef struct xl_heap_insert
 /* This is what we need to know about update|move */
 typedef struct xl_heap_update
 {
-	xl_heaptid			target;		/* deleted tuple id */
-	ItemPointerData		newtid;		/* new inserted tuple id */
+	xl_heaptid	target;			/* deleted tuple id */
+	ItemPointerData newtid;		/* new inserted tuple id */
 	/* NEW TUPLE xl_heap_header (XMIN & XMAX FOR MOVE OP) */
 	/* and TUPLE DATA FOLLOWS AT END OF STRUCT */
 } xl_heap_update;
@@ -131,16 +131,16 @@ typedef struct xl_heap_update
 /* This is what we need to know about page cleanup */
 typedef struct xl_heap_clean
 {
-	RelFileNode			node;
-	BlockNumber			block;
+	RelFileNode node;
+	BlockNumber block;
 	/* UNUSED OFFSET NUMBERS FOLLOW AT THE END */
 } xl_heap_clean;
 
-#define	SizeOfHeapClean	(offsetof(xl_heap_clean, block) + sizeof(BlockNumber))
+#define SizeOfHeapClean (offsetof(xl_heap_clean, block) + sizeof(BlockNumber))
 
 /*
  * MaxTupleSize is the maximum allowed size of a tuple, including header and
- * MAXALIGN alignment padding.  Basically it's BLCKSZ minus the other stuff
+ * MAXALIGN alignment padding.	Basically it's BLCKSZ minus the other stuff
  * that has to be on a disk page.  The "other stuff" includes access-method-
  * dependent "special space", which we assume will be no more than
  * MaxSpecialSpace bytes (currently, on heap pages it's actually zero).
@@ -172,7 +172,7 @@ typedef struct xl_heap_clean
 #define MinCommandIdAttributeNumber				(-4)
 #define MaxTransactionIdAttributeNumber			(-5)
 #define MaxCommandIdAttributeNumber				(-6)
-#define TableOidAttributeNumber			        (-7)
+#define TableOidAttributeNumber					(-7)
 #define FirstLowInvalidHeapAttributeNumber		(-8)
 
 /*
@@ -193,11 +193,11 @@ typedef struct xl_heap_clean
  */
 typedef struct HeapTupleData
 {
-	uint32			t_len;			/* length of *t_data */
-	ItemPointerData t_self;			/* SelfItemPointer */
-	Oid				t_tableOid;		/* table the tuple came from */
-	MemoryContext	t_datamcxt;		/* memory context of allocation */
-	HeapTupleHeader	t_data;			/* -> tuple header and data */
+	uint32		t_len;			/* length of *t_data */
+	ItemPointerData t_self;		/* SelfItemPointer */
+	Oid			t_tableOid;		/* table the tuple came from */
+	MemoryContext t_datamcxt;	/* memory context of allocation */
+	HeapTupleHeader t_data;		/* -> tuple header and data */
 } HeapTupleData;
 
 typedef HeapTupleData *HeapTuple;
@@ -240,7 +240,7 @@ typedef HeapTupleData *HeapTuple;
 #define HEAP_HASEXTENDED		0x000C	/* the two above combined */
 
 #define HEAP_XMAX_UNLOGGED		0x0080	/* to lock tuple for update */
-										/* without logging */
+ /* without logging */
 #define HEAP_XMIN_COMMITTED		0x0100	/* t_xmin committed */
 #define HEAP_XMIN_INVALID		0x0200	/* t_xmin invalid/aborted */
 #define HEAP_XMAX_COMMITTED		0x0400	/* t_xmax committed */
diff --git a/src/include/access/istrat.h b/src/include/access/istrat.h
index f525f41922c67dbb52b79bbc6b97ae8d9216dcfb..bb12a5eafb187fbf8f8bf7ccc22f8cb8956fb664 100644
--- a/src/include/access/istrat.h
+++ b/src/include/access/istrat.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: istrat.h,v 1.19 2001/01/24 19:43:19 momjian Exp $
+ * $Id: istrat.h,v 1.20 2001/03/22 04:00:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -56,12 +56,12 @@ extern StrategyNumber RelationGetStrategy(Relation relation,
 			   AttrNumber attributeNumber, StrategyEvaluation evaluation,
 					RegProcedure procedure);
 extern void IndexSupportInitialize(IndexStrategy indexStrategy,
-								   RegProcedure *indexSupport,
-								   bool *isUnique,
-								   Oid indexObjectId,
-								   Oid accessMethodObjectId,
-								   StrategyNumber maxStrategyNumber,
-								   StrategyNumber maxSupportNumber,
-								   AttrNumber maxAttributeNumber);
+					   RegProcedure *indexSupport,
+					   bool *isUnique,
+					   Oid indexObjectId,
+					   Oid accessMethodObjectId,
+					   StrategyNumber maxStrategyNumber,
+					   StrategyNumber maxSupportNumber,
+					   AttrNumber maxAttributeNumber);
 
 #endif	 /* ISTRAT_H */
diff --git a/src/include/access/itup.h b/src/include/access/itup.h
index 7c6adc8b2615f70fcff1218bd58f761be5796619..bf31c9e2a857e45bab9c736c140fa869b2a13aa3 100644
--- a/src/include/access/itup.h
+++ b/src/include/access/itup.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itup.h,v 1.30 2001/02/22 21:48:49 momjian Exp $
+ * $Id: itup.h,v 1.31 2001/03/22 04:00:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -75,8 +75,8 @@ typedef RetrieveIndexResultData *RetrieveIndexResult;
 
 #define IndexTupleSize(itup)		((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK))
 #define IndexTupleDSize(itup)		((Size) ((itup).t_info & INDEX_SIZE_MASK))
-#define IndexTupleHasNulls(itup) 	((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK))
-#define IndexTupleHasVarlenas(itup)	((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))
+#define IndexTupleHasNulls(itup)	((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK))
+#define IndexTupleHasVarlenas(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))
 
 #define IndexTupleHasMinHeader(itup) (!IndexTupleHasNulls(itup))
 
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index de094670bfb930804f93a0f293222bf494c38e2c..1ba7f963303297f3dc3ea382892af01bab8c1194 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nbtree.h,v 1.54 2001/02/22 23:02:33 momjian Exp $
+ * $Id: nbtree.h,v 1.55 2001/03/22 04:00:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,7 +22,7 @@
 /*
  *	BTPageOpaqueData -- At the end of every page, we store a pointer
  *	to both siblings in the tree.  This is used to do forward/backward
- *  index scans.  See Lehman and Yao's paper for more
+ *	index scans.  See Lehman and Yao's paper for more
  *	info.  In addition, we need to know what type of page this is
  *	(leaf or internal), and whether the page is available for reuse.
  *
@@ -35,8 +35,8 @@ typedef struct BTPageOpaqueData
 {
 	BlockNumber btpo_prev;		/* used for backward index scans */
 	BlockNumber btpo_next;		/* used for forward index scans */
-	BlockNumber btpo_parent;	/* pointer to parent, but not updated
-								   on parent split */
+	BlockNumber btpo_parent;	/* pointer to parent, but not updated on
+								 * parent split */
 	uint16		btpo_flags;		/* LEAF?, ROOT?, FREE?, META?, REORDER? */
 
 } BTPageOpaqueData;
@@ -44,11 +44,11 @@ typedef struct BTPageOpaqueData
 typedef BTPageOpaqueData *BTPageOpaque;
 
 /* Bits defined in btpo_flags */
-#define BTP_LEAF		(1 << 0)	/* leaf page, if not internal page */
-#define BTP_ROOT		(1 << 1)	/* root page (has no parent) */
-#define BTP_FREE		(1 << 2)	/* page not in use */
-#define BTP_META		(1 << 3)	/* meta-page */
-#define	BTP_REORDER		(1 << 4)	/* items need reordering */
+#define BTP_LEAF		(1 << 0)/* leaf page, if not internal page */
+#define BTP_ROOT		(1 << 1)/* root page (has no parent) */
+#define BTP_FREE		(1 << 2)/* page not in use */
+#define BTP_META		(1 << 3)/* meta-page */
+#define BTP_REORDER		(1 << 4)/* items need reordering */
 
 
 /*
@@ -67,15 +67,15 @@ typedef struct BTMetaPageData
 #define BTPageGetMeta(p) \
 	((BTMetaPageData *) &((PageHeader) p)->pd_linp[0])
 
-#define BTREE_METAPAGE	0			/* first page is meta */
-#define BTREE_MAGIC		0x053162	/* magic number of btree pages */
+#define BTREE_METAPAGE	0		/* first page is meta */
+#define BTREE_MAGIC		0x053162/* magic number of btree pages */
 
 #define BTreeInvalidParent(opaque)	\
 	(opaque->btpo_parent == InvalidBlockNumber || \
 		opaque->btpo_parent == BTREE_METAPAGE)
 
 #define BTREE_VERSION	1
-	
+
 /*
  *	BTScanOpaqueData is used to remember which buffers we're currently
  *	examining in the scan.	We keep these buffers pinned (but not locked,
@@ -101,8 +101,8 @@ typedef struct BTScanOpaqueData
 	/* these fields are set by _bt_orderkeys(), which see for more info: */
 	bool		qual_ok;		/* false if qual can never be satisfied */
 	uint16		numberOfKeys;	/* number of scan keys */
-	uint16		numberOfRequiredKeys; /* number of keys that must be matched
-									   * to continue the scan */
+	uint16		numberOfRequiredKeys;	/* number of keys that must be
+										 * matched to continue the scan */
 	ScanKey		keyData;		/* array of scan keys */
 } BTScanOpaqueData;
 
@@ -136,7 +136,7 @@ typedef struct BTItemData
 
 typedef BTItemData *BTItem;
 
-/* 
+/*
  * For XLOG: size without alignement. Sizeof works as long as
  * IndexTupleData has exactly 8 bytes.
  */
@@ -217,28 +217,28 @@ typedef BTStackData *BTStack;
 
 #define P_HIKEY				((OffsetNumber) 1)
 #define P_FIRSTKEY			((OffsetNumber) 2)
-#define P_FIRSTDATAKEY(opaque)  (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)
+#define P_FIRSTDATAKEY(opaque)	(P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)
 
 /*
  * XLOG allows to store some information in high 4 bits of log
  * record xl_info field
  */
-#define	XLOG_BTREE_DELETE	0x00	/* delete btitem */
-#define	XLOG_BTREE_INSERT	0x10	/* add btitem without split */
-#define	XLOG_BTREE_SPLIT	0x20	/* add btitem with split */
-#define	XLOG_BTREE_SPLEFT	0x30	/* as above + flag that new btitem */
-									/* goes to the left sibling */
-#define	XLOG_BTREE_NEWROOT	0x40	/* new root page */
+#define XLOG_BTREE_DELETE	0x00/* delete btitem */
+#define XLOG_BTREE_INSERT	0x10/* add btitem without split */
+#define XLOG_BTREE_SPLIT	0x20/* add btitem with split */
+#define XLOG_BTREE_SPLEFT	0x30/* as above + flag that new btitem */
+ /* goes to the left sibling */
+#define XLOG_BTREE_NEWROOT	0x40/* new root page */
 
-#define	XLOG_BTREE_LEAF		0x80	/* leaf/internal page was changed */
+#define XLOG_BTREE_LEAF		0x80/* leaf/internal page was changed */
 
 /*
  * All what we need to find changed index tuple
  */
 typedef struct xl_btreetid
 {
-	RelFileNode			node;
-	ItemPointerData		tid;		/* changed tuple id */
+	RelFileNode node;
+	ItemPointerData tid;		/* changed tuple id */
 } xl_btreetid;
 
 /*
@@ -246,48 +246,48 @@ typedef struct xl_btreetid
  */
 typedef struct xl_btree_delete
 {
-	xl_btreetid			target;		/* deleted tuple id */
+	xl_btreetid target;			/* deleted tuple id */
 } xl_btree_delete;
 
-#define	SizeOfBtreeDelete	(offsetof(xl_btreetid, tid) + SizeOfIptrData)
+#define SizeOfBtreeDelete	(offsetof(xl_btreetid, tid) + SizeOfIptrData)
 
-/* 
+/*
  * This is what we need to know about pure (without split) insert
  */
 typedef struct xl_btree_insert
 {
-	xl_btreetid			target;		/* inserted tuple id */
+	xl_btreetid target;			/* inserted tuple id */
 	/* BTITEM FOLLOWS AT END OF STRUCT */
 } xl_btree_insert;
 
 #define SizeOfBtreeInsert	(offsetof(xl_btreetid, tid) + SizeOfIptrData)
 
-/* 
+/*
  * On insert with split we save items of both left and right siblings
  * and restore content of both pages from log record
  */
 typedef struct xl_btree_split
 {
-	xl_btreetid			target;		/* inserted tuple id */
-	BlockIdData			otherblk;	/* second block participated in split: */
-									/* first one is stored in target' tid */
-	BlockIdData			parentblk;	/* parent block */
-	BlockIdData			leftblk;	/* prev left block */
-	BlockIdData			rightblk;	/* next right block */
-	uint16				leftlen;	/* len of left page items below */
+	xl_btreetid target;			/* inserted tuple id */
+	BlockIdData otherblk;		/* second block participated in split: */
+	/* first one is stored in target' tid */
+	BlockIdData parentblk;		/* parent block */
+	BlockIdData leftblk;		/* prev left block */
+	BlockIdData rightblk;		/* next right block */
+	uint16		leftlen;		/* len of left page items below */
 	/* LEFT AND RIGHT PAGES ITEMS FOLLOW AT THE END */
 } xl_btree_split;
 
 #define SizeOfBtreeSplit	(offsetof(xl_btree_split, leftlen) + sizeof(uint16))
 
-/* 
- * New root log record. 
+/*
+ * New root log record.
  */
 typedef struct xl_btree_newroot
 {
-	RelFileNode			node;
-	int32				level;
-	BlockIdData			rootblk;
+	RelFileNode node;
+	int32		level;
+	BlockIdData rootblk;
 	/* 0 or 2 BTITEMS FOLLOW AT END OF STRUCT */
 } xl_btree_newroot;
 
@@ -332,7 +332,7 @@ extern Datum btdelete(PG_FUNCTION_ARGS);
 
 extern void btree_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void btree_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void btree_desc(char *buf, uint8 xl_info, char* rec);
+extern void btree_desc(char *buf, uint8 xl_info, char *rec);
 
 /*
  * prototypes for functions in nbtinsert.c
@@ -365,13 +365,13 @@ extern void AtEOXact_nbtree(void);
  * prototypes for functions in nbtsearch.c
  */
 extern BTStack _bt_search(Relation rel, int keysz, ScanKey scankey,
-						  Buffer *bufP, int access);
+		   Buffer *bufP, int access);
 extern Buffer _bt_moveright(Relation rel, Buffer buf, int keysz,
 			  ScanKey scankey, int access);
 extern OffsetNumber _bt_binsrch(Relation rel, Buffer buf, int keysz,
-								ScanKey scankey);
+			ScanKey scankey);
 extern int32 _bt_compare(Relation rel, int keysz, ScanKey scankey,
-						 Page page, OffsetNumber offnum);
+			Page page, OffsetNumber offnum);
 extern RetrieveIndexResult _bt_next(IndexScanDesc scan, ScanDirection dir);
 extern RetrieveIndexResult _bt_first(IndexScanDesc scan, ScanDirection dir);
 extern bool _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
@@ -391,7 +391,7 @@ extern void _bt_freeskey(ScanKey skey);
 extern void _bt_freestack(BTStack stack);
 extern void _bt_orderkeys(Relation relation, BTScanOpaque so);
 extern bool _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple,
-						  ScanDirection dir, bool *continuescan);
+			  ScanDirection dir, bool *continuescan);
 extern BTItem _bt_formitem(IndexTuple itup);
 
 /*
diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h
index f6a4f237c31a46c5a34d13d77b37537237f7a3cd..eab2fd3db1396506b7c9127e345714c6ebeb039e 100644
--- a/src/include/access/printtup.h
+++ b/src/include/access/printtup.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: printtup.h,v 1.14 2001/01/24 19:43:19 momjian Exp $
+ * $Id: printtup.h,v 1.15 2001/03/22 04:00:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,13 +20,13 @@ extern DestReceiver *printtup_create_DR(bool isBinary);
 
 extern void showatts(char *name, TupleDesc attinfo);
 extern void debugtup(HeapTuple tuple, TupleDesc typeinfo,
-					 DestReceiver *self);
+		 DestReceiver *self);
 
 /* XXX this one is really in executor/spi.c */
 extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc,
-						 DestReceiver *self);
+			 DestReceiver *self);
 
 extern bool getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
-							  bool *typIsVarlena);
+				  bool *typIsVarlena);
 
 #endif	 /* PRINTTUP_H */
diff --git a/src/include/access/rtree.h b/src/include/access/rtree.h
index 0226e6327ecb28c192214b72e8b765e0f4bd0c8f..4be5c83d537878ea9ccc0e151f37785d645b506d 100644
--- a/src/include/access/rtree.h
+++ b/src/include/access/rtree.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rtree.h,v 1.21 2001/01/24 19:43:19 momjian Exp $
+ * $Id: rtree.h,v 1.22 2001/03/22 04:00:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ extern void _rtdump(Relation r);
 
 extern void rtree_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void rtree_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void rtree_desc(char *buf, uint8 xl_info, char* rec);
+extern void rtree_desc(char *buf, uint8 xl_info, char *rec);
 
 /* rtscan.c */
 extern void rtadjscans(Relation r, int op, BlockNumber blkno,
diff --git a/src/include/access/strat.h b/src/include/access/strat.h
index 445e1e871ef35a6a7562d6c293571165c0139cc6..4c4ed0b4cd6c40cd96467b9290d30d35d86f3199 100644
--- a/src/include/access/strat.h
+++ b/src/include/access/strat.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: strat.h,v 1.19 2001/01/24 19:43:19 momjian Exp $
+ * $Id: strat.h,v 1.20 2001/03/22 04:00:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,6 +37,7 @@ typedef struct StrategyTransformMapData
 								 *
 								 *
 								 *
+								 *
 								 * STRUCTURE */
 
 typedef StrategyTransformMapData *StrategyTransformMap;
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index 9007c24e8995bd51b76737434372ac8299dfa4a1..0da7fe565002a0b4237fcc3b37e3afd5903f855e 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: transam.h,v 1.31 2001/03/18 20:18:59 tgl Exp $
+ * $Id: transam.h,v 1.32 2001/03/22 04:00:31 momjian Exp $
  *
  *	 NOTES
  *		Transaction System Version 101 now support proper oid
@@ -84,8 +84,8 @@ typedef unsigned char XidStatus;/* (2 bits) */
  */
 typedef struct LogRelationContentsData
 {
-	XLogRecPtr	LSN;		/* temp hack: LSN is member of any block */
-							/* so should be described in bufmgr */
+	XLogRecPtr	LSN;			/* temp hack: LSN is member of any block */
+	/* so should be described in bufmgr */
 	int			TransSystemVersion;
 } LogRelationContentsData;
 
@@ -120,7 +120,8 @@ typedef struct VariableRelationContentsData
 } VariableRelationContentsData;
 
 typedef VariableRelationContentsData *VariableRelationContents;
-#endif /* NOT_USED */
+
+#endif	 /* NOT_USED */
 
 /*
  * VariableCache is placed in shmem and used by
@@ -128,9 +129,9 @@ typedef VariableRelationContentsData *VariableRelationContents;
  */
 typedef struct VariableCacheData
 {
-	TransactionId	nextXid;	/* next XID to assign */
-	Oid				nextOid;	/* next OID to assign */
-	uint32			oidCount;	/* OIDs available before must do XLOG work */
+	TransactionId nextXid;		/* next XID to assign */
+	Oid			nextOid;		/* next OID to assign */
+	uint32		oidCount;		/* OIDs available before must do XLOG work */
 } VariableCacheData;
 
 typedef VariableCacheData *VariableCache;
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 9b12407e395b5807a6c5131abcd49ee4b812d621..f1bf680f31c1dfa96823bbc96abd4ff2cfb18953 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tupmacs.h,v 1.16 2001/01/24 19:43:20 momjian Exp $
+ * $Id: tupmacs.h,v 1.17 2001/03/22 04:00:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,7 +68,7 @@
 	PointerGetDatum((char *) (T)) \
 )
 
-#else /* SIZEOF_DATUM != 8 */
+#else							/* SIZEOF_DATUM != 8 */
 
 #define fetch_att(T,attbyval,attlen) \
 ( \
@@ -91,7 +91,7 @@
 	PointerGetDatum((char *) (T)) \
 )
 
-#endif /* SIZEOF_DATUM == 8 */
+#endif	 /* SIZEOF_DATUM == 8 */
 
 /*
  * att_align aligns the given offset as needed for a datum of length attlen
@@ -158,7 +158,7 @@
 		} \
 	} while (0)
 
-#else /* SIZEOF_DATUM != 8 */
+#else							/* SIZEOF_DATUM != 8 */
 
 #define store_att_byval(T,newdatum,attlen) \
 	do { \
@@ -180,6 +180,6 @@
 		} \
 	} while (0)
 
-#endif /* SIZEOF_DATUM == 8 */
+#endif	 /* SIZEOF_DATUM == 8 */
 
 #endif
diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h
index 05c4b2c1e408eb353ec4b997a5d921dca5f9f34f..759ab3d39e2494de4fa021c8070ac7e5da62d283 100644
--- a/src/include/access/tuptoaster.h
+++ b/src/include/access/tuptoaster.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 2000, PostgreSQL Development Team
  *
- * $Id: tuptoaster.h,v 1.9 2001/02/15 20:57:01 tgl Exp $
+ * $Id: tuptoaster.h,v 1.10 2001/03/22 04:00:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,7 +49,7 @@
 
 /*
  * When we store an oversize datum externally, we divide it into chunks
- * containing at most TOAST_MAX_CHUNK_SIZE data bytes.  This number *must*
+ * containing at most TOAST_MAX_CHUNK_SIZE data bytes.	This number *must*
  * be small enough that the completed toast-table tuple (including the
  * ID and sequence fields and all overhead) is no more than MaxTupleSize
  * bytes.  It *should* be small enough to make toast-table tuples no more
@@ -80,7 +80,7 @@
  * ----------
  */
 extern void heap_tuple_toast_attrs(Relation rel,
-				HeapTuple newtup, HeapTuple oldtup);
+					   HeapTuple newtup, HeapTuple oldtup);
 
 /* ----------
  * heap_tuple_fetch_attr() -
@@ -90,7 +90,7 @@ extern void heap_tuple_toast_attrs(Relation rel,
  *		in compressed format.
  * ----------
  */
-extern varattrib *heap_tuple_fetch_attr(varattrib * attr);
+extern varattrib *heap_tuple_fetch_attr(varattrib *attr);
 
 /* ----------
  * heap_tuple_untoast_attr() -
@@ -99,7 +99,7 @@ extern varattrib *heap_tuple_fetch_attr(varattrib * attr);
  *		it as needed.
  * ----------
  */
-extern varattrib *heap_tuple_untoast_attr(varattrib * attr);
+extern varattrib *heap_tuple_untoast_attr(varattrib *attr);
 
 /* ----------
  * toast_compress_datum -
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 2196aa84b2e484c639ade1030f0e6f72fbeb7ddb..ab75ec001f0164e3a9213de514bfbcec61db37b3 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xact.h,v 1.32 2001/01/24 19:43:20 momjian Exp $
+ * $Id: xact.h,v 1.33 2001/03/22 04:00:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -82,15 +82,15 @@ typedef TransactionStateData *TransactionState;
  * XLOG allows to store some information in high 4 bits of log
  * record xl_info field
  */
-#define XLOG_XACT_COMMIT    0x00
-#define XLOG_XACT_ABORT     0x20
+#define XLOG_XACT_COMMIT	0x00
+#define XLOG_XACT_ABORT		0x20
 
 typedef struct xl_xact_commit
 {
 	time_t		xtime;
+
 	/*
-	 * Array of RelFileNode-s to drop may follow
-	 * at the end of struct
+	 * Array of RelFileNode-s to drop may follow at the end of struct
 	 */
 } xl_xact_commit;
 
@@ -101,7 +101,7 @@ typedef struct xl_xact_abort
 	time_t		xtime;
 } xl_xact_abort;
 
-#define SizeOfXactAbort	((offsetof(xl_xact_abort, xtime) + sizeof(time_t)))
+#define SizeOfXactAbort ((offsetof(xl_xact_abort, xtime) + sizeof(time_t)))
 
 /* ----------------
  *		extern definitions
@@ -135,12 +135,12 @@ extern void RecordTransactionCommit(void);
 
 extern TransactionId DisabledTransactionId;
 
-extern void XactPushRollback(void (*func) (void *), void* data);
+extern void XactPushRollback(void (*func) (void *), void *data);
 extern void XactPopRollback(void);
 
-extern void	xact_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void	xact_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void	xact_desc(char *buf, uint8 xl_info, char* rec);
+extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
+extern void xact_undo(XLogRecPtr lsn, XLogRecord *record);
+extern void xact_desc(char *buf, uint8 xl_info, char *rec);
 
 /* defined in xid.c */
 extern Datum xidin(PG_FUNCTION_ARGS);
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index b1808dfc26fb712c8cf3d92b583675af515b7c17..41a8d84dade4a667df4a8fffd5ef4904f22f3983 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xlog.h,v 1.22 2001/03/18 20:18:59 tgl Exp $
+ * $Id: xlog.h,v 1.23 2001/03/22 04:00:32 momjian Exp $
  */
 #ifndef XLOG_H
 #define XLOG_H
@@ -52,7 +52,7 @@ typedef struct XLogRecord
 /*
  * XLOG uses only low 4 bits of xl_info.  High 4 bits may be used by rmgr.
  */
-#define	XLR_INFO_MASK			0x0F
+#define XLR_INFO_MASK			0x0F
 
 /*
  * We support backup of up to 2 disk blocks per XLOG record (could support
@@ -60,9 +60,10 @@ typedef struct XLogRecord
  * do not need more than 2 anyway).  If we backed up any disk blocks then we
  * use flag bits in xl_info to signal it.
  */
-#define XLR_BKP_BLOCK_MASK		0x0C /* all info bits used for bkp blocks */
+#define XLR_BKP_BLOCK_MASK		0x0C	/* all info bits used for bkp
+										 * blocks */
 #define XLR_MAX_BKP_BLOCKS		2
-#define XLR_SET_BKP_BLOCK(iblk)	(0x08 >> (iblk))
+#define XLR_SET_BKP_BLOCK(iblk) (0x08 >> (iblk))
 #define XLR_BKP_BLOCK_1			XLR_SET_BKP_BLOCK(0)	/* 0x08 */
 #define XLR_BKP_BLOCK_2			XLR_SET_BKP_BLOCK(1)	/* 0x04 */
 
@@ -70,7 +71,7 @@ typedef struct XLogRecord
  * Sometimes we log records which are out of transaction control.
  * Rmgr may "or" XLOG_NO_TRAN into info passed to XLogInsert to indicate this.
  */
-#define	XLOG_NO_TRAN			XLR_INFO_MASK
+#define XLOG_NO_TRAN			XLR_INFO_MASK
 
 /*
  * Header info for a backup block appended to an XLOG record.
@@ -81,14 +82,14 @@ typedef struct XLogRecord
  */
 typedef struct BkpBlock
 {
-	crc64			crc;
-	RelFileNode		node;
-	BlockNumber		block;
+	crc64		crc;
+	RelFileNode node;
+	BlockNumber block;
 } BkpBlock;
 
 /*
  * When there is not enough space on current page for whole record, we
- * continue on the next page with continuation record.  (However, the
+ * continue on the next page with continuation record.	(However, the
  * XLogRecord header will never be split across pages; if there's less than
  * SizeOfXLogRecord space left at the end of a page, we just waste it.)
  *
@@ -101,9 +102,9 @@ typedef struct XLogContRecord
 
 	/* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */
 
-} XLogContRecord;
+}			XLogContRecord;
 
-#define	SizeOfXLogContRecord	MAXALIGN(sizeof(XLogContRecord))
+#define SizeOfXLogContRecord	MAXALIGN(sizeof(XLogContRecord))
 
 /*
  * Each page of XLOG file has a header like this:
@@ -132,7 +133,7 @@ typedef XLogPageHeaderData *XLogPageHeader;
  * that we don't have problems representing last-byte-position-plus-1.
  */
 #define XLogSegSize		((uint32) (16*1024*1024))
-#define XLogSegsPerFile	(((uint32) 0xffffffff) / XLogSegSize)
+#define XLogSegsPerFile (((uint32) 0xffffffff) / XLogSegSize)
 #define XLogFileSize	(XLogSegsPerFile * XLogSegSize)
 
 /*
@@ -143,9 +144,9 @@ typedef XLogPageHeaderData *XLogPageHeader;
 typedef struct RmgrData
 {
 	char	   *rm_name;
-	void	   (*rm_redo)(XLogRecPtr lsn, XLogRecord *rptr);
-	void	   (*rm_undo)(XLogRecPtr lsn, XLogRecord *rptr);
-	void	   (*rm_desc)(char *buf, uint8 xl_info, char *rec);
+	void		(*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr);
+	void		(*rm_undo) (XLogRecPtr lsn, XLogRecord *rptr);
+	void		(*rm_desc) (char *buf, uint8 xl_info, char *rec);
 } RmgrData;
 
 extern RmgrData RmgrTable[];
@@ -166,21 +167,21 @@ extern RmgrData RmgrTable[];
  */
 typedef struct XLogRecData
 {
-	Buffer				buffer;		/* buffer associated with this data */
-	char			   *data;
-	uint32				len;
+	Buffer		buffer;			/* buffer associated with this data */
+	char	   *data;
+	uint32		len;
 	struct XLogRecData *next;
 } XLogRecData;
 
-extern	StartUpID	ThisStartUpID;	/* current SUI */
-extern	bool		InRecovery;
-extern	XLogRecPtr	MyLastRecPtr;
+extern StartUpID ThisStartUpID; /* current SUI */
+extern bool InRecovery;
+extern XLogRecPtr MyLastRecPtr;
 
 /* these variables are GUC parameters related to XLOG */
-extern int CheckPointSegments;
-extern int XLOGbuffers;
-extern int XLOGfiles;
-extern int XLOG_DEBUG;
+extern int	CheckPointSegments;
+extern int	XLOGbuffers;
+extern int	XLOGfiles;
+extern int	XLOG_DEBUG;
 extern char *XLOG_sync_method;
 extern const char XLOG_sync_method_default[];
 
@@ -190,10 +191,10 @@ extern void XLogFlush(XLogRecPtr RecPtr);
 
 extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void xlog_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void xlog_desc(char *buf, uint8 xl_info, char* rec);
+extern void xlog_desc(char *buf, uint8 xl_info, char *rec);
 
 extern void UpdateControlFile(void);
-extern int XLOGShmemSize(void);
+extern int	XLOGShmemSize(void);
 extern void XLOGShmemInit(void);
 extern void XLOGPathInit(void);
 extern void BootStrapXLOG(void);
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
index bc7f9e1a36dff87c3907c735f509e355993f824b..d6af5eb4989e4e3d61f52bd61118c5bd44b7977a 100644
--- a/src/include/access/xlogdefs.h
+++ b/src/include/access/xlogdefs.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xlogdefs.h,v 1.2 2001/03/13 01:17:06 tgl Exp $
+ * $Id: xlogdefs.h,v 1.3 2001/03/22 04:00:32 momjian Exp $
  */
 #ifndef XLOG_DEFS_H
 #define XLOG_DEFS_H
@@ -23,8 +23,8 @@
  * NOTE: the "log file number" is somewhat misnamed, since the actual files
  * making up the XLOG are much smaller than 4Gb.  Each actual file is an
  * XLogSegSize-byte "segment" of a logical log file having the indicated
- * xlogid.  The log file number and segment number together identify a
- * physical XLOG file.  Segment number and offset within the physical file
+ * xlogid.	The log file number and segment number together identify a
+ * physical XLOG file.	Segment number and offset within the physical file
  * are computed from xrecoff div and mod XLogSegSize.
  */
 typedef struct XLogRecPtr
@@ -54,6 +54,6 @@ typedef struct XLogRecPtr
  * StartUpID (SUI) - system startups counter. It's to allow removing
  * pg_log after shutdown, in future.
  */
-typedef	uint32		StartUpID;
+typedef uint32 StartUpID;
 
 #endif	 /* XLOG_DEFS_H */
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h
index 1f1fff7c07f11e102a5a267e398b2aab47527efc..b31184b76bb1a7e8bcb526c1fedf77f05cdffeca 100644
--- a/src/include/access/xlogutils.h
+++ b/src/include/access/xlogutils.h
@@ -6,16 +6,16 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xlogutils.h,v 1.6 2001/03/13 01:17:06 tgl Exp $
+ * $Id: xlogutils.h,v 1.7 2001/03/22 04:00:32 momjian Exp $
  */
 #ifndef XLOG_UTILS_H
-#define	XLOG_UTILS_H
+#define XLOG_UTILS_H
 
 #include "access/rmgr.h"
 #include "utils/rel.h"
 
-extern int XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr, 
-					TransactionId xid, CommandId cid);
+extern int XLogIsOwnerOfTuple(RelFileNode hnode, ItemPointer iptr,
+				   TransactionId xid, CommandId cid);
 extern bool XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr);
 
 extern void XLogOpenLogRelation(void);
diff --git a/src/include/c.h b/src/include/c.h
index 5756aefedc3e0b913d9e2d94232a9bda126130df..ab960dc7fc47136eb847e3f0f975215a4d3c382c 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.91 2001/02/20 00:28:07 tgl Exp $
+ * $Id: c.h,v 1.92 2001/03/22 04:00:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,7 +36,7 @@
  *		8)		system-specific hacks
  *
  * NOTE: since this file is included by both frontend and backend modules, it's
- * almost certainly wrong to put an "extern" declaration here.  typedefs and macros
+ * almost certainly wrong to put an "extern" declaration here.	typedefs and macros
  * are the kind of thing that might go here.
  *
  *----------------------------------------------------------------
@@ -62,7 +62,7 @@
 
 #ifdef __CYGWIN__
 #include <errno.h>
-#include <sys/fcntl.h>		/* ensure O_BINARY is available */
+#include <sys/fcntl.h>			/* ensure O_BINARY is available */
 #endif
 #ifdef HAVE_SUPPORTDEFS_H
 #include <SupportDefs.h>
@@ -131,11 +131,12 @@
 /* BeOS defines bool already, but the compiler chokes on the
  * #ifndef unless we wrap it in this check.
  */
-#ifndef __BEOS__ 
+#ifndef __BEOS__
 
 #ifndef __cplusplus
 #ifndef bool
 typedef char bool;
+
 #endif	 /* ndef bool */
 #endif	 /* not C++ */
 
@@ -147,7 +148,7 @@ typedef char bool;
 #define false	((bool) 0)
 #endif
 
-#endif /* __BEOS__ */
+#endif	 /* __BEOS__ */
 
 typedef bool *BoolPtr;
 
@@ -188,11 +189,12 @@ typedef char *Pointer;
  *		used for numerical computations and the
  *		frontend/backend protocol.
  */
-#ifndef __BEOS__ /* this shouldn't be required, but is is! */
+#ifndef __BEOS__				/* this shouldn't be required, but is is! */
 typedef signed char int8;		/* == 8 bits */
 typedef signed short int16;		/* == 16 bits */
 typedef signed int int32;		/* == 32 bits */
-#endif /* __BEOS__ */
+
+#endif	 /* __BEOS__ */
 
 /*
  * uintN
@@ -200,11 +202,12 @@ typedef signed int int32;		/* == 32 bits */
  *		used for numerical computations and the
  *		frontend/backend protocol.
  */
-#ifndef __BEOS__ /* this shouldn't be required, but is is! */
+#ifndef __BEOS__				/* this shouldn't be required, but is is! */
 typedef unsigned char uint8;	/* == 8 bits */
 typedef unsigned short uint16;	/* == 16 bits */
 typedef unsigned int uint32;	/* == 32 bits */
-#endif /* __BEOS__ */
+
+#endif	 /* __BEOS__ */
 
 /*
  * boolN
@@ -250,24 +253,27 @@ typedef double *float64;
 /*
  * 64-bit integers
  */
-#ifndef __BEOS__ /* this is already defined on BeOS */
+#ifndef __BEOS__				/* this is already defined on BeOS */
 #ifdef HAVE_LONG_INT_64
 /* Plain "long int" fits, use it */
 typedef long int int64;
 typedef unsigned long int uint64;
+
 #else
 #ifdef HAVE_LONG_LONG_INT_64
 /* We have working support for "long long int", use that */
 typedef long long int int64;
 typedef unsigned long long int uint64;
+
 #else
 /* Won't actually work, but fall back to long int so that code compiles */
 typedef long int int64;
 typedef unsigned long int uint64;
+
 #define INT64_IS_BUSTED
 #endif
 #endif
-#endif /* __BEOS__ */
+#endif	 /* __BEOS__ */
 
 /*
  * Size
@@ -354,7 +360,7 @@ struct varlena
 typedef struct varlena bytea;
 typedef struct varlena text;
 typedef struct varlena BpChar;	/* blank-padded char, ie SQL char(n) */
-typedef struct varlena VarChar;	/* var-length char, ie SQL varchar(n) */
+typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */
 
 /*
  * Fixed-length array types (these are not varlena's!)
@@ -487,7 +493,7 @@ typedef NameData *Name;
  *	datum) and add a null, do not do it with StrNCpy(..., len+1).  That
  *	might seem to work, but it fetches one byte more than there is in the
  *	text object.  One fine day you'll have a SIGSEGV because there isn't
- *	another byte before the end of memory.  Don't laugh, we've had real
+ *	another byte before the end of memory.	Don't laugh, we've had real
  *	live bug reports from real live users over exactly this mistake.
  *	Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead.
  */
@@ -567,19 +573,19 @@ typedef NameData *Name;
  *				Section 8: system-specific hacks
  *
  *		This should be limited to things that absolutely have to be
- *		included in every source file.  The port-specific header file
+ *		included in every source file.	The port-specific header file
  *		is usually a better place for this sort of thing.
  * ----------------------------------------------------------------
  */
 
 #ifdef __CYGWIN__
 #define PG_BINARY	O_BINARY
-#define	PG_BINARY_R	"rb"
-#define	PG_BINARY_W	"wb"
+#define PG_BINARY_R "rb"
+#define PG_BINARY_W "wb"
 #else
-#define	PG_BINARY	0
-#define	PG_BINARY_R	"r"
-#define	PG_BINARY_W	"w"
+#define PG_BINARY	0
+#define PG_BINARY_R "r"
+#define PG_BINARY_W "w"
 #endif
 
 #if defined(sun) && defined(__sparc__) && !defined(__SVR4)
diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h
index d3d815c3364596ac22590759a3e875498ee09af1..8a51f87c033e77159e86afd7f0a105404aa8439c 100644
--- a/src/include/catalog/catalog.h
+++ b/src/include/catalog/catalog.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catalog.h,v 1.15 2001/01/24 19:43:20 momjian Exp $
+ * $Id: catalog.h,v 1.16 2001/03/22 04:00:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,11 +21,13 @@
 extern char *relpath(const char *relname);
 extern char *relpath_blind(const char *dbname, const char *relname,
 			  Oid dbid, Oid relid);
+
 #else
 #include "storage/relfilenode.h"
 
 extern char *relpath(RelFileNode rnode);
 extern char *GetDatabasePath(Oid tblNode);
+
 #endif
 
 extern bool IsSystemRelationName(const char *relname);
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index b91c4341840b58ccd4b3ff8966404a77a9dbeab5..963b11c1d386ed6df175ad0e2e92cfe2929af774 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catversion.h,v 1.69 2001/01/24 19:43:20 momjian Exp $
+ * $Id: catversion.h,v 1.70 2001/03/22 04:00:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@
  * catalog changes on the same day...)
  */
 
-/*                        	yyyymmddN */
+/*							yyyymmddN */
 #define CATALOG_VERSION_NO	200101061
 
 #endif
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index d67fd6b3913ff9f04461fb1d0c1757afcaa11db3..a7248f6c6dc4fb438d27b29fe250c446534ad228 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heap.h,v 1.33 2001/01/24 19:43:20 momjian Exp $
+ * $Id: heap.h,v 1.34 2001/03/22 04:00:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,17 +26,17 @@ typedef struct RawColumnDefault
 extern Oid	RelnameFindRelid(const char *relname);
 
 extern Relation heap_create(char *relname, TupleDesc tupDesc,
-							bool istemp, bool storage_create,
-							bool allow_system_table_mods);
+			bool istemp, bool storage_create,
+			bool allow_system_table_mods);
 
 extern void heap_storage_create(Relation rel);
 
 extern Oid heap_create_with_catalog(char *relname, TupleDesc tupdesc,
-									char relkind, bool istemp,
-									bool allow_system_table_mods);
+						 char relkind, bool istemp,
+						 bool allow_system_table_mods);
 
 extern void heap_drop_with_catalog(const char *relname,
-								   bool allow_system_table_mods);
+					   bool allow_system_table_mods);
 
 extern void heap_truncate(char *relname);
 
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index eae6e433b3584fd327c7df00b348b9d00be5742c..1dac0bb1c31596e1b31e5fc2d82f20835ed7879b 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: index.h,v 1.32 2001/01/24 19:43:20 momjian Exp $
+ * $Id: index.h,v 1.33 2001/03/22 04:00:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 #include "nodes/execnodes.h"
 
 extern Form_pg_am AccessMethodObjectIdGetForm(Oid accessMethodObjectId,
-											  MemoryContext resultCxt);
+							MemoryContext resultCxt);
 
 extern void UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate);
 
@@ -27,36 +27,38 @@ extern void InitIndexStrategy(int numatts,
 				  Oid accessMethodObjectId);
 
 extern void index_create(char *heapRelationName,
-						 char *indexRelationName,
-						 IndexInfo *indexInfo,
-						 Oid accessMethodObjectId,
-						 Oid *classObjectId,
-						 bool islossy,
-						 bool primary,
-						 bool allow_system_table_mods);
+			 char *indexRelationName,
+			 IndexInfo *indexInfo,
+			 Oid accessMethodObjectId,
+			 Oid *classObjectId,
+			 bool islossy,
+			 bool primary,
+			 bool allow_system_table_mods);
 
 extern void index_drop(Oid indexId);
 
 extern IndexInfo *BuildIndexInfo(HeapTuple indexTuple);
 
 extern void FormIndexDatum(IndexInfo *indexInfo,
-						   HeapTuple heapTuple,
-						   TupleDesc heapDescriptor,
-						   MemoryContext resultCxt,
-						   Datum *datum,
-						   char *nullv);
+			   HeapTuple heapTuple,
+			   TupleDesc heapDescriptor,
+			   MemoryContext resultCxt,
+			   Datum *datum,
+			   char *nullv);
 
 extern void UpdateStats(Oid relid, long reltuples);
 extern bool IndexesAreActive(Oid relid, bool comfirmCommitted);
 extern void setRelhasindex(Oid relid, bool hasindex);
+
 #ifndef OLD_FILE_NAMING
 extern void setNewRelfilenode(Relation relation);
-#endif /* OLD_FILE_NAMING */
+
+#endif	 /* OLD_FILE_NAMING */
 extern bool SetReindexProcessing(bool processing);
 extern bool IsReindexProcessing(void);
 
 extern void index_build(Relation heapRelation, Relation indexRelation,
-						IndexInfo *indexInfo, Node *oldPred);
+			IndexInfo *indexInfo, Node *oldPred);
 
 extern bool reindex_index(Oid indexId, bool force, bool inplace);
 extern bool activate_indexes_of_a_table(Oid relid, bool activate);
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index 12e213228f7615b56d82603180aa096759325267..41a580a37779abae1d46c2b8422b8ece0fbebc2b 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: indexing.h,v 1.47 2001/01/24 19:43:20 momjian Exp $
+ * $Id: indexing.h,v 1.48 2001/03/22 04:00:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -115,14 +115,14 @@ extern char *IndexedCatalogNames[];
 extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
 extern void CatalogCloseIndices(int nIndices, Relation *idescs);
 extern void CatalogIndexInsert(Relation *idescs, int nIndices,
-							   Relation heapRelation, HeapTuple heapTuple);
+				   Relation heapRelation, HeapTuple heapTuple);
 
 /*
  * Canned functions for indexscans on certain system indexes.
  * All index-value arguments should be passed as Datum for portability!
  */
 extern HeapTuple AttributeRelidNumIndexScan(Relation heapRelation,
-											Datum relid, Datum attnum);
+						   Datum relid, Datum attnum);
 extern HeapTuple ClassNameIndexScan(Relation heapRelation, Datum relName);
 extern HeapTuple ClassOidIndexScan(Relation heapRelation, Datum relId);
 
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index ef2d6ea7a29661f370f060a72877c73ce713d5b9..266fcf1bc4a0f21c463cfc3d70b40c5d3f8313fd 100644
--- a/src/include/catalog/pg_aggregate.h
+++ b/src/include/catalog/pg_aggregate.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_aggregate.h,v 1.28 2001/01/24 19:43:20 momjian Exp $
+ * $Id: pg_aggregate.h,v 1.29 2001/03/22 04:00:36 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -85,67 +85,67 @@ DATA(insert OID = 0 ( avg	PGUID int8_accum	numeric_avg		20	 1231 1700 "{0,0,0}"
 DATA(insert OID = 0 ( avg	PGUID int4_accum	numeric_avg		23	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( avg	PGUID int2_accum	numeric_avg		21	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( avg	PGUID numeric_accum  numeric_avg	1700 1231 1700 "{0,0,0}" ));
-DATA(insert OID = 0 ( avg	PGUID float4_accum	float8_avg		700	 1022 701 "{0,0,0}" ));
-DATA(insert OID = 0 ( avg	PGUID float8_accum	float8_avg		701	 1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( avg	PGUID float4_accum	float8_avg		700  1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( avg	PGUID float8_accum	float8_avg		701  1022 701 "{0,0,0}" ));
 DATA(insert OID = 0 ( avg	PGUID interval_accum interval_avg	1186 1187 1186 "{0,0}" ));
 
-DATA(insert OID = 0 ( sum	PGUID int8_sum			-   20 1700 1700 _null_ ));
-DATA(insert OID = 0 ( sum	PGUID int4_sum			-   23 1700 1700 _null_ ));
-DATA(insert OID = 0 ( sum	PGUID int2_sum			-   21 1700 1700 _null_ ));
-DATA(insert OID = 0 ( sum	PGUID float4pl			-  700  700  700 _null_ ));
-DATA(insert OID = 0 ( sum	PGUID float8pl			-  701  701  701 _null_ ));
-DATA(insert OID = 0 ( sum	PGUID cash_pl			-  790  790  790 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID int8_sum			-	20 1700 1700 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID int4_sum			-	23 1700 1700 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID int2_sum			-	21 1700 1700 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID float4pl			-  700	700  700 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID float8pl			-  701	701  701 _null_ ));
+DATA(insert OID = 0 ( sum	PGUID cash_pl			-  790	790  790 _null_ ));
 DATA(insert OID = 0 ( sum	PGUID interval_pl		- 1186 1186 1186 _null_ ));
 DATA(insert OID = 0 ( sum	PGUID numeric_add		- 1700 1700 1700 _null_ ));
 
-DATA(insert OID = 0 ( max	PGUID int8larger		-   20   20   20 _null_ ));
-DATA(insert OID = 0 ( max	PGUID int4larger		-   23   23   23 _null_ ));
-DATA(insert OID = 0 ( max	PGUID int2larger		-   21   21   21 _null_ ));
-DATA(insert OID = 0 ( max	PGUID float4larger		-  700  700  700 _null_ ));
-DATA(insert OID = 0 ( max	PGUID float8larger		-  701  701  701 _null_ ));
-DATA(insert OID = 0 ( max	PGUID int4larger		-  702  702  702 _null_ ));
+DATA(insert OID = 0 ( max	PGUID int8larger		-	20	 20   20 _null_ ));
+DATA(insert OID = 0 ( max	PGUID int4larger		-	23	 23   23 _null_ ));
+DATA(insert OID = 0 ( max	PGUID int2larger		-	21	 21   21 _null_ ));
+DATA(insert OID = 0 ( max	PGUID float4larger		-  700	700  700 _null_ ));
+DATA(insert OID = 0 ( max	PGUID float8larger		-  701	701  701 _null_ ));
+DATA(insert OID = 0 ( max	PGUID int4larger		-  702	702  702 _null_ ));
 DATA(insert OID = 0 ( max	PGUID date_larger		- 1082 1082 1082 _null_ ));
 DATA(insert OID = 0 ( max	PGUID time_larger		- 1083 1083 1083 _null_ ));
 DATA(insert OID = 0 ( max	PGUID timetz_larger		- 1266 1266 1266 _null_ ));
-DATA(insert OID = 0 ( max	PGUID cashlarger		-  790  790  790 _null_ ));
+DATA(insert OID = 0 ( max	PGUID cashlarger		-  790	790  790 _null_ ));
 DATA(insert OID = 0 ( max	PGUID timestamp_larger	- 1184 1184 1184 _null_ ));
 DATA(insert OID = 0 ( max	PGUID interval_larger	- 1186 1186 1186 _null_ ));
-DATA(insert OID = 0 ( max	PGUID text_larger		-   25   25   25 _null_ ));
+DATA(insert OID = 0 ( max	PGUID text_larger		-	25	 25   25 _null_ ));
 DATA(insert OID = 0 ( max	PGUID numeric_larger	- 1700 1700 1700 _null_ ));
 
-DATA(insert OID = 0 ( min	PGUID int8smaller		-   20   20   20 _null_ ));
-DATA(insert OID = 0 ( min	PGUID int4smaller		-   23   23   23 _null_ ));
-DATA(insert OID = 0 ( min	PGUID int2smaller		-   21   21   21 _null_ ));
-DATA(insert OID = 0 ( min	PGUID float4smaller		-  700  700  700 _null_ ));
-DATA(insert OID = 0 ( min	PGUID float8smaller		-  701  701  701 _null_ ));
-DATA(insert OID = 0 ( min	PGUID int4smaller		-  702  702  702 _null_ ));
+DATA(insert OID = 0 ( min	PGUID int8smaller		-	20	 20   20 _null_ ));
+DATA(insert OID = 0 ( min	PGUID int4smaller		-	23	 23   23 _null_ ));
+DATA(insert OID = 0 ( min	PGUID int2smaller		-	21	 21   21 _null_ ));
+DATA(insert OID = 0 ( min	PGUID float4smaller		-  700	700  700 _null_ ));
+DATA(insert OID = 0 ( min	PGUID float8smaller		-  701	701  701 _null_ ));
+DATA(insert OID = 0 ( min	PGUID int4smaller		-  702	702  702 _null_ ));
 DATA(insert OID = 0 ( min	PGUID date_smaller		- 1082 1082 1082 _null_ ));
 DATA(insert OID = 0 ( min	PGUID time_smaller		- 1083 1083 1083 _null_ ));
 DATA(insert OID = 0 ( min	PGUID timetz_smaller	- 1266 1266 1266 _null_ ));
-DATA(insert OID = 0 ( min	PGUID cashsmaller		-  790  790  790 _null_ ));
+DATA(insert OID = 0 ( min	PGUID cashsmaller		-  790	790  790 _null_ ));
 DATA(insert OID = 0 ( min	PGUID timestamp_smaller - 1184 1184 1184 _null_ ));
 DATA(insert OID = 0 ( min	PGUID interval_smaller	- 1186 1186 1186 _null_ ));
-DATA(insert OID = 0 ( min	PGUID text_smaller		-   25   25   25 _null_ ));
+DATA(insert OID = 0 ( min	PGUID text_smaller		-	25	 25   25 _null_ ));
 DATA(insert OID = 0 ( min	PGUID numeric_smaller	- 1700 1700 1700 _null_ ));
 
 /*
  * Using int4inc for count() is cheating a little, since it really only
  * takes 1 parameter not 2, but nodeAgg.c won't complain ...
  */
-DATA(insert OID = 0 ( count PGUID int4inc           - 0 23 23 0 ));
+DATA(insert OID = 0 ( count PGUID int4inc			- 0 23 23 0 ));
 
 DATA(insert OID = 0 ( variance	PGUID int8_accum	numeric_variance	20	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( variance	PGUID int4_accum	numeric_variance	23	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( variance	PGUID int2_accum	numeric_variance	21	 1231 1700 "{0,0,0}" ));
-DATA(insert OID = 0 ( variance	PGUID float4_accum	float8_variance		700	 1022 701 "{0,0,0}" ));
-DATA(insert OID = 0 ( variance	PGUID float8_accum	float8_variance		701	 1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( variance	PGUID float4_accum	float8_variance		700  1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( variance	PGUID float8_accum	float8_variance		701  1022 701 "{0,0,0}" ));
 DATA(insert OID = 0 ( variance	PGUID numeric_accum  numeric_variance	1700 1231 1700 "{0,0,0}" ));
 
 DATA(insert OID = 0 ( stddev	PGUID int8_accum	numeric_stddev		20	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( stddev	PGUID int4_accum	numeric_stddev		23	 1231 1700 "{0,0,0}" ));
 DATA(insert OID = 0 ( stddev	PGUID int2_accum	numeric_stddev		21	 1231 1700 "{0,0,0}" ));
-DATA(insert OID = 0 ( stddev	PGUID float4_accum	float8_stddev		700	 1022 701 "{0,0,0}" ));
-DATA(insert OID = 0 ( stddev	PGUID float8_accum	float8_stddev		701	 1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( stddev	PGUID float4_accum	float8_stddev		700  1022 701 "{0,0,0}" ));
+DATA(insert OID = 0 ( stddev	PGUID float8_accum	float8_stddev		701  1022 701 "{0,0,0}" ));
 DATA(insert OID = 0 ( stddev	PGUID numeric_accum  numeric_stddev		1700 1231 1700 "{0,0,0}" ));
 
 /*
@@ -159,6 +159,6 @@ extern void AggregateCreate(char *aggName,
 				char *agginitval);
 
 extern Datum AggNameGetInitVal(char *aggName, Oid basetype,
-							   bool *isNull);
+				  bool *isNull);
 
 #endif	 /* PG_AGGREGATE_H */
diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h
index 98854fa21bf3591627080940eb5dd1fe9e7b6d5c..055cbbe688606dd4bd841d8b737111e01b0946cf 100644
--- a/src/include/catalog/pg_amop.h
+++ b/src/include/catalog/pg_amop.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_amop.h,v 1.37 2001/01/24 19:43:20 momjian Exp $
+ * $Id: pg_amop.h,v 1.38 2001/03/22 04:00:37 momjian Exp $
  *
  * NOTES
  *	 the genbki.sh script reads this file and generates .bki
@@ -36,8 +36,8 @@ CATALOG(pg_amop)
 	Oid			amopid;			/* an index access method */
 	Oid			amopclaid;		/* an index opclass */
 	Oid			amopopr;		/* the operator OID to use */
-	int2		amopstrategy;	/* one of the strategy numbers defined
-								 * by the AM */
+	int2		amopstrategy;	/* one of the strategy numbers defined by
+								 * the AM */
 } FormData_pg_amop;
 
 /* ----------------
@@ -106,7 +106,7 @@ DATA(insert OID = 0 (  402 434 489 8 ));
  *
  * XXX Diked out 2000-06-18 by tgl.  Since we have no rtree support functions
  * (union, intersection, size) for circles, we can't actually build rtree
- * indexes on circles.  These can be put back in someday if anyone ever
+ * indexes on circles.	These can be put back in someday if anyone ever
  * writes such functions.
  */
 
@@ -353,21 +353,21 @@ DATA(insert OID = 0 (  403 1690   59 5 ));
  *	nbtree bit
  */
 
-DATA(insert OID = 0 (  403  424 1786 1 ));
-DATA(insert OID = 0 (  403  424 1788 2 ));
-DATA(insert OID = 0 (  403  424 1784 3 ));
-DATA(insert OID = 0 (  403  424 1789 4 ));
-DATA(insert OID = 0 (  403  424 1787 5 ));
+DATA(insert OID = 0 (  403	424 1786 1 ));
+DATA(insert OID = 0 (  403	424 1788 2 ));
+DATA(insert OID = 0 (  403	424 1784 3 ));
+DATA(insert OID = 0 (  403	424 1789 4 ));
+DATA(insert OID = 0 (  403	424 1787 5 ));
 
 /*
  *	nbtree varbit
  */
 
-DATA(insert OID = 0 (  403  425 1806 1 ));
-DATA(insert OID = 0 (  403  425 1808 2 ));
-DATA(insert OID = 0 (  403  425 1804 3 ));
-DATA(insert OID = 0 (  403  425 1809 4 ));
-DATA(insert OID = 0 (  403  425 1807 5 ));
+DATA(insert OID = 0 (  403	425 1806 1 ));
+DATA(insert OID = 0 (  403	425 1808 2 ));
+DATA(insert OID = 0 (  403	425 1804 3 ));
+DATA(insert OID = 0 (  403	425 1809 4 ));
+DATA(insert OID = 0 (  403	425 1807 5 ));
 
 
 /*
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index 3ee6fa273f40de6fb04efcccf215b2384feb4884..58724e94dc966cef18b5345521cafa985a4dbf1e 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.69 2001/01/24 19:43:20 momjian Exp $
+ * $Id: pg_attribute.h,v 1.70 2001/03/22 04:00:37 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -246,7 +246,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
 { 1247, {"typreceive"},    24, 0,	4, 13, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0' }, \
 { 1247, {"typsend"},	   24, 0,	4, 14, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0' }, \
 { 1247, {"typalign"},	   18, 0,	1, 15, 0, -1, -1, '\001', 'p', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typstorage"},	   18, 0,	1, 16, 0, -1, -1, '\001', 'p', '\0', 'c', '\0', '\0' }, \
+{ 1247, {"typstorage"},    18, 0,	1, 16, 0, -1, -1, '\001', 'p', '\0', 'c', '\0', '\0' }, \
 { 1247, {"typdefault"},    25, 0,  -1, 17, 0, -1, -1, '\0'	, 'x', '\0', 'i', '\0', '\0' }
 
 DATA(insert OID = 0 ( 1247 typname			19 0 NAMEDATALEN   1 0 -1 -1 f p f i f f));
@@ -281,9 +281,9 @@ DATA(insert OID = 0 ( 1247 tableoid			26 0  4  -7 0 -1 -1 t p f i f f));
 DATA(insert OID = 0 ( 1262 datname			19 0 NAMEDATALEN   1 0 -1 -1 f p f i f f));
 DATA(insert OID = 0 ( 1262 datdba			23 0  4   2 0 -1 -1 t p f i f f));
 DATA(insert OID = 0 ( 1262 encoding			23 0  4   3 0 -1 -1 t p f i f f));
-DATA(insert OID = 0 ( 1262 datistemplate    16 0  1   4 0 -1 -1 t p f c f f));
-DATA(insert OID = 0 ( 1262 datallowconn     16 0  1   5 0 -1 -1 t p f c f f));
-DATA(insert OID = 0 ( 1262 datlastsysoid    26 0  4   6 0 -1 -1 t p f i f f));
+DATA(insert OID = 0 ( 1262 datistemplate	16 0  1   4 0 -1 -1 t p f c f f));
+DATA(insert OID = 0 ( 1262 datallowconn		16 0  1   5 0 -1 -1 t p f c f f));
+DATA(insert OID = 0 ( 1262 datlastsysoid	26 0  4   6 0 -1 -1 t p f i f f));
 /* do not mark datpath as toastable; GetRawDatabaseInfo won't cope */
 DATA(insert OID = 0 ( 1262 datpath			25 0 -1   7 0 -1 -1 f p f i f f));
 DATA(insert OID = 0 ( 1262 ctid				27 0  6  -1 0 -1 -1 f p f i f f));
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index 14ab578ceddc24bfbaea7b7a21b513a4e6f5ba5a..81e75e14b6a7dc7372f9dcd6808f824944f5f028 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_class.h,v 1.46 2001/01/24 19:43:21 momjian Exp $
+ * $Id: pg_class.h,v 1.47 2001/03/22 04:00:38 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -59,6 +59,7 @@ CATALOG(pg_class) BOOTSTRAP
 	bool		relisshared;
 	char		relkind;
 	int2		relnatts;
+
 	/*
 	 * relnatts is the number of user attributes this class has.  There
 	 * must be exactly this many instances in Class pg_attribute for this
@@ -71,7 +72,8 @@ CATALOG(pg_class) BOOTSTRAP
 	int2		relrefs;		/* # of references to this rel (not used!) */
 	bool		relhaspkey;		/* has PRIMARY KEY */
 	bool		relhasrules;	/* has associated rules */
-	bool		relhassubclass;	/* has derived classes */
+	bool		relhassubclass; /* has derived classes */
+
 	/*
 	 * relacl may or may not be present, see note above!
 	 */
@@ -138,21 +140,21 @@ DATA(insert OID = 1255 (  pg_proc 81		  PGUID 0 1255 0 0 0 0 f f r 17 0 0 0 0 0
 DESCR("");
 DATA(insert OID = 1259 (  pg_class 83		  PGUID 0 1259 0 0 0 0 f f r 22 0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1260 (  pg_shadow 86		  PGUID 0 1260 0 0 0 0 f t r 8  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1260 (  pg_shadow 86		  PGUID 0 1260 0 0 0 0 f t r 8	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1261 (  pg_group 87		  PGUID 0 1261 0 0 0 0 f t r 3  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1261 (  pg_group 87		  PGUID 0 1261 0 0 0 0 f t r 3	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1262 (  pg_database 88	  PGUID 0 1262 0 0 0 0 f t r 7  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1262 (  pg_database 88	  PGUID 0 1262 0 0 0 0 f t r 7	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1264 (  pg_variable 90	  PGUID 0 1264 0 0 0 0 f t s 1  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1264 (  pg_variable 90	  PGUID 0 1264 0 0 0 0 f t s 1	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1269 (  pg_log  99		  PGUID 0 1269 0 0 0 0 f t s 1  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1269 (  pg_log  99		  PGUID 0 1269 0 0 0 0 f t s 1	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 376  (  pg_xactlock  0	  PGUID 0    0 0 0 0 0 f t s 1  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 376  (  pg_xactlock  0	  PGUID 0	 0 0 0 0 0 f t s 1	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1215 (  pg_attrdef 109	  PGUID 0 1215 0 0 0 0 t t r 4  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1215 (  pg_attrdef 109	  PGUID 0 1215 0 0 0 0 t t r 4	0 0 0 0 0 f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1216 (  pg_relcheck 110	  PGUID 0 1216 0 0 0 0 t t r 4  0 0 0 0 0 f f f _null_ ));
+DATA(insert OID = 1216 (  pg_relcheck 110	  PGUID 0 1216 0 0 0 0 t t r 4	0 0 0 0 0 f f f _null_ ));
 DESCR("");
 DATA(insert OID = 1219 (  pg_trigger 111	  PGUID 0 1219 0 0 0 0 t t r 13  0 0 0 0 0 f f f _null_ ));
 DESCR("");
diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h
index 4dcb120469bcb14ecb31eab88d25f10e26f77913..76de50e68bdcc86293a17d77cc0d56e93d7cbb13 100644
--- a/src/include/catalog/pg_control.h
+++ b/src/include/catalog/pg_control.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_control.h,v 1.2 2001/03/18 20:18:59 tgl Exp $
+ * $Id: pg_control.h,v 1.3 2001/03/22 04:00:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,16 +30,16 @@
  */
 typedef struct CheckPoint
 {
-	XLogRecPtr		redo;		/* next RecPtr available when we */
-								/* began to create CheckPoint */
-								/* (i.e. REDO start point) */
-	XLogRecPtr		undo;		/* first record of oldest in-progress */
-								/* transaction when we started */
-								/* (i.e. UNDO end point) */
-	StartUpID		ThisStartUpID;	/* current SUI */
-	TransactionId	nextXid;	/* next free XID */
-	Oid				nextOid;	/* next free OID */
-	time_t			time;		/* time stamp of checkpoint */
+	XLogRecPtr	redo;			/* next RecPtr available when we */
+	/* began to create CheckPoint */
+	/* (i.e. REDO start point) */
+	XLogRecPtr	undo;			/* first record of oldest in-progress */
+	/* transaction when we started */
+	/* (i.e. UNDO end point) */
+	StartUpID	ThisStartUpID;	/* current SUI */
+	TransactionId nextXid;		/* next free XID */
+	Oid			nextOid;		/* next free OID */
+	time_t		time;			/* time stamp of checkpoint */
 } CheckPoint;
 
 /* XLOG info values for XLOG rmgr */
@@ -58,7 +58,7 @@ typedef enum DBState
 	DB_IN_PRODUCTION
 } DBState;
 
-#define LOCALE_NAME_BUFLEN  128
+#define LOCALE_NAME_BUFLEN	128
 
 /*
  * Contents of pg_control.
@@ -74,16 +74,16 @@ typedef struct ControlFileData
 	crc64		crc;			/* CRC for remainder of struct */
 
 	/*
-	 * Version identifier information.  Keep these fields at the front,
+	 * Version identifier information.	Keep these fields at the front,
 	 * especially pg_control_version; they won't be real useful if they
 	 * move around.
 	 *
 	 * pg_control_version identifies the format of pg_control itself.
 	 * catalog_version_no identifies the format of the system catalogs.
 	 *
-	 * There are additional version identifiers in individual files;
-	 * for example, WAL logs contain per-page magic numbers that can serve
-	 * as version cues for the WAL log.
+	 * There are additional version identifiers in individual files; for
+	 * example, WAL logs contain per-page magic numbers that can serve as
+	 * version cues for the WAL log.
 	 */
 	uint32		pg_control_version;		/* PG_CONTROL_VERSION */
 	uint32		catalog_version_no;		/* see catversion.h */
@@ -96,9 +96,9 @@ typedef struct ControlFileData
 	uint32		logId;			/* current log file id */
 	uint32		logSeg;			/* current log file segment, + 1 */
 	XLogRecPtr	checkPoint;		/* last check point record ptr */
-	XLogRecPtr	prevCheckPoint;	/* previous check point record ptr */
+	XLogRecPtr	prevCheckPoint; /* previous check point record ptr */
 
-	CheckPoint	checkPointCopy;	/* copy of last check point record */
+	CheckPoint	checkPointCopy; /* copy of last check point record */
 
 	/*
 	 * This data is used to make sure that configuration of this database
diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h
index d2604a4cd4b43bbec674fa8e4e2474b7a5698e61..ffc83da3b4cfc7ccd08dbcc9c896660d0b1ca82b 100644
--- a/src/include/catalog/pg_database.h
+++ b/src/include/catalog/pg_database.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_database.h,v 1.16 2001/01/24 19:43:21 momjian Exp $
+ * $Id: pg_database.h,v 1.17 2001/03/22 04:00:38 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -36,7 +36,8 @@ CATALOG(pg_database) BOOTSTRAP
 	NameData	datname;
 	int4		datdba;
 	int4		encoding;
-	bool		datistemplate;	/* allowed as template for CREATE DATABASE? */
+	bool		datistemplate;	/* allowed as template for CREATE
+								 * DATABASE? */
 	bool		datallowconn;	/* new connections allowed? */
 	Oid			datlastsysoid;
 	text		datpath;		/* VARIABLE LENGTH FIELD */
@@ -57,9 +58,9 @@ typedef FormData_pg_database *Form_pg_database;
 #define Anum_pg_database_datname		1
 #define Anum_pg_database_datdba			2
 #define Anum_pg_database_encoding		3
-#define Anum_pg_database_datistemplate  4
+#define Anum_pg_database_datistemplate	4
 #define Anum_pg_database_datallowconn	5
-#define Anum_pg_database_datlastsysoid  6
+#define Anum_pg_database_datlastsysoid	6
 #define Anum_pg_database_datpath		7
 
 DATA(insert OID = 1 (  template1 PGUID ENCODING t t 0 "" ));
@@ -70,7 +71,7 @@ DESCR("Default template database");
 /* Just to mark OID as used for unused_oid script -:) */
 #define DATAMARKOID(x)
 
-DATAMARKOID( = 2)
+DATAMARKOID(= 2)
 #define RecoveryDb	2
 
 #undef DATAMARKOID
diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h
index 5bef87f3de5c3ffafe173194030a66705210c481..37443041e68aea6764d8639ab9a48862944b5463 100644
--- a/src/include/catalog/pg_largeobject.h
+++ b/src/include/catalog/pg_largeobject.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_largeobject.h,v 1.6 2001/01/24 19:43:21 momjian Exp $
+ * $Id: pg_largeobject.h,v 1.7 2001/03/22 04:00:39 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -27,7 +27,7 @@
  */
 
 /* ----------------
- *		pg_largeobject definition.  cpp turns this into
+ *		pg_largeobject definition.	cpp turns this into
  *		typedef struct FormData_pg_largeobject. Large object id
  *		is stored in loid;
  * ----------------
@@ -56,7 +56,7 @@ typedef FormData_pg_largeobject *Form_pg_largeobject;
 #define Anum_pg_largeobject_pageno		2
 #define Anum_pg_largeobject_data		3
 
-extern Oid LargeObjectCreate(Oid loid);
+extern Oid	LargeObjectCreate(Oid loid);
 extern void LargeObjectDrop(Oid loid);
 extern bool LargeObjectExists(Oid loid);
 
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index d858a1a52c871915772aa73a4947077a46f64395..7f201ea47171bd96ca62d796c0cc173c06dc5c8a 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_operator.h,v 1.87 2001/01/24 19:43:21 momjian Exp $
+ * $Id: pg_operator.h,v 1.88 2001/03/22 04:00:39 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -691,30 +691,30 @@ DATA(insert OID = 828 (  ">>"	   PGUID 0 b t f 650 650	 16 826   0 0 0 network_s
 DATA(insert OID = 1004 ( ">>="	   PGUID 0 b t f 650 650	 16 827   0 0 0 network_supeq - - ));
 
 /* case-insensitive LIKE hacks */
-DATA(insert OID = 1625 (  "~~*"	  PGUID 0 b t f  19   25  16 0 1626 0 0 nameiclike iclikesel iclikejoinsel ));
+DATA(insert OID = 1625 (  "~~*"   PGUID 0 b t f  19   25  16 0 1626 0 0 nameiclike iclikesel iclikejoinsel ));
 #define OID_NAME_ICLIKE_OP		1625
 DATA(insert OID = 1626 (  "!~~*"  PGUID 0 b t f  19   25  16 0 1625 0 0 nameicnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1627 (  "~~*"	  PGUID 0 b t f  25   25  16 0 1628 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1627 (  "~~*"   PGUID 0 b t f  25   25  16 0 1628 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_TEXT_ICLIKE_OP		1627
 DATA(insert OID = 1628 (  "!~~*"  PGUID 0 b t f  25   25  16 0 1627 0 0 texticnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1629 (  "~~*"	  PGUID 0 b t f  1042 25  16 0 1630 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1629 (  "~~*"   PGUID 0 b t f  1042 25  16 0 1630 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_BPCHAR_ICLIKE_OP	1629
 DATA(insert OID = 1630 (  "!~~*"  PGUID 0 b t f  1042 25  16 0 1629 0 0 texticnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1631 (  "~~*"	  PGUID 0 b t f  1043 25  16 0 1632 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1631 (  "~~*"   PGUID 0 b t f  1043 25  16 0 1632 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_VARCHAR_ICLIKE_OP	1631
 DATA(insert OID = 1632 (  "!~~*"  PGUID 0 b t f  1043 25  16 0 1631 0 0 texticnlike icnlikesel icnlikejoinsel ));
 
 /* int4 vs oid comparisons --- use oid (unsigned) comparison */
-DATA(insert OID = 1656 (  "<>"	   PGUID 0 b t f  23  26  16 1661 1136  0  0 oidne neqsel neqjoinsel ));
-DATA(insert OID = 1657 (  "<"	   PGUID 0 b t f  23  26  16 1663 1660  0  0 oidlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1658 (  ">"	   PGUID 0 b t f  23  26  16 1662 1659  0  0 oidgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1659 (  "<="	   PGUID 0 b t f  23  26  16 1665 1658  0  0 oidle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1660 (  ">="	   PGUID 0 b t f  23  26  16 1664 1657  0  0 oidge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1661 (  "<>"	   PGUID 0 b t f  26  23  16 1656 1137  0  0 oidne neqsel neqjoinsel ));
-DATA(insert OID = 1662 (  "<"	   PGUID 0 b t f  26  23  16 1658 1665  0  0 oidlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1663 (  ">"	   PGUID 0 b t f  26  23  16 1657 1664  0  0 oidgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1664 (  "<="	   PGUID 0 b t f  26  23  16 1660 1663  0  0 oidle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1665 (  ">="	   PGUID 0 b t f  26  23  16 1659 1662  0  0 oidge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1656 (  "<>"	   PGUID 0 b t f  23  26  16 1661 1136	0  0 oidne neqsel neqjoinsel ));
+DATA(insert OID = 1657 (  "<"	   PGUID 0 b t f  23  26  16 1663 1660	0  0 oidlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1658 (  ">"	   PGUID 0 b t f  23  26  16 1662 1659	0  0 oidgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1659 (  "<="	   PGUID 0 b t f  23  26  16 1665 1658	0  0 oidle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1660 (  ">="	   PGUID 0 b t f  23  26  16 1664 1657	0  0 oidge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1661 (  "<>"	   PGUID 0 b t f  26  23  16 1656 1137	0  0 oidne neqsel neqjoinsel ));
+DATA(insert OID = 1662 (  "<"	   PGUID 0 b t f  26  23  16 1658 1665	0  0 oidlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1663 (  ">"	   PGUID 0 b t f  26  23  16 1657 1664	0  0 oidgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1664 (  "<="	   PGUID 0 b t f  26  23  16 1660 1663	0  0 oidle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1665 (  ">="	   PGUID 0 b t f  26  23  16 1659 1662	0  0 oidge scalargtsel scalargtjoinsel ));
 
 /* NUMERIC type - OID's 1700-1799 */
 DATA(insert OID = 1751 (  "-"	   PGUID 0 l t f	0 1700 1700    0	0 0 0 numeric_uminus - - ));
@@ -773,26 +773,26 @@ DATA(insert OID = 1871 ( ">"	   PGUID 0 b t f  20  21  16  1864 1872   0  0 int8
 DATA(insert OID = 1872 ( "<="	   PGUID 0 b t f  20  21  16  1867 1871   0  0 int82le scalarltsel scalarltjoinsel ));
 DATA(insert OID = 1873 ( ">="	   PGUID 0 b t f  20  21  16  1866 1870   0  0 int82ge scalargtsel scalargtjoinsel ));
 
-DATA(insert OID = 1874 ( "&"	   PGUID 0 b t f  21  21  21  1874    0   0  0 int2and - - ));
-DATA(insert OID = 1875 ( "|"	   PGUID 0 b t f  21  21  21  1875    0   0  0 int2or - - ));
-DATA(insert OID = 1876 ( "#"	   PGUID 0 b t f  21  21  21  1876    0   0  0 int2xor - - ));
-DATA(insert OID = 1877 ( "~"	   PGUID 0 l t f   0  21  21     0    0   0  0 int2not - - ));
-DATA(insert OID = 1878 ( "<<"	   PGUID 0 b t f  21  23  21     0    0   0  0 int2shl - - ));
-DATA(insert OID = 1879 ( ">>"	   PGUID 0 b t f  21  23  21     0    0   0  0 int2shr - - ));
-
-DATA(insert OID = 1880 ( "&"	   PGUID 0 b t f  23  23  23  1880    0   0  0 int4and - - ));
-DATA(insert OID = 1881 ( "|"	   PGUID 0 b t f  23  23  23  1881    0   0  0 int4or - - ));
-DATA(insert OID = 1882 ( "#"	   PGUID 0 b t f  23  23  23  1882    0   0  0 int4xor - - ));
-DATA(insert OID = 1883 ( "~"	   PGUID 0 l t f   0  23  23     0    0   0  0 int4not - - ));
-DATA(insert OID = 1884 ( "<<"	   PGUID 0 b t f  23  23  23     0    0   0  0 int4shl - - ));
-DATA(insert OID = 1885 ( ">>"	   PGUID 0 b t f  23  23  23     0    0   0  0 int4shr - - ));
-
-DATA(insert OID = 1886 ( "&"	   PGUID 0 b t f  20  20  20  1886    0   0  0 int8and - - ));
-DATA(insert OID = 1887 ( "|"	   PGUID 0 b t f  20  20  20  1887    0   0  0 int8or - - ));
-DATA(insert OID = 1888 ( "#"	   PGUID 0 b t f  20  20  20  1888    0   0  0 int8xor - - ));
-DATA(insert OID = 1889 ( "~"	   PGUID 0 l t f   0  20  20     0    0   0  0 int8not - - ));
-DATA(insert OID = 1890 ( "<<"	   PGUID 0 b t f  20  23  20     0    0   0  0 int8shl - - ));
-DATA(insert OID = 1891 ( ">>"	   PGUID 0 b t f  20  23  20     0    0   0  0 int8shr - - ));
+DATA(insert OID = 1874 ( "&"	   PGUID 0 b t f  21  21  21  1874	  0   0  0 int2and - - ));
+DATA(insert OID = 1875 ( "|"	   PGUID 0 b t f  21  21  21  1875	  0   0  0 int2or - - ));
+DATA(insert OID = 1876 ( "#"	   PGUID 0 b t f  21  21  21  1876	  0   0  0 int2xor - - ));
+DATA(insert OID = 1877 ( "~"	   PGUID 0 l t f   0  21  21	 0	  0   0  0 int2not - - ));
+DATA(insert OID = 1878 ( "<<"	   PGUID 0 b t f  21  23  21	 0	  0   0  0 int2shl - - ));
+DATA(insert OID = 1879 ( ">>"	   PGUID 0 b t f  21  23  21	 0	  0   0  0 int2shr - - ));
+
+DATA(insert OID = 1880 ( "&"	   PGUID 0 b t f  23  23  23  1880	  0   0  0 int4and - - ));
+DATA(insert OID = 1881 ( "|"	   PGUID 0 b t f  23  23  23  1881	  0   0  0 int4or - - ));
+DATA(insert OID = 1882 ( "#"	   PGUID 0 b t f  23  23  23  1882	  0   0  0 int4xor - - ));
+DATA(insert OID = 1883 ( "~"	   PGUID 0 l t f   0  23  23	 0	  0   0  0 int4not - - ));
+DATA(insert OID = 1884 ( "<<"	   PGUID 0 b t f  23  23  23	 0	  0   0  0 int4shl - - ));
+DATA(insert OID = 1885 ( ">>"	   PGUID 0 b t f  23  23  23	 0	  0   0  0 int4shr - - ));
+
+DATA(insert OID = 1886 ( "&"	   PGUID 0 b t f  20  20  20  1886	  0   0  0 int8and - - ));
+DATA(insert OID = 1887 ( "|"	   PGUID 0 b t f  20  20  20  1887	  0   0  0 int8or - - ));
+DATA(insert OID = 1888 ( "#"	   PGUID 0 b t f  20  20  20  1888	  0   0  0 int8xor - - ));
+DATA(insert OID = 1889 ( "~"	   PGUID 0 l t f   0  20  20	 0	  0   0  0 int8not - - ));
+DATA(insert OID = 1890 ( "<<"	   PGUID 0 b t f  20  23  20	 0	  0   0  0 int8shl - - ));
+DATA(insert OID = 1891 ( ">>"	   PGUID 0 b t f  20  23  20	 0	  0   0  0 int8shr - - ));
 
 /*
  * function prototypes
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 492bc8321920272d9011a53acf071f6746b655bc..d03d472043f4ec55025cb824ba1e172486fac796 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.183 2001/02/27 20:34:10 tgl Exp $
+ * $Id: pg_proc.h,v 1.184 2001/03/22 04:00:39 momjian Exp $
  *
  * NOTES
  *	  The script catalog/genbki.sh reads this file and generates .bki
@@ -97,104 +97,104 @@ typedef FormData_pg_proc *Form_pg_proc;
 
 /* OIDS 1 - 99 */
 
-DATA(insert OID = 1242 (  boolin		   PGUID 12 f t t t 1 f 16 "0" 100 0 0  100  boolin - ));
+DATA(insert OID = 1242 (  boolin		   PGUID 12 f t t t 1 f 16 "0" 100 0 0	100  boolin - ));
 DESCR("(internal)");
-DATA(insert OID = 1243 (  boolout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  boolout - ));
+DATA(insert OID = 1243 (  boolout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	boolout - ));
 DESCR("(internal)");
-DATA(insert OID = 1244 (  byteain		   PGUID 12 f t t t 1 f 17 "0" 100 0 0 100  byteain - ));
+DATA(insert OID = 1244 (  byteain		   PGUID 12 f t t t 1 f 17 "0" 100 0 0 100	byteain - ));
 DESCR("(internal)");
-DATA(insert OID =  31 (  byteaout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  byteaout - ));
+DATA(insert OID =  31 (  byteaout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	byteaout - ));
 DESCR("(internal)");
-DATA(insert OID = 1245 (  charin		   PGUID 12 f t t t 1 f 18 "0" 100 0 0 100  charin - ));
+DATA(insert OID = 1245 (  charin		   PGUID 12 f t t t 1 f 18 "0" 100 0 0 100	charin - ));
 DESCR("(internal)");
-DATA(insert OID =  33 (  charout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  charout - ));
+DATA(insert OID =  33 (  charout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	charout - ));
 DESCR("(internal)");
-DATA(insert OID =  34 (  namein			   PGUID 12 f t t t 1 f 19 "0" 100 0 0 100  namein - ));
+DATA(insert OID =  34 (  namein			   PGUID 12 f t t t 1 f 19 "0" 100 0 0 100	namein - ));
 DESCR("(internal)");
-DATA(insert OID =  35 (  nameout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  nameout - ));
+DATA(insert OID =  35 (  nameout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	nameout - ));
 DESCR("(internal)");
-DATA(insert OID =  38 (  int2in			   PGUID 12 f t t t 1 f 21 "0" 100 0 0 100  int2in - ));
+DATA(insert OID =  38 (  int2in			   PGUID 12 f t t t 1 f 21 "0" 100 0 0 100	int2in - ));
 DESCR("(internal)");
-DATA(insert OID =  39 (  int2out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int2out - ));
+DATA(insert OID =  39 (  int2out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int2out - ));
 DESCR("(internal)");
-DATA(insert OID =  40 (  int2vectorin	   PGUID 12 f t t t 1 f 22 "0" 100 0 0 100  int2vectorin - ));
+DATA(insert OID =  40 (  int2vectorin	   PGUID 12 f t t t 1 f 22 "0" 100 0 0 100	int2vectorin - ));
 DESCR("(internal)");
-DATA(insert OID =  41 (  int2vectorout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int2vectorout - ));
+DATA(insert OID =  41 (  int2vectorout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int2vectorout - ));
 DESCR("(internal)");
-DATA(insert OID =  42 (  int4in			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int4in - ));
+DATA(insert OID =  42 (  int4in			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int4in - ));
 DESCR("(internal)");
-DATA(insert OID =  43 (  int4out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int4out - ));
+DATA(insert OID =  43 (  int4out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int4out - ));
 DESCR("(internal)");
-DATA(insert OID =  44 (  regprocin		   PGUID 12 f t f t 1 f 24 "0" 100 0 0 100  regprocin - ));
+DATA(insert OID =  44 (  regprocin		   PGUID 12 f t f t 1 f 24 "0" 100 0 0 100	regprocin - ));
 DESCR("(internal)");
-DATA(insert OID =  45 (  regprocout		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  regprocout - ));
+DATA(insert OID =  45 (  regprocout		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	regprocout - ));
 DESCR("(internal)");
-DATA(insert OID =  46 (  textin			   PGUID 12 f t t t 1 f 25 "0" 100 0 0 100  textin - ));
+DATA(insert OID =  46 (  textin			   PGUID 12 f t t t 1 f 25 "0" 100 0 0 100	textin - ));
 DESCR("(internal)");
-DATA(insert OID =  47 (  textout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  textout - ));
+DATA(insert OID =  47 (  textout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	textout - ));
 DESCR("(internal)");
-DATA(insert OID =  48 (  tidin			   PGUID 12 f t t t 1 f 27 "0" 100 0 0 100  tidin - ));
+DATA(insert OID =  48 (  tidin			   PGUID 12 f t t t 1 f 27 "0" 100 0 0 100	tidin - ));
 DESCR("(internal)");
-DATA(insert OID =  49 (  tidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  tidout - ));
+DATA(insert OID =  49 (  tidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	tidout - ));
 DESCR("(internal)");
-DATA(insert OID =  50 (  xidin			   PGUID 12 f t t t 1 f 28 "0" 100 0 0 100  xidin - ));
+DATA(insert OID =  50 (  xidin			   PGUID 12 f t t t 1 f 28 "0" 100 0 0 100	xidin - ));
 DESCR("(internal)");
-DATA(insert OID =  51 (  xidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  xidout - ));
+DATA(insert OID =  51 (  xidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	xidout - ));
 DESCR("(internal)");
-DATA(insert OID =  52 (  cidin			   PGUID 12 f t t t 1 f 29 "0" 100 0 0 100  cidin - ));
+DATA(insert OID =  52 (  cidin			   PGUID 12 f t t t 1 f 29 "0" 100 0 0 100	cidin - ));
 DESCR("(internal)");
-DATA(insert OID =  53 (  cidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  cidout - ));
+DATA(insert OID =  53 (  cidout			   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	cidout - ));
 DESCR("(internal)");
-DATA(insert OID =  54 (  oidvectorin	   PGUID 12 f t t t 1 f 30 "0" 100 0 0 100  oidvectorin - ));
+DATA(insert OID =  54 (  oidvectorin	   PGUID 12 f t t t 1 f 30 "0" 100 0 0 100	oidvectorin - ));
 DESCR("(internal)");
-DATA(insert OID =  55 (  oidvectorout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  oidvectorout - ));
+DATA(insert OID =  55 (  oidvectorout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	oidvectorout - ));
 DESCR("(internal)");
-DATA(insert OID =  56 (  boollt			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100  boollt - ));
+DATA(insert OID =  56 (  boollt			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100	boollt - ));
 DESCR("less-than");
-DATA(insert OID =  57 (  boolgt			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100  boolgt - ));
+DATA(insert OID =  57 (  boolgt			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100	boolgt - ));
 DESCR("greater-than");
-DATA(insert OID =  60 (  booleq			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100  booleq - ));
+DATA(insert OID =  60 (  booleq			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100	booleq - ));
 DESCR("equal");
-DATA(insert OID =  61 (  chareq			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  chareq - ));
+DATA(insert OID =  61 (  chareq			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	chareq - ));
 DESCR("equal");
-DATA(insert OID =  62 (  nameeq			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  nameeq - ));
+DATA(insert OID =  62 (  nameeq			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	nameeq - ));
 DESCR("equal");
-DATA(insert OID =  63 (  int2eq			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2eq - ));
+DATA(insert OID =  63 (  int2eq			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2eq - ));
 DESCR("equal");
-DATA(insert OID =  64 (  int2lt			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2lt - ));
+DATA(insert OID =  64 (  int2lt			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2lt - ));
 DESCR("less-than");
-DATA(insert OID =  65 (  int4eq			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4eq - ));
+DATA(insert OID =  65 (  int4eq			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4eq - ));
 DESCR("equal");
-DATA(insert OID =  66 (  int4lt			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4lt - ));
+DATA(insert OID =  66 (  int4lt			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4lt - ));
 DESCR("less-than");
 DATA(insert OID =  67 (  texteq			   PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100	texteq - ));
 DESCR("equal");
-DATA(insert OID =  68 (  xideq			   PGUID 12 f t t t 2 f 16 "28 28" 100 0 0 100  xideq - ));
+DATA(insert OID =  68 (  xideq			   PGUID 12 f t t t 2 f 16 "28 28" 100 0 0 100	xideq - ));
 DESCR("equal");
-DATA(insert OID =  69 (  cideq			   PGUID 12 f t t t 2 f 16 "29 29" 100 0 0 100  cideq - ));
+DATA(insert OID =  69 (  cideq			   PGUID 12 f t t t 2 f 16 "29 29" 100 0 0 100	cideq - ));
 DESCR("equal");
-DATA(insert OID =  70 (  charne			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  charne - ));
+DATA(insert OID =  70 (  charne			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	charne - ));
 DESCR("not equal");
-DATA(insert OID = 1246 (  charlt		   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  charlt - ));
+DATA(insert OID = 1246 (  charlt		   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	charlt - ));
 DESCR("less-than");
-DATA(insert OID =  72 (  charle			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  charle - ));
+DATA(insert OID =  72 (  charle			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	charle - ));
 DESCR("less-than-or-equal");
-DATA(insert OID =  73 (  chargt			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  chargt - ));
+DATA(insert OID =  73 (  chargt			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	chargt - ));
 DESCR("greater-than");
-DATA(insert OID =  74 (  charge			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100  charge - ));
+DATA(insert OID =  74 (  charge			   PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100	charge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1248 (  charpl		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100  charpl - ));
+DATA(insert OID = 1248 (  charpl		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100	charpl - ));
 DESCR("add");
-DATA(insert OID = 1250 (  charmi		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100  charmi - ));
+DATA(insert OID = 1250 (  charmi		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100	charmi - ));
 DESCR("subtract");
-DATA(insert OID =  77 (  charmul		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100  charmul - ));
+DATA(insert OID =  77 (  charmul		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100	charmul - ));
 DESCR("multiply");
-DATA(insert OID =  78 (  chardiv		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100  chardiv - ));
+DATA(insert OID =  78 (  chardiv		   PGUID 12 f t t t 2 f 18 "18 18" 100 0 0 100	chardiv - ));
 DESCR("divide");
 
-DATA(insert OID =  79 (  nameregexeq	   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  nameregexeq - ));
+DATA(insert OID =  79 (  nameregexeq	   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	nameregexeq - ));
 DESCR("matches regex., case-sensitive");
-DATA(insert OID = 1252 (  nameregexne	   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  nameregexne - ));
+DATA(insert OID = 1252 (  nameregexne	   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	nameregexne - ));
 DESCR("does not match regex., case-sensitive");
 DATA(insert OID = 1254 (  textregexeq	   PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100	textregexeq - ));
 DESCR("matches regex., case-sensitive");
@@ -205,7 +205,7 @@ DESCR("length");
 DATA(insert OID = 1258 (  textcat		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	textcat - ));
 DESCR("concatenate");
 
-DATA(insert OID =  84 (  boolne			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100  boolne - ));
+DATA(insert OID =  84 (  boolne			   PGUID 12 f t t t 2 f 16 "16 16" 100 0 0 100	boolne - ));
 DESCR("not equal");
 DATA(insert OID =  89 (  version		   PGUID 12 f t f t 0 f 25 "" 100 0 0 100 pgsql_version - ));
 DESCR("PostgreSQL version string");
@@ -250,19 +250,19 @@ DESCR("is below");
 
 DATA(insert OID = 117 (  point_in		   PGUID 12 f t t t 1 f 600 "0" 100 0 0 100  point_in - ));
 DESCR("(internal)");
-DATA(insert OID = 118 (  point_out		   PGUID 12 f t t t 1 f 23  "600" 100 0 0 100  point_out - ));
+DATA(insert OID = 118 (  point_out		   PGUID 12 f t t t 1 f 23	"600" 100 0 0 100  point_out - ));
 DESCR("(internal)");
 DATA(insert OID = 119 (  lseg_in		   PGUID 12 f t t t 1 f 601 "0" 100 0 0 100  lseg_in - ));
 DESCR("(internal)");
-DATA(insert OID = 120 (  lseg_out		   PGUID 12 f t t t 1 f 23  "0" 100 0 0 100  lseg_out - ));
+DATA(insert OID = 120 (  lseg_out		   PGUID 12 f t t t 1 f 23	"0" 100 0 0 100  lseg_out - ));
 DESCR("(internal)");
 DATA(insert OID = 121 (  path_in		   PGUID 12 f t t t 1 f 602 "0" 100 0 0 100  path_in - ));
 DESCR("(internal)");
-DATA(insert OID = 122 (  path_out		   PGUID 12 f t t t 1 f 23  "0" 100 0 0 100  path_out - ));
+DATA(insert OID = 122 (  path_out		   PGUID 12 f t t t 1 f 23	"0" 100 0 0 100  path_out - ));
 DESCR("(internal)");
 DATA(insert OID = 123 (  box_in			   PGUID 12 f t t t 1 f 603 "0" 100 0 0 100  box_in - ));
 DESCR("(internal)");
-DATA(insert OID = 124 (  box_out		   PGUID 12 f t t t 1 f 23  "0" 100 0 0 100  box_out - ));
+DATA(insert OID = 124 (  box_out		   PGUID 12 f t t t 1 f 23	"0" 100 0 0 100  box_out - ));
 DESCR("(internal)");
 DATA(insert OID = 125 (  box_overlap	   PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100	box_overlap - ));
 DESCR("overlaps");
@@ -296,93 +296,93 @@ DATA(insert OID = 139 (  areasel		   PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 10
 DESCR("restriction selectivity for area-comparison operators");
 DATA(insert OID = 140 (  areajoinsel	   PGUID 12 f t f t 5 f 701 "26 26 21 26 21" 100 0 0 100	areajoinsel - ));
 DESCR("join selectivity for area-comparison operators");
-DATA(insert OID = 141 (  int4mul		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4mul - ));
+DATA(insert OID = 141 (  int4mul		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4mul - ));
 DESCR("multiply");
 DATA(insert OID = 142 (  int4fac		   PGUID 12 f t t t 1 f 23 "23" 100 0 0 100  int4fac - ));
 DESCR("factorial");
-DATA(insert OID = 144 (  int4ne			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4ne - ));
+DATA(insert OID = 144 (  int4ne			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4ne - ));
 DESCR("not equal");
-DATA(insert OID = 145 (  int2ne			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2ne - ));
+DATA(insert OID = 145 (  int2ne			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2ne - ));
 DESCR("not equal");
-DATA(insert OID = 146 (  int2gt			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2gt - ));
+DATA(insert OID = 146 (  int2gt			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2gt - ));
 DESCR("greater-than");
-DATA(insert OID = 147 (  int4gt			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4gt - ));
+DATA(insert OID = 147 (  int4gt			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4gt - ));
 DESCR("greater-than");
-DATA(insert OID = 148 (  int2le			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2le - ));
+DATA(insert OID = 148 (  int2le			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 149 (  int4le			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4le - ));
+DATA(insert OID = 149 (  int4le			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 150 (  int4ge			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100  int4ge - ));
+DATA(insert OID = 150 (  int4ge			   PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100	int4ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 151 (  int2ge			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100  int2ge - ));
+DATA(insert OID = 151 (  int2ge			   PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100	int2ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 152 (  int2mul		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2mul - ));
+DATA(insert OID = 152 (  int2mul		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2mul - ));
 DESCR("multiply");
-DATA(insert OID = 153 (  int2div		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2div - ));
+DATA(insert OID = 153 (  int2div		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2div - ));
 DESCR("divide");
-DATA(insert OID = 154 (  int4div		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4div - ));
+DATA(insert OID = 154 (  int4div		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4div - ));
 DESCR("divide");
-DATA(insert OID = 155 (  int2mod		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2mod - ));
+DATA(insert OID = 155 (  int2mod		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2mod - ));
 DESCR("modulus");
-DATA(insert OID = 156 (  int4mod		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4mod - ));
+DATA(insert OID = 156 (  int4mod		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4mod - ));
 DESCR("modulus");
 DATA(insert OID = 157 (  textne			   PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100	textne - ));
 DESCR("not equal");
-DATA(insert OID = 158 (  int24eq		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24eq - ));
+DATA(insert OID = 158 (  int24eq		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24eq - ));
 DESCR("equal");
-DATA(insert OID = 159 (  int42eq		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42eq - ));
+DATA(insert OID = 159 (  int42eq		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42eq - ));
 DESCR("equal");
-DATA(insert OID = 160 (  int24lt		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24lt - ));
+DATA(insert OID = 160 (  int24lt		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24lt - ));
 DESCR("less-than");
-DATA(insert OID = 161 (  int42lt		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42lt - ));
+DATA(insert OID = 161 (  int42lt		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42lt - ));
 DESCR("less-than");
-DATA(insert OID = 162 (  int24gt		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24gt - ));
+DATA(insert OID = 162 (  int24gt		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24gt - ));
 DESCR("greater-than");
-DATA(insert OID = 163 (  int42gt		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42gt - ));
+DATA(insert OID = 163 (  int42gt		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42gt - ));
 DESCR("greater-than");
-DATA(insert OID = 164 (  int24ne		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24ne - ));
+DATA(insert OID = 164 (  int24ne		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24ne - ));
 DESCR("not equal");
-DATA(insert OID = 165 (  int42ne		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42ne - ));
+DATA(insert OID = 165 (  int42ne		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42ne - ));
 DESCR("not equal");
-DATA(insert OID = 166 (  int24le		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24le - ));
+DATA(insert OID = 166 (  int24le		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 167 (  int42le		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42le - ));
+DATA(insert OID = 167 (  int42le		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 168 (  int24ge		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100  int24ge - ));
+DATA(insert OID = 168 (  int24ge		   PGUID 12 f t t t 2 f 16 "21 23" 100 0 0 100	int24ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 169 (  int42ge		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100  int42ge - ));
+DATA(insert OID = 169 (  int42ge		   PGUID 12 f t t t 2 f 16 "23 21" 100 0 0 100	int42ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 170 (  int24mul		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24mul - ));
+DATA(insert OID = 170 (  int24mul		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24mul - ));
 DESCR("multiply");
-DATA(insert OID = 171 (  int42mul		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42mul - ));
+DATA(insert OID = 171 (  int42mul		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42mul - ));
 DESCR("multiply");
-DATA(insert OID = 172 (  int24div		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24div - ));
+DATA(insert OID = 172 (  int24div		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24div - ));
 DESCR("divide");
-DATA(insert OID = 173 (  int42div		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42div - ));
+DATA(insert OID = 173 (  int42div		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42div - ));
 DESCR("divide");
-DATA(insert OID = 174 (  int24mod		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24mod - ));
+DATA(insert OID = 174 (  int24mod		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24mod - ));
 DESCR("modulus");
-DATA(insert OID = 175 (  int42mod		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42mod - ));
+DATA(insert OID = 175 (  int42mod		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42mod - ));
 DESCR("modulus");
-DATA(insert OID = 176 (  int2pl			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2pl - ));
+DATA(insert OID = 176 (  int2pl			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2pl - ));
 DESCR("add");
-DATA(insert OID = 177 (  int4pl			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4pl - ));
+DATA(insert OID = 177 (  int4pl			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4pl - ));
 DESCR("add");
-DATA(insert OID = 178 (  int24pl		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24pl - ));
+DATA(insert OID = 178 (  int24pl		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24pl - ));
 DESCR("add");
-DATA(insert OID = 179 (  int42pl		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42pl - ));
+DATA(insert OID = 179 (  int42pl		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42pl - ));
 DESCR("add");
-DATA(insert OID = 180 (  int2mi			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2mi - ));
+DATA(insert OID = 180 (  int2mi			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2mi - ));
 DESCR("subtract");
-DATA(insert OID = 181 (  int4mi			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4mi - ));
+DATA(insert OID = 181 (  int4mi			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4mi - ));
 DESCR("subtract");
-DATA(insert OID = 182 (  int24mi		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24mi - ));
+DATA(insert OID = 182 (  int24mi		   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24mi - ));
 DESCR("subtract");
-DATA(insert OID = 183 (  int42mi		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42mi - ));
+DATA(insert OID = 183 (  int42mi		   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42mi - ));
 DESCR("subtract");
-DATA(insert OID = 184 (  oideq			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oideq - ));
+DATA(insert OID = 184 (  oideq			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oideq - ));
 DESCR("equal");
-DATA(insert OID = 185 (  oidne			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oidne - ));
+DATA(insert OID = 185 (  oidne			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oidne - ));
 DESCR("not equal");
 DATA(insert OID = 186 (  box_same		   PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100	box_same - ));
 DESCR("same as");
@@ -417,7 +417,7 @@ DESCR("r-tree");
 
 DATA(insert OID = 200 (  float4in		   PGUID 12 f t t t 1 f 700 "0" 100 0 0 100  float4in - ));
 DESCR("(internal)");
-DATA(insert OID = 201 (  float4out		   PGUID 12 f t t t 1 f 23  "700" 100 0 0 100  float4out - ));
+DATA(insert OID = 201 (  float4out		   PGUID 12 f t t t 1 f 23	"700" 100 0 0 100  float4out - ));
 DESCR("(internal)");
 DATA(insert OID = 202 (  float4mul		   PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100  float4mul - ));
 DESCR("multiply");
@@ -445,7 +445,7 @@ DESCR("negate");
 
 DATA(insert OID = 214 (  float8in		   PGUID 12 f t t t 1 f 701 "0" 100 0 0 100  float8in - ));
 DESCR("(internal)");
-DATA(insert OID = 215 (  float8out		   PGUID 12 f t t t 1 f 23  "701" 100 0 0 100  float8out - ));
+DATA(insert OID = 215 (  float8out		   PGUID 12 f t t t 1 f 23	"701" 100 0 0 100  float8out - ));
 DESCR("(internal)");
 DATA(insert OID = 216 (  float8mul		   PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100  float8mul - ));
 DESCR("multiply");
@@ -500,11 +500,11 @@ DESCR("distance between");
 
 DATA(insert OID = 240 (  nabstimein		   PGUID 12 f t f t 1 f 702 "0" 100 0 0 100  nabstimein - ));
 DESCR("(internal)");
-DATA(insert OID = 241 (  nabstimeout	   PGUID 12 f t f t 1 f 23  "0" 100 0 0 100  nabstimeout - ));
+DATA(insert OID = 241 (  nabstimeout	   PGUID 12 f t f t 1 f 23	"0" 100 0 0 100  nabstimeout - ));
 DESCR("(internal)");
 DATA(insert OID = 242 (  reltimein		   PGUID 12 f t f t 1 f 703 "0" 100 0 0 100  reltimein - ));
 DESCR("(internal)");
-DATA(insert OID = 243 (  reltimeout		   PGUID 12 f t f t 1 f 23  "0" 100 0 0 100  reltimeout - ));
+DATA(insert OID = 243 (  reltimeout		   PGUID 12 f t f t 1 f 23	"0" 100 0 0 100  reltimeout - ));
 DESCR("(internal)");
 DATA(insert OID = 244 (  timepl			   PGUID 12 f t f t 2 f 702 "702 703" 100 0 0 100  timepl - ));
 DESCR("add");
@@ -512,7 +512,7 @@ DATA(insert OID = 245 (  timemi			   PGUID 12 f t f t 2 f 702 "702 703" 100 0 0
 DESCR("subtract");
 DATA(insert OID = 246 (  tintervalin	   PGUID 12 f t f t 1 f 704 "0" 100 0 0 100  tintervalin - ));
 DESCR("(internal)");
-DATA(insert OID = 247 (  tintervalout	   PGUID 12 f t f t 1 f 23  "0" 100 0 0 100  tintervalout - ));
+DATA(insert OID = 247 (  tintervalout	   PGUID 12 f t f t 1 f 23	"0" 100 0 0 100  tintervalout - ));
 DESCR("(internal)");
 DATA(insert OID = 248 (  intinterval	   PGUID 12 f t f t 2 f 16 "702 704" 100 0 0 100	intinterval - ));
 DESCR("abstime in tinterval");
@@ -566,7 +566,7 @@ DATA(insert OID = 272 (  tintervalstart    PGUID 12 f t f t 1 f 702 "704" 100 0
 DESCR("start of interval");
 DATA(insert OID = 273 (  tintervalend	   PGUID 12 f t f t 1 f 702 "704" 100 0 0 100  tintervalend - ));
 DESCR("");
-DATA(insert OID = 274 (  timeofday		   PGUID 12 f t f t 0 f 25 "0" 100 0 0 100  timeofday - ));
+DATA(insert OID = 274 (  timeofday		   PGUID 12 f t f t 0 f 25 "0" 100 0 0 100	timeofday - ));
 DESCR("Current date and time with microseconds");
 DATA(insert OID = 275 (  isfinite		   PGUID 12 f t f t 1 f 16 "702" 100 0 0 100	abstime_finite - ));
 DESCR("");
@@ -669,42 +669,42 @@ DESCR("convert int4 to float4");
 DATA(insert OID = 319 (  int4			   PGUID 12 f t t t 1 f  23 "700" 100 0 0 100  ftoi4 - ));
 DESCR("convert float4 to int4");
 
-DATA(insert OID = 320 (  rtinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  rtinsert - ));
+DATA(insert OID = 320 (  rtinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	rtinsert - ));
 DESCR("r-tree(internal)");
 DATA(insert OID = 321 (  rtdelete		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  rtdelete - ));
 DESCR("r-tree(internal)");
 DATA(insert OID = 322 (  rtgettuple		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  rtgettuple - ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 323 (  rtbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  rtbuild - ));
+DATA(insert OID = 323 (  rtbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	rtbuild - ));
 DESCR("r-tree(internal)");
 DATA(insert OID = 324 (  rtbeginscan	   PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100  rtbeginscan - ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 325 (  rtendscan		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  rtendscan - ));
+DATA(insert OID = 325 (  rtendscan		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	rtendscan - ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 326 (  rtmarkpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  rtmarkpos - ));
+DATA(insert OID = 326 (  rtmarkpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	rtmarkpos - ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 327 (  rtrestrpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  rtrestrpos - ));
+DATA(insert OID = 327 (  rtrestrpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	rtrestrpos - ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 328 (  rtrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100  rtrescan - ));
+DATA(insert OID = 328 (  rtrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100	rtrescan - ));
 DESCR("r-tree(internal)");
 
 DATA(insert OID = 330 (  btgettuple		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  btgettuple - ));
 DESCR("btree(internal)");
-DATA(insert OID = 331 (  btinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  btinsert - ));
+DATA(insert OID = 331 (  btinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	btinsert - ));
 DESCR("btree(internal)");
 DATA(insert OID = 332 (  btdelete		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  btdelete - ));
 DESCR("btree(internal)");
 DATA(insert OID = 333 (  btbeginscan	   PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100  btbeginscan - ));
 DESCR("btree(internal)");
-DATA(insert OID = 334 (  btrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100  btrescan - ));
+DATA(insert OID = 334 (  btrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100	btrescan - ));
 DESCR("btree(internal)");
-DATA(insert OID = 335 (  btendscan		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  btendscan - ));
+DATA(insert OID = 335 (  btendscan		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	btendscan - ));
 DESCR("btree(internal)");
-DATA(insert OID = 336 (  btmarkpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  btmarkpos - ));
+DATA(insert OID = 336 (  btmarkpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	btmarkpos - ));
 DESCR("btree(internal)");
-DATA(insert OID = 337 (  btrestrpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  btrestrpos - ));
+DATA(insert OID = 337 (  btrestrpos		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	btrestrpos - ));
 DESCR("btree(internal)");
-DATA(insert OID = 338 (  btbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  btbuild - ));
+DATA(insert OID = 338 (  btbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	btbuild - ));
 DESCR("btree(internal)");
 
 DATA(insert OID = 339 (  poly_same		   PGUID 12 f t t t 2 f 16 "604 604" 100 0 0 100  poly_same - ));
@@ -725,30 +725,30 @@ DATA(insert OID = 346 (  poly_overlap	   PGUID 12 f t t t 2 f 16 "604 604" 100 0
 DESCR("overlaps");
 DATA(insert OID = 347 (  poly_in		   PGUID 12 f t t t 1 f 604 "0" 100 0 0 100  poly_in - ));
 DESCR("(internal)");
-DATA(insert OID = 348 (  poly_out		   PGUID 12 f t t t 1 f 23  "0" 100 0 0 100  poly_out - ));
+DATA(insert OID = 348 (  poly_out		   PGUID 12 f t t t 1 f 23	"0" 100 0 0 100  poly_out - ));
 DESCR("(internal)");
 
-DATA(insert OID = 350 (  btint2cmp		   PGUID 12 f t t t 2 f 23 "21 21" 100 0 0 100  btint2cmp - ));
+DATA(insert OID = 350 (  btint2cmp		   PGUID 12 f t t t 2 f 23 "21 21" 100 0 0 100	btint2cmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 351 (  btint4cmp		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  btint4cmp - ));
+DATA(insert OID = 351 (  btint4cmp		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	btint4cmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 842 (  btint8cmp		   PGUID 12 f t t t 2 f 23 "20 20" 100 0 0 100  btint8cmp - ));
+DATA(insert OID = 842 (  btint8cmp		   PGUID 12 f t t t 2 f 23 "20 20" 100 0 0 100	btint8cmp - ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 354 (  btfloat4cmp	   PGUID 12 f t t t 2 f 23 "700 700" 100 0 0 100	btfloat4cmp - ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 355 (  btfloat8cmp	   PGUID 12 f t t t 2 f 23 "701 701" 100 0 0 100	btfloat8cmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 356 (  btoidcmp		   PGUID 12 f t t t 2 f 23 "26 26" 100 0 0 100  btoidcmp - ));
+DATA(insert OID = 356 (  btoidcmp		   PGUID 12 f t t t 2 f 23 "26 26" 100 0 0 100	btoidcmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 404 (  btoidvectorcmp    PGUID 12 f t t t 2 f 23 "30 30" 100 0 0 100  btoidvectorcmp - ));
+DATA(insert OID = 404 (  btoidvectorcmp    PGUID 12 f t t t 2 f 23 "30 30" 100 0 0 100	btoidvectorcmp - ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 357 (  btabstimecmp	   PGUID 12 f t f t 2 f 23 "702 702" 100 0 0 100	btabstimecmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 358 (  btcharcmp		   PGUID 12 f t t t 2 f 23 "18 18" 100 0 0 100  btcharcmp - ));
+DATA(insert OID = 358 (  btcharcmp		   PGUID 12 f t t t 2 f 23 "18 18" 100 0 0 100	btcharcmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 359 (  btnamecmp		   PGUID 12 f t t t 2 f 23 "19 19" 100 0 0 100  btnamecmp - ));
+DATA(insert OID = 359 (  btnamecmp		   PGUID 12 f t t t 2 f 23 "19 19" 100 0 0 100	btnamecmp - ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 360 (  bttextcmp		   PGUID 12 f t t t 2 f 23 "25 25" 100 0 0 100  bttextcmp - ));
+DATA(insert OID = 360 (  bttextcmp		   PGUID 12 f t t t 2 f 23 "25 25" 100 0 0 100	bttextcmp - ));
 DESCR("btree less-equal-greater");
 
 DATA(insert OID = 361 (  lseg_distance	   PGUID 12 f t t t 2 f 701 "601 601" 100 0 0 100  lseg_distance - ));
@@ -780,13 +780,13 @@ DESCR("intersects?");
 
 /* OIDS 400 - 499 */
 
-DATA(insert OID =  406 (  text			   PGUID 12 f t t t 1 f	25 "19" 100 0 0 100 name_text - ));
+DATA(insert OID =  406 (  text			   PGUID 12 f t t t 1 f 25 "19" 100 0 0 100 name_text - ));
 DESCR("convert name to text");
-DATA(insert OID =  407 (  name			   PGUID 12 f t t t 1 f	19 "25" 100 0 0 100 text_name - ));
+DATA(insert OID =  407 (  name			   PGUID 12 f t t t 1 f 19 "25" 100 0 0 100 text_name - ));
 DESCR("convert text to name");
 DATA(insert OID =  408 (  bpchar		   PGUID 12 f t t t 1 f 1042 "19" 100 0 0 100 name_bpchar - ));
 DESCR("convert name to char()");
-DATA(insert OID =  409 (  name			   PGUID 12 f t t t 1 f	19 "1042" 100 0 0 100	bpchar_name - ));
+DATA(insert OID =  409 (  name			   PGUID 12 f t t t 1 f 19 "1042" 100 0 0 100	bpchar_name - ));
 DESCR("convert char() to name");
 
 DATA(insert OID =  438 (  hashcostestimate PGUID 12 f t f t 7 f 0 "0 0 0 0 0 0 0" 100 0 0 100  hashcostestimate - ));
@@ -794,21 +794,21 @@ DESCR("hash index cost estimator");
 
 DATA(insert OID = 440 (  hashgettuple	   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  hashgettuple - ));
 DESCR("hash(internal)");
-DATA(insert OID = 441 (  hashinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  hashinsert - ));
+DATA(insert OID = 441 (  hashinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	hashinsert - ));
 DESCR("hash(internal)");
 DATA(insert OID = 442 (  hashdelete		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  hashdelete - ));
 DESCR("hash(internal)");
 DATA(insert OID = 443 (  hashbeginscan	   PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100  hashbeginscan - ));
 DESCR("hash(internal)");
-DATA(insert OID = 444 (  hashrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100  hashrescan - ));
+DATA(insert OID = 444 (  hashrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100	hashrescan - ));
 DESCR("hash(internal)");
-DATA(insert OID = 445 (  hashendscan	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  hashendscan - ));
+DATA(insert OID = 445 (  hashendscan	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	hashendscan - ));
 DESCR("hash(internal)");
-DATA(insert OID = 446 (  hashmarkpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  hashmarkpos - ));
+DATA(insert OID = 446 (  hashmarkpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	hashmarkpos - ));
 DESCR("hash(internal)");
-DATA(insert OID = 447 (  hashrestrpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  hashrestrpos - ));
+DATA(insert OID = 447 (  hashrestrpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	hashrestrpos - ));
 DESCR("hash(internal)");
-DATA(insert OID = 448 (  hashbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  hashbuild - ));
+DATA(insert OID = 448 (  hashbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	hashbuild - ));
 DESCR("hash(internal)");
 DATA(insert OID = 449 (  hashint2		   PGUID 12 f t t t 1 f 23 "21" 100 0 0 100  hashint2 - ));
 DESCR("hash");
@@ -826,55 +826,55 @@ DATA(insert OID = 454 (  hashchar		   PGUID 12 f t t t 1 f 23 "18" 100 0 0 100
 DESCR("hash");
 DATA(insert OID = 455 (  hashname		   PGUID 12 f t t t 1 f 23 "19" 100 0 0 100  hashname - ));
 DESCR("hash");
-DATA(insert OID = 456 (  hashvarlena	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  hashvarlena - ));
+DATA(insert OID = 456 (  hashvarlena	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	hashvarlena - ));
 DESCR("hash any varlena type");
 DATA(insert OID = 457 (  hashoidvector	   PGUID 12 f t t t 1 f 23 "30" 100 0 0 100  hashoidvector - ));
 DESCR("hash");
 DATA(insert OID = 399 (  hashmacaddr	   PGUID 12 f t t t 1 f 23 "829" 100 0 0 100  hashmacaddr - ));
 DESCR("hash");
-DATA(insert OID = 458 (  text_larger	   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100  text_larger - ));
+DATA(insert OID = 458 (  text_larger	   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	text_larger - ));
 DESCR("larger of two");
-DATA(insert OID = 459 (  text_smaller	   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100  text_smaller - ));
+DATA(insert OID = 459 (  text_smaller	   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	text_smaller - ));
 DESCR("smaller of two");
 
-DATA(insert OID = 460 (  int8in			   PGUID 12 f t t t 1 f 20 "0" 100 0 0 100  int8in - ));
+DATA(insert OID = 460 (  int8in			   PGUID 12 f t t t 1 f 20 "0" 100 0 0 100	int8in - ));
 DESCR("(internal)");
-DATA(insert OID = 461 (  int8out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int8out - ));
+DATA(insert OID = 461 (  int8out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int8out - ));
 DESCR("(internal)");
 DATA(insert OID = 462 (  int8um			   PGUID 12 f t t t 1 f 20 "20" 100 0 0 100  int8um - ));
 DESCR("negate");
-DATA(insert OID = 463 (  int8pl			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8pl - ));
+DATA(insert OID = 463 (  int8pl			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8pl - ));
 DESCR("add");
-DATA(insert OID = 464 (  int8mi			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8mi - ));
+DATA(insert OID = 464 (  int8mi			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8mi - ));
 DESCR("subtract");
-DATA(insert OID = 465 (  int8mul		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8mul - ));
+DATA(insert OID = 465 (  int8mul		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8mul - ));
 DESCR("multiply");
-DATA(insert OID = 466 (  int8div		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8div - ));
+DATA(insert OID = 466 (  int8div		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8div - ));
 DESCR("divide");
-DATA(insert OID = 467 (  int8eq			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8eq - ));
+DATA(insert OID = 467 (  int8eq			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8eq - ));
 DESCR("equal");
-DATA(insert OID = 468 (  int8ne			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8ne - ));
+DATA(insert OID = 468 (  int8ne			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8ne - ));
 DESCR("not equal");
-DATA(insert OID = 469 (  int8lt			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8lt - ));
+DATA(insert OID = 469 (  int8lt			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8lt - ));
 DESCR("less-than");
-DATA(insert OID = 470 (  int8gt			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8gt - ));
+DATA(insert OID = 470 (  int8gt			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8gt - ));
 DESCR("greater-than");
-DATA(insert OID = 471 (  int8le			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8le - ));
+DATA(insert OID = 471 (  int8le			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 472 (  int8ge			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100  int8ge - ));
+DATA(insert OID = 472 (  int8ge			   PGUID 12 f t t t 2 f 16 "20 20" 100 0 0 100	int8ge - ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 474 (  int84eq		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84eq - ));
+DATA(insert OID = 474 (  int84eq		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84eq - ));
 DESCR("equal");
-DATA(insert OID = 475 (  int84ne		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84ne - ));
+DATA(insert OID = 475 (  int84ne		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84ne - ));
 DESCR("not equal");
-DATA(insert OID = 476 (  int84lt		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84lt - ));
+DATA(insert OID = 476 (  int84lt		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84lt - ));
 DESCR("less-than");
-DATA(insert OID = 477 (  int84gt		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84gt - ));
+DATA(insert OID = 477 (  int84gt		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84gt - ));
 DESCR("greater-than");
-DATA(insert OID = 478 (  int84le		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84le - ));
+DATA(insert OID = 478 (  int84le		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 479 (  int84ge		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100  int84ge - ));
+DATA(insert OID = 479 (  int84ge		   PGUID 12 f t t t 2 f 16 "20 23" 100 0 0 100	int84ge - ));
 DESCR("greater-than-or-equal");
 
 DATA(insert OID = 480 (  int4			   PGUID 12 f t t t 1 f  23 "20" 100 0 0 100	int84 - ));
@@ -890,66 +890,66 @@ DESCR("convert float8 to int8");
 
 /* OIDS 600 - 699 */
 
-DATA(insert OID = 1285 (  int4notin		   PGUID 12 f t f t 2 f 16 "23 25" 100 0 0 100  int4notin - ));
+DATA(insert OID = 1285 (  int4notin		   PGUID 12 f t f t 2 f 16 "23 25" 100 0 0 100	int4notin - ));
 DESCR("not in");
-DATA(insert OID = 1286 (  oidnotin		   PGUID 12 f t f t 2 f 16 "26 25" 100 0 0 100  oidnotin - ));
+DATA(insert OID = 1286 (  oidnotin		   PGUID 12 f t f t 2 f 16 "26 25" 100 0 0 100	oidnotin - ));
 DESCR("not in");
-DATA(insert OID = 1287 (  int44in		   PGUID 12 f t t t 1 f 22 "0" 100 0 0 100  int44in - ));
+DATA(insert OID = 1287 (  int44in		   PGUID 12 f t t t 1 f 22 "0" 100 0 0 100	int44in - ));
 DESCR("(internal)");
-DATA(insert OID = 653 (  int44out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  int44out - ));
+DATA(insert OID = 653 (  int44out		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	int44out - ));
 DESCR("(internal)");
-DATA(insert OID = 655 (  namelt			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  namelt - ));
+DATA(insert OID = 655 (  namelt			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	namelt - ));
 DESCR("less-than");
-DATA(insert OID = 656 (  namele			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  namele - ));
+DATA(insert OID = 656 (  namele			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	namele - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 657 (  namegt			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  namegt - ));
+DATA(insert OID = 657 (  namegt			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	namegt - ));
 DESCR("greater-than");
-DATA(insert OID = 658 (  namege			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  namege - ));
+DATA(insert OID = 658 (  namege			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	namege - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 659 (  namene			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100  namene - ));
+DATA(insert OID = 659 (  namene			   PGUID 12 f t t t 2 f 16 "19 19" 100 0 0 100	namene - ));
 DESCR("not equal");
 
-DATA(insert OID = 668 (  bpchar			   PGUID 12 f t t t 2 f 1042 "1042 23" 100 0 0 100  bpchar - ));
+DATA(insert OID = 668 (  bpchar			   PGUID 12 f t t t 2 f 1042 "1042 23" 100 0 0 100	bpchar - ));
 DESCR("adjust char() to typmod length");
-DATA(insert OID = 669 (  varchar		   PGUID 12 f t t t 2 f 1043 "1043 23" 100 0 0 100  varchar - ));
+DATA(insert OID = 669 (  varchar		   PGUID 12 f t t t 2 f 1043 "1043 23" 100 0 0 100	varchar - ));
 DESCR("adjust varchar() to typmod length");
 
 DATA(insert OID = 676 (  mktinterval	   PGUID 12 f t f t 2 f 704 "702 702" 100 0 0 100 mktinterval - ));
 DESCR("convert to tinterval");
-DATA(insert OID = 619 (  oidvectorne	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectorne - ));
+DATA(insert OID = 619 (  oidvectorne	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectorne - ));
 DESCR("not equal");
-DATA(insert OID = 677 (  oidvectorlt	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectorlt - ));
+DATA(insert OID = 677 (  oidvectorlt	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectorlt - ));
 DESCR("less-than");
-DATA(insert OID = 678 (  oidvectorle	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectorle - ));
+DATA(insert OID = 678 (  oidvectorle	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectorle - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 679 (  oidvectoreq	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectoreq - ));
+DATA(insert OID = 679 (  oidvectoreq	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectoreq - ));
 DESCR("equal");
-DATA(insert OID = 680 (  oidvectorge	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectorge - ));
+DATA(insert OID = 680 (  oidvectorge	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectorge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 681 (  oidvectorgt	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100  oidvectorgt - ));
+DATA(insert OID = 681 (  oidvectorgt	   PGUID 12 f t t t 2 f 16 "30 30" 100 0 0 100	oidvectorgt - ));
 DESCR("greater-than");
 
 /* OIDS 700 - 799 */
-DATA(insert OID = 710 (  getpgusername	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100  current_user - ));
+DATA(insert OID = 710 (  getpgusername	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100	current_user - ));
 DESCR("deprecated -- use current_user");
 DATA(insert OID = 711 (  userfntest		   PGUID 12 f t t t 1 f 23 "23" 100 0 0 100  userfntest - ));
 DESCR("");
-DATA(insert OID = 713 (  oidrand		   PGUID 12 f t f t 2 f 16 "26 23" 100 0 0 100  oidrand - ));
+DATA(insert OID = 713 (  oidrand		   PGUID 12 f t f t 2 f 16 "26 23" 100 0 0 100	oidrand - ));
 DESCR("random");
 DATA(insert OID = 715 (  oidsrand		   PGUID 12 f t f t 1 f 16 "23" 100 0 0 100  oidsrand - ));
 DESCR("seed random number generator");
-DATA(insert OID = 716 (  oidlt			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oidlt - ));
+DATA(insert OID = 716 (  oidlt			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oidlt - ));
 DESCR("less-than");
-DATA(insert OID = 717 (  oidle			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oidle - ));
+DATA(insert OID = 717 (  oidle			   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oidle - ));
 DESCR("less-than-or-equal");
 
 DATA(insert OID = 720 (  octet_length	   PGUID 12 f t t t 1 f 23 "17" 100 0 0 100  byteaoctetlen - ));
 DESCR("octet length");
-DATA(insert OID = 721 (  get_byte		   PGUID 12 f t t t 2 f 23 "17 23" 100 0 0 100  byteaGetByte - ));
+DATA(insert OID = 721 (  get_byte		   PGUID 12 f t t t 2 f 23 "17 23" 100 0 0 100	byteaGetByte - ));
 DESCR("");
 DATA(insert OID = 722 (  set_byte		   PGUID 12 f t t t 3 f 17 "17 23 23" 100 0 0 100  byteaSetByte - ));
 DESCR("");
-DATA(insert OID = 723 (  get_bit		   PGUID 12 f t t t 2 f 23 "17 23" 100 0 0 100  byteaGetBit - ));
+DATA(insert OID = 723 (  get_bit		   PGUID 12 f t t t 2 f 23 "17 23" 100 0 0 100	byteaGetBit - ));
 DESCR("");
 DATA(insert OID = 724 (  set_bit		   PGUID 12 f t t t 3 f 17 "17 23 23" 100 0 0 100  byteaSetBit - ));
 DESCR("");
@@ -977,9 +977,9 @@ DESCR("greater-than-or-equal");
 DATA(insert OID = 744 (  array_eq		   PGUID 12 f t t t 2 f 16 "0 0" 100 0 0 100 array_eq -));
 DESCR("array equal");
 
-DATA(insert OID = 745 (  current_user	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100  current_user - ));
+DATA(insert OID = 745 (  current_user	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100	current_user - ));
 DESCR("current user name");
-DATA(insert OID = 746 (  session_user	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100  session_user - ));
+DATA(insert OID = 746 (  session_user	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100	session_user - ));
 DESCR("session user name");
 
 DATA(insert OID = 747 (  array_dims		   PGUID 12 f t t t 1 f 25 "0" 100 0 0 100 array_dims -));
@@ -991,7 +991,7 @@ DESCR("array");
 
 DATA(insert OID = 760 (  smgrin			   PGUID 12 f t f t 1 f 210 "0" 100 0 0 100  smgrin - ));
 DESCR("storage manager(internal)");
-DATA(insert OID = 761 (  smgrout		   PGUID 12 f t f t 1 f 23  "0" 100 0 0 100  smgrout - ));
+DATA(insert OID = 761 (  smgrout		   PGUID 12 f t f t 1 f 23	"0" 100 0 0 100  smgrout - ));
 DESCR("storage manager(internal)");
 DATA(insert OID = 762 (  smgreq			   PGUID 12 f t f t 2 f 16 "210 210" 100 0 0 100	smgreq - ));
 DESCR("storage manager");
@@ -1000,39 +1000,39 @@ DESCR("storage manager");
 
 DATA(insert OID = 764 (  lo_import		   PGUID 12 f t f t 1 f 26 "25" 100 0 0 100  lo_import - ));
 DESCR("large object import");
-DATA(insert OID = 765 (  lo_export		   PGUID 12 f t f t 2 f 23 "26 25" 100 0 0 100  lo_export - ));
+DATA(insert OID = 765 (  lo_export		   PGUID 12 f t f t 2 f 23 "26 25" 100 0 0 100	lo_export - ));
 DESCR("large object export");
 
 DATA(insert OID = 766 (  int4inc		   PGUID 12 f t t t 1 f 23 "23" 100 0 0 100  int4inc - ));
 DESCR("increment");
-DATA(insert OID = 768 (  int4larger		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4larger - ));
+DATA(insert OID = 768 (  int4larger		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4larger - ));
 DESCR("larger of two");
-DATA(insert OID = 769 (  int4smaller	   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4smaller - ));
+DATA(insert OID = 769 (  int4smaller	   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4smaller - ));
 DESCR("smaller of two");
-DATA(insert OID = 770 (  int2larger		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2larger - ));
+DATA(insert OID = 770 (  int2larger		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2larger - ));
 DESCR("larger of two");
-DATA(insert OID = 771 (  int2smaller	   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2smaller - ));
+DATA(insert OID = 771 (  int2smaller	   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2smaller - ));
 DESCR("smaller of two");
 
 DATA(insert OID = 772 (  gistcostestimate  PGUID 12 f t f t 7 f 0 "0 0 0 0 0 0 0" 100 0 0 100  gistcostestimate - ));
 DESCR("gist cost estimator");
 DATA(insert OID = 774 (  gistgettuple	   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  gistgettuple - ));
 DESCR("gist(internal)");
-DATA(insert OID = 775 (  gistinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  gistinsert - ));
+DATA(insert OID = 775 (  gistinsert		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	gistinsert - ));
 DESCR("gist(internal)");
 DATA(insert OID = 776 (  gistdelete		   PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100  gistdelete - ));
 DESCR("gist(internal)");
 DATA(insert OID = 777 (  gistbeginscan	   PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100  gistbeginscan - ));
 DESCR("gist(internal)");
-DATA(insert OID = 778 (  gistrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100  gistrescan - ));
+DATA(insert OID = 778 (  gistrescan		   PGUID 12 f t f t 3 f 23 "0 0 0" 100 0 0 100	gistrescan - ));
 DESCR("gist(internal)");
-DATA(insert OID = 779 (  gistendscan	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  gistendscan - ));
+DATA(insert OID = 779 (  gistendscan	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	gistendscan - ));
 DESCR("gist(internal)");
-DATA(insert OID = 780 (  gistmarkpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  gistmarkpos - ));
+DATA(insert OID = 780 (  gistmarkpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	gistmarkpos - ));
 DESCR("gist(internal)");
-DATA(insert OID = 781 (  gistrestrpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  gistrestrpos - ));
+DATA(insert OID = 781 (  gistrestrpos	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	gistrestrpos - ));
 DESCR("gist(internal)");
-DATA(insert OID = 782 (  gistbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100  gistbuild - ));
+DATA(insert OID = 782 (  gistbuild		   PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100	gistbuild - ));
 DESCR("gist(internal)");
 
 DATA(insert OID = 784 (  tintervaleq	   PGUID 12 f t f t 2 f 16 "704 704" 100 0 0 100	tintervaleq - ));
@@ -1080,27 +1080,27 @@ DESCR("matches LIKE expression");
 DATA(insert OID =  851 (  textnlike		   PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100 textnlike - ));
 DESCR("does not match LIKE expression");
 
-DATA(insert OID =  852 (  int48eq		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48eq - ));
+DATA(insert OID =  852 (  int48eq		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48eq - ));
 DESCR("equal");
-DATA(insert OID =  853 (  int48ne		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48ne - ));
+DATA(insert OID =  853 (  int48ne		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48ne - ));
 DESCR("not equal");
-DATA(insert OID =  854 (  int48lt		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48lt - ));
+DATA(insert OID =  854 (  int48lt		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48lt - ));
 DESCR("less-than");
-DATA(insert OID =  855 (  int48gt		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48gt - ));
+DATA(insert OID =  855 (  int48gt		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48gt - ));
 DESCR("greater-than");
-DATA(insert OID =  856 (  int48le		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48le - ));
+DATA(insert OID =  856 (  int48le		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID =  857 (  int48ge		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100  int48ge - ));
+DATA(insert OID =  857 (  int48ge		   PGUID 12 f t t t 2 f 16 "23 20" 100 0 0 100	int48ge - ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID =  858 (  namelike		   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  namelike - ));
+DATA(insert OID =  858 (  namelike		   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	namelike - ));
 DESCR("matches LIKE expression");
-DATA(insert OID =  859 (  namenlike		   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  namenlike - ));
+DATA(insert OID =  859 (  namenlike		   PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	namenlike - ));
 DESCR("does not match LIKE expression");
 
 DATA(insert OID =  860 (  bpchar		   PGUID 12 f t t t 1 f 1042 "18" 100 0 0 100  char_bpchar - ));
 DESCR("convert char to char()");
-DATA(insert OID =  861 (  char			   PGUID 12 f t t t 1 f	18 "1042" 100 0 0 100  bpchar_char - ));
+DATA(insert OID =  861 (  char			   PGUID 12 f t t t 1 f 18 "1042" 100 0 0 100  bpchar_char - ));
 DESCR("convert char() to char");
 
 DATA(insert OID =  862 (  int4_mul_cash		   PGUID 12 f t t t 2 f 790 "23 790" 100 0 0 100	int4_mul_cash - ));
@@ -1147,23 +1147,23 @@ DESCR("larger of two");
 DATA(insert OID =  899 (  cashsmaller	   PGUID 12 f t t t 2 f 790 "790 790" 100 0 0 100  cashsmaller - ));
 DESCR("smaller of two");
 
-DATA(insert OID =  919 (  flt8_mul_cash	   PGUID 12 f t t t 2 f 790 "701 790" 100 0 0 100  flt8_mul_cash - ));
+DATA(insert OID =  919 (  flt8_mul_cash    PGUID 12 f t t t 2 f 790 "701 790" 100 0 0 100  flt8_mul_cash - ));
 DESCR("multiply");
 
 /* OIDS 900 - 999 */
 
-DATA(insert OID = 940 (  mod			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2mod - ));
+DATA(insert OID = 940 (  mod			   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2mod - ));
 DESCR("modulus");
-DATA(insert OID = 941 (  mod			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4mod - ));
+DATA(insert OID = 941 (  mod			   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4mod - ));
 DESCR("modulus");
-DATA(insert OID = 942 (  mod			   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100  int24mod - ));
+DATA(insert OID = 942 (  mod			   PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100	int24mod - ));
 DESCR("modulus");
-DATA(insert OID = 943 (  mod			   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100  int42mod - ));
+DATA(insert OID = 943 (  mod			   PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100	int42mod - ));
 DESCR("modulus");
 
-DATA(insert OID = 945 (  int8mod		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8mod - ));
+DATA(insert OID = 945 (  int8mod		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8mod - ));
 DESCR("modulus");
-DATA(insert OID = 947 (  mod			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8mod - ));
+DATA(insert OID = 947 (  mod			   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8mod - ));
 DESCR("modulus");
 
 DATA(insert OID = 944 (  char			   PGUID 12 f t t t 1 f 18 "25" 100 0 0 100  text_char - ));
@@ -1176,13 +1176,13 @@ DESCR("bool is true (not false or unknown)");
 DATA(insert OID = 951 (  isfalse		   PGUID 12 f t t f 1 f 16 "16" 100 0 0 100  isfalse - ));
 DESCR("bool is false (not true or unknown)");
 
-DATA(insert OID = 952 (  lo_open		   PGUID 12 f t f t 2 f 23 "26 23" 100 0 0 100  lo_open - ));
+DATA(insert OID = 952 (  lo_open		   PGUID 12 f t f t 2 f 23 "26 23" 100 0 0 100	lo_open - ));
 DESCR("large object open");
 DATA(insert OID = 953 (  lo_close		   PGUID 12 f t f t 1 f 23 "23" 100 0 0 100  lo_close - ));
 DESCR("large object close");
-DATA(insert OID = 954 (  loread			   PGUID 12 f t f t 2 f 17 "23 23" 100 0 0 100  loread - ));
+DATA(insert OID = 954 (  loread			   PGUID 12 f t f t 2 f 17 "23 23" 100 0 0 100	loread - ));
 DESCR("large object read");
-DATA(insert OID = 955 (  lowrite		   PGUID 12 f t f t 2 f 23 "23 17" 100 0 0 100  lowrite - ));
+DATA(insert OID = 955 (  lowrite		   PGUID 12 f t f t 2 f 23 "23 17" 100 0 0 100	lowrite - ));
 DESCR("large object write");
 DATA(insert OID = 956 (  lo_lseek		   PGUID 12 f t f t 3 f 23 "23 23 23" 100 0 0 100  lo_lseek - ));
 DESCR("large object seek");
@@ -1258,27 +1258,27 @@ DESCR("horizontal?");
 DATA(insert OID = 999 (  lseg_eq		   PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100	lseg_eq - ));
 DESCR("equal");
 
-DATA(insert OID =  748 (  date			   PGUID 12 f t f t 1 f	1082 "25" 100 0 0 100 text_date - ));
+DATA(insert OID =  748 (  date			   PGUID 12 f t f t 1 f 1082 "25" 100 0 0 100 text_date - ));
 DESCR("convert text to date");
-DATA(insert OID =  749 (  text			   PGUID 12 f t f t 1 f	25 "1082" 100 0 0 100 date_text - ));
+DATA(insert OID =  749 (  text			   PGUID 12 f t f t 1 f 25 "1082" 100 0 0 100 date_text - ));
 DESCR("convert date to text");
-DATA(insert OID =  837 (  time			   PGUID 12 f t f t 1 f	1083 "25" 100 0 0 100 text_time - ));
+DATA(insert OID =  837 (  time			   PGUID 12 f t f t 1 f 1083 "25" 100 0 0 100 text_time - ));
 DESCR("convert text to time");
-DATA(insert OID =  948 (  text			   PGUID 12 f t f t 1 f	25 "1083" 100 0 0 100 time_text - ));
+DATA(insert OID =  948 (  text			   PGUID 12 f t f t 1 f 25 "1083" 100 0 0 100 time_text - ));
 DESCR("convert time to text");
-DATA(insert OID =  938 (  timetz		   PGUID 12 f t f t 1 f	1266 "25" 100 0 0 100 text_timetz - ));
+DATA(insert OID =  938 (  timetz		   PGUID 12 f t f t 1 f 1266 "25" 100 0 0 100 text_timetz - ));
 DESCR("convert text to timetz");
-DATA(insert OID =  939 (  text			   PGUID 12 f t f t 1 f	25 "1266" 100 0 0 100 timetz_text - ));
+DATA(insert OID =  939 (  text			   PGUID 12 f t f t 1 f 25 "1266" 100 0 0 100 timetz_text - ));
 DESCR("convert timetz to text");
 
 /* OIDS 1000 - 1999 */
 
-DATA(insert OID = 1026 (  timezone		   PGUID 12 f t f t 2 f	25 "1186 1184" 100 0 0 100  timestamp_izone - ));
+DATA(insert OID = 1026 (  timezone		   PGUID 12 f t f t 2 f 25 "1186 1184" 100 0 0 100	timestamp_izone - ));
 DESCR("time zone");
 
-DATA(insert OID = 1029 (  nullvalue		   PGUID 12 f t t f 1 f 16 "0" 100 0 0 100  nullvalue - ));
+DATA(insert OID = 1029 (  nullvalue		   PGUID 12 f t t f 1 f 16 "0" 100 0 0 100	nullvalue - ));
 DESCR("(internal)");
-DATA(insert OID = 1030 (  nonnullvalue	   PGUID 12 f t t f 1 f 16 "0" 100 0 0 100  nonnullvalue - ));
+DATA(insert OID = 1030 (  nonnullvalue	   PGUID 12 f t t f 1 f 16 "0" 100 0 0 100	nonnullvalue - ));
 DESCR("(internal)");
 DATA(insert OID = 1031 (  aclitemin		   PGUID 12 f t f t 1 f 1033 "0" 100 0 0 100	aclitemin - ));
 DESCR("(internal)");
@@ -1288,98 +1288,98 @@ DATA(insert OID = 1035 (  aclinsert		   PGUID 12 f t f t 2 f 1034 "1034 1033" 10
 DESCR("add/update ACL item");
 DATA(insert OID = 1036 (  aclremove		   PGUID 12 f t f t 2 f 1034 "1034 1033" 100 0 0 100	aclremove - ));
 DESCR("remove ACL item");
-DATA(insert OID = 1037 (  aclcontains	   PGUID 12 f t f t 2 f 16 "1034 1033" 100 0 0 100  aclcontains - ));
+DATA(insert OID = 1037 (  aclcontains	   PGUID 12 f t f t 2 f 16 "1034 1033" 100 0 0 100	aclcontains - ));
 DESCR("does ACL contain item?");
 DATA(insert OID = 1038 (  seteval		   PGUID 12 f t f t 1 t 23 "26" 100 0 0 100  seteval - ));
 DESCR("internal function supporting PostQuel-style sets");
 DATA(insert OID = 1044 (  bpcharin		   PGUID 12 f t t t 3 f 1042 "0 26 23" 100 0 0 100 bpcharin - ));
 DESCR("(internal)");
-DATA(insert OID = 1045 (  bpcharout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  bpcharout - ));
+DATA(insert OID = 1045 (  bpcharout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	bpcharout - ));
 DESCR("(internal)");
 DATA(insert OID = 1046 (  varcharin		   PGUID 12 f t t t 3 f 1043 "0 26 23" 100 0 0 100 varcharin - ));
 DESCR("(internal)");
-DATA(insert OID = 1047 (  varcharout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  varcharout - ));
+DATA(insert OID = 1047 (  varcharout	   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	varcharout - ));
 DESCR("(internal)");
-DATA(insert OID = 1048 (  bpchareq		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpchareq - ));
+DATA(insert OID = 1048 (  bpchareq		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpchareq - ));
 DESCR("equal");
-DATA(insert OID = 1049 (  bpcharlt		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpcharlt - ));
+DATA(insert OID = 1049 (  bpcharlt		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpcharlt - ));
 DESCR("less-than");
-DATA(insert OID = 1050 (  bpcharle		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpcharle - ));
+DATA(insert OID = 1050 (  bpcharle		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpcharle - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1051 (  bpchargt		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpchargt - ));
+DATA(insert OID = 1051 (  bpchargt		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpchargt - ));
 DESCR("greater-than");
-DATA(insert OID = 1052 (  bpcharge		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpcharge - ));
+DATA(insert OID = 1052 (  bpcharge		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpcharge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1053 (  bpcharne		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100  bpcharne - ));
+DATA(insert OID = 1053 (  bpcharne		   PGUID 12 f t t t 2 f 16 "1042 1042" 100 0 0 100	bpcharne - ));
 DESCR("not equal");
-DATA(insert OID = 1070 (  varchareq		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varchareq - ));
+DATA(insert OID = 1070 (  varchareq		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varchareq - ));
 DESCR("equal");
-DATA(insert OID = 1071 (  varcharlt		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varcharlt - ));
+DATA(insert OID = 1071 (  varcharlt		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varcharlt - ));
 DESCR("less-than");
-DATA(insert OID = 1072 (  varcharle		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varcharle - ));
+DATA(insert OID = 1072 (  varcharle		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varcharle - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1073 (  varchargt		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varchargt - ));
+DATA(insert OID = 1073 (  varchargt		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varchargt - ));
 DESCR("greater-than");
-DATA(insert OID = 1074 (  varcharge		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varcharge - ));
+DATA(insert OID = 1074 (  varcharge		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varcharge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1075 (  varcharne		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100  varcharne - ));
+DATA(insert OID = 1075 (  varcharne		   PGUID 12 f t t t 2 f 16 "1043 1043" 100 0 0 100	varcharne - ));
 DESCR("not equal");
-DATA(insert OID = 1078 (  bpcharcmp		   PGUID 12 f t t t 2 f 23 "1042 1042" 100 0 0 100  bpcharcmp - ));
+DATA(insert OID = 1078 (  bpcharcmp		   PGUID 12 f t t t 2 f 23 "1042 1042" 100 0 0 100	bpcharcmp - ));
 DESCR("less-equal-greater");
-DATA(insert OID = 1079 (  varcharcmp	   PGUID 12 f t t t 2 f 23 "1043 1043" 100 0 0 100  varcharcmp - ));
+DATA(insert OID = 1079 (  varcharcmp	   PGUID 12 f t t t 2 f 23 "1043 1043" 100 0 0 100	varcharcmp - ));
 DESCR("less-equal-greater");
 DATA(insert OID = 1080 (  hashbpchar	   PGUID 12 f t t t 1 f 23 "1042" 100 0 0 100  hashbpchar - ));
 DESCR("hash");
-DATA(insert OID = 1081 (  format_type      PGUID 12 f t t f 2 f 25 "26 23" 100 0 0 100 format_type - ));
+DATA(insert OID = 1081 (  format_type	   PGUID 12 f t t f 2 f 25 "26 23" 100 0 0 100 format_type - ));
 DESCR("format a type oid and atttypmod to canonical SQL");
 DATA(insert OID = 1084 (  date_in		   PGUID 12 f t f t 1 f 1082 "0" 100 0 0 100	date_in - ));
 DESCR("(internal)");
-DATA(insert OID = 1085 (  date_out		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  date_out - ));
+DATA(insert OID = 1085 (  date_out		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	date_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1086 (  date_eq		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_eq - ));
+DATA(insert OID = 1086 (  date_eq		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_eq - ));
 DESCR("equal");
-DATA(insert OID = 1087 (  date_lt		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_lt - ));
+DATA(insert OID = 1087 (  date_lt		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_lt - ));
 DESCR("less-than");
-DATA(insert OID = 1088 (  date_le		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_le - ));
+DATA(insert OID = 1088 (  date_le		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1089 (  date_gt		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_gt - ));
+DATA(insert OID = 1089 (  date_gt		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1090 (  date_ge		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_ge - ));
+DATA(insert OID = 1090 (  date_ge		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1091 (  date_ne		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100  date_ne - ));
+DATA(insert OID = 1091 (  date_ne		   PGUID 12 f t t t 2 f 16 "1082 1082" 100 0 0 100	date_ne - ));
 DESCR("not equal");
-DATA(insert OID = 1092 (  date_cmp		   PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100  date_cmp - ));
+DATA(insert OID = 1092 (  date_cmp		   PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100	date_cmp - ));
 DESCR("less-equal-greater");
 
 /* OIDS 1100 - 1199 */
 
-DATA(insert OID = 1102 (  time_lt		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_lt - ));
+DATA(insert OID = 1102 (  time_lt		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_lt - ));
 DESCR("less-than");
-DATA(insert OID = 1103 (  time_le		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_le - ));
+DATA(insert OID = 1103 (  time_le		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1104 (  time_gt		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_gt - ));
+DATA(insert OID = 1104 (  time_gt		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1105 (  time_ge		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_ge - ));
+DATA(insert OID = 1105 (  time_ge		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1106 (  time_ne		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_ne - ));
+DATA(insert OID = 1106 (  time_ne		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_ne - ));
 DESCR("not equal");
-DATA(insert OID = 1107 (  time_cmp		   PGUID 12 f t t t 2 f 23 "1083 1083" 100 0 0 100  time_cmp - ));
+DATA(insert OID = 1107 (  time_cmp		   PGUID 12 f t t t 2 f 23 "1083 1083" 100 0 0 100	time_cmp - ));
 DESCR("less-equal-greater");
 DATA(insert OID = 1138 (  date_larger	   PGUID 12 f t t t 2 f 1082 "1082 1082" 100 0 0 100	date_larger - ));
 DESCR("larger of two");
 DATA(insert OID = 1139 (  date_smaller	   PGUID 12 f t t t 2 f 1082 "1082 1082" 100 0 0 100	date_smaller - ));
 DESCR("smaller of two");
-DATA(insert OID = 1140 (  date_mi		   PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100  date_mi - ));
+DATA(insert OID = 1140 (  date_mi		   PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100	date_mi - ));
 DESCR("subtract");
-DATA(insert OID = 1141 (  date_pli		   PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100  date_pli - ));
+DATA(insert OID = 1141 (  date_pli		   PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100	date_pli - ));
 DESCR("add");
-DATA(insert OID = 1142 (  date_mii		   PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100  date_mii - ));
+DATA(insert OID = 1142 (  date_mii		   PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100	date_mii - ));
 DESCR("subtract");
 DATA(insert OID = 1143 (  time_in		   PGUID 12 f t f t 1 f 1083 "0" 100 0 0 100	time_in - ));
 DESCR("(internal)");
-DATA(insert OID = 1144 (  time_out		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  time_out - ));
+DATA(insert OID = 1144 (  time_out		   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	time_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1145 (  time_eq		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100  time_eq - ));
+DATA(insert OID = 1145 (  time_eq		   PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100	time_eq - ));
 DESCR("equal");
 
 DATA(insert OID = 1146 (  circle_add_pt    PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100  circle_add_pt - ));
@@ -1393,38 +1393,38 @@ DESCR("divide");
 
 DATA(insert OID = 1150 (  timestamp_in	   PGUID 12 f t f t 1 f 1184 "0" 100 0 0 100	timestamp_in - ));
 DESCR("(internal)");
-DATA(insert OID = 1151 (  timestamp_out    PGUID 12 f t f t 1 f	23 "0" 100 0 0 100	timestamp_out - ));
+DATA(insert OID = 1151 (  timestamp_out    PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	timestamp_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1152 (  timestamp_eq	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_eq - ));
+DATA(insert OID = 1152 (  timestamp_eq	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_eq - ));
 DESCR("equal");
-DATA(insert OID = 1153 (  timestamp_ne	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_ne - ));
+DATA(insert OID = 1153 (  timestamp_ne	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_ne - ));
 DESCR("not equal");
-DATA(insert OID = 1154 (  timestamp_lt	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_lt - ));
+DATA(insert OID = 1154 (  timestamp_lt	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_lt - ));
 DESCR("less-than");
-DATA(insert OID = 1155 (  timestamp_le	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_le - ));
+DATA(insert OID = 1155 (  timestamp_le	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1156 (  timestamp_ge	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_ge - ));
+DATA(insert OID = 1156 (  timestamp_ge	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1157 (  timestamp_gt	   PGUID 12 f t f t 2 f	16 "1184 1184" 100 0 0 100	timestamp_gt - ));
+DATA(insert OID = 1157 (  timestamp_gt	   PGUID 12 f t f t 2 f 16 "1184 1184" 100 0 0 100	timestamp_gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1159 (  timezone		   PGUID 12 f t f t 2 f	25 "25 1184" 100 0 0 100  timestamp_zone - ));
+DATA(insert OID = 1159 (  timezone		   PGUID 12 f t f t 2 f 25 "25 1184" 100 0 0 100  timestamp_zone - ));
 DESCR("time zone");
 
 DATA(insert OID = 1160 (  interval_in	   PGUID 12 f t f t 1 f 1186 "0" 100 0 0 100	interval_in - ));
 DESCR("(internal)");
-DATA(insert OID = 1161 (  interval_out	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  interval_out - ));
+DATA(insert OID = 1161 (  interval_out	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	interval_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1162 (  interval_eq	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_eq - ));
+DATA(insert OID = 1162 (  interval_eq	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_eq - ));
 DESCR("equal");
-DATA(insert OID = 1163 (  interval_ne	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_ne - ));
+DATA(insert OID = 1163 (  interval_ne	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_ne - ));
 DESCR("not equal");
-DATA(insert OID = 1164 (  interval_lt	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_lt - ));
+DATA(insert OID = 1164 (  interval_lt	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_lt - ));
 DESCR("less-than");
-DATA(insert OID = 1165 (  interval_le	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_le - ));
+DATA(insert OID = 1165 (  interval_le	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1166 (  interval_ge	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_ge - ));
+DATA(insert OID = 1166 (  interval_ge	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1167 (  interval_gt	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100  interval_gt - ));
+DATA(insert OID = 1167 (  interval_gt	   PGUID 12 f t f t 2 f 16 "1186 1186" 100 0 0 100	interval_gt - ));
 DESCR("greater-than");
 DATA(insert OID = 1168 (  interval_um	   PGUID 12 f t f t 1 f 1186 "1186" 100 0 0 100  interval_um - ));
 DESCR("subtract");
@@ -1432,22 +1432,22 @@ DATA(insert OID = 1169 (  interval_pl	   PGUID 12 f t f t 2 f 1186 "1186 1186" 1
 DESCR("add");
 DATA(insert OID = 1170 (  interval_mi	   PGUID 12 f t f t 2 f 1186 "1186 1186" 100 0 0 100	interval_mi - ));
 DESCR("subtract");
-DATA(insert OID = 1171 (  date_part		   PGUID 12 f t f t 2 f  701 "25 1184" 100 0 0 100  timestamp_part - ));
+DATA(insert OID = 1171 (  date_part		   PGUID 12 f t f t 2 f  701 "25 1184" 100 0 0 100	timestamp_part - ));
 DESCR("extract field from timestamp");
-DATA(insert OID = 1172 (  date_part		   PGUID 12 f t f t 2 f  701 "25 1186" 100 0 0 100  interval_part - ));
+DATA(insert OID = 1172 (  date_part		   PGUID 12 f t f t 2 f  701 "25 1186" 100 0 0 100	interval_part - ));
 DESCR("extract field from interval");
 
-DATA(insert OID = 1173 (  timestamp		   PGUID 12 f t f t 1 f 1184 "702" 100 0 0 100  abstime_timestamp - ));
+DATA(insert OID = 1173 (  timestamp		   PGUID 12 f t f t 1 f 1184 "702" 100 0 0 100	abstime_timestamp - ));
 DESCR("convert abstime to timestamp");
 DATA(insert OID = 1174 (  timestamp		   PGUID 12 f t f t 1 f 1184 "1082" 100 0 0 100  date_timestamp - ));
 DESCR("convert date to timestamp");
 DATA(insert OID = 1176 (  timestamp		   PGUID 12 f t f t 2 f 1184 "1082 1083" 100 0 0 100	datetime_timestamp - ));
 DESCR("convert date and time to timestamp");
-DATA(insert OID = 1177 (  interval		   PGUID 12 f t f t 1 f 1186 "703" 100 0 0 100  reltime_interval - ));
+DATA(insert OID = 1177 (  interval		   PGUID 12 f t f t 1 f 1186 "703" 100 0 0 100	reltime_interval - ));
 DESCR("convert reltime to interval");
 DATA(insert OID = 1178 (  date			   PGUID 12 f t f t 1 f 1082 "1184" 100 0 0 100  timestamp_date - ));
 DESCR("convert timestamp to date");
-DATA(insert OID = 1179 (  date			   PGUID 12 f t f t 1 f 1082 "702" 100 0 0 100  abstime_date - ));
+DATA(insert OID = 1179 (  date			   PGUID 12 f t f t 1 f 1082 "702" 100 0 0 100	abstime_date - ));
 DESCR("convert abstime to date");
 DATA(insert OID = 1180 (  abstime		   PGUID 12 f t f t 1 f  702 "1184" 100 0 0 100  timestamp_abstime - ));
 DESCR("convert timestamp to abstime");
@@ -1458,7 +1458,7 @@ DATA(insert OID = 1189 (  timestamp_pl_span PGUID 12 f t f t 2 f 1184 "1184 1186
 DESCR("plus");
 DATA(insert OID = 1190 (  timestamp_mi_span PGUID 12 f t f t 2 f 1184 "1184 1186" 100 0 0 100  timestamp_mi_span - ));
 DESCR("minus");
-DATA(insert OID = 1191 (  timestamp			PGUID 12 f t f t 1 f 1184 "25" 100 0 0 100  text_timestamp - ));
+DATA(insert OID = 1191 (  timestamp			PGUID 12 f t f t 1 f 1184 "25" 100 0 0 100	text_timestamp - ));
 DESCR("convert text to timestamp");
 DATA(insert OID = 1192 (  text				PGUID 12 f t f t 1 f	 25 "1184" 100 0 0 100	timestamp_text - ));
 DESCR("convert timestamp to text");
@@ -1482,26 +1482,26 @@ DESCR("date difference preserving months and years");
 DATA(insert OID = 1200 (  reltime		   PGUID 12 f t t t 1 f  703 "23" 100 0 0 100  int4reltime - ));
 DESCR("convert int4 to reltime");
 
-DATA(insert OID = 1217 (  date_trunc	   PGUID 12 f t f t 2 f 1184 "25 1184" 100 0 0 100  timestamp_trunc - ));
+DATA(insert OID = 1217 (  date_trunc	   PGUID 12 f t f t 2 f 1184 "25 1184" 100 0 0 100	timestamp_trunc - ));
 DESCR("truncate timestamp to specified units");
-DATA(insert OID = 1218 (  date_trunc	   PGUID 12 f t f t 2 f 1186 "25 1186" 100 0 0 100  interval_trunc - ));
+DATA(insert OID = 1218 (  date_trunc	   PGUID 12 f t f t 2 f 1186 "25 1186" 100 0 0 100	interval_trunc - ));
 DESCR("truncate interval to specified units");
 
 DATA(insert OID = 1230 (  int8abs		   PGUID 12 f t t t 1 f 20 "20" 100 0 0 100  int8abs - ));
 DESCR("absolute value");
 
-DATA(insert OID = 1236 (  int8larger	   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8larger - ));
+DATA(insert OID = 1236 (  int8larger	   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8larger - ));
 DESCR("larger of two");
-DATA(insert OID = 1237 (  int8smaller	   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8smaller - ));
+DATA(insert OID = 1237 (  int8smaller	   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8smaller - ));
 DESCR("smaller of two");
 
 DATA(insert OID = 1238 (  texticregexeq    PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100	texticregexeq - ));
 DESCR("matches regex., case-insensitive");
 DATA(insert OID = 1239 (  texticregexne    PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100	texticregexne - ));
 DESCR("does not match regex., case-insensitive");
-DATA(insert OID = 1240 (  nameicregexeq    PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  nameicregexeq - ));
+DATA(insert OID = 1240 (  nameicregexeq    PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	nameicregexeq - ));
 DESCR("matches regex., case-insensitive");
-DATA(insert OID = 1241 (  nameicregexne    PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100  nameicregexne - ));
+DATA(insert OID = 1241 (  nameicregexne    PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100	nameicregexne - ));
 DESCR("does not match regex., case-insensitive");
 
 DATA(insert OID = 1251 (  int4abs		   PGUID 12 f t t t 1 f 23 "23" 100 0 0 100  int4abs - ));
@@ -1517,21 +1517,21 @@ DESCR("SQL92 interval comparison");
 DATA(insert OID = 1272 (  datetime_pl	   PGUID 12 f t f t 2 f 1184 "1082 1083" 100 0 0 100	datetime_timestamp - ));
 DESCR("convert date and time to timestamp");
 
-DATA(insert OID = 1274 (  int84pl		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int84pl - ));
+DATA(insert OID = 1274 (  int84pl		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int84pl - ));
 DESCR("add");
-DATA(insert OID = 1275 (  int84mi		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int84mi - ));
+DATA(insert OID = 1275 (  int84mi		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int84mi - ));
 DESCR("subtract");
-DATA(insert OID = 1276 (  int84mul		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int84mul - ));
+DATA(insert OID = 1276 (  int84mul		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int84mul - ));
 DESCR("multiply");
-DATA(insert OID = 1277 (  int84div		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int84div - ));
+DATA(insert OID = 1277 (  int84div		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int84div - ));
 DESCR("divide");
-DATA(insert OID = 1278 (  int48pl		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100  int48pl - ));
+DATA(insert OID = 1278 (  int48pl		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100	int48pl - ));
 DESCR("add");
-DATA(insert OID = 1279 (  int48mi		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100  int48mi - ));
+DATA(insert OID = 1279 (  int48mi		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100	int48mi - ));
 DESCR("subtract");
-DATA(insert OID = 1280 (  int48mul		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100  int48mul - ));
+DATA(insert OID = 1280 (  int48mul		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100	int48mul - ));
 DESCR("multiply");
-DATA(insert OID = 1281 (  int48div		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100  int48div - ));
+DATA(insert OID = 1281 (  int48div		   PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100	int48div - ));
 DESCR("divide");
 
 DATA(insert OID = 1288 (  text			   PGUID 12 f t t t 1 f 25 "20" 100 0 0 100  int8_text - ));
@@ -1539,16 +1539,16 @@ DESCR("convert int8 to text");
 DATA(insert OID = 1289 (  int8			   PGUID 12 f t t t 1 f 20 "25" 100 0 0 100  text_int8 - ));
 DESCR("convert text to int8");
 
-DATA(insert OID = 1290 (  _bpchar		   PGUID 12 f t t t 2 f 1014 "1014 23" 100 0 0 100  _bpchar - ));
+DATA(insert OID = 1290 (  _bpchar		   PGUID 12 f t t t 2 f 1014 "1014 23" 100 0 0 100	_bpchar - ));
 DESCR("adjust char()[] to typmod length");
-DATA(insert OID = 1291 (  _varchar		   PGUID 12 f t t t 2 f 1015 "1015 23" 100 0 0 100  _varchar - ));
+DATA(insert OID = 1291 (  _varchar		   PGUID 12 f t t t 2 f 1015 "1015 23" 100 0 0 100	_varchar - ));
 DESCR("adjust varchar()[] to typmod length");
 
-DATA(insert OID = 1292 ( tideq			   PGUID 12 f t f t 2 f 16 "27 27" 100 0 0 100  tideq - ));
+DATA(insert OID = 1292 ( tideq			   PGUID 12 f t f t 2 f 16 "27 27" 100 0 0 100	tideq - ));
 DESCR("equal");
-DATA(insert OID = 1293 ( currtid		   PGUID 12 f t f t 2 f 27 "26 27" 100 0 0 100  currtid_byreloid - ));
+DATA(insert OID = 1293 ( currtid		   PGUID 12 f t f t 2 f 27 "26 27" 100 0 0 100	currtid_byreloid - ));
 DESCR("latest tid of a tuple");
-DATA(insert OID = 1294 ( currtid2		   PGUID 12 f t f t 2 f 27 "25 27" 100 0 0 100  currtid_byrelname - ));
+DATA(insert OID = 1294 ( currtid2		   PGUID 12 f t f t 2 f 27 "25 27" 100 0 0 100	currtid_byrelname - ));
 DESCR("latest tid of a tuple");
 
 DATA(insert OID = 1296 (  timedate_pl	   PGUID 14 f t f t 2 f 1184 "1083 1082" 100 0 0 100	"select datetime_pl($2, $1)" - ));
@@ -1589,18 +1589,18 @@ DESCR("SQL92 interval comparison");
 DATA(insert OID = 1311 ( overlaps			 PGUID 14 f t t f 4 f 16 "1083 1186 1083 1083" 100 0 0 100	"select ($1, ($1 + $2)) overlaps ($3, $4)" - ));
 DESCR("SQL92 interval comparison");
 
-DATA(insert OID = 1314 (  timestamp_cmp		 PGUID 12 f t f t 2 f   23 "1184 1184" 100 0 0 100  timestamp_cmp - ));
+DATA(insert OID = 1314 (  timestamp_cmp		 PGUID 12 f t f t 2 f	23 "1184 1184" 100 0 0 100	timestamp_cmp - ));
 DESCR("less-equal-greater");
-DATA(insert OID = 1315 (  interval_cmp		 PGUID 12 f t f t 2 f   23 "1186 1186" 100 0 0 100  interval_cmp - ));
+DATA(insert OID = 1315 (  interval_cmp		 PGUID 12 f t f t 2 f	23 "1186 1186" 100 0 0 100	interval_cmp - ));
 DESCR("less-equal-greater");
 DATA(insert OID = 1316 (  time				 PGUID 12 f t f t 1 f 1083 "1184" 100 0 0 100  timestamp_time - ));
 DESCR("convert timestamp to time");
 
-DATA(insert OID = 1317 (  length			 PGUID 12 f t t t 1 f   23 "25" 100 0 0 100  textlen - ));
+DATA(insert OID = 1317 (  length			 PGUID 12 f t t t 1 f	23 "25" 100 0 0 100  textlen - ));
 DESCR("length");
-DATA(insert OID = 1318 (  length			 PGUID 12 f t t t 1 f   23 "1042" 100 0 0 100  bpcharlen - ));
+DATA(insert OID = 1318 (  length			 PGUID 12 f t t t 1 f	23 "1042" 100 0 0 100  bpcharlen - ));
 DESCR("character length");
-DATA(insert OID = 1319 (  length			 PGUID 12 f t t t 1 f   23 "1043" 100 0 0 100  varcharlen - ));
+DATA(insert OID = 1319 (  length			 PGUID 12 f t t t 1 f	23 "1043" 100 0 0 100  varcharlen - ));
 DESCR("character length");
 
 DATA(insert OID = 1326 (  interval_div		 PGUID 12 f t f t 2 f 1186 "1186 701" 100 0 0 100  interval_div - ));
@@ -1625,29 +1625,29 @@ DESCR("exponentiation");
 DATA(insert OID = 1347 (  exp				 PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dexp - ));
 DESCR("exponential");
 
-DATA(insert OID = 1348 (  obj_description	 PGUID 14 f t f t 1 f   25 "26" 100 0 0 100  "select description from pg_description where objoid = $1" - ));
+DATA(insert OID = 1348 (  obj_description	 PGUID 14 f t f t 1 f	25 "26" 100 0 0 100  "select description from pg_description where objoid = $1" - ));
 DESCR("get description for object id");
-DATA(insert OID = 1349 (  oidvectortypes	 PGUID 12 f t f t 1 f   25 "30" 100 0 0 100  oidvectortypes - ));
+DATA(insert OID = 1349 (  oidvectortypes	 PGUID 12 f t f t 1 f	25 "30" 100 0 0 100  oidvectortypes - ));
 DESCR("print type names of oidvector field");
 
 
 DATA(insert OID = 1350 (  timetz_in		   PGUID 12 f t f t 1 f 1266 "0" 100 0 0 100	timetz_in - ));
 DESCR("(internal)");
-DATA(insert OID = 1351 (  timetz_out	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  timetz_out - ));
+DATA(insert OID = 1351 (  timetz_out	   PGUID 12 f t f t 1 f 23 "0" 100 0 0 100	timetz_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1352 (  timetz_eq		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_eq - ));
+DATA(insert OID = 1352 (  timetz_eq		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_eq - ));
 DESCR("equal");
-DATA(insert OID = 1353 (  timetz_ne		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_ne - ));
+DATA(insert OID = 1353 (  timetz_ne		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_ne - ));
 DESCR("not equal");
-DATA(insert OID = 1354 (  timetz_lt		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_lt - ));
+DATA(insert OID = 1354 (  timetz_lt		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_lt - ));
 DESCR("less-than");
-DATA(insert OID = 1355 (  timetz_le		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_le - ));
+DATA(insert OID = 1355 (  timetz_le		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1356 (  timetz_ge		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_ge - ));
+DATA(insert OID = 1356 (  timetz_ge		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_ge - ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 1357 (  timetz_gt		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100  timetz_gt - ));
+DATA(insert OID = 1357 (  timetz_gt		   PGUID 12 f t t t 2 f 16 "1266 1266" 100 0 0 100	timetz_gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1358 (  timetz_cmp	   PGUID 12 f t t t 2 f 23 "1266 1266" 100 0 0 100  timetz_cmp - ));
+DATA(insert OID = 1358 (  timetz_cmp	   PGUID 12 f t t t 2 f 23 "1266 1266" 100 0 0 100	timetz_cmp - ));
 DESCR("less-equal-greater");
 DATA(insert OID = 1359 (  timestamp		   PGUID 12 f t f t 2 f 1184 "1082 1266" 100 0 0 100	datetimetz_timestamp - ));
 DESCR("convert date and time with time zone to timestamp");
@@ -1668,16 +1668,16 @@ DATA(insert OID = 1370 (  interval			 PGUID 12 f t f t 1 f 1186 "1083" 100 0 0 1
 DESCR("convert time to interval");
 DATA(insert OID = 1371 (  date				 PGUID 14 f t t t 1 f 1082 "1082" 100 0 0 100  "select $1" - ));
 DESCR("convert (noop)");
-DATA(insert OID = 1372 (  char_length		 PGUID 12 f t t t 1 f   23   "1042" 100 0 0 100  bpcharlen - ));
+DATA(insert OID = 1372 (  char_length		 PGUID 12 f t t t 1 f	23	 "1042" 100 0 0 100  bpcharlen - ));
 DESCR("character length");
-DATA(insert OID = 1373 (  char_length		 PGUID 12 f t t t 1 f   23   "1043" 100 0 0 100  varcharlen - ));
+DATA(insert OID = 1373 (  char_length		 PGUID 12 f t t t 1 f	23	 "1043" 100 0 0 100  varcharlen - ));
 DESCR("character length");
 
-DATA(insert OID = 1374 (  octet_length			 PGUID 12 f t t t 1 f   23   "25" 100 0 0 100  textoctetlen - ));
+DATA(insert OID = 1374 (  octet_length			 PGUID 12 f t t t 1 f	23	 "25" 100 0 0 100  textoctetlen - ));
 DESCR("octet length");
-DATA(insert OID = 1375 (  octet_length			 PGUID 12 f t t t 1 f   23   "1042" 100 0 0 100  bpcharoctetlen - ));
+DATA(insert OID = 1375 (  octet_length			 PGUID 12 f t t t 1 f	23	 "1042" 100 0 0 100  bpcharoctetlen - ));
 DESCR("octet length");
-DATA(insert OID = 1376 (  octet_length			 PGUID 12 f t t t 1 f   23   "1043" 100 0 0 100  varcharoctetlen - ));
+DATA(insert OID = 1376 (  octet_length			 PGUID 12 f t t t 1 f	23	 "1043" 100 0 0 100  varcharoctetlen - ));
 DESCR("octet length");
 
 DATA(insert OID = 1377 (  time_larger	   PGUID 12 f t t t 2 f 1083 "1083 1083" 100 0 0 100	time_larger - ));
@@ -1696,9 +1696,9 @@ DATA(insert OID = 1382 (  date_part    PGUID 14 f t f t 2 f  701 "25 702" 100 0
 DESCR("extract field from abstime");
 DATA(insert OID = 1383 (  date_part    PGUID 14 f t f t 2 f  701 "25 703" 100 0 0 100  "select date_part($1, interval($2))" - ));
 DESCR("extract field from reltime");
-DATA(insert OID = 1384 (  date_part    PGUID 14 f t f t 2 f  701 "25 1082" 100 0 0 100  "select date_part($1, timestamp($2))" - ));
+DATA(insert OID = 1384 (  date_part    PGUID 14 f t f t 2 f  701 "25 1082" 100 0 0 100	"select date_part($1, timestamp($2))" - ));
 DESCR("extract field from date");
-DATA(insert OID = 1385 (  date_part    PGUID 14 f t f t 2 f  701 "25 1083" 100 0 0 100  "select date_part($1, interval($2))" - ));
+DATA(insert OID = 1385 (  date_part    PGUID 14 f t f t 2 f  701 "25 1083" 100 0 0 100	"select date_part($1, interval($2))" - ));
 DESCR("extract field from time");
 DATA(insert OID = 1386 (  age		   PGUID 14 f t f t 1 f 1186 "1184" 100 0 0 100  "select age(\'today\', $1)" - ));
 DESCR("date difference from today preserving months and years");
@@ -1708,9 +1708,9 @@ DESCR("noop conversion");
 DATA(insert OID = 1388 (  timetz		   PGUID 12 f t f t 1 f 1266 "1184" 100 0 0 100  timestamp_timetz - ));
 DESCR("convert timestamp to timetz");
 
-DATA(insert OID = 1389 (  isfinite	   PGUID 12 f t f t 1 f	16 "1184" 100 0 0 100  timestamp_finite - ));
+DATA(insert OID = 1389 (  isfinite	   PGUID 12 f t f t 1 f 16 "1184" 100 0 0 100  timestamp_finite - ));
 DESCR("boolean test");
-DATA(insert OID = 1390 (  isfinite	   PGUID 12 f t f t 1 f	16 "1186" 100 0 0 100  interval_finite - ));
+DATA(insert OID = 1390 (  isfinite	   PGUID 12 f t f t 1 f 16 "1186" 100 0 0 100  interval_finite - ));
 DESCR("boolean test");
 
 
@@ -1733,18 +1733,18 @@ DESCR("absolute value");
 
 /* OIDS 1400 - 1499 */
 
-DATA(insert OID = 1400 (  name		   PGUID 12 f t t t 1 f	19 "1043" 100 0 0 100  text_name - ));
+DATA(insert OID = 1400 (  name		   PGUID 12 f t t t 1 f 19 "1043" 100 0 0 100  text_name - ));
 DESCR("convert varchar to name");
 DATA(insert OID = 1401 (  varchar	   PGUID 12 f t t t 1 f 1043 "19" 100 0 0 100  name_text - ));
 DESCR("convert name to varchar");
 
 DATA(insert OID = 1402 (  float4	   PGUID 14 f t t t 1 f  700	"700" 100 0 0 100  "select $1" - ));
 DESCR("convert float4 to float4 (no-op)");
-DATA(insert OID = 1403 (  int2		   PGUID 14 f t t t 1 f	21	 "21" 100 0 0 100  "select $1" - ));
+DATA(insert OID = 1403 (  int2		   PGUID 14 f t t t 1 f 21	 "21" 100 0 0 100  "select $1" - ));
 DESCR("convert (no-op)");
 DATA(insert OID = 1404 (  float8	   PGUID 14 f t t t 1 f  701	"701" 100 0 0 100  "select $1" - ));
 DESCR("convert (no-op)");
-DATA(insert OID = 1405 (  int4		   PGUID 14 f t t t 1 f	23	 "23" 100 0 0 100  "select $1" - ));
+DATA(insert OID = 1405 (  int4		   PGUID 14 f t t t 1 f 23	 "23" 100 0 0 100  "select $1" - ));
 DESCR("convert (no-op)");
 
 DATA(insert OID = 1406 (  isvertical		PGUID 12 f t t t 2 f	16 "600 600" 100 0 0 100	point_vert - ));
@@ -1778,15 +1778,15 @@ DESCR("bool is not false (ie, true or unknown)");
 DATA(insert OID = 1419 (  time				PGUID 12 f t f t 1 f 1083 "1186" 100 0 0 100  interval_time - ));
 DESCR("convert interval to time");
 
-DATA(insert OID = 1421 (  box				PGUID 12 f t t t 2 f 603 "600 600" 100 0 0 100  points_box - ));
+DATA(insert OID = 1421 (  box				PGUID 12 f t t t 2 f 603 "600 600" 100 0 0 100	points_box - ));
 DESCR("convert points to box");
-DATA(insert OID = 1422 (  box_add			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100  box_add - ));
+DATA(insert OID = 1422 (  box_add			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100	box_add - ));
 DESCR("add point to box (translate)");
-DATA(insert OID = 1423 (  box_sub			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100  box_sub - ));
+DATA(insert OID = 1423 (  box_sub			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100	box_sub - ));
 DESCR("subtract point from box (translate)");
-DATA(insert OID = 1424 (  box_mul			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100  box_mul - ));
+DATA(insert OID = 1424 (  box_mul			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100	box_mul - ));
 DESCR("multiply box by point (scale)");
-DATA(insert OID = 1425 (  box_div			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100  box_div - ));
+DATA(insert OID = 1425 (  box_div			PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100	box_div - ));
 DESCR("divide box by point (scale)");
 DATA(insert OID = 1426 (  path_contain_pt	PGUID 14 f t t t 2 f	16 "602 600" 100 0 0 100  "select on_ppath($2, $1)" - ));
 DESCR("path contains point?");
@@ -1806,41 +1806,41 @@ DESCR("# points in path");
  * - thomas 97/04/20
  */
 
-DATA(insert OID = 1433 (  pclose			PGUID 12 f t t t 1 f 602 "602" 100 0 0 100  path_close - ));
+DATA(insert OID = 1433 (  pclose			PGUID 12 f t t t 1 f 602 "602" 100 0 0 100	path_close - ));
 DESCR("close path");
-DATA(insert OID = 1434 (  popen				PGUID 12 f t t t 1 f 602 "602" 100 0 0 100  path_open - ));
+DATA(insert OID = 1434 (  popen				PGUID 12 f t t t 1 f 602 "602" 100 0 0 100	path_open - ));
 DESCR("open path");
-DATA(insert OID = 1435 (  path_add			PGUID 12 f t t t 2 f 602 "602 602" 100 0 0 100  path_add - ));
+DATA(insert OID = 1435 (  path_add			PGUID 12 f t t t 2 f 602 "602 602" 100 0 0 100	path_add - ));
 DESCR("concatenate open paths");
-DATA(insert OID = 1436 (  path_add_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100  path_add_pt - ));
+DATA(insert OID = 1436 (  path_add_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100	path_add_pt - ));
 DESCR("add (translate path)");
-DATA(insert OID = 1437 (  path_sub_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100  path_sub_pt - ));
+DATA(insert OID = 1437 (  path_sub_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100	path_sub_pt - ));
 DESCR("subtract (translate path)");
-DATA(insert OID = 1438 (  path_mul_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100  path_mul_pt - ));
+DATA(insert OID = 1438 (  path_mul_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100	path_mul_pt - ));
 DESCR("multiply (rotate/scale path)");
-DATA(insert OID = 1439 (  path_div_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100  path_div_pt - ));
+DATA(insert OID = 1439 (  path_div_pt		PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100	path_div_pt - ));
 DESCR("divide (rotate/scale path)");
 
-DATA(insert OID = 1440 (  point				PGUID 12 f t t t 2 f 600 "701 701" 100 0 0 100  construct_point - ));
+DATA(insert OID = 1440 (  point				PGUID 12 f t t t 2 f 600 "701 701" 100 0 0 100	construct_point - ));
 DESCR("convert x, y to point");
-DATA(insert OID = 1441 (  point_add			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100  point_add - ));
+DATA(insert OID = 1441 (  point_add			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100	point_add - ));
 DESCR("add points (translate)");
-DATA(insert OID = 1442 (  point_sub			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100  point_sub - ));
+DATA(insert OID = 1442 (  point_sub			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100	point_sub - ));
 DESCR("subtract points (translate)");
-DATA(insert OID = 1443 (  point_mul			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100  point_mul - ));
+DATA(insert OID = 1443 (  point_mul			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100	point_mul - ));
 DESCR("multiply points (scale/rotate)");
-DATA(insert OID = 1444 (  point_div			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100  point_div - ));
+DATA(insert OID = 1444 (  point_div			PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100	point_div - ));
 DESCR("divide points (scale/rotate)");
 
 DATA(insert OID = 1445 (  poly_npoints		PGUID 12 f t t t 1 f	23 "604" 100 0 0 100  poly_npoints - ));
 DESCR("number of points in polygon");
-DATA(insert OID = 1446 (  box				PGUID 12 f t t t 1 f 603 "604" 100 0 0 100  poly_box - ));
+DATA(insert OID = 1446 (  box				PGUID 12 f t t t 1 f 603 "604" 100 0 0 100	poly_box - ));
 DESCR("convert polygon to bounding box");
-DATA(insert OID = 1447 (  path				PGUID 12 f t t t 1 f 602 "604" 100 0 0 100  poly_path - ));
+DATA(insert OID = 1447 (  path				PGUID 12 f t t t 1 f 602 "604" 100 0 0 100	poly_path - ));
 DESCR("convert polygon to path");
-DATA(insert OID = 1448 (  polygon			PGUID 12 f t t t 1 f 604 "603" 100 0 0 100  box_poly - ));
+DATA(insert OID = 1448 (  polygon			PGUID 12 f t t t 1 f 604 "603" 100 0 0 100	box_poly - ));
 DESCR("convert box to polygon");
-DATA(insert OID = 1449 (  polygon			PGUID 12 f t t t 1 f 604 "602" 100 0 0 100  path_poly - ));
+DATA(insert OID = 1449 (  polygon			PGUID 12 f t t t 1 f 604 "602" 100 0 0 100	path_poly - ));
 DESCR("convert path to polygon");
 
 DATA(insert OID = 1450 (  circle_in			PGUID 12 f t t t 1 f 718 "0" 100 0 0 100  circle_in - ));
@@ -1920,20 +1920,20 @@ DATA(insert OID = 1486 (  lseg_ge			PGUID 12 f t t t 2 f	16 "601 601" 100 0 0 10
 DESCR("greater-than-or-equal by length");
 DATA(insert OID = 1487 (  lseg_length		PGUID 12 f t t t 1 f 701 "601" 100 0 0 100	lseg_length - ));
 DESCR("distance between endpoints");
-DATA(insert OID = 1488 (  close_ls			PGUID 12 f t t t 2 f 600 "628 601" 100 0 0 100  close_ls - ));
+DATA(insert OID = 1488 (  close_ls			PGUID 12 f t t t 2 f 600 "628 601" 100 0 0 100	close_ls - ));
 DESCR("closest point to line on line segment");
-DATA(insert OID = 1489 (  close_lseg		PGUID 12 f t t t 2 f 600 "601 601" 100 0 0 100  close_lseg - ));
+DATA(insert OID = 1489 (  close_lseg		PGUID 12 f t t t 2 f 600 "601 601" 100 0 0 100	close_lseg - ));
 DESCR("closest point to line segment on line segment");
 
 DATA(insert OID = 1490 (  line_in			PGUID 12 f t t t 1 f 628 "0" 100 0 0 100	line_in - ));
 DESCR("(internal)");
 DATA(insert OID = 1491 (  line_out			PGUID 12 f t t t 1 f 23  "628" 100 0 0 100	line_out - ));
 DESCR("(internal)");
-DATA(insert OID = 1492 (  line_eq			PGUID 12 f t t t 2 f  16 "628 628" 100 0 0 100  line_eq - ));
+DATA(insert OID = 1492 (  line_eq			PGUID 12 f t t t 2 f  16 "628 628" 100 0 0 100	line_eq - ));
 DESCR("lines equal?");
-DATA(insert OID = 1493 (  line				PGUID 12 f t t t 2 f 628 "600 600" 100 0 0 100  line_construct_pp - ));
+DATA(insert OID = 1493 (  line				PGUID 12 f t t t 2 f 628 "600 600" 100 0 0 100	line_construct_pp - ));
 DESCR("line from points");
-DATA(insert OID = 1494 (  line_interpt		PGUID 12 f t t t 2 f 600 "628 628" 100 0 0 100  line_interpt - ));
+DATA(insert OID = 1494 (  line_interpt		PGUID 12 f t t t 2 f 600 "628 628" 100 0 0 100	line_interpt - ));
 DESCR("intersection point");
 DATA(insert OID = 1495 (  line_intersect	PGUID 12 f t t t 2 f	16 "628 628" 100 0 0 100  line_intersect - ));
 DESCR("lines intersect?");
@@ -1954,21 +1954,21 @@ DATA(insert OID = 1531 (  length			PGUID 12 f t t t 1 f 701 "602" 100 0 0 100	pa
 DESCR("sum of path segments");
 
 
-DATA(insert OID = 1532 (  point				PGUID 12 f t t t 1 f 600 "601" 100 0 0 100  lseg_center - ));
+DATA(insert OID = 1532 (  point				PGUID 12 f t t t 1 f 600 "601" 100 0 0 100	lseg_center - ));
 DESCR("center of");
-DATA(insert OID = 1533 (  point				PGUID 12 f t t t 1 f 600 "602" 100 0 0 100  path_center - ));
+DATA(insert OID = 1533 (  point				PGUID 12 f t t t 1 f 600 "602" 100 0 0 100	path_center - ));
 DESCR("center of");
-DATA(insert OID = 1534 (  point				PGUID 12 f t t t 1 f 600 "603" 100 0 0 100  box_center - ));
+DATA(insert OID = 1534 (  point				PGUID 12 f t t t 1 f 600 "603" 100 0 0 100	box_center - ));
 DESCR("center of");
-DATA(insert OID = 1540 (  point				PGUID 12 f t t t 1 f 600 "604" 100 0 0 100  poly_center - ));
+DATA(insert OID = 1540 (  point				PGUID 12 f t t t 1 f 600 "604" 100 0 0 100	poly_center - ));
 DESCR("center of");
-DATA(insert OID = 1541 (  lseg				PGUID 12 f t t t 1 f 601 "603" 100 0 0 100  box_diagonal - ));
+DATA(insert OID = 1541 (  lseg				PGUID 12 f t t t 1 f 601 "603" 100 0 0 100	box_diagonal - ));
 DESCR("diagonal of");
-DATA(insert OID = 1542 (  center			PGUID 12 f t t t 1 f 600 "603" 100 0 0 100  box_center - ));
+DATA(insert OID = 1542 (  center			PGUID 12 f t t t 1 f 600 "603" 100 0 0 100	box_center - ));
 DESCR("center of");
 DATA(insert OID = 1543 (  center			PGUID 12 f t t t 1 f 600 "718" 100 0 0 100	circle_center - ));
 DESCR("center of");
-DATA(insert OID = 1544 (  polygon			PGUID 14 f t t t 1 f 604 "718" 100 0 0 100  "select polygon(12, $1)" - ));
+DATA(insert OID = 1544 (  polygon			PGUID 14 f t t t 1 f 604 "718" 100 0 0 100	"select polygon(12, $1)" - ));
 DESCR("convert circle to 12-vertex polygon");
 DATA(insert OID = 1545 (  npoints			PGUID 12 f t t t 1 f	23 "602" 100 0 0 100  path_npoints - ));
 DESCR("# points in path");
@@ -1999,7 +1999,7 @@ DATA(insert OID = 1575 (  currval			PGUID 12 f t f t 1 f 23 "25" 100 0 0 100	cur
 DESCR("sequence current value");
 DATA(insert OID = 1576 (  setval			PGUID 12 f t f t 2 f 23 "25 23" 100 0 0 100  setval - ));
 DESCR("set sequence value");
-DATA(insert OID = 1765 (  setval            PGUID 12 f t f t 3 f 23 "25 23 16" 100 0 0 100  setval_and_iscalled - ));
+DATA(insert OID = 1765 (  setval			PGUID 12 f t f t 3 f 23 "25 23 16" 100 0 0 100	setval_and_iscalled - ));
 DESCR("set sequence value and iscalled status");
 
 DATA(insert OID = 1579 (  varbit_in			PGUID 12 f t t t 1 f 1562 "0" 100 0 0 100  varbit_in - ));
@@ -2024,37 +2024,37 @@ DESCR("compare");
 
 DATA(insert OID = 1598 (  random			PGUID 12 f t f t 0 f 701 "0" 100 0 0 100	drandom - ));
 DESCR("random value");
-DATA(insert OID = 1599 (  setseed			PGUID 12 f t f t 1 f  23 "701" 100 0 0 100  setseed - ));
+DATA(insert OID = 1599 (  setseed			PGUID 12 f t f t 1 f  23 "701" 100 0 0 100	setseed - ));
 DESCR("set random seed");
 
 /* OIDS 1600 - 1699 */
 
-DATA(insert OID = 1600 (  asin				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dasin - ));
+DATA(insert OID = 1600 (  asin				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dasin - ));
 DESCR("arcsine");
-DATA(insert OID = 1601 (  acos				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dacos - ));
+DATA(insert OID = 1601 (  acos				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dacos - ));
 DESCR("arccosine");
-DATA(insert OID = 1602 (  atan				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  datan - ));
+DATA(insert OID = 1602 (  atan				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	datan - ));
 DESCR("arctangent");
-DATA(insert OID = 1603 (  atan2				PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100  datan2 - ));
+DATA(insert OID = 1603 (  atan2				PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100	datan2 - ));
 DESCR("arctangent, two arguments");
-DATA(insert OID = 1604 (  sin				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dsin - ));
+DATA(insert OID = 1604 (  sin				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dsin - ));
 DESCR("sine");
-DATA(insert OID = 1605 (  cos				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dcos - ));
+DATA(insert OID = 1605 (  cos				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dcos - ));
 DESCR("cosine");
-DATA(insert OID = 1606 (  tan				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dtan - ));
+DATA(insert OID = 1606 (  tan				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dtan - ));
 DESCR("tangent");
-DATA(insert OID = 1607 (  cot				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  dcot - ));
+DATA(insert OID = 1607 (  cot				PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	dcot - ));
 DESCR("cotangent");
-DATA(insert OID = 1608 (  degrees			PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  degrees - ));
+DATA(insert OID = 1608 (  degrees			PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	degrees - ));
 DESCR("radians to degrees");
-DATA(insert OID = 1609 (  radians			PGUID 12 f t t t 1 f 701 "701" 100 0 0 100  radians - ));
+DATA(insert OID = 1609 (  radians			PGUID 12 f t t t 1 f 701 "701" 100 0 0 100	radians - ));
 DESCR("degrees to radians");
 DATA(insert OID = 1610 (  pi				PGUID 12 f t t t 0 f 701 "0" 100 0 0 100	dpi - ));
 DESCR("PI");
 
 DATA(insert OID = 1618 (  interval_mul		PGUID 12 f t t t 2 f 1186 "1186 701" 100 0 0 100	interval_mul - ));
 DESCR("multiply interval");
-DATA(insert OID = 1619 (  varchar			PGUID 12 f t t t 1 f 1043 "23" 100 0 0 100  int4_text - ));
+DATA(insert OID = 1619 (  varchar			PGUID 12 f t t t 1 f 1043 "23" 100 0 0 100	int4_text - ));
 DESCR("convert int4 to varchar");
 
 DATA(insert OID = 1620 (  ascii				PGUID 12 f t t t 1 f 23 "25" 100 0 0 100	ascii - ));
@@ -2064,7 +2064,7 @@ DESCR("convert int4 to char");
 DATA(insert OID = 1622 (  repeat			PGUID 12 f t t t 2 f 25 "25 23" 100 0 0 100  repeat - ));
 DESCR("replicate string int4 times");
 
-DATA(insert OID = 1623 (  varchar			PGUID 12 f t t t 1 f 1043 "20" 100 0 0 100  int8_text - ));
+DATA(insert OID = 1623 (  varchar			PGUID 12 f t t t 1 f 1043 "20" 100 0 0 100	int8_text - ));
 DESCR("convert int8 to varchar");
 DATA(insert OID = 1624 (  mul_d_interval	PGUID 12 f t t t 2 f 1186 "701 1186" 100 0 0 100	mul_d_interval - ));
 
@@ -2079,11 +2079,11 @@ DESCR("does not match LIKE expression, case-insensitive");
 DATA(insert OID = 1637 (  like_escape		PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100 like_escape - ));
 DESCR("convert match pattern to use backslash escapes");
 
-DATA(insert OID = 1689 (  update_pg_pwd       PGUID 12 f t f t 0 f 0  ""  100 0 0 100  update_pg_pwd - ));
+DATA(insert OID = 1689 (  update_pg_pwd		  PGUID 12 f t f t 0 f 0  ""  100 0 0 100  update_pg_pwd - ));
 DESCR("update pg_pwd file");
 
 /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */
-DATA(insert OID =  868 (  strpos	   PGUID 12 f t t t 2 f 23 "25 25" 100 0 0 100  textpos - ));
+DATA(insert OID =  868 (  strpos	   PGUID 12 f t t t 2 f 23 "25 25" 100 0 0 100	textpos - ));
 DESCR("find position of substring");
 DATA(insert OID =  870 (  lower		   PGUID 12 f t t t 1 f 25 "25" 100 0 0 100  lower - ));
 DESCR("lowercase");
@@ -2095,36 +2095,36 @@ DATA(insert OID =  873 (  lpad		   PGUID 12 f t t t 3 f 25 "25 23 25" 100 0 0 10
 DESCR("left-pad string to length");
 DATA(insert OID =  874 (  rpad		   PGUID 12 f t t t 3 f 25 "25 23 25" 100 0 0 100  rpad - ));
 DESCR("right-pad string to length");
-DATA(insert OID =  875 (  ltrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100  ltrim - ));
+DATA(insert OID =  875 (  ltrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	ltrim - ));
 DESCR("left-pad string to length");
-DATA(insert OID =  876 (  rtrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100  rtrim - ));
+DATA(insert OID =  876 (  rtrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	rtrim - ));
 DESCR("right-pad string to length");
 DATA(insert OID =  877 (  substr	   PGUID 12 f t t t 3 f 25 "25 23 23" 100 0 0 100  text_substr - ));
 DESCR("return portion of string");
 DATA(insert OID =  878 (  translate    PGUID 12 f t t t 3 f 25 "25 25 25" 100 0 0 100  translate - ));
 DESCR("modify string by substring replacement");
-DATA(insert OID =  879 (  lpad		   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100  "select lpad($1, $2, \' \')" - ));
+DATA(insert OID =  879 (  lpad		   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100	"select lpad($1, $2, \' \')" - ));
 DESCR("left-pad string to length");
-DATA(insert OID =  880 (  rpad		   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100  "select rpad($1, $2, \' \')" - ));
+DATA(insert OID =  880 (  rpad		   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100	"select rpad($1, $2, \' \')" - ));
 DESCR("right-pad string to length");
 DATA(insert OID =  881 (  ltrim		   PGUID 14 f t t t 1 f 25 "25" 100 0 0 100  "select ltrim($1, \' \')" - ));
 DESCR("remove initial characters from string");
 DATA(insert OID =  882 (  rtrim		   PGUID 14 f t t t 1 f 25 "25" 100 0 0 100  "select rtrim($1, \' \')" - ));
 DESCR("remove trailing characters from string");
-DATA(insert OID =  883 (  substr	   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100  "select substr($1, $2, -1)" - ));
+DATA(insert OID =  883 (  substr	   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100	"select substr($1, $2, -1)" - ));
 DESCR("return portion of string");
-DATA(insert OID =  884 (  btrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100  btrim - ));
+DATA(insert OID =  884 (  btrim		   PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100	btrim - ));
 DESCR("trim both ends of string");
 DATA(insert OID =  885 (  btrim		   PGUID 14 f t t t 1 f 25 "25" 100 0 0 100  "select btrim($1, \' \')" - ));
 DESCR("trim both ends of string");
 
-DATA(insert OID =  936 (  substring	   PGUID 12 f t t t 3 f 25 "25 23 23" 100 0 0 100  text_substr - ));
+DATA(insert OID =  936 (  substring    PGUID 12 f t t t 3 f 25 "25 23 23" 100 0 0 100  text_substr - ));
 DESCR("return portion of string");
-DATA(insert OID =  937 (  substring	   PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100  "select substring($1, $2, -1)" - ));
+DATA(insert OID =  937 (  substring    PGUID 14 f t t t 2 f 25 "25 23" 100 0 0 100	"select substring($1, $2, -1)" - ));
 DESCR("return portion of string");
 
 /* for multi-byte support */
-DATA(insert OID = 1039 (  getdatabaseencoding	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100  getdatabaseencoding - ));
+DATA(insert OID = 1039 (  getdatabaseencoding	   PGUID 12 f t f t 0 f 19 "0" 100 0 0 100	getdatabaseencoding - ));
 DESCR("encoding name of current database");
 
 DATA(insert OID = 1295 (  pg_char_to_encoding	   PGUID 12 f t f t 1 f 23 "19" 100 0 0 100  PG_char_to_encoding - ));
@@ -2133,9 +2133,9 @@ DESCR("convert encoding name to encoding id");
 DATA(insert OID = 1597 (  pg_encoding_to_char	   PGUID 12 f t f t 1 f 19 "23" 100 0 0 100  PG_encoding_to_char - ));
 DESCR("convert encoding id to encoding name");
 
-DATA(insert OID = 1638 (  oidgt				   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oidgt - ));
+DATA(insert OID = 1638 (  oidgt				   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oidgt - ));
 DESCR("greater-than");
-DATA(insert OID = 1639 (  oidge				   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100  oidge - ));
+DATA(insert OID = 1639 (  oidge				   PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100	oidge - ));
 DESCR("greater-than-or-equal");
 
 /* System-view support functions */
@@ -2165,9 +2165,9 @@ DATA(insert OID = 1650 (  RI_FKey_setnull_del	PGUID 12 f t f t 0 f 0 "" 100 0 0
 DESCR("referential integrity ON DELETE SET NULL");
 DATA(insert OID = 1651 (  RI_FKey_setnull_upd	PGUID 12 f t f t 0 f 0 "" 100 0 0 100  RI_FKey_setnull_upd - ));
 DESCR("referential integrity ON UPDATE SET NULL");
-DATA(insert OID = 1652 (  RI_FKey_setdefault_del PGUID 12 f t f t 0 f 0 "" 100 0 0 100  RI_FKey_setdefault_del - ));
+DATA(insert OID = 1652 (  RI_FKey_setdefault_del PGUID 12 f t f t 0 f 0 "" 100 0 0 100	RI_FKey_setdefault_del - ));
 DESCR("referential integrity ON DELETE SET DEFAULT");
-DATA(insert OID = 1653 (  RI_FKey_setdefault_upd PGUID 12 f t f t 0 f 0 "" 100 0 0 100  RI_FKey_setdefault_upd - ));
+DATA(insert OID = 1653 (  RI_FKey_setdefault_upd PGUID 12 f t f t 0 f 0 "" 100 0 0 100	RI_FKey_setdefault_upd - ));
 DESCR("referential integrity ON UPDATE SET DEFAULT");
 DATA(insert OID = 1654 (  RI_FKey_noaction_del PGUID 12 f t f t 0 f 0 "" 100 0 0 100	RI_FKey_noaction_del - ));
 DESCR("referential integrity ON DELETE NO ACTION");
@@ -2203,24 +2203,24 @@ DATA(insert OID = 1678 (  bitshiftright		PGUID 12 f t t t 2 f 1560 "1560 23" 100
 DESCR("bitwise right shift");
 DATA(insert OID = 1679 (  bitcat			PGUID 12 f t t t 2 f 1560 "1560 1560" 100 0 0 100  bitcat - ));
 DESCR("bitwise concatenation");
-DATA(insert OID = 1680 (  substring			PGUID 12 f t t t 3 f 1560 "1560 23 23" 100 0 0 100  bitsubstr - ));
+DATA(insert OID = 1680 (  substring			PGUID 12 f t t t 3 f 1560 "1560 23 23" 100 0 0 100	bitsubstr - ));
 DESCR("return portion of bitstring");
-DATA(insert OID = 1681 (  length			PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100  bitlength - ));
+DATA(insert OID = 1681 (  length			PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100	bitlength - ));
 DESCR("bitstring length");
-DATA(insert OID = 1682 (  octet_length		PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100  bitoctetlength - ));
+DATA(insert OID = 1682 (  octet_length		PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100	bitoctetlength - ));
 DESCR("octet length");
-DATA(insert OID = 1683 (  bitfromint4		PGUID 12 f t t t 1 f 1560 "23" 100 0 0 100  bitfromint4 - ));
+DATA(insert OID = 1683 (  bitfromint4		PGUID 12 f t t t 1 f 1560 "23" 100 0 0 100	bitfromint4 - ));
 DESCR("int4 to bitstring");
-DATA(insert OID = 1684 (  bittoint4			PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100  bittoint4 - ));
+DATA(insert OID = 1684 (  bittoint4			PGUID 12 f t t t 1 f 23 "1560" 100 0 0 100	bittoint4 - ));
 DESCR("bitstring to int4");
 
-DATA(insert OID = 1685 (  bit			   PGUID 12 f t t t 2 f 1560 "1560 23" 100 0 0 100  zpbit - ));
+DATA(insert OID = 1685 (  bit			   PGUID 12 f t t t 2 f 1560 "1560 23" 100 0 0 100	zpbit - ));
 DESCR("adjust bit() to typmod length");
-DATA(insert OID = 1686 (  _bit			   PGUID 12 f t t t 2 f 1561 "1561 23" 100 0 0 100  _zpbit - ));
+DATA(insert OID = 1686 (  _bit			   PGUID 12 f t t t 2 f 1561 "1561 23" 100 0 0 100	_zpbit - ));
 DESCR("adjust bit()[] to typmod length");
-DATA(insert OID = 1687 (  varbit		   PGUID 12 f t t t 2 f 1562 "1562 23" 100 0 0 100  varbit - ));
+DATA(insert OID = 1687 (  varbit		   PGUID 12 f t t t 2 f 1562 "1562 23" 100 0 0 100	varbit - ));
 DESCR("adjust varbit() to typmod length");
-DATA(insert OID = 1688 (  _varbit		   PGUID 12 f t t t 2 f 1563 "1563 23" 100 0 0 100  _varbit - ));
+DATA(insert OID = 1688 (  _varbit		   PGUID 12 f t t t 2 f 1563 "1563 23" 100 0 0 100	_varbit - ));
 DESCR("adjust varbit()[] to typmod length");
 
 DATA(insert OID = 1698 (  position		   PGUID 12 f t t t 2 f 23 "1560 1560" 100 0 0 100 bitposition - ));
@@ -2296,13 +2296,13 @@ DESCR("is-supernet-or-equal");
 /* inet/cidr functions */
 DATA(insert OID = 605 (  abbrev				PGUID 12 f t t t 1 f 25 "869" 100 0 0 100  network_abbrev - ));
 DESCR("abbreviated display of inet/cidr value");
-DATA(insert OID = 683 (  network			PGUID 12 f t t t 1 f 650 "869" 100 0 0 100  network_network - ));
+DATA(insert OID = 683 (  network			PGUID 12 f t t t 1 f 650 "869" 100 0 0 100	network_network - ));
 DESCR("network part of address");
-DATA(insert OID = 696 (  netmask			PGUID 12 f t t t 1 f 869 "869" 100 0 0 100  network_netmask - ));
+DATA(insert OID = 696 (  netmask			PGUID 12 f t t t 1 f 869 "869" 100 0 0 100	network_netmask - ));
 DESCR("netmask of address");
 DATA(insert OID = 697 (  masklen			PGUID 12 f t t t 1 f 23 "869" 100 0 0 100  network_masklen - ));
 DESCR("netmask length");
-DATA(insert OID = 698 (  broadcast			PGUID 12 f t t t 1 f 869 "869" 100 0 0 100  network_broadcast - ));
+DATA(insert OID = 698 (  broadcast			PGUID 12 f t t t 1 f 869 "869" 100 0 0 100	network_broadcast - ));
 DESCR("broadcast address of network");
 DATA(insert OID = 699 (  host				PGUID 12 f t t t 1 f 25 "869" 100 0 0 100  network_host - ));
 DESCR("show address octets only");
@@ -2316,9 +2316,9 @@ DESCR("greater-than-or-equal");
 DATA(insert OID = 1693 (  btboolcmp			PGUID 12 f t t t 2 f 23 "16 16" 100 0 0 100  btboolcmp - ));
 DESCR("btree less-equal-greater");
 
-DATA(insert OID = 1696 (  timetz_hash		PGUID 12 f t t t 1 f 23 "1266" 100 0 0 100  timetz_hash - ));
+DATA(insert OID = 1696 (  timetz_hash		PGUID 12 f t t t 1 f 23 "1266" 100 0 0 100	timetz_hash - ));
 DESCR("hash");
-DATA(insert OID = 1697 (  interval_hash		PGUID 12 f t t t 1 f 23 "1186" 100 0 0 100  interval_hash - ));
+DATA(insert OID = 1697 (  interval_hash		PGUID 12 f t t t 1 f 23 "1186" 100 0 0 100	interval_hash - ));
 DESCR("hash");
 
 
@@ -2391,7 +2391,7 @@ DATA(insert OID = 1738 ( pow					PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 1
 DESCR("m raised to the power of n");
 DATA(insert OID = 1739 ( numeric_power			PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100  numeric_power - ));
 DESCR("m raised to the power of n");
-DATA(insert OID = 1740 ( numeric				PGUID 12 f t t t 1 f 1700 "23" 100 0 0 100  int4_numeric - ));
+DATA(insert OID = 1740 ( numeric				PGUID 12 f t t t 1 f 1700 "23" 100 0 0 100	int4_numeric - ));
 DESCR("(internal)");
 DATA(insert OID = 1741 ( log					PGUID 14 f t t t 1 f 1700 "1700" 100 0 0 100	"select log(10, $1)" - ));
 DESCR("logarithm base 10 of n");
@@ -2399,7 +2399,7 @@ DATA(insert OID = 1742 ( numeric				PGUID 12 f t t t 1 f 1700 "700" 100 0 0 100
 DESCR("(internal)");
 DATA(insert OID = 1743 ( numeric				PGUID 12 f t t t 1 f 1700 "701" 100 0 0 100  float8_numeric - ));
 DESCR("(internal)");
-DATA(insert OID = 1744 ( int4					PGUID 12 f t t t 1 f 23 "1700" 100 0 0 100  numeric_int4 - ));
+DATA(insert OID = 1744 ( int4					PGUID 12 f t t t 1 f 23 "1700" 100 0 0 100	numeric_int4 - ));
 DESCR("(internal)");
 DATA(insert OID = 1745 ( float4					PGUID 12 f t t t 1 f 700 "1700" 100 0 0 100  numeric_float4 - ));
 DESCR("(internal)");
@@ -2425,13 +2425,13 @@ DATA(insert OID = 1769 ( numeric_cmp			PGUID 12 f t t t 2 f 23 "1700 1700" 100 0
 DESCR("compare two numbers");
 DATA(insert OID = 1771 ( numeric_uminus			PGUID 12 f t t t 1 f 1700 "1700" 100 0 0 100	numeric_uminus - ));
 DESCR("negate");
-DATA(insert OID = 1779 ( int8					PGUID 12 f t t t 1 f 20 "1700" 100 0 0 100  numeric_int8 - ));
+DATA(insert OID = 1779 ( int8					PGUID 12 f t t t 1 f 20 "1700" 100 0 0 100	numeric_int8 - ));
 DESCR("(internal)");
-DATA(insert OID = 1781 ( numeric				PGUID 12 f t t t 1 f 1700 "20" 100 0 0 100  int8_numeric - ));
+DATA(insert OID = 1781 ( numeric				PGUID 12 f t t t 1 f 1700 "20" 100 0 0 100	int8_numeric - ));
 DESCR("(internal)");
-DATA(insert OID = 1782 ( numeric				PGUID 12 f t t t 1 f 1700 "21" 100 0 0 100  int2_numeric - ));
+DATA(insert OID = 1782 ( numeric				PGUID 12 f t t t 1 f 1700 "21" 100 0 0 100	int2_numeric - ));
 DESCR("(internal)");
-DATA(insert OID = 1783 ( int2					PGUID 12 f t t t 1 f 21 "1700" 100 0 0 100  numeric_int2 - ));
+DATA(insert OID = 1783 ( int2					PGUID 12 f t t t 1 f 21 "1700" 100 0 0 100	numeric_int2 - ));
 DESCR("(internal)");
 
 /* formatting */
@@ -2456,12 +2456,12 @@ DESCR("convert text to date");
 
 DATA(insert OID =  1282 ( quote_ident	   PGUID 12 f t t t 1 f 25 "25" 100 0 0 100 quote_ident - ));
 DESCR("quote an identifier for usage in a querystring");
-DATA(insert OID =  1283 ( quote_literal	   PGUID 12 f t t t 1 f 25 "25" 100 0 0 100 quote_literal - ));
+DATA(insert OID =  1283 ( quote_literal    PGUID 12 f t t t 1 f 25 "25" 100 0 0 100 quote_literal - ));
 DESCR("quote a literal for usage in a querystring");
 
-DATA(insert OID = 1798 (  oidin			   PGUID 12 f t t t 1 f 26 "0" 100 0 0 100  oidin - ));
+DATA(insert OID = 1798 (  oidin			   PGUID 12 f t t t 1 f 26 "0" 100 0 0 100	oidin - ));
 DESCR("(internal)");
-DATA(insert OID = 1799 (  oidout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  oidout - ));
+DATA(insert OID = 1799 (  oidout		   PGUID 12 f t t t 1 f 23 "0" 100 0 0 100	oidout - ));
 DESCR("(internal)");
 
 /* Selectivity estimators for LIKE and related operators */
@@ -2499,19 +2499,19 @@ DATA(insert OID = 1829 ( icregexnejoinsel	PGUID 12 f t f t 5 f 701 "26 26 21 26
 DESCR("join selectivity of case-insensitive regex non-match");
 
 /* Aggregate-related functions */
-DATA(insert OID = 1830 (  float8_avg	   PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100  float8_avg - ));
+DATA(insert OID = 1830 (  float8_avg	   PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100	float8_avg - ));
 DESCR("AVG aggregate final function");
-DATA(insert OID = 1831 (  float8_variance  PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100  float8_variance - ));
+DATA(insert OID = 1831 (  float8_variance  PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100	float8_variance - ));
 DESCR("VARIANCE aggregate final function");
-DATA(insert OID = 1832 (  float8_stddev	   PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100  float8_stddev - ));
+DATA(insert OID = 1832 (  float8_stddev    PGUID 12 f t t t 1 f 701 "1022" 100 0 0 100	float8_stddev - ));
 DESCR("STDDEV aggregate final function");
-DATA(insert OID = 1833 (  numeric_accum	   PGUID 12 f t t t 2 f 1231 "1231 1700" 100 0 0 100  numeric_accum - ));
+DATA(insert OID = 1833 (  numeric_accum    PGUID 12 f t t t 2 f 1231 "1231 1700" 100 0 0 100  numeric_accum - ));
 DESCR("aggregate transition function");
-DATA(insert OID = 1834 (  int2_accum	   PGUID 12 f t t t 2 f 1231 "1231 21" 100 0 0 100  int2_accum - ));
+DATA(insert OID = 1834 (  int2_accum	   PGUID 12 f t t t 2 f 1231 "1231 21" 100 0 0 100	int2_accum - ));
 DESCR("aggregate transition function");
-DATA(insert OID = 1835 (  int4_accum	   PGUID 12 f t t t 2 f 1231 "1231 23" 100 0 0 100  int4_accum - ));
+DATA(insert OID = 1835 (  int4_accum	   PGUID 12 f t t t 2 f 1231 "1231 23" 100 0 0 100	int4_accum - ));
 DESCR("aggregate transition function");
-DATA(insert OID = 1836 (  int8_accum	   PGUID 12 f t t t 2 f 1231 "1231 20" 100 0 0 100  int8_accum - ));
+DATA(insert OID = 1836 (  int8_accum	   PGUID 12 f t t t 2 f 1231 "1231 20" 100 0 0 100	int8_accum - ));
 DESCR("aggregate transition function");
 DATA(insert OID = 1837 (  numeric_avg	   PGUID 12 f t t t 1 f 1700 "1231" 100 0 0 100  numeric_avg - ));
 DESCR("AVG aggregate final function");
@@ -2519,91 +2519,91 @@ DATA(insert OID = 1838 (  numeric_variance PGUID 12 f t t t 1 f 1700 "1231" 100
 DESCR("VARIANCE aggregate final function");
 DATA(insert OID = 1839 (  numeric_stddev   PGUID 12 f t t t 1 f 1700 "1231" 100 0 0 100  numeric_stddev - ));
 DESCR("STDDEV aggregate final function");
-DATA(insert OID = 1840 (  int2_sum		   PGUID 12 f t t f 2 f 1700 "1700 21" 100 0 0 100  int2_sum - ));
+DATA(insert OID = 1840 (  int2_sum		   PGUID 12 f t t f 2 f 1700 "1700 21" 100 0 0 100	int2_sum - ));
 DESCR("SUM(int2) transition function");
-DATA(insert OID = 1841 (  int4_sum		   PGUID 12 f t t f 2 f 1700 "1700 23" 100 0 0 100  int4_sum - ));
+DATA(insert OID = 1841 (  int4_sum		   PGUID 12 f t t f 2 f 1700 "1700 23" 100 0 0 100	int4_sum - ));
 DESCR("SUM(int4) transition function");
-DATA(insert OID = 1842 (  int8_sum		   PGUID 12 f t t f 2 f 1700 "1700 20" 100 0 0 100  int8_sum - ));
+DATA(insert OID = 1842 (  int8_sum		   PGUID 12 f t t f 2 f 1700 "1700 20" 100 0 0 100	int8_sum - ));
 DESCR("SUM(int8) transition function");
 DATA(insert OID = 1843 (  interval_accum   PGUID 12 f t t t 2 f 1187 "1187 1186" 100 0 0 100  interval_accum - ));
 DESCR("aggregate transition function");
 DATA(insert OID = 1844 (  interval_avg	   PGUID 12 f t t t 1 f 1186 "1187" 100 0 0 100  interval_avg - ));
 DESCR("AVG aggregate final function");
 
-/* To ASCII conversion */ 
+/* To ASCII conversion */
 DATA(insert OID = 1845 ( to_ascii	PGUID 12 f t t t 1 f	25 "25" 100 0 0 100  to_ascii_default - ));
 DESCR("encode text from DB encoding to ASCII text");
-DATA(insert OID = 1846 ( to_ascii	PGUID 12 f t t t 2 f	25 "25 23" 100 0 0 100  to_ascii_enc - ));
+DATA(insert OID = 1846 ( to_ascii	PGUID 12 f t t t 2 f	25 "25 23" 100 0 0 100	to_ascii_enc - ));
 DESCR("encode text from encoding to ASCII text");
-DATA(insert OID = 1847 ( to_ascii	PGUID 12 f t t t 2 f	25 "25 19" 100 0 0 100  to_ascii_encname - ));
+DATA(insert OID = 1847 ( to_ascii	PGUID 12 f t t t 2 f	25 "25 19" 100 0 0 100	to_ascii_encname - ));
 DESCR("encode text from encoding to ASCII text");
 
 DATA(insert OID = 1848 ( interval_pl_time		PGUID 12 f t t t 2 f 1083 "1186 1083" 100 0 0 100  interval_pl_time - ));
 DESCR("plus");
 
-DATA(insert OID = 1850 (  int28eq		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28eq - ));
+DATA(insert OID = 1850 (  int28eq		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28eq - ));
 DESCR("equal");
-DATA(insert OID = 1851 (  int28ne		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28ne - ));
+DATA(insert OID = 1851 (  int28ne		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28ne - ));
 DESCR("not equal");
-DATA(insert OID = 1852 (  int28lt		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28lt - ));
+DATA(insert OID = 1852 (  int28lt		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28lt - ));
 DESCR("less-than");
-DATA(insert OID = 1853 (  int28gt		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28gt - ));
+DATA(insert OID = 1853 (  int28gt		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1854 (  int28le		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28le - ));
+DATA(insert OID = 1854 (  int28le		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1855 (  int28ge		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100  int28ge - ));
+DATA(insert OID = 1855 (  int28ge		   PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100	int28ge - ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 1856 (  int82eq		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82eq - ));
+DATA(insert OID = 1856 (  int82eq		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82eq - ));
 DESCR("equal");
-DATA(insert OID = 1857 (  int82ne		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82ne - ));
+DATA(insert OID = 1857 (  int82ne		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82ne - ));
 DESCR("not equal");
-DATA(insert OID = 1858 (  int82lt		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82lt - ));
+DATA(insert OID = 1858 (  int82lt		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82lt - ));
 DESCR("less-than");
-DATA(insert OID = 1859 (  int82gt		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82gt - ));
+DATA(insert OID = 1859 (  int82gt		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82gt - ));
 DESCR("greater-than");
-DATA(insert OID = 1860 (  int82le		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82le - ));
+DATA(insert OID = 1860 (  int82le		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82le - ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 1861 (  int82ge		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100  int82ge - ));
+DATA(insert OID = 1861 (  int82ge		   PGUID 12 f t t t 2 f 16 "20 21" 100 0 0 100	int82ge - ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 1892 (  int2and		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2and - ));
+DATA(insert OID = 1892 (  int2and		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2and - ));
 DESCR("binary and");
-DATA(insert OID = 1893 (  int2or		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2or - ));
+DATA(insert OID = 1893 (  int2or		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2or - ));
 DESCR("binary or");
-DATA(insert OID = 1894 (  int2xor		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100  int2xor - ));
+DATA(insert OID = 1894 (  int2xor		   PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100	int2xor - ));
 DESCR("binary xor");
 DATA(insert OID = 1895 (  int2not		   PGUID 12 f t t t 1 f 21 "21" 100 0 0 100  int2not - ));
 DESCR("binary not");
-DATA(insert OID = 1896 (  int2shl		   PGUID 12 f t t t 2 f 21 "21 23" 100 0 0 100  int2shl - ));
+DATA(insert OID = 1896 (  int2shl		   PGUID 12 f t t t 2 f 21 "21 23" 100 0 0 100	int2shl - ));
 DESCR("binary shift left");
-DATA(insert OID = 1897 (  int2shr		   PGUID 12 f t t t 2 f 21 "21 23" 100 0 0 100  int2shr - ));
+DATA(insert OID = 1897 (  int2shr		   PGUID 12 f t t t 2 f 21 "21 23" 100 0 0 100	int2shr - ));
 DESCR("binary shift right");
 
-DATA(insert OID = 1898 (  int4and		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4and - ));
+DATA(insert OID = 1898 (  int4and		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4and - ));
 DESCR("binary and");
-DATA(insert OID = 1899 (  int4or		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4or - ));
+DATA(insert OID = 1899 (  int4or		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4or - ));
 DESCR("binary or");
-DATA(insert OID = 1900 (  int4xor		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4xor - ));
+DATA(insert OID = 1900 (  int4xor		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4xor - ));
 DESCR("binary xor");
 DATA(insert OID = 1901 (  int4not		   PGUID 12 f t t t 1 f 23 "23" 100 0 0 100  int4not - ));
 DESCR("binary not");
-DATA(insert OID = 1902 (  int4shl		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4shl - ));
+DATA(insert OID = 1902 (  int4shl		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4shl - ));
 DESCR("binary shift left");
-DATA(insert OID = 1903 (  int4shr		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100  int4shr - ));
+DATA(insert OID = 1903 (  int4shr		   PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100	int4shr - ));
 DESCR("binary shift right");
 
-DATA(insert OID = 1904 (  int8and		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8and - ));
+DATA(insert OID = 1904 (  int8and		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8and - ));
 DESCR("binary and");
-DATA(insert OID = 1905 (  int8or		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8or - ));
+DATA(insert OID = 1905 (  int8or		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8or - ));
 DESCR("binary or");
-DATA(insert OID = 1906 (  int8xor		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100  int8xor - ));
+DATA(insert OID = 1906 (  int8xor		   PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100	int8xor - ));
 DESCR("binary xor");
 DATA(insert OID = 1907 (  int8not		   PGUID 12 f t t t 1 f 20 "20" 100 0 0 100  int8not - ));
 DESCR("binary not");
-DATA(insert OID = 1908 (  int8shl		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int8shl - ));
+DATA(insert OID = 1908 (  int8shl		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int8shl - ));
 DESCR("binary shift left");
-DATA(insert OID = 1909 (  int8shr		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100  int8shr - ));
+DATA(insert OID = 1909 (  int8shr		   PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100	int8shr - ));
 DESCR("binary shift right");
 
 /*
diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h
index 5b3ade6146917c9d1655c4a0d3a7d3ab60d8910d..d9df02ec97acf6e23e98d215c3d60f5d4d7db77a 100644
--- a/src/include/catalog/pg_rewrite.h
+++ b/src/include/catalog/pg_rewrite.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_rewrite.h,v 1.13 2001/01/24 19:43:22 momjian Exp $
+ * $Id: pg_rewrite.h,v 1.14 2001/03/22 04:00:40 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -38,6 +38,7 @@ CATALOG(pg_rewrite)
 	Oid			ev_class;
 	int2		ev_attr;
 	bool		is_instead;
+
 	/* NB: remaining fields must be accessed via heap_getattr */
 	text		ev_qual;
 	text		ev_action;
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index e429047542f2208c5559fedce1505f720dc3e146..7dc1f0620e291959372123faabc6dea272b2c956 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.101 2001/02/12 20:07:20 tgl Exp $
+ * $Id: pg_type.h,v 1.102 2001/03/22 04:00:41 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -51,11 +51,11 @@ CATALOG(pg_type) BOOTSTRAP
 
 	/*
 	 * typbyval determines whether internal Postgres routines pass a value
-	 * of this type by value or by reference.  typbyval had better be FALSE
-	 * if the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines).
-	 * Variable-length types are always passed by reference. Note that
-	 * typbyval can be false even if the length would allow pass-by-value;
-	 * this is currently true for type float4, for example.
+	 * of this type by value or by reference.  typbyval had better be
+	 * FALSE if the length is not 1, 2, or 4 (or 8 on 8-byte-Datum
+	 * machines). Variable-length types are always passed by reference.
+	 * Note that typbyval can be false even if the length would allow
+	 * pass-by-value; this is currently true for type float4, for example.
 	 */
 	bool		typbyval;
 
@@ -71,14 +71,14 @@ CATALOG(pg_type) BOOTSTRAP
 	Oid			typrelid;		/* 0 if not a class type */
 
 	/*
-	 * If typelem is not 0 then it identifies another row in pg_type.
-	 * The current type can then be subscripted like an array yielding
-	 * values of type typelem. A non-zero typelem does not guarantee
-	 * this type to be a "real" array type; some ordinary fixed-length
-	 * types can also be subscripted (e.g., oidvector). Variable-length
-	 * types can *not* be turned into pseudo-arrays like that. Hence,
-	 * the way to determine whether a type is a "true" array type is
-	 * typelem != 0 and typlen < 0.
+	 * If typelem is not 0 then it identifies another row in pg_type. The
+	 * current type can then be subscripted like an array yielding values
+	 * of type typelem. A non-zero typelem does not guarantee this type to
+	 * be a "real" array type; some ordinary fixed-length types can also
+	 * be subscripted (e.g., oidvector). Variable-length types can *not*
+	 * be turned into pseudo-arrays like that. Hence, the way to determine
+	 * whether a type is a "true" array type is typelem != 0 and typlen <
+	 * 0.
 	 */
 	Oid			typelem;
 	regproc		typinput;
@@ -114,10 +114,10 @@ CATALOG(pg_type) BOOTSTRAP
 	 * typstorage tells if the type is prepared for toasting and what
 	 * the default strategy for attributes of this type should be.
 	 *
-	 * 'p' PLAIN      type not prepared for toasting
+	 * 'p' PLAIN	  type not prepared for toasting
 	 * 'e' EXTERNAL   external storage possible, don't try to compress
 	 * 'x' EXTENDED   try to compress and store external if required
-	 * 'm' MAIN       like 'x' but try to keep in main tuple
+	 * 'm' MAIN		  like 'x' but try to keep in main tuple
 	 * ----------------
 	 */
 	char		typstorage;
diff --git a/src/include/commands/command.h b/src/include/commands/command.h
index 3e3f675c0f7e485c87bf934772f7014b412f6659..8b108451d2accff7969f55e6972ad389551829a1 100644
--- a/src/include/commands/command.h
+++ b/src/include/commands/command.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: command.h,v 1.25 2001/01/24 19:43:23 momjian Exp $
+ * $Id: command.h,v 1.26 2001/03/22 04:00:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -59,7 +59,7 @@ extern void AlterTableDropConstraint(const char *relationName,
 						 int behavior);
 
 extern void AlterTableCreateToastTable(const char *relationName,
-                         bool silent);
+						   bool silent);
 
 extern void AlterTableOwner(const char *relationName, const char *newOwnerName);
 
diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h
index 1514412969a85bd360fdb4b01f44533829e7f1ae..7d9b279c814c12d43544d99e7c6866310a6edf95 100644
--- a/src/include/commands/comment.h
+++ b/src/include/commands/comment.h
@@ -25,8 +25,8 @@
  *------------------------------------------------------------------
  */
 
-extern void	DeleteComments(Oid oid);
+extern void DeleteComments(Oid oid);
 extern void CommentObject(int objtype, char *objname, char *objproperty,
-				List *objlist, char *comment);
+			  List *objlist, char *comment);
 
 #endif	 /* COMMENT_H */
diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h
index 1e8302a1ec4873a2b79cd4d993052f9977762d24..39f5b3da595647a098ad3b7a10b0eba376c1e0f8 100644
--- a/src/include/commands/dbcommands.h
+++ b/src/include/commands/dbcommands.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dbcommands.h,v 1.15 2001/01/24 19:43:23 momjian Exp $
+ * $Id: dbcommands.h,v 1.16 2001/03/22 04:00:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,7 +15,7 @@
 #define DBCOMMANDS_H
 
 extern void createdb(const char *dbname, const char *dbpath,
-					 const char *dbtemplate, int encoding);
+		 const char *dbtemplate, int encoding);
 extern void dropdb(const char *dbname);
 
 #endif	 /* DBCOMMANDS_H */
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index 31925b395af79d04fbfa3d8bc29ce9326a231c59..75b2311481d058f72e660d0291db99a9277c5f52 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -37,7 +37,7 @@ typedef FormData_pg_sequence *Form_pg_sequence;
 #define SEQ_COL_MAXVALUE		4
 #define SEQ_COL_MINVALUE		5
 #define SEQ_COL_CACHE			6
-#define	SEQ_COL_LOG				7
+#define SEQ_COL_LOG				7
 #define SEQ_COL_CYCLE			8
 #define SEQ_COL_CALLED			9
 
@@ -45,11 +45,11 @@ typedef FormData_pg_sequence *Form_pg_sequence;
 #define SEQ_COL_LASTCOL			SEQ_COL_CALLED
 
 /* XLOG stuff */
-#define	XLOG_SEQ_LOG			0x00
+#define XLOG_SEQ_LOG			0x00
 
 typedef struct xl_seq_rec
 {
-	RelFileNode				node;
+	RelFileNode node;
 	/* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
 } xl_seq_rec;
 
@@ -63,6 +63,6 @@ extern void CloseSequences(void);
 
 extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void seq_undo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void seq_desc(char *buf, uint8 xl_info, char* rec);
+extern void seq_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif	 /* SEQUENCE_H */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 86387b0a6f6101396e2f5a23cb8a678b512ca3a9..46c4a497646d3e087863839bc5c089a0d0c98fdb 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: trigger.h,v 1.25 2001/03/14 21:50:32 tgl Exp $
+ * $Id: trigger.h,v 1.26 2001/03/22 04:00:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -90,15 +90,15 @@ extern void FreeTriggerDesc(TriggerDesc *trigdesc);
 extern bool equalTriggerDescs(TriggerDesc *trigdesc1, TriggerDesc *trigdesc2);
 
 extern HeapTuple ExecBRInsertTriggers(EState *estate,
-									  Relation rel, HeapTuple tuple);
+					 Relation rel, HeapTuple tuple);
 extern void ExecARInsertTriggers(EState *estate,
-								 Relation rel, HeapTuple tuple);
+					 Relation rel, HeapTuple tuple);
 extern bool ExecBRDeleteTriggers(EState *estate, ItemPointer tupleid);
 extern void ExecARDeleteTriggers(EState *estate, ItemPointer tupleid);
 extern HeapTuple ExecBRUpdateTriggers(EState *estate, ItemPointer tupleid,
-									  HeapTuple tuple);
+					 HeapTuple tuple);
 extern void ExecARUpdateTriggers(EState *estate, ItemPointer tupleid,
-								 HeapTuple tuple);
+					 HeapTuple tuple);
 
 
 /* ----------
@@ -125,7 +125,7 @@ typedef struct DeferredTriggerEventData *DeferredTriggerEvent;
 
 typedef struct DeferredTriggerEventData
 {
-	DeferredTriggerEvent dte_next; /* list link */
+	DeferredTriggerEvent dte_next;		/* list link */
 	int32		dte_event;
 	Oid			dte_relid;
 	ItemPointerData dte_oldctid;
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index 139b03c2d83ed8c9d010b3f5c354e6826054ced2..d82d22fcdfcbe3482ed5dbf1b66bf52b607767c3 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: vacuum.h,v 1.33 2001/01/24 19:43:23 momjian Exp $
+ * $Id: vacuum.h,v 1.34 2001/03/22 04:00:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,24 +31,22 @@ typedef VAttListData *VAttList;
 
 typedef struct VacPageData
 {
-	BlockNumber blkno;		/* BlockNumber of this Page */
-	Size		free;		/* FreeSpace on this Page */
-	uint16		offsets_used;		/* Number of OffNums used by
-										 * vacuum */
-	uint16		offsets_free;		/* Number of OffNums free or to be
-										 * free */
-	OffsetNumber offsets[1];/* Array of its OffNums */
+	BlockNumber blkno;			/* BlockNumber of this Page */
+	Size		free;			/* FreeSpace on this Page */
+	uint16		offsets_used;	/* Number of OffNums used by vacuum */
+	uint16		offsets_free;	/* Number of OffNums free or to be free */
+	OffsetNumber offsets[1];	/* Array of its OffNums */
 } VacPageData;
 
 typedef VacPageData *VacPage;
 
 typedef struct VacPageListData
 {
-	int			empty_end_pages;	/* Number of "empty" end-pages */
-	int			num_pages;	/* Number of pages in pagedesc */
-	int			num_allocated_pages;		/* Number of allocated
-												 * pages in pagedesc */
-	VacPage *pagedesc;	/* Descriptions of pages */
+	int			empty_end_pages;/* Number of "empty" end-pages */
+	int			num_pages;		/* Number of pages in pagedesc */
+	int			num_allocated_pages;	/* Number of allocated pages in
+										 * pagedesc */
+	VacPage    *pagedesc;		/* Descriptions of pages */
 } VacPageListData;
 
 typedef VacPageListData *VacPageList;
@@ -102,7 +100,7 @@ typedef VTupleLinkData *VTupleLink;
 typedef struct VTupleMoveData
 {
 	ItemPointerData tid;		/* tuple ID */
-	VacPage		vacpage;			/* where to move */
+	VacPage		vacpage;		/* where to move */
 	bool		cleanVpd;		/* clean vacpage before using */
 } VTupleMoveData;
 
diff --git a/src/include/executor/execFlatten.h b/src/include/executor/execFlatten.h
index ede31af1df13f8a8a01e27c96f098a42bc720648..b922ab845a44fa357efb922173525d30aca6b4d5 100644
--- a/src/include/executor/execFlatten.h
+++ b/src/include/executor/execFlatten.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execFlatten.h,v 1.13 2001/01/24 19:43:23 momjian Exp $
+ * $Id: execFlatten.h,v 1.14 2001/03/22 04:00:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,10 +19,10 @@
 
 
 extern Datum ExecEvalIter(Iter *iterNode, ExprContext *econtext,
-						  bool *isNull, ExprDoneCond *isDone);
+			 bool *isNull, ExprDoneCond *isDone);
 
 extern void ExecEvalFjoin(TargetEntry *tlist, ExprContext *econtext,
-						  bool *isNullVect, ExprDoneCond *fj_isDone);
+			  bool *isNullVect, ExprDoneCond *fj_isDone);
 
 
 #endif	 /* EXECFLATTEN_H */
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 091841a9c1c7969cf5b20b069ec1c40661d313cd..787296f0e5c9c9fe09010cf52df315f6cee06578 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: executor.h,v 1.56 2001/01/29 00:39:20 tgl Exp $
+ * $Id: executor.h,v 1.57 2001/03/22 04:00:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,12 +55,12 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
  */
 extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
 extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, EState *estate,
-								   int feature, long count);
+			int feature, long count);
 extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate);
 extern void ExecConstraints(char *caller, ResultRelInfo *resultRelInfo,
-							TupleTableSlot *slot, EState *estate);
+				TupleTableSlot *slot, EState *estate);
 extern TupleTableSlot *EvalPlanQual(EState *estate, Index rti,
-									ItemPointer tid);
+			 ItemPointer tid);
 
 /*
  * prototypes from functions in execProcnode.c
@@ -77,23 +77,23 @@ extern TupleDesc ExecGetTupType(Plan *node);
 extern Datum ExecEvalParam(Param *expression, ExprContext *econtext,
 			  bool *isNull);
 extern Datum GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
-							   bool *isNull);
+				  bool *isNull);
 extern Datum GetAttributeByName(TupleTableSlot *slot, char *attname,
-								bool *isNull);
+				   bool *isNull);
 extern Datum ExecMakeFunctionResult(FunctionCachePtr fcache,
-									List *arguments,
-									ExprContext *econtext,
-									bool *isNull,
-									ExprDoneCond *isDone);
+					   List *arguments,
+					   ExprContext *econtext,
+					   bool *isNull,
+					   ExprDoneCond *isDone);
 extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext,
-						  bool *isNull, ExprDoneCond *isDone);
+			 bool *isNull, ExprDoneCond *isDone);
 extern Datum ExecEvalExprSwitchContext(Node *expression, ExprContext *econtext,
-									   bool *isNull, ExprDoneCond *isDone);
+						  bool *isNull, ExprDoneCond *isDone);
 extern bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull);
 extern int	ExecTargetListLength(List *targetlist);
 extern int	ExecCleanTargetListLength(List *targetlist);
 extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo,
-								   ExprDoneCond *isDone);
+			ExprDoneCond *isDone);
 
 /*
  * prototypes from functions in execScan.c
@@ -115,14 +115,14 @@ extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple,
 			   bool shouldFree);
 extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot);
 extern void ExecSetSlotDescriptor(TupleTableSlot *slot,
-								  TupleDesc tupdesc, bool shouldFree);
+					  TupleDesc tupdesc, bool shouldFree);
 extern void ExecSetSlotDescriptorIsNew(TupleTableSlot *slot, bool isNew);
 extern void ExecInitResultTupleSlot(EState *estate, CommonState *commonstate);
 extern void ExecInitScanTupleSlot(EState *estate,
 					  CommonScanState *commonscanstate);
 extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate);
 extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate,
-											 TupleDesc tupType);
+					  TupleDesc tupType);
 extern TupleDesc ExecTypeFromTL(List *targetList);
 extern void SetChangedParamList(Plan *node, List *newchg);
 
@@ -132,7 +132,7 @@ extern void SetChangedParamList(Plan *node, List *newchg);
 extern void ResetTupleCount(void);
 extern void ExecAssignExprContext(EState *estate, CommonState *commonstate);
 extern void ExecAssignResultType(CommonState *commonstate,
-								 TupleDesc tupDesc, bool shouldFree);
+					 TupleDesc tupDesc, bool shouldFree);
 extern void ExecAssignResultTypeFromOuterPlan(Plan *node,
 								  CommonState *commonstate);
 extern void ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate);
@@ -142,13 +142,13 @@ extern void ExecFreeProjectionInfo(CommonState *commonstate);
 extern void ExecFreeExprContext(CommonState *commonstate);
 extern TupleDesc ExecGetScanType(CommonScanState *csstate);
 extern void ExecAssignScanType(CommonScanState *csstate,
-							   TupleDesc tupDesc, bool shouldFree);
+				   TupleDesc tupDesc, bool shouldFree);
 extern void ExecAssignScanTypeFromOuterPlan(Plan *node,
 								CommonScanState *csstate);
 extern Form_pg_attribute ExecGetTypeInfo(Relation relDesc);
 
 extern ExprContext *MakeExprContext(TupleTableSlot *slot,
-									MemoryContext queryContext);
+				MemoryContext queryContext);
 extern void FreeExprContext(ExprContext *econtext);
 
 #define ResetExprContext(econtext) \
diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h
index 0c09516b7434b78ebd5c53ba129e39c97b6eed94..8aaf5d16ed40433a2b2a27aeff58a79ea4bebdfe 100644
--- a/src/include/executor/hashjoin.h
+++ b/src/include/executor/hashjoin.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: hashjoin.h,v 1.21 2001/01/24 19:43:23 momjian Exp $
+ * $Id: hashjoin.h,v 1.22 2001/03/22 04:00:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -69,8 +69,8 @@ typedef struct HashTableData
 								 * file */
 
 	/*
-	 * Info about the datatype being hashed.  We assume that the inner
-	 * and outer sides of the hash are the same type, or at least
+	 * Info about the datatype being hashed.  We assume that the inner and
+	 * outer sides of the hash are the same type, or at least
 	 * binary-compatible types.
 	 */
 	int16		typLen;
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index 71c97470227242e3e541228a6838acd64bf93a8a..e00bdfbc355fb6d15b1b4432ee3f5aadea6b71d4 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodeHash.h,v 1.18 2001/01/24 19:43:23 momjian Exp $
+ * $Id: nodeHash.h,v 1.19 2001/03/22 04:00:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,11 +26,11 @@ extern void ExecEndHash(Hash *node);
 extern HashJoinTable ExecHashTableCreate(Hash *node);
 extern void ExecHashTableDestroy(HashJoinTable hashtable);
 extern void ExecHashTableInsert(HashJoinTable hashtable,
-								ExprContext *econtext,
-								Node *hashkey);
+					ExprContext *econtext,
+					Node *hashkey);
 extern int ExecHashGetBucket(HashJoinTable hashtable,
-							 ExprContext *econtext,
-							 Node *hashkey);
+				  ExprContext *econtext,
+				  Node *hashkey);
 extern HeapTuple ExecScanHashBucket(HashJoinState *hjstate, List *hjclauses,
 				   ExprContext *econtext);
 extern void ExecHashTableReset(HashJoinTable hashtable, long ntuples);
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 63c370cecc9ea8bf083061f89cdad8a5dbec78e8..3ccd1c39c615e7fe8659bcf04e4618676703de6d 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -1,8 +1,8 @@
 /*-------------------------------------------------------------------------
  *
  * fmgr.h
- *    Definitions for the Postgres function manager and function-call
- *    interface.
+ *	  Definitions for the Postgres function manager and function-call
+ *	  interface.
  *
  * This file must be included by all Postgres modules that either define
  * or call fmgr-callable functions.
@@ -11,11 +11,11 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: fmgr.h,v 1.12 2001/01/24 19:43:19 momjian Exp $
+ * $Id: fmgr.h,v 1.13 2001/03/22 04:00:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
-#ifndef	FMGR_H
+#ifndef FMGR_H
 #define FMGR_H
 
 
@@ -25,7 +25,7 @@
  * signature.)
  */
 
-typedef struct FunctionCallInfoData    *FunctionCallInfo;
+typedef struct FunctionCallInfoData *FunctionCallInfo;
 
 typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
 
@@ -37,13 +37,18 @@ typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
  */
 typedef struct
 {
-    PGFunction  fn_addr;    /* pointer to function or handler to be called */
-    Oid         fn_oid;     /* OID of function (NOT of handler, if any) */
-    short       fn_nargs;   /* 0..FUNC_MAX_ARGS, or -1 if variable arg count */
-    bool        fn_strict;  /* function is "strict" (NULL in => NULL out) */
-	bool		fn_retset;	/* function returns a set (over multiple calls) */
-    void       *fn_extra;   /* extra space for use by handler */
-	MemoryContext fn_mcxt;	/* memory context to store fn_extra in */
+	PGFunction	fn_addr;		/* pointer to function or handler to be
+								 * called */
+	Oid			fn_oid;			/* OID of function (NOT of handler, if
+								 * any) */
+	short		fn_nargs;		/* 0..FUNC_MAX_ARGS, or -1 if variable arg
+								 * count */
+	bool		fn_strict;		/* function is "strict" (NULL in => NULL
+								 * out) */
+	bool		fn_retset;		/* function returns a set (over multiple
+								 * calls) */
+	void	   *fn_extra;		/* extra space for use by handler */
+	MemoryContext fn_mcxt;		/* memory context to store fn_extra in */
 } FmgrInfo;
 
 /*
@@ -51,13 +56,14 @@ typedef struct
  */
 typedef struct FunctionCallInfoData
 {
-    FmgrInfo   *flinfo;			/* ptr to lookup info used for this call */
-    struct Node *context;		/* pass info about context of call */
-    struct Node *resultinfo;	/* pass or return extra info about result */
-    bool        isnull;         /* function must set true if result is NULL */
-	short		nargs;          /* # arguments actually passed */
-    Datum       arg[FUNC_MAX_ARGS];	/* Arguments passed to function */
-    bool        argnull[FUNC_MAX_ARGS];	/* T if arg[i] is actually NULL */
+	FmgrInfo   *flinfo;			/* ptr to lookup info used for this call */
+	struct Node *context;		/* pass info about context of call */
+	struct Node *resultinfo;	/* pass or return extra info about result */
+	bool		isnull;			/* function must set true if result is
+								 * NULL */
+	short		nargs;			/* # arguments actually passed */
+	Datum		arg[FUNC_MAX_ARGS];		/* Arguments passed to function */
+	bool		argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */
 } FunctionCallInfoData;
 
 /*
@@ -68,12 +74,12 @@ extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
 
 /*
  * This macro invokes a function given a filled-in FunctionCallInfoData
- * struct.  The macro result is the returned Datum --- but note that
- * caller must still check fcinfo->isnull!  Also, if function is strict,
+ * struct.	The macro result is the returned Datum --- but note that
+ * caller must still check fcinfo->isnull!	Also, if function is strict,
  * it is caller's responsibility to verify that no null arguments are present
  * before calling.
  */
-#define FunctionCallInvoke(fcinfo)  ((* (fcinfo)->flinfo->fn_addr) (fcinfo))
+#define FunctionCallInvoke(fcinfo)	((* (fcinfo)->flinfo->fn_addr) (fcinfo))
 
 
 /*-------------------------------------------------------------------------
@@ -107,14 +113,14 @@ extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
  * which are varlena types).  pg_detoast_datum() gives you either the input
  * datum (if not toasted) or a detoasted copy allocated with palloc().
  * pg_detoast_datum_copy() always gives you a palloc'd copy --- use it
- * if you need a modifiable copy of the input.  Caller is expected to have
+ * if you need a modifiable copy of the input.	Caller is expected to have
  * checked for null inputs first, if necessary.
  *
  * Note: it'd be nice if these could be macros, but I see no way to do that
  * without evaluating the arguments multiple times, which is NOT acceptable.
  */
-extern struct varlena * pg_detoast_datum(struct varlena * datum);
-extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
+extern struct varlena *pg_detoast_datum(struct varlena * datum);
+extern struct varlena *pg_detoast_datum_copy(struct varlena * datum);
 
 #define PG_DETOAST_DATUM(datum) \
 	pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
@@ -122,7 +128,7 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
 	pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
 
 /*
- * Support for cleaning up detoasted copies of inputs.  This must only
+ * Support for cleaning up detoasted copies of inputs.	This must only
  * be used for pass-by-ref datatypes, and normally would only be used
  * for toastable types.  If the given pointer is different from the
  * original argument, assume it's a palloc'd detoasted copy, and pfree it.
@@ -138,44 +144,44 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
 
 /* Macros for fetching arguments of standard types */
 
-#define PG_GETARG_DATUM(n)   (fcinfo->arg[n])
-#define PG_GETARG_INT32(n)   DatumGetInt32(PG_GETARG_DATUM(n))
+#define PG_GETARG_DATUM(n)	 (fcinfo->arg[n])
+#define PG_GETARG_INT32(n)	 DatumGetInt32(PG_GETARG_DATUM(n))
 #define PG_GETARG_UINT32(n)  DatumGetUInt32(PG_GETARG_DATUM(n))
-#define PG_GETARG_INT16(n)   DatumGetInt16(PG_GETARG_DATUM(n))
+#define PG_GETARG_INT16(n)	 DatumGetInt16(PG_GETARG_DATUM(n))
 #define PG_GETARG_UINT16(n)  DatumGetUInt16(PG_GETARG_DATUM(n))
-#define PG_GETARG_CHAR(n)    DatumGetChar(PG_GETARG_DATUM(n))
-#define PG_GETARG_BOOL(n)    DatumGetBool(PG_GETARG_DATUM(n))
-#define PG_GETARG_OID(n)     DatumGetObjectId(PG_GETARG_DATUM(n))
+#define PG_GETARG_CHAR(n)	 DatumGetChar(PG_GETARG_DATUM(n))
+#define PG_GETARG_BOOL(n)	 DatumGetBool(PG_GETARG_DATUM(n))
+#define PG_GETARG_OID(n)	 DatumGetObjectId(PG_GETARG_DATUM(n))
 #define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
 #define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
-#define PG_GETARG_NAME(n)    DatumGetName(PG_GETARG_DATUM(n))
+#define PG_GETARG_NAME(n)	 DatumGetName(PG_GETARG_DATUM(n))
 /* these macros hide the pass-by-reference-ness of the datatype: */
 #define PG_GETARG_FLOAT4(n)  DatumGetFloat4(PG_GETARG_DATUM(n))
 #define PG_GETARG_FLOAT8(n)  DatumGetFloat8(PG_GETARG_DATUM(n))
-#define PG_GETARG_INT64(n)   DatumGetInt64(PG_GETARG_DATUM(n))
+#define PG_GETARG_INT64(n)	 DatumGetInt64(PG_GETARG_DATUM(n))
 /* use this if you want the raw, possibly-toasted input datum: */
-#define PG_GETARG_RAW_VARLENA_P(n)  ((struct varlena *) PG_GETARG_POINTER(n))
+#define PG_GETARG_RAW_VARLENA_P(n)	((struct varlena *) PG_GETARG_POINTER(n))
 /* use this if you want the input datum de-toasted: */
 #define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
 /* DatumGetFoo macros for varlena types will typically look like this: */
-#define DatumGetByteaP(X)           ((bytea *) PG_DETOAST_DATUM(X))
-#define DatumGetTextP(X)            ((text *) PG_DETOAST_DATUM(X))
-#define DatumGetBpCharP(X)          ((BpChar *) PG_DETOAST_DATUM(X))
-#define DatumGetVarCharP(X)         ((VarChar *) PG_DETOAST_DATUM(X))
+#define DatumGetByteaP(X)			((bytea *) PG_DETOAST_DATUM(X))
+#define DatumGetTextP(X)			((text *) PG_DETOAST_DATUM(X))
+#define DatumGetBpCharP(X)			((BpChar *) PG_DETOAST_DATUM(X))
+#define DatumGetVarCharP(X)			((VarChar *) PG_DETOAST_DATUM(X))
 /* And we also offer variants that return an OK-to-write copy */
-#define DatumGetByteaPCopy(X)       ((bytea *) PG_DETOAST_DATUM_COPY(X))
-#define DatumGetTextPCopy(X)        ((text *) PG_DETOAST_DATUM_COPY(X))
-#define DatumGetBpCharPCopy(X)      ((BpChar *) PG_DETOAST_DATUM_COPY(X))
-#define DatumGetVarCharPCopy(X)     ((VarChar *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetByteaPCopy(X)		((bytea *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetTextPCopy(X)		((text *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetBpCharPCopy(X)		((BpChar *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetVarCharPCopy(X)		((VarChar *) PG_DETOAST_DATUM_COPY(X))
 /* GETARG macros for varlena types will typically look like this: */
-#define PG_GETARG_BYTEA_P(n)        DatumGetByteaP(PG_GETARG_DATUM(n))
-#define PG_GETARG_TEXT_P(n)         DatumGetTextP(PG_GETARG_DATUM(n))
-#define PG_GETARG_BPCHAR_P(n)       DatumGetBpCharP(PG_GETARG_DATUM(n))
-#define PG_GETARG_VARCHAR_P(n)      DatumGetVarCharP(PG_GETARG_DATUM(n))
+#define PG_GETARG_BYTEA_P(n)		DatumGetByteaP(PG_GETARG_DATUM(n))
+#define PG_GETARG_TEXT_P(n)			DatumGetTextP(PG_GETARG_DATUM(n))
+#define PG_GETARG_BPCHAR_P(n)		DatumGetBpCharP(PG_GETARG_DATUM(n))
+#define PG_GETARG_VARCHAR_P(n)		DatumGetVarCharP(PG_GETARG_DATUM(n))
 /* And we also offer variants that return an OK-to-write copy */
-#define PG_GETARG_BYTEA_P_COPY(n)   DatumGetByteaPCopy(PG_GETARG_DATUM(n))
-#define PG_GETARG_TEXT_P_COPY(n)    DatumGetTextPCopy(PG_GETARG_DATUM(n))
-#define PG_GETARG_BPCHAR_P_COPY(n)  DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_BYTEA_P_COPY(n)	DatumGetByteaPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_TEXT_P_COPY(n)	DatumGetTextPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_BPCHAR_P_COPY(n)	DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
 #define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
 
 /* To return a NULL do this: */
@@ -183,24 +189,24 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
 	do { fcinfo->isnull = true; return (Datum) 0; } while (0)
 
 /* A few internal functions return void (which is not the same as NULL!) */
-#define PG_RETURN_VOID()     return (Datum) 0
+#define PG_RETURN_VOID()	 return (Datum) 0
 
 /* Macros for returning results of standard types */
 
-#define PG_RETURN_DATUM(x)   return (x)
-#define PG_RETURN_INT32(x)   return Int32GetDatum(x)
+#define PG_RETURN_DATUM(x)	 return (x)
+#define PG_RETURN_INT32(x)	 return Int32GetDatum(x)
 #define PG_RETURN_UINT32(x)  return UInt32GetDatum(x)
-#define PG_RETURN_INT16(x)   return Int16GetDatum(x)
-#define PG_RETURN_CHAR(x)    return CharGetDatum(x)
-#define PG_RETURN_BOOL(x)    return BoolGetDatum(x)
-#define PG_RETURN_OID(x)     return ObjectIdGetDatum(x)
+#define PG_RETURN_INT16(x)	 return Int16GetDatum(x)
+#define PG_RETURN_CHAR(x)	 return CharGetDatum(x)
+#define PG_RETURN_BOOL(x)	 return BoolGetDatum(x)
+#define PG_RETURN_OID(x)	 return ObjectIdGetDatum(x)
 #define PG_RETURN_POINTER(x) return PointerGetDatum(x)
 #define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
-#define PG_RETURN_NAME(x)    return NameGetDatum(x)
+#define PG_RETURN_NAME(x)	 return NameGetDatum(x)
 /* these macros hide the pass-by-reference-ness of the datatype: */
 #define PG_RETURN_FLOAT4(x)  return Float4GetDatum(x)
 #define PG_RETURN_FLOAT8(x)  return Float8GetDatum(x)
-#define PG_RETURN_INT64(x)   return Int64GetDatum(x)
+#define PG_RETURN_INT64(x)	 return Int64GetDatum(x)
 /* RETURN macros for other pass-by-ref types will typically look like this: */
 #define PG_RETURN_BYTEA_P(x)   PG_RETURN_POINTER(x)
 #define PG_RETURN_TEXT_P(x)    PG_RETURN_POINTER(x)
@@ -214,7 +220,7 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
  * Dynamically loaded functions may use either the version-1 ("new style")
  * or version-0 ("old style") calling convention.  Version 1 is the call
  * convention defined in this header file; version 0 is the old "plain C"
- * convention.  A version-1 function must be accompanied by the macro call
+ * convention.	A version-1 function must be accompanied by the macro call
  *
  *		PG_FUNCTION_INFO_V1(function_name);
  *
@@ -226,12 +232,13 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum);
 
 typedef struct
 {
-	int			api_version;	/* specifies call convention version number */
+	int			api_version;	/* specifies call convention version
+								 * number */
 	/* More fields may be added later, for version numbers > 1. */
 } Pg_finfo_record;
 
 /* Expected signature of an info function */
-typedef Pg_finfo_record * (*PGFInfoFunction) (void);
+typedef Pg_finfo_record *(*PGFInfoFunction) (void);
 
 /* Macro to build an info function associated with the given function name */
 
@@ -257,24 +264,24 @@ CppConcat(pg_finfo_,funcname) (void) \
 extern Datum DirectFunctionCall1(PGFunction func, Datum arg1);
 extern Datum DirectFunctionCall2(PGFunction func, Datum arg1, Datum arg2);
 extern Datum DirectFunctionCall3(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3);
+					Datum arg3);
 extern Datum DirectFunctionCall4(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4);
+					Datum arg3, Datum arg4);
 extern Datum DirectFunctionCall5(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4, Datum arg5);
+					Datum arg3, Datum arg4, Datum arg5);
 extern Datum DirectFunctionCall6(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4, Datum arg5,
-								 Datum arg6);
+					Datum arg3, Datum arg4, Datum arg5,
+					Datum arg6);
 extern Datum DirectFunctionCall7(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4, Datum arg5,
-								 Datum arg6, Datum arg7);
+					Datum arg3, Datum arg4, Datum arg5,
+					Datum arg6, Datum arg7);
 extern Datum DirectFunctionCall8(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4, Datum arg5,
-								 Datum arg6, Datum arg7, Datum arg8);
+					Datum arg3, Datum arg4, Datum arg5,
+					Datum arg6, Datum arg7, Datum arg8);
 extern Datum DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
-								 Datum arg3, Datum arg4, Datum arg5,
-								 Datum arg6, Datum arg7, Datum arg8,
-								 Datum arg9);
+					Datum arg3, Datum arg4, Datum arg5,
+					Datum arg6, Datum arg7, Datum arg8,
+					Datum arg9);
 
 /* These are for invocation of a previously-looked-up function with a
  * directly-computed parameter list.  Note that neither arguments nor result
@@ -283,65 +290,65 @@ extern Datum DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
 extern Datum FunctionCall1(FmgrInfo *flinfo, Datum arg1);
 extern Datum FunctionCall2(FmgrInfo *flinfo, Datum arg1, Datum arg2);
 extern Datum FunctionCall3(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3);
+			  Datum arg3);
 extern Datum FunctionCall4(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4);
+			  Datum arg3, Datum arg4);
 extern Datum FunctionCall5(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4, Datum arg5);
+			  Datum arg3, Datum arg4, Datum arg5);
 extern Datum FunctionCall6(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4, Datum arg5,
-						   Datum arg6);
+			  Datum arg3, Datum arg4, Datum arg5,
+			  Datum arg6);
 extern Datum FunctionCall7(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4, Datum arg5,
-						   Datum arg6, Datum arg7);
+			  Datum arg3, Datum arg4, Datum arg5,
+			  Datum arg6, Datum arg7);
 extern Datum FunctionCall8(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4, Datum arg5,
-						   Datum arg6, Datum arg7, Datum arg8);
+			  Datum arg3, Datum arg4, Datum arg5,
+			  Datum arg6, Datum arg7, Datum arg8);
 extern Datum FunctionCall9(FmgrInfo *flinfo, Datum arg1, Datum arg2,
-						   Datum arg3, Datum arg4, Datum arg5,
-						   Datum arg6, Datum arg7, Datum arg8,
-						   Datum arg9);
+			  Datum arg3, Datum arg4, Datum arg5,
+			  Datum arg6, Datum arg7, Datum arg8,
+			  Datum arg9);
 
 /* These are for invocation of a function identified by OID with a
  * directly-computed parameter list.  Note that neither arguments nor result
- * are allowed to be NULL.  These are essentially FunctionLookup() followed
- * by FunctionCallN().  If the same function is to be invoked repeatedly,
+ * are allowed to be NULL.	These are essentially FunctionLookup() followed
+ * by FunctionCallN().	If the same function is to be invoked repeatedly,
  * do the FunctionLookup() once and then use FunctionCallN().
  */
 extern Datum OidFunctionCall1(Oid functionId, Datum arg1);
 extern Datum OidFunctionCall2(Oid functionId, Datum arg1, Datum arg2);
 extern Datum OidFunctionCall3(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3);
+				 Datum arg3);
 extern Datum OidFunctionCall4(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4);
+				 Datum arg3, Datum arg4);
 extern Datum OidFunctionCall5(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4, Datum arg5);
+				 Datum arg3, Datum arg4, Datum arg5);
 extern Datum OidFunctionCall6(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4, Datum arg5,
-							  Datum arg6);
+				 Datum arg3, Datum arg4, Datum arg5,
+				 Datum arg6);
 extern Datum OidFunctionCall7(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4, Datum arg5,
-							  Datum arg6, Datum arg7);
+				 Datum arg3, Datum arg4, Datum arg5,
+				 Datum arg6, Datum arg7);
 extern Datum OidFunctionCall8(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4, Datum arg5,
-							  Datum arg6, Datum arg7, Datum arg8);
+				 Datum arg3, Datum arg4, Datum arg5,
+				 Datum arg6, Datum arg7, Datum arg8);
 extern Datum OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2,
-							  Datum arg3, Datum arg4, Datum arg5,
-							  Datum arg6, Datum arg7, Datum arg8,
-							  Datum arg9);
+				 Datum arg3, Datum arg4, Datum arg5,
+				 Datum arg6, Datum arg7, Datum arg8,
+				 Datum arg9);
 
 
 /*
  * Routines in fmgr.c
  */
 extern Pg_finfo_record *fetch_finfo_record(char *filename, char *funcname);
-extern Oid fmgr_internal_function(const char *proname);
+extern Oid	fmgr_internal_function(const char *proname);
 
 /*
  * Routines in dfmgr.c
  */
 extern PGFunction load_external_function(char *filename, char *funcname,
-										 bool signalNotFound);
+					   bool signalNotFound);
 extern void load_file(char *filename);
 
 
@@ -358,6 +365,6 @@ extern void load_file(char *filename);
 /*
  * DEPRECATED, DO NOT USE IN NEW CODE
  */
-extern char *fmgr(Oid procedureId, ... );
+extern char *fmgr(Oid procedureId,...);
 
-#endif	/* FMGR_H */
+#endif	 /* FMGR_H */
diff --git a/src/include/lib/dllist.h b/src/include/lib/dllist.h
index 646976222f9ca5ca25f55470245f6ef6201509a8..42e500fa056dbc178f784156601296df6ec5bdfb 100644
--- a/src/include/lib/dllist.h
+++ b/src/include/lib/dllist.h
@@ -34,7 +34,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dllist.h,v 1.15 2001/01/24 19:43:24 momjian Exp $
+ * $Id: dllist.h,v 1.16 2001/03/22 04:00:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -66,7 +66,7 @@ extern void DLFreeList(Dllist *list);	/* free up a list and all the
 extern Dlelem *DLNewElem(void *val);
 extern void DLInitElem(Dlelem *e, void *val);
 extern void DLFreeElem(Dlelem *e);
-extern void DLRemove(Dlelem *e);		/* removes node from list */
+extern void DLRemove(Dlelem *e);/* removes node from list */
 extern void DLAddHead(Dllist *list, Dlelem *node);
 extern void DLAddTail(Dllist *list, Dlelem *node);
 extern Dlelem *DLRemHead(Dllist *list); /* remove and return the head */
@@ -78,7 +78,7 @@ extern void DLMoveToFront(Dlelem *e);	/* move node to front of its list */
 #define DLGetTail(list)  ((list)->dll_tail)
 #define DLGetSucc(elem)  ((elem)->dle_next)
 #define DLGetPred(elem)  ((elem)->dle_prev)
-#define DLGetListHdr(elem)  ((elem)->dle_list)
+#define DLGetListHdr(elem)	((elem)->dle_list)
 
 #define DLE_VAL(elem)	((elem)->dle_val)
 
diff --git a/src/include/libpq/auth.h b/src/include/libpq/auth.h
index 76aecba6d54b60bbe493d4e94d570ab2514c0482..649823f0e76804bd371af87859641628c92c663c 100644
--- a/src/include/libpq/auth.h
+++ b/src/include/libpq/auth.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: auth.h,v 1.15 2001/01/24 19:43:24 momjian Exp $
+ * $Id: auth.h,v 1.16 2001/03/22 04:00:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,6 +26,6 @@ void		be_recvauth(Port *port);
 #define PG_KRB4_VERSION "PGVER4.1"		/* at most KRB_SENDAUTH_VLEN chars */
 #define PG_KRB5_VERSION "PGVER5.1"
 
-extern char * pg_krb_server_keyfile;
+extern char *pg_krb_server_keyfile;
 
 #endif	 /* AUTH_H */
diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h
index 58c223311332e8360f995c6ae75b26d51eea48f1..9afd9f841732c2a0cc001033b05eea55e53593bd 100644
--- a/src/include/libpq/hba.h
+++ b/src/include/libpq/hba.h
@@ -4,7 +4,7 @@
  *	  Interface to hba.c
  *
  *
- * $Id: hba.h,v 1.18 2000/06/15 03:32:42 momjian Exp $
+ * $Id: hba.h,v 1.19 2001/03/22 04:00:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@ typedef enum UserAuth
 
 typedef struct Port hbaPort;
 
-int	hba_getauthmethod(hbaPort *port);
+int			hba_getauthmethod(hbaPort *port);
 int authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
 		  const char *postgres_username, const char *auth_arg);
 
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index ec1ebdc1f7ac1fbd9a98e96dccb95587c274a7e2..4ab823e5463766acf03b73b41f868d8afaa46cd4 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq.h,v 1.43 2001/01/24 19:43:25 momjian Exp $
+ * $Id: libpq.h,v 1.44 2001/03/22 04:00:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,8 +55,8 @@ extern char PQerrormsg[PQERRORMSG_LENGTH];		/* in libpq/util.c */
 /*
  * prototypes for functions in pqcomm.c
  */
-extern int	StreamServerPort(int family, char *hostName,
-			unsigned short portNumber, char *unixSocketName, int *fdP);
+extern int StreamServerPort(int family, char *hostName,
+			  unsigned short portNumber, char *unixSocketName, int *fdP);
 extern int	StreamConnection(int server_fd, Port *port);
 extern void StreamClose(int sock);
 extern void pq_init(void);
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index b952891411b2046ff3af4936835afdea5c7e5b74..0f90ecdc67d4897683068cff83497bc5f05a6639 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqcomm.h,v 1.54 2001/02/10 02:31:28 tgl Exp $
+ * $Id: pqcomm.h,v 1.55 2001/03/22 04:00:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,22 +18,23 @@
 
 #include <sys/types.h>
 #ifdef WIN32
-# include <winsock.h>
-#else /* not WIN32 */
-# include <sys/socket.h>
-# ifdef HAVE_SYS_UN_H
-#  include <sys/un.h>
-# endif
-# include <netinet/in.h>
-#endif /* not WIN32 */
+#include <winsock.h>
+#else							/* not WIN32 */
+#include <sys/socket.h>
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#include <netinet/in.h>
+#endif	 /* not WIN32 */
 
 
 #ifndef HAVE_STRUCT_SOCKADDR_UN
 struct sockaddr_un
 {
 	short int	sun_family;		/* AF_UNIX */
-	char		sun_path[108];  /* path name (gag) */
+	char		sun_path[108];	/* path name (gag) */
 };
+
 #endif
 
 /* Define a generic socket address type. */
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index b137da7cec47fc94d6e18385f4dc12912c892f9b..ca8e6b15dfd64f958adda95d1d465c208c7445b8 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -1,4 +1,4 @@
-/* $Id: pg_wchar.h,v 1.24 2001/02/10 02:31:28 tgl Exp $ */
+/* $Id: pg_wchar.h,v 1.25 2001/03/22 04:00:49 momjian Exp $ */
 
 #ifndef PG_WCHAR_H
 #define PG_WCHAR_H
@@ -8,7 +8,7 @@
 #ifdef FRONTEND
 #undef palloc
 #define palloc malloc
-# undef pfree
+#undef pfree
 #define pfree free
 #endif
 
@@ -38,6 +38,7 @@
 
 #ifdef MULTIBYTE
 typedef unsigned int pg_wchar;
+
 #else
 #define pg_wchar char
 #endif
@@ -88,15 +89,15 @@ typedef struct
 								 * client only */
 	void		(*to_mic) ();	/* client encoding to MIC */
 	void		(*from_mic) (); /* MIC to client encoding */
-	void		(*to_unicode) ();	/* client encoding to UTF-8 */
-	void		(*from_unicode) (); /* UTF-8 to client encoding */
+	void		(*to_unicode) ();		/* client encoding to UTF-8 */
+	void		(*from_unicode) ();		/* UTF-8 to client encoding */
 }			pg_encoding_conv_tbl;
 
 extern pg_encoding_conv_tbl pg_conv_tbl[];
 
 typedef struct
 {
-	int		(*mb2wchar_with_len) ();		/* convert a multi-byte
+	int			(*mb2wchar_with_len) ();		/* convert a multi-byte
 												 * string to a wchar */
 	int			(*mblen) ();	/* returns the length of a multi-byte word */
 }			pg_wchar_tbl;
@@ -108,21 +109,21 @@ extern pg_wchar_tbl pg_wchar_table[];
  */
 typedef struct
 {
-	unsigned int utf;		/* UTF-8 */
-	unsigned int code;		/* local code */
-} pg_utf_to_local;
+	unsigned int utf;			/* UTF-8 */
+	unsigned int code;			/* local code */
+}			pg_utf_to_local;
 
 /*
  * local code to UTF-8 conversion map
  */
 typedef struct
 {
-	unsigned int code;	/* local code */
-	unsigned int utf;		/* UTF-8 */
-} pg_local_to_utf;
+	unsigned int code;			/* local code */
+	unsigned int utf;			/* UTF-8 */
+}			pg_local_to_utf;
 
-extern int pg_mb2wchar(const unsigned char *, pg_wchar *);
-extern int pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int);
+extern int	pg_mb2wchar(const unsigned char *, pg_wchar *);
+extern int	pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int);
 extern int	pg_char_and_wchar_strcmp(const char *, const pg_wchar *);
 extern int	pg_wchar_strncmp(const pg_wchar *, const pg_wchar *, size_t);
 extern int	pg_char_and_wchar_strncmp(const char *, const pg_wchar *, size_t);
@@ -141,7 +142,7 @@ extern unsigned char *pg_client_to_server(unsigned char *, int);
 extern unsigned char *pg_server_to_client(unsigned char *, int);
 extern int	pg_valid_client_encoding(const char *);
 extern pg_encoding_conv_tbl *pg_get_enc_ent(int);
-extern int pg_utf_mblen(const unsigned char *);
+extern int	pg_utf_mblen(const unsigned char *);
 
 /* internally-used versions of functions.  The PG_xxx forms of these
  * functions have fmgr-compatible interfaves.
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 851174f39667a242a4a7d2c004a52a11cf0be4e1..6f90355d7681adb18dbf4d82998b184074a9916e 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: miscadmin.h,v 1.82 2001/03/13 01:17:06 tgl Exp $
+ * $Id: miscadmin.h,v 1.83 2001/03/22 04:00:25 momjian Exp $
  *
  * NOTES
  *	  some of the information in this file should be moved to
@@ -26,14 +26,14 @@
 #include "storage/ipc.h"
 
 /*****************************************************************************
- *    System interrupt and critical section handling
+ *	  System interrupt and critical section handling
  *
  * There are two types of interrupts that a running backend needs to accept
  * without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM).
  * In both cases, we need to be able to clean up the current transaction
  * gracefully, so we can't respond to the interrupt instantaneously ---
  * there's no guarantee that internal data structures would be self-consistent
- * if the code is interrupted at an arbitrary instant.  Instead, the signal
+ * if the code is interrupted at an arbitrary instant.	Instead, the signal
  * handlers set flags that are checked periodically during execution.
  *
  * The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots
@@ -42,7 +42,7 @@
  * might sometimes be called in contexts that do *not* want to allow a cancel
  * or die interrupt.  The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros
  * allow code to ensure that no cancel or die interrupt will be accepted,
- * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine.  The interrupt
+ * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine.	The interrupt
  * will be held off until the last matching RESUME_INTERRUPTS() occurs.
  *
  * Special mechanisms are used to let an interrupt be accepted when we are
@@ -64,6 +64,7 @@
 extern volatile bool InterruptPending;
 extern volatile bool QueryCancelPending;
 extern volatile bool ProcDiePending;
+
 /* these are marked volatile because they are examined by signal handlers: */
 extern volatile bool ImmediateInterruptOK;
 extern volatile uint32 InterruptHoldoffCount;
@@ -78,7 +79,7 @@ extern void ProcessInterrupts(void);
 			ProcessInterrupts(); \
 	} while(0)
 
-#define	HOLD_INTERRUPTS()  (InterruptHoldoffCount++)
+#define HOLD_INTERRUPTS()  (InterruptHoldoffCount++)
 
 #define RESUME_INTERRUPTS() \
 	do { \
@@ -88,7 +89,7 @@ extern void ProcessInterrupts(void);
 			ProcessInterrupts(); \
 	} while(0)
 
-#define	START_CRIT_SECTION()  (CritSectionCount++)
+#define START_CRIT_SECTION()  (CritSectionCount++)
 
 #define END_CRIT_SECTION() \
 	do { \
@@ -176,10 +177,10 @@ extern int	SortMem;
 extern bool NetServer;
 extern bool EnableSSL;
 extern bool SilentMode;
-extern int MaxBackends;
-extern int NBuffers;
-extern int PostPortNumber;
-extern int Unix_socket_permissions;
+extern int	MaxBackends;
+extern int	NBuffers;
+extern int	PostPortNumber;
+extern int	Unix_socket_permissions;
 extern char *Unix_socket_group;
 extern char *UnixSocketDir;
 extern char *VirtualHost;
@@ -203,22 +204,23 @@ extern void SetDatabasePath(const char *path);
 
 extern char *GetUserName(Oid userid);
 
-extern Oid GetUserId(void);
+extern Oid	GetUserId(void);
 extern void SetUserId(Oid userid);
-extern Oid GetSessionUserId(void);
+extern Oid	GetSessionUserId(void);
 extern void SetSessionUserId(Oid userid);
 extern void SetSessionUserIdFromUserName(const char *username);
 
 extern void SetDataDir(const char *dir);
 
-extern int	FindExec(char *full_path, const char *argv0,
-					 const char *binary_name);
+extern int FindExec(char *full_path, const char *argv0,
+		 const char *binary_name);
 extern int	CheckPathAccess(char *path, char *name, int open_mode);
 
 #ifdef CYR_RECODE
 extern void GetCharSetByHost(char *TableName, int host, const char *DataDir);
 extern void SetCharSet(void);
 extern char *convertstr(unsigned char *buff, int len, int dest);
+
 #endif
 
 /*****************************************************************************
@@ -237,7 +239,7 @@ extern char *convertstr(unsigned char *buff, int len, int dest);
  * is used during the initial generation of template databases.
  *
  * Initialization mode: used while starting a backend, until all normal
- * initialization is complete.  Some code behaves differently when executed
+ * initialization is complete.	Some code behaves differently when executed
  * in this mode to enable system bootstrapping.
  *
  * If a POSTGRES binary is in normal mode, then all code may be executed
@@ -284,7 +286,7 @@ extern bool CreateDataDirLockFile(const char *datadir, bool amPostmaster);
 extern bool CreateSocketLockFile(const char *socketfile, bool amPostmaster);
 extern void TouchSocketLockFile(void);
 extern void RecordSharedMemoryInLockFile(IpcMemoryKey shmKey,
-										 IpcMemoryId shmId);
+							 IpcMemoryId shmId);
 
 extern void ValidatePgVersion(const char *path);
 
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index b9c10e6b310279d4f2bc7a52d52ca2832a60dfd8..2cf9378cf116426106be2cba0bb29d970e561c09 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execnodes.h,v 1.56 2001/01/29 00:39:20 tgl Exp $
+ * $Id: execnodes.h,v 1.57 2001/03/22 04:00:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,7 +65,7 @@ typedef struct IndexInfo
  *	There are two memory contexts associated with an ExprContext:
  *	* ecxt_per_query_memory is a relatively long-lived context (such as
  *	  TransactionCommandContext); typically it's the same context the
- *	  ExprContext node itself is allocated in.  This context can be
+ *	  ExprContext node itself is allocated in.	This context can be
  *	  used for purposes such as storing operator/function fcache nodes.
  *	* ecxt_per_tuple_memory is a short-term context for expression results.
  *	  As the name suggests, it will typically be reset once per tuple,
@@ -86,8 +86,8 @@ typedef struct ExprContext
 	MemoryContext ecxt_per_query_memory;
 	MemoryContext ecxt_per_tuple_memory;
 	/* Values to substitute for Param nodes in expression */
-	ParamExecData *ecxt_param_exec_vals;	/* for PARAM_EXEC params */
-	ParamListInfo ecxt_param_list_info;		/* for other param types */
+	ParamExecData *ecxt_param_exec_vals;		/* for PARAM_EXEC params */
+	ParamListInfo ecxt_param_list_info; /* for other param types */
 	/* Values to substitute for Aggref nodes in expression */
 	Datum	   *ecxt_aggvalues; /* precomputed values for Aggref nodes */
 	bool	   *ecxt_aggnulls;	/* null flags for Aggref nodes */
@@ -153,7 +153,7 @@ typedef struct ProjectionInfo
  *	  in emitted tuples.	For example, when we do an UPDATE query,
  *	  the planner adds a "junk" entry to the targetlist so that the tuples
  *	  returned to ExecutePlan() contain an extra attribute: the ctid of
- *	  the tuple to be updated.  This is needed to do the update, but we
+ *	  the tuple to be updated.	This is needed to do the update, but we
  *	  don't want the ctid to be part of the stored new tuple!  So, we
  *	  apply a "junk filter" to remove the junk attributes and form the
  *	  real output tuple.
@@ -246,10 +246,11 @@ typedef struct EState
 	ScanDirection es_direction;
 	Snapshot	es_snapshot;
 	List	   *es_range_table;
-	ResultRelInfo *es_result_relations;		/* array of ResultRelInfos */
-	int			es_num_result_relations;	/* length of array */
-	ResultRelInfo *es_result_relation_info;	/* currently active array elt */
-	JunkFilter *es_junkFilter;				/* currently active junk filter */
+	ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
+	int			es_num_result_relations;		/* length of array */
+	ResultRelInfo *es_result_relation_info;		/* currently active array
+												 * elt */
+	JunkFilter *es_junkFilter;	/* currently active junk filter */
 	Relation	es_into_relation_descriptor;
 	ParamListInfo es_param_list_info;
 	ParamExecData *es_param_exec_vals;	/* this is for subselects */
@@ -257,11 +258,13 @@ typedef struct EState
 	uint32		es_processed;	/* # of tuples processed */
 	Oid			es_lastoid;		/* last oid processed (by INSERT) */
 	List	   *es_rowMark;		/* not good place, but there is no other */
-	MemoryContext es_query_cxt;	/* per-query context in which EState lives */
+	MemoryContext es_query_cxt; /* per-query context in which EState lives */
+
 	/*
 	 * this ExprContext is for per-output-tuple operations, such as
-	 * constraint checks and index-value computations.  It will be reset
-	 * for each output tuple.  Note that it will be created only if needed.
+	 * constraint checks and index-value computations.	It will be reset
+	 * for each output tuple.  Note that it will be created only if
+	 * needed.
 	 */
 	ExprContext *es_per_tuple_exprcontext;
 	/* Below is to re-evaluate plan qual in READ COMMITTED mode */
@@ -484,8 +487,8 @@ typedef CommonState JoinState;
 /* ----------------
  *	 NestLoopState information
  *
- *		NeedNewOuter       true if need new outer tuple on next call
- *		MatchedOuter       true if found a join match for current outer tuple
+ *		NeedNewOuter	   true if need new outer tuple on next call
+ *		MatchedOuter	   true if found a join match for current outer tuple
  *		NullInnerTupleSlot prepared null tuple for left outer joins
  * ----------------
  */
@@ -503,10 +506,10 @@ typedef struct NestLoopState
  *		OuterSkipQual	   outerKey1 < innerKey1 ...
  *		InnerSkipQual	   outerKey1 > innerKey1 ...
  *		JoinState		   current "state" of join. see executor.h
- *		MatchedOuter       true if found a join match for current outer tuple
- *		MatchedInner       true if found a join match for current inner tuple
- *		OuterTupleSlot     pointer to slot in tuple table for cur outer tuple
- *		InnerTupleSlot     pointer to slot in tuple table for cur inner tuple
+ *		MatchedOuter	   true if found a join match for current outer tuple
+ *		MatchedInner	   true if found a join match for current inner tuple
+ *		OuterTupleSlot	   pointer to slot in tuple table for cur outer tuple
+ *		InnerTupleSlot	   pointer to slot in tuple table for cur inner tuple
  *		MarkedTupleSlot    pointer to slot in tuple table for marked tuple
  *		NullOuterTupleSlot prepared null tuple for right outer joins
  *		NullInnerTupleSlot prepared null tuple for left outer joins
@@ -539,9 +542,9 @@ typedef struct MergeJoinState
  *		hj_InnerHashKey			the inner hash key in the hashjoin condition
  *		hj_OuterTupleSlot		tuple slot for outer tuples
  *		hj_HashTupleSlot		tuple slot for hashed tuples
- *		hj_NullInnerTupleSlot   prepared null tuple for left outer joins
- *		hj_NeedNewOuter         true if need new outer tuple on next call
- *		hj_MatchedOuter         true if found a join match for current outer
+ *		hj_NullInnerTupleSlot	prepared null tuple for left outer joins
+ *		hj_NeedNewOuter			true if need new outer tuple on next call
+ *		hj_MatchedOuter			true if found a join match for current outer
  *		hj_hashdone				true if hash-table-build phase is done
  * ----------------
  */
@@ -593,7 +596,7 @@ typedef struct MaterialState
  *	during evaluation of an Agg node's output tuple(s).
  * -------------------------
  */
-typedef struct AggStatePerAggData *AggStatePerAgg;	/* private in nodeAgg.c */
+typedef struct AggStatePerAggData *AggStatePerAgg;		/* private in nodeAgg.c */
 
 typedef struct AggState
 {
@@ -601,7 +604,8 @@ typedef struct AggState
 	List	   *aggs;			/* all Aggref nodes in targetlist & quals */
 	int			numaggs;		/* length of list (could be zero!) */
 	AggStatePerAgg peragg;		/* per-Aggref working state */
-	MemoryContext tup_cxt;		/* context for per-output-tuple expressions */
+	MemoryContext tup_cxt;		/* context for per-output-tuple
+								 * expressions */
 	MemoryContext agg_cxt[2];	/* pair of expression eval memory contexts */
 	int			which_cxt;		/* 0 or 1, indicates current agg_cxt */
 	bool		agg_done;		/* indicates completion of Agg scan */
@@ -659,7 +663,7 @@ typedef struct UniqueState
  *	 SetOpState information
  *
  *		SetOp nodes are used "on top of" sort nodes to discard
- *		duplicate tuples returned from the sort phase.  These are
+ *		duplicate tuples returned from the sort phase.	These are
  *		more complex than a simple Unique since we have to count
  *		how many duplicates to return.
  * ----------------
diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h
index aae5c72821087f25f38e9957b5dfb37a3dfa1947..374292b9e036dba31056f6737ddd9de6088df0c5 100644
--- a/src/include/nodes/memnodes.h
+++ b/src/include/nodes/memnodes.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: memnodes.h,v 1.20 2001/01/24 19:43:25 momjian Exp $
+ * $Id: memnodes.h,v 1.21 2001/03/22 04:00:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,7 +42,7 @@ typedef struct MemoryContextMethods
 	void		(*init) (MemoryContext context);
 	void		(*reset) (MemoryContext context);
 	void		(*delete) (MemoryContext context);
-#ifdef MEMORY_CONTEXT_CHECKING	
+#ifdef MEMORY_CONTEXT_CHECKING
 	void		(*check) (MemoryContext context);
 #endif
 	void		(*stats) (MemoryContext context);
@@ -51,12 +51,12 @@ typedef struct MemoryContextMethods
 
 typedef struct MemoryContextData
 {
-	NodeTag		type;				/* identifies exact kind of context */
-	MemoryContextMethods *methods;	/* virtual function table */
-	MemoryContext parent;			/* NULL if no parent (toplevel context) */
-	MemoryContext firstchild;		/* head of linked list of children */
-	MemoryContext nextchild;		/* next child of same parent */
-	char	   *name;				/* context name (just for debugging) */
+	NodeTag		type;			/* identifies exact kind of context */
+	MemoryContextMethods *methods;		/* virtual function table */
+	MemoryContext parent;		/* NULL if no parent (toplevel context) */
+	MemoryContext firstchild;	/* head of linked list of children */
+	MemoryContext nextchild;	/* next child of same parent */
+	char	   *name;			/* context name (just for debugging) */
 } MemoryContextData;
 
 /* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 1cd2aee397c55543ae04e0e49b5fd36a637006fa..bf1a6eee4f4dfff8c9e37f971221297509d26c57 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodes.h,v 1.86 2001/01/24 19:43:25 momjian Exp $
+ * $Id: nodes.h,v 1.87 2001/03/22 04:00:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -172,7 +172,8 @@ typedef enum NodeTag
 	T_RemoveAggrStmt,
 	T_RemoveFuncStmt,
 	T_RemoveOperStmt,
-	T_RemoveStmt_XXX,			/* not used anymore; this tag# is available */
+	T_RemoveStmt_XXX,			/* not used anymore; this tag# is
+								 * available */
 	T_RenameStmt,
 	T_RuleStmt,
 	T_NotifyStmt,
@@ -225,11 +226,14 @@ typedef enum NodeTag
 	T_RangeTblEntry,
 	T_SortClause,
 	T_GroupClause,
-	T_SubSelectXXX,				/* not used anymore; this tag# is available */
-	T_oldJoinExprXXX,			/* not used anymore; this tag# is available */
+	T_SubSelectXXX,				/* not used anymore; this tag# is
+								 * available */
+	T_oldJoinExprXXX,			/* not used anymore; this tag# is
+								 * available */
 	T_CaseExpr,
 	T_CaseWhen,
-	T_RowMarkXXX,				/* not used anymore; this tag# is available */
+	T_RowMarkXXX,				/* not used anymore; this tag# is
+								 * available */
 	T_FkConstraint,
 
 	/*---------------------
@@ -347,19 +351,24 @@ typedef enum CmdType
  */
 typedef enum JoinType
 {
+
 	/*
 	 * The canonical kinds of joins
 	 */
 	JOIN_INNER,					/* matching tuple pairs only */
 	JOIN_LEFT,					/* pairs + unmatched outer tuples */
-	JOIN_FULL,					/* pairs + unmatched outer + unmatched inner */
+	JOIN_FULL,					/* pairs + unmatched outer + unmatched
+								 * inner */
 	JOIN_RIGHT,					/* pairs + unmatched inner tuples */
+
 	/*
-	 * SQL92 considers UNION JOIN to be a kind of join, so list it here for
-	 * parser convenience, even though it's not implemented like a join in
-	 * the executor.  (The planner must convert it to an Append plan.)
+	 * SQL92 considers UNION JOIN to be a kind of join, so list it here
+	 * for parser convenience, even though it's not implemented like a
+	 * join in the executor.  (The planner must convert it to an Append
+	 * plan.)
 	 */
 	JOIN_UNION
+
 	/*
 	 * Eventually we will have some additional join types for efficient
 	 * support of queries like WHERE foo IN (SELECT bar FROM ...).
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 94264d0b4c89099ba059e4f9c670200b5fe425af..3c093dd390fcadd5e4148998b6a36f12964a300c 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.124 2001/01/24 19:43:25 momjian Exp $
+ * $Id: parsenodes.h,v 1.125 2001/03/22 04:00:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,7 +49,8 @@ typedef struct Query
 	bool		hasSubLinks;	/* has subquery SubLink */
 
 	List	   *rtable;			/* list of range table entries */
-	FromExpr   *jointree;		/* table join tree (FROM and WHERE clauses) */
+	FromExpr   *jointree;		/* table join tree (FROM and WHERE
+								 * clauses) */
 
 	List	   *rowMarks;		/* integer list of RT indexes of relations
 								 * that are selected FOR UPDATE */
@@ -78,7 +79,7 @@ typedef struct Query
 	 * commit to the exact set of child tables at parse time.  This field
 	 * ought to go in some sort of TopPlan plan node, not in the Query.
 	 */
-	List	   *resultRelations; /* integer list of RT indexes, or NIL */
+	List	   *resultRelations;/* integer list of RT indexes, or NIL */
 
 	/* internal to planner */
 	List	   *base_rel_list;	/* list of base-relation RelOptInfos */
@@ -115,13 +116,14 @@ typedef enum InhOption
 typedef struct AlterTableStmt
 {
 	NodeTag		type;
-	char		subtype;		/* A = add column, T = alter column, D = drop column,
-								 * C = add constraint, X = drop constraint,
-								 * E = add toast table,
-								 * U = change owner */
+	char		subtype;		/* A = add column, T = alter column, D =
+								 * drop column, C = add constraint, X =
+								 * drop constraint, E = add toast table, U
+								 * = change owner */
 	char	   *relname;		/* table to work on */
 	InhOption	inhOpt;			/* recursively act on children? */
-	char	   *name;			/* column or constraint name to act on, or new owner */
+	char	   *name;			/* column or constraint name to act on, or
+								 * new owner */
 	Node	   *def;			/* definition of new column or constraint */
 	int			behavior;		/* CASCADE or RESTRICT drop behavior */
 } AlterTableStmt;
@@ -414,11 +416,11 @@ typedef struct DefineStmt
  * ----------------------
  */
 
-#define DROP_TABLE    1
+#define DROP_TABLE	  1
 #define DROP_SEQUENCE 2
-#define DROP_VIEW     3
-#define DROP_INDEX    4
-#define DROP_RULE     5
+#define DROP_VIEW	  3
+#define DROP_INDEX	  4
+#define DROP_RULE	  5
 #define DROP_TYPE_P   6
 
 typedef struct DropStmt
@@ -798,10 +800,11 @@ typedef struct InsertStmt
 	NodeTag		type;
 	char	   *relname;		/* relation to insert into */
 	List	   *cols;			/* optional: names of the target columns */
+
 	/*
-	 * An INSERT statement has *either* VALUES or SELECT, never both.
-	 * If VALUES, a targetList is supplied (empty for DEFAULT VALUES).
-	 * If SELECT, a complete SelectStmt (or set-operation tree) is supplied.
+	 * An INSERT statement has *either* VALUES or SELECT, never both. If
+	 * VALUES, a targetList is supplied (empty for DEFAULT VALUES). If
+	 * SELECT, a complete SelectStmt (or set-operation tree) is supplied.
 	 */
 	List	   *targetList;		/* the target list (of ResTarget) */
 	Node	   *selectStmt;		/* the source SELECT */
@@ -857,6 +860,7 @@ typedef enum SetOperation
 typedef struct SelectStmt
 {
 	NodeTag		type;
+
 	/*
 	 * These fields are used only in "leaf" SelectStmts.
 	 */
@@ -870,6 +874,7 @@ typedef struct SelectStmt
 	Node	   *whereClause;	/* WHERE qualification */
 	List	   *groupClause;	/* GROUP BY clauses */
 	Node	   *havingClause;	/* HAVING conditional-expression */
+
 	/*
 	 * These fields are used in both "leaf" SelectStmts and upper-level
 	 * SelectStmts.  portalname/binary may only be set at the top level.
@@ -880,6 +885,7 @@ typedef struct SelectStmt
 	Node	   *limitOffset;	/* # of result tuples to skip */
 	Node	   *limitCount;		/* # of result tuples to return */
 	List	   *forUpdate;		/* FOR UPDATE clause */
+
 	/*
 	 * These fields are used only in upper-level SelectStmts.
 	 */
@@ -910,7 +916,8 @@ typedef struct SetOperationStmt
 	/* Eventually add fields for CORRESPONDING spec here */
 
 	/* Fields derived during parse analysis: */
-	List	   *colTypes;		/* integer list of OIDs of output column types */
+	List	   *colTypes;		/* integer list of OIDs of output column
+								 * types */
 } SetOperationStmt;
 
 /****************************************************************************
@@ -1237,15 +1244,18 @@ typedef struct TargetEntry
 typedef struct RangeTblEntry
 {
 	NodeTag		type;
+
 	/*
 	 * Fields valid for a plain relation RTE (else NULL/zero):
 	 */
 	char	   *relname;		/* real name of the relation */
 	Oid			relid;			/* OID of the relation */
+
 	/*
 	 * Fields valid for a subquery RTE (else NULL):
 	 */
 	Query	   *subquery;		/* the sub-query */
+
 	/*
 	 * Fields valid in all RTEs:
 	 */
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 49319e57c6778c8acbf4a48933e5de9bc79cb1d8..1ee5e93cb492d75a6ef8182eb8ad5ca5ec07d75b 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: plannodes.h,v 1.48 2001/03/04 15:43:33 momjian Exp $
+ * $Id: plannodes.h,v 1.49 2001/03/22 04:00:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -152,7 +152,7 @@ typedef struct Result
  *		Generate the concatenation of the results of sub-plans.
  *
  * Append nodes are sometimes used to switch between several result relations
- * (when the target of an UPDATE or DELETE is an inheritance set).  Such a
+ * (when the target of an UPDATE or DELETE is an inheritance set).	Such a
  * node will have isTarget true.  The Append executor is then responsible
  * for updating the executor state to point at the correct target relation
  * whenever it switches subplans.
@@ -215,11 +215,11 @@ typedef struct TidScan
  *
  * SubqueryScan is for scanning the output of a sub-query in the range table.
  * We need a special plan node above the sub-query's plan as a place to switch
- * execution contexts.  Although we are not scanning a physical relation,
+ * execution contexts.	Although we are not scanning a physical relation,
  * we make this a descendant of Scan anyway for code-sharing purposes.
  *
  * Note: we store the sub-plan in the type-specific subplan field, not in
- * the generic lefttree field as you might expect.  This is because we do
+ * the generic lefttree field as you might expect.	This is because we do
  * not want plan-tree-traversal routines to recurse into the subplan without
  * knowing that they are changing Query contexts.
  * ----------------
@@ -420,7 +420,7 @@ typedef struct Tee
 	List	   *rtentries;		/* the range table for the plan below the
 								 * Tee may be different than the parent
 								 * plans */
-} Tee;
+}			Tee;
 
 #endif
 
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index f5cd6ea461d8f5d73b12b16833101d2f020dc9e5..3ae8e09f57a30468fdece0f7fe9098a3ca05653f 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: primnodes.h,v 1.52 2001/02/14 21:35:05 tgl Exp $
+ * $Id: primnodes.h,v 1.53 2001/03/22 04:00:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,17 +54,17 @@ typedef struct FunctionCache *FunctionCachePtr;
  */
 typedef struct Resdom
 {
-	NodeTag		type;		
-	AttrNumber	resno;		/* attribute number */
-	Oid			restype;	/* type of the value */
-	int32		restypmod;	/* type-specific modifier of the value */
-	char	   *resname;	/* name of the resdom (could be NULL) */
+	NodeTag		type;
+	AttrNumber	resno;			/* attribute number */
+	Oid			restype;		/* type of the value */
+	int32		restypmod;		/* type-specific modifier of the value */
+	char	   *resname;		/* name of the resdom (could be NULL) */
 	Index		ressortgroupref;
-							/* nonzero if referenced by a sort/group clause */
-	Index		reskey;		/* order of key in a sort (for those > 0) */
-	Oid			reskeyop;	/* sort operator's regproc Oid */
-	bool		resjunk;	/* set to true to eliminate the attribute
- *						       from final target list */
+	/* nonzero if referenced by a sort/group clause */
+	Index		reskey;			/* order of key in a sort (for those > 0) */
+	Oid			reskeyop;		/* sort operator's regproc Oid */
+	bool		resjunk;		/* set to true to eliminate the attribute
+								 * from final target list */
 } Resdom;
 
 /*
@@ -73,25 +73,23 @@ typedef struct Resdom
 typedef struct Fjoin
 {
 	NodeTag		type;
-	bool		fj_initialized;	/* true if the Fjoin has already been
-								 * initialized for the current target
-								 * list evaluation */
-	int			fj_nNodes;		/* The number of Iter nodes returning
-								 * sets that the node will flatten */
+	bool		fj_initialized; /* true if the Fjoin has already been
+								 * initialized for the current target list
+								 * evaluation */
+	int			fj_nNodes;		/* The number of Iter nodes returning sets
+								 * that the node will flatten */
 	List	   *fj_innerNode;	/* exactly one Iter node.  We eval every
 								 * node in the outerList once then eval
 								 * the inner node to completion pair the
 								 * outerList result vector with each inner
-								 * result to form the full result.  When
+								 * result to form the full result.	When
 								 * the inner has been exhausted, we get
 								 * the next outer result vector and reset
-								 * the inner.
-								 */
+								 * the inner. */
 	DatumPtr	fj_results;		/* The complete (flattened) result vector */
 	BoolPtr		fj_alwaysDone;	/* a null vector to indicate sets with a
 								 * cardinality of 0, we treat them as the
-								 * set {NULL}.
-								 */
+								 * set {NULL}. */
 } Fjoin;
 
 
@@ -111,11 +109,11 @@ typedef enum OpType
 typedef struct Expr
 {
 	NodeTag		type;
-	Oid			typeOid;	/* oid of the type of this expression */
-	OpType		opType;		/* type of this expression */
-	Node	   *oper;		/* operator node if needed (Oper, Func, or
-							 * SubPlan) */
-	List	   *args;		/* arguments to this expression */
+	Oid			typeOid;		/* oid of the type of this expression */
+	OpType		opType;			/* type of this expression */
+	Node	   *oper;			/* operator node if needed (Oper, Func, or
+								 * SubPlan) */
+	List	   *args;			/* arguments to this expression */
 } Expr;
 
 /*
@@ -139,17 +137,22 @@ typedef struct Expr
 typedef struct Var
 {
 	NodeTag		type;
-	Index		varno;		/* index of this var's relation in the range
-							 * table (could also be INNER or OUTER) */
-	AttrNumber	varattno;	/* attribute number of this var, or zero for all */
-	Oid			vartype;	/* pg_type tuple OID for the type of this var */
-	int32		vartypmod;	/* pg_attribute typmod value */
+	Index		varno;			/* index of this var's relation in the
+								 * range table (could also be INNER or
+								 * OUTER) */
+	AttrNumber	varattno;		/* attribute number of this var, or zero
+								 * for all */
+	Oid			vartype;		/* pg_type tuple OID for the type of this
+								 * var */
+	int32		vartypmod;		/* pg_attribute typmod value */
 	Index		varlevelsup;
-							/* for subquery variables referencing outer
-							 * relations; 0 in a normal var, >0 means N
-							 * levels up */
-	Index		varnoold;	/* original value of varno, for debugging */
-	AttrNumber	varoattno;	/* original value of varattno */
+
+	/*
+	 * for subquery variables referencing outer relations; 0 in a normal
+	 * var, >0 means N levels up
+	 */
+	Index		varnoold;		/* original value of varno, for debugging */
+	AttrNumber	varoattno;		/* original value of varattno */
 } Var;
 
 /*--------------------
@@ -173,13 +176,13 @@ typedef struct Var
 typedef struct Oper
 {
 	NodeTag		type;
-	Oid			opno;		/* PG_OPERATOR OID of the operator */
-	Oid			opid;		/* PG_PROC OID for the operator's underlying
-							 * function */
+	Oid			opno;			/* PG_OPERATOR OID of the operator */
+	Oid			opid;			/* PG_PROC OID for the operator's
+								 * underlying function */
 	Oid			opresulttype;
-							/* PG_TYPE OID of the operator's return value */
+	/* PG_TYPE OID of the operator's return value */
 	FunctionCachePtr op_fcache;
-							/* runtime state while running the function */
+	/* runtime state while running the function */
 } Oper;
 
 
@@ -195,12 +198,12 @@ typedef struct Const
 	bool		constisnull;	/* whether the constant is null (if true,
 								 * the other fields are undefined) */
 	bool		constbyval;		/* whether the information in constvalue
-								 * if passed by value.  If true, then all
+								 * if passed by value.	If true, then all
 								 * the information is stored in the datum.
-								 * If false, then the datum contains a pointer
-								 * to the information. */
-	bool		constisset;		/* whether the const represents a set.
-								 * The const value corresponding will be the
+								 * If false, then the datum contains a
+								 * pointer to the information. */
+	bool		constisset;		/* whether the const represents a set. The
+								 * const value corresponding will be the
 								 * query that defines the set. */
 	bool		constiscast;
 } Const;
@@ -230,12 +233,13 @@ typedef struct Const
 typedef struct Param
 {
 	NodeTag		type;
-	int			paramkind;	/* specifies the kind of parameter.  See above */
-	AttrNumber	paramid;	/* numeric identifier for literal-constant
-							 * parameters ("$1") */
-	char	   *paramname;	/* attribute name for tuple-substitution
-							 * parameters ("$.foo") */
-	Oid			paramtype;	/* PG_TYPE OID of the parameter's value */
+	int			paramkind;		/* specifies the kind of parameter.  See
+								 * above */
+	AttrNumber	paramid;		/* numeric identifier for literal-constant
+								 * parameters ("$1") */
+	char	   *paramname;		/* attribute name for tuple-substitution
+								 * parameters ("$.foo") */
+	Oid			paramtype;		/* PG_TYPE OID of the parameter's value */
 } Param;
 
 
@@ -245,13 +249,16 @@ typedef struct Param
 typedef struct Func
 {
 	NodeTag		type;
-	Oid			funcid;		/* PG_PROC OID of the function */
-	Oid			functype;	/* PG_TYPE OID of the function's return value */
+	Oid			funcid;			/* PG_PROC OID of the function */
+	Oid			functype;		/* PG_TYPE OID of the function's return
+								 * value */
 	FunctionCachePtr func_fcache;
-							/* runtime state while running this function.
-							 * Where we are in the execution of the function
-							 * if it returns more than one value, etc.
-							 * See utils/fcache.h */
+
+	/*
+	 * runtime state while running this function. Where we are in the
+	 * execution of the function if it returns more than one value, etc.
+	 * See utils/fcache.h
+	 */
 } Func;
 
 /* ----------------
@@ -274,14 +281,16 @@ typedef struct Iter
 typedef struct Aggref
 {
 	NodeTag		type;
-	char	   *aggname;	/* name of the aggregate */
-	Oid			basetype;	/* base type Oid of the aggregate
-							 * (ie, input type) */
-	Oid			aggtype;	/* type Oid of final result of the aggregate */
-	Node	   *target;		/* attribute or expression we are aggregating on */
-	bool		aggstar;	/* TRUE if argument was really '*' */
-	bool		aggdistinct;/* TRUE if it's agg(DISTINCT ...) */
-	int			aggno;		/* workspace for executor (see nodeAgg.c) */
+	char	   *aggname;		/* name of the aggregate */
+	Oid			basetype;		/* base type Oid of the aggregate (ie,
+								 * input type) */
+	Oid			aggtype;		/* type Oid of final result of the
+								 * aggregate */
+	Node	   *target;			/* attribute or expression we are
+								 * aggregating on */
+	bool		aggstar;		/* TRUE if argument was really '*' */
+	bool		aggdistinct;	/* TRUE if it's agg(DISTINCT ...) */
+	int			aggno;			/* workspace for executor (see nodeAgg.c) */
 } Aggref;
 
 /* ----------------
@@ -343,12 +352,14 @@ typedef enum SubLinkType
 typedef struct SubLink
 {
 	NodeTag		type;
-	SubLinkType subLinkType;/* EXISTS, ALL, ANY, MULTIEXPR, EXPR */
-	bool		useor;		/* TRUE to combine column results with "OR"
-							 * not "AND" */
-	List	   *lefthand;	/* list of outer-query expressions on the left */
-	List	   *oper;		/* list of Oper nodes for combining operators */
-	Node	   *subselect;	/* subselect as Query* or parsetree */
+	SubLinkType subLinkType;	/* EXISTS, ALL, ANY, MULTIEXPR, EXPR */
+	bool		useor;			/* TRUE to combine column results with
+								 * "OR" not "AND" */
+	List	   *lefthand;		/* list of outer-query expressions on the
+								 * left */
+	List	   *oper;			/* list of Oper nodes for combining
+								 * operators */
+	Node	   *subselect;		/* subselect as Query* or parsetree */
 } SubLink;
 
 /* ----------------
@@ -382,19 +393,19 @@ typedef struct SubLink
 typedef struct ArrayRef
 {
 	NodeTag		type;
-	int			refattrlength;		/* typlen of array type */
-	int			refelemlength;		/* typlen of the array element type */
-	Oid			refelemtype;		/* type of the result of the ArrayRef
-								 	 * operation */
-	bool		refelembyval;		/* is the element type pass-by-value? */
-	List	   *refupperindexpr;	/* expressions that evaluate to upper
-								 	 * array indexes */
-	List	   *reflowerindexpr;	/* expressions that evaluate to lower
-								 	 * array indexes */
-	Node	   *refexpr;			/* the expression that evaluates to an
-									 * array value */
-	Node	   *refassgnexpr;		/* expression for the source value, or NULL
-								 	 * if fetch */
+	int			refattrlength;	/* typlen of array type */
+	int			refelemlength;	/* typlen of the array element type */
+	Oid			refelemtype;	/* type of the result of the ArrayRef
+								 * operation */
+	bool		refelembyval;	/* is the element type pass-by-value? */
+	List	   *refupperindexpr;/* expressions that evaluate to upper
+								 * array indexes */
+	List	   *reflowerindexpr;/* expressions that evaluate to lower
+								 * array indexes */
+	Node	   *refexpr;		/* the expression that evaluates to an
+								 * array value */
+	Node	   *refassgnexpr;	/* expression for the source value, or
+								 * NULL if fetch */
 } ArrayRef;
 
 /* ----------------
@@ -459,7 +470,7 @@ typedef struct RelabelType
  *
  * NOTE: the qualification expressions present in JoinExpr nodes are
  * *in addition to* the query's main WHERE clause, which appears as the
- * qual of the top-level FromExpr.  The reason for associating quals with
+ * qual of the top-level FromExpr.	The reason for associating quals with
  * specific nodes in the jointree is that the position of a qual is critical
  * when outer joins are present.  (If we enforce a qual too soon or too late,
  * that may cause the outer join to produce the wrong set of NULL-extended
@@ -489,12 +500,12 @@ typedef struct RangeTblRef
 /*----------
  * JoinExpr - for SQL JOIN expressions
  *
- * isNatural, using, and quals are interdependent.  The user can write only
+ * isNatural, using, and quals are interdependent.	The user can write only
  * one of NATURAL, USING(), or ON() (this is enforced by the grammar).
  * If he writes NATURAL then parse analysis generates the equivalent USING()
  * list, and from that fills in "quals" with the right equality comparisons.
  * If he writes USING() then "quals" is filled with equality comparisons.
- * If he writes ON() then only "quals" is set.  Note that NATURAL/USING
+ * If he writes ON() then only "quals" is set.	Note that NATURAL/USING
  * are not equivalent to ON() since they also affect the output column list.
  *
  * alias is an Attr node representing the AS alias-clause attached to the
@@ -519,7 +530,8 @@ typedef struct JoinExpr
 	Node	   *quals;			/* qualifiers on join, if any */
 	struct Attr *alias;			/* user-written alias clause, if any */
 	List	   *colnames;		/* output column names (list of String) */
-	List	   *colvars;		/* output column nodes (list of expressions) */
+	List	   *colvars;		/* output column nodes (list of
+								 * expressions) */
 } JoinExpr;
 
 /*----------
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 4761d4ba7f28a7ffaa906b09679c396b0e2d7dc8..f643ef879689640186250b344d4734f80aa6dc49 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: relation.h,v 1.53 2001/01/24 19:43:26 momjian Exp $
+ * $Id: relation.h,v 1.54 2001/03/22 04:00:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -159,7 +159,7 @@ typedef struct RelOptInfo
 	List	   *baserestrictinfo;		/* RestrictInfo structures (if
 										 * base rel) */
 	Cost		baserestrictcost;		/* cost of evaluating the above */
-	Relids		outerjoinset;			/* integer list of base relids */
+	Relids		outerjoinset;	/* integer list of base relids */
 	List	   *joininfo;		/* JoinInfo structures */
 	List	   *innerjoin;		/* potential indexscans for nestloop joins */
 
@@ -436,7 +436,7 @@ typedef struct HashPath
  * When we construct a join rel that includes all the base rels referenced
  * in a multi-relation restriction clause, we place that clause into the
  * joinrestrictinfo lists of paths for the join rel, if neither left nor
- * right sub-path includes all base rels referenced in the clause.  The clause
+ * right sub-path includes all base rels referenced in the clause.	The clause
  * will be applied at that join level, and will not propagate any further up
  * the join tree.  (Note: the "predicate migration" code was once intended to
  * push restriction clauses up and down the plan tree based on evaluation
@@ -512,8 +512,8 @@ typedef struct RestrictInfo
 	Oid			hashjoinoperator;		/* copy of clause operator */
 
 	/* cache space for hashclause processing; -1 if not yet set */
-	Selectivity	left_dispersion;	/* dispersion of left side */
-	Selectivity	right_dispersion;	/* dispersion of right side */
+	Selectivity left_dispersion;/* dispersion of left side */
+	Selectivity right_dispersion;		/* dispersion of right side */
 } RestrictInfo;
 
 /*
@@ -533,7 +533,7 @@ typedef struct RestrictInfo
 typedef struct JoinInfo
 {
 	NodeTag		type;
-	Relids		unjoined_relids; /* some rels not yet part of my RelOptInfo */
+	Relids		unjoined_relids;/* some rels not yet part of my RelOptInfo */
 	List	   *jinfo_restrictinfo;		/* relevant RestrictInfos */
 } JoinInfo;
 
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index f6aca6b7ef73b4d9a229fbcd6cd594106012b6e9..a02ef9c77c30d432e4688071b200c652a179ac26 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: clauses.h,v 1.42 2001/01/24 19:43:26 momjian Exp $
+ * $Id: clauses.h,v 1.43 2001/03/22 04:00:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,8 +20,8 @@
  *	Flag bits returned by get_relattval().
  *	These are used in selectivity-estimation routines, too.
  */
-#define	SEL_CONSTANT 	1		/* operator's non-var arg is a constant */
-#define	SEL_RIGHT		2		/* operator's non-var arg is on the right */
+#define SEL_CONSTANT	1		/* operator's non-var arg is a constant */
+#define SEL_RIGHT		2		/* operator's non-var arg is on the right */
 
 
 extern Expr *make_clause(int type, Node *oper, List *args);
@@ -71,13 +71,13 @@ extern void CommuteClause(Expr *clause);
 extern Node *eval_const_expressions(Node *node);
 
 extern bool expression_tree_walker(Node *node, bool (*walker) (),
-								   void *context);
+											   void *context);
 extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
-									 void *context);
+												 void *context);
 extern bool query_tree_walker(Query *query, bool (*walker) (),
-							  void *context, bool visitQueryRTEs);
+									 void *context, bool visitQueryRTEs);
 extern void query_tree_mutator(Query *query, Node *(*mutator) (),
-							   void *context, bool visitQueryRTEs);
+									 void *context, bool visitQueryRTEs);
 
 #define is_subplan(clause)	((clause) != NULL && \
 							 IsA(clause, Expr) && \
diff --git a/src/include/optimizer/geqo.h b/src/include/optimizer/geqo.h
index e1229c3e1a9ff53e999ddbcd9e146972e470d80d..34b7065f76c2b377448f8fb07e0dad7203c88061 100644
--- a/src/include/optimizer/geqo.h
+++ b/src/include/optimizer/geqo.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo.h,v 1.23 2001/01/24 19:43:26 momjian Exp $
+ * $Id: geqo.h,v 1.24 2001/03/22 04:00:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,21 +46,25 @@
  * Configuration options
  */
 /* If you change these, update backend/utils/misc/postgresql.sample.conf */
-extern int  	    Geqo_pool_size;
-#define DEFAULT_GEQO_POOL_SIZE 0 /* = default based on no. of relations. */
+extern int	Geqo_pool_size;
+
+#define DEFAULT_GEQO_POOL_SIZE 0/* = default based on no. of relations. */
 #define MIN_GEQO_POOL_SIZE 128
 #define MAX_GEQO_POOL_SIZE 1024
 
-extern int          Geqo_effort; /* 1 .. inf, only used to calculate generations default */
-extern int  	    Geqo_generations; /* 1 .. inf, or 0 to use default based on pool size */
+extern int	Geqo_effort;		/* 1 .. inf, only used to calculate
+								 * generations default */
+extern int	Geqo_generations;	/* 1 .. inf, or 0 to use default based on
+								 * pool size */
+
+extern double Geqo_selection_bias;
 
-extern double 		Geqo_selection_bias;
 /* If you change these, update backend/utils/misc/postgresql.sample.conf */
 #define DEFAULT_GEQO_SELECTION_BIAS 2.0
 #define MIN_GEQO_SELECTION_BIAS 1.5
 #define MAX_GEQO_SELECTION_BIAS 2.0
 
-extern int          Geqo_random_seed; /* or negative to use current time */
+extern int	Geqo_random_seed;	/* or negative to use current time */
 
 
 /* routines in geqo_main.c */
@@ -68,9 +72,9 @@ extern RelOptInfo *geqo(Query *root, int number_of_rels, List *initial_rels);
 
 /* routines in geqo_eval.c */
 extern Cost geqo_eval(Query *root, List *initial_rels,
-					  Gene *tour, int num_gene);
+		  Gene *tour, int num_gene);
 extern RelOptInfo *gimme_tree(Query *root, List *initial_rels,
-							  Gene *tour, int num_gene,
-							  int rel_count, RelOptInfo *old_rel);
+		   Gene *tour, int num_gene,
+		   int rel_count, RelOptInfo *old_rel);
 
 #endif	 /* GEQO_H */
diff --git a/src/include/optimizer/geqo_pool.h b/src/include/optimizer/geqo_pool.h
index 5c7e24c9e75e17740bcec18b0c2ab18f85f0f4fc..264bacba8f37f7ad2dec6623823947d7d6a2f3b0 100644
--- a/src/include/optimizer/geqo_pool.h
+++ b/src/include/optimizer/geqo_pool.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_pool.h,v 1.11 2001/01/24 19:43:26 momjian Exp $
+ * $Id: geqo_pool.h,v 1.12 2001/03/22 04:00:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,7 @@ extern Pool *alloc_pool(int pool_size, int string_length);
 extern void free_pool(Pool *pool);
 
 extern void random_init_pool(Query *root, List *initial_rels,
-							 Pool *pool, int strt, int stop);
+				 Pool *pool, int strt, int stop);
 extern Chromosome *alloc_chromo(int string_length);
 extern void free_chromo(Chromosome *chromo);
 
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index 7e000034761e03e467c4875aa535ddcbd929a05d..5b71eded86fcac8f21a5732ef81d8906fd9263a3 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pathnode.h,v 1.34 2001/02/16 00:03:06 tgl Exp $
+ * $Id: pathnode.h,v 1.35 2001/03/22 04:00:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,29 +37,29 @@ extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths);
 extern Path *create_subqueryscan_path(RelOptInfo *rel);
 
 extern NestPath *create_nestloop_path(RelOptInfo *joinrel,
-									  JoinType jointype,
-									  Path *outer_path,
-									  Path *inner_path,
-									  List *restrict_clauses,
-									  List *pathkeys);
+					 JoinType jointype,
+					 Path *outer_path,
+					 Path *inner_path,
+					 List *restrict_clauses,
+					 List *pathkeys);
 
 extern MergePath *create_mergejoin_path(RelOptInfo *joinrel,
-										JoinType jointype,
-										Path *outer_path,
-										Path *inner_path,
-										List *restrict_clauses,
-										List *pathkeys,
-										List *mergeclauses,
-										List *outersortkeys,
-										List *innersortkeys);
+					  JoinType jointype,
+					  Path *outer_path,
+					  Path *inner_path,
+					  List *restrict_clauses,
+					  List *pathkeys,
+					  List *mergeclauses,
+					  List *outersortkeys,
+					  List *innersortkeys);
 
 extern HashPath *create_hashjoin_path(RelOptInfo *joinrel,
-									  JoinType jointype,
-									  Path *outer_path,
-									  Path *inner_path,
-									  List *restrict_clauses,
-									  List *hashclauses,
-									  Selectivity innerdispersion);
+					 JoinType jointype,
+					 Path *outer_path,
+					 Path *inner_path,
+					 List *restrict_clauses,
+					 List *hashclauses,
+					 Selectivity innerdispersion);
 
 /*
  * prototypes for relnode.c
@@ -67,9 +67,9 @@ extern HashPath *create_hashjoin_path(RelOptInfo *joinrel,
 extern RelOptInfo *get_base_rel(Query *root, int relid);
 extern RelOptInfo *make_base_rel(Query *root, int relid);
 extern RelOptInfo *get_join_rel(Query *root,
-								RelOptInfo *outer_rel,
-								RelOptInfo *inner_rel,
-								JoinType jointype,
-								List **restrictlist_ptr);
+			 RelOptInfo *outer_rel,
+			 RelOptInfo *inner_rel,
+			 JoinType jointype,
+			 List **restrictlist_ptr);
 
 #endif	 /* PATHNODE_H */
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 5f0acdd472950c07c506333b9f870b601c34c987..ac67f6a6551cbadbb127dfe330dbc8d0ca80d05e 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: paths.h,v 1.51 2001/01/24 19:43:26 momjian Exp $
+ * $Id: paths.h,v 1.52 2001/03/22 04:00:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -61,10 +61,10 @@ extern void create_tidscan_paths(Query *root, RelOptInfo *rel);
  *	   routines to create join paths
  */
 extern void add_paths_to_joinrel(Query *root, RelOptInfo *joinrel,
-								 RelOptInfo *outerrel,
-								 RelOptInfo *innerrel,
-								 JoinType jointype,
-								 List *restrictlist);
+					 RelOptInfo *outerrel,
+					 RelOptInfo *innerrel,
+					 JoinType jointype,
+					 List *restrictlist);
 
 /*
  * joinrels.c
@@ -72,11 +72,11 @@ extern void add_paths_to_joinrel(Query *root, RelOptInfo *joinrel,
  */
 extern List *make_rels_by_joins(Query *root, int level, List **joinrels);
 extern List *make_rels_by_clause_joins(Query *root,
-									   RelOptInfo *old_rel,
-									   List *other_rels);
+						  RelOptInfo *old_rel,
+						  List *other_rels);
 extern List *make_rels_by_clauseless_joins(Query *root,
-										   RelOptInfo *old_rel,
-										   List *other_rels);
+							  RelOptInfo *old_rel,
+							  List *other_rels);
 extern RelOptInfo *make_jointree_rel(Query *root, Node *jtnode);
 
 /*
@@ -97,7 +97,7 @@ extern List *canonicalize_pathkeys(Query *root, List *pathkeys);
 extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2);
 extern bool pathkeys_contained_in(List *keys1, List *keys2);
 extern PathKeysComparison compare_noncanonical_pathkeys(List *keys1,
-														List *keys2);
+							  List *keys2);
 extern bool noncanonical_pathkeys_contained_in(List *keys1, List *keys2);
 extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
 							   CostSelector cost_criterion);
@@ -108,22 +108,22 @@ extern List *build_index_pathkeys(Query *root, RelOptInfo *rel,
 					 IndexOptInfo *index,
 					 ScanDirection scandir);
 extern List *build_join_pathkeys(Query *root,
-								 RelOptInfo *joinrel,
-								 List *outer_pathkeys);
+					RelOptInfo *joinrel,
+					List *outer_pathkeys);
 extern List *make_pathkeys_for_sortclauses(List *sortclauses,
 							  List *tlist);
 extern List *find_mergeclauses_for_pathkeys(Query *root,
-											List *pathkeys,
-											List *restrictinfos);
+							   List *pathkeys,
+							   List *restrictinfos);
 extern List *make_pathkeys_for_mergeclauses(Query *root,
-											List *mergeclauses,
-											RelOptInfo *rel);
-extern int	pathkeys_useful_for_merging(Query *root,
-										RelOptInfo *rel,
-										List *pathkeys);
+							   List *mergeclauses,
+							   RelOptInfo *rel);
+extern int pathkeys_useful_for_merging(Query *root,
+							RelOptInfo *rel,
+							List *pathkeys);
 extern int	pathkeys_useful_for_ordering(Query *root, List *pathkeys);
 extern List *truncate_useless_pathkeys(Query *root,
-									   RelOptInfo *rel,
-									   List *pathkeys);
+						  RelOptInfo *rel,
+						  List *pathkeys);
 
 #endif	 /* PATHS_H */
diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h
index d4854039efbb9778b04b395aaf1197c1fda2afe5..5d3062d981ce782a97005d464d16dace736a1e35 100644
--- a/src/include/optimizer/plancat.h
+++ b/src/include/optimizer/plancat.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: plancat.h,v 1.21 2001/01/24 19:43:26 momjian Exp $
+ * $Id: plancat.h,v 1.22 2001/03/22 04:00:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 
 
 extern void relation_info(Oid relationObjectId,
-						  bool *hasindex, long *pages, double *tuples);
+			  bool *hasindex, long *pages, double *tuples);
 
 extern List *find_secondary_indexes(Oid relationObjectId);
 
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 79112f6fb4e42ec9a7e97510a0582d346c3bd091..75b05fa27814405fab5fdf8375c0d800dc83bfbd 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: planmain.h,v 1.49 2001/01/24 19:43:26 momjian Exp $
+ * $Id: planmain.h,v 1.50 2001/03/22 04:00:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,20 +27,20 @@ extern Plan *query_planner(Query *root, List *tlist, double tuple_fraction);
  */
 extern Plan *create_plan(Query *root, Path *best_path);
 extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual,
-									   Index scanrelid, Plan *subplan);
+				  Index scanrelid, Plan *subplan);
 extern Append *make_append(List *appendplans, bool isTarget, List *tlist);
 extern Sort *make_sort(List *tlist, Plan *lefttree, int keycount);
 extern Sort *make_sort_from_pathkeys(List *tlist, Plan *lefttree,
-									 List *pathkeys);
+						List *pathkeys);
 extern Agg *make_agg(List *tlist, List *qual, Plan *lefttree);
 extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
 		   AttrNumber *grpColIdx, Plan *lefttree);
 extern Material *make_material(List *tlist, Plan *lefttree);
 extern Unique *make_unique(List *tlist, Plan *lefttree, List *distinctList);
 extern Limit *make_limit(List *tlist, Plan *lefttree,
-						 Node *limitOffset, Node *limitCount);
+		   Node *limitOffset, Node *limitCount);
 extern SetOp *make_setop(SetOpCmd cmd, List *tlist, Plan *lefttree,
-						 List *distinctList, AttrNumber flagColIdx);
+		   List *distinctList, AttrNumber flagColIdx);
 extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
 
 /*
@@ -50,7 +50,7 @@ extern void build_base_rel_tlists(Query *root, List *tlist);
 extern Relids distribute_quals_to_rels(Query *root, Node *jtnode);
 extern List *add_missing_rels_to_query(Query *root, Node *jtnode);
 extern void process_implied_equality(Query *root, Node *item1, Node *item2,
-									 Oid sortop1, Oid sortop2);
+						 Oid sortop1, Oid sortop2);
 
 /*
  * prototypes for plan/setrefs.c
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index 9caf584975e228ade6522e5de35c15afd0ea630b..b1ca99fed520cbdab5c3f45a9fb0ac87dfb1569d 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: prep.h,v 1.26 2001/01/24 19:43:26 momjian Exp $
+ * $Id: prep.h,v 1.27 2001/03/22 04:00:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ extern List *find_all_inheritors(Oid parentrel);
 extern List *expand_inherted_rtentry(Query *parse, Index rti);
 
 extern Node *adjust_inherited_attrs(Node *node,
-									Index old_rt_index, Oid old_relid,
-									Index new_rt_index, Oid new_relid);
+					   Index old_rt_index, Oid old_relid,
+					   Index new_rt_index, Oid new_relid);
 
 #endif	 /* PREP_H */
diff --git a/src/include/optimizer/restrictinfo.h b/src/include/optimizer/restrictinfo.h
index 672e9206dfb9e33d09918733e371d87242d8483c..084d8e615606d8fa02cfbd8086c2891484a6a0d6 100644
--- a/src/include/optimizer/restrictinfo.h
+++ b/src/include/optimizer/restrictinfo.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: restrictinfo.h,v 1.10 2001/01/24 19:43:26 momjian Exp $
+ * $Id: restrictinfo.h,v 1.11 2001/03/22 04:00:56 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,6 +19,6 @@
 extern bool restriction_is_or_clause(RestrictInfo *restrictinfo);
 extern List *get_actual_clauses(List *restrictinfo_list);
 extern void get_actual_join_clauses(List *restrictinfo_list,
-									List **joinquals, List **otherquals);
+						List **joinquals, List **otherquals);
 
 #endif	 /* RESTRICTINFO_H */
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index 31d5542efc28a8d4cfa19b3f0b08d24c0769ee87..bf05dc6d7e81c6dca994c895602b2b33cfc1f8e5 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_clause.h,v 1.23 2001/02/14 21:35:05 tgl Exp $
+ * $Id: parse_clause.h,v 1.24 2001/03/22 04:00:56 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 
 extern void transformFromClause(ParseState *pstate, List *frmList);
 extern int setTargetTable(ParseState *pstate, char *relname,
-						  bool inh, bool alsoSource);
+			   bool inh, bool alsoSource);
 extern bool interpretInhOption(InhOption inhOpt);
 extern Node *transformWhereClause(ParseState *pstate, Node *where);
 extern List *transformGroupClause(ParseState *pstate, List *grouplist,
diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h
index 09cb81544748b3ba51afb1607d9cc9113ed367e5..d8c7e430cd95ce8955bf7fa167514478a8c48f2d 100644
--- a/src/include/parser/parse_coerce.h
+++ b/src/include/parser/parse_coerce.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_coerce.h,v 1.26 2001/01/24 19:43:27 momjian Exp $
+ * $Id: parse_coerce.h,v 1.27 2001/03/22 04:00:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,9 +136,9 @@ extern Node *coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
 extern Node *coerce_type_typmod(ParseState *pstate, Node *node,
 				   Oid targetTypeId, int32 atttypmod);
 
-extern Oid select_common_type(List *typeids, const char *context);
+extern Oid	select_common_type(List *typeids, const char *context);
 extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
-								   Oid targetTypeId,
-								   const char *context);
+					  Oid targetTypeId,
+					  const char *context);
 
 #endif	 /* PARSE_COERCE_H */
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index 205d993e8a4a27803fd1fa5806c61bb526d2763e..7e0b3f77527853bbd9eee55084de22bc85026204 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_func.h,v 1.28 2001/01/24 19:43:27 momjian Exp $
+ * $Id: parse_func.h,v 1.29 2001/03/22 04:00:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,15 +39,15 @@ typedef struct _CandidateList
 }		   *CandidateList;
 
 extern Node *ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr,
-									 int precedence);
+						int precedence);
 extern Node *ParseFuncOrColumn(ParseState *pstate,
-							   char *funcname, List *fargs,
-							   bool agg_star, bool agg_distinct,
-							   int precedence);
+				  char *funcname, List *fargs,
+				  bool agg_star, bool agg_distinct,
+				  int precedence);
 
 extern bool func_get_detail(char *funcname, int nargs, Oid *argtypes,
-							Oid *funcid, Oid *rettype,
-							bool *retset, Oid **true_typeids);
+				Oid *funcid, Oid *rettype,
+				bool *retset, Oid **true_typeids);
 
 extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
 
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index bb0229abcd17db068a169bc78eb30e06fd38828d..a7c14883ed28b9507b85d990cb216e851a22fb5b 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_node.h,v 1.25 2001/02/14 21:35:05 tgl Exp $
+ * $Id: parse_node.h,v 1.26 2001/03/22 04:00:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,10 +35,10 @@
  */
 typedef struct ParseState
 {
-	struct ParseState *parentParseState; /* stack link */
+	struct ParseState *parentParseState;		/* stack link */
 	List	   *p_rtable;		/* range table so far */
-	List	   *p_joinlist;		/* join items so far (will become
-								 * FromExpr node's fromlist) */
+	List	   *p_joinlist;		/* join items so far (will become FromExpr
+								 * node's fromlist) */
 	List	   *p_namespace;	/* current lookup namespace (join items) */
 	int			p_last_resno;	/* last targetlist resno assigned */
 	List	   *p_forUpdate;	/* FOR UPDATE clause, if any (see gram.y) */
diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h
index 069a9d5be27b36993cb04857ec075821746e6b19..400702fd7a857ec78845301831ac5d15d21e13fe 100644
--- a/src/include/parser/parse_oper.h
+++ b/src/include/parser/parse_oper.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_oper.h,v 1.14 2001/02/16 03:16:58 tgl Exp $
+ * $Id: parse_oper.h,v 1.15 2001/03/22 04:00:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,12 +27,13 @@ extern Operator left_oper(char *op, Oid arg);
 /* Routines to find operators that DO NOT require coercion --- ie, their */
 /* input types are either exactly as given, or binary-compatible */
 extern Operator compatible_oper(char *op, Oid arg1, Oid arg2, bool noError);
+
 /* currently no need for compatible_left_oper/compatible_right_oper */
 
 /* Convenience routines that call compatible_oper() and return either */
 /* the operator OID or the underlying function OID, or InvalidOid if fail */
-extern Oid compatible_oper_opid(char *op, Oid arg1, Oid arg2, bool noError);
-extern Oid compatible_oper_funcid(char *op, Oid arg1, Oid arg2, bool noError);
+extern Oid	compatible_oper_opid(char *op, Oid arg1, Oid arg2, bool noError);
+extern Oid	compatible_oper_funcid(char *op, Oid arg1, Oid arg2, bool noError);
 
 /* Convenience routine that packages a specific call on compatible_oper */
 extern Oid	any_ordering_op(Oid argtype);
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index 274de9e88955376b5091d7040d644c38335093ea..904bde96235f3b84a422be1cc53f7c2fa0878d17 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_relation.h,v 1.22 2001/02/14 21:35:06 tgl Exp $
+ * $Id: parse_relation.h,v 1.23 2001/03/22 04:00:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,33 +17,33 @@
 #include "parser/parse_node.h"
 
 extern Node *refnameRangeOrJoinEntry(ParseState *pstate,
-									 char *refname,
-									 int *sublevels_up);
+						char *refname,
+						int *sublevels_up);
 extern void checkNameSpaceConflicts(ParseState *pstate, Node *namespace1,
-									Node *namespace2);
+						Node *namespace2);
 extern int RTERangeTablePosn(ParseState *pstate,
-							 RangeTblEntry *rte,
-							 int *sublevels_up);
+				  RangeTblEntry *rte,
+				  int *sublevels_up);
 extern Node *colnameToVar(ParseState *pstate, char *colname);
 extern Node *qualifiedNameToVar(ParseState *pstate, char *refname,
-								char *colname, bool implicitRTEOK);
+				   char *colname, bool implicitRTEOK);
 extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
-										 char *relname,
-										 Attr *alias,
-										 bool inh,
-										 bool inFromCl);
+				   char *relname,
+				   Attr *alias,
+				   bool inh,
+				   bool inFromCl);
 extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate,
-													Query *subquery,
-													Attr *alias,
-													bool inFromCl);
+							  Query *subquery,
+							  Attr *alias,
+							  bool inFromCl);
 extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
-						  bool addToJoinList, bool addToNameSpace);
+			  bool addToJoinList, bool addToNameSpace);
 extern RangeTblEntry *addImplicitRTE(ParseState *pstate, char *relname);
 extern void expandRTE(ParseState *pstate, RangeTblEntry *rte,
-					  List **colnames, List **colvars);
+		  List **colnames, List **colvars);
 extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte);
 extern List *expandJoinAttrs(ParseState *pstate, JoinExpr *join,
-							 int sublevels_up);
+				int sublevels_up);
 extern int	attnameAttNum(Relation rd, char *a);
 extern int	specialAttNum(char *a);
 extern Oid	attnumTypeId(Relation rd, int attid);
diff --git a/src/include/port/beos.h b/src/include/port/beos.h
index 5bb31f4c670c22636c0d442e1e43f11205965840..654249545cd53894f48531382d244ce44fbf3c20 100644
--- a/src/include/port/beos.h
+++ b/src/include/port/beos.h
@@ -5,7 +5,7 @@
 
 typedef unsigned char slock_t;
 
-#define AF_UNIX     10 /* no domain sockets on BeOS */
+#define AF_UNIX		10			/* no domain sockets on BeOS */
 
 /* Beos doesn't have all the required getrusage fields */
 #undef HAVE_GETRUSAGE
@@ -40,9 +40,9 @@ union semun
 
 struct sembuf
 {
-	int sem_flg;
-	int sem_op;
-	int sem_num;
+	int			sem_flg;
+	int			sem_op;
+	int			sem_num;
 };
 
 struct shmid_ds
@@ -50,28 +50,33 @@ struct shmid_ds
 	int			dummy;
 	int			shm_nattch;
 };
-	
-int semctl(int semId,int semNum,int flag,union semun);
-int semget(int semKey, int semNum, int flags);
-int semop(int semId, struct sembuf *sops, int flag);
 
-int shmdt(char* shmaddr);
-int* shmat(int memId,int m1,int m2);
-int shmctl(int shmid,int flag, struct shmid_ds* dummy);
-int shmget(int memKey,int size,int flag);
+int			semctl(int semId, int semNum, int flag, union semun);
+int			semget(int semKey, int semNum, int flags);
+int			semop(int semId, struct sembuf * sops, int flag);
+
+int			shmdt(char *shmaddr);
+int		   *shmat(int memId, int m1, int m2);
+int			shmctl(int shmid, int flag, struct shmid_ds * dummy);
+int			shmget(int memKey, int size, int flag);
 
 
 /* Support functions */
 
 /* Specific beos action made on postgres/postmaster startup */
-void beos_startup(int argc,char** argv);
+void		beos_startup(int argc, char **argv);
+
 /* Load a shared library */
-image_id beos_dl_open(char * filename);
+image_id	beos_dl_open(char *filename);
+
 /* UnLoad a shared library */
-status_t beos_dl_close(image_id im);
+status_t	beos_dl_close(image_id im);
+
 /* Specific beos action made on backend startup */
-void beos_before_backend_startup(void);
+void		beos_before_backend_startup(void);
+
 /* Specific beos action made on backend startup */
-void beos_backend_startup(void);
-/* Specific beos action made on backend startup failure*/	
-void beos_backend_startup_failed(void);
+void		beos_backend_startup(void);
+
+/* Specific beos action made on backend startup failure*/
+void		beos_backend_startup_failed(void);
diff --git a/src/include/port/darwin.h b/src/include/port/darwin.h
index 5d5072aa550737c61b01aaea10084607189a2d64..0d35a8a2f49de8c5d502df2ec322fbe95b131e70 100644
--- a/src/include/port/darwin.h
+++ b/src/include/port/darwin.h
@@ -1,4 +1,4 @@
-#define __darwin__  1
+#define __darwin__	1
 
 #if defined(__ppc__)
 #define HAS_TEST_AND_SET
@@ -6,6 +6,8 @@
 
 #if defined(__ppc__)
 typedef unsigned int slock_t;
+
 #else
 typedef unsigned char slock_t;
+
 #endif
diff --git a/src/include/port/darwin/sem.h b/src/include/port/darwin/sem.h
index 9e3e28d646a618dbfe702fddb161a73f1c6de936..55cf85dccaa6e6483766eea653c122856f081a31 100644
--- a/src/include/port/darwin/sem.h
+++ b/src/include/port/darwin/sem.h
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/include/port/darwin/Attic/sem.h,v 1.1 2000/12/11 00:49:53 tgl Exp $
+ *		 $Header: /cvsroot/pgsql/src/include/port/darwin/Attic/sem.h,v 1.2 2001/03/22 04:01:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/include/port/freebsd.h b/src/include/port/freebsd.h
index f2fbf65337bfbc3b511026cd6fcf0af25be47b5b..7759191b8d2673c7bff88753f407ebfec58497ca 100644
--- a/src/include/port/freebsd.h
+++ b/src/include/port/freebsd.h
@@ -1,5 +1,6 @@
 #if defined(__i386__)
 typedef unsigned char slock_t;
+
 #define HAS_TEST_AND_SET
 #endif
 
@@ -10,11 +11,13 @@ typedef unsigned char slock_t;
 
 #if defined(__alpha__)
 typedef long int slock_t;
+
 #define HAS_TEST_AND_SET
 #endif
 
 #if defined(__vax__)
 typedef unsigned char slock_t;
+
 #define NEED_VAX_TAS_ASM
 #define HAS_TEST_AND_SET
 #endif
diff --git a/src/include/port/netbsd.h b/src/include/port/netbsd.h
index aba5c72fe629d010587ff5cb25d2bebdb16e269c..8b841e1a4a2a7e017c74d33ea04fe6d568f1b814 100644
--- a/src/include/port/netbsd.h
+++ b/src/include/port/netbsd.h
@@ -2,34 +2,40 @@
 #define NEED_I386_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__sparc__)
 #define NEED_SPARC_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__vax__)
 #define NEED_VAX_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__ns32k__)
 #define NEED_NS32K_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__m68k__)
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__arm__)
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__mips__)
@@ -39,9 +45,11 @@ typedef unsigned char slock_t;
 #if defined(__alpha__)
 #define HAS_TEST_AND_SET
 typedef unsigned long slock_t;
+
 #endif
 
 #if defined(__powerpc__)
 #define HAS_TEST_AND_SET
 typedef unsigned int slock_t;
+
 #endif
diff --git a/src/include/port/openbsd.h b/src/include/port/openbsd.h
index aba5c72fe629d010587ff5cb25d2bebdb16e269c..8b841e1a4a2a7e017c74d33ea04fe6d568f1b814 100644
--- a/src/include/port/openbsd.h
+++ b/src/include/port/openbsd.h
@@ -2,34 +2,40 @@
 #define NEED_I386_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__sparc__)
 #define NEED_SPARC_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__vax__)
 #define NEED_VAX_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__ns32k__)
 #define NEED_NS32K_TAS_ASM
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__m68k__)
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__arm__)
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
+
 #endif
 
 #if defined(__mips__)
@@ -39,9 +45,11 @@ typedef unsigned char slock_t;
 #if defined(__alpha__)
 #define HAS_TEST_AND_SET
 typedef unsigned long slock_t;
+
 #endif
 
 #if defined(__powerpc__)
 #define HAS_TEST_AND_SET
 typedef unsigned int slock_t;
+
 #endif
diff --git a/src/include/port/osf.h b/src/include/port/osf.h
index c43671811d940b3ec9fd4e566daef0c1a2bd7300..25df79a5cc3e85d7edccb0e2386a6b4473f1478e 100644
--- a/src/include/port/osf.h
+++ b/src/include/port/osf.h
@@ -1,7 +1,7 @@
 #define NOFIXADE
 #define DISABLE_XOPEN_NLS
 #define HAS_TEST_AND_SET
-/*#include <sys/mman.h>*/			/* for msemaphore */
+ /*#include <sys/mman.h>*//* for msemaphore */
 /*typedef msemaphore slock_t;*/
 #include <alpha/builtins.h>
 typedef volatile long slock_t;
diff --git a/src/include/port/solaris.h b/src/include/port/solaris.h
index 6851b6ce04082634802421138766eec4ca7ff5e1..f19a33f00fc2760a7d66c415e4f1700e95cf2107 100644
--- a/src/include/port/solaris.h
+++ b/src/include/port/solaris.h
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/include/port/solaris.h,v 1.3 2000/10/29 13:17:34 petere Exp $ */
+/* $Header: /cvsroot/pgsql/src/include/port/solaris.h,v 1.4 2001/03/22 04:01:00 momjian Exp $ */
 
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
@@ -9,15 +9,15 @@ typedef unsigned char slock_t;
  * doesn't document them.  The __xxx__ symbols are only on GCC.
  */
 #if defined(__i386) && !defined(__i386__)
-# define __i386__
+#define __i386__
 #endif
 
 #if defined(__sparc) && !defined(__sparc__)
-# define __sparc__
+#define __sparc__
 #endif
 
 #if defined(__i386__)
-# include <sys/isa_defs.h>
+#include <sys/isa_defs.h>
 #endif
 
 #ifndef			BIG_ENDIAN
@@ -31,31 +31,32 @@ typedef unsigned char slock_t;
 #endif
 
 #ifndef			BYTE_ORDER
-# ifdef __sparc__
-#  define		BYTE_ORDER		BIG_ENDIAN
-# endif
-# ifdef __i386__
-#   define		BYTE_ORDER		LITTLE_ENDIAN
-# endif
+#ifdef __sparc__
+#define		  BYTE_ORDER	  BIG_ENDIAN
+#endif
+#ifdef __i386__
+#define		 BYTE_ORDER		 LITTLE_ENDIAN
+#endif
 #endif
 
 
-#ifndef	NAN
+#ifndef NAN
 
-# if defined(__GNUC__) && defined(__i386__)
+#if defined(__GNUC__) && defined(__i386__)
 
-#  ifndef __nan_bytes
-#   define __nan_bytes				{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
-#  endif
+#ifndef __nan_bytes
+#define __nan_bytes				 { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
+#endif
 
-#  define NAN \
+#define NAN \
 	(__extension__ ((union { unsigned char __c[8]; double __d; }) \
 					{ __nan_bytes }).__d)
 
-# else /* not GNUC and i386 */
+#else
+/* not GNUC and i386 */
 
-#  define NAN (0.0/0.0)
+#define NAN (0.0/0.0)
 
-# endif /* GCC.  */
+#endif	 /* GCC.  */
 
 #endif	 /* not NAN */
diff --git a/src/include/port/win.h b/src/include/port/win.h
index ff02db1b5b1f04c4762aa55c72fbeb2fb9cdd806..b9d6308d77d466ae1e05dfc412e7e47005f1829b 100644
--- a/src/include/port/win.h
+++ b/src/include/port/win.h
@@ -14,5 +14,5 @@ typedef unsigned char slock_t;
  * Check for b20.1 and disable AF_UNIX family socket support.
  */
 #if CYGWIN_VERSION_DLL_MAJOR < 1001
-# undef HAVE_UNIX_SOCKETS
+#undef HAVE_UNIX_SOCKETS
 #endif
diff --git a/src/include/postgres.h b/src/include/postgres.h
index fbc38197d724f795ada944d1b9b7fd7e2f1e46cb..471b6af503f9ea3e3aa913b4d45cb2c8efa99bd9 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.46 2001/02/10 02:31:28 tgl Exp $
+ * $Id: postgres.h,v 1.47 2001/03/22 04:00:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,7 +85,7 @@ typedef struct varattrib
 
 		char		va_data[1]; /* Plain stored attribute */
 	}			va_content;
-}			varattrib;
+} varattrib;
 
 #define VARATT_FLAG_EXTERNAL	0x80000000
 #define VARATT_FLAG_COMPRESSED	0x40000000
@@ -322,7 +322,7 @@ typedef Datum *DatumPtr;
  *		Returns 64-bit integer value of a datum.
  *
  * Note: this macro hides the fact that int64 is currently a
- * pass-by-reference type.  Someday it may be pass-by-value,
+ * pass-by-reference type.	Someday it may be pass-by-value,
  * at least on some platforms.
  */
 
@@ -342,7 +342,7 @@ extern Datum Int64GetDatum(int64 X);
  *		Returns 4-byte floating point value of a datum.
  *
  * Note: this macro hides the fact that float4 is currently a
- * pass-by-reference type.  Someday it may be pass-by-value.
+ * pass-by-reference type.	Someday it may be pass-by-value.
  */
 
 #define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X)))
@@ -361,7 +361,7 @@ extern Datum Float4GetDatum(float4 X);
  *		Returns 8-byte floating point value of a datum.
  *
  * Note: this macro hides the fact that float8 is currently a
- * pass-by-reference type.  Someday it may be pass-by-value,
+ * pass-by-reference type.	Someday it may be pass-by-value,
  * at least on some platforms.
  */
 
@@ -457,7 +457,7 @@ extern Exception FailedAssertion;
 extern Exception BadArg;
 extern Exception BadState;
 
-extern bool	assert_enabled;
+extern bool assert_enabled;
 
 /*
  * USE_ASSERT_CHECKING, if defined, turns on all the assertions.
@@ -538,7 +538,7 @@ extern bool	assert_enabled;
 extern int ExceptionalCondition(char *conditionName,
 					 Exception *exceptionP, char *details,
 					 char *fileName, int lineNumber);
-extern char *vararg_format(const char *fmt, ...);
+extern char *vararg_format(const char *fmt,...);
 
 #ifndef USE_ASSERT_CHECKING
 #define LogAssert(condition, printArgs)
diff --git a/src/include/postgres_ext.h b/src/include/postgres_ext.h
index a5696f2a0207503d4546c027627bcb7c49761956..7b52f9c8350b81944aabc55162b382e3ffe19997 100644
--- a/src/include/postgres_ext.h
+++ b/src/include/postgres_ext.h
@@ -3,7 +3,7 @@
  * postgres_ext.h
  *
  *	   This file contains declarations of things that are visible everywhere
- *  in PostgreSQL *and* are visible to clients of frontend interface libraries.
+ *	in PostgreSQL *and* are visible to clients of frontend interface libraries.
  *	For example, the Oid type is part of the API of libpq and other libraries.
  *
  *	   Declarations which are specific to a particular interface should
@@ -15,7 +15,7 @@
  *	use header files that are otherwise internal to Postgres to interface
  *	with the backend.
  *
- * $Id: postgres_ext.h,v 1.6 2001/02/10 02:31:28 tgl Exp $
+ * $Id: postgres_ext.h,v 1.7 2001/03/22 04:00:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h
index b0c136f83d3fe0301e0ae2f23dd3b0558b5ea2c1..180bfe204f50b6184cb7496a7f85b99b19c63ad7 100644
--- a/src/include/regex/regex.h
+++ b/src/include/regex/regex.h
@@ -102,12 +102,12 @@ typedef struct
 #define REG_LARGE		01000	/* force large representation */
 #define REG_BACKR		02000	/* force use of backref code */
 
-extern int pg95_regcomp(regex_t *preg, const char *pattern, int cflags);
+extern int	pg95_regcomp(regex_t *preg, const char *pattern, int cflags);
 extern size_t pg95_regerror(int errcode, const regex_t *preg,
-							char *errbuf, size_t errbuf_size);
+			  char *errbuf, size_t errbuf_size);
 extern int pg95_regexec(const regex_t *preg, const char *string,
-						size_t nmatch,
-						regmatch_t *pmatch, int eflags);
+			 size_t nmatch,
+			 regmatch_t *pmatch, int eflags);
 extern void pg95_regfree(regex_t *preg);
 
 #endif	 /* !_REGEX_H_ */
diff --git a/src/include/regex/utils.h b/src/include/regex/utils.h
index 4bf6d9eace54a421932d5f68e4b108be57905aaa..4a29c2172649ad903b67869f1bb149cad8410619 100644
--- a/src/include/regex/utils.h
+++ b/src/include/regex/utils.h
@@ -61,4 +61,4 @@ typedef unsigned char uch;
 #endif
 #endif
 
-#endif	/* _REGEX_UTILS_H */
+#endif	 /* _REGEX_UTILS_H */
diff --git a/src/include/rewrite/rewriteManip.h b/src/include/rewrite/rewriteManip.h
index aa4e5c8d0db281ec9b1a8cd57178a6b85c975b6c..6123eb10977b33d565455073d543d507c96b3e42 100644
--- a/src/include/rewrite/rewriteManip.h
+++ b/src/include/rewrite/rewriteManip.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteManip.h,v 1.25 2001/01/24 19:43:27 momjian Exp $
+ * $Id: rewriteManip.h,v 1.26 2001/03/22 04:01:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,9 +24,9 @@ extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up,
 						int min_sublevels_up);
 
 extern bool rangeTableEntry_used(Node *node, int rt_index,
-								 int sublevels_up);
+					 int sublevels_up);
 extern bool attribute_used(Node *node, int rt_index, int attno,
-						   int sublevels_up);
+			   int sublevels_up);
 
 extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr);
 
@@ -38,6 +38,6 @@ extern bool checkExprHasAggs(Node *node);
 extern bool checkExprHasSubLink(Node *node);
 
 extern Node *ResolveNew(Node *node, int target_varno, int sublevels_up,
-						List *targetlist, int event, int update_varno);
+		   List *targetlist, int event, int update_varno);
 
 #endif	 /* REWRITEMANIP_H */
diff --git a/src/include/rewrite/rewriteSupport.h b/src/include/rewrite/rewriteSupport.h
index b5ae3c1ccdf56d2a07d355eacc8c22da3c7a7918..cda3d0f5d1c439916b93ba45e6ba695e322e3845 100644
--- a/src/include/rewrite/rewriteSupport.h
+++ b/src/include/rewrite/rewriteSupport.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteSupport.h,v 1.15 2001/01/24 19:43:27 momjian Exp $
+ * $Id: rewriteSupport.h,v 1.16 2001/03/22 04:01:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,6 +17,6 @@
 extern bool IsDefinedRewriteRule(char *ruleName);
 
 extern void SetRelationRuleStatus(Oid relationId, bool relHasRules,
-								  bool relIsBecomingView);
+					  bool relIsBecomingView);
 
 #endif	 /* REWRITESUPPORT_H */
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 051381bec68189afd6b113ca9f0d5a421cbf75e8..b795d65fb2060e2471b11c386ce235329f962aab 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: buf_internals.h,v 1.47 2001/01/24 19:43:27 momjian Exp $
+ * $Id: buf_internals.h,v 1.48 2001/03/22 04:01:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,7 +43,7 @@ typedef bits16 BufFlags;
 
 typedef struct buftag
 {
-	RelFileNode	rnode;
+	RelFileNode rnode;
 	BlockNumber blockNum;		/* blknum relative to begin of reln */
 } BufferTag;
 
@@ -69,7 +69,7 @@ typedef struct bufblindid
 {
 	char		dbname[NAMEDATALEN];	/* name of db in which buf belongs */
 	char		relname[NAMEDATALEN];	/* name of reln */
-}			BufferBlindId;
+} BufferBlindId;
 
 /*
  *	BufferDesc -- shared buffer cache metadata for a single
@@ -96,7 +96,7 @@ typedef struct sbufdesc
 	BufFlags	flags;			/* see bit definitions above */
 	unsigned	refcount;		/* # of times buffer is pinned */
 
-	slock_t		io_in_progress_lock; /* to block for I/O to complete */
+	slock_t		io_in_progress_lock;	/* to block for I/O to complete */
 	slock_t		cntx_lock;		/* to lock access to page context */
 
 	unsigned	r_locks;		/* # of shared locks */
@@ -108,12 +108,12 @@ typedef struct sbufdesc
 	BufferBlindId blind;		/* was used to support blind write */
 
 	/*
-	 * When we can't delete item from page (someone else has buffer pinned)
-	 * we mark buffer for cleanup by specifying appropriate for buffer
-	 * content cleanup function. Buffer will be cleaned up from release
-	 * buffer functions.
+	 * When we can't delete item from page (someone else has buffer
+	 * pinned) we mark buffer for cleanup by specifying appropriate for
+	 * buffer content cleanup function. Buffer will be cleaned up from
+	 * release buffer functions.
 	 */
-	void		(*CleanupFunc)(Buffer);
+	void		(*CleanupFunc) (Buffer);
 } BufferDesc;
 
 #define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1)
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 70f648931d7dc207e08788024b55d34f0b14d642..fc76f9fe4c5bd27e9124414675d2e7f33af55128 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufmgr.h,v 1.49 2001/01/24 19:43:27 momjian Exp $
+ * $Id: bufmgr.h,v 1.50 2001/03/22 04:01:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -192,7 +192,7 @@ extern void LockBuffer(Buffer buffer, int mode);
 extern void AbortBufferIO(void);
 
 extern bool BufferIsUpdatable(Buffer buffer);
-extern void MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc)(Buffer));
+extern void MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc) (Buffer));
 
 extern void BufmgrCommit(void);
 extern void BufferSync(void);
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 07a5f2447ce747b5c5f461d7e9a6e8581c9f9495..9dd956d3081abd8324c140b248c373fb425e216f 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufpage.h,v 1.40 2001/02/21 19:07:04 momjian Exp $
+ * $Id: bufpage.h,v 1.41 2001/03/22 04:01:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -118,12 +118,12 @@ typedef OpaqueData *Opaque;
  */
 typedef struct PageHeaderData
 {
-								/* XXX LSN is member of *any* block, not */
-								/* only page-organized - 'll change later */
+	/* XXX LSN is member of *any* block, not */
+	/* only page-organized - 'll change later */
 	XLogRecPtr	pd_lsn;			/* LSN: next byte after last byte of xlog */
-								/* record for last change of this page */
+	/* record for last change of this page */
 	StartUpID	pd_sui;			/* SUI of last changes (currently it's */
-								/* used by heap AM only) */
+	/* used by heap AM only) */
 
 	LocationIndex pd_lower;		/* offset to start of free space */
 	LocationIndex pd_upper;		/* offset to end of free space */
@@ -319,7 +319,7 @@ extern OffsetNumber PageAddItem(Page page, Item item, Size size,
 			OffsetNumber offsetNumber, ItemIdFlags flags);
 extern Page PageGetTempPage(Page page, Size specialSize);
 extern void PageRestoreTempPage(Page tempPage, Page oldPage);
-extern int PageRepairFragmentation(Page page, OffsetNumber *unused);
+extern int	PageRepairFragmentation(Page page, OffsetNumber *unused);
 extern Size PageGetFreeSpace(Page page);
 extern void PageIndexTupleDelete(Page page, OffsetNumber offset);
 extern void IndexPageCleanup(Buffer buffer);
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index f1e1e6096cd096bfec94460a3dc529ffe5155246..aa685fc8ff6072e7c70499b4410f219a5359f1f1 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: ipc.h,v 1.48 2001/03/13 01:17:06 tgl Exp $
+ * $Id: ipc.h,v 1.49 2001/03/22 04:01:05 momjian Exp $
  *
  * Some files that would normally need to include only sys/ipc.h must
  * instead include this file because on Ultrix, sys/ipc.h is not designed
@@ -21,7 +21,7 @@
 #include <sys/types.h>
 #ifdef HAVE_SYS_IPC_H
 #include <sys/ipc.h>
-#endif /* HAVE_SYS_IPC_H */
+#endif	 /* HAVE_SYS_IPC_H */
 
 #ifndef HAVE_UNION_SEMUN
 union semun
@@ -30,6 +30,7 @@ union semun
 	struct semid_ds *buf;
 	unsigned short *array;
 };
+
 #endif
 
 /* generic IPC definitions */
@@ -94,8 +95,8 @@ extern void on_exit_reset(void);
 extern void IpcInitKeyAssignment(int port);
 
 extern IpcSemaphoreId IpcSemaphoreCreate(int numSems, int permission,
-										 int semStartValue,
-										 bool removeOnExit);
+				   int semStartValue,
+				   bool removeOnExit);
 extern void IpcSemaphoreKill(IpcSemaphoreId semId);
 extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, bool interruptOK);
 extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem);
@@ -103,12 +104,12 @@ extern bool IpcSemaphoreTryLock(IpcSemaphoreId semId, int sem);
 extern int	IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem);
 
 extern PGShmemHeader *IpcMemoryCreate(uint32 size, bool makePrivate,
-									  int permission);
+				int permission);
 
 extern bool SharedMemoryIsInUse(IpcMemoryKey shmKey, IpcMemoryId shmId);
 
 /* ipci.c */
 extern void CreateSharedMemoryAndSemaphores(bool makePrivate,
-											int maxBackends);
+								int maxBackends);
 
 #endif	 /* IPC_H */
diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h
index e50cf6e0ba522816b704a14b98faa4a7efe5046e..68ebcfee502e646c188653f27d1b334329ce3319 100644
--- a/src/include/storage/itemid.h
+++ b/src/include/storage/itemid.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itemid.h,v 1.15 2001/01/24 19:43:27 momjian Exp $
+ * $Id: itemid.h,v 1.16 2001/03/22 04:01:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@ typedef ItemIdData *ItemId;
  */
 #define LP_USED			0x01	/* this line pointer is being used */
 
-#define LP_DELETE		0x02    /* item is to be deleted */
+#define LP_DELETE		0x02	/* item is to be deleted */
 
 #define ItemIdDeleted(itemId) \
 	(((itemId)->lp_flags & LP_DELETE) != 0)
@@ -40,7 +40,7 @@ typedef ItemIdData *ItemId;
  * This bit may be passed to PageAddItem together with
  * LP_USED & LP_DELETED bits to specify overwrite mode
  */
-#define	OverwritePageMode	0x10
+#define OverwritePageMode	0x10
 
 /*
  * Item offsets, lengths, and flags are represented by these types when
diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 710db49af8c66ee746911b8c2fb9594ff66d6b6c..5b2c715e01eb2a94fbd0dc607b16b858f9600ee4 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itemptr.h,v 1.16 2001/01/24 19:43:27 momjian Exp $
+ * $Id: itemptr.h,v 1.17 2001/03/22 04:01:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,7 @@ typedef struct ItemPointerData
 	OffsetNumber ip_posid;
 } ItemPointerData;
 
-#define	SizeOfIptrData	\
+#define SizeOfIptrData	\
 	(offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))
 
 typedef ItemPointerData *ItemPointer;
diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h
index 146d6333f47fa4966fcb9ba507f21b24eb928f29..05d62331386fbaf4e08a68126be7b1a7706fa715 100644
--- a/src/include/storage/large_object.h
+++ b/src/include/storage/large_object.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: large_object.h,v 1.20 2001/01/24 19:43:27 momjian Exp $
+ * $Id: large_object.h,v 1.21 2001/03/22 04:01:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,10 +27,11 @@
  * index_r holds an open-relation reference to pg_largeobject_loid_pn_index
  *
  * NOTE: before 7.1, heap_r and index_r held references to the separate
- * table and index of a specific large object.  Now they all live in one rel.
+ * table and index of a specific large object.	Now they all live in one rel.
  *----------
  */
-typedef struct LargeObjectDesc {
+typedef struct LargeObjectDesc
+{
 	Oid			id;
 	uint32		offset;			/* current seek pointer */
 	int			flags;			/* locking info, etc */
@@ -58,7 +59,7 @@ typedef struct LargeObjectDesc {
  * since clients will often be written to send data in power-of-2 blocks.
  * This avoids unnecessary tuple updates caused by partial-page writes.
  */
-#define	LOBLKSIZE		(BLCKSZ / 4)
+#define LOBLKSIZE		(BLCKSZ / 4)
 
 
 /*
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h
index 5906445f37f1a96190336b2e885b9c5ab6780e17..45af8bedede20acfb289b730d04342c877fb4ce6 100644
--- a/src/include/storage/lmgr.h
+++ b/src/include/storage/lmgr.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lmgr.h,v 1.29 2001/02/22 23:02:33 momjian Exp $
+ * $Id: lmgr.h,v 1.30 2001/03/22 04:01:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,11 +26,13 @@
 #define RowShareLock			2		/* SELECT FOR UPDATE */
 #define RowExclusiveLock		3		/* INSERT, UPDATE, DELETE */
 #define ShareLock				4		/* CREATE INDEX */
-#define ShareRowExclusiveLock	5		/* like EXCLUSIVE MODE, allows SHARE ROW */
-#define ExclusiveLock			6		/* blocks ROW SHARE/SELECT...FOR UPDATE */
-#define AccessExclusiveLock		7		/* ALTER TABLE, DROP TABLE, VACUUM, and
-										 * unqualified LOCK TABLE 
-										 */
+#define ShareRowExclusiveLock	5		/* like EXCLUSIVE MODE, allows
+										 * SHARE ROW */
+#define ExclusiveLock			6		/* blocks ROW SHARE/SELECT...FOR
+										 * UPDATE */
+#define AccessExclusiveLock		7		/* ALTER TABLE, DROP TABLE,
+										 * VACUUM, and unqualified LOCK
+										 * TABLE */
 extern LOCKMETHOD LockTableId;
 
 
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index af07e889350f73b70092bd7c1fbeb0845ed9e07b..3d5ddb70385dfb127bebeb818a8675a676259140 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lock.h,v 1.47 2001/02/23 19:24:06 momjian Exp $
+ * $Id: lock.h,v 1.48 2001/03/22 04:01:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,12 +33,13 @@ typedef struct proc PROC;
 extern SPINLOCK LockMgrLock;
 
 #ifdef LOCK_DEBUG
-extern int  Trace_lock_oidmin;
+extern int	Trace_lock_oidmin;
 extern bool Trace_locks;
 extern bool Trace_userlocks;
-extern int  Trace_lock_table;
+extern int	Trace_lock_table;
 extern bool Debug_deadlocks;
-#endif /* LOCK_DEBUG */
+
+#endif	 /* LOCK_DEBUG */
 
 
 /* ----------------------
@@ -60,7 +61,7 @@ typedef int LOCKMODE;
 typedef int LOCKMETHOD;
 
 /* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
-#define MAX_LOCKMODES  		8
+#define MAX_LOCKMODES		8
 
 /*
  * MAX_LOCK_METHODS corresponds to the number of spin locks allocated in
@@ -87,7 +88,7 @@ typedef int LOCKMETHOD;
 
 /*
  * This is the control structure for a lock table.	It
- * lives in shared memory.  This information is the same
+ * lives in shared memory.	This information is the same
  * for all backends.
  *
  * lockmethod -- the handle used by the lock table's clients to
@@ -132,7 +133,7 @@ typedef struct LOCKMETHODTABLE
 
 /*
  * LOCKTAG is the key information needed to look up a LOCK item in the
- * lock hashtable.  A LOCKTAG value uniquely identifies a lockable object.
+ * lock hashtable.	A LOCKTAG value uniquely identifies a lockable object.
  */
 typedef struct LOCKTAG
 {
@@ -179,9 +180,10 @@ typedef struct LOCK
 	int			waitMask;		/* bitmask for lock types awaited */
 	SHM_QUEUE	lockHolders;	/* list of HOLDER objects assoc. with lock */
 	PROC_QUEUE	waitProcs;		/* list of PROC objects waiting on lock */
-	int			requested[MAX_LOCKMODES]; /* counts of requested locks */
+	int			requested[MAX_LOCKMODES];		/* counts of requested
+												 * locks */
 	int			nRequested;		/* total of requested[] array */
-	int			granted[MAX_LOCKMODES];	/* counts of granted locks */
+	int			granted[MAX_LOCKMODES]; /* counts of granted locks */
 	int			nGranted;		/* total of granted[] array */
 } LOCK;
 
@@ -208,13 +210,13 @@ typedef struct LOCK
  * with per-transaction locks obtained by the same backend.
  *
  * The holding[] array counts the granted locks (of each type) represented
- * by this holder.  Note that there will be a holder object, possibly with
+ * by this holder.	Note that there will be a holder object, possibly with
  * zero holding[], for any lock that the process is currently waiting on.
  * Otherwise, holder objects whose counts have gone to zero are recycled
  * as soon as convenient.
  *
  * Each HOLDER object is linked into lists for both the associated LOCK object
- * and the owning PROC object.  Note that the HOLDER is entered into these
+ * and the owning PROC object.	Note that the HOLDER is entered into these
  * lists as soon as it is created, even if no lock has yet been granted.
  * A PROC that is waiting for a lock to be granted will also be linked into
  * the lock's waitProcs queue.
@@ -232,7 +234,7 @@ typedef struct HOLDER
 	HOLDERTAG	tag;			/* unique identifier of holder object */
 
 	/* data */
-	int			holding[MAX_LOCKMODES];	/* count of locks currently held */
+	int			holding[MAX_LOCKMODES]; /* count of locks currently held */
 	int			nHolding;		/* total of holding[] array */
 	SHM_QUEUE	lockLink;		/* list link for lock's list of holders */
 	SHM_QUEUE	procLink;		/* list link for process's list of holders */
@@ -261,15 +263,15 @@ extern LOCKMETHOD LockMethodTableInit(char *tabName, LOCKMASK *conflictsP,
 					int *prioP, int numModes, int maxBackends);
 extern LOCKMETHOD LockMethodTableRename(LOCKMETHOD lockmethod);
 extern bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
-						TransactionId xid, LOCKMODE lockmode);
+			TransactionId xid, LOCKMODE lockmode);
 extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
-						TransactionId xid, LOCKMODE lockmode);
+			TransactionId xid, LOCKMODE lockmode);
 extern bool LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
-						   bool allxids, TransactionId xid);
+			   bool allxids, TransactionId xid);
 extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
-							  LOCKMODE lockmode,
-							  LOCK *lock, HOLDER *holder, PROC *proc,
-							  int *myHolding);
+				   LOCKMODE lockmode,
+				   LOCK *lock, HOLDER *holder, PROC *proc,
+				   int *myHolding);
 extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode);
 extern void RemoveFromWaitQueue(PROC *proc);
 extern int	LockShmemSize(int maxBackends);
@@ -279,6 +281,7 @@ extern void InitDeadLockChecking(void);
 #ifdef LOCK_DEBUG
 extern void DumpLocks(void);
 extern void DumpAllLocks(void);
+
 #endif
 
 #endif	 /* LOCK_H */
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 6290e83d50fa8631e4877470542c7bd42ddaff46..72e2aafd425222ea600c1661a2763f2a67327ca0 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: proc.h,v 1.40 2001/02/26 00:50:08 tgl Exp $
+ * $Id: proc.h,v 1.41 2001/03/22 04:01:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 #include "storage/lock.h"
 
 /* configurable option */
-extern int DeadlockTimeout;
+extern int	DeadlockTimeout;
 
 typedef struct
 {
@@ -50,9 +50,10 @@ struct proc
 								 * were starting our xact: vacuum must not
 								 * remove tuples deleted by xid >= xmin ! */
 
-	/* XLOG location of first XLOG record written by this backend's current
-	 * transaction.  If backend is not in a transaction or hasn't yet modified
-	 * anything, logRec.xrecoff is zero.
+	/*
+	 * XLOG location of first XLOG record written by this backend's
+	 * current transaction.  If backend is not in a transaction or hasn't
+	 * yet modified anything, logRec.xrecoff is zero.
 	 */
 	XLogRecPtr	logRec;
 
@@ -68,8 +69,8 @@ struct proc
 	Oid			databaseId;		/* OID of database this backend is using */
 
 	short		sLocks[MAX_SPINS];		/* Spin lock stats */
-	SHM_QUEUE	procHolders;	/* list of HOLDER objects for locks held or
-								 * awaited by this backend */
+	SHM_QUEUE	procHolders;	/* list of HOLDER objects for locks held
+								 * or awaited by this backend */
 };
 
 /* NOTE: "typedef struct proc PROC" appears in storage/lock.h. */
@@ -132,7 +133,7 @@ extern bool ProcRemove(int pid);
 
 extern void ProcQueueInit(PROC_QUEUE *queue);
 extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
-					 LOCK *lock, HOLDER *holder);
+		  LOCK *lock, HOLDER *holder);
 extern PROC *ProcWakeup(PROC *proc, int errType);
 extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
 extern void ProcReleaseSpins(PROC *proc);
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h
index e4f07e9ac688a75f2ca69f35a3377cbf8341f148..c53dea8f3992606d14dc877409c7449bff2eb18c 100644
--- a/src/include/storage/relfilenode.h
+++ b/src/include/storage/relfilenode.h
@@ -11,12 +11,12 @@
  */
 typedef struct RelFileNode
 {
-	Oid					tblNode;		/* tablespace */
-	Oid					relNode;		/* relation */
+	Oid			tblNode;		/* tablespace */
+	Oid			relNode;		/* relation */
 } RelFileNode;
 
-#define	RelFileNodeEquals(node1, node2)	\
+#define RelFileNodeEquals(node1, node2) \
 	((node1).relNode == (node2).relNode && \
 	 (node1).tblNode == (node2).tblNode)
 
-#endif	/* RELFILENODE_H */
+#endif	 /* RELFILENODE_H */
diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h
index 3331f117cc7aff4eff0605472e0cd47e25408cad..04c8bbaf418a521ec541dcf9d950a798a6b6c5aa 100644
--- a/src/include/storage/shmem.h
+++ b/src/include/storage/shmem.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: shmem.h,v 1.27 2001/02/22 18:39:20 momjian Exp $
+ * $Id: shmem.h,v 1.28 2001/03/22 04:01:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,8 +28,8 @@
  */
 typedef unsigned long SHMEM_OFFSET;
 
-#define INVALID_OFFSET 	(-1)
-#define BAD_LOCATION 	(-1)
+#define INVALID_OFFSET	(-1)
+#define BAD_LOCATION	(-1)
 
 /*
  * Start of the primary shared memory region, in this process' address space.
@@ -102,7 +102,7 @@ extern void SHMQueueElemInit(SHM_QUEUE *queue);
 extern void SHMQueueDelete(SHM_QUEUE *queue);
 extern void SHMQueueInsertBefore(SHM_QUEUE *queue, SHM_QUEUE *elem);
 extern Pointer SHMQueueNext(SHM_QUEUE *queue, SHM_QUEUE *curElem,
-							Size linkOffset);
+			 Size linkOffset);
 extern bool SHMQueueEmpty(SHM_QUEUE *queue);
 
 #endif	 /* SHMEM_H */
diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h
index 074e37eb17a2370e7f68bf53fe1e9eacb307ee81..22b073350df2c4bfaf110adebf9bb6cca60e4e59 100644
--- a/src/include/storage/sinvaladt.h
+++ b/src/include/storage/sinvaladt.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: sinvaladt.h,v 1.25 2001/01/24 19:43:28 momjian Exp $
+ * $Id: sinvaladt.h,v 1.26 2001/03/22 04:01:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -89,7 +89,8 @@ typedef struct SISeg
 	 */
 	int			minMsgNum;		/* oldest message still needed */
 	int			maxMsgNum;		/* next message number to be assigned */
-	int			lastBackend;	/* index of last active procState entry, +1 */
+	int			lastBackend;	/* index of last active procState entry,
+								 * +1 */
 	int			maxBackends;	/* size of procState array */
 
 	/*
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 58f11719991e147578b482311a139b6947460a4c..34892040cc535c22089ca342bcd9d59b8e2b2f7d 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: smgr.h,v 1.27 2001/01/24 19:43:28 momjian Exp $
+ * $Id: smgr.h,v 1.28 2001/03/22 04:01:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,9 +38,9 @@ extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
 extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum,
 		  char *buffer);
 extern int smgrblindwrt(int16 which, RelFileNode rnode,
-						BlockNumber blkno, char *buffer, bool dofsync);
+			 BlockNumber blkno, char *buffer, bool dofsync);
 extern int smgrblindmarkdirty(int16 which, RelFileNode rnode,
-						BlockNumber blkno);
+				   BlockNumber blkno);
 extern int	smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno);
 extern int	smgrnblocks(int16 which, Relation reln);
 extern int	smgrtruncate(int16 which, Relation reln, int nblocks);
@@ -51,7 +51,7 @@ extern int	smgrsync(void);
 
 extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record);
 extern void smgr_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void smgr_desc(char *buf, uint8 xl_info, char* rec);
+extern void smgr_desc(char *buf, uint8 xl_info, char *rec);
 
 
 /* internals: move me elsewhere -- ay 7/94 */
@@ -67,8 +67,8 @@ extern int	mdread(Relation reln, BlockNumber blocknum, char *buffer);
 extern int	mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
 extern int	mdflush(Relation reln, BlockNumber blocknum, char *buffer);
 extern int	mdmarkdirty(Relation reln, BlockNumber blkno);
-extern int	mdblindwrt(RelFileNode rnode, BlockNumber blkno,
-					   char *buffer, bool dofsync);
+extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno,
+		   char *buffer, bool dofsync);
 extern int	mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno);
 extern int	mdnblocks(Relation reln);
 extern int	mdtruncate(Relation reln, int nblocks);
diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h
index 7faa19b64a50af8ffd3a6555c0dfa5dfe93aa0e1..1d488e547672385e00e75ac06d9ce9d3ba150168 100644
--- a/src/include/storage/spin.h
+++ b/src/include/storage/spin.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: spin.h,v 1.14 2001/01/24 19:43:28 momjian Exp $
+ * $Id: spin.h,v 1.15 2001/03/22 04:01:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,6 +29,7 @@ typedef int SPINLOCK;
 
 #ifdef LOCK_DEBUG
 extern bool Trace_spinlocks;
+
 #endif
 
 
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 94af6e711335a2b53142e054927518174f03b78b..df616de5786a5421064b8905e750e75acace4fdf 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tcopprot.h,v 1.39 2001/03/13 01:17:06 tgl Exp $
+ * $Id: tcopprot.h,v 1.40 2001/03/22 04:01:09 momjian Exp $
  *
  * OLD COMMENTS
  *	  This file was created so that other c files could get the two
@@ -32,11 +32,11 @@ extern bool ShowPortNumber;
 #ifndef BOOTSTRAP_INCLUDE
 
 extern List *pg_parse_and_rewrite(char *query_string,
-								  Oid *typev, int nargs);
+					 Oid *typev, int nargs);
 extern Plan *pg_plan_query(Query *querytree);
 extern void pg_exec_query_string(char *query_string,
-								 CommandDest dest,
-								 MemoryContext parse_context);
+					 CommandDest dest,
+					 MemoryContext parse_context);
 
 #endif	 /* BOOTSTRAP_INCLUDE */
 
@@ -46,6 +46,6 @@ extern int PostgresMain(int argc, char *argv[],
 			 int real_argc, char *real_argv[], const char *username);
 extern void ResetUsage(void);
 extern void ShowUsage(void);
-extern FILE * StatFp;
+extern FILE *StatFp;
 
 #endif	 /* TCOPPROT_H */
diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h
index 12747f80d7178aef0687a08cd55db7874c6dc32c..7e09390c3ca8546ba8613f7656ba666b91d489bb 100644
--- a/src/include/utils/acl.h
+++ b/src/include/utils/acl.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: acl.h,v 1.30 2001/01/24 19:43:28 momjian Exp $
+ * $Id: acl.h,v 1.31 2001/03/22 04:01:10 momjian Exp $
  *
  * NOTES
  *	  For backward-compatibility purposes we have to allow there
@@ -68,8 +68,8 @@ typedef struct AclItem
 	AclMode		ai_mode;
 
 	/*
-	 * This is actually type 'aclitem', and we want a fixed size for
-	 * all platforms, so we pad this with dummies.
+	 * This is actually type 'aclitem', and we want a fixed size for all
+	 * platforms, so we pad this with dummies.
 	 */
 	char		dummy1,
 				dummy2;
@@ -86,7 +86,7 @@ typedef struct AclItem
  * and set it to zero when writing.
  *
  * CAUTION: as of Postgres 7.1, these arrays are toastable (just like all
- * other array types).  Therefore, be careful to detoast them with the
+ * other array types).	Therefore, be careful to detoast them with the
  * macros provided, unless you know for certain that a particular array
  * can't have been toasted.  Presently, we do not provide toast tables for
  * pg_class or pg_group, so the entries in those tables won't have been
@@ -117,21 +117,21 @@ typedef ArrayType IdList;
 /*
  * fmgr macros for these types
  */
-#define DatumGetAclItemP(X)        ((AclItem *) DatumGetPointer(X))
-#define PG_GETARG_ACLITEM_P(n)     DatumGetAclItemP(PG_GETARG_DATUM(n))
-#define PG_RETURN_ACLITEM_P(x)     PG_RETURN_POINTER(x)
+#define DatumGetAclItemP(X)		   ((AclItem *) DatumGetPointer(X))
+#define PG_GETARG_ACLITEM_P(n)	   DatumGetAclItemP(PG_GETARG_DATUM(n))
+#define PG_RETURN_ACLITEM_P(x)	   PG_RETURN_POINTER(x)
 
-#define DatumGetAclP(X)            ((Acl *) PG_DETOAST_DATUM(X))
-#define DatumGetAclPCopy(X)        ((Acl *) PG_DETOAST_DATUM_COPY(X))
-#define PG_GETARG_ACL_P(n)         DatumGetAclP(PG_GETARG_DATUM(n))
+#define DatumGetAclP(X)			   ((Acl *) PG_DETOAST_DATUM(X))
+#define DatumGetAclPCopy(X)		   ((Acl *) PG_DETOAST_DATUM_COPY(X))
+#define PG_GETARG_ACL_P(n)		   DatumGetAclP(PG_GETARG_DATUM(n))
 #define PG_GETARG_ACL_P_COPY(n)    DatumGetAclPCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_ACL_P(x)         PG_RETURN_POINTER(x)
+#define PG_RETURN_ACL_P(x)		   PG_RETURN_POINTER(x)
 
-#define DatumGetIdListP(X)         ((IdList *) PG_DETOAST_DATUM(X))
-#define DatumGetIdListPCopy(X)     ((IdList *) PG_DETOAST_DATUM_COPY(X))
-#define PG_GETARG_IDLIST_P(n)      DatumGetIdListP(PG_GETARG_DATUM(n))
+#define DatumGetIdListP(X)		   ((IdList *) PG_DETOAST_DATUM(X))
+#define DatumGetIdListPCopy(X)	   ((IdList *) PG_DETOAST_DATUM_COPY(X))
+#define PG_GETARG_IDLIST_P(n)	   DatumGetIdListP(PG_GETARG_DATUM(n))
 #define PG_GETARG_IDLIST_P_COPY(n) DatumGetIdListPCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_IDLIST_P(x)      PG_RETURN_POINTER(x)
+#define PG_RETURN_IDLIST_P(x)	   PG_RETURN_POINTER(x)
 
 
 /*
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index a4306c0e908b8d66db8873c65ff58147898e933c..992703537407919180cbf7d24f7f0180c43a62b7 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: array.h,v 1.28 2001/01/24 19:43:28 momjian Exp $
+ * $Id: array.h,v 1.29 2001/03/22 04:01:10 momjian Exp $
  *
  * NOTES
  *	  XXX the data array should be MAXALIGN'd -- currently we only INTALIGN
@@ -40,11 +40,11 @@ typedef struct
 /*
  * fmgr macros for array objects
  */
-#define DatumGetArrayTypeP(X)         ((ArrayType *) PG_DETOAST_DATUM(X))
-#define DatumGetArrayTypePCopy(X)     ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
-#define PG_GETARG_ARRAYTYPE_P(n)      DatumGetArrayTypeP(PG_GETARG_DATUM(n))
+#define DatumGetArrayTypeP(X)		  ((ArrayType *) PG_DETOAST_DATUM(X))
+#define DatumGetArrayTypePCopy(X)	  ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
+#define PG_GETARG_ARRAYTYPE_P(n)	  DatumGetArrayTypeP(PG_GETARG_DATUM(n))
 #define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_ARRAYTYPE_P(x)      PG_RETURN_POINTER(x)
+#define PG_RETURN_ARRAYTYPE_P(x)	  PG_RETURN_POINTER(x)
 
 /*
  * Access macros for array header fields.
@@ -90,29 +90,29 @@ extern Datum array_eq(PG_FUNCTION_ARGS);
 extern Datum array_dims(PG_FUNCTION_ARGS);
 
 extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
-					   bool elmbyval, int elmlen,
-					   int arraylen, bool *isNull);
+		  bool elmbyval, int elmlen,
+		  int arraylen, bool *isNull);
 extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx,
-							Datum dataValue,
-							bool elmbyval, int elmlen,
-							int arraylen, bool *isNull);
+		  Datum dataValue,
+		  bool elmbyval, int elmlen,
+		  int arraylen, bool *isNull);
 extern ArrayType *array_get_slice(ArrayType *array, int nSubscripts,
-								  int *upperIndx, int *lowerIndx,
-								  bool elmbyval, int elmlen,
-								  int arraylen, bool *isNull);
+				int *upperIndx, int *lowerIndx,
+				bool elmbyval, int elmlen,
+				int arraylen, bool *isNull);
 extern ArrayType *array_set_slice(ArrayType *array, int nSubscripts,
-								  int *upperIndx, int *lowerIndx,
-								  ArrayType *srcArray,
-								  bool elmbyval, int elmlen,
-								  int arraylen, bool *isNull);
+				int *upperIndx, int *lowerIndx,
+				ArrayType *srcArray,
+				bool elmbyval, int elmlen,
+				int arraylen, bool *isNull);
 
 extern Datum array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType);
 
 extern ArrayType *construct_array(Datum *elems, int nelems,
-								  bool elmbyval, int elmlen, char elmalign);
+				bool elmbyval, int elmlen, char elmalign);
 extern void deconstruct_array(ArrayType *array,
-							  bool elmbyval, int elmlen, char elmalign,
-							  Datum **elemsp, int *nelemsp);
+				  bool elmbyval, int elmlen, char elmalign,
+				  Datum **elemsp, int *nelemsp);
 
 
 /*
diff --git a/src/include/utils/ascii.h b/src/include/utils/ascii.h
index f95d61320298e5fb68783ac42af0041dd992c244..15d4a6da6762a962033d2db5c55195ad26d8c8c8 100644
--- a/src/include/utils/ascii.h
+++ b/src/include/utils/ascii.h
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------
  * ascii.h
  *
- * $Id: ascii.h,v 1.4 2001/01/24 19:43:28 momjian Exp $
+ * $Id: ascii.h,v 1.5 2001/03/22 04:01:10 momjian Exp $
  *
  *	 Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
  *
@@ -20,8 +20,9 @@ extern Datum to_ascii_default(PG_FUNCTION_ARGS);
 
 #ifdef MULTIBYTE
 
-extern char *pg_to_ascii(unsigned char *src, unsigned char *src_end, 
-					unsigned char *desc, int enc);
-#endif /* MULTIBYTE */
+extern char *pg_to_ascii(unsigned char *src, unsigned char *src_end,
+			unsigned char *desc, int enc);
 
-#endif /* _ASCII_H_ */
+#endif	 /* MULTIBYTE */
+
+#endif	 /* _ASCII_H_ */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index dcc923a36de0bfc8d35f184e8559e4bbeb08f593..45eb70232415bd1b8f6ad66e5050e58f9976529e 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.147 2001/02/14 21:35:06 tgl Exp $
+ * $Id: builtins.h,v 1.148 2001/03/22 04:01:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -374,9 +374,9 @@ typedef enum
 } Pattern_Prefix_Status;
 
 extern Pattern_Prefix_Status pattern_fixed_prefix(char *patt,
-												  Pattern_Type ptype,
-												  char **prefix,
-												  char **rest);
+					 Pattern_Type ptype,
+					 char **prefix,
+					 char **rest);
 extern bool locale_is_like_safe(void);
 extern char *make_greater_string(const char *str, Oid datatype);
 
@@ -479,13 +479,13 @@ extern Datum ascii(PG_FUNCTION_ARGS);
 
 /* inet_net_ntop.c */
 extern char *inet_net_ntop(int af, const void *src, int bits,
-						   char *dst, size_t size);
+			  char *dst, size_t size);
 extern char *inet_cidr_ntop(int af, const void *src, int bits,
-							char *dst, size_t size);
+			   char *dst, size_t size);
 
 /* inet_net_pton.c */
-extern int	inet_net_pton(int af, const char *src,
-						  void *dst, size_t size);
+extern int inet_net_pton(int af, const char *src,
+			  void *dst, size_t size);
 
 /* network.c */
 extern Datum inet_in(PG_FUNCTION_ARGS);
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 14767c1279d57788b2982107b5bfce6380811389..a2d99458a9d548f652d021d7b6cf574e94f0e854 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,14 +13,14 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catcache.h,v 1.31 2001/01/24 19:43:28 momjian Exp $
+ * $Id: catcache.h,v 1.32 2001/03/22 04:01:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef CATCACHE_H
 #define CATCACHE_H
 
-/* #define CACHEDEBUG */	/* turns DEBUG elogs on */
+ /* #define CACHEDEBUG *//* turns DEBUG elogs on */
 
 #include "access/htup.h"
 #include "lib/dllist.h"
@@ -72,7 +72,7 @@ typedef struct catcache
 	PGFunction	cc_hashfunc[4]; /* hash function to use for each key */
 	ScanKeyData cc_skey[4];		/* precomputed key info for heap scans */
 	Dllist		cc_lrulist;		/* overall LRU list, most recent first */
-	Dllist		cc_cache[NCCBUCK]; /* hash buckets */
+	Dllist		cc_cache[NCCBUCK];		/* hash buckets */
 } CatCache;
 
 #define InvalidCatalogCacheId	(-1)
@@ -84,19 +84,19 @@ extern void CreateCacheMemoryContext(void);
 extern void AtEOXact_CatCache(bool isCommit);
 
 extern CatCache *InitCatCache(int id, char *relname, char *indname,
-							  int nkeys, int *key);
+			 int nkeys, int *key);
 
 extern HeapTuple SearchCatCache(CatCache *cache,
-								Datum v1, Datum v2,
-								Datum v3, Datum v4);
+			   Datum v1, Datum v2,
+			   Datum v3, Datum v4);
 extern void ReleaseCatCache(HeapTuple tuple);
 
 extern void ResetSystemCache(void);
 extern void SystemCacheRelationFlushed(Oid relId);
 extern void CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
-									 ItemPointer pointer);
+						 ItemPointer pointer);
 extern void PrepareToInvalidateCacheTuple(Relation relation,
-								HeapTuple tuple,
-								void (*function) (int, Index, ItemPointer));
+							  HeapTuple tuple,
+							  void (*function) (int, Index, ItemPointer));
 
 #endif	 /* CATCACHE_H */
diff --git a/src/include/utils/date.h b/src/include/utils/date.h
index 0aa37327c9318b478dc5008489b28c1925d7c6d3..5aeb87ee00e279bc300cbb08b5ee9faf5927eff1 100644
--- a/src/include/utils/date.h
+++ b/src/include/utils/date.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: date.h,v 1.10 2001/01/24 19:43:28 momjian Exp $
+ * $Id: date.h,v 1.11 2001/03/22 04:01:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,20 +34,20 @@ typedef struct
  * For TimeADT, we make use of the same support routines as for float8.
  * Therefore TimeADT is pass-by-reference if and only if float8 is!
  */
-#define DatumGetDateADT(X)    ((DateADT) DatumGetInt32(X))
-#define DatumGetTimeADT(X)    ((TimeADT) DatumGetFloat8(X))
+#define DatumGetDateADT(X)	  ((DateADT) DatumGetInt32(X))
+#define DatumGetTimeADT(X)	  ((TimeADT) DatumGetFloat8(X))
 #define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
 
-#define DateADTGetDatum(X)    Int32GetDatum(X)
-#define TimeADTGetDatum(X)    Float8GetDatum(X)
+#define DateADTGetDatum(X)	  Int32GetDatum(X)
+#define TimeADTGetDatum(X)	  Float8GetDatum(X)
 #define TimeTzADTPGetDatum(X) PointerGetDatum(X)
 
-#define PG_GETARG_DATEADT(n)     DatumGetDateADT(PG_GETARG_DATUM(n))
-#define PG_GETARG_TIMEADT(n)     DatumGetTimeADT(PG_GETARG_DATUM(n))
+#define PG_GETARG_DATEADT(n)	 DatumGetDateADT(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMEADT(n)	 DatumGetTimeADT(PG_GETARG_DATUM(n))
 #define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
 
-#define PG_RETURN_DATEADT(x)     return DateADTGetDatum(x)
-#define PG_RETURN_TIMEADT(x)     return TimeADTGetDatum(x)
+#define PG_RETURN_DATEADT(x)	 return DateADTGetDatum(x)
+#define PG_RETURN_TIMEADT(x)	 return TimeADTGetDatum(x)
 #define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x)
 
 
diff --git a/src/include/utils/datum.h b/src/include/utils/datum.h
index 9cb6c7eb45a3a3bb9a50ed1b86101db943c6db31..b667495f1869353e63424d3f4d6176b6c4938dbe 100644
--- a/src/include/utils/datum.h
+++ b/src/include/utils/datum.h
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: datum.h,v 1.12 2001/01/24 19:43:28 momjian Exp $
+ * $Id: datum.h,v 1.13 2001/03/22 04:01:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,6 +44,6 @@ extern void datumFree(Datum value, bool typByVal, int typLen);
  * XXX : See comments in the code for restrictions!
  */
 extern bool datumIsEqual(Datum value1, Datum value2,
-						 bool typByVal, int typLen);
+			 bool typByVal, int typLen);
 
 #endif	 /* DATUM_H */
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 46f85d07e12fbf4899e9ab402908039ade45600c..583897cc41f3530751e4165634a1387b8b8115c8 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: elog.h,v 1.25 2001/01/24 19:43:28 momjian Exp $
+ * $Id: elog.h,v 1.26 2001/03/22 04:01:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,20 +26,22 @@
 
 /* Configurable parameters */
 #ifdef ENABLE_SYSLOG
-extern int Use_syslog;
+extern int	Use_syslog;
+
 #endif
 extern bool Log_timestamp;
 extern bool Log_pid;
 
 
 #ifndef __GNUC__
-extern void elog(int lev, const char *fmt, ...);
+extern void elog(int lev, const char *fmt,...);
 
 #else
 /* This extension allows gcc to check the format string for consistency with
    the supplied arguments. */
-extern void elog(int lev, const char *fmt, ...)
-	__attribute__((format(printf, 2, 3)));
+extern void
+elog(int lev, const char *fmt,...)
+__attribute__((format(printf, 2, 3)));
 
 #endif
 
diff --git a/src/include/utils/fcache.h b/src/include/utils/fcache.h
index a99b804d19c3d346d2344cd4b1fdc9b6825535cc..bb081a04748d0154d7ee3d543ee318d899fd7038 100644
--- a/src/include/utils/fcache.h
+++ b/src/include/utils/fcache.h
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: fcache.h,v 1.15 2001/01/24 19:43:28 momjian Exp $
+ * $Id: fcache.h,v 1.16 2001/03/22 04:01:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,19 +34,24 @@
 
 typedef struct FunctionCache
 {
+
 	/*
 	 * Function manager's lookup info for the target function.
 	 */
 	FmgrInfo	func;
+
 	/*
 	 * Per-call info for calling the target function.  Unvarying fields
-	 * are set up by init_fcache().  Argument values are filled in as needed.
+	 * are set up by init_fcache().  Argument values are filled in as
+	 * needed.
 	 */
 	FunctionCallInfoData fcinfo;
+
 	/*
 	 * "Resultinfo" node --- used only if target function returns a set.
 	 */
 	ReturnSetInfo rsinfo;
+
 	/*
 	 * argsValid is true when we are evaluating a set-valued function and
 	 * we are in the middle of a call series; we want to pass the same
@@ -54,15 +59,16 @@ typedef struct FunctionCache
 	 * ExprEndResult).
 	 */
 	bool		argsValid;		/* TRUE if fcinfo contains valid arguments */
+
 	/*
-	 * hasSetArg is true if we found a set-valued argument to the function.
-	 * This causes the function result to be a set as well.
+	 * hasSetArg is true if we found a set-valued argument to the
+	 * function. This causes the function result to be a set as well.
 	 */
 	bool		hasSetArg;		/* some argument returns a set */
 } FunctionCache;
 
 
 extern FunctionCachePtr init_fcache(Oid foid, int nargs,
-									MemoryContext fcacheCxt);
+			MemoryContext fcacheCxt);
 
 #endif	 /* FCACHE_H */
diff --git a/src/include/utils/fmgrtab.h b/src/include/utils/fmgrtab.h
index 33cecce3196404a4be40ecb0fc73bac34aa72340..34411e33305096a2ba11181e627429032c857187 100644
--- a/src/include/utils/fmgrtab.h
+++ b/src/include/utils/fmgrtab.h
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
  * fmgrtab.h
- *    The function manager's table of internal functions.
+ *	  The function manager's table of internal functions.
  *
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: fmgrtab.h,v 1.15 2001/01/24 19:43:28 momjian Exp $
+ * $Id: fmgrtab.h,v 1.16 2001/03/22 04:01:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,14 +26,15 @@ typedef struct
 {
 	Oid			foid;			/* OID of the function */
 	const char *funcName;		/* C name of the function */
-    short       nargs;			/* 0..FUNC_MAX_ARGS, or -1 if variable count */
-    bool        strict;			/* T if function is "strict" */
+	short		nargs;			/* 0..FUNC_MAX_ARGS, or -1 if variable
+								 * count */
+	bool		strict;			/* T if function is "strict" */
 	bool		retset;			/* T if function returns a set */
-    PGFunction  func;			/* pointer to compiled function */
+	PGFunction	func;			/* pointer to compiled function */
 } FmgrBuiltin;
 
 extern const FmgrBuiltin fmgr_builtins[];
 
-extern const int fmgr_nbuiltins; /* number of entries in table */
+extern const int fmgr_nbuiltins;/* number of entries in table */
 
 #endif	 /* FMGRTAB_H */
diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h
index 27b0dc7fac8d5b0a58872dd785be160c95f625b3..99a0524accd24a717f8621cc30ded4d831ce88b2 100644
--- a/src/include/utils/geo_decls.h
+++ b/src/include/utils/geo_decls.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geo_decls.h,v 1.33 2001/02/10 02:31:29 tgl Exp $
+ * $Id: geo_decls.h,v 1.34 2001/03/22 04:01:12 momjian Exp $
  *
  * NOTE
  *	  These routines do *not* use the float types from adt/.
@@ -141,25 +141,25 @@ typedef struct
  * fixed-size pass-by-reference types.
  */
 
-#define DatumGetPointP(X)    ((Point *) DatumGetPointer(X))
-#define PointPGetDatum(X)    PointerGetDatum(X)
+#define DatumGetPointP(X)	 ((Point *) DatumGetPointer(X))
+#define PointPGetDatum(X)	 PointerGetDatum(X)
 #define PG_GETARG_POINT_P(n) DatumGetPointP(PG_GETARG_DATUM(n))
 #define PG_RETURN_POINT_P(x) return PointPGetDatum(x)
 
-#define DatumGetLsegP(X)    ((LSEG *) DatumGetPointer(X))
-#define LsegPGetDatum(X)    PointerGetDatum(X)
+#define DatumGetLsegP(X)	((LSEG *) DatumGetPointer(X))
+#define LsegPGetDatum(X)	PointerGetDatum(X)
 #define PG_GETARG_LSEG_P(n) DatumGetLsegP(PG_GETARG_DATUM(n))
 #define PG_RETURN_LSEG_P(x) return LsegPGetDatum(x)
 
-#define DatumGetPathP(X)         ((PATH *) PG_DETOAST_DATUM(X))
-#define DatumGetPathPCopy(X)     ((PATH *) PG_DETOAST_DATUM_COPY(X))
-#define PathPGetDatum(X)         PointerGetDatum(X)
-#define PG_GETARG_PATH_P(n)      DatumGetPathP(PG_GETARG_DATUM(n))
+#define DatumGetPathP(X)		 ((PATH *) PG_DETOAST_DATUM(X))
+#define DatumGetPathPCopy(X)	 ((PATH *) PG_DETOAST_DATUM_COPY(X))
+#define PathPGetDatum(X)		 PointerGetDatum(X)
+#define PG_GETARG_PATH_P(n)		 DatumGetPathP(PG_GETARG_DATUM(n))
 #define PG_GETARG_PATH_P_COPY(n) DatumGetPathPCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_PATH_P(x)      return PathPGetDatum(x)
+#define PG_RETURN_PATH_P(x)		 return PathPGetDatum(x)
 
-#define DatumGetLineP(X)    ((LINE *) DatumGetPointer(X))
-#define LinePGetDatum(X)    PointerGetDatum(X)
+#define DatumGetLineP(X)	((LINE *) DatumGetPointer(X))
+#define LinePGetDatum(X)	PointerGetDatum(X)
 #define PG_GETARG_LINE_P(n) DatumGetLineP(PG_GETARG_DATUM(n))
 #define PG_RETURN_LINE_P(x) return LinePGetDatum(x)
 
@@ -168,15 +168,15 @@ typedef struct
 #define PG_GETARG_BOX_P(n) DatumGetBoxP(PG_GETARG_DATUM(n))
 #define PG_RETURN_BOX_P(x) return BoxPGetDatum(x)
 
-#define DatumGetPolygonP(X)         ((POLYGON *) PG_DETOAST_DATUM(X))
-#define DatumGetPolygonPCopy(X)     ((POLYGON *) PG_DETOAST_DATUM_COPY(X))
-#define PolygonPGetDatum(X)         PointerGetDatum(X)
-#define PG_GETARG_POLYGON_P(n)      DatumGetPolygonP(PG_GETARG_DATUM(n))
+#define DatumGetPolygonP(X)			((POLYGON *) PG_DETOAST_DATUM(X))
+#define DatumGetPolygonPCopy(X)		((POLYGON *) PG_DETOAST_DATUM_COPY(X))
+#define PolygonPGetDatum(X)			PointerGetDatum(X)
+#define PG_GETARG_POLYGON_P(n)		DatumGetPolygonP(PG_GETARG_DATUM(n))
 #define PG_GETARG_POLYGON_P_COPY(n) DatumGetPolygonPCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_POLYGON_P(x)      return PolygonPGetDatum(x)
+#define PG_RETURN_POLYGON_P(x)		return PolygonPGetDatum(x)
 
-#define DatumGetCircleP(X)    ((CIRCLE *) DatumGetPointer(X))
-#define CirclePGetDatum(X)    PointerGetDatum(X)
+#define DatumGetCircleP(X)	  ((CIRCLE *) DatumGetPointer(X))
+#define CirclePGetDatum(X)	  PointerGetDatum(X)
 #define PG_GETARG_CIRCLE_P(n) DatumGetCircleP(PG_GETARG_DATUM(n))
 #define PG_RETURN_CIRCLE_P(x) return CirclePGetDatum(x)
 
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 7953e5a8e7a610f89689059c51105f661359a5f2..978b9da859e7791e0d7623e4513516c5325601fa 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -4,7 +4,7 @@
  * External declarations pertaining to backend/utils/misc/guc.c and
  * backend/utils/misc/guc-file.l
  *
- * $Header: /cvsroot/pgsql/src/include/utils/guc.h,v 1.5 2001/02/10 02:31:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/include/utils/guc.h,v 1.6 2001/03/22 04:01:12 momjian Exp $
  */
 #ifndef GUC_H
 #define GUC_H
@@ -36,7 +36,8 @@
  *
  * USERSET options can be set by anyone any time.
  */
-typedef enum {
+typedef enum
+{
 	PGC_POSTMASTER,
 	PGC_SIGHUP,
 	PGC_BACKEND,
@@ -45,12 +46,12 @@ typedef enum {
 } GucContext;
 
 
-void         SetConfigOption(const char * name, const char * value, GucContext context);
-const char * GetConfigOption(const char * name);
-void         ProcessConfigFile(GucContext context);
-void         ResetAllOptions(void);
-void         ParseLongOption(const char * string, char ** name, char ** value);
-bool         set_config_option(const char * name, const char * value, GucContext context, bool DoIt);
+void		SetConfigOption(const char *name, const char *value, GucContext context);
+const char *GetConfigOption(const char *name);
+void		ProcessConfigFile(GucContext context);
+void		ResetAllOptions(void);
+void		ParseLongOption(const char *string, char **name, char **value);
+bool		set_config_option(const char *name, const char *value, GucContext context, bool DoIt);
 
 
 extern bool Debug_print_query;
@@ -67,4 +68,4 @@ extern bool Show_btree_build_stats;
 
 extern bool SQL_inheritance;
 
-#endif /*GUC_H*/
+#endif	 /* GUC_H */
diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h
index 93742aef063d1dbf6cb11c01aefdc9669727f878..9d47d73d3868387068e46fe4919e1f0b35541dc6 100644
--- a/src/include/utils/hsearch.h
+++ b/src/include/utils/hsearch.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: hsearch.h,v 1.18 2001/01/24 19:43:28 momjian Exp $
+ * $Id: hsearch.h,v 1.19 2001/03/22 04:01:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -84,7 +84,7 @@ typedef struct htab
 	char	   *segbase;		/* segment base address for calculating
 								 * pointer values */
 	SEG_OFFSET *dir;			/* 'directory' of segm starts */
-	void	   *(*alloc) (Size);	/* memory allocator */
+	void	   *(*alloc) (Size);/* memory allocator */
 } HTAB;
 
 typedef struct hashctl
@@ -98,7 +98,7 @@ typedef struct hashctl
 	long		max_dsize;		/* limit to dsize if directory size is
 								 * limited */
 	long	   *segbase;		/* base for calculating bucket + seg ptrs */
-	void	   *(*alloc) (Size);	/* memory allocation function */
+	void	   *(*alloc) (Size);/* memory allocation function */
 	long	   *dir;			/* directory if allocated already */
 	long	   *hctl;			/* location of header information in shd
 								 * mem */
@@ -134,8 +134,8 @@ typedef enum
 /* hash_seq status (should be considered an opaque type by callers) */
 typedef struct
 {
-	HTAB   *hashp;
-	long	curBucket;
+	HTAB	   *hashp;
+	long		curBucket;
 	BUCKET_INDEX curIndex;
 } HASH_SEQ_STATUS;
 
diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h
index 9503fed8beaa0bd50de4a3a00fdf6e00292aa7ff..acb71e600286f448220b0053fb7bb718a26feb29 100644
--- a/src/include/utils/inet.h
+++ b/src/include/utils/inet.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: inet.h,v 1.9 2001/01/24 19:43:28 momjian Exp $
+ * $Id: inet.h,v 1.10 2001/03/22 04:01:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,8 +57,8 @@ typedef struct macaddr
 /*
  * fmgr interface macros
  */
-#define DatumGetInetP(X)    ((inet *) DatumGetPointer(X))
-#define InetPGetDatum(X)    PointerGetDatum(X)
+#define DatumGetInetP(X)	((inet *) DatumGetPointer(X))
+#define InetPGetDatum(X)	PointerGetDatum(X)
 #define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n))
 #define PG_RETURN_INET_P(x) return InetPGetDatum(x)
 /* macaddr is a fixed-length pass-by-reference datatype */
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 5f9a960589ea7b6c4ef1040bfd7da854c374cbff..f1c4aff1c804172da17b24a438551c0b631c98c0 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lsyscache.h,v 1.29 2001/01/24 19:43:28 momjian Exp $
+ * $Id: lsyscache.h,v 1.30 2001/03/22 04:01:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,6 +42,6 @@ extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
 extern char get_typstorage(Oid typid);
 extern Datum get_typdefault(Oid typid);
 
-#define TypeIsToastable(typid)  (get_typstorage(typid) != 'p')
+#define TypeIsToastable(typid)	(get_typstorage(typid) != 'p')
 
 #endif	 /* LSYSCACHE_H */
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
index 7ba0719dcb55897b439400ea58ec1db92cdca482..ca8d2d78d04b99402d3c3d1d7e55e4d468e918df 100644
--- a/src/include/utils/memutils.h
+++ b/src/include/utils/memutils.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: memutils.h,v 1.42 2001/02/06 01:53:52 tgl Exp $
+ * $Id: memutils.h,v 1.43 2001/03/22 04:01:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,9 +30,9 @@
  *		be summarily denied.
  *
  * XXX This is deliberately chosen to correspond to the limiting size
- * of varlena objects under TOAST.  See VARATT_MASK_SIZE in postgres.h.
+ * of varlena objects under TOAST.	See VARATT_MASK_SIZE in postgres.h.
  */
-#define MaxAllocSize	((Size) 0x3fffffff)	/* 1 gigabyte - 1 */
+#define MaxAllocSize	((Size) 0x3fffffff)		/* 1 gigabyte - 1 */
 
 #define AllocSizeIsValid(size)	(0 < (size) && (size) <= MaxAllocSize)
 
@@ -40,14 +40,14 @@
  * All chunks allocated by any memory context manager are required to be
  * preceded by a StandardChunkHeader at a spacing of STANDARDCHUNKHEADERSIZE.
  * A currently-allocated chunk must contain a backpointer to its owning
- * context as well as the allocated size of the chunk.  The backpointer is
- * used by pfree() and repalloc() to find the context to call.  The allocated
+ * context as well as the allocated size of the chunk.	The backpointer is
+ * used by pfree() and repalloc() to find the context to call.	The allocated
  * size is not absolutely essential, but it's expected to be needed by any
  * reasonable implementation.
  */
 typedef struct StandardChunkHeader
 {
-	MemoryContext	context;	/* owning context */
+	MemoryContext context;		/* owning context */
 	Size		size;			/* size of data space allocated in chunk */
 #ifdef MEMORY_CONTEXT_CHECKING
 	/* when debugging memory usage, also store actual requested size */
@@ -92,9 +92,9 @@ extern bool MemoryContextContains(MemoryContext context, void *pointer);
  * specific creation routines, and noplace else.
  */
 extern MemoryContext MemoryContextCreate(NodeTag tag, Size size,
-										 MemoryContextMethods *methods,
-										 MemoryContext parent,
-										 const char *name);
+					MemoryContextMethods *methods,
+					MemoryContext parent,
+					const char *name);
 
 
 /*
@@ -103,10 +103,10 @@ extern MemoryContext MemoryContextCreate(NodeTag tag, Size size,
 
 /* aset.c */
 extern MemoryContext AllocSetContextCreate(MemoryContext parent,
-										   const char *name,
-										   Size minContextSize,
-										   Size initBlockSize,
-										   Size maxBlockSize);
+					  const char *name,
+					  Size minContextSize,
+					  Size initBlockSize,
+					  Size maxBlockSize);
 
 /*
  * Recommended default alloc parameters, suitable for "ordinary" contexts
diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h
index fde50d224c9ca965165e5aa6caa93f772e7f7b6c..1e09e82e69a8590389b2349382d3b2cd7efd0cc9 100644
--- a/src/include/utils/nabstime.h
+++ b/src/include/utils/nabstime.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nabstime.h,v 1.28 2001/01/24 19:43:28 momjian Exp $
+ * $Id: nabstime.h,v 1.29 2001/03/22 04:01:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,7 +79,7 @@ typedef TimeIntervalData *TimeInterval;
 #define CURRENT_ABSTIME ((AbsoluteTime) 0x7FFFFFFD)		/* 2147483646 (2^31 - 2) */
 #define NOEND_ABSTIME	((AbsoluteTime) 0x7FFFFFFC)		/* 2147483645 (2^31 - 3) */
 #define BIG_ABSTIME		((AbsoluteTime) 0x7FFFFFFB)		/* 2147483644 (2^31 - 4) */
-#define NOSTART_ABSTIME	((AbsoluteTime) INT_MIN)		/* -2147483648 */
+#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN)		/* -2147483648 */
 
 #define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE)		/* 2147483647 (2^31 - 1) */
 
diff --git a/src/include/utils/numeric.h b/src/include/utils/numeric.h
index 8e6412eabeeff7e863abb2cd103d6bb5cf4b3897..fa251c2262986bcbbd681f927fc31e1541a8e414 100644
--- a/src/include/utils/numeric.h
+++ b/src/include/utils/numeric.h
@@ -5,7 +5,7 @@
  *
  *	1998 Jan Wieck
  *
- * $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.11 2000/07/17 03:05:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/include/utils/numeric.h,v 1.12 2001/03/22 04:01:13 momjian Exp $
  *
  * ----------
  */
@@ -75,11 +75,11 @@ typedef NumericData *Numeric;
  * fmgr interface macros
  */
 
-#define DatumGetNumeric(X)        ((Numeric) PG_DETOAST_DATUM(X))
-#define DatumGetNumericCopy(X)    ((Numeric) PG_DETOAST_DATUM_COPY(X))
-#define NumericGetDatum(X)        PointerGetDatum(X)
-#define PG_GETARG_NUMERIC(n)      DatumGetNumeric(PG_GETARG_DATUM(n))
+#define DatumGetNumeric(X)		  ((Numeric) PG_DETOAST_DATUM(X))
+#define DatumGetNumericCopy(X)	  ((Numeric) PG_DETOAST_DATUM_COPY(X))
+#define NumericGetDatum(X)		  PointerGetDatum(X)
+#define PG_GETARG_NUMERIC(n)	  DatumGetNumeric(PG_GETARG_DATUM(n))
 #define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_NUMERIC(x)      return NumericGetDatum(x)
+#define PG_RETURN_NUMERIC(x)	  return NumericGetDatum(x)
 
 #endif	 /* _PG_NUMERIC_H_ */
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h
index cb86616d80f5463c303d2edb257b4630e109f23d..07a7320f9764c893057e3e7c281cb95fd3584940 100644
--- a/src/include/utils/palloc.h
+++ b/src/include/utils/palloc.h
@@ -6,9 +6,9 @@
  * This file contains the basic memory allocation interface that is
  * needed by almost every backend module.  It is included directly by
  * postgres.h, so the definitions here are automatically available
- * everywhere.  Keep it lean!
+ * everywhere.	Keep it lean!
  *
- * Memory allocation occurs within "contexts".  Every chunk obtained from
+ * Memory allocation occurs within "contexts".	Every chunk obtained from
  * palloc()/MemoryContextAlloc() is allocated within a specific context.
  * The entire contents of a context can be freed easily and quickly by
  * resetting or deleting the context --- this is both faster and less
@@ -21,7 +21,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: palloc.h,v 1.15 2001/02/10 02:31:29 tgl Exp $
+ * $Id: palloc.h,v 1.16 2001/03/22 04:01:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,7 +29,7 @@
 #define PALLOC_H
 
 /*
- * Type MemoryContextData is declared in nodes/memnodes.h.  Most users
+ * Type MemoryContextData is declared in nodes/memnodes.h.	Most users
  * of memory allocation should just treat it as an abstract type, so we
  * do not provide the struct contents here.
  */
@@ -37,7 +37,7 @@ typedef struct MemoryContextData *MemoryContext;
 
 /*
  * CurrentMemoryContext is the default allocation context for palloc().
- * We declare it here so that palloc() can be a macro.  Avoid accessing it
+ * We declare it here so that palloc() can be a macro.	Avoid accessing it
  * directly!  Instead, use MemoryContextSwitchTo() to change the setting.
  */
 extern DLLIMPORT MemoryContext CurrentMemoryContext;
@@ -47,7 +47,7 @@ extern DLLIMPORT MemoryContext CurrentMemoryContext;
  */
 extern void *MemoryContextAlloc(MemoryContext context, Size size);
 
-#define palloc(sz)  MemoryContextAlloc(CurrentMemoryContext, (sz))
+#define palloc(sz)	MemoryContextAlloc(CurrentMemoryContext, (sz))
 
 extern void pfree(void *pointer);
 
diff --git a/src/include/utils/pg_crc.h b/src/include/utils/pg_crc.h
index 18e012bbcd0ca9a314ac000dd3c006f9552f833f..ad67e3b1c94b5030e5cca2c197f02b7b82c92a04 100644
--- a/src/include/utils/pg_crc.h
+++ b/src/include/utils/pg_crc.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_crc.h,v 1.1 2001/03/13 01:17:06 tgl Exp $
+ * $Id: pg_crc.h,v 1.2 2001/03/22 04:01:14 momjian Exp $
  */
 #ifndef PG_CRC_H
 #define PG_CRC_H
@@ -34,7 +34,7 @@
 /*
  * crc0 represents the LSBs of the 64-bit value, crc1 the MSBs.  Note that
  * with crc0 placed first, the output of 32-bit and 64-bit implementations
- * will be bit-compatible only on little-endian architectures.  If it were
+ * will be bit-compatible only on little-endian architectures.	If it were
  * important to make the two possible implementations bit-compatible on
  * all machines, we could do a configure test to decide how to order the
  * two fields, but it seems not worth the trouble.
@@ -46,7 +46,7 @@ typedef struct crc64
 } crc64;
 
 /* Initialize a CRC accumulator */
-#define INIT_CRC64(crc)	((crc).crc0 = 0xffffffff, (crc).crc1 = 0xffffffff)
+#define INIT_CRC64(crc) ((crc).crc0 = 0xffffffff, (crc).crc1 = 0xffffffff)
 
 /* Finish a CRC calculation */
 #define FIN_CRC64(crc)	((crc).crc0 ^= 0xffffffff, (crc).crc1 ^= 0xffffffff)
@@ -76,7 +76,7 @@ do { \
 extern const uint32 crc_table0[];
 extern const uint32 crc_table1[];
 
-#else /* int64 works */
+#else							/* int64 works */
 
 typedef struct crc64
 {
@@ -84,7 +84,7 @@ typedef struct crc64
 } crc64;
 
 /* Initialize a CRC accumulator */
-#define INIT_CRC64(crc)	((crc).crc0 = (uint64) 0xffffffffffffffff)
+#define INIT_CRC64(crc) ((crc).crc0 = (uint64) 0xffffffffffffffff)
 
 /* Finish a CRC calculation */
 #define FIN_CRC64(crc)	((crc).crc0 ^= (uint64) 0xffffffffffffffff)
@@ -110,6 +110,6 @@ do { \
 /* Constant table for CRC calculation */
 extern const uint64 crc_table[];
 
-#endif /* INT64_IS_BUSTED */
+#endif	 /* INT64_IS_BUSTED */
 
 #endif	 /* PG_CRC_H */
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index a8040cc5442647eaf86c970430aaef4c24cc4470..062806bc3986a35f99cfcb27ca9db9b0f5ce3dbe 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -4,7 +4,7 @@
  *	 The PostgreSQL locale utils.
  *
  *
- * $Id: pg_locale.h,v 1.6 2001/01/24 19:43:28 momjian Exp $
+ * $Id: pg_locale.h,v 1.7 2001/03/22 04:01:14 momjian Exp $
  *
  *	 Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
  *
@@ -38,7 +38,7 @@ extern void PGLC_current(PG_LocaleCategories * lc);
 
 /*------
  * Return the POSIX lconv struct (contains number/money formatting information)
- * with locale information for all categories.  Note that returned lconv
+ * with locale information for all categories.	Note that returned lconv
  * does not depend on currently active category settings, but on external
  * environment variables for locale.
  *------
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 27ef1bf433103ccc16c1bc4b1e3320461a04def7..1cdd770dfdc0de37f7227d54becd824b4ef1ef96 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: portal.h,v 1.26 2001/02/27 22:07:34 tgl Exp $
+ * $Id: portal.h,v 1.27 2001/03/22 04:01:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,8 +34,8 @@ typedef struct PortalData
 	EState	   *state;			/* Execution state of query */
 	bool		atStart;		/* T => fetch backwards is not allowed */
 	bool		atEnd;			/* T => fetch forwards is not allowed */
-	void		(*cleanup) (Portal); /* Cleanup routine (optional) */
-} PortalData;
+	void		(*cleanup) (Portal);	/* Cleanup routine (optional) */
+}			PortalData;
 
 /*
  * PortalIsValid
@@ -46,9 +46,9 @@ typedef struct PortalData
 /*
  * Access macros for Portal ... use these in preference to field access.
  */
-#define PortalGetQueryDesc(portal)  ((portal)->queryDesc)
-#define PortalGetTupleDesc(portal)  ((portal)->attinfo)
-#define PortalGetState(portal)  ((portal)->state)
+#define PortalGetQueryDesc(portal)	((portal)->queryDesc)
+#define PortalGetTupleDesc(portal)	((portal)->attinfo)
+#define PortalGetState(portal)	((portal)->state)
 #define PortalGetHeapMemory(portal)  ((portal)->heap)
 
 /*
diff --git a/src/include/utils/ps_status.h b/src/include/utils/ps_status.h
index a981fc398b1bc88e17244878fc51d98651c84f8a..9690a156ae1421047a02be7bca9141aed3b9d927 100644
--- a/src/include/utils/ps_status.h
+++ b/src/include/utils/ps_status.h
@@ -10,15 +10,14 @@
 #ifndef PS_STATUS_H
 #define PS_STATUS_H
 
-void
-init_ps_display(int argc, char *argv[],
-				const char * username, const char * dbname,
-				const char * host_info);
+void init_ps_display(int argc, char *argv[],
+				const char *username, const char *dbname,
+				const char *host_info);
 
 void
-set_ps_display(const char * value);
+			set_ps_display(const char *value);
 
 const char *
-get_ps_display(void);
+			get_ps_display(void);
 
 #endif	 /* PS_STATUS_H */
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 1a7cf32c8744087253c73d277e3c0fd12eb68d4a..5853be716d18d6fb4354f6784e2dc0a54598a047 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rel.h,v 1.44 2001/01/24 19:43:29 momjian Exp $
+ * $Id: rel.h,v 1.45 2001/03/22 04:01:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -87,13 +87,13 @@ typedef struct TriggerDesc
 typedef struct RelationData
 {
 	File		rd_fd;			/* open file descriptor, or -1 if none */
-	RelFileNode	rd_node;		/* relation file node */
+	RelFileNode rd_node;		/* relation file node */
 	int			rd_nblocks;		/* number of blocks in rel */
 	uint16		rd_refcnt;		/* reference count */
 	bool		rd_myxactonly;	/* rel uses the local buffer mgr */
 	bool		rd_isnailed;	/* rel is nailed in cache */
 	bool		rd_indexfound;	/* true if rd_indexlist is valid */
-	bool		rd_uniqueindex;	/* true if rel is a UNIQUE index */
+	bool		rd_uniqueindex; /* true if rel is a UNIQUE index */
 	Form_pg_am	rd_am;			/* AM tuple */
 	Form_pg_class rd_rel;		/* RELATION tuple */
 	Oid			rd_id;			/* relation's object id */
@@ -246,7 +246,7 @@ typedef Relation *RelationPtr;
  * Routines in utils/cache/rel.c
  */
 extern void RelationSetIndexSupport(Relation relation,
-									IndexStrategy strategy,
-									RegProcedure *support);
+						IndexStrategy strategy,
+						RegProcedure *support);
 
 #endif	 /* REL_H */
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 7cb3c26606bc0077e2e80d5d37aa7488ad84a714..8d4e2ae62c419658f44ec3f1adb9853a658ea2c6 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: syscache.h,v 1.28 2001/01/24 19:43:29 momjian Exp $
+ * $Id: syscache.h,v 1.29 2001/03/22 04:01:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,14 +60,14 @@
 extern void InitCatalogCache(void);
 
 extern HeapTuple SearchSysCache(int cacheId,
-					Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4);
 extern void ReleaseSysCache(HeapTuple tuple);
 
 /* convenience routines */
 extern HeapTuple SearchSysCacheCopy(int cacheId,
-					Datum key1, Datum key2, Datum key3, Datum key4);
+				   Datum key1, Datum key2, Datum key3, Datum key4);
 extern Oid GetSysCacheOid(int cacheId,
-					Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4);
 
 /* macro for just probing for existence of a tuple via the syscache */
 #define SearchSysCacheExists(c,k1,k2,k3,k4)  \
diff --git a/src/include/utils/temprel.h b/src/include/utils/temprel.h
index e7b38f30f8318e4d670bc7a2cae2306c64ee1361..3fc0ed4b11ad8eb80cb3e64be5a34a383f70cd47 100644
--- a/src/include/utils/temprel.h
+++ b/src/include/utils/temprel.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: temprel.h,v 1.14 2001/01/24 19:43:29 momjian Exp $
+ * $Id: temprel.h,v 1.15 2001/03/22 04:01:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,10 +17,10 @@
 #include "access/htup.h"
 
 extern void create_temp_relation(const char *relname,
-								 HeapTuple pg_class_tuple);
+					 HeapTuple pg_class_tuple);
 extern void remove_temp_rel_by_relid(Oid relid);
 extern bool rename_temp_relation(const char *oldname,
-								 const char *newname);
+					 const char *newname);
 
 extern void remove_all_temp_relations(void);
 extern void AtEOXact_temp_relations(bool isCommit);
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h
index 5f74d55750ea630ae2db3516bb32fc08a2e51759..34af2ef85c3134a62f8e445a6a43d80f20bb3f8f 100644
--- a/src/include/utils/timestamp.h
+++ b/src/include/utils/timestamp.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: timestamp.h,v 1.15 2001/03/14 20:12:10 tgl Exp $
+ * $Id: timestamp.h,v 1.16 2001/03/22 04:01:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,8 +35,10 @@ typedef double Timestamp;
 
 typedef struct
 {
-	double		time;	/* all time units other than months and years */
-	int32		month;	/* months and years, after time for alignment */
+	double		time;			/* all time units other than months and
+								 * years */
+	int32		month;			/* months and years, after time for
+								 * alignment */
 } Interval;
 
 
@@ -52,10 +54,10 @@ typedef struct
 #define TimestampGetDatum(X)  Float8GetDatum(X)
 #define IntervalPGetDatum(X)  PointerGetDatum(X)
 
-#define PG_GETARG_TIMESTAMP(n)  DatumGetTimestamp(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMESTAMP(n)	DatumGetTimestamp(PG_GETARG_DATUM(n))
 #define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n))
 
-#define PG_RETURN_TIMESTAMP(x)  return TimestampGetDatum(x)
+#define PG_RETURN_TIMESTAMP(x)	return TimestampGetDatum(x)
 #define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x)
 
 
@@ -172,12 +174,12 @@ extern Datum now(PG_FUNCTION_ARGS);
 /* Internal routines (not fmgr-callable) */
 
 extern int	tm2timestamp(struct tm * tm, double fsec, int *tzp, Timestamp *dt);
-extern int	timestamp2tm(Timestamp dt, int *tzp, struct tm * tm,
-						 double *fsec, char **tzn);
+extern int timestamp2tm(Timestamp dt, int *tzp, struct tm * tm,
+			 double *fsec, char **tzn);
 
 extern Timestamp SetTimestamp(Timestamp timestamp);
 
-extern void	isoweek2date( int woy, int *year, int *mon, int *mday);
+extern void isoweek2date(int woy, int *year, int *mon, int *mday);
 extern int	date2isoweek(int year, int mon, int mday);
 
 #endif	 /* TIMESTAMP_H */
diff --git a/src/include/utils/tuplestore.h b/src/include/utils/tuplestore.h
index 5dc56fd788f5d72eda4d8d7401cb66d9ceb5764f..3e73f8fca99c008aaa976d542af1d5af045b422a 100644
--- a/src/include/utils/tuplestore.h
+++ b/src/include/utils/tuplestore.h
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tuplestore.h,v 1.2 2001/01/24 19:43:29 momjian Exp $
+ * $Id: tuplestore.h,v 1.3 2001/03/22 04:01:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,14 +33,14 @@ typedef struct Tuplestorestate Tuplestorestate;
  */
 
 extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
-											  int maxKBytes);
+					  int maxKBytes);
 
 extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple);
 
 extern void tuplestore_donestoring(Tuplestorestate *state);
 
 extern void *tuplestore_gettuple(Tuplestorestate *state, bool forward,
-								 bool *should_free);
+					bool *should_free);
 
 #define tuplestore_getheaptuple(state, forward, should_free) \
 	((HeapTuple) tuplestore_gettuple(state, forward, should_free))
diff --git a/src/include/utils/varbit.h b/src/include/utils/varbit.h
index b64b7d974670de03c9881b52d20a8092eb0c9067..3a1b3f07a0409a604b89f50bbe0f940405d17444 100644
--- a/src/include/utils/varbit.h
+++ b/src/include/utils/varbit.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: varbit.h,v 1.9 2001/01/24 19:43:29 momjian Exp $
+ * $Id: varbit.h,v 1.10 2001/03/22 04:01:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,7 +22,8 @@
  */
 typedef struct
 {
-	int32		vl_len;			/* standard varlena header (total size in bytes) */
+	int32		vl_len;			/* standard varlena header (total size in
+								 * bytes) */
 	int32		bit_len;		/* number of valid bits */
 	bits8		bit_dat[1];		/* bit string, most sig. byte first */
 } VarBit;
@@ -33,12 +34,12 @@ typedef struct
  * BIT and BIT VARYING are toastable varlena types.  They are the same
  * as far as representation goes, so we just have one set of macros.
  */
-#define DatumGetVarBitP(X)         ((VarBit *) PG_DETOAST_DATUM(X))
-#define DatumGetVarBitPCopy(X)     ((VarBit *) PG_DETOAST_DATUM_COPY(X))
-#define VarBitPGetDatum(X)         PointerGetDatum(X)
-#define PG_GETARG_VARBIT_P(n)      DatumGetVarBitP(PG_GETARG_DATUM(n))
+#define DatumGetVarBitP(X)		   ((VarBit *) PG_DETOAST_DATUM(X))
+#define DatumGetVarBitPCopy(X)	   ((VarBit *) PG_DETOAST_DATUM_COPY(X))
+#define VarBitPGetDatum(X)		   PointerGetDatum(X)
+#define PG_GETARG_VARBIT_P(n)	   DatumGetVarBitP(PG_GETARG_DATUM(n))
 #define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n))
-#define PG_RETURN_VARBIT_P(x)      return VarBitPGetDatum(x)
+#define PG_RETURN_VARBIT_P(x)	   return VarBitPGetDatum(x)
 
 /* Header overhead *in addition to* VARHDRSZ */
 #define VARBITHDRSZ			sizeof(int32)
diff --git a/src/interfaces/cli/example1.c b/src/interfaces/cli/example1.c
index 75cedda3dd9e7e792ee20c1bca3d1c3a186077e8..9660ce57198afe5d3bf91963af922f0056b9ddc1 100644
--- a/src/interfaces/cli/example1.c
+++ b/src/interfaces/cli/example1.c
@@ -40,7 +40,7 @@
 int			print_err(SQLSMALLINT handletype, SQLINTEGER handle);
 
 int
-example1(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen)
+example1(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen)
 {
 	SQLHENV		henv;
 	SQLHDBC		hdbc;
@@ -135,12 +135,12 @@ example1(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen)
 	/* this time, explicitly allocate an application row descriptor */
 	SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);
 	SQLSetDescRec(hdesc, 1, SQL_INTEGER, 0, 0L, 0, 0,
-		(SQLPOINTER) & id, (SQLINTEGER *) NULL, (SQLSMALLINT *) & idind);
+		 (SQLPOINTER) & id, (SQLINTEGER *) NULL, (SQLSMALLINT *) &idind);
 
 	SQLSetDescRec(hdesc, 2, SQL_
 				  CHAR, 0, (SQLINTEGER) sizeof(name),
-				  0, 0, (SQLPOINTER) & name, (SQLINTEGER *) & namelen,
-				  (SQLSMALLINT *) & nameind);
+				  0, 0, (SQLPOINTER) & name, (SQLINTEGER *) &namelen,
+				  (SQLSMALLINT *) &nameind);
 	/* associate descriptor with statement handle */
 	SQLSetStmtAttr(hstmt, SQL_ATTR_APP_ROW_DESC, &hdesc, 0);
 	/* execute the fetch */
diff --git a/src/interfaces/cli/example2.c b/src/interfaces/cli/example2.c
index 7230abc4da8e7f19e1d8e7a1445483e0b5b5b6da..21685ef21b0b393c332ae9a730945ece02a38234 100644
--- a/src/interfaces/cli/example2.c
+++ b/src/interfaces/cli/example2.c
@@ -39,17 +39,17 @@
 #define  max(a,b) (a>b?a:b)
 
 int			print_err(SQLSMALLINT handletype, SQLINTEGER handle);
-int build_indicator_message(SQLCHAR * errmsg,
+int build_indicator_message(SQLCHAR *errmsg,
 						SQLPOINTER * data,
 						SQLINTEGER collen,
-						SQLINTEGER * outlen,
+						SQLINTEGER *outlen,
 						SQLSMALLINT colnum);
 
 SQLINTEGER display_length(SQLSMALLINT coltype,
 			   SQLINTEGER collen,
-			   SQLCHAR * colname);
+			   SQLCHAR *colname);
 
-example2(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen, SQLCHAR * sqlstr)
+example2(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen, SQLCHAR *sqlstr)
 {
 	int			i;
 	SQLHENV		henv;
@@ -214,13 +214,13 @@ example2(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen, SQLCHAR * sqlstr)
 
 SQLINTEGER
 display_length(SQLSMALLINT coltype, SQLINTEGER collen,
-			   SQLCHAR * colname)
+			   SQLCHAR *colname)
 {
 	switch (coltype)
 	{
 
-		case SQL_VARCHAR:
-		case SQL_CHAR:
+			case SQL_VARCHAR:
+			case SQL_CHAR:
 			return (max(collen, strlen((char *) colname)));
 			break;
 
@@ -252,8 +252,8 @@ display_length(SQLSMALLINT coltype, SQLINTEGER collen,
 }
 
 int
-build_indicator_message(SQLCHAR * errmsg, SQLPOINTER * data,
-			  SQLINTEGER collen, SQLINTEGER * outlen, SQLSMALLINT colnum)
+build_indicator_message(SQLCHAR *errmsg, SQLPOINTER * data,
+			   SQLINTEGER collen, SQLINTEGER *outlen, SQLSMALLINT colnum)
 {
 	if (*outlen == SQL_NULL_DATA)
 	{
diff --git a/src/interfaces/cli/sqlcli.h b/src/interfaces/cli/sqlcli.h
index a9145495fc62612c78cb91d82112d9345805dc34..2942abf12fae3b7a3847da836f99d09c116ece46 100644
--- a/src/interfaces/cli/sqlcli.h
+++ b/src/interfaces/cli/sqlcli.h
@@ -473,7 +473,7 @@ SQLRETURN	SQLAllocEnv(SQLHENV * EnvironmentHandle);
 
 SQLRETURN SQLAllocHandle(SQLSMALLINT HandleType,
 			   SQLINTEGER InputHandle,
-			   SQLINTEGER * OutputHandle);
+			   SQLINTEGER *OutputHandle);
 
 SQLRETURN SQLAllocStmt(SQLHDBC ConnectionHandle,
 			 SQLSTMT * StatementHandle);
@@ -483,7 +483,7 @@ SQLRETURN SQLBindCol(SQLHSTMT StatementHandle,
 		   SQLSMALLINT BufferType,
 		   SQLPOINTER Data,
 		   SQLINTEGER BufferLength,
-		   SQLINTEGER * DataLength);
+		   SQLINTEGER *DataLength);
 
 SQLRETURN SQLBindParam(SQLHSTMT StatementHandle,
 			 SQLSMALLINT ParamNumber,
@@ -492,7 +492,7 @@ SQLRETURN SQLBindParam(SQLHSTMT StatementHandle,
 			 SQLINTEGER ParamLength,
 			 SQLSMALLINT Scale,
 			 SQLPOINTER Data,
-			 SQLINTEGER * DataLength);
+			 SQLINTEGER *DataLength);
 
 SQLRETURN	SQLCancel(SQLHSTMT StatementHandle);
 
@@ -501,17 +501,17 @@ SQLRETURN	SQLCloseCursor(SQLHSTMT StatementHandle);
 SQLRETURN SQLColAttribute(SQLHSTMT StatementHandle,
 				SQLSMALLINT ColumnNumber,
 				SQLSMALLINT FieldIdentifier,
-				SQLCHAR * CharacterAttribute,
+				SQLCHAR *CharacterAttribute,
 				SQLINTEGER BufferLength,
-				SQLINTEGER * AttributetLength,
-				SQLINTEGER * NumericAttribute);
+				SQLINTEGER *AttributetLength,
+				SQLINTEGER *NumericAttribute);
 
 SQLRETURN SQLConnect(SQLHDBC ConnectionHandle,
-		   SQLCHAR * ServerName,
+		   SQLCHAR *ServerName,
 		   SQLSMALLINT NameLength1,
-		   SQLCHAR * UserName,
+		   SQLCHAR *UserName,
 		   SQLSMALLINT NameLength2,
-		   SQLCHAR * Authentication,
+		   SQLCHAR *Authentication,
 		   SQLSMALLINT NameLength3);
 
 SQLRETURN SQLCopyDesc(SQLHDESC SourceDescHandle,
@@ -519,22 +519,22 @@ SQLRETURN SQLCopyDesc(SQLHDESC SourceDescHandle,
 
 SQLRETURN SQLDataSources(SQLHENV EnvironmentHandle,
 			   SQLSMALLINT Direction,
-			   SQLCHAR * ServerName,
+			   SQLCHAR *ServerName,
 			   SQLSMALLINT BufferLength1,
-			   SQLSMALLINT * NameLength1,
-			   SQLCHAR * Description,
+			   SQLSMALLINT *NameLength1,
+			   SQLCHAR *Description,
 			   SQLSMALLINT BufferLength2,
-			   SQLSMALLINT * NameLength2);
+			   SQLSMALLINT *NameLength2);
 
 SQLRETURN SQLDescribeCol(SQLHSTMT StatementHandle,
 			   SQLSMALLINT ColumnNumber,
-			   SQLCHAR * ColumnName,
+			   SQLCHAR *ColumnName,
 			   SQLSMALLINT BufferLength,
-			   SQLSMALLINT * ColumnNameLength,
-			   SQLSMALLINT * ColumnType,
-			   SQLINTEGER * ColumnLength,
-			   SQLSMALLINT * ColumnScale,
-			   SQLSMALLINT * Nullable);
+			   SQLSMALLINT *ColumnNameLength,
+			   SQLSMALLINT *ColumnType,
+			   SQLINTEGER *ColumnLength,
+			   SQLSMALLINT *ColumnScale,
+			   SQLSMALLINT *Nullable);
 
 SQLRETURN	SQLDisconnect(SQLHDBC ConnectionHandle);
 
@@ -545,14 +545,14 @@ SQLRETURN SQLEndTran(SQLSMALLINT HandleType,
 SQLRETURN SQLError(SQLHENV EnvironmentHandle,
 		 SQLHDBC ConnectionHandle,
 		 SQLSTMT StatementHandle,
-		 SQLCHAR * Sqlstate,
-		 SQLINTEGER * NativeError,
-		 SQLCHAR * MessageText,
+		 SQLCHAR *Sqlstate,
+		 SQLINTEGER *NativeError,
+		 SQLCHAR *MessageText,
 		 SQLINTEGER BufferLength,
-		 SQLINTEGER * TextLength);
+		 SQLINTEGER *TextLength);
 
 SQLRETURN SQLExecDirect(SQLHSTMT StatementHandle,
-			  SQLCHAR * StatementText,
+			  SQLCHAR *StatementText,
 			  SQLSMALLINT StringLength);
 
 SQLRETURN	SQLExecute(SQLHSTMT StatementHandle);
@@ -576,38 +576,38 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC ConnectionHandle,
 				  SQLINTEGER Attribute,
 				  SQLPOINTER Value,
 				  SQLINTEGER BufferLength,
-				  SQLINTEGER * StringLength);
+				  SQLINTEGER *StringLength);
 
 SQLRETURN SQLGetCursorName(SQLHSTMT StatementHandle,
-				 SQLCHAR * CursorName,
+				 SQLCHAR *CursorName,
 				 SQLSMALLINT BufferLength,
-				 SQLSMALLINT * NameLength);
+				 SQLSMALLINT *NameLength);
 
 SQLRETURN SQLGetData(SQLHSTMT StatementHandle,
 		   SQLSMALLINT ColumnNumber,
 		   SQLSMALLINT TargetType,
 		   SQLPOINTER TargetValue,
 		   SQLINTEGER BufferLength,
-		   SQLINTEGER * IndicatorValue);
+		   SQLINTEGER *IndicatorValue);
 
 SQLRETURN SQLGetDescField(SQLHDESC DescriptorHandle,
 				SQLSMALLINT RecordNumber,
 				SQLSMALLINT FieldIdentifier,
 				SQLPOINTER Value,
 				SQLINTEGER BufferLength,
-				SQLINTEGER * StringLength);
+				SQLINTEGER *StringLength);
 
 SQLRETURN SQLGetDescRec(SQLHDESC DescriptorHandle,
 			  SQLSMALLINT RecordNumber,
-			  SQLCHAR * Name,
+			  SQLCHAR *Name,
 			  SQLSMALLINT BufferLength,
-			  SQLSMALLINT * StringLength,
-			  SQLSMALLINT * Type,
-			  SQLSMALLINT * SubType,
-			  SQLINTEGER * Length,
-			  SQLSMALLINT * Precision,
-			  SQLSMALLINT * Scale,
-			  SQLSMALLINT * Nullable);
+			  SQLSMALLINT *StringLength,
+			  SQLSMALLINT *Type,
+			  SQLSMALLINT *SubType,
+			  SQLINTEGER *Length,
+			  SQLSMALLINT *Precision,
+			  SQLSMALLINT *Scale,
+			  SQLSMALLINT *Nullable);
 
 SQLRETURN SQLGetDiagField(SQLSMALLINT HandleType,
 				SQLINTEGER Handle,
@@ -615,51 +615,51 @@ SQLRETURN SQLGetDiagField(SQLSMALLINT HandleType,
 				SQLSMALLINT DiagIdentifier,
 				SQLPOINTER DiagInfo,
 				SQLSMALLINT BufferLength,
-				SQLSMALLINT * StringLength);
+				SQLSMALLINT *StringLength);
 
 
 SQLRETURN SQLGetDiagRec(SQLSMALLINT HandleType,
 			  SQLINTEGER Handle,
 			  SQLSMALLINT RecordNumber,
-			  SQLCHAR * Sqlstate,
-			  SQLINTEGER * NativeError,
-			  SQLCHAR * MessageText,
+			  SQLCHAR *Sqlstate,
+			  SQLINTEGER *NativeError,
+			  SQLCHAR *MessageText,
 			  SQLSMALLINT BufferLength,
-			  SQLSMALLINT * StringLength);
+			  SQLSMALLINT *StringLength);
 
 SQLRETURN SQLGetEnvAttr(SQLHENV EnvironmentHandle,
 			  SQLINTEGER Attribute,
 			  SQLPOINTER Value,
 			  SQLINTEGER BufferLength,
-			  SQLINTEGER * StringLength);
+			  SQLINTEGER *StringLength);
 
 SQLRETURN SQLGetFunctions(SQLHDBC ConnectionHandle,
 				SQLSMALLINT FunctionId,
-				SQLSMALLINT * Supported);
+				SQLSMALLINT *Supported);
 
 SQLRETURN SQLGetInfo(SQLHDBC ConnectionHandle,
 		   SQLSMALLINT InfoType,
 		   SQLPOINTER InfoValue,
 		   SQLSMALLINT BufferLength,
-		   SQLSMALLINT * StringLength);
+		   SQLSMALLINT *StringLength);
 
 SQLRETURN SQLGetStmtAttr(SQLHSTMT StatementHandle,
 			   SQLINTEGER Attribute,
 			   SQLPOINTER Value,
 			   SQLINTEGER BufferLength,
-			   SQLINTEGER * StringLength);
+			   SQLINTEGER *StringLength);
 
 SQLRETURN SQLGetTypeInfo(SQLHSTMT StatementHandle,
 			   SQLSMALLINT DataType);
 
 SQLRETURN SQLNumResultCols(SQLHSTMT StatementHandle,
-				 SQLINTEGER * ColumnCount);
+				 SQLINTEGER *ColumnCount);
 
 SQLRETURN SQLParamData(SQLHSTMT StatementHandle,
 			 SQLPOINTER * Value);
 
 SQLRETURN SQLPrepare(SQLHSTMT StatementHandle,
-		   SQLCHAR * StatementText,
+		   SQLCHAR *StatementText,
 		   SQLSMALLINT StringLength);
 
 
@@ -668,7 +668,7 @@ SQLRETURN SQLPutData(SQLHSTMT StatementHandle,
 		   SQLINTEGER StringLength);
 
 SQLRETURN SQLRowCount(SQLHSTMT StatementHandle,
-			SQLINTEGER * RowCount);
+			SQLINTEGER *RowCount);
 
 SQLRETURN SQLSetConnectAttr(SQLHDBC ConnectionHandle,
 				  SQLINTEGER AttributeCursorName,
@@ -676,7 +676,7 @@ SQLRETURN SQLSetConnectAttr(SQLHDBC ConnectionHandle,
 				  SQLINTEGER StringLength);
 
 SQLRETURN SQLSetCursorName(SQLHSTMT StatementHandle,
-				 SQLCHAR * CursorName,
+				 SQLCHAR *CursorName,
 				 SQLSMALLINT NameLength);
 
 SQLRETURN SQLSetDescField(SQLHDESC DescriptorHandle,
@@ -692,8 +692,8 @@ SQLRETURN SQLSetDescRec(SQLHDESC DescriptorHandle,
 			  SQLSMALLINT Precision,
 			  SQLSMALLINT Scale,
 			  SQLPOINTER Data,
-			  SQLINTEGER * StringLength,
-			  SQLSMALLINT * Indicator);
+			  SQLINTEGER *StringLength,
+			  SQLSMALLINT *Indicator);
 
 SQLRETURN SQLSetEnvAttr(SQLHENV EnvironmentHandle,
 			  SQLINTEGER Attribute,
diff --git a/src/interfaces/ecpg/include/ecpgerrno.h b/src/interfaces/ecpg/include/ecpgerrno.h
index 58e70a0752bcc56433066db6f258bd9e2af38333..49e6269d8af65c46fa1fdb47667457e926854f14 100644
--- a/src/interfaces/ecpg/include/ecpgerrno.h
+++ b/src/interfaces/ecpg/include/ecpgerrno.h
@@ -44,18 +44,22 @@
 #define ECPG_CONNECT			-402
 
 /* backend notices, starting at 600 */
-#define ECPG_NOTICE_UNRECOGNIZED       -600
-               /* NOTICE:  (transaction aborted): queries ignored until END */
-               /* NOTICE:  current transaction is aborted, queries ignored until end of transaction block */
-#define ECPG_NOTICE_QUERY_IGNORED      -601
-               /* NOTICE:  PerformPortalClose: portal "*" not found */
-#define ECPG_NOTICE_UNKNOWN_PORTAL     -602
-               /* NOTICE:  BEGIN: already a transaction in progress */
-#define ECPG_NOTICE_IN_TRANSACTION     -603
-               /* NOTICE:  AbortTransaction and not in in-progress state */
-               /* NOTICE:  COMMIT: no transaction in progress */
-#define ECPG_NOTICE_NO_TRANSACTION     -604
-               /* NOTICE:  BlankPortalAssignName: portal * already exists */
-#define ECPG_NOTICE_PORTAL_EXISTS      -605
-                                        
+#define ECPG_NOTICE_UNRECOGNIZED	   -600
+ /* NOTICE:  (transaction aborted): queries ignored until END */
+
+ /*
+  * NOTICE:  current transaction is aborted, queries ignored until end of
+  * transaction block
+  */
+#define ECPG_NOTICE_QUERY_IGNORED	   -601
+ /* NOTICE:  PerformPortalClose: portal "*" not found */
+#define ECPG_NOTICE_UNKNOWN_PORTAL	   -602
+ /* NOTICE:  BEGIN: already a transaction in progress */
+#define ECPG_NOTICE_IN_TRANSACTION	   -603
+ /* NOTICE:  AbortTransaction and not in in-progress state */
+ /* NOTICE:  COMMIT: no transaction in progress */
+#define ECPG_NOTICE_NO_TRANSACTION	   -604
+ /* NOTICE:  BlankPortalAssignName: portal * already exists */
+#define ECPG_NOTICE_PORTAL_EXISTS	   -605
+
 #endif	 /* !_ECPG_ERROR_H */
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index d06f22d63369ccbf6d1535401039d8b34ad429a8..acb022aa1b2ddda09d9c3e0e3950e93fc33d02c6 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -9,26 +9,26 @@
 #ifndef __cplusplus
 #ifndef bool
 #define bool char
-#endif   /* ndef bool */
+#endif	 /* ndef bool */
 
 #ifndef true
-#define true    ((bool) 1)
-#endif /* ndef true */
-#ifndef false    
-#define false	((bool) 0)    
-#endif   /* ndef false */
-#endif   /* not C++ */   
-#else /* __BEOS__ */
+#define true	((bool) 1)
+#endif	 /* ndef true */
+#ifndef false
+#define false	((bool) 0)
+#endif	 /* ndef false */
+#endif	 /* not C++ */
+#else							/* __BEOS__ */
 #include <SupportDefs.h>
-#endif /* __BEOS__ */
+#endif	 /* __BEOS__ */
 
 #ifndef TRUE
-#define TRUE    1
-#endif   /* TRUE */
+#define TRUE	1
+#endif	 /* TRUE */
 
 #ifndef FALSE
-#define FALSE   0
-#endif   /* FALSE */
+#define FALSE	0
+#endif	 /* FALSE */
 
 #ifdef __cplusplus
 extern		"C"
diff --git a/src/interfaces/ecpg/include/sqlca.h b/src/interfaces/ecpg/include/sqlca.h
index 9bc958a1af77256b87e2325ac1d63c99d22a6ffa..4d38c92334f158a546a810dd875a96071e46bc43 100644
--- a/src/interfaces/ecpg/include/sqlca.h
+++ b/src/interfaces/ecpg/include/sqlca.h
@@ -23,17 +23,21 @@ extern		"C"
 		/* Element 0: empty						*/
 		/* 1: OID of processed tuple if applicable			*/
 		/* 2: number of rows processed				*/
-		/* after an INSERT, UPDATE or 				*/
+		/* after an INSERT, UPDATE or				*/
 		/* DELETE statement					*/
 		/* 3: empty						*/
 		/* 4: empty						*/
 		/* 5: empty						*/
 		char		sqlwarn[8];
-		/* Element 0: set to 'W' if at least one other is 'W' 	*/
-		/* 1: if 'W' at least one character string	  	*/
-		/* value was truncated when it was		   	*/
-		/* stored into a host variable.			   	*/
-		/* 2: if 'W' a (hopefully) non-fatal notice occured 	*/		/* 3: empty									  */
+		/* Element 0: set to 'W' if at least one other is 'W'	*/
+		/* 1: if 'W' at least one character string		*/
+		/* value was truncated when it was			*/
+		/* stored into a host variable.				*/
+
+		/*
+		 * 2: if 'W' a (hopefully) non-fatal notice occured		*//* 3:
+		 * empty
+		 */
 		/* 4: empty						*/
 		/* 5: empty						*/
 		/* 6: empty						*/
@@ -47,6 +51,7 @@ extern		"C"
 
 #ifdef __cplusplus
 }
+
 #endif
 
 #endif
diff --git a/src/interfaces/ecpg/lib/connect.c b/src/interfaces/ecpg/lib/connect.c
index a7804f8ec9b7a01123177c879201d27341867f8a..eac4fcc028ec6f8e3e10003a8f29ac8109da67da 100644
--- a/src/interfaces/ecpg/lib/connect.c
+++ b/src/interfaces/ecpg/lib/connect.c
@@ -27,8 +27,9 @@ ecpg_finish(struct connection * act)
 {
 	if (act != NULL)
 	{
-		struct ECPGtype_information_cache *cache, *ptr;
-		
+		struct ECPGtype_information_cache *cache,
+				   *ptr;
+
 		ECPGlog("ecpg_finish: finishing %s.\n", act->name);
 		PQfinish(act->connection);
 
@@ -115,114 +116,141 @@ ECPGnoticeProcessor_raise(int code, const char *message)
 {
 	sqlca.sqlcode = code;
 	strncpy(sqlca.sqlerrm.sqlerrmc, message, sizeof(sqlca.sqlerrm.sqlerrmc));
-	sqlca.sqlerrm.sqlerrmc[sizeof(sqlca.sqlerrm.sqlerrmc)-1]=0;
+	sqlca.sqlerrm.sqlerrmc[sizeof(sqlca.sqlerrm.sqlerrmc) - 1] = 0;
 	sqlca.sqlerrm.sqlerrml = strlen(sqlca.sqlerrm.sqlerrmc);
-	
+
 	/* remove trailing newline */
-	if (sqlca.sqlerrm.sqlerrml 
-		&& sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml-1]=='\n')
+	if (sqlca.sqlerrm.sqlerrml
+		&& sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml - 1] == '\n')
 	{
-		sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml-1]=0;
+		sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml - 1] = 0;
 		sqlca.sqlerrm.sqlerrml--;
 	}
-	
-	ECPGlog("raising sqlcode %d\n",code);
+
+	ECPGlog("raising sqlcode %d\n", code);
 }
 
-/* 
- * I know this is a mess, but we can't redesign the backend 
+/*
+ * I know this is a mess, but we can't redesign the backend
  */
 
 static void
 ECPGnoticeProcessor(void *arg, const char *message)
 {
-	/* these notices raise an error */	
-	if (strncmp(message,"NOTICE: ",8))
+	/* these notices raise an error */
+	if (strncmp(message, "NOTICE: ", 8))
 	{
 		ECPGlog("ECPGnoticeProcessor: strange notice '%s'\n", message);
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_UNRECOGNIZED, message);
 		return;
 	}
-	
-	message+=8;
-	while (*message==' ') message++;
+
+	message += 8;
+	while (*message == ' ')
+		message++;
 	ECPGlog("NOTICE: %s", message);
-		
-	/* NOTICE:  (transaction aborted): queries ignored until END */
-	/* NOTICE:  current transaction is aborted, queries ignored until end of transaction block */
-	if (strstr(message,"queries ignored") && strstr(message,"transaction")
-		&& strstr(message,"aborted"))
+
+	/* NOTICE:	(transaction aborted): queries ignored until END */
+
+	/*
+	 * NOTICE:	current transaction is aborted, queries ignored until end
+	 * of transaction block
+	 */
+	if (strstr(message, "queries ignored") && strstr(message, "transaction")
+		&& strstr(message, "aborted"))
 	{
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_QUERY_IGNORED, message);
 		return;
 	}
-	
-	/* NOTICE:  PerformPortalClose: portal "*" not found */
-	if ((!strncmp(message,"PerformPortalClose: portal",26) 
-		|| !strncmp(message,"PerformPortalFetch: portal",26)) 
-		&& strstr(message+26,"not found"))
+
+	/* NOTICE:	PerformPortalClose: portal "*" not found */
+	if ((!strncmp(message, "PerformPortalClose: portal", 26)
+		 || !strncmp(message, "PerformPortalFetch: portal", 26))
+		&& strstr(message + 26, "not found"))
 	{
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_UNKNOWN_PORTAL, message);
 		return;
 	}
-	
-	/* NOTICE:  BEGIN: already a transaction in progress */
-	if (!strncmp(message,"BEGIN: already a transaction in progress",40))
+
+	/* NOTICE:	BEGIN: already a transaction in progress */
+	if (!strncmp(message, "BEGIN: already a transaction in progress", 40))
 	{
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_IN_TRANSACTION, message);
 		return;
 	}
-	
-	/* NOTICE:  AbortTransaction and not in in-progress state */
-	/* NOTICE:  COMMIT: no transaction in progress */
-	/* NOTICE:  ROLLBACK: no transaction in progress */
-	if (!strncmp(message,"AbortTransaction and not in in-progress state",45)
-		|| !strncmp(message,"COMMIT: no transaction in progress",34)
-		|| !strncmp(message,"ROLLBACK: no transaction in progress",36))
+
+	/* NOTICE:	AbortTransaction and not in in-progress state */
+	/* NOTICE:	COMMIT: no transaction in progress */
+	/* NOTICE:	ROLLBACK: no transaction in progress */
+	if (!strncmp(message, "AbortTransaction and not in in-progress state", 45)
+		|| !strncmp(message, "COMMIT: no transaction in progress", 34)
+		|| !strncmp(message, "ROLLBACK: no transaction in progress", 36))
 	{
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_NO_TRANSACTION, message);
 		return;
 	}
-	
-	/* NOTICE:  BlankPortalAssignName: portal * already exists */
-	if (!strncmp(message,"BlankPortalAssignName: portal",29)
-			&& strstr(message+29,"already exists"))
+
+	/* NOTICE:	BlankPortalAssignName: portal * already exists */
+	if (!strncmp(message, "BlankPortalAssignName: portal", 29)
+		&& strstr(message + 29, "already exists"))
 	{
 		ECPGnoticeProcessor_raise(ECPG_NOTICE_PORTAL_EXISTS, message);
 		return;
 	}
 
 	/* these are harmless - do nothing */
-	/* NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index '*' for table '*' */
-	/* NOTICE:  ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s) */
-	/* NOTICE:  CREATE TABLE will create implicit sequence '*' for SERIAL column '*.*' */
-	/* NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) */
-	if ((!strncmp(message,"CREATE TABLE",12) || !strncmp(message,"ALTER TABLE",11))
-			&& strstr(message+11,"will create implicit"))
+
+	/*
+	 * NOTICE:	CREATE TABLE/PRIMARY KEY will create implicit index '*'
+	 * for table '*'
+	 */
+
+	/*
+	 * NOTICE:	ALTER TABLE ... ADD CONSTRAINT will create implicit
+	 * trigger(s) for FOREIGN KEY check(s)
+	 */
+
+	/*
+	 * NOTICE:	CREATE TABLE will create implicit sequence '*' for SERIAL
+	 * column '*.*'
+	 */
+
+	/*
+	 * NOTICE:	CREATE TABLE will create implicit trigger(s) for FOREIGN
+	 * KEY check(s)
+	 */
+	if ((!strncmp(message, "CREATE TABLE", 12) || !strncmp(message, "ALTER TABLE", 11))
+		&& strstr(message + 11, "will create implicit"))
 		return;
-	
-	/* NOTICE:  QUERY PLAN: */
-	if (!strncmp(message,"QUERY PLAN:",11)) /* do we really see these? */
+
+	/* NOTICE:	QUERY PLAN: */
+	if (!strncmp(message, "QUERY PLAN:", 11))	/* do we really see these? */
 		return;
-	
-	/* NOTICE:  DROP TABLE implicitly drops referential integrity trigger from table "*" */
-	if (!strncmp(message,"DROP TABLE implicitly drops",27))
+
+	/*
+	 * NOTICE:	DROP TABLE implicitly drops referential integrity trigger
+	 * from table "*"
+	 */
+	if (!strncmp(message, "DROP TABLE implicitly drops", 27))
 		return;
-	
-	/* NOTICE:  Caution: DROP INDEX cannot be rolled back, so don't abort now */
-	if (strstr(message,"cannot be rolled back"))
+
+	/*
+	 * NOTICE:	Caution: DROP INDEX cannot be rolled back, so don't abort
+	 * now
+	 */
+	if (strstr(message, "cannot be rolled back"))
 		return;
 
 	/* these and other unmentioned should set sqlca.sqlwarn[2] */
-	/* NOTICE:  The ':' operator is deprecated.  Use exp(x) instead. */
-	/* NOTICE:  Rel *: Uninitialized page 0 - fixing */
-	/* NOTICE:  PortalHeapMemoryFree: * not in alloc set! */
-	/* NOTICE:  Too old parent tuple found - can't continue vc_repair_frag */
-	/* NOTICE:  identifier "*" will be truncated to "*" */
-	/* NOTICE:  InvalidateSharedInvalid: cache state reset */
-	/* NOTICE:  RegisterSharedInvalid: SI buffer overflow */
-	sqlca.sqlwarn[2]='W';
-	sqlca.sqlwarn[0]='W';
+	/* NOTICE:	The ':' operator is deprecated.  Use exp(x) instead. */
+	/* NOTICE:	Rel *: Uninitialized page 0 - fixing */
+	/* NOTICE:	PortalHeapMemoryFree: * not in alloc set! */
+	/* NOTICE:	Too old parent tuple found - can't continue vc_repair_frag */
+	/* NOTICE:	identifier "*" will be truncated to "*" */
+	/* NOTICE:	InvalidateSharedInvalid: cache state reset */
+	/* NOTICE:	RegisterSharedInvalid: SI buffer overflow */
+	sqlca.sqlwarn[2] = 'W';
+	sqlca.sqlwarn[0] = 'W';
 }
 
 /* this contains some quick hacks, needs to be cleaned up, but it works */
@@ -230,7 +258,12 @@ bool
 ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
 {
 	struct connection *this;
-	char *dbname = strdup(name), *host = NULL, *tmp, *port = NULL, *realname = NULL, *options = NULL;
+	char	   *dbname = strdup(name),
+			   *host = NULL,
+			   *tmp,
+			   *port = NULL,
+			   *realname = NULL,
+			   *options = NULL;
 
 	init_sqlca();
 
@@ -239,72 +272,74 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 
 	if (dbname == NULL && connection_name == NULL)
 		connection_name = "DEFAULT";
-		
+
 	/* get the detail information out of dbname */
 	if (strchr(dbname, '@') != NULL)
-        {
-        	/* old style: dbname[@server][:port] */
-	        tmp = strrchr(dbname, ':');
-	        if (tmp != NULL)                /* port number given */
-	        {
-	                port = strdup(tmp + 1);
-	                *tmp = '\0';
-	        }
-
-	        tmp = strrchr(dbname, '@');
-                if (tmp != NULL)                /* host name given */
-                {
-	                host = strdup(tmp + 1);
-	                *tmp = '\0';
+	{
+		/* old style: dbname[@server][:port] */
+		tmp = strrchr(dbname, ':');
+		if (tmp != NULL)		/* port number given */
+		{
+			port = strdup(tmp + 1);
+			*tmp = '\0';
+		}
+
+		tmp = strrchr(dbname, '@');
+		if (tmp != NULL)		/* host name given */
+		{
+			host = strdup(tmp + 1);
+			*tmp = '\0';
 		}
 		realname = strdup(dbname);
 	}
 	else if (strncmp(dbname, "tcp:", 4) == 0 || strncmp(dbname, "unix:", 5) == 0)
 	{
-		int offset = 0;
-		
+		int			offset = 0;
+
 		/*
 		 * only allow protocols tcp and unix
 		 */
 		if (strncmp(dbname, "tcp:", 4) == 0)
-		        offset = 4;
+			offset = 4;
 		else if (strncmp(dbname, "unix:", 5) == 0)
-		        offset = 5;
-               		
-               	if (strncmp(dbname + offset, "postgresql://", strlen("postgresql://")) == 0)
-               	{
-               		/*
+			offset = 5;
+
+		if (strncmp(dbname + offset, "postgresql://", strlen("postgresql://")) == 0)
+		{
+
+			/*
 			 * new style:
-                         * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:][/dbname][?options] 
-  		         */
-                        offset += strlen("postgresql://");
-                        
-                        tmp = strrchr(dbname + offset, '?'); 
-                        if (tmp != NULL)	/* options given */
-                        {
-                        	options = strdup(tmp + 1);
-                                *tmp = '\0';
-                        }
-                        
-                        tmp = strrchr(dbname + offset, '/');
-                        if (tmp != NULL)        /* database name given */
-                        {
-                        	realname = strdup(tmp + 1);
-                                *tmp = '\0';
-                        }
-                        
-                        tmp = strrchr(dbname + offset, ':');
-                        if (tmp != NULL)        /* port number or Unix socket path given */
-                        {
-                        	char *tmp2;
-                        	
-                        	*tmp = '\0';
+			 * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:][/db
+			 * name][?options]
+			 */
+			offset += strlen("postgresql://");
+
+			tmp = strrchr(dbname + offset, '?');
+			if (tmp != NULL)	/* options given */
+			{
+				options = strdup(tmp + 1);
+				*tmp = '\0';
+			}
+
+			tmp = strrchr(dbname + offset, '/');
+			if (tmp != NULL)	/* database name given */
+			{
+				realname = strdup(tmp + 1);
+				*tmp = '\0';
+			}
+
+			tmp = strrchr(dbname + offset, ':');
+			if (tmp != NULL)	/* port number or Unix socket path given */
+			{
+				char	   *tmp2;
+
+				*tmp = '\0';
 				if ((tmp2 = strchr(tmp + 1, ':')) != NULL)
 				{
 					*tmp2 = '\0';
 					host = strdup(tmp + 1);
-                        		if (strncmp(dbname, "unix:", 5) != 0)
-                        		{
+					if (strncmp(dbname, "unix:", 5) != 0)
+					{
 						ECPGlog("connect: socketname %s given for TCP connection in line %d\n", host, lineno);
 						ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
 						if (host)
@@ -318,19 +353,17 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 						if (dbname)
 							free(dbname);
 						return false;
-                        		}
-                        	}
-                        	else
-                        	{
-                        		port = strdup(tmp + 1);   
-                        	}
-                        }
-                        
-                        if (strncmp(dbname, "unix:", 5) == 0)
-                        {
-                        	if (strcmp(dbname + offset, "localhost") != 0 && strcmp(dbname + offset, "127.0.0.1") != 0)
-	                        {
-	                        	ECPGlog("connect: non-localhost access via sockets in line %d\n", lineno);
+					}
+				}
+				else
+					port = strdup(tmp + 1);
+			}
+
+			if (strncmp(dbname, "unix:", 5) == 0)
+			{
+				if (strcmp(dbname + offset, "localhost") != 0 && strcmp(dbname + offset, "127.0.0.1") != 0)
+				{
+					ECPGlog("connect: non-localhost access via sockets in line %d\n", lineno);
 					ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
 					if (host)
 						free(host);
@@ -340,27 +373,25 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 						free(options);
 					if (realname)
 						free(realname);
-					if(dbname)
+					if (dbname)
 						free(dbname);
 					return false;
-                	        }
-                        }
-                        else
-                        {
-                        	host = strdup(dbname + offset);
-                        }
-                        	
-               	}
+				}
+			}
+			else
+				host = strdup(dbname + offset);
+
+		}
 	}
 	else
 		realname = strdup(dbname);
-		
+
 	/* add connection to our list */
 	if (connection_name != NULL)
 		this->name = ecpg_strdup(connection_name, lineno);
 	else
 		this->name = ecpg_strdup(realname, lineno);
-		
+
 	this->cache_head = NULL;
 
 	if (all_connections == NULL)
@@ -371,9 +402,9 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 	actual_connection = all_connections = this;
 
 	ECPGlog("ECPGconnect: opening database %s on %s port %s %s%s%s%s\n",
-			realname ? realname : "<DEFAULT>", 
-			host ? host : "<DEFAULT>", 
-			port ? port : "<DEFAULT>", 
+			realname ? realname : "<DEFAULT>",
+			host ? host : "<DEFAULT>",
+			port ? port : "<DEFAULT>",
 			options ? "with options " : "", options ? options : "",
 			user ? "for user " : "", user ? user : "");
 
@@ -389,25 +420,25 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 		free(realname);
 	if (dbname)
 		free(dbname);
-		
+
 	if (PQstatus(this->connection) == CONNECTION_BAD)
 	{
 		ecpg_finish(this);
 		ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n",
-			realname ? realname : "<DEFAULT>", 
-			host ? host : "<DEFAULT>", 
-			port ? port : "<DEFAULT>", 
-			options ? "with options " : "", options ? options : "",
-			user ? "for user " : "", user ? user : "",
-			lineno);
+				realname ? realname : "<DEFAULT>",
+				host ? host : "<DEFAULT>",
+				port ? port : "<DEFAULT>",
+				options ? "with options " : "", options ? options : "",
+				user ? "for user " : "", user ? user : "",
+				lineno);
 		ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
 		return false;
 	}
 
 	this->committed = true;
 	this->autocommit = autocommit;
-	
-	PQsetNoticeProcessor(this->connection,&ECPGnoticeProcessor,(void*)this);
+
+	PQsetNoticeProcessor(this->connection, &ECPGnoticeProcessor, (void *) this);
 
 	return true;
 }
diff --git a/src/interfaces/ecpg/lib/data.c b/src/interfaces/ecpg/lib/data.c
index b6cc32b856382dd343f781c935cdf74cbe523705..50640ba1a46e279ec449bd0c03631f438f0a265c 100644
--- a/src/interfaces/ecpg/lib/data.c
+++ b/src/interfaces/ecpg/lib/data.c
@@ -33,13 +33,13 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 		switch (type)
 		{
 			case ECPGt_char:
-		        case ECPGt_unsigned_char:
-		        case ECPGt_varchar:
-		 		break;
-		
-		        default:
-		                pval++;
-		                break;
+			case ECPGt_unsigned_char:
+			case ECPGt_varchar:
+				break;
+
+			default:
+				pval++;
+				break;
 		}
 	}
 
@@ -64,12 +64,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 			break;
 #ifdef HAVE_LONG_LONG_INT_64
 		case ECPGt_long_long:
-		        ((long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
-		        break;
+			((long long int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
+			break;
 		case ECPGt_unsigned_long_long:
-		        ((unsigned long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
-		        break;
-#endif /* HAVE_LONG_LONG_INT_64 */
+			((unsigned long long int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
+			break;
+#endif	 /* HAVE_LONG_LONG_INT_64 */
 		case ECPGt_NO_INDICATOR:
 			if (PQgetisnull(results, act_tuple, act_field))
 			{
@@ -159,7 +159,7 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 				break;
 
 #ifdef HAVE_LONG_LONG_INT_64
-# ifdef HAVE_STRTOLL
+#ifdef HAVE_STRTOLL
 			case ECPGt_long_long:
 				if (pval)
 				{
@@ -168,15 +168,15 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 						|| (!isarray && *scan_length != '\0'))	/* Garbage left */
 					{
 						ECPGraise(lineno, ECPG_INT_FORMAT, pval);
-				                return (false);
-				        }
+						return (false);
+					}
 				}
-				else     
-					((long long int *) var)[act_tuple] = 0LL;
-				
+				else
+					((long long int *) var)[act_tuple] = (long long) 0;
+
 				break;
-# endif /* HAVE_STRTOLL */
-# ifdef HAVE_STRTOULL
+#endif	 /* HAVE_STRTOLL */
+#ifdef HAVE_STRTOULL
 			case ECPGt_unsigned_long_long:
 				if (pval)
 				{
@@ -185,16 +185,16 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 						|| (!isarray && *scan_length != '\0'))	/* Garbage left */
 					{
 						ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
-				                return (false);
-				        }
+						return (false);
+					}
 				}
-				else     
-					((unsigned long long int *) var)[act_tuple] = 0LL;
-				
+				else
+					((unsigned long long int *) var)[act_tuple] = (long long) 0;
+
 				break;
-# endif /* HAVE_STRTOULL */
-#endif /* HAVE_LONG_LONG_INT_64 */
-					
+#endif	 /* HAVE_STRTOULL */
+#endif	 /* HAVE_LONG_LONG_INT_64 */
+
 			case ECPGt_float:
 			case ECPGt_double:
 				if (pval)
@@ -203,10 +203,10 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 						dres = strtod(pval + 1, &scan_length);
 					else
 						dres = strtod(pval, &scan_length);
-					
+
 					if (isarray && *scan_length == '"')
-					        scan_length++;
-					
+						scan_length++;
+
 					if ((isarray && *scan_length != ',' && *scan_length != '}')
 						|| (!isarray && *scan_length != '\0'))	/* Garbage left */
 					{
@@ -236,16 +236,22 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
 				{
 					if (pval[0] == 'f' && pval[1] == '\0')
 					{
-						if (offset==sizeof(char)) ((char *) var)[act_tuple] = false;
-						else if (offset==sizeof(int)) ((int *) var)[act_tuple] = false;
-						else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
+						if (offset == sizeof(char))
+							((char *) var)[act_tuple] = false;
+						else if (offset == sizeof(int))
+							((int *) var)[act_tuple] = false;
+						else
+							ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
 						break;
 					}
 					else if (pval[0] == 't' && pval[1] == '\0')
 					{
-						if (offset==sizeof(char)) ((char *) var)[act_tuple] = true;
-						else if (offset==sizeof(int)) ((int *) var)[act_tuple] = true;
-						else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
+						if (offset == sizeof(char))
+							((char *) var)[act_tuple] = true;
+						else if (offset == sizeof(int))
+							((int *) var)[act_tuple] = true;
+						else
+							ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
 						break;
 					}
 					else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))
diff --git a/src/interfaces/ecpg/lib/descriptor.c b/src/interfaces/ecpg/lib/descriptor.c
index 5cdf8dc1f38efca9131ccb12a54c2e7cc4657026..bbf239e3920f3cba8efdb80874c8f35b849baa95 100644
--- a/src/interfaces/ecpg/lib/descriptor.c
+++ b/src/interfaces/ecpg/lib/descriptor.c
@@ -65,7 +65,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
 {
 	switch (vartype)
 	{
-		case ECPGt_short:
+			case ECPGt_short:
 			*(short *) var = (short) value;
 			break;
 		case ECPGt_int:
@@ -90,7 +90,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
 		case ECPGt_unsigned_long_long:
 			*(unsigned long long int *) var = (unsigned long long int) value;
 			break;
-#endif /* HAVE_LONG_LONG_INT_64 */
+#endif	 /* HAVE_LONG_LONG_INT_64 */
 		case ECPGt_float:
 			*(float *) var = (float) value;
 			break;
diff --git a/src/interfaces/ecpg/lib/error.c b/src/interfaces/ecpg/lib/error.c
index 0c9c197edfc2d3c784301df4229ff413ff1eac74..72b005bb9ac7503e31fc80891634b32cbe6fc4eb 100644
--- a/src/interfaces/ecpg/lib/error.c
+++ b/src/interfaces/ecpg/lib/error.c
@@ -119,15 +119,16 @@ ECPGraise(int line, int code, const char *str)
 			break;
 
 		case ECPG_PGSQL:
-		{
-			int		slen = strlen(str);
-			/* strip trailing newline */
-			if (slen > 0 && str[slen - 1] == '\n')
-				slen--;
-			snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
-					 "'%.*s' in line %d.", slen, str, line);
-			break;
-		}
+			{
+				int			slen = strlen(str);
+
+				/* strip trailing newline */
+				if (slen > 0 && str[slen - 1] == '\n')
+					slen--;
+				snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
+						 "'%.*s' in line %d.", slen, str, line);
+				break;
+			}
 
 		case ECPG_TRANS:
 			snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c
index 50ebf904a479a4131c4aab35485d4fd4b2df9998..99177844717d2d161f86ab153344c0a2d319c864 100644
--- a/src/interfaces/ecpg/lib/execute.c
+++ b/src/interfaces/ecpg/lib/execute.c
@@ -104,7 +104,7 @@ quote_postgres(char *arg, int lineno)
 		return (res);
 
 	res[ri++] = '\'';
-		
+
 	for (i = 0; arg[i]; i++, ri++)
 	{
 		switch (arg[i])
@@ -121,7 +121,7 @@ quote_postgres(char *arg, int lineno)
 
 		res[ri] = arg[i];
 	}
-	
+
 	res[ri++] = '\'';
 	res[ri] = '\0';
 
@@ -253,11 +253,10 @@ next_insert(char *text)
 
 	for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
 	{
-		if (*ptr == '\\') /* escape character */
+		if (*ptr == '\\')		/* escape character */
 			ptr++;
-		else
-			if (*ptr == '\'' )
-				string = string ? false : true;
+		else if (*ptr == '\'')
+			string = string ? false : true;
 	}
 
 	return (*ptr == '\0') ? NULL : ptr;
@@ -268,10 +267,11 @@ next_insert(char *text)
  */
 
 static void
-ECPGtypeinfocache_push(struct ECPGtype_information_cache **cache, int oid, bool isarray, int lineno)
+ECPGtypeinfocache_push(struct ECPGtype_information_cache ** cache, int oid, bool isarray, int lineno)
 {
-	struct ECPGtype_information_cache	*new_entry 
-						= (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno);
+	struct ECPGtype_information_cache *new_entry
+	= (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno);
+
 	new_entry->oid = oid;
 	new_entry->isarray = isarray;
 	new_entry->next = *cache;
@@ -279,17 +279,21 @@ ECPGtypeinfocache_push(struct ECPGtype_information_cache **cache, int oid, bool
 }
 
 static bool
-ECPGis_type_an_array(int type,const struct statement * stmt,const struct variable *var)
+ECPGis_type_an_array(int type, const struct statement * stmt, const struct variable * var)
 {
 	char	   *array_query;
-	int		isarray = 0;
-	PGresult	*query;
-	struct ECPGtype_information_cache	*cache_entry;
-	
-	if ((stmt->connection->cache_head)==NULL)
-	{	
-		/* Text like types are not an array for ecpg, but postgres counts them as
-		   an array. This define reminds you to not 'correct' these values. */
+	int			isarray = 0;
+	PGresult   *query;
+	struct ECPGtype_information_cache *cache_entry;
+
+	if ((stmt->connection->cache_head) == NULL)
+	{
+
+		/*
+		 * Text like types are not an array for ecpg, but postgres counts
+		 * them as an array. This define reminds you to not 'correct'
+		 * these values.
+		 */
 #define not_an_array_in_ecpg false
 
 		/* populate cache with well known types to speed things up */
@@ -310,7 +314,7 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), OIDVECTOROID, true, stmt->lineno);
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), POINTOID, true, stmt->lineno);
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), LSEGOID, true, stmt->lineno);
-		ECPGtypeinfocache_push(&(stmt->connection->cache_head), PATHOID, not_an_array_in_ecpg , stmt->lineno);
+		ECPGtypeinfocache_push(&(stmt->connection->cache_head), PATHOID, not_an_array_in_ecpg, stmt->lineno);
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), BOXOID, true, stmt->lineno);
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), POLYGONOID, false, stmt->lineno);
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), LINEOID, true, stmt->lineno);
@@ -336,12 +340,12 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
 		ECPGtypeinfocache_push(&(stmt->connection->cache_head), NUMERICOID, false, stmt->lineno);
 	}
 
-	for (cache_entry = (stmt->connection->cache_head);cache_entry != NULL;cache_entry=cache_entry->next)
+	for (cache_entry = (stmt->connection->cache_head); cache_entry != NULL; cache_entry = cache_entry->next)
 	{
-		if (cache_entry->oid==type) 
+		if (cache_entry->oid == type)
 			return cache_entry->isarray;
 	}
-		
+
 	array_query = (char *) ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt->lineno);
 	sprintf(array_query, "select typelem from pg_type where oid=%d", type);
 	query = PQexec(stmt->connection->connection, array_query);
@@ -354,8 +358,7 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
 		{
 
 			/*
-			 * arrays of character strings are not yet
-			 * implemented
+			 * arrays of character strings are not yet implemented
 			 */
 			isarray = false;
 		}
@@ -391,7 +394,7 @@ ECPGexecute(struct statement * stmt)
 		char	   *tobeinserted = NULL;
 		char	   *p;
 		char		buff[20];
-		int		hostvarl = 0;
+		int			hostvarl = 0;
 
 		/*
 		 * Some special treatment is needed for records since we want
@@ -422,10 +425,10 @@ ECPGexecute(struct statement * stmt)
 #ifdef HAVE_LONG_LONG_INT_64
 			case ECPGt_long_long:
 			case ECPGt_unsigned_long_long:
-	                        if (*(long long int*) var->ind_value < 0LL)
+				if (*(long long int *) var->ind_value < (long long) 0)
 					strcpy(buff, "null");
-	                        break;
-#endif /* HAVE_LONG_LONG_INT_64 */
+				break;
+#endif	 /* HAVE_LONG_LONG_INT_64 */
 			default:
 				break;
 		}
@@ -583,11 +586,11 @@ ECPGexecute(struct statement * stmt)
 						strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
 					}
 					else
-						sprintf(mallocedval, "%llu", *((unsigned long long*) var->value));
+						sprintf(mallocedval, "%llu", *((unsigned long long *) var->value));
 
 					tobeinserted = mallocedval;
 					break;
-#endif /* HAVE_LONG_LONG_INT_64 */
+#endif	 /* HAVE_LONG_LONG_INT_64 */
 				case ECPGt_float:
 					if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
 						return false;
@@ -634,11 +637,15 @@ ECPGexecute(struct statement * stmt)
 					{
 						strncpy(mallocedval, "'{", sizeof("'{"));
 
-						if (var->offset==sizeof(char))
+						if (var->offset == sizeof(char))
 							for (element = 0; element < var->arrsize; element++)
 								sprintf(mallocedval + strlen(mallocedval), "%c,", (((char *) var->value)[element]) ? 't' : 'f');
-						/* this is necessary since sizeof(C++'s bool)==sizeof(int) */
-						else if (var->offset==sizeof(int))
+
+						/*
+						 * this is necessary since sizeof(C++'s
+						 * bool)==sizeof(int)
+						 */
+						else if (var->offset == sizeof(int))
 							for (element = 0; element < var->arrsize; element++)
 								sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
 						else
@@ -648,9 +655,9 @@ ECPGexecute(struct statement * stmt)
 					}
 					else
 					{
-						if (var->offset==sizeof(char))
+						if (var->offset == sizeof(char))
 							sprintf(mallocedval, "'%c'", (*((char *) var->value)) ? 't' : 'f');
-						else if (var->offset==sizeof(int))
+						else if (var->offset == sizeof(int))
 							sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
 						else
 							ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size");
@@ -734,6 +741,7 @@ ECPGexecute(struct statement * stmt)
 		strcpy(newcopy, copiedquery);
 		if ((p = next_insert(newcopy + hostvarl)) == NULL)
 		{
+
 			/*
 			 * We have an argument but we dont have the matched up string
 			 * in the string
@@ -932,9 +940,9 @@ ECPGexecute(struct statement * stmt)
 				sqlca.sqlerrd[1] = atol(PQoidStatus(results));
 				sqlca.sqlerrd[2] = atol(PQcmdTuples(results));
 				ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, PQcmdStatus(results));
-				if (!sqlca.sqlerrd[2] && (!strncmp(PQcmdStatus(results),"UPDATE",6) 
-									|| !strncmp(PQcmdStatus(results),"INSERT",6) 
-									|| !strncmp(PQcmdStatus(results),"DELETE",6)))
+				if (!sqlca.sqlerrd[2] && (!strncmp(PQcmdStatus(results), "UPDATE", 6)
+						   || !strncmp(PQcmdStatus(results), "INSERT", 6)
+						 || !strncmp(PQcmdStatus(results), "DELETE", 6)))
 					ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL);
 				break;
 			case PGRES_NONFATAL_ERROR:
@@ -1024,7 +1032,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
  *
  * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
  *
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.18 2001/02/12 13:56:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.19 2001/03/22 04:01:19 momjian Exp $
  */
 
 PGconn	   *ECPG_internal_get_connection(char *name);
diff --git a/src/interfaces/ecpg/lib/extern.h b/src/interfaces/ecpg/lib/extern.h
index 3278b0d079c30bdf2e2da2acebc6835c7e3d1a0c..b9318d05c9842060c944bd8ba23859f00b0331f0 100644
--- a/src/interfaces/ecpg/lib/extern.h
+++ b/src/interfaces/ecpg/lib/extern.h
@@ -24,12 +24,12 @@ struct ECPGgeneric_varchar
 /*
  * type information cache
  */
- 
+
 struct ECPGtype_information_cache
 {
-	struct ECPGtype_information_cache	*next;
-	int		oid;
-	bool	isarray;
+	struct ECPGtype_information_cache *next;
+	int			oid;
+	bool		isarray;
 };
 
 /* structure to store one statement */
@@ -47,8 +47,8 @@ struct connection
 {
 	char	   *name;
 	PGconn	   *connection;
-	bool	    committed;
-	int	    autocommit;
-	struct ECPGtype_information_cache        *cache_head;
+	bool		committed;
+	int			autocommit;
+	struct ECPGtype_information_cache *cache_head;
 	struct connection *next;
 };
diff --git a/src/interfaces/ecpg/lib/typename.c b/src/interfaces/ecpg/lib/typename.c
index 710354ffe298057dabe655431d6165ffa84f7a95..78c2665ed8fd7ecb349394e03983e618057007a1 100644
--- a/src/interfaces/ecpg/lib/typename.c
+++ b/src/interfaces/ecpg/lib/typename.c
@@ -15,7 +15,7 @@ ECPGtype_name(enum ECPGttype typ)
 {
 	switch (typ)
 	{
-		case ECPGt_char:
+			case ECPGt_char:
 			return "char";
 		case ECPGt_unsigned_char:
 			return "unsigned char";
@@ -36,7 +36,7 @@ ECPGtype_name(enum ECPGttype typ)
 			return "long long";
 		case ECPGt_unsigned_long_long:
 			return "unsigned long long";
-#endif /* HAVE_LONG_LONG_INT_64 */
+#endif	 /* HAVE_LONG_LONG_INT_64 */
 		case ECPGt_float:
 			return "float";
 		case ECPGt_double:
@@ -58,18 +58,29 @@ ECPGDynamicType(Oid type)
 {
 	switch (type)
 	{
-		case BOOLOID:		return SQL3_BOOLEAN;		/* bool */
-		case INT2OID:		return SQL3_SMALLINT;		/* int2 */
-		case INT4OID:		return SQL3_INTEGER;/* int4 */
-		case TEXTOID:		return SQL3_CHARACTER;		/* text */
-		case FLOAT4OID:		return SQL3_REAL;	/* float4 */
-		case FLOAT8OID:		return SQL3_DOUBLE_PRECISION;		/* float8 */
-		case BPCHAROID:		return SQL3_CHARACTER;		/* bpchar */
-		case VARCHAROID:	return SQL3_CHARACTER_VARYING;		/* varchar */
-		case DATEOID:		return SQL3_DATE_TIME_TIMESTAMP;	/* date */
-		case TIMEOID:		return SQL3_DATE_TIME_TIMESTAMP;	/* time */
-		case TIMESTAMPOID:	return SQL3_DATE_TIME_TIMESTAMP;	/* datetime */
-		case NUMERICOID:	return SQL3_NUMERIC;/* numeric */
+			case BOOLOID:return SQL3_BOOLEAN;	/* bool */
+		case INT2OID:
+			return SQL3_SMALLINT;		/* int2 */
+		case INT4OID:
+			return SQL3_INTEGER;/* int4 */
+		case TEXTOID:
+			return SQL3_CHARACTER;		/* text */
+		case FLOAT4OID:
+			return SQL3_REAL;	/* float4 */
+		case FLOAT8OID:
+			return SQL3_DOUBLE_PRECISION;		/* float8 */
+		case BPCHAROID:
+			return SQL3_CHARACTER;		/* bpchar */
+		case VARCHAROID:
+			return SQL3_CHARACTER_VARYING;		/* varchar */
+		case DATEOID:
+			return SQL3_DATE_TIME_TIMESTAMP;	/* date */
+		case TIMEOID:
+			return SQL3_DATE_TIME_TIMESTAMP;	/* time */
+		case TIMESTAMPOID:
+			return SQL3_DATE_TIME_TIMESTAMP;	/* datetime */
+		case NUMERICOID:
+			return SQL3_NUMERIC;/* numeric */
 		default:
 			return -type;
 	}
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index 7d4992251345847f030fc8d8aa84cdd95b2bdd8c..73631f69c990861c995cfdea3eb9afae9a26219d 100644
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -114,7 +114,8 @@ drop_descriptor(char *name, char *connection)
 }
 
 struct descriptor
-*lookup_descriptor(char *name, char *connection)
+		   *
+lookup_descriptor(char *name, char *connection)
 {
 	struct descriptor *i;
 
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index a3030098f3c9e536fae09b38907539c3aad053b2..e2eccf41fd71ca3e02177438098e0cef56ba9d47 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -25,9 +25,9 @@ usage(char *progname)
 	fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
 	fprintf(stderr, "Usage: %s: "
 #ifdef YYDEBUG
-								"[-d]"
+			"[-d]"
 #endif
-									" [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname);
+			" [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname);
 }
 
 static void
@@ -92,9 +92,9 @@ main(int argc, char *const argv[])
 			case 'D':
 				add_preprocessor_define(optarg);
 				break;
-#ifdef YYDEBUG				
+#ifdef YYDEBUG
 			case 'd':
-				yydebug=1;
+				yydebug = 1;
 				break;
 #endif
 			default:
diff --git a/src/interfaces/ecpg/preproc/ecpg_keywords.c b/src/interfaces/ecpg/preproc/ecpg_keywords.c
index c65730d9a33f89c6feac9602f062395d33ac904f..587f1174471e229da466e23e90076b38afffb221 100644
--- a/src/interfaces/ecpg/preproc/ecpg_keywords.c
+++ b/src/interfaces/ecpg/preproc/ecpg_keywords.c
@@ -4,7 +4,7 @@
  *	  lexical token lookup for reserved words in postgres embedded SQL
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.22 2001/02/21 18:53:47 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.23 2001/03/22 04:01:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -104,16 +104,16 @@ ScanECPGKeywordLookup(char *text)
 		return NULL;
 
 	/*
-	 * Apply an ASCII-only downcasing.  We must not use tolower() since
-	 * it may produce the wrong translation in some locales (eg, Turkish),
+	 * Apply an ASCII-only downcasing.	We must not use tolower() since it
+	 * may produce the wrong translation in some locales (eg, Turkish),
 	 * and we don't trust isupper() very much either.  In an ASCII-based
-	 * encoding the tests against A and Z are sufficient, but we also check
-	 * isupper() so that we will work correctly under EBCDIC.  The actual
-	 * case conversion step should work for either ASCII or EBCDIC.
+	 * encoding the tests against A and Z are sufficient, but we also
+	 * check isupper() so that we will work correctly under EBCDIC.  The
+	 * actual case conversion step should work for either ASCII or EBCDIC.
 	 */
 	for (i = 0; i < len; i++)
 	{
-		char	ch = text[i];
+		char		ch = text[i];
 
 		if (ch >= 'A' && ch <= 'Z' && isupper((unsigned char) ch))
 			ch += 'a' - 'A';
diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h
index 3274515ff638928bf1610eff54c47be7427cdaa7..a6813c23795804a8926edb37be0a360a62aa3743 100644
--- a/src/interfaces/ecpg/preproc/extern.h
+++ b/src/interfaces/ecpg/preproc/extern.h
@@ -19,8 +19,10 @@ extern char *connection;
 extern char *input_filename;
 extern char *yytext,
 			errortext[128];
+
 #ifdef YYDEBUG
-extern int yydebug;
+extern int	yydebug;
+
 #endif
 extern int	yylineno,
 			yyleng;
diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c
index 2decc2b853b536ed26a07683b0a528032f3e40d8..5614a34b0fef7390ba8ec0a4184fea10da5e7d69 100644
--- a/src/interfaces/ecpg/preproc/keywords.c
+++ b/src/interfaces/ecpg/preproc/keywords.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.38 2001/02/21 18:53:47 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.39 2001/03/22 04:01:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ static ScanKeyword ScanKeywords[] = {
 	{"aggregate", AGGREGATE},
 	{"all", ALL},
 	{"alter", ALTER},
-	{"analyse", ANALYSE}, /* British spelling */
+	{"analyse", ANALYSE},		/* British spelling */
 	{"analyze", ANALYZE},
 	{"and", AND},
 	{"any", ANY},
@@ -312,16 +312,16 @@ ScanKeywordLookup(char *text)
 		return NULL;
 
 	/*
-	 * Apply an ASCII-only downcasing.  We must not use tolower() since
-	 * it may produce the wrong translation in some locales (eg, Turkish),
+	 * Apply an ASCII-only downcasing.	We must not use tolower() since it
+	 * may produce the wrong translation in some locales (eg, Turkish),
 	 * and we don't trust isupper() very much either.  In an ASCII-based
-	 * encoding the tests against A and Z are sufficient, but we also check
-	 * isupper() so that we will work correctly under EBCDIC.  The actual
-	 * case conversion step should work for either ASCII or EBCDIC.
+	 * encoding the tests against A and Z are sufficient, but we also
+	 * check isupper() so that we will work correctly under EBCDIC.  The
+	 * actual case conversion step should work for either ASCII or EBCDIC.
 	 */
 	for (i = 0; i < len; i++)
 	{
-		char	ch = text[i];
+		char		ch = text[i];
 
 		if (ch >= 'A' && ch <= 'Z' && isupper((unsigned char) ch))
 			ch += 'a' - 'A';
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index 5a1a7d1fa02d3675fa184961a3748bfffeb46f56..017a80888d52d5eb52e7bbe1aa9c7da0ebc28528 100644
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -203,10 +203,10 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in
 {
 /*	if (ind_typ == NULL)
 	{
-	        ind_typ = &ecpg_no_indicator;
-	        ind_name = "no_indicator";
+			ind_typ = &ecpg_no_indicator;
+			ind_name = "no_indicator";
 	}*/
-	
+
 	switch (typ->typ)
 	{
 			case ECPGt_array:
diff --git a/src/interfaces/libpgeasy/examples/pginsert.c b/src/interfaces/libpgeasy/examples/pginsert.c
index 85de5aad68d50587a829d6f0663df972a1a02c16..39c3752cb20c2880ebe2e65f99dddd1ef01f5c3c 100644
--- a/src/interfaces/libpgeasy/examples/pginsert.c
+++ b/src/interfaces/libpgeasy/examples/pginsert.c
@@ -23,7 +23,7 @@ main(int argc, char **argv)
 				avarchar[51],
 				atext[51];
 	time_t		aabstime;
-	char	    optstr[256];
+	char		optstr[256];
 
 	if (argc != 2)
 		halt("Usage:  %s database\n", argv[0]);
diff --git a/src/interfaces/libpgeasy/examples/pgnulltest.c b/src/interfaces/libpgeasy/examples/pgnulltest.c
index 419a68fe869f1bcdff91f92c74b6b1b26a532708..a9e4204e18d199ca6e10b19e6b77db748520f641 100644
--- a/src/interfaces/libpgeasy/examples/pgnulltest.c
+++ b/src/interfaces/libpgeasy/examples/pgnulltest.c
@@ -34,7 +34,7 @@ main(int argc, char **argv)
 				avarchar_null,
 				atext_null,
 				aabstime_null;
-	char	    optstr[256];
+	char		optstr[256];
 
 	if (argc != 2)
 		halt("Usage:  %s database\n", argv[0]);
diff --git a/src/interfaces/libpgeasy/examples/pgwordcount.c b/src/interfaces/libpgeasy/examples/pgwordcount.c
index 86aa8c2ff4f1e74a9fb2fb2a4464aae1ff70284b..57f888601b5443c599e4eb3c15bd40ce7e234382 100644
--- a/src/interfaces/libpgeasy/examples/pgwordcount.c
+++ b/src/interfaces/libpgeasy/examples/pgwordcount.c
@@ -15,7 +15,7 @@ main(int argc, char **argv)
 	int			row = 0;
 	int			count;
 	char		line[4000];
-	char	    optstr[256];
+	char		optstr[256];
 
 	if (argc != 2)
 		halt("Usage:  %s database\n", argv[0]);
diff --git a/src/interfaces/libpgeasy/halt.c b/src/interfaces/libpgeasy/halt.c
index 2173f7adf6e0197d1989db46ac76a3dc7de37b9f..57ae1fdf294144b40c740d3f169e7e25c1fb1161 100644
--- a/src/interfaces/libpgeasy/halt.c
+++ b/src/interfaces/libpgeasy/halt.c
@@ -40,17 +40,17 @@ halt(char *format,...)
 	fflush(stderr);
 
 	/* call one clean up function if defined */
-	if ((sig_func = signal(SIGTERM, SIG_DFL)) !=SIG_DFL &&
-		sig_func !=SIG_IGN)
+	if ((sig_func = signal(SIGTERM, SIG_DFL)) != SIG_DFL &&
+		sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGHUP, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGHUP, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGINT, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGINT, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGQUIT, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGQUIT, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
 	exit(1);
 }
diff --git a/src/interfaces/libpgeasy/libpgeasy.h b/src/interfaces/libpgeasy/libpgeasy.h
index 5ca12c80122d492e176512f81521bbd5152c7fff..864f30231df84a30d170abf653713517502aece6 100644
--- a/src/interfaces/libpgeasy/libpgeasy.h
+++ b/src/interfaces/libpgeasy/libpgeasy.h
@@ -4,7 +4,7 @@
 */
 
 PGresult   *doquery(char *query);
-PGconn 	   *connectdb(char *options);
+PGconn	   *connectdb(char *options);
 void		disconnectdb(void);
 int			fetch(void *param,...);
 int			fetchwithnulls(void *param,...);
diff --git a/src/interfaces/libpgtcl/pgtcl.c b/src/interfaces/libpgtcl/pgtcl.c
index bf3548e839ca15a57e36dcf78aded26140750bbb..6da179ced572532023b07d9bba17777684dc66b1 100644
--- a/src/interfaces/libpgtcl/pgtcl.c
+++ b/src/interfaces/libpgtcl/pgtcl.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.20 2001/02/10 02:31:29 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.21 2001/03/22 04:01:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -87,14 +87,14 @@ Pgtcl_Init(Tcl_Interp *interp)
 
 #ifdef PGTCL_USE_TCLOBJ
 	Tcl_CreateObjCommand(interp,
-					  "pg_lo_read",
-					  Pg_lo_read,
-					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+						 "pg_lo_read",
+						 Pg_lo_read,
+						 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
 	Tcl_CreateObjCommand(interp,
-					  "pg_lo_write",
-					  Pg_lo_write,
-					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+						 "pg_lo_write",
+						 Pg_lo_write,
+						 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 #else
 	Tcl_CreateCommand(interp,
 					  "pg_lo_read",
diff --git a/src/interfaces/libpgtcl/pgtclCmds.c b/src/interfaces/libpgtcl/pgtclCmds.c
index d4626f8869970a362e21fbeb66b0c4d27bbc9324..bf9f56471f71facb29ecc7bb9a2872bb259a0bfb 100644
--- a/src/interfaces/libpgtcl/pgtclCmds.c
+++ b/src/interfaces/libpgtcl/pgtclCmds.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.54 2001/02/10 02:31:29 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.55 2001/03/22 04:01:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,7 +24,7 @@
  * Local function forward declarations
  */
 static int execute_put_values(Tcl_Interp *interp, char *array_varname,
-						PGresult *result, int tupno);
+				   PGresult *result, int tupno);
 
 
 #ifdef TCL_ARRAYS
@@ -790,7 +790,7 @@ Pg_result_errReturn:
 
  the return result is the number of tuples processed. If the query
  returns tuples (i.e. a SELECT statement), the result is placed into
- variables 
+ variables
  **********************************/
 
 int
@@ -808,8 +808,8 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	char		buf[64];
 
 	char	   *usage = "Wrong # of arguments\n"
-						"pg_execute ?-array arrayname? ?-oid varname? "
-						"connection queryString ?loop_body?";
+	"pg_execute ?-array arrayname? ?-oid varname? "
+	"connection queryString ?loop_body?";
 
 	/*
 	 * First we parse the options
@@ -817,18 +817,19 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	i = 1;
 	while (i < argc)
 	{
-	    if (argv[i][0] != '-')
+		if (argv[i][0] != '-')
 			break;
 
 		if (strcmp(argv[i], "-array") == 0)
 		{
+
 			/*
 			 * The rows should appear in an array vs. to single variables
 			 */
-		    i++;
+			i++;
 			if (i == argc)
 			{
-			    Tcl_SetResult(interp, usage, TCL_VOLATILE);
+				Tcl_SetResult(interp, usage, TCL_VOLATILE);
 				return TCL_ERROR;
 			}
 			array_varname = argv[i++];
@@ -837,13 +838,14 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 
 		if (strcmp(argv[i], "-oid") == 0)
 		{
+
 			/*
 			 * We should place PQoidValue() somewhere
 			 */
-		    i++;
+			i++;
 			if (i == argc)
 			{
-			    Tcl_SetResult(interp, usage, TCL_VOLATILE);
+				Tcl_SetResult(interp, usage, TCL_VOLATILE);
 				return TCL_ERROR;
 			}
 			oid_varname = argv[i++];
@@ -854,7 +856,7 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 		return TCL_ERROR;
 	}
 
-	/* 
+	/*
 	 * Check that after option parsing at least 'connection' and 'query'
 	 * are left
 	 */
@@ -897,15 +899,15 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	}
 
 	/*
-	 * Set the oid variable to the returned oid of an INSERT statement
-	 * if requested (or an empty string if it wasn't an INSERT)
+	 * Set the oid variable to the returned oid of an INSERT statement if
+	 * requested (or an empty string if it wasn't an INSERT)
 	 */
 	if (oid_varname != NULL)
 	{
-	    if (Tcl_SetVar(interp, oid_varname,
-				PQoidStatus(result), TCL_LEAVE_ERR_MSG) != TCL_OK)
+		if (Tcl_SetVar(interp, oid_varname,
+					   PQoidStatus(result), TCL_LEAVE_ERR_MSG) != TCL_OK)
 		{
-		    PQclear(result);
+			PQclear(result);
 			return TCL_ERROR;
 		}
 	}
@@ -919,7 +921,7 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 			/* fall through if we have tuples */
 			break;
 
-	    case PGRES_EMPTY_QUERY:
+		case PGRES_EMPTY_QUERY:
 		case PGRES_COMMAND_OK:
 		case PGRES_COPY_IN:
 		case PGRES_COPY_OUT:
@@ -940,11 +942,12 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	/*
 	 * We reach here only for queries that returned tuples
 	 */
-	if (i == argc) {
+	if (i == argc)
+	{
+
 		/*
-		 * We don't have a loop body. If we have at least one
-		 * result row, we set all the variables to the first one
-		 * and return.
+		 * We don't have a loop body. If we have at least one result row,
+		 * we set all the variables to the first one and return.
 		 */
 		if (PQntuples(result) > 0)
 		{
@@ -954,7 +957,7 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 				return TCL_ERROR;
 			}
 		}
-	    
+
 		sprintf(buf, "%d", PQntuples(result));
 		Tcl_SetResult(interp, buf, TCL_VOLATILE);
 		PQclear(result);
@@ -962,15 +965,15 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	}
 
 	/*
-	 * We have a loop body. For each row in the result set put the
-	 * values into the Tcl variables and execute the body.
+	 * We have a loop body. For each row in the result set put the values
+	 * into the Tcl variables and execute the body.
 	 */
 	ntup = PQntuples(result);
 	for (tupno = 0; tupno < ntup; tupno++)
 	{
-	    if (execute_put_values(interp, array_varname, result, tupno) != TCL_OK)
+		if (execute_put_values(interp, array_varname, result, tupno) != TCL_OK)
 		{
-		    PQclear(result);
+			PQclear(result);
 			return TCL_ERROR;
 		}
 
@@ -995,12 +998,12 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	}
 
 	/*
-	 * At the end of the loop we put the number of rows we
-	 * got into the interpreter result and clear the result set.
+	 * At the end of the loop we put the number of rows we got into the
+	 * interpreter result and clear the result set.
 	 */
 	sprintf(buf, "%d", ntup);
 	Tcl_SetResult(interp, buf, TCL_VOLATILE);
-    PQclear(result);
+	PQclear(result);
 	return TCL_OK;
 }
 
@@ -1011,36 +1014,35 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
  Put the values of one tuple into Tcl variables named like the
  column names, or into an array indexed by the column names.
  **********************************/
-static int 
+static int
 execute_put_values(Tcl_Interp *interp, char *array_varname,
-						PGresult *result, int tupno)
+				   PGresult *result, int tupno)
 {
-	int		i;
-	int		n;
-	char   *fname;
-	char   *value;
+	int			i;
+	int			n;
+	char	   *fname;
+	char	   *value;
 
 	/*
-	 * For each column get the column name and value
-	 * and put it into a Tcl variable (either scalar or
-	 * array item)
+	 * For each column get the column name and value and put it into a Tcl
+	 * variable (either scalar or array item)
 	 */
 	n = PQnfields(result);
 	for (i = 0; i < n; i++)
 	{
-	    fname = PQfname(result, i);
+		fname = PQfname(result, i);
 		value = PQgetvalue(result, tupno, i);
 
 		if (array_varname != NULL)
 		{
-		    if (Tcl_SetVar2(interp, array_varname, fname, value,
-								TCL_LEAVE_ERR_MSG) == NULL)
-		        return TCL_ERROR;
+			if (Tcl_SetVar2(interp, array_varname, fname, value,
+							TCL_LEAVE_ERR_MSG) == NULL)
+				return TCL_ERROR;
 		}
 		else
 		{
-		    if (Tcl_SetVar(interp, fname, value, TCL_LEAVE_ERR_MSG) == NULL)
-		        return TCL_ERROR;
+			if (Tcl_SetVar(interp, fname, value, TCL_LEAVE_ERR_MSG) == NULL)
+				return TCL_ERROR;
 		}
 	}
 
@@ -1163,15 +1165,15 @@ Pg_lo_close(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 **********************/
 #ifdef PGTCL_USE_TCLOBJ
 int
-Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc, 
-		Tcl_Obj *CONST objv[])
+Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
+		   Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			fd;
 	int			nbytes = 0;
 	char	   *buf;
-	Tcl_Obj	   *bufVar;
-	Tcl_Obj	   *bufObj;
+	Tcl_Obj    *bufVar;
+	Tcl_Obj    *bufObj;
 	int			len;
 	int			rc = TCL_OK;
 
@@ -1182,8 +1184,8 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL), 
-			(Pg_ConnectionId **) NULL);
+	conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL),
+							 (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
@@ -1205,16 +1207,17 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
 	nbytes = lo_read(conn, fd, buf, len);
 	bufObj = Tcl_NewStringObj(buf, nbytes);
 
-	if (Tcl_ObjSetVar2(interp, bufVar, NULL, bufObj, 
-					TCL_LEAVE_ERR_MSG | TCL_PARSE_PART1) == NULL)
+	if (Tcl_ObjSetVar2(interp, bufVar, NULL, bufObj,
+					   TCL_LEAVE_ERR_MSG | TCL_PARSE_PART1) == NULL)
 		rc = TCL_ERROR;
 	else
 		Tcl_SetObjResult(interp, Tcl_NewIntObj(nbytes));
-	
+
 	ckfree(buf);
 	return rc;
 
 }
+
 #else
 int
 Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
@@ -1258,6 +1261,7 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	return TCL_OK;
 
 }
+
 #endif
 
 /***********************************
@@ -1270,8 +1274,8 @@ Pg_lo_write
 ***********************************/
 #ifdef PGTCL_USE_TCLOBJ
 int
-Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc, 
-		Tcl_Obj *CONST objv[])
+Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
+			Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	char	   *buf;
@@ -1286,8 +1290,8 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL), 
-			(Pg_ConnectionId **) NULL);
+	conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL),
+							 (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
@@ -1312,6 +1316,7 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
 	Tcl_SetObjResult(interp, Tcl_NewIntObj(nbytes));
 	return TCL_OK;
 }
+
 #else
 int
 Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
@@ -1349,6 +1354,7 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 	sprintf(interp->result, "%d", nbytes);
 	return TCL_OK;
 }
+
 #endif
 
 /***********************************
diff --git a/src/interfaces/libpgtcl/pgtclCmds.h b/src/interfaces/libpgtcl/pgtclCmds.h
index cf306e8c2d353d3a480c55a26f6cbf279ec7f449..69ae93015e9920ee50ea243ee838bb6a053bd8cc 100644
--- a/src/interfaces/libpgtcl/pgtclCmds.h
+++ b/src/interfaces/libpgtcl/pgtclCmds.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pgtclCmds.h,v 1.20 2001/01/24 19:43:29 momjian Exp $
+ * $Id: pgtclCmds.h,v 1.21 2001/03/22 04:01:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,9 +24,9 @@
  * From Tcl verion 8.0 on we can make large object access binary.
  */
 #ifdef TCL_MAJOR_VERSION
-#  if (TCL_MAJOR_VERSION >= 8)
-#    define PGTCL_USE_TCLOBJ
-#  endif
+#if (TCL_MAJOR_VERSION >= 8)
+#define PGTCL_USE_TCLOBJ
+#endif
 #endif
 
 /*
@@ -85,7 +85,7 @@ extern int Pg_disconnect(
 extern int Pg_exec(
 		ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_execute(
-		ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_select(
 		  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_result(
@@ -94,18 +94,21 @@ extern int Pg_lo_open(
 		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_lo_close(
 			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+
 #ifdef PGTCL_USE_TCLOBJ
 extern int Pg_lo_read(
-		   ClientData cData, Tcl_Interp *interp, int objc, 
+		   ClientData cData, Tcl_Interp *interp, int objc,
 		   Tcl_Obj *CONST objv[]);
 extern int Pg_lo_write(
-			ClientData cData, Tcl_Interp *interp, int objc, 
+			ClientData cData, Tcl_Interp *interp, int objc,
 			Tcl_Obj *CONST objv[]);
+
 #else
 extern int Pg_lo_read(
 		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_lo_write(
 			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+
 #endif
 extern int Pg_lo_lseek(
 			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index dce3b5c90b965aa69d5470b86e8bcf15e071a200..0e158d984f414ee0310d7386c23dfaee048148d9 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -10,7 +10,7 @@
  * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.46 2001/02/10 02:31:30 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.47 2001/03/22 04:01:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -118,7 +118,7 @@ static void
 pg_krb4_init()
 {
 	char	   *realm;
-	static int		init_done = 0;
+	static int	init_done = 0;
 
 	if (init_done)
 		return;
@@ -265,7 +265,7 @@ pg_an_to_ln(char *aname)
  * Various krb5 state which is not connection specfic, and a flag to
  * indicate whether we have initialised it yet.
  */
-static int pg_krb5_initialised;
+static int	pg_krb5_initialised;
 static krb5_context pg_krb5_context;
 static krb5_ccache pg_krb5_ccache;
 static krb5_principal pg_krb5_client;
@@ -281,7 +281,8 @@ pg_krb5_init(char *PQerrormsg)
 		return STATUS_OK;
 
 	retval = krb5_init_context(&pg_krb5_context);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_init_context: %s",
 				 error_message(retval));
@@ -289,27 +290,30 @@ pg_krb5_init(char *PQerrormsg)
 	}
 
 	retval = krb5_cc_default(pg_krb5_context, &pg_krb5_ccache);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_cc_default: %s",
 				 error_message(retval));
 		krb5_free_context(pg_krb5_context);
 		return STATUS_ERROR;
-    }
+	}
 
-    retval = krb5_cc_get_principal(pg_krb5_context, pg_krb5_ccache, 
+	retval = krb5_cc_get_principal(pg_krb5_context, pg_krb5_ccache,
 								   &pg_krb5_client);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_cc_get_principal: %s",
 				 error_message(retval));
 		krb5_cc_close(pg_krb5_context, pg_krb5_ccache);
 		krb5_free_context(pg_krb5_context);
 		return STATUS_ERROR;
-    }
+	}
 
-    retval = krb5_unparse_name(pg_krb5_context, pg_krb5_client, &pg_krb5_name);
-	if (retval) {
+	retval = krb5_unparse_name(pg_krb5_context, pg_krb5_client, &pg_krb5_name);
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_init: krb5_unparse_name: %s",
 				 error_message(retval));
@@ -317,7 +321,7 @@ pg_krb5_init(char *PQerrormsg)
 		krb5_cc_close(pg_krb5_context, pg_krb5_ccache);
 		krb5_free_context(pg_krb5_context);
 		return STATUS_ERROR;
-	}	
+	}
 
 	pg_krb5_name = pg_an_to_ln(pg_krb5_name);
 
@@ -351,32 +355,34 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
 				 const char *hostname)
 {
 	krb5_error_code retval;
-	int ret;
+	int			ret;
 	krb5_principal server;
 	krb5_auth_context auth_context = NULL;
-    krb5_error *err_ret = NULL;
-	int flags;
+	krb5_error *err_ret = NULL;
+	int			flags;
 
 	ret = pg_krb5_init(PQerrormsg);
 	if (ret != STATUS_OK)
 		return ret;
 
-	retval = krb5_sname_to_principal(pg_krb5_context, hostname, PG_KRB_SRVNAM, 
+	retval = krb5_sname_to_principal(pg_krb5_context, hostname, PG_KRB_SRVNAM,
 									 KRB5_NT_SRV_HST, &server);
-	if (retval) {
+	if (retval)
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_sendauth: krb5_sname_to_principal: %s",
 				 error_message(retval));
 		return STATUS_ERROR;
 	}
 
-	/* 
+	/*
 	 * libpq uses a non-blocking socket. But kerberos needs a blocking
 	 * socket, and we have to block somehow to do mutual authentication
 	 * anyway. So we temporarily make it blocking.
 	 */
 	flags = fcntl(sock, F_GETFL);
-	if (flags < 0 || fcntl(sock, F_SETFL, (long)(flags & ~O_NONBLOCK))) {
+	if (flags < 0 || fcntl(sock, F_SETFL, (long) (flags & ~O_NONBLOCK)))
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_sendauth: fcntl: %s", strerror(errno));
 		krb5_free_principal(pg_krb5_context, server);
@@ -384,32 +390,36 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
 	}
 
 	retval = krb5_sendauth(pg_krb5_context, &auth_context,
-						   (krb5_pointer) &sock, PG_KRB_SRVNAM,
+						   (krb5_pointer) & sock, PG_KRB_SRVNAM,
 						   pg_krb5_client, server,
 						   AP_OPTS_MUTUAL_REQUIRED,
 						   NULL, 0,		/* no creds, use ccache instead */
 						   pg_krb5_ccache, &err_ret, NULL, NULL);
-	if (retval) {
-		if (retval == KRB5_SENDAUTH_REJECTED && err_ret) {
+	if (retval)
+	{
+		if (retval == KRB5_SENDAUTH_REJECTED && err_ret)
+		{
 			snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 					 "pg_krb5_sendauth: authentication rejected: \"%*s\"",
 					 err_ret->text.length, err_ret->text.data);
 		}
-		else {
+		else
+		{
 			snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 					 "pg_krb5_sendauth: krb5_sendauth: %s",
 					 error_message(retval));
 		}
-			
+
 		if (err_ret)
 			krb5_free_error(pg_krb5_context, err_ret);
-		
+
 		ret = STATUS_ERROR;
 	}
 
 	krb5_free_principal(pg_krb5_context, server);
-	
-	if (fcntl(sock, F_SETFL, (long)flags)) {
+
+	if (fcntl(sock, F_SETFL, (long) flags))
+	{
 		snprintf(PQerrormsg, PQERRORMSG_LENGTH,
 				 "pg_krb5_sendauth: fcntl: %s", strerror(errno));
 		ret = STATUS_ERROR;
@@ -575,8 +585,8 @@ fe_getauthname(char *PQerrormsg)
 #endif
 
 	if (authsvc == STARTUP_MSG
-	    || (authsvc == STARTUP_KRB4_MSG && !name)
-	    || (authsvc == STARTUP_KRB5_MSG && !name))
+		|| (authsvc == STARTUP_KRB4_MSG && !name)
+		|| (authsvc == STARTUP_KRB5_MSG && !name))
 	{
 #ifdef WIN32
 		char		username[128];
@@ -593,7 +603,7 @@ fe_getauthname(char *PQerrormsg)
 	}
 
 	if (authsvc != STARTUP_MSG && authsvc != STARTUP_KRB4_MSG && authsvc != STARTUP_KRB5_MSG)
-		sprintf(PQerrormsg,"fe_getauthname: invalid authentication system: %d\n", authsvc);
+		sprintf(PQerrormsg, "fe_getauthname: invalid authentication system: %d\n", authsvc);
 
 	if (name && (authn = (char *) malloc(strlen(name) + 1)))
 		strcpy(authn, name);
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 4486e3cf72a015564d93b362e34a23f3bb40809e..891e0752b42207746ca70ef3ef4af965d6b5757d 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.160 2001/02/10 02:31:30 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.161 2001/03/22 04:01:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -32,7 +32,7 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
+#include <netinet/tcp.h>
 #endif
 #include <arpa/inet.h>
 #endif
@@ -65,6 +65,7 @@ inet_aton(const char *cp, struct in_addr * inp)
 
 #ifdef USE_SSL
 static SSL_CTX *SSL_context = NULL;
+
 #endif
 
 #define NOTIFYLIST_INITIAL_SIZE 10
@@ -108,7 +109,7 @@ static const PQconninfoOption PQconninfoOptions[] = {
 	"Database-Authtype", "D", 20},
 
 	{"service", "PGSERVICE", NULL, NULL,
-	 "Database-Service", "", 20},
+	"Database-Service", "", 20},
 
 	{"user", "PGUSER", NULL, NULL,
 	"Database-User", "", 20},
@@ -137,7 +138,7 @@ static const PQconninfoOption PQconninfoOptions[] = {
 
 #ifdef USE_SSL
 	{"requiressl", "PGREQUIRESSL", "0", NULL,
-	 "Require-SSL", "", 1 },
+	"Require-SSL", "", 1},
 #endif
 
 	/* Terminating entry --- MUST BE LAST */
@@ -186,8 +187,8 @@ static PQconninfoOption *conninfo_parse(const char *conninfo,
 static char *conninfo_getval(PQconninfoOption *connOptions,
 				const char *keyword);
 static void defaultNoticeProcessor(void *arg, const char *message);
-static int  parseServiceInfo(PQconninfoOption *options, 
-			     PQExpBuffer errorMessage);
+static int parseServiceInfo(PQconninfoOption *options,
+				 PQExpBuffer errorMessage);
 
 
 /* ----------------
@@ -316,7 +317,7 @@ PQconnectStart(const char *conninfo)
 	conn->pgpass = tmp ? strdup(tmp) : NULL;
 #ifdef USE_SSL
 	tmp = conninfo_getval(connOptions, "requiressl");
-	conn->require_ssl = tmp ? (tmp[0]=='1'?true:false) : false;
+	conn->require_ssl = tmp ? (tmp[0] == '1' ? true : false) : false;
 #endif
 
 	/* ----------
@@ -516,7 +517,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
 
 #ifdef USE_SSL
 	if ((tmp = getenv("PGREQUIRESSL")) != NULL)
-		conn->require_ssl = (tmp[0]=='1')?true:false;
+		conn->require_ssl = (tmp[0] == '1') ? true : false;
 	else
 		conn->require_ssl = 0;
 #endif
@@ -533,7 +534,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
 }
 
 
-#ifdef NOT_USED /* because it's broken */
+#ifdef NOT_USED					/* because it's broken */
 /*
  * update_db_info -
  * get all additional info out of dbName
@@ -542,7 +543,8 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
 static int
 update_db_info(PGconn *conn)
 {
-	char	   *tmp, *tmp2,
+	char	   *tmp,
+			   *tmp2,
 			   *old = conn->dbName;
 
 	if (strchr(conn->dbName, '@') != NULL)
@@ -588,7 +590,8 @@ update_db_info(PGconn *conn)
 
 			/*
 			 * new style:
-			 * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:][/dbname][?options]
+			 * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:][/db
+			 * name][?options]
 			 */
 			offset += strlen("postgresql://");
 
@@ -611,7 +614,11 @@ update_db_info(PGconn *conn)
 			}
 			else
 			{
-				/* Why do we default only this value from the environment again?  */
+
+				/*
+				 * Why do we default only this value from the environment
+				 * again?
+				 */
 				if ((tmp = getenv("PGDATABASE")) != NULL)
 				{
 					if (conn->dbName)
@@ -635,10 +642,10 @@ update_db_info(PGconn *conn)
 					if (strncmp(old, "unix:", 5) != 0)
 					{
 						printfPQExpBuffer(&conn->errorMessage,
-								  "connectDBStart() -- "
-								  "socket name can only be specified with "
-								  "non-TCP\n");
-						return 1; 
+										  "connectDBStart() -- "
+								"socket name can only be specified with "
+										  "non-TCP\n");
+						return 1;
 					}
 					*tmp2 = '\0';
 					if (conn->pgunixsocket)
@@ -682,7 +689,8 @@ update_db_info(PGconn *conn)
 
 	return 0;
 }
-#endif /* NOT_USED */
+
+#endif	 /* NOT_USED */
 
 
 /* ----------
@@ -696,12 +704,14 @@ connectMakeNonblocking(PGconn *conn)
 {
 #ifdef WIN32
 	int			on = 1;
+
 	if (ioctlsocket(conn->sock, FIONBIO, &on) != 0)
 #elif defined(__BEOS__)
-	int			on = 1;
-    if (ioctl(conn->sock, FIONBIO, &on) != 0)
+		int			on = 1;
+
+	if (ioctl(conn->sock, FIONBIO, &on) != 0)
 #else
-	if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
+	if			(fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
 #endif
 	{
 		printfPQExpBuffer(&conn->errorMessage,
@@ -754,7 +764,7 @@ connectFailureMessage(PGconn *conn, const char *caller, int errorno)
 		printfPQExpBuffer(&conn->errorMessage,
 						  "%s -- connect() failed: %s\n"
 						  "\tIs the postmaster running locally\n"
-						  "\tand accepting connections on Unix socket '%s'?\n",
+					"\tand accepting connections on Unix socket '%s'?\n",
 						  caller,
 						  strerror(errorno),
 						  conn->raddr.un.sun_path);
@@ -762,8 +772,8 @@ connectFailureMessage(PGconn *conn, const char *caller, int errorno)
 #endif
 		printfPQExpBuffer(&conn->errorMessage,
 						  "%s -- connect() failed: %s\n"
-						  "\tIs the postmaster running (with -i) at '%s'\n"
-						  "\tand accepting connections on TCP/IP port %s?\n",
+						"\tIs the postmaster running (with -i) at '%s'\n"
+					  "\tand accepting connections on TCP/IP port %s?\n",
 						  caller,
 						  strerror(errorno),
 						  conn->pghost ? conn->pghost : "localhost",
@@ -794,6 +804,7 @@ connectDBStart(PGconn *conn)
 		return 0;
 
 #ifdef NOT_USED
+
 	/*
 	 * parse dbName to get all additional info in it, if any
 	 */
@@ -822,7 +833,7 @@ connectDBStart(PGconn *conn)
 		{
 			printfPQExpBuffer(&conn->errorMessage,
 							  "connectDBStart() -- "
-						 	  "invalid host address: %s\n", conn->pghostaddr);
+						 "invalid host address: %s\n", conn->pghostaddr);
 			goto connect_errReturn;
 		}
 
@@ -963,15 +974,15 @@ connectDBStart(PGconn *conn)
 		if (pqPacketSend(conn, (char *) &np, sizeof(StartupPacket)) != STATUS_OK)
 		{
 			printfPQExpBuffer(&conn->errorMessage,
-					"connectDB() -- couldn't send SSL negotiation packet: errno=%d\n%s\n",
-					errno, strerror(errno));
+							  "connectDB() -- couldn't send SSL negotiation packet: errno=%d\n%s\n",
+							  errno, strerror(errno));
 			goto connect_errReturn;
 		}
 		/* Now receive the postmasters response */
 		if (recv(conn->sock, &SSLok, 1, 0) != 1)
 		{
 			printfPQExpBuffer(&conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n",
-					errno, strerror(errno));
+							  errno, strerror(errno));
 			goto connect_errReturn;
 		}
 		if (SSLok == 'S')
@@ -985,7 +996,7 @@ connectDBStart(PGconn *conn)
 				{
 					printfPQExpBuffer(&conn->errorMessage,
 					  "connectDB() -- couldn't create SSL context: %s\n",
-							ERR_reason_error_string(ERR_get_error()));
+							   ERR_reason_error_string(ERR_get_error()));
 					goto connect_errReturn;
 				}
 			}
@@ -995,7 +1006,7 @@ connectDBStart(PGconn *conn)
 			{
 				printfPQExpBuffer(&conn->errorMessage,
 				"connectDB() -- couldn't establish SSL connection: %s\n",
-						ERR_reason_error_string(ERR_get_error()));
+							   ERR_reason_error_string(ERR_get_error()));
 				goto connect_errReturn;
 			}
 			/* SSL connection finished. Continue to send startup packet */
@@ -1012,15 +1023,15 @@ connectDBStart(PGconn *conn)
 		else if (SSLok != 'N')
 		{
 			printfPQExpBuffer(&conn->errorMessage,
-				   "Received invalid negotiation response.\n");
+							  "Received invalid negotiation response.\n");
 			goto connect_errReturn;
 		}
 	}
-	if (conn->require_ssl && !conn->ssl) 
+	if (conn->require_ssl && !conn->ssl)
 	{
 		/* Require SSL, but server does not support/want it */
 		printfPQExpBuffer(&conn->errorMessage,
-						  "Server does not support SSL when SSL was required.\n");
+				 "Server does not support SSL when SSL was required.\n");
 		goto connect_errReturn;
 	}
 #endif
@@ -1065,6 +1076,7 @@ static int
 connectDBComplete(PGconn *conn)
 {
 	PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
+
 	if (conn == NULL || conn->status == CONNECTION_BAD)
 		return 0;
 
@@ -1144,6 +1156,7 @@ PostgresPollingStatusType
 PQconnectPoll(PGconn *conn)
 {
 	PGresult   *res;
+
 	if (conn == NULL)
 		return PGRES_POLLING_FAILED;
 
@@ -1621,8 +1634,11 @@ keep_going:						/* We will come back to here until there
 				env = getenv(envname);
 				if (!env || *env == '\0')
 				{
-					/* query server encoding if PGCLIENTENCODING
-					   is not specified */
+
+					/*
+					 * query server encoding if PGCLIENTENCODING is not
+					 * specified
+					 */
 					if (!PQsendQuery(conn,
 									 "select getdatabaseencoding()"))
 						goto error_return;
@@ -1633,16 +1649,17 @@ keep_going:						/* We will come back to here until there
 				else
 				{
 					/* otherwise set client encoding in pg_conn struct */
-					int encoding = pg_char_to_encoding(env);
+					int			encoding = pg_char_to_encoding(env);
+
 					if (encoding < 0)
 					{
 						strcpy(conn->errorMessage.data,
-							   "PGCLIENTENCODING has no valid encoding name.\n");
+						"PGCLIENTENCODING has no valid encoding name.\n");
 						goto error_return;
 					}
 					conn->client_encoding = encoding;
 				}
-					
+
 			}
 
 		case SETENV_STATE_ENCODINGS_WAIT:
@@ -2209,7 +2226,7 @@ pqPacketSend(PGconn *conn, const char *buf, size_t len)
 
 
 #ifndef SYSCONFDIR
-# error "You must compile this file with SYSCONFDIR defined."
+#error "You must compile this file with SYSCONFDIR defined."
 #endif
 
 #define MAXBUFSIZE 256
@@ -2217,111 +2234,131 @@ pqPacketSend(PGconn *conn, const char *buf, size_t len)
 static int
 parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
 {
-  char *service = conninfo_getval(options, "service");
-  char *serviceFile = SYSCONFDIR "/pg_service.conf";
-  int  group_found = 0;
-  int  linenr=0, i;
-
-  if(service != NULL) {
-    FILE *f;
-    char buf[MAXBUFSIZE], *line;
-    
-    f = fopen(serviceFile, "r");
-    if(f == NULL) {
-      printfPQExpBuffer(errorMessage, "ERROR: Service file '%s' not found\n",
-			serviceFile);
-      return 1;
-    }
-
-    /* As default, set the database name to the name of the service */
-    for(i = 0; options[i].keyword; i++)
-      if(strcmp(options[i].keyword, "dbname") == 0) {
-	if(options[i].val != NULL)
-	  free(options[i].val);
-	options[i].val = strdup(service);
-      }
-    
-    while((line = fgets(buf, MAXBUFSIZE-1, f)) != NULL) {
-      linenr++;
-
-      if(strlen(line) >= MAXBUFSIZE - 2) {
-	fclose(f);
-	printfPQExpBuffer(errorMessage,
-			 "ERROR: line %d too long in service file '%s'\n",
-			  linenr,
-			 serviceFile);
-	return 2;
-      }
-
-      /* ignore EOL at end of line */
-      if(strlen(line) && line[strlen(line)-1] == '\n')
-	line[strlen(line)-1] = 0;
-
-      /* ignore leading blanks */
-      while(*line && isspace((unsigned char) line[0]))
-		  line++;
-
-      /* ignore comments and empty lines */
-      if(strlen(line) == 0 || line[0] == '#')
-		  continue;
-
-      /* Check for right groupname */
-      if(line[0] == '[')
-	  {
-		  if(group_found) {
-			  /* group info already read */
-			  fclose(f);
-			  return 0;
-		  }
-
-	if(strncmp(line+1, service, strlen(service)) == 0 &&
-	   line[strlen(service)+1] == ']')
-	  group_found = 1;
-	else
-	  group_found = 0;
-      } else {
-	if(group_found) {
-	  /* Finally, we are in the right group and can parse the line */
-	  char *key, *val;
-	  int found_keyword;
-
-	  key = strtok(line, "=");
-	  if(key == NULL) {
-	    printfPQExpBuffer(errorMessage,
-			      "ERROR: syntax error in service file '%s', line %d\n",
-			      serviceFile,
-			      linenr);
-	    fclose(f);
-	    return 3;
-	  }
-	  val = line + strlen(line) + 1;
-	  
-	  found_keyword = 0;
-	  for(i = 0; options[i].keyword; i++) {
-	    if(strcmp(options[i].keyword, key) == 0) {
- 	      if(options[i].val != NULL)
- 		free(options[i].val);
- 	      options[i].val = strdup(val);
-	      found_keyword = 1;
-	    }
-	  }
-
-	  if(!found_keyword) {
-	    printfPQExpBuffer(errorMessage,
-			      "ERROR: syntax error in service file '%s', line %d\n",
-			      serviceFile,
-			      linenr);
-	    fclose(f);
-	    return 3;
-	  }
-	}
-      }
-    }
+	char	   *service = conninfo_getval(options, "service");
+	char	   *serviceFile = SYSCONFDIR "/pg_service.conf";
+	int			group_found = 0;
+	int			linenr = 0,
+				i;
+
+	if (service != NULL)
+	{
+		FILE	   *f;
+		char		buf[MAXBUFSIZE],
+				   *line;
+
+		f = fopen(serviceFile, "r");
+		if (f == NULL)
+		{
+			printfPQExpBuffer(errorMessage, "ERROR: Service file '%s' not found\n",
+							  serviceFile);
+			return 1;
+		}
+
+		/* As default, set the database name to the name of the service */
+		for (i = 0; options[i].keyword; i++)
+			if (strcmp(options[i].keyword, "dbname") == 0)
+			{
+				if (options[i].val != NULL)
+					free(options[i].val);
+				options[i].val = strdup(service);
+			}
+
+		while ((line = fgets(buf, MAXBUFSIZE - 1, f)) != NULL)
+		{
+			linenr++;
+
+			if (strlen(line) >= MAXBUFSIZE - 2)
+			{
+				fclose(f);
+				printfPQExpBuffer(errorMessage,
+						"ERROR: line %d too long in service file '%s'\n",
+								  linenr,
+								  serviceFile);
+				return 2;
+			}
+
+			/* ignore EOL at end of line */
+			if (strlen(line) && line[strlen(line) - 1] == '\n')
+				line[strlen(line) - 1] = 0;
+
+			/* ignore leading blanks */
+			while (*line && isspace((unsigned char) line[0]))
+				line++;
+
+			/* ignore comments and empty lines */
+			if (strlen(line) == 0 || line[0] == '#')
+				continue;
+
+			/* Check for right groupname */
+			if (line[0] == '[')
+			{
+				if (group_found)
+				{
+					/* group info already read */
+					fclose(f);
+					return 0;
+				}
+
+				if (strncmp(line + 1, service, strlen(service)) == 0 &&
+					line[strlen(service) + 1] == ']')
+					group_found = 1;
+				else
+					group_found = 0;
+			}
+			else
+			{
+				if (group_found)
+				{
 
-    fclose(f);
-  }
+					/*
+					 * Finally, we are in the right group and can parse
+					 * the line
+					 */
+					char	   *key,
+							   *val;
+					int			found_keyword;
 
-  return 0;
+					key = strtok(line, "=");
+					if (key == NULL)
+					{
+						printfPQExpBuffer(errorMessage,
+										  "ERROR: syntax error in service file '%s', line %d\n",
+										  serviceFile,
+										  linenr);
+						fclose(f);
+						return 3;
+					}
+					val = line + strlen(line) + 1;
+
+					found_keyword = 0;
+					for (i = 0; options[i].keyword; i++)
+					{
+						if (strcmp(options[i].keyword, key) == 0)
+						{
+							if (options[i].val != NULL)
+								free(options[i].val);
+							options[i].val = strdup(val);
+							found_keyword = 1;
+						}
+					}
+
+					if (!found_keyword)
+					{
+						printfPQExpBuffer(errorMessage,
+										  "ERROR: syntax error in service file '%s', line %d\n",
+										  serviceFile,
+										  linenr);
+						fclose(f);
+						return 3;
+					}
+				}
+			}
+		}
+
+		fclose(f);
+	}
+
+	return 0;
 }
 
 
@@ -2500,11 +2537,12 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
 
 	}
 
-	/* Now check for service info */	
-	if(parseServiceInfo(options, errorMessage)) {
-	  PQconninfoFree(options);
-	  free(buf);
-	  return NULL;
+	/* Now check for service info */
+	if (parseServiceInfo(options, errorMessage))
+	{
+		PQconninfoFree(options);
+		free(buf);
+		return NULL;
 	}
 
 	/* Done with the modifiable input string */
@@ -2749,12 +2787,14 @@ PQsetClientEncoding(PGconn *conn, const char *encoding)
 #endif
 
 #ifdef USE_SSL
-SSL *PQgetssl(PGconn *conn)
+SSL *
+PQgetssl(PGconn *conn)
 {
 	if (!conn)
 		return NULL;
 	return conn->ssl;
 }
+
 #endif
 
 void
@@ -2819,31 +2859,32 @@ defaultNoticeProcessor(void *arg, const char *message)
  * if there's no valid encoding, returns -1
  */
 
-typedef struct {
-	int encoding;	/* encoding symbol value */
-	char *name;	/* encoding string */
-} PQ_encoding_conv_tbl;
+typedef struct
+{
+	int			encoding;		/* encoding symbol value */
+	char	   *name;			/* encoding string */
+}			PQ_encoding_conv_tbl;
 
 static PQ_encoding_conv_tbl pq_conv_tbl[] = {
-		{SQL_ASCII, "SQL_ASCII"},
-		{EUC_JP, "EUC_JP"},
-		{EUC_CN, "EUC_CN"},
-		{EUC_KR, "EUC_KR"},
-		{EUC_TW, "EUC_TW"},
-		{UNICODE, "UNICODE"},
-		{MULE_INTERNAL, "MULE_INTERNAL"},
-		{LATIN1, "LATIN1"},
-		{LATIN2, "LATIN2"},
-		{LATIN3, "LATIN3"},
-		{LATIN4, "LATIN4"},
-		{LATIN5, "LATIN5"},
-		{KOI8, "KOI8"},
-		{WIN, "WIN"},
-		{ALT, "ALT"},
-		{SJIS, "SJIS"},
-		{BIG5, "BIG5"},
-		{WIN1250, "WIN1250"},
-		{-1, ""}
+	{SQL_ASCII, "SQL_ASCII"},
+	{EUC_JP, "EUC_JP"},
+	{EUC_CN, "EUC_CN"},
+	{EUC_KR, "EUC_KR"},
+	{EUC_TW, "EUC_TW"},
+	{UNICODE, "UNICODE"},
+	{MULE_INTERNAL, "MULE_INTERNAL"},
+	{LATIN1, "LATIN1"},
+	{LATIN2, "LATIN2"},
+	{LATIN3, "LATIN3"},
+	{LATIN4, "LATIN4"},
+	{LATIN5, "LATIN5"},
+	{KOI8, "KOI8"},
+	{WIN, "WIN"},
+	{ALT, "ALT"},
+	{SJIS, "SJIS"},
+	{BIG5, "BIG5"},
+	{WIN1250, "WIN1250"},
+	{-1, ""}
 };
 
 int
@@ -2878,4 +2919,5 @@ pg_encoding_to_char(int encoding)
 	}
 	return ("");
 }
+
 #endif
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index b7acb04467473b027f01f5e69dbc85ab7a1c5c8f..697128cb8289dbf8dc1548a62d169cf6fc17f179 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -25,7 +25,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.46 2001/02/17 03:37:22 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.47 2001/03/22 04:01:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -208,7 +208,7 @@ pqGetnchar(char *s, size_t len, PGconn *conn)
 	conn->inCursor += len;
 
 	if (conn->Pfdebug)
-		fprintf(conn->Pfdebug, "From backend (%lu)> %.*s\n", (unsigned long)len, (int) len, s);
+		fprintf(conn->Pfdebug, "From backend (%lu)> %.*s\n", (unsigned long) len, (int) len, s);
 
 	return 0;
 }
@@ -259,13 +259,13 @@ pqGetInt(int *result, size_t bytes, PGconn *conn)
 			break;
 		default:
 			sprintf(noticeBuf,
-					"pqGetInt: int size %lu not supported\n", (unsigned long)bytes);
+					"pqGetInt: int size %lu not supported\n", (unsigned long) bytes);
 			DONOTICE(conn, noticeBuf);
 			return EOF;
 	}
 
 	if (conn->Pfdebug)
-		fprintf(conn->Pfdebug, "From backend (#%lu)> %d\n", (unsigned long)bytes, *result);
+		fprintf(conn->Pfdebug, "From backend (#%lu)> %d\n", (unsigned long) bytes, *result);
 
 	return 0;
 }
@@ -296,13 +296,13 @@ pqPutInt(int value, size_t bytes, PGconn *conn)
 			break;
 		default:
 			sprintf(noticeBuf,
-					"pqPutInt: int size %lu not supported\n", (unsigned long)bytes);
+					"pqPutInt: int size %lu not supported\n", (unsigned long) bytes);
 			DONOTICE(conn, noticeBuf);
 			return EOF;
 	}
 
 	if (conn->Pfdebug)
-		fprintf(conn->Pfdebug, "To backend (%lu#)> %d\n", (unsigned long)bytes, value);
+		fprintf(conn->Pfdebug, "To backend (%lu#)> %d\n", (unsigned long) bytes, value);
 
 	return 0;
 }
@@ -645,9 +645,9 @@ pqFlush(PGconn *conn)
 				case ECONNRESET:
 #endif
 					printfPQExpBuffer(&conn->errorMessage,
-						"pqFlush() -- backend closed the channel unexpectedly.\n"
-						"\tThis probably means the backend terminated abnormally"
-						" before or while processing the request.\n");
+									  "pqFlush() -- backend closed the channel unexpectedly.\n"
+									  "\tThis probably means the backend terminated abnormally"
+						   " before or while processing the request.\n");
 
 					/*
 					 * We used to close the socket here, but that's a bad
@@ -661,8 +661,8 @@ pqFlush(PGconn *conn)
 
 				default:
 					printfPQExpBuffer(&conn->errorMessage,
-						"pqFlush() --  couldn't send data: errno=%d\n%s\n",
-						errno, strerror(errno));
+					  "pqFlush() --  couldn't send data: errno=%d\n%s\n",
+									  errno, strerror(errno));
 					/* We don't assume it's a fatal error... */
 					return EOF;
 			}
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index bd5e4e29a125e65f28d7d9a5287d7dfb980be672..f581260de03005a23f99f50863da7facbdbc889f 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -10,7 +10,7 @@
  * didn't really belong there.
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.41 2001/02/10 02:31:30 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.42 2001/03/22 04:01:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -92,14 +92,17 @@ PQprint(FILE *fout,
 		int			usePipe = 0;
 		pqsigfunc	oldsigpipehandler = NULL;
 		char	   *pagerenv;
+
 #ifdef TIOCGWINSZ
 		struct winsize screen_size;
+
 #else
 		struct winsize
 		{
 			int			ws_row;
 			int			ws_col;
 		}			screen_size;
+
 #endif
 
 		nTups = PQntuples(res);
@@ -149,9 +152,10 @@ PQprint(FILE *fout,
 #endif
 			)
 		{
+
 			/*
-			 * If we think there'll be more than one screen of output,
-			 * try to pipe to the pager program.
+			 * If we think there'll be more than one screen of output, try
+			 * to pipe to the pager program.
 			 */
 #ifdef TIOCGWINSZ
 			if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) == -1 ||
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index 1f201857e3eeed9dd1f67bf9e7725109b147c5bc..95279a133a9af369d4843d41fcadc65139e4cee0 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-fe.h,v 1.70 2001/01/24 19:43:31 momjian Exp $
+ * $Id: libpq-fe.h,v 1.71 2001/03/22 04:01:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -227,7 +227,7 @@ extern		"C"
 	extern int	PQsetClientEncoding(PGconn *conn, const char *encoding);
 #ifdef USE_SSL
 	/* Get the SSL structure associated with a connection */
-	extern SSL  *PQgetssl(PGconn *conn);
+	extern SSL *PQgetssl(PGconn *conn);
 #endif
 
 
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 09ffcb137ad9f65e71119e01ebcc810b2151c928..2c652bd767a6b1860f7e3f131eea793f3e6c8c99 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-int.h,v 1.32 2001/02/10 02:31:30 tgl Exp $
+ * $Id: libpq-int.h,v 1.33 2001/03/22 04:01:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -204,8 +204,9 @@ struct pg_conn
 								 * numbers-and-dots notation. Takes
 								 * precedence over above. */
 	char	   *pgport;			/* the server's communication port */
-	char	   *pgunixsocket;	/* the Unix-domain socket that the server is listening on;
-						 		 * if NULL, uses a default constructed from pgport */
+	char	   *pgunixsocket;	/* the Unix-domain socket that the server
+								 * is listening on; if NULL, uses a
+								 * default constructed from pgport */
 	char	   *pgtty;			/* tty on which the backend messages is
 								 * displayed (NOT ACTUALLY USED???) */
 	char	   *pgoptions;		/* options to start the backend with */
@@ -266,7 +267,7 @@ struct pg_conn
 
 #ifdef USE_SSL
 	bool		allow_ssl_try;	/* Allowed to try SSL negotiation */
-	bool        require_ssl;    /* Require SSL to make connection */
+	bool		require_ssl;	/* Require SSL to make connection */
 	SSL		   *ssl;			/* SSL status, if have SSL connection */
 #endif
 
diff --git a/src/interfaces/odbc/bind.c b/src/interfaces/odbc/bind.c
index 6ec25f80d6372fc0d76451919fdb51694a7e1832..a83bd5596b81f7615efc05dc3e50a0d62513cb24 100644
--- a/src/interfaces/odbc/bind.c
+++ b/src/interfaces/odbc/bind.c
@@ -1,15 +1,15 @@
 
-/* Module:          bind.c
+/* Module:			bind.c
  *
- * Description:     This module contains routines related to binding 
- *                  columns and parameters.
+ * Description:		This module contains routines related to binding
+ *					columns and parameters.
  *
- * Classes:         BindInfoClass, ParameterInfoClass
+ * Classes:			BindInfoClass, ParameterInfoClass
  *
- * API functions:   SQLBindParameter, SQLBindCol, SQLDescribeParam, SQLNumParams,
- *                  SQLParamOptions(NI)
+ * API functions:	SQLBindParameter, SQLBindCol, SQLDescribeParam, SQLNumParams,
+ *					SQLParamOptions(NI)
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -34,39 +34,44 @@
 #include "sqlext.h"
 #endif
 
-/*      Bind parameters on a statement handle */
-
-RETCODE SQL_API SQLBindParameter(
-        HSTMT      hstmt,
-        UWORD      ipar,
-        SWORD      fParamType,
-        SWORD      fCType,
-        SWORD      fSqlType,
-        UDWORD     cbColDef,
-        SWORD      ibScale,
-        PTR        rgbValue,
-        SDWORD     cbValueMax,
-        SDWORD FAR *pcbValue)
+/*		Bind parameters on a statement handle */
+
+RETCODE SQL_API
+SQLBindParameter(
+				 HSTMT hstmt,
+				 UWORD ipar,
+				 SWORD fParamType,
+				 SWORD fCType,
+				 SWORD fSqlType,
+				 UDWORD cbColDef,
+				 SWORD ibScale,
+				 PTR rgbValue,
+				 SDWORD cbValueMax,
+				 SDWORD FAR *pcbValue)
 {
-StatementClass *stmt = (StatementClass *) hstmt;
-static char *func="SQLBindParameter";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	static char *func = "SQLBindParameter";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if(stmt->parameters_allocated < ipar) {
+	if (stmt->parameters_allocated < ipar)
+	{
 		ParameterInfoClass *old_parameters;
-		int i, old_parameters_allocated;
+		int			i,
+					old_parameters_allocated;
 
 		old_parameters = stmt->parameters;
 		old_parameters_allocated = stmt->parameters_allocated;
 
-		stmt->parameters = (ParameterInfoClass *) malloc(sizeof(ParameterInfoClass)*(ipar));
-		if ( ! stmt->parameters) {
+		stmt->parameters = (ParameterInfoClass *) malloc(sizeof(ParameterInfoClass) * (ipar));
+		if (!stmt->parameters)
+		{
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Could not allocate memory for statement parameters";
 			SC_log_error(func, "", stmt);
@@ -76,18 +81,23 @@ static char *func="SQLBindParameter";
 		stmt->parameters_allocated = ipar;
 
 		/* copy the old parameters over */
-		for(i = 0; i < old_parameters_allocated; i++) {
+		for (i = 0; i < old_parameters_allocated; i++)
+		{
 			/* a structure copy should work */
 			stmt->parameters[i] = old_parameters[i];
 		}
 
 		/* get rid of the old parameters, if there were any */
-		if(old_parameters)
+		if (old_parameters)
 			free(old_parameters);
 
-		/* zero out the newly allocated parameters (in case they skipped some, */
+		/*
+		 * zero out the newly allocated parameters (in case they skipped
+		 * some,
+		 */
 		/* so we don't accidentally try to use them later) */
-		for(; i < stmt->parameters_allocated; i++) {
+		for (; i < stmt->parameters_allocated; i++)
+		{
 			stmt->parameters[i].buflen = 0;
 			stmt->parameters[i].buffer = 0;
 			stmt->parameters[i].used = 0;
@@ -103,7 +113,8 @@ static char *func="SQLBindParameter";
 		}
 	}
 
-	ipar--;		/* use zero based column numbers for the below part */
+	ipar--;						/* use zero based column numbers for the
+								 * below part */
 
 	/* store the given info */
 	stmt->parameters[ipar].buflen = cbValueMax;
@@ -115,74 +126,84 @@ static char *func="SQLBindParameter";
 	stmt->parameters[ipar].precision = cbColDef;
 	stmt->parameters[ipar].scale = ibScale;
 
-	/*	If rebinding a parameter that had data-at-exec stuff in it,
-		then free that stuff
-	*/
-	if (stmt->parameters[ipar].EXEC_used) {
+	/*
+	 * If rebinding a parameter that had data-at-exec stuff in it, then
+	 * free that stuff
+	 */
+	if (stmt->parameters[ipar].EXEC_used)
+	{
 		free(stmt->parameters[ipar].EXEC_used);
 		stmt->parameters[ipar].EXEC_used = NULL;
 	}
 
-	if (stmt->parameters[ipar].EXEC_buffer) {
+	if (stmt->parameters[ipar].EXEC_buffer)
+	{
 		if (stmt->parameters[ipar].SQLType != SQL_LONGVARBINARY)
 			free(stmt->parameters[ipar].EXEC_buffer);
 		stmt->parameters[ipar].EXEC_buffer = NULL;
 	}
 
-	/*	Data at exec macro only valid for C char/binary data */
+	/* Data at exec macro only valid for C char/binary data */
 	if ((fSqlType == SQL_LONGVARBINARY || fSqlType == SQL_LONGVARCHAR) && pcbValue && *pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET)
 		stmt->parameters[ipar].data_at_exec = TRUE;
 	else
 		stmt->parameters[ipar].data_at_exec = FALSE;
 
-	mylog("SQLBindParamater: ipar=%d, paramType=%d, fCType=%d, fSqlType=%d, cbColDef=%d, ibScale=%d, rgbValue=%d, *pcbValue = %d, data_at_exec = %d\n", ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, pcbValue ? *pcbValue: -777, stmt->parameters[ipar].data_at_exec);
+	mylog("SQLBindParamater: ipar=%d, paramType=%d, fCType=%d, fSqlType=%d, cbColDef=%d, ibScale=%d, rgbValue=%d, *pcbValue = %d, data_at_exec = %d\n", ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, pcbValue ? *pcbValue : -777, stmt->parameters[ipar].data_at_exec);
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
-
-/*      Associate a user-supplied buffer with a database column. */
-RETCODE SQL_API SQLBindCol(
-        HSTMT      hstmt,
-        UWORD      icol,
-        SWORD      fCType,
-        PTR        rgbValue,
-        SDWORD     cbValueMax,
-        SDWORD FAR *pcbValue)
+/*		-		-		-		-		-		-		-		-		- */
+
+/*		Associate a user-supplied buffer with a database column. */
+RETCODE SQL_API
+SQLBindCol(
+		   HSTMT hstmt,
+		   UWORD icol,
+		   SWORD fCType,
+		   PTR rgbValue,
+		   SDWORD cbValueMax,
+		   SDWORD FAR *pcbValue)
 {
-StatementClass *stmt = (StatementClass *) hstmt;
-static char *func="SQLBindCol";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	static char *func = "SQLBindCol";
+
+	mylog("%s: entering...\n", func);
 
-	mylog( "%s: entering...\n", func);
-    
-mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
+	mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 
 	SC_clear_error(stmt);
-    
-	if( stmt->status == STMT_EXECUTING) {
+
+	if (stmt->status == STMT_EXECUTING)
+	{
 		stmt->errormsg = "Can't bind columns while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/*	If the bookmark column is being bound, then just save it */
-	if (icol == 0) {
+	/* If the bookmark column is being bound, then just save it */
+	if (icol == 0)
+	{
 
-		if (rgbValue == NULL) {
+		if (rgbValue == NULL)
+		{
 			stmt->bookmark.buffer = NULL;
 			stmt->bookmark.used = NULL;
 		}
-		else {
-			/*	Make sure it is the bookmark data type */
-			if ( fCType != SQL_C_BOOKMARK) {
+		else
+		{
+			/* Make sure it is the bookmark data type */
+			if (fCType != SQL_C_BOOKMARK)
+			{
 				stmt->errormsg = "Column 0 is not of type SQL_C_BOOKMARK";
 				stmt->errornumber = STMT_PROGRAM_TYPE_OUT_OF_RANGE;
 				SC_log_error(func, "", stmt);
@@ -195,37 +216,42 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
 		return SQL_SUCCESS;
 	}
 
-	/*	allocate enough bindings if not already done */
-	/*	Most likely, execution of a statement would have setup the  */
-	/*	necessary bindings. But some apps call BindCol before any */
-	/*	statement is executed. */
-	if ( icol > stmt->bindings_allocated)
+	/* allocate enough bindings if not already done */
+	/* Most likely, execution of a statement would have setup the  */
+	/* necessary bindings. But some apps call BindCol before any */
+	/* statement is executed. */
+	if (icol > stmt->bindings_allocated)
 		extend_bindings(stmt, icol);
 
-	/*	check to see if the bindings were allocated */
-	if ( ! stmt->bindings) {
+	/* check to see if the bindings were allocated */
+	if (!stmt->bindings)
+	{
 		stmt->errormsg = "Could not allocate memory for bindings.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	icol--;		/* use zero based col numbers from here out */
+	icol--;						/* use zero based col numbers from here
+								 * out */
 
-	/*	Reset for SQLGetData */
+	/* Reset for SQLGetData */
 	stmt->bindings[icol].data_left = -1;
 
-	if (rgbValue == NULL) {
+	if (rgbValue == NULL)
+	{
 		/* we have to unbind the column */
 		stmt->bindings[icol].buflen = 0;
 		stmt->bindings[icol].buffer = NULL;
-		stmt->bindings[icol].used =   NULL;
+		stmt->bindings[icol].used = NULL;
 		stmt->bindings[icol].returntype = SQL_C_CHAR;
-	} else {
+	}
+	else
+	{
 		/* ok, bind that column */
-		stmt->bindings[icol].buflen     = cbValueMax;
-		stmt->bindings[icol].buffer     = rgbValue;
-		stmt->bindings[icol].used       = pcbValue;
+		stmt->bindings[icol].buflen = cbValueMax;
+		stmt->bindings[icol].buffer = rgbValue;
+		stmt->bindings[icol].used = pcbValue;
 		stmt->bindings[icol].returntype = fCType;
 
 		mylog("       bound buffer[%d] = %u\n", icol, stmt->bindings[icol].buffer);
@@ -234,34 +260,37 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*  Returns the description of a parameter marker. */
+/*	Returns the description of a parameter marker. */
 /*	This function is listed as not being supported by SQLGetFunctions() because it is  */
 /*	used to describe "parameter markers" (not bound parameters), in which case,  */
 /*	the dbms should return info on the markers.  Since Postgres doesn't support that, */
 /*	it is best to say this function is not supported and let the application assume a  */
 /*	data type (most likely varchar). */
 
-RETCODE SQL_API SQLDescribeParam(
-        HSTMT      hstmt,
-        UWORD      ipar,
-        SWORD  FAR *pfSqlType,
-        UDWORD FAR *pcbColDef,
-        SWORD  FAR *pibScale,
-        SWORD  FAR *pfNullable)
+RETCODE SQL_API
+SQLDescribeParam(
+				 HSTMT hstmt,
+				 UWORD ipar,
+				 SWORD FAR *pfSqlType,
+				 UDWORD FAR *pcbColDef,
+				 SWORD FAR *pibScale,
+				 SWORD FAR *pfNullable)
 {
-StatementClass *stmt = (StatementClass *) hstmt;
-static char *func = "SQLDescribeParam";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	static char *func = "SQLDescribeParam";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if( (ipar < 1) || (ipar > stmt->parameters_allocated) ) {
+	if ((ipar < 1) || (ipar > stmt->parameters_allocated))
+	{
 		stmt->errormsg = "Invalid parameter number for SQLDescribeParam.";
 		stmt->errornumber = STMT_BAD_PARAMETER_NUMBER_ERROR;
 		SC_log_error(func, "", stmt);
@@ -270,41 +299,45 @@ static char *func = "SQLDescribeParam";
 
 	ipar--;
 
-	/*	This implementation is not very good, since it is supposed to describe */
-	/*	parameter markers, not bound parameters.  */
-	if(pfSqlType)
+	/*
+	 * This implementation is not very good, since it is supposed to
+	 * describe
+	 */
+	/* parameter markers, not bound parameters.  */
+	if (pfSqlType)
 		*pfSqlType = stmt->parameters[ipar].SQLType;
 
-	if(pcbColDef)
+	if (pcbColDef)
 		*pcbColDef = stmt->parameters[ipar].precision;
 
-	if(pibScale)
+	if (pibScale)
 		*pibScale = stmt->parameters[ipar].scale;
 
-	if(pfNullable)
+	if (pfNullable)
 		*pfNullable = pgtype_nullable(stmt, stmt->parameters[ipar].paramType);
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*      Sets multiple values (arrays) for the set of parameter markers. */
+/*		Sets multiple values (arrays) for the set of parameter markers. */
 
-RETCODE SQL_API SQLParamOptions(
-        HSTMT      hstmt,
-        UDWORD     crow,
-        UDWORD FAR *pirow)
+RETCODE SQL_API
+SQLParamOptions(
+				HSTMT hstmt,
+				UDWORD crow,
+				UDWORD FAR *pirow)
 {
-static char *func = "SQLParamOptions";
+	static char *func = "SQLParamOptions";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
 	return SQL_ERROR;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
 /*	This function should really talk to the dbms to determine the number of  */
 /*	"parameter markers" (not bound parameters) in the statement.  But, since */
@@ -313,43 +346,51 @@ static char *func = "SQLParamOptions";
 /*	like it does for SQLDescribeParam is that some applications don't care and try  */
 /*	to call it anyway. */
 /*	If the statement does not have parameters, it should just return 0. */
-RETCODE SQL_API SQLNumParams(
-        HSTMT      hstmt,
-        SWORD  FAR *pcpar)
+RETCODE SQL_API
+SQLNumParams(
+			 HSTMT hstmt,
+			 SWORD FAR *pcpar)
 {
-StatementClass *stmt = (StatementClass *) hstmt;
-char in_quote = FALSE;
-unsigned int i;
-static char *func = "SQLNumParams";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	char		in_quote = FALSE;
+	unsigned int i;
+	static char *func = "SQLNumParams";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if(!stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	if (pcpar)
 		*pcpar = 0;
-	else {
+	else
+	{
 		SC_log_error(func, "pcpar was null", stmt);
 		return SQL_ERROR;
 	}
 
 
-	if(!stmt->statement) {
+	if (!stmt->statement)
+	{
 		/* no statement has been allocated */
 		stmt->errormsg = "SQLNumParams called with no statement ready.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
-	} else {
+	}
+	else
+	{
 
-		for(i=0; i < strlen(stmt->statement); i++) {
+		for (i = 0; i < strlen(stmt->statement); i++)
+		{
 
-			if(stmt->statement[i] == '?' && !in_quote)
+			if (stmt->statement[i] == '?' && !in_quote)
 				(*pcpar)++;
-			else {
+			else
+			{
 				if (stmt->statement[i] == '\'')
 					in_quote = (in_quote ? FALSE : TRUE);
 			}
@@ -360,20 +401,20 @@ static char *func = "SQLNumParams";
 }
 
 /********************************************************************
- *   Bindings Implementation
+ *	 Bindings Implementation
  */
 BindInfoClass *
 create_empty_bindings(int num_columns)
 {
-BindInfoClass *new_bindings;
-int i;
+	BindInfoClass *new_bindings;
+	int			i;
 
-	new_bindings = (BindInfoClass *)malloc(num_columns * sizeof(BindInfoClass));
-	if(!new_bindings) {
+	new_bindings = (BindInfoClass *) malloc(num_columns * sizeof(BindInfoClass));
+	if (!new_bindings)
 		return 0;
-	}
 
-	for(i=0; i < num_columns; i++) {
+	for (i = 0; i < num_columns; i++)
+	{
 		new_bindings[i].buflen = 0;
 		new_bindings[i].buffer = NULL;
 		new_bindings[i].used = NULL;
@@ -386,21 +427,24 @@ int i;
 void
 extend_bindings(StatementClass *stmt, int num_columns)
 {
-static char *func="extend_bindings";
-BindInfoClass *new_bindings;
-int i;
+	static char *func = "extend_bindings";
+	BindInfoClass *new_bindings;
+	int			i;
 
-mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func, stmt, stmt->bindings_allocated, num_columns);
+	mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func, stmt, stmt->bindings_allocated, num_columns);
 
 	/* if we have too few, allocate room for more, and copy the old */
 	/* entries into the new structure */
-	if(stmt->bindings_allocated < num_columns) {
+	if (stmt->bindings_allocated < num_columns)
+	{
 
 		new_bindings = create_empty_bindings(num_columns);
-		if ( ! new_bindings) {
-           mylog("%s: unable to create %d new bindings from %d old bindings\n", func, num_columns, stmt->bindings_allocated);
+		if (!new_bindings)
+		{
+			mylog("%s: unable to create %d new bindings from %d old bindings\n", func, num_columns, stmt->bindings_allocated);
 
-			if (stmt->bindings) {
+			if (stmt->bindings)
+			{
 				free(stmt->bindings);
 				stmt->bindings = NULL;
 			}
@@ -408,8 +452,9 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
 			return;
 		}
 
-		if(stmt->bindings) {
-			for(i=0; i<stmt->bindings_allocated; i++)
+		if (stmt->bindings)
+		{
+			for (i = 0; i < stmt->bindings_allocated; i++)
 				new_bindings[i] = stmt->bindings[i];
 
 			free(stmt->bindings);
@@ -418,14 +463,14 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
 		stmt->bindings = new_bindings;
 		stmt->bindings_allocated = num_columns;
 
-    } 
-	/*	There is no reason to zero out extra bindings if there are */
-	/*	more than needed.  If an app has allocated extra bindings,  */
-	/*	let it worry about it by unbinding those columns. */
+	}
+	/* There is no reason to zero out extra bindings if there are */
+	/* more than needed.  If an app has allocated extra bindings,  */
+	/* let it worry about it by unbinding those columns. */
 
-	/*	SQLBindCol(1..) ... SQLBindCol(10...)	# got 10 bindings */
-	/*	SQLExecDirect(...)  # returns 5 cols */
-	/*	SQLExecDirect(...)	# returns 10 cols  (now OK) */
+	/* SQLBindCol(1..) ... SQLBindCol(10...)   # got 10 bindings */
+	/* SQLExecDirect(...)  # returns 5 cols */
+	/* SQLExecDirect(...)  # returns 10 cols  (now OK) */
 
 	mylog("exit extend_bindings\n");
 }
diff --git a/src/interfaces/odbc/bind.h b/src/interfaces/odbc/bind.h
index 39e594f34601c286b0d92123541b99e682f286d9..58e5fb190ab21ef5b67c5186bac4452ce2215a18 100644
--- a/src/interfaces/odbc/bind.h
+++ b/src/interfaces/odbc/bind.h
@@ -1,9 +1,9 @@
 
-/* File:            bind.h
+/* File:			bind.h
  *
- * Description:     See "bind.c"
+ * Description:		See "bind.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -15,33 +15,40 @@
 /*
  * BindInfoClass -- stores information about a bound column
  */
-struct BindInfoClass_ {
-	Int4 buflen;		/* size of buffer */
-	Int4 data_left;		/* amount of data left to read (SQLGetData) */
-	char *buffer;		/* pointer to the buffer */
-	Int4 *used;			/* used space in the buffer (for strings not counting the '\0') */
-	Int2 returntype;	/* kind of conversion to be applied when returning (SQL_C_DEFAULT, SQL_C_CHAR...) */
+struct BindInfoClass_
+{
+	Int4		buflen;			/* size of buffer */
+	Int4		data_left;		/* amount of data left to read
+								 * (SQLGetData) */
+	char	   *buffer;			/* pointer to the buffer */
+	Int4	   *used;			/* used space in the buffer (for strings
+								 * not counting the '\0') */
+	Int2		returntype;		/* kind of conversion to be applied when
+								 * returning (SQL_C_DEFAULT,
+								 * SQL_C_CHAR...) */
 };
 
 /*
  * ParameterInfoClass -- stores information about a bound parameter
  */
-struct ParameterInfoClass_ {
-	Int4 buflen;
-	char *buffer;
-	Int4 *used;
-	Int2 paramType;
-	Int2 CType;
-	Int2 SQLType;
-	UInt4 precision;
-	Int2 scale;
-	Oid  lobj_oid;
-	Int4 *EXEC_used;		/* amount of data OR the oid of the large object */
-	char *EXEC_buffer;		/* the data or the FD of the large object */
-	char data_at_exec;
+struct ParameterInfoClass_
+{
+	Int4		buflen;
+	char	   *buffer;
+	Int4	   *used;
+	Int2		paramType;
+	Int2		CType;
+	Int2		SQLType;
+	UInt4		precision;
+	Int2		scale;
+	Oid			lobj_oid;
+	Int4	   *EXEC_used;		/* amount of data OR the oid of the large
+								 * object */
+	char	   *EXEC_buffer;	/* the data or the FD of the large object */
+	char		data_at_exec;
 };
 
 BindInfoClass *create_empty_bindings(int num_columns);
-void extend_bindings(StatementClass *stmt, int num_columns);
+void		extend_bindings(StatementClass *stmt, int num_columns);
 
 #endif
diff --git a/src/interfaces/odbc/columninfo.c b/src/interfaces/odbc/columninfo.c
index 9e5223b83b39b306c98666fd0c8f2d43c50503a0..630b0538c666b8a8cacb28b8424074e570f05ad7 100644
--- a/src/interfaces/odbc/columninfo.c
+++ b/src/interfaces/odbc/columninfo.c
@@ -1,14 +1,14 @@
 
-/* Module:          columninfo.c
+/* Module:			columninfo.c
  *
- * Description:     This module contains routines related to 
- *                  reading and storing the field information from a query.
+ * Description:		This module contains routines related to
+ *					reading and storing the field information from a query.
  *
- * Classes:         ColumnInfoClass (Functions prefix: "CI_")
+ * Classes:			ColumnInfoClass (Functions prefix: "CI_")
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -21,11 +21,12 @@
 ColumnInfoClass *
 CI_Constructor()
 {
-ColumnInfoClass *rv;
+	ColumnInfoClass *rv;
 
 	rv = (ColumnInfoClass *) malloc(sizeof(ColumnInfoClass));
 
-	if (rv) {
+	if (rv)
+	{
 		rv->num_fields = 0;
 		rv->name = NULL;
 		rv->adtid = NULL;
@@ -45,21 +46,21 @@ CI_Destructor(ColumnInfoClass *self)
 	free(self);
 }
 
-/*  Read in field descriptions.
-    If self is not null, then also store the information.
+/*	Read in field descriptions.
+	If self is not null, then also store the information.
 	If self is null, then just read, don't store.
 */
 char
 CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
 {
-Int2 lf;
-int new_num_fields;
-Oid new_adtid;
-Int2 new_adtsize;
-Int4 new_atttypmod = -1;
-char new_field_name[MAX_MESSAGE_LEN+1];
-SocketClass *sock;
-ConnInfo *ci;
+	Int2		lf;
+	int			new_num_fields;
+	Oid			new_adtid;
+	Int2		new_adtsize;
+	Int4		new_atttypmod = -1;
+	char		new_field_name[MAX_MESSAGE_LEN + 1];
+	SocketClass *sock;
+	ConnInfo   *ci;
 
 	sock = CC_get_socket(conn);
 	ci = &conn->connInfo;
@@ -69,24 +70,27 @@ ConnInfo *ci;
 
 	mylog("num_fields = %d\n", new_num_fields);
 
-	if (self) { 	/* according to that allocate memory */
+	if (self)
+	{							/* according to that allocate memory */
 		CI_set_num_fields(self, new_num_fields);
 	}
 
 	/* now read in the descriptions */
-	for(lf = 0; lf < new_num_fields; lf++) {
+	for (lf = 0; lf < new_num_fields; lf++)
+	{
 
 		SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN);
 		new_adtid = (Oid) SOCK_get_int(sock, 4);
 		new_adtsize = (Int2) SOCK_get_int(sock, 2);
 
-		/*	If 6.4 protocol, then read the atttypmod field */
-		if (PG_VERSION_GE(conn, 6.4)) {
+		/* If 6.4 protocol, then read the atttypmod field */
+		if (PG_VERSION_GE(conn, 6.4))
+		{
 
 			mylog("READING ATTTYPMOD\n");
 			new_atttypmod = (Int4) SOCK_get_int(sock, 4);
 
-			/*	Subtract the header length */
+			/* Subtract the header length */
 			new_atttypmod -= 4;
 			if (new_atttypmod < 0)
 				new_atttypmod = -1;
@@ -107,15 +111,16 @@ ConnInfo *ci;
 void
 CI_free_memory(ColumnInfoClass *self)
 {
-register Int2 lf;
-int num_fields = self->num_fields;
+	register Int2 lf;
+	int			num_fields = self->num_fields;
 
-	for (lf = 0; lf < num_fields; lf++) {
-		if( self->name[lf])
-			free (self->name[lf]);
+	for (lf = 0; lf < num_fields; lf++)
+	{
+		if (self->name[lf])
+			free(self->name[lf]);
 	}
 
-	/*	Safe to call even if null */
+	/* Safe to call even if null */
 	free(self->name);
 	free(self->adtid);
 	free(self->adtsize);
@@ -127,33 +132,31 @@ int num_fields = self->num_fields;
 void
 CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
 {
-	CI_free_memory(self);	/* always safe to call */
+	CI_free_memory(self);		/* always safe to call */
 
 	self->num_fields = new_num_fields;
 
-	self->name = (char **) malloc (sizeof(char *) * self->num_fields);
-	self->adtid = (Oid *) malloc (sizeof(Oid) * self->num_fields);
-	self->adtsize = (Int2 *) malloc (sizeof(Int2) * self->num_fields);
+	self->name = (char **) malloc(sizeof(char *) * self->num_fields);
+	self->adtid = (Oid *) malloc(sizeof(Oid) * self->num_fields);
+	self->adtsize = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
 	self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
 	self->atttypmod = (Int4 *) malloc(sizeof(Int4) * self->num_fields);
 }
 
 void
-CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, 
-                                      Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
+CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
+				  Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
 {
-    
+
 	/* check bounds */
-	if((field_num < 0) || (field_num >= self->num_fields)) {
+	if ((field_num < 0) || (field_num >= self->num_fields))
 		return;
-	}
 
 	/* store the info */
-	self->name[field_num] = strdup(new_name);  
+	self->name[field_num] = strdup(new_name);
 	self->adtid[field_num] = new_adtid;
 	self->adtsize[field_num] = new_adtsize;
 	self->atttypmod[field_num] = new_atttypmod;
 
 	self->display_size[field_num] = 0;
 }
-
diff --git a/src/interfaces/odbc/columninfo.h b/src/interfaces/odbc/columninfo.h
index 3ec1cc92d50e3edee351f108a9dfed30f65f091c..964ebc7617b905718efb885ed294772a90be4c0c 100644
--- a/src/interfaces/odbc/columninfo.h
+++ b/src/interfaces/odbc/columninfo.h
@@ -1,9 +1,9 @@
 
-/* File:            columninfo.h
+/* File:			columninfo.h
  *
- * Description:     See "columninfo.c"
+ * Description:		See "columninfo.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -12,13 +12,14 @@
 
 #include "psqlodbc.h"
 
-struct ColumnInfoClass_ {
-	Int2	num_fields;
-	char	**name;				/* list of type names */
-	Oid		*adtid;				/* list of type ids */
-	Int2	*adtsize;			/* list type sizes */
-	Int2	*display_size;		/* the display size (longest row) */
-	Int4	*atttypmod;			/* the length of bpchar/varchar */
+struct ColumnInfoClass_
+{
+	Int2		num_fields;
+	char	  **name;			/* list of type names */
+	Oid		   *adtid;			/* list of type ids */
+	Int2	   *adtsize;		/* list type sizes */
+	Int2	   *display_size;	/* the display size (longest row) */
+	Int4	   *atttypmod;		/* the length of bpchar/varchar */
 };
 
 #define CI_get_num_fields(self)			(self->num_fields)
@@ -29,15 +30,15 @@ struct ColumnInfoClass_ {
 #define CI_get_atttypmod(self, col)		(self->atttypmod[col])
 
 ColumnInfoClass *CI_Constructor(void);
-void CI_Destructor(ColumnInfoClass *self);
-void CI_free_memory(ColumnInfoClass *self);
-char CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
+void		CI_Destructor(ColumnInfoClass *self);
+void		CI_free_memory(ColumnInfoClass *self);
+char		CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
 
 /* functions for setting up the fields from within the program, */
 /* without reading from a socket */
-void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
-void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, 
-                       Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
+void		CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
+void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
+				  Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
 
 
 #endif
diff --git a/src/interfaces/odbc/connection.c b/src/interfaces/odbc/connection.c
index a4f0526184fc58464061c1ba004815edb7be9fea..bdb23a8d089dd8734b0d06d1f456ec1711b36171 100644
--- a/src/interfaces/odbc/connection.c
+++ b/src/interfaces/odbc/connection.c
@@ -1,15 +1,15 @@
 
-/* Module:          connection.c
+/* Module:			connection.c
  *
- * Description:     This module contains routines related to 
- *                  connecting to and disconnecting from the Postgres DBMS.
+ * Description:		This module contains routines related to
+ *					connecting to and disconnecting from the Postgres DBMS.
  *
- * Classes:         ConnectionClass (Functions prefix: "CC_")
+ * Classes:			ConnectionClass (Functions prefix: "CC_")
  *
- * API functions:   SQLAllocConnect, SQLConnect, SQLDisconnect, SQLFreeConnect,
- *                  SQLBrowseConnect(NI)
+ * API functions:	SQLAllocConnect, SQLConnect, SQLDisconnect, SQLFreeConnect,
+ *					SQLBrowseConnect(NI)
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 /* Multibyte support	Eiji Tokuya 2001-03-15 */
@@ -37,67 +37,73 @@
 #include <odbcinst.h>
 #endif
 
-#define STMT_INCREMENT 16  /* how many statement holders to allocate at a time */
+#define STMT_INCREMENT 16		/* how many statement holders to allocate
+								 * at a time */
 
 #define PRN_NULLCHECK
 
 extern GLOBAL_VALUES globals;
 
 
-RETCODE SQL_API SQLAllocConnect(
-                                HENV     henv,
-                                HDBC FAR *phdbc)
+RETCODE SQL_API
+SQLAllocConnect(
+				HENV henv,
+				HDBC FAR *phdbc)
 {
-EnvironmentClass *env = (EnvironmentClass *)henv;
-ConnectionClass *conn;
-static char *func="SQLAllocConnect";
+	EnvironmentClass *env = (EnvironmentClass *) henv;
+	ConnectionClass *conn;
+	static char *func = "SQLAllocConnect";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
 	conn = CC_Constructor();
 	mylog("**** %s: henv = %u, conn = %u\n", func, henv, conn);
 
-    if( ! conn) {
-        env->errormsg = "Couldn't allocate memory for Connection object.";
-        env->errornumber = ENV_ALLOC_ERROR;
+	if (!conn)
+	{
+		env->errormsg = "Couldn't allocate memory for Connection object.";
+		env->errornumber = ENV_ALLOC_ERROR;
 		*phdbc = SQL_NULL_HDBC;
 		EN_log_error(func, "", env);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    if ( ! EN_add_connection(env, conn)) {
-        env->errormsg = "Maximum number of connections exceeded.";
-        env->errornumber = ENV_ALLOC_ERROR;
-        CC_Destructor(conn);
+	if (!EN_add_connection(env, conn))
+	{
+		env->errormsg = "Maximum number of connections exceeded.";
+		env->errornumber = ENV_ALLOC_ERROR;
+		CC_Destructor(conn);
 		*phdbc = SQL_NULL_HDBC;
 		EN_log_error(func, "", env);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	*phdbc = (HDBC) conn;
 
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLConnect(
-                           HDBC      hdbc,
-                           UCHAR FAR *szDSN,
-                           SWORD     cbDSN,
-                           UCHAR FAR *szUID,
-                           SWORD     cbUID,
-                           UCHAR FAR *szAuthStr,
-                           SWORD     cbAuthStr)
+RETCODE SQL_API
+SQLConnect(
+		   HDBC hdbc,
+		   UCHAR FAR *szDSN,
+		   SWORD cbDSN,
+		   UCHAR FAR *szUID,
+		   SWORD cbUID,
+		   UCHAR FAR *szAuthStr,
+		   SWORD cbAuthStr)
 {
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-ConnInfo *ci;
-static char *func = "SQLConnect";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	ConnInfo   *ci;
+	static char *func = "SQLConnect";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if ( ! conn) {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -106,14 +112,15 @@ static char *func = "SQLConnect";
 
 	make_string(szDSN, cbDSN, ci->dsn);
 
-	/*	get the values for the DSN from the registry */
+	/* get the values for the DSN from the registry */
 	getDSNinfo(ci, CONN_OVERWRITE);
-	/*	initialize pg_version from connInfo.protocol	*/
-	CC_initialize_pg_version(conn); 
-	
-	/*	override values from DSN info with UID and authStr(pwd) 
-		This only occurs if the values are actually there.
-	*/
+	/* initialize pg_version from connInfo.protocol    */
+	CC_initialize_pg_version(conn);
+
+	/*
+	 * override values from DSN info with UID and authStr(pwd) This only
+	 * occurs if the values are actually there.
+	 */
 	make_string(szUID, cbUID, ci->username);
 	make_string(szAuthStr, cbAuthStr, ci->password);
 
@@ -122,54 +129,59 @@ static char *func = "SQLConnect";
 
 	qlog("conn = %u, %s(DSN='%s', UID='%s', PWD='%s')\n", conn, func, ci->dsn, ci->username, ci->password);
 
-	if ( CC_connect(conn, FALSE) <= 0) {
-		/*	Error messages are filled in */
+	if (CC_connect(conn, FALSE) <= 0)
+	{
+		/* Error messages are filled in */
 		CC_log_error(func, "Error on CC_connect", conn);
 		return SQL_ERROR;
 	}
 
-	mylog( "%s: returning...\n", func);
+	mylog("%s: returning...\n", func);
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLBrowseConnect(
-        HDBC      hdbc,
-        UCHAR FAR *szConnStrIn,
-        SWORD     cbConnStrIn,
-        UCHAR FAR *szConnStrOut,
-        SWORD     cbConnStrOutMax,
-        SWORD FAR *pcbConnStrOut)
+RETCODE SQL_API
+SQLBrowseConnect(
+				 HDBC hdbc,
+				 UCHAR FAR *szConnStrIn,
+				 SWORD cbConnStrIn,
+				 UCHAR FAR *szConnStrOut,
+				 SWORD cbConnStrOutMax,
+				 SWORD FAR *pcbConnStrOut)
 {
-static char *func="SQLBrowseConnect";
+	static char *func = "SQLBrowseConnect";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
 /* Drop any hstmts open on hdbc and disconnect from database */
-RETCODE SQL_API SQLDisconnect(
-        HDBC      hdbc)
+RETCODE SQL_API
+SQLDisconnect(
+			  HDBC hdbc)
 {
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-static char *func = "SQLDisconnect";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	static char *func = "SQLDisconnect";
 
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if ( ! conn) {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	qlog("conn=%u, %s\n", conn, func);
 
-	if (conn->status == CONN_EXECUTING) {
+	if (conn->status == CONN_EXECUTING)
+	{
 		conn->errornumber = CONN_IN_USE;
 		conn->errormsg = "A transaction is currently being executed";
 		CC_log_error(func, "", conn);
@@ -178,7 +190,7 @@ static char *func = "SQLDisconnect";
 
 	mylog("%s: about to CC_cleanup\n", func);
 
-	/*  Close the connection and free statements */
+	/* Close the connection and free statements */
 	CC_cleanup(conn);
 
 	mylog("%s: done CC_cleanup\n", func);
@@ -188,24 +200,27 @@ static char *func = "SQLDisconnect";
 }
 
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLFreeConnect(
-        HDBC      hdbc)
+RETCODE SQL_API
+SQLFreeConnect(
+			   HDBC hdbc)
 {
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-static char *func = "SQLFreeConnect";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	static char *func = "SQLFreeConnect";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 	mylog("**** in %s: hdbc=%u\n", func, hdbc);
 
-	if ( ! conn) {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*  Remove the connection from the environment */
-	if ( ! EN_remove_connection(conn->henv, conn)) {
+	/* Remove the connection from the environment */
+	if (!EN_remove_connection(conn->henv, conn))
+	{
 		conn->errornumber = CONN_IN_USE;
 		conn->errormsg = "A transaction is currently being executed";
 		CC_log_error(func, "", conn);
@@ -222,35 +237,37 @@ static char *func = "SQLFreeConnect";
 
 /*
 *
-*       IMPLEMENTATION CONNECTION CLASS
+*		IMPLEMENTATION CONNECTION CLASS
 *
 */
 
-ConnectionClass *CC_Constructor()
+ConnectionClass *
+CC_Constructor()
 {
-ConnectionClass *rv;
+	ConnectionClass *rv;
 
-    rv = (ConnectionClass *)malloc(sizeof(ConnectionClass));
+	rv = (ConnectionClass *) malloc(sizeof(ConnectionClass));
 
-    if (rv != NULL) {
+	if (rv != NULL)
+	{
 
-		rv->henv = NULL; /* not yet associated with an environment */
+		rv->henv = NULL;		/* not yet associated with an environment */
 
-        rv->errormsg = NULL;
-        rv->errornumber = 0;
+		rv->errormsg = NULL;
+		rv->errornumber = 0;
 		rv->errormsg_created = FALSE;
 
-        rv->status = CONN_NOT_CONNECTED;
-        rv->transact_status = CONN_IN_AUTOCOMMIT; /* autocommit by default */
+		rv->status = CONN_NOT_CONNECTED;
+		rv->transact_status = CONN_IN_AUTOCOMMIT;		/* autocommit by default */
 
 		memset(&rv->connInfo, 0, sizeof(ConnInfo));
 
 		rv->sock = SOCK_Constructor();
-		if ( ! rv->sock)
+		if (!rv->sock)
 			return NULL;
 
-		rv->stmts = (StatementClass **) malloc( sizeof(StatementClass *) * STMT_INCREMENT);
-		if ( ! rv->stmts)
+		rv->stmts = (StatementClass **) malloc(sizeof(StatementClass *) * STMT_INCREMENT);
+		if (!rv->stmts)
 			return NULL;
 		memset(rv->stmts, 0, sizeof(StatementClass *) * STMT_INCREMENT);
 
@@ -271,14 +288,14 @@ ConnectionClass *rv;
 		rv->pg_version_minor = 0;
 
 
-		/*	Initialize statement options to defaults */
-		/*	Statements under this conn will inherit these options */
+		/* Initialize statement options to defaults */
+		/* Statements under this conn will inherit these options */
 
 		InitializeStatementOptions(&rv->stmtOptions);
 
 
-    } 
-    return rv;
+	}
+	return rv;
 }
 
 
@@ -291,22 +308,27 @@ CC_Destructor(ConnectionClass *self)
 	if (self->status == CONN_EXECUTING)
 		return 0;
 
-	CC_cleanup(self);   /* cleanup socket and statements */
+	CC_cleanup(self);			/* cleanup socket and statements */
 
 	mylog("after CC_Cleanup\n");
 
-	/*  Free up statement holders */
-	if (self->stmts) {
+	/* Free up statement holders */
+	if (self->stmts)
+	{
 		free(self->stmts);
 		self->stmts = NULL;
 	}
 	mylog("after free statement holders\n");
 
-	/*	Free cached table info */
-	if (self->col_info) {
-		int i;
-		for (i = 0; i < self->ntables; i++) {
-			if (self->col_info[i]->result)		/*	Free the SQLColumns result structure */
+	/* Free cached table info */
+	if (self->col_info)
+	{
+		int			i;
+
+		for (i = 0; i < self->ntables; i++)
+		{
+			if (self->col_info[i]->result)		/* Free the SQLColumns
+												 * result structure */
 				QR_Destructor(self->col_info[i]->result);
 
 			free(self->col_info[i]);
@@ -326,12 +348,14 @@ CC_Destructor(ConnectionClass *self)
 int
 CC_cursor_count(ConnectionClass *self)
 {
-StatementClass *stmt;
-int i, count = 0;
+	StatementClass *stmt;
+	int			i,
+				count = 0;
 
 	mylog("CC_cursor_count: self=%u, num_stmts=%d\n", self, self->num_stmts);
 
-	for (i = 0; i < self->num_stmts; i++) {
+	for (i = 0; i < self->num_stmts; i++)
+	{
 		stmt = self->stmts[i];
 		if (stmt && stmt->result && stmt->result->cursor)
 			count++;
@@ -342,11 +366,11 @@ int i, count = 0;
 	return count;
 }
 
-void 
+void
 CC_clear_error(ConnectionClass *self)
 {
-	self->errornumber = 0; 
-	self->errormsg = NULL; 
+	self->errornumber = 0;
+	self->errormsg = NULL;
 	self->errormsg_created = FALSE;
 }
 
@@ -355,9 +379,10 @@ CC_clear_error(ConnectionClass *self)
 char
 CC_abort(ConnectionClass *self)
 {
-QResultClass *res;
+	QResultClass *res;
 
-	if ( CC_is_in_trans(self)) {
+	if (CC_is_in_trans(self))
+	{
 		res = NULL;
 
 		mylog("CC_abort:  sending ABORT!\n");
@@ -379,8 +404,8 @@ QResultClass *res;
 char
 CC_cleanup(ConnectionClass *self)
 {
-int i;
-StatementClass *stmt;
+	int			i;
+	StatementClass *stmt;
 
 	if (self->status == CONN_EXECUTING)
 		return FALSE;
@@ -395,18 +420,21 @@ StatementClass *stmt;
 
 	mylog("after CC_abort\n");
 
-	/*  This actually closes the connection to the dbase */
-	if (self->sock) {
-	    SOCK_Destructor(self->sock);
+	/* This actually closes the connection to the dbase */
+	if (self->sock)
+	{
+		SOCK_Destructor(self->sock);
 		self->sock = NULL;
 	}
 
 	mylog("after SOCK destructor\n");
 
-	/*  Free all the stmts on this connection */
-	for (i = 0; i < self->num_stmts; i++) {
+	/* Free all the stmts on this connection */
+	for (i = 0; i < self->num_stmts; i++)
+	{
 		stmt = self->stmts[i];
-		if (stmt) {
+		if (stmt)
+		{
 
 			stmt->hdbc = NULL;	/* prevent any more dbase interactions */
 
@@ -416,10 +444,11 @@ StatementClass *stmt;
 		}
 	}
 
-	/*	Check for translation dll */
+	/* Check for translation dll */
 #ifdef WIN32
-	if ( self->translation_handle) {
-		FreeLibrary (self->translation_handle);
+	if (self->translation_handle)
+	{
+		FreeLibrary(self->translation_handle);
 		self->translation_handle = NULL;
 	}
 #endif
@@ -429,37 +458,40 @@ StatementClass *stmt;
 }
 
 int
-CC_set_translation (ConnectionClass *self)
+CC_set_translation(ConnectionClass *self)
 {
 
 #ifdef WIN32
 
-	if (self->translation_handle != NULL) {
-		FreeLibrary (self->translation_handle);
+	if (self->translation_handle != NULL)
+	{
+		FreeLibrary(self->translation_handle);
 		self->translation_handle = NULL;
 	}
 
 	if (self->connInfo.translation_dll[0] == 0)
 		return TRUE;
 
-	self->translation_option = atoi (self->connInfo.translation_option);
-	self->translation_handle = LoadLibrary (self->connInfo.translation_dll);
+	self->translation_option = atoi(self->connInfo.translation_option);
+	self->translation_handle = LoadLibrary(self->connInfo.translation_dll);
 
-	if (self->translation_handle == NULL) {
+	if (self->translation_handle == NULL)
+	{
 		self->errornumber = CONN_UNABLE_TO_LOAD_DLL;
 		self->errormsg = "Could not load the translation DLL.";
 		return FALSE;
 	}
 
 	self->DataSourceToDriver
-	 = (DataSourceToDriverProc) GetProcAddress (self->translation_handle,
+		= (DataSourceToDriverProc) GetProcAddress(self->translation_handle,
 												"SQLDataSourceToDriver");
 
 	self->DriverToDataSource
-	 = (DriverToDataSourceProc) GetProcAddress (self->translation_handle,
+		= (DriverToDataSourceProc) GetProcAddress(self->translation_handle,
 												"SQLDriverToDataSource");
 
-	if (self->DataSourceToDriver == NULL || self->DriverToDataSource == NULL) {
+	if (self->DataSourceToDriver == NULL || self->DriverToDataSource == NULL)
+	{
 		self->errornumber = CONN_UNABLE_TO_LOAD_DLL;
 		self->errormsg = "Could not find translation DLL functions.";
 		return FALSE;
@@ -468,64 +500,67 @@ CC_set_translation (ConnectionClass *self)
 	return TRUE;
 }
 
-char 
+char
 CC_connect(ConnectionClass *self, char do_password)
 {
-StartupPacket sp;
-StartupPacket6_2 sp62;
-QResultClass *res;
-SocketClass *sock;
-ConnInfo *ci = &(self->connInfo);
-int areq = -1;
-int beresp;
-char msgbuffer[ERROR_MSG_LENGTH]; 
-char salt[2];
-static char *func="CC_connect";
+	StartupPacket sp;
+	StartupPacket6_2 sp62;
+	QResultClass *res;
+	SocketClass *sock;
+	ConnInfo   *ci = &(self->connInfo);
+	int			areq = -1;
+	int			beresp;
+	char		msgbuffer[ERROR_MSG_LENGTH];
+	char		salt[2];
+	static char *func = "CC_connect";
 
 	mylog("%s: entering...\n", func);
 
-	if ( do_password)
+	if (do_password)
 
 		sock = self->sock;		/* already connected, just authenticate */
 
-	else {
+	else
+	{
 
 		qlog("Global Options: Version='%s', fetch=%d, socket=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n",
-			POSTGRESDRIVERVERSION,
-			globals.fetch_max, 
-			globals.socket_buffersize, 
-			globals.unknown_sizes, 
-			globals.max_varchar_size, 
-			globals.max_longvarchar_size);
+			 POSTGRESDRIVERVERSION,
+			 globals.fetch_max,
+			 globals.socket_buffersize,
+			 globals.unknown_sizes,
+			 globals.max_varchar_size,
+			 globals.max_longvarchar_size);
 		qlog("                disable_optimizer=%d, ksqo=%d, unique_index=%d, use_declarefetch=%d\n",
-			globals.disable_optimizer,
-			globals.ksqo,
-			globals.unique_index,
-			globals.use_declarefetch);
+			 globals.disable_optimizer,
+			 globals.ksqo,
+			 globals.unique_index,
+			 globals.use_declarefetch);
 		qlog("                text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d\n",
-			globals.text_as_longvarchar, 
-			globals.unknowns_as_longvarchar, 
-			globals.bools_as_char);
+			 globals.text_as_longvarchar,
+			 globals.unknowns_as_longvarchar,
+			 globals.bools_as_char);
 
 #ifdef MULTIBYTE
 		check_client_encoding(globals.conn_settings);
 		qlog("                extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
-			globals.extra_systable_prefixes,
-			globals.conn_settings,
-			check_client_encoding(globals.conn_settings));
+			 globals.extra_systable_prefixes,
+			 globals.conn_settings,
+			 check_client_encoding(globals.conn_settings));
 #else
 		qlog("                extra_systable_prefixes='%s', conn_settings='%s'\n",
-			globals.extra_systable_prefixes, 
-			globals.conn_settings);
+			 globals.extra_systable_prefixes,
+			 globals.conn_settings);
 #endif
 
-		if (self->status != CONN_NOT_CONNECTED) {
+		if (self->status != CONN_NOT_CONNECTED)
+		{
 			self->errormsg = "Already connected.";
 			self->errornumber = CONN_OPENDB_ERROR;
 			return 0;
 		}
 
-		if ( ci->server[0] == '\0' || ci->port[0] == '\0' || ci->database[0] == '\0') {
+		if (ci->server[0] == '\0' || ci->port[0] == '\0' || ci->database[0] == '\0')
+		{
 			self->errornumber = CONN_INIREAD_ERROR;
 			self->errormsg = "Missing server name, port, or database name in call to CC_connect.";
 			return 0;
@@ -533,15 +568,18 @@ static char *func="CC_connect";
 
 		mylog("CC_connect(): DSN = '%s', server = '%s', port = '%s', database = '%s', username = '%s', password='%s'\n", ci->dsn, ci->server, ci->port, ci->database, ci->username, ci->password);
 
-		/* If the socket was closed for some reason (like a SQLDisconnect, but no SQLFreeConnect
-			then create a socket now.
-		*/
-		if ( ! self->sock) {
+		/*
+		 * If the socket was closed for some reason (like a SQLDisconnect,
+		 * but no SQLFreeConnect then create a socket now.
+		 */
+		if (!self->sock)
+		{
 			self->sock = SOCK_Constructor();
-			if ( ! self->sock) {
-				 self->errornumber = CONNECTION_SERVER_NOT_REACHED;
-				 self->errormsg = "Could not open a socket to the server";
-				 return 0;
+			if (!self->sock)
+			{
+				self->errornumber = CONNECTION_SERVER_NOT_REACHED;
+				self->errormsg = "Could not open a socket to the server";
+				return 0;
 			}
 		}
 
@@ -550,7 +588,8 @@ static char *func="CC_connect";
 		mylog("connecting to the server socket...\n");
 
 		SOCK_connect_to(sock, (short) atoi(ci->port), ci->server);
-		if (SOCK_get_errcode(sock) != 0) {
+		if (SOCK_get_errcode(sock) != 0)
+		{
 			mylog("connection to the server socket failed.\n");
 			self->errornumber = CONNECTION_SERVER_NOT_REACHED;
 			self->errormsg = "Could not connect to the server";
@@ -558,26 +597,29 @@ static char *func="CC_connect";
 		}
 		mylog("connection to the server socket succeeded.\n");
 
-		if ( PROTOCOL_62(ci)) {
-			sock->reverse = TRUE;		/* make put_int and get_int work for 6.2 */
+		if (PROTOCOL_62(ci))
+		{
+			sock->reverse = TRUE;		/* make put_int and get_int work
+										 * for 6.2 */
 
 			memset(&sp62, 0, sizeof(StartupPacket6_2));
-			SOCK_put_int(sock, htonl(4+sizeof(StartupPacket6_2)), 4);
+			SOCK_put_int(sock, htonl(4 + sizeof(StartupPacket6_2)), 4);
 			sp62.authtype = htonl(NO_AUTHENTICATION);
 			strncpy(sp62.database, ci->database, PATH_SIZE);
 			strncpy(sp62.user, ci->username, NAMEDATALEN);
 			SOCK_put_n_char(sock, (char *) &sp62, sizeof(StartupPacket6_2));
 			SOCK_flush_output(sock);
 		}
-		else {
+		else
+		{
 			memset(&sp, 0, sizeof(StartupPacket));
 
 			mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
 
 			/* Send length of Authentication Block */
-			SOCK_put_int(sock, 4+sizeof(StartupPacket), 4); 
+			SOCK_put_int(sock, 4 + sizeof(StartupPacket), 4);
 
-			if ( PROTOCOL_63(ci))
+			if (PROTOCOL_63(ci))
 				sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_63);
 			else
 				sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST);
@@ -591,7 +633,8 @@ static char *func="CC_connect";
 
 		mylog("sent the authentication block.\n");
 
-		if (sock->errornumber != 0) {
+		if (sock->errornumber != 0)
+		{
 			mylog("couldn't send the authentication block properly.\n");
 			self->errornumber = CONN_INVALID_AUTHENTICATION;
 			self->errormsg = "Sending the authentication packet failed";
@@ -605,101 +648,109 @@ static char *func="CC_connect";
 
 
 	/* *************************************************** */
-	/*	Now get the authentication request from backend */
+	/* Now get the authentication request from backend */
 	/* *************************************************** */
 
-	if ( ! PROTOCOL_62(ci))	do {
-
-		if (do_password)
-			beresp = 'R';
-		else
-			beresp = SOCK_get_char(sock);
-
-		switch(beresp) {
-		case 'E':
-			mylog("auth got 'E'\n");
-
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			self->errornumber = CONN_INVALID_AUTHENTICATION;
-			self->errormsg = msgbuffer;
-			qlog("ERROR from backend during authentication: '%s'\n", self->errormsg);
-			return 0;
-		case 'R':
-
-			if (do_password) {
-				mylog("in 'R' do_password\n");
-				areq = AUTH_REQ_PASSWORD;
-				do_password = FALSE;
-			}
-			else {
-				mylog("auth got 'R'\n");
-
-				areq = SOCK_get_int(sock, 4);
-				if (areq == AUTH_REQ_CRYPT)
-					SOCK_get_n_char(sock, salt, 2);
+	if (!PROTOCOL_62(ci))
+		do
+		{
 
-				mylog("areq = %d\n", areq);
-			}
-			switch(areq) {
-			case AUTH_REQ_OK:
-				break;
-
-			case AUTH_REQ_KRB4:
-				self->errormsg = "Kerberos 4 authentication not supported";
-				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-				return 0;
-
-			case AUTH_REQ_KRB5:
-				self->errormsg = "Kerberos 5 authentication not supported";
-				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-				return 0;
-
-			case AUTH_REQ_PASSWORD:
-				mylog("in AUTH_REQ_PASSWORD\n");
-
-				if (ci->password[0] == '\0') {
-					self->errornumber = CONNECTION_NEED_PASSWORD;
-					self->errormsg = "A password is required for this connection.";
-					return -1;	/* need password */
-				}
-
-				mylog("past need password\n");
-
-				SOCK_put_int(sock, 4+strlen(ci->password)+1, 4);
-				SOCK_put_n_char(sock, ci->password, strlen(ci->password) + 1);
-				SOCK_flush_output(sock);
-
-				mylog("past flush\n");
-				break;
+			if (do_password)
+				beresp = 'R';
+			else
+				beresp = SOCK_get_char(sock);
+
+			switch (beresp)
+			{
+				case 'E':
+					mylog("auth got 'E'\n");
+
+					SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+					self->errornumber = CONN_INVALID_AUTHENTICATION;
+					self->errormsg = msgbuffer;
+					qlog("ERROR from backend during authentication: '%s'\n", self->errormsg);
+					return 0;
+				case 'R':
+
+					if (do_password)
+					{
+						mylog("in 'R' do_password\n");
+						areq = AUTH_REQ_PASSWORD;
+						do_password = FALSE;
+					}
+					else
+					{
+						mylog("auth got 'R'\n");
 
-			case AUTH_REQ_CRYPT:
-				self->errormsg = "Password crypt authentication not supported";
-				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-				return 0;
+						areq = SOCK_get_int(sock, 4);
+						if (areq == AUTH_REQ_CRYPT)
+							SOCK_get_n_char(sock, salt, 2);
 
-			default:
-				self->errormsg = "Unknown authentication type";
-				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-				return 0;
+						mylog("areq = %d\n", areq);
+					}
+					switch (areq)
+					{
+						case AUTH_REQ_OK:
+							break;
+
+						case AUTH_REQ_KRB4:
+							self->errormsg = "Kerberos 4 authentication not supported";
+							self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+							return 0;
+
+						case AUTH_REQ_KRB5:
+							self->errormsg = "Kerberos 5 authentication not supported";
+							self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+							return 0;
+
+						case AUTH_REQ_PASSWORD:
+							mylog("in AUTH_REQ_PASSWORD\n");
+
+							if (ci->password[0] == '\0')
+							{
+								self->errornumber = CONNECTION_NEED_PASSWORD;
+								self->errormsg = "A password is required for this connection.";
+								return -1;		/* need password */
+							}
+
+							mylog("past need password\n");
+
+							SOCK_put_int(sock, 4 + strlen(ci->password) + 1, 4);
+							SOCK_put_n_char(sock, ci->password, strlen(ci->password) + 1);
+							SOCK_flush_output(sock);
+
+							mylog("past flush\n");
+							break;
+
+						case AUTH_REQ_CRYPT:
+							self->errormsg = "Password crypt authentication not supported";
+							self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+							return 0;
+
+						default:
+							self->errormsg = "Unknown authentication type";
+							self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+							return 0;
+					}
+					break;
+				default:
+					self->errormsg = "Unexpected protocol character during authentication";
+					self->errornumber = CONN_INVALID_AUTHENTICATION;
+					return 0;
 			}
-			break;
-		default:
-			self->errormsg = "Unexpected protocol character during authentication";
-			self->errornumber = CONN_INVALID_AUTHENTICATION;
-			return 0;
-		}
 
-	} while (areq != AUTH_REQ_OK);		
+		} while (areq != AUTH_REQ_OK);
 
 
-	CC_clear_error(self);	/* clear any password error */
+	CC_clear_error(self);		/* clear any password error */
 
 	/* send an empty query in order to find out whether the specified */
 	/* database really exists on the server machine */
 	mylog("sending an empty query...\n");
 
 	res = CC_send_query(self, " ", NULL);
-	if ( res == NULL || QR_get_status(res) != PGRES_EMPTY_QUERY) {
+	if (res == NULL || QR_get_status(res) != PGRES_EMPTY_QUERY)
+	{
 		mylog("got no result from the empty query.  (probably database does not exist)\n");
 		self->errornumber = CONNECTION_NO_SUCH_DATABASE;
 		self->errormsg = "The database does not exist on the server\nor user authentication failed.";
@@ -712,21 +763,25 @@ static char *func="CC_connect";
 
 	mylog("empty query seems to be OK.\n");
 
-	CC_set_translation (self);
+	CC_set_translation(self);
 
 	/**********************************************/
 	/*******   Send any initial settings  *********/
 	/**********************************************/
 
-	/*	Since these functions allocate statements, and since the connection is not
-		established yet, it would violate odbc state transition rules.  Therefore,
-		these functions call the corresponding local function instead.
-	*/
+	/*
+	 * Since these functions allocate statements, and since the connection
+	 * is not established yet, it would violate odbc state transition
+	 * rules.  Therefore, these functions call the corresponding local
+	 * function instead.
+	 */
 	CC_send_settings(self);
-	CC_lookup_lo(self);		/* a hack to get the oid of our large object oid type */
-	CC_lookup_pg_version(self);	/* Get PostgreSQL version for SQLGetInfo use */
+	CC_lookup_lo(self);			/* a hack to get the oid of our large
+								 * object oid type */
+	CC_lookup_pg_version(self); /* Get PostgreSQL version for SQLGetInfo
+								 * use */
 
-	CC_clear_error(self);	/* clear any initial command errors */
+	CC_clear_error(self);		/* clear any initial command errors */
 	self->status = CONN_CONNECTED;
 
 	mylog("%s: returning...\n", func);
@@ -738,12 +793,14 @@ static char *func="CC_connect";
 char
 CC_add_statement(ConnectionClass *self, StatementClass *stmt)
 {
-int i;
+	int			i;
 
 	mylog("CC_add_statement: self=%u, stmt=%u\n", self, stmt);
 
-	for (i = 0; i < self->num_stmts; i++) {
-		if ( ! self->stmts[i]) {
+	for (i = 0; i < self->num_stmts; i++)
+	{
+		if (!self->stmts[i])
+		{
 			stmt->hdbc = self;
 			self->stmts[i] = stmt;
 			return TRUE;
@@ -751,8 +808,8 @@ int i;
 	}
 
 	/* no more room -- allocate more memory */
-	self->stmts = (StatementClass **) realloc( self->stmts, sizeof(StatementClass *) * (STMT_INCREMENT + self->num_stmts));
-	if ( ! self->stmts)
+	self->stmts = (StatementClass **) realloc(self->stmts, sizeof(StatementClass *) * (STMT_INCREMENT + self->num_stmts));
+	if (!self->stmts)
 		return FALSE;
 
 	memset(&self->stmts[self->num_stmts], 0, sizeof(StatementClass *) * STMT_INCREMENT);
@@ -765,13 +822,15 @@ int i;
 	return TRUE;
 }
 
-char 
+char
 CC_remove_statement(ConnectionClass *self, StatementClass *stmt)
 {
-int i;
+	int			i;
 
-	for (i = 0; i < self->num_stmts; i++) {
-		if (self->stmts[i] == stmt && stmt->status != STMT_EXECUTING) {
+	for (i = 0; i < self->num_stmts; i++)
+	{
+		if (self->stmts[i] == stmt && stmt->status != STMT_EXECUTING)
+		{
 			self->stmts[i] = NULL;
 			return TRUE;
 		}
@@ -786,9 +845,9 @@ int i;
 char *
 CC_create_errormsg(ConnectionClass *self)
 {
-SocketClass *sock = self->sock;
-int pos;
-static char msg[4096];
+	SocketClass *sock = self->sock;
+	int			pos;
+	static char msg[4096];
 
 	mylog("enter CC_create_errormsg\n");
 
@@ -799,7 +858,8 @@ static char msg[4096];
 
 	mylog("msg = '%s'\n", msg);
 
-	if (sock && sock->errormsg && sock->errormsg[0] != '\0') {
+	if (sock && sock->errormsg && sock->errormsg[0] != '\0')
+	{
 		pos = strlen(msg);
 		sprintf(&msg[pos], ";\n%s", sock->errormsg);
 	}
@@ -809,20 +869,22 @@ static char msg[4096];
 }
 
 
-char 
+char
 CC_get_error(ConnectionClass *self, int *number, char **message)
 {
-int rv;
+	int			rv;
 
 	mylog("enter CC_get_error\n");
 
-	/*	Create a very informative errormsg if it hasn't been done yet. */
-	if ( ! self->errormsg_created) {
+	/* Create a very informative errormsg if it hasn't been done yet. */
+	if (!self->errormsg_created)
+	{
 		self->errormsg = CC_create_errormsg(self);
 		self->errormsg_created = TRUE;
 	}
 
-	if (self->errornumber) {
+	if (self->errornumber)
+	{
 		*number = self->errornumber;
 		*message = self->errormsg;
 	}
@@ -841,25 +903,29 @@ int rv;
 	needs to be re-filled).
 
 	The "cursor" is used by SQLExecute to associate a statement handle as the cursor name
-	(i.e., C3326857) for SQL select statements.  This cursor is then used in future 
+	(i.e., C3326857) for SQL select statements.  This cursor is then used in future
 	'declare cursor C3326857 for ...' and 'fetch 100 in C3326857' statements.
 */
 QResultClass *
 CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 {
-QResultClass *result_in, *res = NULL;
-char swallow;
-int id;
-SocketClass *sock = self->sock;
-static char msgbuffer[MAX_MESSAGE_LEN+1];
-char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont need static */
+	QResultClass *result_in,
+			   *res = NULL;
+	char		swallow;
+	int			id;
+	SocketClass *sock = self->sock;
+	static char msgbuffer[MAX_MESSAGE_LEN + 1];
+	char		cmdbuffer[MAX_MESSAGE_LEN + 1]; /* QR_set_command() dups
+												 * this string so dont
+												 * need static */
 
 
 	mylog("send_query(): conn=%u, query='%s'\n", self, query);
 	qlog("conn=%u, query='%s'\n", self, query);
 
 	/* Indicate that we are sending a query to the backend */
-	if(strlen(query) > MAX_MESSAGE_LEN-2) {
+	if (strlen(query) > MAX_MESSAGE_LEN - 2)
+	{
 		self->errornumber = CONNECTION_MSG_TOO_LONG;
 		self->errormsg = "Query string is too long";
 		return NULL;
@@ -868,7 +934,8 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 	if ((NULL == query) || (query[0] == '\0'))
 		return NULL;
 
-	if (SOCK_get_errcode(sock) != 0) {
+	if (SOCK_get_errcode(sock) != 0)
+	{
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -876,7 +943,8 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 	}
 
 	SOCK_put_char(sock, 'Q');
-	if (SOCK_get_errcode(sock) != 0) {
+	if (SOCK_get_errcode(sock) != 0)
+	{
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -886,7 +954,8 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 	SOCK_put_string(sock, query);
 	SOCK_flush_output(sock);
 
-	if (SOCK_get_errcode(sock) != 0) {
+	if (SOCK_get_errcode(sock) != 0)
+	{
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -895,11 +964,13 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 
 	mylog("send_query: done sending query\n");
 
-	while(1) {
+	while (1)
+	{
 		/* what type of message is coming now ? */
 		id = SOCK_get_char(sock);
 
-		if ((SOCK_get_errcode(sock) != 0) || (id == EOF)) {
+		if ((SOCK_get_errcode(sock) != 0) || (id == EOF))
+		{
 			self->errornumber = CONNECTION_NO_RESPONSE;
 			self->errormsg = "No response from the backend";
 			if (res)
@@ -912,199 +983,222 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 
 		mylog("send_query: got id = '%c'\n", id);
 
-		switch (id) {
-		case 'A' : /* Asynchronous Messages are ignored */
-			(void)SOCK_get_int(sock, 4); /* id of notification */
-			SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
-			/* name of the relation the message comes from */
-			break;
-		case 'C' : /* portal query command, no tuples returned */
-			/* read in the return message from the backend */
-			SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
-			if (SOCK_get_errcode(sock) != 0) {
-				self->errornumber = CONNECTION_NO_RESPONSE;
-				self->errormsg = "No response from backend while receiving a portal query command";
-				mylog("send_query: 'C' - %s\n", self->errormsg);
-				CC_set_no_trans(self);
-				return NULL;
-			} else {
-
-				char clear = 0;
-
-				mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
-
-				if (res == NULL)	/* allow for "show" style notices */
-					res = QR_Constructor();
-
-				mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer);
-
-				/*	Only save the first command */
-				QR_set_status(res, PGRES_COMMAND_OK);
-				QR_set_command(res, cmdbuffer);
-
-				/* (Quotation from the original comments)
-					since backend may produce more than one result for some commands
-					we need to poll until clear
-					so we send an empty query, and keep reading out of the pipe
-					until an 'I' is received
-				*/
-
-
-				SOCK_put_string(sock, "Q ");
-				SOCK_flush_output(sock);
-
-				while( ! clear) {
-					id = SOCK_get_char(sock);
-					switch(id) {
-					case 'I':
-						(void) SOCK_get_char(sock);
-						clear = TRUE;
-						break;
-					case 'Z':
-						break;
-					case 'C':
-						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-						qlog("Command response: '%s'\n", cmdbuffer);
-						break;
-					case 'N':
-						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-						qlog("NOTICE from backend during clear: '%s'\n", cmdbuffer);
-						break;
-					case 'E':
-						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-						qlog("ERROR from backend during clear: '%s'\n", cmdbuffer);
-						/* We must report this type of error as well
-						   (practically for reference integrity violation
-						   error reporting, from PostgreSQL 7.0).
-						   (Zoltan Kovacs, 04/26/2000)
-						*/
-						self->errormsg = cmdbuffer;
-						if ( ! strncmp(self->errormsg, "FATAL", 5)) {
-						    self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
-						    CC_set_no_trans(self);
-						    }
-						else
-						    self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
-						QR_set_status(res, PGRES_NONFATAL_ERROR);
-						QR_set_aborted(res, TRUE);
-						break;
+		switch (id)
+		{
+			case 'A':			/* Asynchronous Messages are ignored */
+				(void) SOCK_get_int(sock, 4);	/* id of notification */
+				SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
+				/* name of the relation the message comes from */
+				break;
+			case 'C':			/* portal query command, no tuples
+								 * returned */
+				/* read in the return message from the backend */
+				SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
+				if (SOCK_get_errcode(sock) != 0)
+				{
+					self->errornumber = CONNECTION_NO_RESPONSE;
+					self->errormsg = "No response from backend while receiving a portal query command";
+					mylog("send_query: 'C' - %s\n", self->errormsg);
+					CC_set_no_trans(self);
+					return NULL;
+				}
+				else
+				{
+
+					char		clear = 0;
+
+					mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
+
+					if (res == NULL)	/* allow for "show" style notices */
+						res = QR_Constructor();
+
+					mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer);
+
+					/* Only save the first command */
+					QR_set_status(res, PGRES_COMMAND_OK);
+					QR_set_command(res, cmdbuffer);
+
+					/*
+					 * (Quotation from the original comments) since
+					 * backend may produce more than one result for some
+					 * commands we need to poll until clear so we send an
+					 * empty query, and keep reading out of the pipe until
+					 * an 'I' is received
+					 */
+
+
+					SOCK_put_string(sock, "Q ");
+					SOCK_flush_output(sock);
+
+					while (!clear)
+					{
+						id = SOCK_get_char(sock);
+						switch (id)
+						{
+							case 'I':
+								(void) SOCK_get_char(sock);
+								clear = TRUE;
+								break;
+							case 'Z':
+								break;
+							case 'C':
+								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+								qlog("Command response: '%s'\n", cmdbuffer);
+								break;
+							case 'N':
+								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+								qlog("NOTICE from backend during clear: '%s'\n", cmdbuffer);
+								break;
+							case 'E':
+								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+								qlog("ERROR from backend during clear: '%s'\n", cmdbuffer);
+
+								/*
+								 * We must report this type of error as
+								 * well (practically for reference
+								 * integrity violation error reporting,
+								 * from PostgreSQL 7.0). (Zoltan Kovacs,
+								 * 04/26/2000)
+								 */
+								self->errormsg = cmdbuffer;
+								if (!strncmp(self->errormsg, "FATAL", 5))
+								{
+									self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
+									CC_set_no_trans(self);
+								}
+								else
+									self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
+								QR_set_status(res, PGRES_NONFATAL_ERROR);
+								QR_set_aborted(res, TRUE);
+								break;
+						}
 					}
+
+					mylog("send_query: returning res = %u\n", res);
+					return res;
 				}
-				
-				mylog("send_query: returning res = %u\n", res);
-				return res;
-			}
-		case 'K':	/* Secret key (6.4 protocol) */
-			(void)SOCK_get_int(sock, 4); /* pid */
-			(void)SOCK_get_int(sock, 4); /* key */
+			case 'K':			/* Secret key (6.4 protocol) */
+				(void) SOCK_get_int(sock, 4);	/* pid */
+				(void) SOCK_get_int(sock, 4);	/* key */
 
-			break;
-		case 'Z':	/* Backend is ready for new query (6.4) */
-			break;
-		case 'N' : /* NOTICE: */
-			SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+				break;
+			case 'Z':			/* Backend is ready for new query (6.4) */
+				break;
+			case 'N':			/* NOTICE: */
+				SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
 
-			res = QR_Constructor();
-			QR_set_status(res, PGRES_NONFATAL_ERROR);
-			QR_set_notice(res, cmdbuffer);	/* will dup this string */
+				res = QR_Constructor();
+				QR_set_status(res, PGRES_NONFATAL_ERROR);
+				QR_set_notice(res, cmdbuffer);	/* will dup this string */
 
-			mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
-			qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
+				mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
+				qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
 
-			continue;		/* dont return a result -- continue reading */
+				continue;		/* dont return a result -- continue
+								 * reading */
 
-		case 'I' : /* The server sends an empty query */
+			case 'I':			/* The server sends an empty query */
 				/* There is a closing '\0' following the 'I', so we eat it */
-			swallow = SOCK_get_char(sock);
-			if ((swallow != '\0') || SOCK_get_errcode(sock) != 0) {
-				self->errornumber = CONNECTION_BACKEND_CRAZY;
-				self->errormsg = "Unexpected protocol character from backend (send_query - I)";
-				res = QR_Constructor();
-				QR_set_status(res, PGRES_FATAL_ERROR);
-				return res;
-			} else {
-				/* We return the empty query */
-				res = QR_Constructor();
-				QR_set_status(res, PGRES_EMPTY_QUERY);
-				return res;
-			}
-			break;
-		case 'E' : 
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				swallow = SOCK_get_char(sock);
+				if ((swallow != '\0') || SOCK_get_errcode(sock) != 0)
+				{
+					self->errornumber = CONNECTION_BACKEND_CRAZY;
+					self->errormsg = "Unexpected protocol character from backend (send_query - I)";
+					res = QR_Constructor();
+					QR_set_status(res, PGRES_FATAL_ERROR);
+					return res;
+				}
+				else
+				{
+					/* We return the empty query */
+					res = QR_Constructor();
+					QR_set_status(res, PGRES_EMPTY_QUERY);
+					return res;
+				}
+				break;
+			case 'E':
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
 
-			/*	Remove a newline */
-			if (msgbuffer[0] != '\0' && msgbuffer[strlen(msgbuffer)-1] == '\n')
-				msgbuffer[strlen(msgbuffer)-1] = '\0';
+				/* Remove a newline */
+				if (msgbuffer[0] != '\0' && msgbuffer[strlen(msgbuffer) - 1] == '\n')
+					msgbuffer[strlen(msgbuffer) - 1] = '\0';
 
-			self->errormsg = msgbuffer;
+				self->errormsg = msgbuffer;
 
-			mylog("send_query: 'E' - %s\n", self->errormsg);
-			qlog("ERROR from backend during send_query: '%s'\n", self->errormsg);
+				mylog("send_query: 'E' - %s\n", self->errormsg);
+				qlog("ERROR from backend during send_query: '%s'\n", self->errormsg);
 
-			/* We should report that an error occured. Zoltan */
-			res = QR_Constructor();
+				/* We should report that an error occured. Zoltan */
+				res = QR_Constructor();
 
-			if ( ! strncmp(self->errormsg, "FATAL", 5)) {
-				self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
-				CC_set_no_trans(self);
-				QR_set_status(res, PGRES_FATAL_ERROR);
-			}
-			else {
-				self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
-				QR_set_status(res, PGRES_NONFATAL_ERROR);
-			}
-			QR_set_aborted(res, TRUE);
-
-			return res; /* instead of NULL. Zoltan */
-
-		case 'P' : /* get the Portal name */
-			SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
-			break;
-		case 'T': /* Tuple results start here */
-			result_in = qi ? qi->result_in : NULL;
-
-			if ( result_in == NULL) {
-				result_in = QR_Constructor();
-				mylog("send_query: 'T' no result_in: res = %u\n", result_in);
-				if ( ! result_in) {
-					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-					self->errormsg = "Could not create result info in send_query.";
-					return NULL;
+				if (!strncmp(self->errormsg, "FATAL", 5))
+				{
+					self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
+					CC_set_no_trans(self);
+					QR_set_status(res, PGRES_FATAL_ERROR);
 				}
+				else
+				{
+					self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
+					QR_set_status(res, PGRES_NONFATAL_ERROR);
+				}
+				QR_set_aborted(res, TRUE);
 
-				if (qi)
-					QR_set_cache_size(result_in, qi->row_size);
+				return res;		/* instead of NULL. Zoltan */
 
-				if ( ! QR_fetch_tuples(result_in, self, qi ? qi->cursor : NULL)) {
-					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-					self->errormsg = QR_get_message(result_in);
-					return NULL;
+			case 'P':			/* get the Portal name */
+				SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
+				break;
+			case 'T':			/* Tuple results start here */
+				result_in = qi ? qi->result_in : NULL;
+
+				if (result_in == NULL)
+				{
+					result_in = QR_Constructor();
+					mylog("send_query: 'T' no result_in: res = %u\n", result_in);
+					if (!result_in)
+					{
+						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+						self->errormsg = "Could not create result info in send_query.";
+						return NULL;
+					}
+
+					if (qi)
+						QR_set_cache_size(result_in, qi->row_size);
+
+					if (!QR_fetch_tuples(result_in, self, qi ? qi->cursor : NULL))
+					{
+						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+						self->errormsg = QR_get_message(result_in);
+						return NULL;
+					}
 				}
-			}
-			else {  /* next fetch, so reuse an existing result */
-				if ( ! QR_fetch_tuples(result_in, NULL, NULL)) {
-					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-					self->errormsg = QR_get_message(result_in);
-					return NULL;
+				else
+				{				/* next fetch, so reuse an existing result */
+					if (!QR_fetch_tuples(result_in, NULL, NULL))
+					{
+						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+						self->errormsg = QR_get_message(result_in);
+						return NULL;
+					}
 				}
-			}
 
-			return result_in;
-		case 'D': /* Copy in command began successfully */
-			res = QR_Constructor();
-			QR_set_status(res, PGRES_COPY_IN);
-			return res;
-		case 'B': /* Copy out command began successfully */
-			res = QR_Constructor();
-			QR_set_status(res, PGRES_COPY_OUT);
-			return res;
-		default:
-			self->errornumber = CONNECTION_BACKEND_CRAZY;
-			self->errormsg = "Unexpected protocol character from backend (send_query)";
-			CC_set_no_trans(self);
+				return result_in;
+			case 'D':			/* Copy in command began successfully */
+				res = QR_Constructor();
+				QR_set_status(res, PGRES_COPY_IN);
+				return res;
+			case 'B':			/* Copy out command began successfully */
+				res = QR_Constructor();
+				QR_set_status(res, PGRES_COPY_OUT);
+				return res;
+			default:
+				self->errornumber = CONNECTION_BACKEND_CRAZY;
+				self->errormsg = "Unexpected protocol character from backend (send_query)";
+				CC_set_no_trans(self);
 
-			mylog("send_query: error - %s\n", self->errormsg);
-			return NULL;
+				mylog("send_query: error - %s\n", self->errormsg);
+				return NULL;
 		}
 	}
 }
@@ -1112,14 +1206,17 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont
 int
 CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *args, int nargs)
 {
-char id, c, done;
-SocketClass *sock = self->sock;
-static char msgbuffer[MAX_MESSAGE_LEN+1];
-int i;
+	char		id,
+				c,
+				done;
+	SocketClass *sock = self->sock;
+	static char msgbuffer[MAX_MESSAGE_LEN + 1];
+	int			i;
 
 	mylog("send_function(): conn=%u, fnid=%d, result_is_int=%d, nargs=%d\n", self, fnid, result_is_int, nargs);
 
-	if (SOCK_get_errcode(sock) != 0) {
+	if (SOCK_get_errcode(sock) != 0)
+	{
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send function to backend";
 		CC_set_no_trans(self);
@@ -1127,25 +1224,27 @@ int i;
 	}
 
 	SOCK_put_string(sock, "F ");
-	if (SOCK_get_errcode(sock) != 0) {
+	if (SOCK_get_errcode(sock) != 0)
+	{
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send function to backend";
 		CC_set_no_trans(self);
 		return FALSE;
 	}
 
-	SOCK_put_int(sock, fnid, 4); 
-	SOCK_put_int(sock, nargs, 4); 
+	SOCK_put_int(sock, fnid, 4);
+	SOCK_put_int(sock, nargs, 4);
 
 
 	mylog("send_function: done sending function\n");
 
-	for (i = 0; i < nargs; ++i) {
+	for (i = 0; i < nargs; ++i)
+	{
 
 		mylog("  arg[%d]: len = %d, isint = %d, integer = %d, ptr = %u\n", i, args[i].len, args[i].isint, args[i].u.integer, args[i].u.ptr);
 
 		SOCK_put_int(sock, args[i].len, 4);
-		if (args[i].isint) 
+		if (args[i].isint)
 			SOCK_put_int(sock, args[i].u.integer, 4);
 		else
 			SOCK_put_n_char(sock, (char *) args[i].u.ptr, args[i].len);
@@ -1159,92 +1258,97 @@ int i;
 	mylog("  after flush output\n");
 
 	done = FALSE;
-	while ( ! done) {
+	while (!done)
+	{
 		id = SOCK_get_char(sock);
 		mylog("   got id = %c\n", id);
 
-		switch(id) {
-		case 'V':
-			done = TRUE;
-			break;		/* ok */
+		switch (id)
+		{
+			case 'V':
+				done = TRUE;
+				break;			/* ok */
 
-		case 'N':
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			mylog("send_function(V): 'N' - %s\n", msgbuffer);
-			/*	continue reading */
-			break;
+			case 'N':
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				mylog("send_function(V): 'N' - %s\n", msgbuffer);
+				/* continue reading */
+				break;
 
-		case 'E':
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			self->errormsg = msgbuffer;
+			case 'E':
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				self->errormsg = msgbuffer;
 
-			mylog("send_function(V): 'E' - %s\n", self->errormsg);
-			qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
+				mylog("send_function(V): 'E' - %s\n", self->errormsg);
+				qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
 
-			return FALSE;
+				return FALSE;
 
-		case 'Z':
-			break;
+			case 'Z':
+				break;
 
-		default:
-			self->errornumber = CONNECTION_BACKEND_CRAZY;
-			self->errormsg = "Unexpected protocol character from backend (send_function, args)";
-			CC_set_no_trans(self);
+			default:
+				self->errornumber = CONNECTION_BACKEND_CRAZY;
+				self->errormsg = "Unexpected protocol character from backend (send_function, args)";
+				CC_set_no_trans(self);
 
-			mylog("send_function: error - %s\n", self->errormsg);
-			return FALSE;
+				mylog("send_function: error - %s\n", self->errormsg);
+				return FALSE;
 		}
 	}
 
 	id = SOCK_get_char(sock);
-	for (;;) {
-		switch (id) {
-		case 'G':	/* function returned properly */
-			mylog("  got G!\n");
+	for (;;)
+	{
+		switch (id)
+		{
+			case 'G':			/* function returned properly */
+				mylog("  got G!\n");
 
-			*actual_result_len = SOCK_get_int(sock, 4);
-			mylog("  actual_result_len = %d\n", *actual_result_len);
+				*actual_result_len = SOCK_get_int(sock, 4);
+				mylog("  actual_result_len = %d\n", *actual_result_len);
 
-			if (result_is_int)
-				*((int *) result_buf) = SOCK_get_int(sock, 4);
-			else
-				SOCK_get_n_char(sock, (char *) result_buf, *actual_result_len);
+				if (result_is_int)
+					*((int *) result_buf) = SOCK_get_int(sock, 4);
+				else
+					SOCK_get_n_char(sock, (char *) result_buf, *actual_result_len);
 
-			mylog("  after get result\n");
+				mylog("  after get result\n");
 
-			c = SOCK_get_char(sock);	/* get the last '0' */
+				c = SOCK_get_char(sock);		/* get the last '0' */
 
-			mylog("   after get 0\n");
+				mylog("   after get 0\n");
 
-			return TRUE;
+				return TRUE;
 
-		case 'E':
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			self->errormsg = msgbuffer;
+			case 'E':
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				self->errormsg = msgbuffer;
 
-			mylog("send_function(G): 'E' - %s\n", self->errormsg);
-			qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
+				mylog("send_function(G): 'E' - %s\n", self->errormsg);
+				qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
 
-			return FALSE;
+				return FALSE;
 
-		case 'N':
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			case 'N':
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
 
-			mylog("send_function(G): 'N' - %s\n", msgbuffer);
-			qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
+				mylog("send_function(G): 'N' - %s\n", msgbuffer);
+				qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
 
-			continue;		/* dont return a result -- continue reading */
+				continue;		/* dont return a result -- continue
+								 * reading */
 
-		case '0':	/* empty result */
-			return TRUE;
+			case '0':			/* empty result */
+				return TRUE;
 
-		default:
-			self->errornumber = CONNECTION_BACKEND_CRAZY;
-			self->errormsg = "Unexpected protocol character from backend (send_function, result)";
-			CC_set_no_trans(self);
+			default:
+				self->errornumber = CONNECTION_BACKEND_CRAZY;
+				self->errormsg = "Unexpected protocol character from backend (send_function, result)";
+				CC_set_no_trans(self);
 
-			mylog("send_function: error - %s\n", self->errormsg);
-			return FALSE;
+				mylog("send_function: error - %s\n", self->errormsg);
+				return FALSE;
 		}
 	}
 }
@@ -1253,65 +1357,70 @@ int i;
 char
 CC_send_settings(ConnectionClass *self)
 {
-  /* char ini_query[MAX_MESSAGE_LEN]; */
-ConnInfo *ci = &(self->connInfo);
+	/* char ini_query[MAX_MESSAGE_LEN]; */
+	ConnInfo   *ci = &(self->connInfo);
+
 /* QResultClass *res; */
-HSTMT hstmt;
-StatementClass *stmt;
-RETCODE result;
-char status = TRUE;
-char *cs, *ptr;
-static char *func="CC_send_settings";
+	HSTMT		hstmt;
+	StatementClass *stmt;
+	RETCODE		result;
+	char		status = TRUE;
+	char	   *cs,
+			   *ptr;
+	static char *func = "CC_send_settings";
 
 
 	mylog("%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state 
+/*	This function must use the local odbc API functions since the odbc state
 	has not transitioned to "connected" yet.
 */
 
-	result = SQLAllocStmt( self, &hstmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(self, &hstmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 		return FALSE;
-	}
 	stmt = (StatementClass *) hstmt;
 
-	stmt->internal = TRUE;	/* ensure no BEGIN/COMMIT/ABORT stuff */
+	stmt->internal = TRUE;		/* ensure no BEGIN/COMMIT/ABORT stuff */
 
-	/*	Set the Datestyle to the format the driver expects it to be in */
+	/* Set the Datestyle to the format the driver expects it to be in */
 	result = SQLExecDirect(hstmt, "set DateStyle to 'ISO'", SQL_NTS);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 		status = FALSE;
 
 	mylog("%s: result %d, status %d from set DateStyle\n", func, result, status);
 
-	/*	Disable genetic optimizer based on global flag */
-	if (globals.disable_optimizer) {
+	/* Disable genetic optimizer based on global flag */
+	if (globals.disable_optimizer)
+	{
 		result = SQLExecDirect(hstmt, "set geqo to 'OFF'", SQL_NTS);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 			status = FALSE;
 
 		mylog("%s: result %d, status %d from set geqo\n", func, result, status);
-	
+
 	}
 
-	/*	KSQO */
-	if (globals.ksqo) {
+	/* KSQO */
+	if (globals.ksqo)
+	{
 		result = SQLExecDirect(hstmt, "set ksqo to 'ON'", SQL_NTS);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 			status = FALSE;
 
 		mylog("%s: result %d, status %d from set ksqo\n", func, result, status);
-	
+
 	}
 
-	/*	Global settings */
-	if (globals.conn_settings[0] != '\0') {
+	/* Global settings */
+	if (globals.conn_settings[0] != '\0')
+	{
 		cs = strdup(globals.conn_settings);
 		ptr = strtok(cs, ";");
-		while (ptr) {
+		while (ptr)
+		{
 			result = SQLExecDirect(hstmt, ptr, SQL_NTS);
-			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 				status = FALSE;
 
 			mylog("%s: result %d, status %d from '%s'\n", func, result, status, ptr);
@@ -1321,14 +1430,16 @@ static char *func="CC_send_settings";
 
 		free(cs);
 	}
-	
-	/*	Per Datasource settings */
-	if (ci->conn_settings[0] != '\0') {
+
+	/* Per Datasource settings */
+	if (ci->conn_settings[0] != '\0')
+	{
 		cs = strdup(ci->conn_settings);
 		ptr = strtok(cs, ";");
-		while (ptr) {
+		while (ptr)
+		{
 			result = SQLExecDirect(hstmt, ptr, SQL_NTS);
-			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 				status = FALSE;
 
 			mylog("%s: result %d, status %d from '%s'\n", func, result, status, ptr);
@@ -1350,38 +1461,40 @@ static char *func="CC_send_settings";
 	will go away and the define 'PG_TYPE_LO' will be updated.
 */
 void
-CC_lookup_lo(ConnectionClass *self) 
+CC_lookup_lo(ConnectionClass *self)
 {
-HSTMT hstmt;
-StatementClass *stmt;
-RETCODE result;
-static char *func = "CC_lookup_lo";
+	HSTMT		hstmt;
+	StatementClass *stmt;
+	RETCODE		result;
+	static char *func = "CC_lookup_lo";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state 
+/*	This function must use the local odbc API functions since the odbc state
 	has not transitioned to "connected" yet.
 */
-	result = SQLAllocStmt( self, &hstmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(self, &hstmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 		return;
-	}
 	stmt = (StatementClass *) hstmt;
 
 	result = SQLExecDirect(hstmt, "select oid from pg_type where typname='" PG_TYPE_LO_NAME "'", SQL_NTS);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLFetch(hstmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLGetData(hstmt, 1, SQL_C_SLONG, &self->lobj_type, sizeof(self->lobj_type), NULL);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
@@ -1397,63 +1510,72 @@ static char *func = "CC_lookup_lo";
 	h-inoue 01-2-2001
 */
 void
-CC_initialize_pg_version(ConnectionClass *self) 
+CC_initialize_pg_version(ConnectionClass *self)
 {
-	strcpy(self->pg_version, self->connInfo.protocol); 
-	if (PROTOCOL_62(&self->connInfo)) {
+	strcpy(self->pg_version, self->connInfo.protocol);
+	if (PROTOCOL_62(&self->connInfo))
+	{
 		self->pg_version_number = (float) 6.2;
 		self->pg_version_major = 6;
 		self->pg_version_minor = 2;
-	} else if (PROTOCOL_63(&self->connInfo)) {
+	}
+	else if (PROTOCOL_63(&self->connInfo))
+	{
 		self->pg_version_number = (float) 6.3;
 		self->pg_version_major = 6;
 		self->pg_version_minor = 3;
-	} else {
+	}
+	else
+	{
 		self->pg_version_number = (float) 6.4;
 		self->pg_version_major = 6;
 		self->pg_version_minor = 4;
 	}
 }
+
 /*	This function gets the version of PostgreSQL that we're connected to.
-    This is used to return the correct info in SQLGetInfo
+	This is used to return the correct info in SQLGetInfo
 	DJP - 25-1-2001
 */
 void
-CC_lookup_pg_version(ConnectionClass *self) 
+CC_lookup_pg_version(ConnectionClass *self)
 {
-HSTMT hstmt;
-StatementClass *stmt;
-RETCODE result;
-char	szVersion[32];
-int	major, minor;
-static char *func = "CC_lookup_pg_version";
+	HSTMT		hstmt;
+	StatementClass *stmt;
+	RETCODE		result;
+	char		szVersion[32];
+	int			major,
+				minor;
+	static char *func = "CC_lookup_pg_version";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state 
+/*	This function must use the local odbc API functions since the odbc state
 	has not transitioned to "connected" yet.
 */
-	result = SQLAllocStmt( self, &hstmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(self, &hstmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 		return;
-	}
 	stmt = (StatementClass *) hstmt;
 
-	/*	get the server's version if possible	*/
+	/* get the server's version if possible	 */
 	result = SQLExecDirect(hstmt, "select version()", SQL_NTS);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLFetch(hstmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLGetData(hstmt, 1, SQL_C_CHAR, self->pg_version, MAX_INFO_STRING, NULL);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
@@ -1461,7 +1583,8 @@ static char *func = "CC_lookup_pg_version";
 	/* Extract the Major and Minor numbers from the string. */
 	/* This assumes the string starts 'Postgresql X.X' */
 	strcpy(szVersion, "0.0");
-	if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2) {
+	if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2)
+	{
 		sprintf(szVersion, "%d.%d", major, minor);
 		self->pg_version_major = major;
 		self->pg_version_minor = minor;
@@ -1483,23 +1606,25 @@ CC_log_error(char *func, char *desc, ConnectionClass *self)
 #define nullcheck(a) (a ? a : "(NULL)")
 #endif
 
-	if (self) {
-		qlog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck (self->errormsg));
-		mylog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck (self->errormsg));
+	if (self)
+	{
+		qlog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
+		mylog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
 		qlog("            ------------------------------------------------------------\n");
 		qlog("            henv=%u, conn=%u, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts);
 		qlog("            sock=%u, stmts=%u, lobj_type=%d\n", self->sock, self->stmts, self->lobj_type);
 
 		qlog("            ---------------- Socket Info -------------------------------\n");
-		if (self->sock) {
-		SocketClass *sock = self->sock;
-		qlog("            socket=%d, reverse=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->reverse, sock->errornumber, nullcheck(sock->errormsg));
-		qlog("            buffer_in=%u, buffer_out=%u\n", sock->buffer_in, sock->buffer_out);
-		qlog("            buffer_filled_in=%d, buffer_filled_out=%d, buffer_read_in=%d\n", sock->buffer_filled_in, sock->buffer_filled_out, sock->buffer_read_in);
+		if (self->sock)
+		{
+			SocketClass *sock = self->sock;
+
+			qlog("            socket=%d, reverse=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->reverse, sock->errornumber, nullcheck(sock->errormsg));
+			qlog("            buffer_in=%u, buffer_out=%u\n", sock->buffer_in, sock->buffer_out);
+			qlog("            buffer_filled_in=%d, buffer_filled_out=%d, buffer_read_in=%d\n", sock->buffer_filled_in, sock->buffer_filled_out, sock->buffer_read_in);
 		}
 	}
 	else
 		qlog("INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 #undef PRN_NULLCHECK
 }
-
diff --git a/src/interfaces/odbc/connection.h b/src/interfaces/odbc/connection.h
index 8222d98518039bbe4b73b39e6a532ffff237d870..e2de90c495b35b86e62e7b95a210f462ee0b74eb 100644
--- a/src/interfaces/odbc/connection.h
+++ b/src/interfaces/odbc/connection.h
@@ -1,9 +1,9 @@
 
-/* File:            connection.h
+/* File:			connection.h
  *
- * Description:     See "connection.c"
+ * Description:		See "connection.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -27,11 +27,14 @@
 #endif
 
 
-typedef enum {
-    CONN_NOT_CONNECTED,      /* Connection has not been established */
-    CONN_CONNECTED,      /* Connection is up and has been established */
-    CONN_DOWN,            /* Connection is broken */
-    CONN_EXECUTING     /* the connection is currently executing a statement */
+typedef enum
+{
+	CONN_NOT_CONNECTED,			/* Connection has not been established */
+	CONN_CONNECTED,				/* Connection is up and has been
+								 * established */
+	CONN_DOWN,					/* Connection is broken */
+	CONN_EXECUTING				/* the connection is currently executing a
+								 * statement */
 } CONN_Status;
 
 /*	These errors have general sql error state */
@@ -50,7 +53,7 @@ typedef enum {
 #define CONN_INIREAD_ERROR 201
 #define CONN_OPENDB_ERROR 202
 #define CONN_STMT_ALLOC_ERROR 203
-#define CONN_IN_USE 204 
+#define CONN_IN_USE 204
 #define CONN_UNSUPPORTED_OPTION 205
 /* Used by SetConnectoption to indicate unsupported options */
 #define CONN_INVALID_ARGUMENT_NO 206
@@ -112,49 +115,50 @@ typedef unsigned int ProtocolVersion;
 /*	This startup packet is to support latest Postgres protocol (6.4, 6.3) */
 typedef struct _StartupPacket
 {
-	ProtocolVersion	protoVersion;
-	char			database[SM_DATABASE];
-	char			user[SM_USER];
-	char			options[SM_OPTIONS];
-	char			unused[SM_UNUSED];
-	char			tty[SM_TTY];
+	ProtocolVersion protoVersion;
+	char		database[SM_DATABASE];
+	char		user[SM_USER];
+	char		options[SM_OPTIONS];
+	char		unused[SM_UNUSED];
+	char		tty[SM_TTY];
 } StartupPacket;
 
 
 /*	This startup packet is to support pre-Postgres 6.3 protocol */
 typedef struct _StartupPacket6_2
 {
-	unsigned int	authtype;
-	char			database[PATH_SIZE];
-	char			user[NAMEDATALEN];
-	char			options[ARGV_SIZE];
-	char			execfile[ARGV_SIZE];
-	char			tty[PATH_SIZE];
-} StartupPacket6_2;
+	unsigned int authtype;
+	char		database[PATH_SIZE];
+	char		user[NAMEDATALEN];
+	char		options[ARGV_SIZE];
+	char		execfile[ARGV_SIZE];
+	char		tty[PATH_SIZE];
+}			StartupPacket6_2;
 
 
 /*	Structure to hold all the connection attributes for a specific
 	connection (used for both registry and file, DSN and DRIVER)
 */
-typedef struct {
-	char	dsn[MEDIUM_REGISTRY_LEN];
-	char	desc[MEDIUM_REGISTRY_LEN];
-	char	driver[MEDIUM_REGISTRY_LEN];
-	char	server[MEDIUM_REGISTRY_LEN];
-	char	database[MEDIUM_REGISTRY_LEN];
-	char	username[MEDIUM_REGISTRY_LEN];
-	char	password[MEDIUM_REGISTRY_LEN];
-	char	conn_settings[LARGE_REGISTRY_LEN];
-	char	protocol[SMALL_REGISTRY_LEN];
-	char	port[SMALL_REGISTRY_LEN];
-	char	onlyread[SMALL_REGISTRY_LEN];	
-	char	fake_oid_index[SMALL_REGISTRY_LEN];
-	char	show_oid_column[SMALL_REGISTRY_LEN];
-	char	row_versioning[SMALL_REGISTRY_LEN];
-	char	show_system_tables[SMALL_REGISTRY_LEN];
-	char    translation_dll[MEDIUM_REGISTRY_LEN];
-	char    translation_option[SMALL_REGISTRY_LEN];
-	char	focus_password;
+typedef struct
+{
+	char		dsn[MEDIUM_REGISTRY_LEN];
+	char		desc[MEDIUM_REGISTRY_LEN];
+	char		driver[MEDIUM_REGISTRY_LEN];
+	char		server[MEDIUM_REGISTRY_LEN];
+	char		database[MEDIUM_REGISTRY_LEN];
+	char		username[MEDIUM_REGISTRY_LEN];
+	char		password[MEDIUM_REGISTRY_LEN];
+	char		conn_settings[LARGE_REGISTRY_LEN];
+	char		protocol[SMALL_REGISTRY_LEN];
+	char		port[SMALL_REGISTRY_LEN];
+	char		onlyread[SMALL_REGISTRY_LEN];
+	char		fake_oid_index[SMALL_REGISTRY_LEN];
+	char		show_oid_column[SMALL_REGISTRY_LEN];
+	char		row_versioning[SMALL_REGISTRY_LEN];
+	char		show_system_tables[SMALL_REGISTRY_LEN];
+	char		translation_dll[MEDIUM_REGISTRY_LEN];
+	char		translation_option[SMALL_REGISTRY_LEN];
+	char		focus_password;
 } ConnInfo;
 
 /*	Macro to determine is the connection using 6.2 protocol? */
@@ -180,15 +184,15 @@ typedef struct {
 #define SERVER_VERSION_LE(conn, major, minor) (! SERVER_VERSION_GT(conn, major, minor))
 #define SERVER_VERSION_LT(conn, major, minor) (! SERVER_VERSION_GE(conn, major, minor))
 /*#if ! defined(HAVE_CONFIG_H) || defined(HAVE_STRINGIZE)*/
-#define	STRING_AFTER_DOT(string)	(strchr(#string, '.') + 1)
+#define STRING_AFTER_DOT(string)	(strchr(#string, '.') + 1)
 /*#else
-#define	STRING_AFTER_DOT(str)	(strchr("str", '.') + 1)
+#define STRING_AFTER_DOT(str)	(strchr("str", '.') + 1)
 #endif*/
 /*
  *	Simplified macros to compare the server's version with a
  *		specified version
  *	Note: Never pass a variable as the second parameter.
- *	      It must be a decimal constant of the form %d.%d . 
+ *		  It must be a decimal constant of the form %d.%d .
  */
 #define PG_VERSION_GT(conn, ver) \
  (SERVER_VERSION_GT(conn, (int) ver, atoi(STRING_AFTER_DOT(ver))))
@@ -200,9 +204,10 @@ typedef struct {
 #define PG_VERSION_LT(conn, ver) (! PG_VERSION_GE(conn, ver))
 
 /*	This is used to store cached table information in the connection */
-struct col_info {
-	QResultClass	*result;
-	char			name[MAX_TABLE_LEN+1];
+struct col_info
+{
+	QResultClass *result;
+	char		name[MAX_TABLE_LEN + 1];
 };
 
  /* Translation DLL entry points */
@@ -214,52 +219,58 @@ struct col_info {
 #define HINSTANCE void *
 #endif
 
-typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD,
-					SWORD,
-					PTR,
-					SDWORD,
-					PTR,
-					SDWORD,
-					SDWORD FAR *,
-					UCHAR FAR *,
-					SWORD,
-					SWORD FAR *);
-
-typedef BOOL (FAR WINAPI *DriverToDataSourceProc) (UDWORD,
-					SWORD,
-					PTR,
-					SDWORD,
-					PTR,
-					SDWORD,
-					SDWORD FAR *,
-					UCHAR FAR *,
-					SWORD,
-					SWORD FAR *);
+typedef BOOL (FAR WINAPI * DataSourceToDriverProc) (UDWORD,
+																SWORD,
+																PTR,
+																SDWORD,
+																PTR,
+																SDWORD,
+															SDWORD FAR *,
+															 UCHAR FAR *,
+																SWORD,
+															SWORD FAR *);
+
+typedef BOOL (FAR WINAPI * DriverToDataSourceProc) (UDWORD,
+																SWORD,
+																PTR,
+																SDWORD,
+																PTR,
+																SDWORD,
+															SDWORD FAR *,
+															 UCHAR FAR *,
+																SWORD,
+															SWORD FAR *);
 
 /*******	The Connection handle	************/
-struct ConnectionClass_ {
-	HENV			henv;					/* environment this connection was created on */
+struct ConnectionClass_
+{
+	HENV		henv;			/* environment this connection was created
+								 * on */
 	StatementOptions stmtOptions;
-	char			*errormsg;
-	int				errornumber;
-	CONN_Status		status;
-	ConnInfo		connInfo;
-	StatementClass	**stmts;
-	int				num_stmts;
-	SocketClass		*sock;
-	int				lobj_type;
-	int				ntables;
-	COL_INFO		**col_info;
-	long            translation_option;
-	HINSTANCE       translation_handle;
-	DataSourceToDriverProc  DataSourceToDriver;
-	DriverToDataSourceProc  DriverToDataSource;
-	char			transact_status;		/* Is a transaction is currently in progress */
-	char			errormsg_created;		/* has an informative error msg been created?  */
-	char			pg_version[MAX_INFO_STRING];	/* Version of PostgreSQL we're connected to - DJP 25-1-2001 */
-	float			pg_version_number;
-	Int2			pg_version_major;
-	Int2			pg_version_minor;
+	char	   *errormsg;
+	int			errornumber;
+	CONN_Status status;
+	ConnInfo	connInfo;
+	StatementClass **stmts;
+	int			num_stmts;
+	SocketClass *sock;
+	int			lobj_type;
+	int			ntables;
+	COL_INFO  **col_info;
+	long		translation_option;
+	HINSTANCE	translation_handle;
+	DataSourceToDriverProc DataSourceToDriver;
+	DriverToDataSourceProc DriverToDataSource;
+	char		transact_status;/* Is a transaction is currently in
+								 * progress */
+	char		errormsg_created;		/* has an informative error msg
+										 * been created?  */
+	char		pg_version[MAX_INFO_STRING];	/* Version of PostgreSQL
+												 * we're connected to -
+												 * DJP 25-1-2001 */
+	float		pg_version_number;
+	Int2		pg_version_major;
+	Int2		pg_version_minor;
 };
 
 
@@ -272,31 +283,31 @@ struct ConnectionClass_ {
 #define CC_is_onlyread(x)	(x->connInfo.onlyread[0] == '1')
 
 
-/*  for CC_DSN_info */
+/*	for CC_DSN_info */
 #define CONN_DONT_OVERWRITE		0
-#define CONN_OVERWRITE			1 
+#define CONN_OVERWRITE			1
 
 
 /*	prototypes */
 ConnectionClass *CC_Constructor(void);
-char CC_Destructor(ConnectionClass *self);
-int CC_cursor_count(ConnectionClass *self);
-char CC_cleanup(ConnectionClass *self);
-char CC_abort(ConnectionClass *self);
-int CC_set_translation (ConnectionClass *self);
-char CC_connect(ConnectionClass *self, char do_password);
-char CC_add_statement(ConnectionClass *self, StatementClass *stmt);
-char CC_remove_statement(ConnectionClass *self, StatementClass *stmt);
-char CC_get_error(ConnectionClass *self, int *number, char **message);
+char		CC_Destructor(ConnectionClass *self);
+int			CC_cursor_count(ConnectionClass *self);
+char		CC_cleanup(ConnectionClass *self);
+char		CC_abort(ConnectionClass *self);
+int			CC_set_translation(ConnectionClass *self);
+char		CC_connect(ConnectionClass *self, char do_password);
+char		CC_add_statement(ConnectionClass *self, StatementClass *stmt);
+char		CC_remove_statement(ConnectionClass *self, StatementClass *stmt);
+char		CC_get_error(ConnectionClass *self, int *number, char **message);
 QResultClass *CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi);
-void CC_clear_error(ConnectionClass *self);
-char *CC_create_errormsg(ConnectionClass *self);
-int CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *argv, int nargs);
-char CC_send_settings(ConnectionClass *self);
-void CC_lookup_lo(ConnectionClass *conn);
-void CC_lookup_pg_version(ConnectionClass *conn);
-void CC_initialize_pg_version(ConnectionClass *conn);
-void CC_log_error(char *func, char *desc, ConnectionClass *self);
+void		CC_clear_error(ConnectionClass *self);
+char	   *CC_create_errormsg(ConnectionClass *self);
+int			CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *argv, int nargs);
+char		CC_send_settings(ConnectionClass *self);
+void		CC_lookup_lo(ConnectionClass *conn);
+void		CC_lookup_pg_version(ConnectionClass *conn);
+void		CC_initialize_pg_version(ConnectionClass *conn);
+void		CC_log_error(char *func, char *desc, ConnectionClass *self);
 
 
 #endif
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 12739f32aaf65a16789e0177de583df6b056f04d..72aa717ae50bfcf6939bb3637519c90a6cbdddb9 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -1,18 +1,18 @@
 
-/* Module:         convert.c
+/* Module:		   convert.c
  *
- * Description:	   This module contains routines related to 
- *                 converting parameters and columns into requested data types.
- *                 Parameters are converted from their SQL_C data types into
- *                 the appropriate postgres type.  Columns are converted from
- *                 their postgres type (SQL type) into the appropriate SQL_C 
- *                 data type.
+ * Description:    This module contains routines related to
+ *				   converting parameters and columns into requested data types.
+ *				   Parameters are converted from their SQL_C data types into
+ *				   the appropriate postgres type.  Columns are converted from
+ *				   their postgres type (SQL type) into the appropriate SQL_C
+ *				   data type.
  *
- * Classes:        n/a
+ * Classes:		   n/a
  *
  * API functions:  none
  *
- * Comments:       See "notice.txt" for copyright and license information.
+ * Comments:	   See "notice.txt" for copyright and license information.
  *
  */
 /* Multibyte support  Eiji Tokuya	2001-03-15	*/
@@ -58,6 +58,7 @@
 #endif
 #ifndef SCHAR
 typedef signed char SCHAR;
+
 #endif
 #endif
 
@@ -69,76 +70,76 @@ extern GLOBAL_VALUES globals;
  *	 http://www.merant.com/datadirect/download/docs/odbc16/Odbcref/rappc.htm
  * - thomas 2000-04-03
  */
-char *mapFuncs[][2] = {
-/*	{ "ASCII",       "ascii"      }, */
-	{ "CHAR",        "chr"        },
-	{ "CONCAT",      "textcat"    },
+char	   *mapFuncs[][2] = {
+/*	{ "ASCII",		 "ascii"	  }, */
+	{"CHAR", "chr"},
+	{"CONCAT", "textcat"},
 /*	{ "DIFFERENCE",  "difference" }, */
-/*	{ "INSERT",      "insert"     }, */
-	{ "LCASE",       "lower"      },
-	{ "LEFT",        "ltrunc"     },
-	{ "LOCATE",      "strpos"     },
-	{ "LENGTH",      "char_length"},
-/*	{ "LTRIM",       "ltrim"      }, */
-	{ "RIGHT",       "rtrunc"     },
-/*	{ "REPEAT",      "repeat"     }, */
-/*	{ "REPLACE",     "replace"    }, */
-/*	{ "RTRIM",       "rtrim"      }, */
-/*	{ "SOUNDEX",     "soundex"    }, */
-	{ "SUBSTRING",   "substr"     },
-	{ "UCASE",       "upper"      },
-
-/*	{ "ABS",         "abs"        }, */
-/*	{ "ACOS",        "acos"       }, */
-/*	{ "ASIN",        "asin"       }, */
-/*	{ "ATAN",        "atan"       }, */
-/*	{ "ATAN2",       "atan2"      }, */
-	{ "CEILING",     "ceil"       },
-/*	{ "COS",         "cos"        }, */
-/*	{ "COT",         "cot"        }, */
-/*	{ "DEGREES",     "degrees"    }, */
-/*	{ "EXP",         "exp"        }, */
-/*	{ "FLOOR",       "floor"      }, */
-	{ "LOG",         "ln"         },
-	{ "LOG10",       "log"        },
-/*	{ "MOD",         "mod"        }, */
-/*	{ "PI",          "pi"         }, */
-	{ "POWER",       "pow"        },
-/*	{ "RADIANS",     "radians"    }, */
-	{ "RAND",        "random"     },
-/*	{ "ROUND",       "round"      }, */
-/*	{ "SIGN",        "sign"       }, */
-/*	{ "SIN",         "sin"        }, */
-/*	{ "SQRT",        "sqrt"       }, */
-/*	{ "TAN",         "tan"        }, */
-	{ "TRUNCATE",    "trunc"      },
-
-/*	{ "CURDATE",     "curdate"    }, */
-/*	{ "CURTIME",     "curtime"    }, */
-/*	{ "DAYNAME",     "dayname"    }, */
+/*	{ "INSERT",		 "insert"	  }, */
+	{"LCASE", "lower"},
+	{"LEFT", "ltrunc"},
+	{"LOCATE", "strpos"},
+	{"LENGTH", "char_length"},
+/*	{ "LTRIM",		 "ltrim"	  }, */
+	{"RIGHT", "rtrunc"},
+/*	{ "REPEAT",		 "repeat"	  }, */
+/*	{ "REPLACE",	 "replace"	  }, */
+/*	{ "RTRIM",		 "rtrim"	  }, */
+/*	{ "SOUNDEX",	 "soundex"	  }, */
+	{"SUBSTRING", "substr"},
+	{"UCASE", "upper"},
+
+/*	{ "ABS",		 "abs"		  }, */
+/*	{ "ACOS",		 "acos"		  }, */
+/*	{ "ASIN",		 "asin"		  }, */
+/*	{ "ATAN",		 "atan"		  }, */
+/*	{ "ATAN2",		 "atan2"	  }, */
+	{"CEILING", "ceil"},
+/*	{ "COS",		 "cos"		  }, */
+/*	{ "COT",		 "cot"		  }, */
+/*	{ "DEGREES",	 "degrees"	  }, */
+/*	{ "EXP",		 "exp"		  }, */
+/*	{ "FLOOR",		 "floor"	  }, */
+	{"LOG", "ln"},
+	{"LOG10", "log"},
+/*	{ "MOD",		 "mod"		  }, */
+/*	{ "PI",			 "pi"		  }, */
+	{"POWER", "pow"},
+/*	{ "RADIANS",	 "radians"	  }, */
+	{"RAND", "random"},
+/*	{ "ROUND",		 "round"	  }, */
+/*	{ "SIGN",		 "sign"		  }, */
+/*	{ "SIN",		 "sin"		  }, */
+/*	{ "SQRT",		 "sqrt"		  }, */
+/*	{ "TAN",		 "tan"		  }, */
+	{"TRUNCATE", "trunc"},
+
+/*	{ "CURDATE",	 "curdate"	  }, */
+/*	{ "CURTIME",	 "curtime"	  }, */
+/*	{ "DAYNAME",	 "dayname"	  }, */
 /*	{ "DAYOFMONTH",  "dayofmonth" }, */
-/*	{ "DAYOFWEEK",   "dayofweek"  }, */
-/*	{ "DAYOFYEAR",   "dayofyear"  }, */
-/*	{ "HOUR",        "hour"       }, */
-/*	{ "MINUTE",      "minute"     }, */
-/*	{ "MONTH",       "month"      }, */
-/*	{ "MONTHNAME",   "monthname"  }, */
-/*	{ "NOW",         "now"        }, */
-/*	{ "QUARTER",     "quarter"    }, */
-/*	{ "SECOND",      "second"     }, */
-/*	{ "WEEK",        "week"       }, */
-/*	{ "YEAR",        "year"       }, */
-
-/*	{ "DATABASE",    "database"   }, */
-	{ "IFNULL",      "coalesce"   },
-	{ "USER",        "odbc_user"  },
-	{    0,             0         }
+/*	{ "DAYOFWEEK",	 "dayofweek"  }, */
+/*	{ "DAYOFYEAR",	 "dayofyear"  }, */
+/*	{ "HOUR",		 "hour"		  }, */
+/*	{ "MINUTE",		 "minute"	  }, */
+/*	{ "MONTH",		 "month"	  }, */
+/*	{ "MONTHNAME",	 "monthname"  }, */
+/*	{ "NOW",		 "now"		  }, */
+/*	{ "QUARTER",	 "quarter"	  }, */
+/*	{ "SECOND",		 "second"	  }, */
+/*	{ "WEEK",		 "week"		  }, */
+/*	{ "YEAR",		 "year"		  }, */
+
+/*	{ "DATABASE",	 "database"   }, */
+	{"IFNULL", "coalesce"},
+	{"USER", "odbc_user"},
+	{0, 0}
 };
 
-char *mapFunction(char *func);
+char	   *mapFunction(char *func);
 unsigned int conv_from_octal(unsigned char *s);
 unsigned int conv_from_hex(unsigned char *s);
-char *conv_to_octal(unsigned char val);
+char	   *conv_to_octal(unsigned char val);
 
 /********		A Guide for date/time/timestamp conversions    **************
 
@@ -150,10 +151,10 @@ char *conv_to_octal(unsigned char val);
 			PG_TYPE_TIME	SQL_C_DEFAULT		SQL_C_TIME
 			PG_TYPE_TIME	SQL_C_TIME			SQL_C_TIME
 			PG_TYPE_TIME	SQL_C_TIMESTAMP		SQL_C_TIMESTAMP		(date = current date)
-			PG_TYPE_ABSTIME	SQL_C_DEFAULT		SQL_C_TIMESTAMP
-			PG_TYPE_ABSTIME	SQL_C_DATE			SQL_C_DATE			(time is truncated)
-			PG_TYPE_ABSTIME	SQL_C_TIME			SQL_C_TIME			(date is truncated)
-			PG_TYPE_ABSTIME	SQL_C_TIMESTAMP		SQL_C_TIMESTAMP		
+			PG_TYPE_ABSTIME SQL_C_DEFAULT		SQL_C_TIMESTAMP
+			PG_TYPE_ABSTIME SQL_C_DATE			SQL_C_DATE			(time is truncated)
+			PG_TYPE_ABSTIME SQL_C_TIME			SQL_C_TIME			(date is truncated)
+			PG_TYPE_ABSTIME SQL_C_TIMESTAMP		SQL_C_TIMESTAMP
 ******************************************************************************/
 
 
@@ -161,36 +162,41 @@ char *conv_to_octal(unsigned char val);
 int
 copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col)
 {
-BindInfoClass *bic = &(stmt->bindings[col]);
+	BindInfoClass *bic = &(stmt->bindings[col]);
 
-	return copy_and_convert_field(stmt, field_type, value, (Int2)bic->returntype, (PTR)bic->buffer,
-                                (SDWORD)bic->buflen, (SDWORD *)bic->used);
+	return copy_and_convert_field(stmt, field_type, value, (Int2) bic->returntype, (PTR) bic->buffer,
+							 (SDWORD) bic->buflen, (SDWORD *) bic->used);
 }
 
 /*	This is called by SQLGetData() */
 int
-copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, 
+copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
 					   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue)
 {
-	Int4 len = 0, copy_len = 0;
+	Int4		len = 0,
+				copy_len = 0;
 	SIMPLE_TIME st;
-	time_t t = time(NULL);
-	struct tm *tim;
-	int pcbValueOffset, rgbValueOffset;
-	char *rgbValueBindRow, *ptr;
-	int bind_row = stmt->bind_row;
-	int bind_size = stmt->options.bind_size;
-	int result = COPY_OK;
-	char tempBuf[TEXT_FIELD_SIZE+5];
+	time_t		t = time(NULL);
+	struct tm  *tim;
+	int			pcbValueOffset,
+				rgbValueOffset;
+	char	   *rgbValueBindRow,
+			   *ptr;
+	int			bind_row = stmt->bind_row;
+	int			bind_size = stmt->options.bind_size;
+	int			result = COPY_OK;
+	char		tempBuf[TEXT_FIELD_SIZE + 5];
 
 /*	rgbValueOffset is *ONLY* for character and binary data */
 /*	pcbValueOffset is for computing any pcbValue location */
 
-	if (bind_size > 0) {
+	if (bind_size > 0)
+	{
 
 		pcbValueOffset = rgbValueOffset = (bind_size * bind_row);
 	}
-	else {
+	else
+	{
 
 		pcbValueOffset = bind_row * sizeof(SDWORD);
 		rgbValueOffset = bind_row * cbValueMax;
@@ -199,31 +205,33 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
 
 	memset(&st, 0, sizeof(SIMPLE_TIME));
 
-	/*	Initialize current date */
+	/* Initialize current date */
 	tim = localtime(&t);
 	st.m = tim->tm_mon + 1;
 	st.d = tim->tm_mday;
 	st.y = tim->tm_year + 1900;
 
-	mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType,  (value==NULL)?"<NULL>":value, cbValueMax);
+	mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, (value == NULL) ? "<NULL>" : value, cbValueMax);
 
-	if ( ! value) {
-        /* handle a null just by returning SQL_NULL_DATA in pcbValue, */
-        /* and doing nothing to the buffer.                           */
-        if(pcbValue) {
+	if (!value)
+	{
+		/* handle a null just by returning SQL_NULL_DATA in pcbValue, */
+		/* and doing nothing to the buffer.							  */
+		if (pcbValue)
 			*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = SQL_NULL_DATA;
-        }
 		return COPY_OK;
 	}
 
 
-	if (stmt->hdbc->DataSourceToDriver != NULL) {
-		int length = strlen (value);
-		stmt->hdbc->DataSourceToDriver (stmt->hdbc->translation_option,
-										SQL_CHAR,
-										value, length,
-										value, length, NULL,
-										NULL, 0, NULL);
+	if (stmt->hdbc->DataSourceToDriver != NULL)
+	{
+		int			length = strlen(value);
+
+		stmt->hdbc->DataSourceToDriver(stmt->hdbc->translation_option,
+									   SQL_CHAR,
+									   value, length,
+									   value, length, NULL,
+									   NULL, 0, NULL);
 	}
 
 
@@ -231,111 +239,131 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
 		First convert any specific postgres types into more
 		useable data.
 
-		NOTE: Conversions from PG char/varchar of a date/time/timestamp 
-		value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported 
+		NOTE: Conversions from PG char/varchar of a date/time/timestamp
+		value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
 	*********************************************************************/
-	switch(field_type) {
-	/*  $$$ need to add parsing for date/time/timestamp strings in PG_TYPE_CHAR,VARCHAR $$$ */
-	case PG_TYPE_DATE:
-		sscanf(value, "%4d-%2d-%2d", &st.y, &st.m, &st.d);
-		break;
-
-	case PG_TYPE_TIME:
-		sscanf(value, "%2d:%2d:%2d", &st.hh, &st.mm, &st.ss);
-		break;
-
-	case PG_TYPE_ABSTIME:
-	case PG_TYPE_DATETIME:
-	case PG_TYPE_TIMESTAMP:
-		if (strnicmp(value, "invalid", 7) != 0) {
-			sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
-
-		} else {	/* The timestamp is invalid so set something conspicuous, like the epoch */
-			t = 0;
-			tim = localtime(&t);
-			st.m = tim->tm_mon + 1;
-			st.d = tim->tm_mday;
-			st.y = tim->tm_year + 1900;
-			st.hh = tim->tm_hour;
-			st.mm = tim->tm_min;
-			st.ss = tim->tm_sec;
-		}
-		break;
-
-	case PG_TYPE_BOOL: {		/* change T/F to 1/0 */
-		char *s = (char *) value;
-		if (s[0] == 'T' || s[0] == 't') 
-			s[0] = '1';
-		else 
-			s[0] = '0';
-		}
-		break;
-
-	/* This is for internal use by SQLStatistics() */
-	case PG_TYPE_INT2VECTOR: {
-		int nval, i;
-		char *vp;
-		/* this is an array of eight integers */
-		short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset);
-
-		len = 32;
-		vp = value;
-		nval = 0;
-mylog("index=(");
-		for (i = 0; i < 16; i++)
-		{
-			if (sscanf(vp, "%hd", &short_array[i]) != 1)
-				break;
+	switch (field_type)
+	{
 
-mylog(" %d", short_array[i]);
-			nval++;
+			/*
+			 * $$$ need to add parsing for date/time/timestamp strings in
+			 * PG_TYPE_CHAR,VARCHAR $$$
+			 */
+		case PG_TYPE_DATE:
+			sscanf(value, "%4d-%2d-%2d", &st.y, &st.m, &st.d);
+			break;
 
-			/* skip the current token */
-			while ((*vp != '\0') && (! isspace((unsigned char) *vp))) vp++;
-			/* and skip the space to the next token */
-			while ((*vp != '\0') && (isspace((unsigned char) *vp))) vp++;
-			if (*vp == '\0')
-				break;
-		}
-mylog(") nval = %d\n", nval);
+		case PG_TYPE_TIME:
+			sscanf(value, "%2d:%2d:%2d", &st.hh, &st.mm, &st.ss);
+			break;
 
-		for (i = nval; i < 16; i++)
-		{
-			short_array[i] = 0;
-		}
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			if (strnicmp(value, "invalid", 7) != 0)
+			{
+				sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
+
+			}
+			else
+			{					/* The timestamp is invalid so set
+								 * something conspicuous, like the epoch */
+				t = 0;
+				tim = localtime(&t);
+				st.m = tim->tm_mon + 1;
+				st.d = tim->tm_mday;
+				st.y = tim->tm_year + 1900;
+				st.hh = tim->tm_hour;
+				st.mm = tim->tm_min;
+				st.ss = tim->tm_sec;
+			}
+			break;
+
+		case PG_TYPE_BOOL:
+			{					/* change T/F to 1/0 */
+				char	   *s = (char *) value;
+
+				if (s[0] == 'T' || s[0] == 't')
+					s[0] = '1';
+				else
+					s[0] = '0';
+			}
+			break;
+
+			/* This is for internal use by SQLStatistics() */
+		case PG_TYPE_INT2VECTOR:
+			{
+				int			nval,
+							i;
+				char	   *vp;
+
+				/* this is an array of eight integers */
+				short	   *short_array = (short *) ((char *) rgbValue + rgbValueOffset);
+
+				len = 32;
+				vp = value;
+				nval = 0;
+				mylog("index=(");
+				for (i = 0; i < 16; i++)
+				{
+					if (sscanf(vp, "%hd", &short_array[i]) != 1)
+						break;
+
+					mylog(" %d", short_array[i]);
+					nval++;
+
+					/* skip the current token */
+					while ((*vp != '\0') && (!isspace((unsigned char) *vp)))
+						vp++;
+					/* and skip the space to the next token */
+					while ((*vp != '\0') && (isspace((unsigned char) *vp)))
+						vp++;
+					if (*vp == '\0')
+						break;
+				}
+				mylog(") nval = %d\n", nval);
+
+				for (i = nval; i < 16; i++)
+					short_array[i] = 0;
 
 #if 0
-		sscanf(value, "%hd %hd %hd %hd %hd %hd %hd %hd",
-			&short_array[0],
-			&short_array[1],
-			&short_array[2],
-			&short_array[3],
-			&short_array[4],
-			&short_array[5],
-			&short_array[6],
-			&short_array[7]);
+				sscanf(value, "%hd %hd %hd %hd %hd %hd %hd %hd",
+					   &short_array[0],
+					   &short_array[1],
+					   &short_array[2],
+					   &short_array[3],
+					   &short_array[4],
+					   &short_array[5],
+					   &short_array[6],
+					   &short_array[7]);
 #endif
 
-		/*  There is no corresponding fCType for this. */
-		if(pcbValue)
-			*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
+				/* There is no corresponding fCType for this. */
+				if (pcbValue)
+					*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
 
-		return COPY_OK;		/* dont go any further or the data will be trashed */
-	}
+				return COPY_OK; /* dont go any further or the data will be
+								 * trashed */
+			}
 
-	/* This is a large object OID, which is used to store LONGVARBINARY objects. */
-	case PG_TYPE_LO:
+			/*
+			 * This is a large object OID, which is used to store
+			 * LONGVARBINARY objects.
+			 */
+		case PG_TYPE_LO:
 
-		return convert_lo( stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
+			return convert_lo(stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
 
-	default:
+		default:
 
-		if (field_type == stmt->hdbc->lobj_type)	/* hack until permanent type available */
-			return convert_lo( stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
+			if (field_type == stmt->hdbc->lobj_type)	/* hack until permanent
+														 * type available */
+				return convert_lo(stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
 	}
 
-	/*  Change default into something useable */
-	if (fCType == SQL_C_DEFAULT) {
+	/* Change default into something useable */
+	if (fCType == SQL_C_DEFAULT)
+	{
 		fCType = pgtype_to_ctype(stmt, field_type);
 
 		mylog("copy_and_convert, SQL_C_DEFAULT: fCType = %d\n", fCType);
@@ -344,297 +372,318 @@ mylog(") nval = %d\n", nval);
 
 	rgbValueBindRow = (char *) rgbValue + rgbValueOffset;
 
-    if(fCType == SQL_C_CHAR) {
+	if (fCType == SQL_C_CHAR)
+	{
 
 
-		/*	Special character formatting as required */
-		/*	These really should return error if cbValueMax is not big enough. */
-		switch(field_type) {
-		case PG_TYPE_DATE:
-		    len = 10;
-			if (cbValueMax > len)
-				sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d", st.y, st.m, st.d);
-			break;
+		/* Special character formatting as required */
 
-		case PG_TYPE_TIME:
-			len = 8;
-			if (cbValueMax > len)
-				sprintf(rgbValueBindRow, "%.2d:%.2d:%.2d", st.hh, st.mm, st.ss);
-			break;
-
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			len = 19;
-			if (cbValueMax > len)
-				sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d", 
-					st.y, st.m, st.d, st.hh, st.mm, st.ss);
-			break;
+		/*
+		 * These really should return error if cbValueMax is not big
+		 * enough.
+		 */
+		switch (field_type)
+		{
+			case PG_TYPE_DATE:
+				len = 10;
+				if (cbValueMax > len)
+					sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d", st.y, st.m, st.d);
+				break;
 
-		case PG_TYPE_BOOL:
-			len = 1;
-			if (cbValueMax > len) {
-				strcpy(rgbValueBindRow, value);
-				mylog("PG_TYPE_BOOL: rgbValueBindRow = '%s'\n", rgbValueBindRow);
-			}
-			break;
+			case PG_TYPE_TIME:
+				len = 8;
+				if (cbValueMax > len)
+					sprintf(rgbValueBindRow, "%.2d:%.2d:%.2d", st.hh, st.mm, st.ss);
+				break;
 
-		/*	Currently, data is SILENTLY TRUNCATED for BYTEA and character data
-			types if there is not enough room in cbValueMax because the driver 
-			can't handle multiple calls to SQLGetData for these, yet.  Most likely,
-			the buffer passed in will be big enough to handle the maximum limit of 
-			postgres, anyway.
+			case PG_TYPE_ABSTIME:
+			case PG_TYPE_DATETIME:
+			case PG_TYPE_TIMESTAMP:
+				len = 19;
+				if (cbValueMax > len)
+					sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
+							st.y, st.m, st.d, st.hh, st.mm, st.ss);
+				break;
 
-			LongVarBinary types are handled correctly above, observing truncation
-			and all that stuff since there is essentially no limit on the large
-			object used to store those.
-		*/
-		case PG_TYPE_BYTEA:		/* convert binary data to hex strings (i.e, 255 = "FF") */
-			len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax);
+			case PG_TYPE_BOOL:
+				len = 1;
+				if (cbValueMax > len)
+				{
+					strcpy(rgbValueBindRow, value);
+					mylog("PG_TYPE_BOOL: rgbValueBindRow = '%s'\n", rgbValueBindRow);
+				}
+				break;
 
-			/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
-			break;
+				/*
+				 * Currently, data is SILENTLY TRUNCATED for BYTEA and
+				 * character data types if there is not enough room in
+				 * cbValueMax because the driver can't handle multiple
+				 * calls to SQLGetData for these, yet.	Most likely, the
+				 * buffer passed in will be big enough to handle the
+				 * maximum limit of postgres, anyway.
+				 *
+				 * LongVarBinary types are handled correctly above, observing
+				 * truncation and all that stuff since there is
+				 * essentially no limit on the large object used to store
+				 * those.
+				 */
+			case PG_TYPE_BYTEA:/* convert binary data to hex strings
+								 * (i.e, 255 = "FF") */
+				len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax);
+
+				/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
+				break;
 
-		default:
-			/*	convert linefeeds to carriage-return/linefeed */
-			len = convert_linefeeds(value, tempBuf, sizeof(tempBuf));
-			ptr = tempBuf;
-
-			mylog("DEFAULT: len = %d, ptr = '%s'\n", len, ptr);
-
-			if (stmt->current_col >= 0) {
-				if (stmt->bindings[stmt->current_col].data_left == 0)
-					return COPY_NO_DATA_FOUND;
-				else if (stmt->bindings[stmt->current_col].data_left > 0) {
-					ptr += len - stmt->bindings[stmt->current_col].data_left;
-					len = stmt->bindings[stmt->current_col].data_left;
+			default:
+				/* convert linefeeds to carriage-return/linefeed */
+				len = convert_linefeeds(value, tempBuf, sizeof(tempBuf));
+				ptr = tempBuf;
+
+				mylog("DEFAULT: len = %d, ptr = '%s'\n", len, ptr);
+
+				if (stmt->current_col >= 0)
+				{
+					if (stmt->bindings[stmt->current_col].data_left == 0)
+						return COPY_NO_DATA_FOUND;
+					else if (stmt->bindings[stmt->current_col].data_left > 0)
+					{
+						ptr += len - stmt->bindings[stmt->current_col].data_left;
+						len = stmt->bindings[stmt->current_col].data_left;
+					}
+					else
+						stmt->bindings[stmt->current_col].data_left = strlen(ptr);
 				}
-				else
-					stmt->bindings[stmt->current_col].data_left = strlen(ptr);
-			}
 
-			if (cbValueMax > 0) {
-				
-				copy_len = (len >= cbValueMax) ? cbValueMax -1 : len;
+				if (cbValueMax > 0)
+				{
+
+					copy_len = (len >= cbValueMax) ? cbValueMax - 1 : len;
 
-				/*	Copy the data */
-				strncpy_null(rgbValueBindRow, ptr, copy_len + 1);
+					/* Copy the data */
+					strncpy_null(rgbValueBindRow, ptr, copy_len + 1);
 
-				/*	Adjust data_left for next time */
-				if (stmt->current_col >= 0) {
-					stmt->bindings[stmt->current_col].data_left -= copy_len;
+					/* Adjust data_left for next time */
+					if (stmt->current_col >= 0)
+						stmt->bindings[stmt->current_col].data_left -= copy_len;
 				}
-			}
 
-			/*	Finally, check for truncation so that proper status can be returned */
-			if ( len >= cbValueMax)
-				result = COPY_RESULT_TRUNCATED;
+				/*
+				 * Finally, check for truncation so that proper status can
+				 * be returned
+				 */
+				if (len >= cbValueMax)
+					result = COPY_RESULT_TRUNCATED;
 
 
-			mylog("    SQL_C_CHAR, default: len = %d, cbValueMax = %d, rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow);
-			break;
+				mylog("    SQL_C_CHAR, default: len = %d, cbValueMax = %d, rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow);
+				break;
 		}
 
 
-    } else {
+	}
+	else
+	{
 
-		/*	for SQL_C_CHAR, it's probably ok to leave currency symbols in.  But
-			to convert to numeric types, it is necessary to get rid of those.
-		*/
+		/*
+		 * for SQL_C_CHAR, it's probably ok to leave currency symbols in.
+		 * But to convert to numeric types, it is necessary to get rid of
+		 * those.
+		 */
 		if (field_type == PG_TYPE_MONEY)
 			convert_money(value);
 
-		switch(fCType) {
-		case SQL_C_DATE:
-			len = 6;
-			{
-			DATE_STRUCT *ds;
-			
-			if (bind_size > 0) {
-				ds = (DATE_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-			} else {
-				ds = (DATE_STRUCT *) rgbValue + bind_row;
-			}
-			ds->year = st.y;
-			ds->month = st.m;
-			ds->day = st.d;
-			}
-			break;
+		switch (fCType)
+		{
+			case SQL_C_DATE:
+				len = 6;
+				{
+					DATE_STRUCT *ds;
+
+					if (bind_size > 0)
+						ds = (DATE_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+					else
+						ds = (DATE_STRUCT *) rgbValue + bind_row;
+					ds->year = st.y;
+					ds->month = st.m;
+					ds->day = st.d;
+				}
+				break;
 
-		case SQL_C_TIME:
-			len = 6;
-			{
-			TIME_STRUCT *ts;
-			
-			if (bind_size > 0) {
-				ts = (TIME_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-			} else {
-				ts = (TIME_STRUCT *) rgbValue + bind_row;
-			}
-			ts->hour = st.hh;
-			ts->minute = st.mm;
-			ts->second = st.ss;
-			}
-			break;
+			case SQL_C_TIME:
+				len = 6;
+				{
+					TIME_STRUCT *ts;
+
+					if (bind_size > 0)
+						ts = (TIME_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+					else
+						ts = (TIME_STRUCT *) rgbValue + bind_row;
+					ts->hour = st.hh;
+					ts->minute = st.mm;
+					ts->second = st.ss;
+				}
+				break;
 
-		case SQL_C_TIMESTAMP:					
-			len = 16;
-			{
-			TIMESTAMP_STRUCT *ts;
-			if (bind_size > 0) {
-				ts = (TIMESTAMP_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-			} else {
-				ts = (TIMESTAMP_STRUCT *) rgbValue + bind_row;
-			}
-			ts->year = st.y;
-			ts->month = st.m;
-			ts->day = st.d;
-			ts->hour = st.hh;
-			ts->minute = st.mm;
-			ts->second = st.ss;
-			ts->fraction = 0;
-			}
-			break;
+			case SQL_C_TIMESTAMP:
+				len = 16;
+				{
+					TIMESTAMP_STRUCT *ts;
+
+					if (bind_size > 0)
+						ts = (TIMESTAMP_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+					else
+						ts = (TIMESTAMP_STRUCT *) rgbValue + bind_row;
+					ts->year = st.y;
+					ts->month = st.m;
+					ts->day = st.d;
+					ts->hour = st.hh;
+					ts->minute = st.mm;
+					ts->second = st.ss;
+					ts->fraction = 0;
+				}
+				break;
 
-		case SQL_C_BIT:
-			len = 1;
-			if (bind_size > 0) {
-				*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-			} else {
-				*((UCHAR *)rgbValue + bind_row) = atoi(value);
-			}
-			/* mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue)); */
-			break;
+			case SQL_C_BIT:
+				len = 1;
+				if (bind_size > 0)
+					*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+				else
+					*((UCHAR *) rgbValue + bind_row) = atoi(value);
 
-		case SQL_C_STINYINT:
-		case SQL_C_TINYINT:
-			len = 1;
-			if (bind_size > 0) {
-				*(SCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-			} else {
-				*((SCHAR *) rgbValue + bind_row) = atoi(value);
-			}
-			break;
+				/*
+				 * mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n",
+				 * atoi(value), cbValueMax, *((UCHAR *)rgbValue));
+				 */
+				break;
 
-		case SQL_C_UTINYINT:
-			len = 1;
-			if (bind_size > 0) {
-				*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-			} else {
-				*((UCHAR *) rgbValue + bind_row) = atoi(value);
-			}
-			break;
+			case SQL_C_STINYINT:
+			case SQL_C_TINYINT:
+				len = 1;
+				if (bind_size > 0)
+					*(SCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+				else
+					*((SCHAR *) rgbValue + bind_row) = atoi(value);
+				break;
 
-		case SQL_C_FLOAT:
-			len = 4;
-			if (bind_size > 0) {
-				*(SFLOAT *) ((char *) rgbValue + (bind_row * bind_size)) = (float) atof(value);
-			} else {
-				*((SFLOAT *)rgbValue + bind_row) = (float) atof(value);
-			}
-			break;
+			case SQL_C_UTINYINT:
+				len = 1;
+				if (bind_size > 0)
+					*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+				else
+					*((UCHAR *) rgbValue + bind_row) = atoi(value);
+				break;
 
-		case SQL_C_DOUBLE:
-			len = 8;
-			if (bind_size > 0) {
-				*(SDOUBLE *) ((char *) rgbValue + (bind_row * bind_size)) = atof(value);
-			} else {
-				*((SDOUBLE *)rgbValue + bind_row) = atof(value);
-			}
-			break;
+			case SQL_C_FLOAT:
+				len = 4;
+				if (bind_size > 0)
+					*(SFLOAT *) ((char *) rgbValue + (bind_row * bind_size)) = (float) atof(value);
+				else
+					*((SFLOAT *) rgbValue + bind_row) = (float) atof(value);
+				break;
 
-		case SQL_C_SSHORT:
-		case SQL_C_SHORT:
-			len = 2;
-			if (bind_size > 0) {
-				*(SWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-			} else {
-				*((SWORD *)rgbValue + bind_row) = atoi(value);
-			}
-			break;
+			case SQL_C_DOUBLE:
+				len = 8;
+				if (bind_size > 0)
+					*(SDOUBLE *) ((char *) rgbValue + (bind_row * bind_size)) = atof(value);
+				else
+					*((SDOUBLE *) rgbValue + bind_row) = atof(value);
+				break;
 
-		case SQL_C_USHORT:
-			len = 2;
-			if (bind_size > 0) {
-				*(UWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-			} else {
-				*((UWORD *)rgbValue + bind_row) = atoi(value);
-			}
-			break;
+			case SQL_C_SSHORT:
+			case SQL_C_SHORT:
+				len = 2;
+				if (bind_size > 0)
+					*(SWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+				else
+					*((SWORD *) rgbValue + bind_row) = atoi(value);
+				break;
 
-		case SQL_C_SLONG:
-		case SQL_C_LONG:
-			len = 4;
-			if (bind_size > 0) {
-				*(SDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
-			} else {
-				*((SDWORD *)rgbValue + bind_row) = atol(value);
-			}
-			break;
+			case SQL_C_USHORT:
+				len = 2;
+				if (bind_size > 0)
+					*(UWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+				else
+					*((UWORD *) rgbValue + bind_row) = atoi(value);
+				break;
 
-		case SQL_C_ULONG:
-			len = 4;
-			if (bind_size > 0) {
-				*(UDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
-			} else {
-				*((UDWORD *)rgbValue + bind_row) = atol(value);
-			}
-			break;
+			case SQL_C_SLONG:
+			case SQL_C_LONG:
+				len = 4;
+				if (bind_size > 0)
+					*(SDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
+				else
+					*((SDWORD *) rgbValue + bind_row) = atol(value);
+				break;
+
+			case SQL_C_ULONG:
+				len = 4;
+				if (bind_size > 0)
+					*(UDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
+				else
+					*((UDWORD *) rgbValue + bind_row) = atol(value);
+				break;
 
-		case SQL_C_BINARY:	
+			case SQL_C_BINARY:
 
-			/*	truncate if necessary */
-			/*	convert octal escapes to bytes */
+				/* truncate if necessary */
+				/* convert octal escapes to bytes */
 
-			len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
-			ptr = tempBuf;
+				len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
+				ptr = tempBuf;
 
-			if (stmt->current_col >= 0) {
+				if (stmt->current_col >= 0)
+				{
 
-				/*	No more data left for this column */
-				if (stmt->bindings[stmt->current_col].data_left == 0)
-					return COPY_NO_DATA_FOUND;
+					/* No more data left for this column */
+					if (stmt->bindings[stmt->current_col].data_left == 0)
+						return COPY_NO_DATA_FOUND;
 
-				/*	Second (or more) call to SQLGetData so move the pointer */
-				else if (stmt->bindings[stmt->current_col].data_left > 0) {
-					ptr += len - stmt->bindings[stmt->current_col].data_left;
-					len = stmt->bindings[stmt->current_col].data_left;
-				}
+					/*
+					 * Second (or more) call to SQLGetData so move the
+					 * pointer
+					 */
+					else if (stmt->bindings[stmt->current_col].data_left > 0)
+					{
+						ptr += len - stmt->bindings[stmt->current_col].data_left;
+						len = stmt->bindings[stmt->current_col].data_left;
+					}
 
-				/*	First call to SQLGetData so initialize data_left */
-				else	
-					stmt->bindings[stmt->current_col].data_left = len;
+					/* First call to SQLGetData so initialize data_left */
+					else
+						stmt->bindings[stmt->current_col].data_left = len;
 
-			}
+				}
 
-			if (cbValueMax > 0) {
-				copy_len = (len > cbValueMax) ? cbValueMax : len;
+				if (cbValueMax > 0)
+				{
+					copy_len = (len > cbValueMax) ? cbValueMax : len;
 
-				/*	Copy the data */
-				memcpy(rgbValueBindRow, ptr, copy_len);
+					/* Copy the data */
+					memcpy(rgbValueBindRow, ptr, copy_len);
 
-				/*	Adjust data_left for next time */
-				if (stmt->current_col >= 0) {
-					stmt->bindings[stmt->current_col].data_left -= copy_len;
+					/* Adjust data_left for next time */
+					if (stmt->current_col >= 0)
+						stmt->bindings[stmt->current_col].data_left -= copy_len;
 				}
-			}
 
-			/*	Finally, check for truncation so that proper status can be returned */
-			if ( len > cbValueMax)
-				result = COPY_RESULT_TRUNCATED;
+				/*
+				 * Finally, check for truncation so that proper status can
+				 * be returned
+				 */
+				if (len > cbValueMax)
+					result = COPY_RESULT_TRUNCATED;
 
-			mylog("SQL_C_BINARY: len = %d, copy_len = %d\n", len, copy_len);
-			break;
-			
-		default:
-			return COPY_UNSUPPORTED_TYPE;
+				mylog("SQL_C_BINARY: len = %d, copy_len = %d\n", len, copy_len);
+				break;
+
+			default:
+				return COPY_UNSUPPORTED_TYPE;
 		}
 	}
 
-    /* store the length of what was copied, if there's a place for it */
-    if(pcbValue) {
-        *(SDWORD *) ((char *)pcbValue + pcbValueOffset) = len;
-	}
+	/* store the length of what was copied, if there's a place for it */
+	if (pcbValue)
+		*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
 
 	return result;
 
@@ -648,91 +697,111 @@ mylog(") nval = %d\n", nval);
 int
 copy_statement_with_parameters(StatementClass *stmt)
 {
-static char *func="copy_statement_with_parameters";
-unsigned int opos, npos, oldstmtlen;
-char param_string[128], tmp[256], cbuf[TEXT_FIELD_SIZE+5];
-int param_number;
-Int2 param_ctype, param_sqltype;
-char *old_statement = stmt->statement;
-char *new_statement = stmt->stmt_with_params;
-SIMPLE_TIME st;
-time_t t = time(NULL);
-struct tm *tim;
-SDWORD used;
-char *buffer, *buf;
-char in_quote = FALSE;
-Oid  lobj_oid;
-int lobj_fd, retval;
-
-
-	if ( ! old_statement) {
+	static char *func = "copy_statement_with_parameters";
+	unsigned int opos,
+				npos,
+				oldstmtlen;
+	char		param_string[128],
+				tmp[256],
+				cbuf[TEXT_FIELD_SIZE + 5];
+	int			param_number;
+	Int2		param_ctype,
+				param_sqltype;
+	char	   *old_statement = stmt->statement;
+	char	   *new_statement = stmt->stmt_with_params;
+	SIMPLE_TIME st;
+	time_t		t = time(NULL);
+	struct tm  *tim;
+	SDWORD		used;
+	char	   *buffer,
+			   *buf;
+	char		in_quote = FALSE;
+	Oid			lobj_oid;
+	int			lobj_fd,
+				retval;
+
+
+	if (!old_statement)
+	{
 		SC_log_error(func, "No statement string", stmt);
 		return SQL_ERROR;
 	}
 
 	memset(&st, 0, sizeof(SIMPLE_TIME));
 
-	/*	Initialize current date */
+	/* Initialize current date */
 	tim = localtime(&t);
 	st.m = tim->tm_mon + 1;
 	st.d = tim->tm_mday;
 	st.y = tim->tm_year + 1900;
 
-	/*	If the application hasn't set a cursor name, then generate one */
-	if ( stmt->cursor_name[0] == '\0')
+	/* If the application hasn't set a cursor name, then generate one */
+	if (stmt->cursor_name[0] == '\0')
 		sprintf(stmt->cursor_name, "SQL_CUR%p", stmt);
 
-	/*	For selects, prepend a declare cursor to the statement */
-	if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch) {
+	/* For selects, prepend a declare cursor to the statement */
+	if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch)
+	{
 		sprintf(new_statement, "declare %s cursor for ", stmt->cursor_name);
 		npos = strlen(new_statement);
 	}
-	else {
+	else
+	{
 		new_statement[0] = '0';
 		npos = 0;
 	}
 
-    param_number = -1;
+	param_number = -1;
 
 	oldstmtlen = strlen(old_statement);
 #ifdef MULTIBYTE
-    multibyte_init();
+	multibyte_init();
 #endif
 
-    for (opos = 0; opos < oldstmtlen; opos++) {
+	for (opos = 0; opos < oldstmtlen; opos++)
+	{
 
-		/*	Squeeze carriage-return/linefeed pairs to linefeed only */
-		if (old_statement[opos] == '\r' && opos+1 < oldstmtlen &&
-			old_statement[opos+1] == '\n') {
+		/* Squeeze carriage-return/linefeed pairs to linefeed only */
+		if (old_statement[opos] == '\r' && opos + 1 < oldstmtlen &&
+			old_statement[opos + 1] == '\n')
 			continue;
-		}
 
-		/*	Handle literals (date, time, timestamp) and ODBC scalar functions */
+		/*
+		 * Handle literals (date, time, timestamp) and ODBC scalar
+		 * functions
+		 */
 #ifdef MULTIBYTE
-		else if (multibyte_char_check(old_statement[opos]) == 0 && old_statement[opos] == '{') {
+		else if (multibyte_char_check(old_statement[opos]) == 0 && old_statement[opos] == '{')
+		{
 #else
-		else if (old_statement[opos] == '{') {
+		else if (old_statement[opos] == '{')
+		{
 #endif
-			char *esc;
-			char *begin = &old_statement[opos + 1];
+			char	   *esc;
+			char	   *begin = &old_statement[opos + 1];
+
 #ifdef MULTIBYTE
-			char *end = multibyte_strchr(begin, '}');
+			char	   *end = multibyte_strchr(begin, '}');
+
 #else
-			char *end = strchr(begin, '}');
+			char	   *end = strchr(begin, '}');
+
 #endif
 
-			if ( ! end)
+			if (!end)
 				continue;
 
 			*end = '\0';
 
 			esc = convert_escape(begin);
-			if (esc) {
+			if (esc)
+			{
 				memcpy(&new_statement[npos], esc, strlen(esc));
 				npos += strlen(esc);
 			}
-			else {		/* it's not a valid literal so just copy */
-				*end = '}';	
+			else
+			{					/* it's not a valid literal so just copy */
+				*end = '}';
 				new_statement[npos++] = old_statement[opos];
 				continue;
 			}
@@ -744,12 +813,15 @@ int lobj_fd, retval;
 			continue;
 		}
 
-		/*	Can you have parameter markers inside of quotes?  I dont think so.
-			All the queries I've seen expect the driver to put quotes if needed.
-		*/
+		/*
+		 * Can you have parameter markers inside of quotes?  I dont think
+		 * so. All the queries I've seen expect the driver to put quotes
+		 * if needed.
+		 */
 		else if (old_statement[opos] == '?' && !in_quote)
-			;	/* ok */
-		else {
+			;					/* ok */
+		else
+		{
 			if (old_statement[opos] == '\'')
 				in_quote = (in_quote ? FALSE : TRUE);
 
@@ -760,390 +832,433 @@ int lobj_fd, retval;
 
 
 		/****************************************************/
-		/*       Its a '?' parameter alright                */
+		/* Its a '?' parameter alright				  */
 		/****************************************************/
 
 		param_number++;
 
-	    if (param_number >= stmt->parameters_allocated)
+		if (param_number >= stmt->parameters_allocated)
 			break;
 
-		/*	Assign correct buffers based on data at exec param or not */
-		if ( stmt->parameters[param_number].data_at_exec) {
+		/* Assign correct buffers based on data at exec param or not */
+		if (stmt->parameters[param_number].data_at_exec)
+		{
 			used = stmt->parameters[param_number].EXEC_used ? *stmt->parameters[param_number].EXEC_used : SQL_NTS;
 			buffer = stmt->parameters[param_number].EXEC_buffer;
 		}
-		else {
+		else
+		{
 			used = stmt->parameters[param_number].used ? *stmt->parameters[param_number].used : SQL_NTS;
 			buffer = stmt->parameters[param_number].buffer;
 		}
 
-		/*	Handle NULL parameter data */
-		if (used == SQL_NULL_DATA) {
+		/* Handle NULL parameter data */
+		if (used == SQL_NULL_DATA)
+		{
 			strcpy(&new_statement[npos], "NULL");
 			npos += 4;
 			continue;
 		}
 
-		/*	If no buffer, and it's not null, then what the hell is it? 
-			Just leave it alone then.
-		*/
-		if ( ! buffer) {
+		/*
+		 * If no buffer, and it's not null, then what the hell is it? Just
+		 * leave it alone then.
+		 */
+		if (!buffer)
+		{
 			new_statement[npos++] = '?';
 			continue;
 		}
 
 		param_ctype = stmt->parameters[param_number].CType;
 		param_sqltype = stmt->parameters[param_number].SQLType;
-		
+
 		mylog("copy_statement_with_params: from(fcType)=%d, to(fSqlType)=%d\n", param_ctype, param_sqltype);
-		
+
 		/* replace DEFAULT with something we can use */
-		if(param_ctype == SQL_C_DEFAULT)
+		if (param_ctype == SQL_C_DEFAULT)
 			param_ctype = sqltype_to_default_ctype(param_sqltype);
 
 		buf = NULL;
 		param_string[0] = '\0';
 		cbuf[0] = '\0';
 
-		
-		/*	Convert input C type to a neutral format */
-		switch(param_ctype) {
-		case SQL_C_BINARY:
-		case SQL_C_CHAR:
-			buf = buffer;
-			break;
 
-		case SQL_C_DOUBLE:
-			sprintf(param_string, "%f", 
-				 *((SDOUBLE *) buffer));
-			break;
+		/* Convert input C type to a neutral format */
+		switch (param_ctype)
+		{
+			case SQL_C_BINARY:
+			case SQL_C_CHAR:
+				buf = buffer;
+				break;
 
-		case SQL_C_FLOAT:
-			sprintf(param_string, "%f", 
-				 *((SFLOAT *) buffer));
-			break;
+			case SQL_C_DOUBLE:
+				sprintf(param_string, "%f",
+						*((SDOUBLE *) buffer));
+				break;
 
-		case SQL_C_SLONG:
-		case SQL_C_LONG:
-			sprintf(param_string, "%ld",
-				*((SDWORD *) buffer));
-			break;
+			case SQL_C_FLOAT:
+				sprintf(param_string, "%f",
+						*((SFLOAT *) buffer));
+				break;
 
-		case SQL_C_SSHORT:
-		case SQL_C_SHORT:
-			sprintf(param_string, "%d",
-				*((SWORD *) buffer));
-			break;
+			case SQL_C_SLONG:
+			case SQL_C_LONG:
+				sprintf(param_string, "%ld",
+						*((SDWORD *) buffer));
+				break;
 
-		case SQL_C_STINYINT:
-		case SQL_C_TINYINT:
-			sprintf(param_string, "%d",
-				*((SCHAR *) buffer));
-			break;
+			case SQL_C_SSHORT:
+			case SQL_C_SHORT:
+				sprintf(param_string, "%d",
+						*((SWORD *) buffer));
+				break;
 
-		case SQL_C_ULONG:
-			sprintf(param_string, "%lu",
-				*((UDWORD *) buffer));
-			break;
+			case SQL_C_STINYINT:
+			case SQL_C_TINYINT:
+				sprintf(param_string, "%d",
+						*((SCHAR *) buffer));
+				break;
 
-		case SQL_C_USHORT:
-			sprintf(param_string, "%u",
-				*((UWORD *) buffer));
-			break;
+			case SQL_C_ULONG:
+				sprintf(param_string, "%lu",
+						*((UDWORD *) buffer));
+				break;
 
-		case SQL_C_UTINYINT:
-			sprintf(param_string, "%u",
-				*((UCHAR *) buffer));
-			break;
+			case SQL_C_USHORT:
+				sprintf(param_string, "%u",
+						*((UWORD *) buffer));
+				break;
 
-		case SQL_C_BIT: {
-			int i = *((UCHAR *) buffer);
-			
-			sprintf(param_string, "%d", i ? 1 : 0);
-			break;
-						}
+			case SQL_C_UTINYINT:
+				sprintf(param_string, "%u",
+						*((UCHAR *) buffer));
+				break;
 
-		case SQL_C_DATE: {
-			DATE_STRUCT *ds = (DATE_STRUCT *) buffer;
-			st.m = ds->month;
-			st.d = ds->day;
-			st.y = ds->year;
+			case SQL_C_BIT:
+				{
+					int			i = *((UCHAR *) buffer);
 
-			break;
-						 }
+					sprintf(param_string, "%d", i ? 1 : 0);
+					break;
+				}
 
-		case SQL_C_TIME: {
-			TIME_STRUCT *ts = (TIME_STRUCT *) buffer;
-			st.hh = ts->hour;
-			st.mm = ts->minute;
-			st.ss = ts->second;
+			case SQL_C_DATE:
+				{
+					DATE_STRUCT *ds = (DATE_STRUCT *) buffer;
 
-			break;
-						 }
+					st.m = ds->month;
+					st.d = ds->day;
+					st.y = ds->year;
 
-		case SQL_C_TIMESTAMP: {
-			TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer;
-			st.m = tss->month;
-			st.d = tss->day;
-			st.y = tss->year;
-			st.hh = tss->hour;
-			st.mm = tss->minute;
-			st.ss = tss->second;
+					break;
+				}
 
-			mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
+			case SQL_C_TIME:
+				{
+					TIME_STRUCT *ts = (TIME_STRUCT *) buffer;
 
-			break;
+					st.hh = ts->hour;
+					st.mm = ts->minute;
+					st.ss = ts->second;
 
-							  }
-		default:
-			/* error */
-			stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
-			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			new_statement[npos] = '\0';   /* just in case */
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
-		}
+					break;
+				}
 
-		/*	Now that the input data is in a neutral format, convert it to
-			the desired output format (sqltype)
-		*/
+			case SQL_C_TIMESTAMP:
+				{
+					TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer;
 
-		switch(param_sqltype) {
-		case SQL_CHAR:
-		case SQL_VARCHAR:
-		case SQL_LONGVARCHAR:
+					st.m = tss->month;
+					st.d = tss->day;
+					st.y = tss->year;
+					st.hh = tss->hour;
+					st.mm = tss->minute;
+					st.ss = tss->second;
 
-			new_statement[npos++] = '\'';	/*    Open Quote */
+					mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
 
-			/* it was a SQL_C_CHAR */
-			if (buf) {
-				convert_special_chars(buf, &new_statement[npos], used);
-				npos += strlen(&new_statement[npos]);
-			}
+					break;
 
-			/* it was a numeric type */
-			else if (param_string[0] != '\0') {	
-				strcpy(&new_statement[npos], param_string);
-				npos += strlen(param_string);
-			}
+				}
+			default:
+				/* error */
+				stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
+				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+				new_statement[npos] = '\0';		/* just in case */
+				SC_log_error(func, "", stmt);
+				return SQL_ERROR;
+		}
 
-			/* it was date,time,timestamp -- use m,d,y,hh,mm,ss */
-			else {
-				sprintf(tmp, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
-					st.y, st.m, st.d, st.hh, st.mm, st.ss);
+		/*
+		 * Now that the input data is in a neutral format, convert it to
+		 * the desired output format (sqltype)
+		 */
 
-				strcpy(&new_statement[npos], tmp);
-				npos += strlen(tmp);
-			}
+		switch (param_sqltype)
+		{
+			case SQL_CHAR:
+			case SQL_VARCHAR:
+			case SQL_LONGVARCHAR:
 
-			new_statement[npos++] = '\'';	/*    Close Quote */
+				new_statement[npos++] = '\'';	/* Open Quote */
 
-			break;
+				/* it was a SQL_C_CHAR */
+				if (buf)
+				{
+					convert_special_chars(buf, &new_statement[npos], used);
+					npos += strlen(&new_statement[npos]);
+				}
 
-		case SQL_DATE:
-			if (buf) {  /* copy char data to time */
-				my_strcpy(cbuf, sizeof(cbuf), buf, used);
-				parse_datetime(cbuf, &st);
-			}
+				/* it was a numeric type */
+				else if (param_string[0] != '\0')
+				{
+					strcpy(&new_statement[npos], param_string);
+					npos += strlen(param_string);
+				}
 
-			sprintf(tmp, "'%.4d-%.2d-%.2d'", st.y, st.m, st.d);
+				/* it was date,time,timestamp -- use m,d,y,hh,mm,ss */
+				else
+				{
+					sprintf(tmp, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
+							st.y, st.m, st.d, st.hh, st.mm, st.ss);
 
-			strcpy(&new_statement[npos], tmp);
-			npos += strlen(tmp);
-			break;
+					strcpy(&new_statement[npos], tmp);
+					npos += strlen(tmp);
+				}
 
-		case SQL_TIME:
-			if (buf) {  /* copy char data to time */
-				my_strcpy(cbuf, sizeof(cbuf), buf, used);
-				parse_datetime(cbuf, &st);
-			}
+				new_statement[npos++] = '\'';	/* Close Quote */
 
-			sprintf(tmp, "'%.2d:%.2d:%.2d'", st.hh, st.mm, st.ss);
+				break;
 
-			strcpy(&new_statement[npos], tmp);
-			npos += strlen(tmp);
-			break;
+			case SQL_DATE:
+				if (buf)
+				{				/* copy char data to time */
+					my_strcpy(cbuf, sizeof(cbuf), buf, used);
+					parse_datetime(cbuf, &st);
+				}
 
-		case SQL_TIMESTAMP:
+				sprintf(tmp, "'%.4d-%.2d-%.2d'", st.y, st.m, st.d);
 
-			if (buf) {
-				my_strcpy(cbuf, sizeof(cbuf), buf, used);
-				parse_datetime(cbuf, &st);
-			}
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
+				break;
 
-			sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'",
-				st.y, st.m, st.d, st.hh, st.mm, st.ss);
+			case SQL_TIME:
+				if (buf)
+				{				/* copy char data to time */
+					my_strcpy(cbuf, sizeof(cbuf), buf, used);
+					parse_datetime(cbuf, &st);
+				}
 
-			strcpy(&new_statement[npos], tmp);
-			npos += strlen(tmp);
+				sprintf(tmp, "'%.2d:%.2d:%.2d'", st.hh, st.mm, st.ss);
 
-			break;
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
+				break;
 
-		case SQL_BINARY:
-		case SQL_VARBINARY:			/* non-ascii characters should be converted to octal */
-			new_statement[npos++] = '\'';	/*    Open Quote */
+			case SQL_TIMESTAMP:
 
-			mylog("SQL_VARBINARY: about to call convert_to_pgbinary, used = %d\n", used);
+				if (buf)
+				{
+					my_strcpy(cbuf, sizeof(cbuf), buf, used);
+					parse_datetime(cbuf, &st);
+				}
 
-			npos += convert_to_pgbinary(buf, &new_statement[npos], used);
+				sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'",
+						st.y, st.m, st.d, st.hh, st.mm, st.ss);
 
-			new_statement[npos++] = '\'';	/*    Close Quote */
-			
-			break;
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
 
-		case SQL_LONGVARBINARY:		
+				break;
 
-			if ( stmt->parameters[param_number].data_at_exec) {
+			case SQL_BINARY:
+			case SQL_VARBINARY:/* non-ascii characters should be
+								 * converted to octal */
+				new_statement[npos++] = '\'';	/* Open Quote */
 
-				lobj_oid = stmt->parameters[param_number].lobj_oid;
+				mylog("SQL_VARBINARY: about to call convert_to_pgbinary, used = %d\n", used);
 
-			}
-			else {
-  
-				/* begin transaction if needed */
-				if(!CC_is_in_trans(stmt->hdbc)) {
-					QResultClass *res;
-					char ok;
-
-					res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-					if (!res) {
-						stmt->errormsg = "Could not begin (in-line) a transaction";
-						stmt->errornumber = STMT_EXEC_ERROR;
-						SC_log_error(func, "", stmt);
-						return SQL_ERROR;
-					}
-					ok = QR_command_successful(res);
-					QR_Destructor(res);
-					if (!ok) {
-						stmt->errormsg = "Could not begin (in-line) a transaction";
-						stmt->errornumber = STMT_EXEC_ERROR;
-						SC_log_error(func, "", stmt);
-						return SQL_ERROR;
-					}
+				npos += convert_to_pgbinary(buf, &new_statement[npos], used);
 
-					CC_set_in_trans(stmt->hdbc);
-				}
+				new_statement[npos++] = '\'';	/* Close Quote */
 
-				/*	store the oid */
-				lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
-				if (lobj_oid == 0) {
-					stmt->errornumber = STMT_EXEC_ERROR;
-					stmt->errormsg = "Couldnt create (in-line) large object.";
-					SC_log_error(func, "", stmt);
-					return SQL_ERROR;
-				}
+				break;
 
-				/*	store the fd */
-				lobj_fd = lo_open(stmt->hdbc, lobj_oid, INV_WRITE);
-				if ( lobj_fd < 0) {
-					stmt->errornumber = STMT_EXEC_ERROR;
-					stmt->errormsg = "Couldnt open (in-line) large object for writing.";
-					SC_log_error(func, "", stmt);
-					return SQL_ERROR;
-				}
+			case SQL_LONGVARBINARY:
+
+				if (stmt->parameters[param_number].data_at_exec)
+				{
 
-				retval = lo_write(stmt->hdbc, lobj_fd, buffer, used);
+					lobj_oid = stmt->parameters[param_number].lobj_oid;
 
-				lo_close(stmt->hdbc, lobj_fd);
+				}
+				else
+				{
+
+					/* begin transaction if needed */
+					if (!CC_is_in_trans(stmt->hdbc))
+					{
+						QResultClass *res;
+						char		ok;
+
+						res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
+						if (!res)
+						{
+							stmt->errormsg = "Could not begin (in-line) a transaction";
+							stmt->errornumber = STMT_EXEC_ERROR;
+							SC_log_error(func, "", stmt);
+							return SQL_ERROR;
+						}
+						ok = QR_command_successful(res);
+						QR_Destructor(res);
+						if (!ok)
+						{
+							stmt->errormsg = "Could not begin (in-line) a transaction";
+							stmt->errornumber = STMT_EXEC_ERROR;
+							SC_log_error(func, "", stmt);
+							return SQL_ERROR;
+						}
 
-				/* commit transaction if needed */
-				if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
-					QResultClass *res;
-					char ok;
+						CC_set_in_trans(stmt->hdbc);
+					}
 
-					res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-					if (!res) {
-						stmt->errormsg = "Could not commit (in-line) a transaction";
+					/* store the oid */
+					lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
+					if (lobj_oid == 0)
+					{
 						stmt->errornumber = STMT_EXEC_ERROR;
+						stmt->errormsg = "Couldnt create (in-line) large object.";
 						SC_log_error(func, "", stmt);
 						return SQL_ERROR;
 					}
-					ok = QR_command_successful(res);
-					QR_Destructor(res);
-					if (!ok) {
-						stmt->errormsg = "Could not commit (in-line) a transaction";
+
+					/* store the fd */
+					lobj_fd = lo_open(stmt->hdbc, lobj_oid, INV_WRITE);
+					if (lobj_fd < 0)
+					{
 						stmt->errornumber = STMT_EXEC_ERROR;
+						stmt->errormsg = "Couldnt open (in-line) large object for writing.";
 						SC_log_error(func, "", stmt);
 						return SQL_ERROR;
 					}
 
-					CC_set_no_trans(stmt->hdbc);
-				}
-			}
+					retval = lo_write(stmt->hdbc, lobj_fd, buffer, used);
 
-			/*	the oid of the large object -- just put that in for the
-				parameter marker -- the data has already been sent to the large object
-			*/
-			sprintf(param_string, "'%d'", lobj_oid);
-			strcpy(&new_statement[npos], param_string);
-			npos += strlen(param_string);
+					lo_close(stmt->hdbc, lobj_fd);
 
-			break;
+					/* commit transaction if needed */
+					if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
+					{
+						QResultClass *res;
+						char		ok;
 
-			/*	because of no conversion operator for bool and int4, SQL_BIT */
-			/*	must be quoted (0 or 1 is ok to use inside the quotes) */
+						res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
+						if (!res)
+						{
+							stmt->errormsg = "Could not commit (in-line) a transaction";
+							stmt->errornumber = STMT_EXEC_ERROR;
+							SC_log_error(func, "", stmt);
+							return SQL_ERROR;
+						}
+						ok = QR_command_successful(res);
+						QR_Destructor(res);
+						if (!ok)
+						{
+							stmt->errormsg = "Could not commit (in-line) a transaction";
+							stmt->errornumber = STMT_EXEC_ERROR;
+							SC_log_error(func, "", stmt);
+							return SQL_ERROR;
+						}
 
-		case SQL_REAL:
-			if (buf)
-            			my_strcpy(param_string, sizeof(param_string), buf, used);
-			sprintf(tmp, "'%s'::float4", param_string);
-			strcpy(&new_statement[npos], tmp);
-			npos += strlen(tmp);
-			break;
-		case SQL_FLOAT:
-		case SQL_DOUBLE:
-			if (buf)
-            			my_strcpy(param_string, sizeof(param_string), buf, used);
-			sprintf(tmp, "'%s'::float8", param_string);
-			strcpy(&new_statement[npos], tmp);
-			npos += strlen(tmp);
-			break;
-		case SQL_NUMERIC:
-			if (buf)
-			{
-				cbuf[0] = '\'';
-				my_strcpy(cbuf + 1, sizeof(cbuf) - 12, buf, used);	/* 12 = 1('\'') + strlen("'::numeric") + 1('\0') */
-				strcat(cbuf, "'::numeric");
-			}
-			else
-				sprintf(cbuf, "'%s'::numeric", param_string);
-			my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos - 1, cbuf, strlen(cbuf));
-			npos += strlen(&new_statement[npos]);
-			break;
-		default:		/* a numeric type or SQL_BIT */
-			if (param_sqltype == SQL_BIT)
-				new_statement[npos++] = '\'';	/*    Open Quote */
+						CC_set_no_trans(stmt->hdbc);
+					}
+				}
 
-			if (buf) {
-				my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos, buf, used);
-				npos += strlen(&new_statement[npos]);
-			}
-			else {
+				/*
+				 * the oid of the large object -- just put that in for the
+				 * parameter marker -- the data has already been sent to
+				 * the large object
+				 */
+				sprintf(param_string, "'%d'", lobj_oid);
 				strcpy(&new_statement[npos], param_string);
 				npos += strlen(param_string);
-			}
 
-			if (param_sqltype == SQL_BIT)
-				new_statement[npos++] = '\'';	/*    Close Quote */
+				break;
+
+				/*
+				 * because of no conversion operator for bool and int4,
+				 * SQL_BIT
+				 */
+				/* must be quoted (0 or 1 is ok to use inside the quotes) */
 
-			break;
+			case SQL_REAL:
+				if (buf)
+					my_strcpy(param_string, sizeof(param_string), buf, used);
+				sprintf(tmp, "'%s'::float4", param_string);
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
+				break;
+			case SQL_FLOAT:
+			case SQL_DOUBLE:
+				if (buf)
+					my_strcpy(param_string, sizeof(param_string), buf, used);
+				sprintf(tmp, "'%s'::float8", param_string);
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
+				break;
+			case SQL_NUMERIC:
+				if (buf)
+				{
+					cbuf[0] = '\'';
+					my_strcpy(cbuf + 1, sizeof(cbuf) - 12, buf, used);	/* 12 = 1('\'') +
+																		 * strlen("'::numeric")
+																		 * + 1('\0') */
+					strcat(cbuf, "'::numeric");
+				}
+				else
+					sprintf(cbuf, "'%s'::numeric", param_string);
+				my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos - 1, cbuf, strlen(cbuf));
+				npos += strlen(&new_statement[npos]);
+				break;
+			default:			/* a numeric type or SQL_BIT */
+				if (param_sqltype == SQL_BIT)
+					new_statement[npos++] = '\'';		/* Open Quote */
+
+				if (buf)
+				{
+					my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos, buf, used);
+					npos += strlen(&new_statement[npos]);
+				}
+				else
+				{
+					strcpy(&new_statement[npos], param_string);
+					npos += strlen(param_string);
+				}
+
+				if (param_sqltype == SQL_BIT)
+					new_statement[npos++] = '\'';		/* Close Quote */
+
+				break;
 
 		}
 
-	}	/* end, for */
+	}							/* end, for */
 
 	/* make sure new_statement is always null-terminated */
 	new_statement[npos] = '\0';
 
 
-	if(stmt->hdbc->DriverToDataSource != NULL) {
-		int length = strlen (new_statement);
-		stmt->hdbc->DriverToDataSource (stmt->hdbc->translation_option,
-										SQL_CHAR,
-										new_statement, length,
-										new_statement, length, NULL,
-										NULL, 0, NULL);
+	if (stmt->hdbc->DriverToDataSource != NULL)
+	{
+		int			length = strlen(new_statement);
+
+		stmt->hdbc->DriverToDataSource(stmt->hdbc->translation_option,
+									   SQL_CHAR,
+									   new_statement, length,
+									   new_statement, length, NULL,
+									   NULL, 0, NULL);
 	}
 
 
@@ -1153,10 +1268,10 @@ int lobj_fd, retval;
 char *
 mapFunction(char *func)
 {
-int i;
+	int			i;
 
 	for (i = 0; mapFuncs[i][0]; i++)
-		if ( ! stricmp(mapFuncs[i][0], func))
+		if (!stricmp(mapFuncs[i][0], func))
 			return mapFuncs[i][1];
 
 	return NULL;
@@ -1168,34 +1283,40 @@ int i;
 char *
 convert_escape(char *value)
 {
-static char escape[1024];
-char key[33];
+	static char escape[1024];
+	char		key[33];
 
 	/* Separate off the key, skipping leading and trailing whitespace */
-	while ((*value != '\0') && isspace((unsigned char) *value)) value++;
+	while ((*value != '\0') && isspace((unsigned char) *value))
+		value++;
 	sscanf(value, "%32s", key);
-	while ((*value != '\0') && (! isspace((unsigned char) *value))) value++;
-	while ((*value != '\0') && isspace((unsigned char) *value)) value++;
+	while ((*value != '\0') && (!isspace((unsigned char) *value)))
+		value++;
+	while ((*value != '\0') && isspace((unsigned char) *value))
+		value++;
 
 	mylog("convert_escape: key='%s', val='%s'\n", key, value);
 
-	if ( (strcmp(key, "d") == 0) ||
-		 (strcmp(key, "t") == 0) ||
-		 (strcmp(key, "ts") == 0)) {
+	if ((strcmp(key, "d") == 0) ||
+		(strcmp(key, "t") == 0) ||
+		(strcmp(key, "ts") == 0))
+	{
 		/* Literal; return the escape part as-is */
-		strncpy(escape, value, sizeof(escape)-1);
+		strncpy(escape, value, sizeof(escape) - 1);
 	}
-	else if (strcmp(key, "fn") == 0) {
-		/* Function invocation
-		 * Separate off the func name,
-		 * skipping trailing whitespace.
+	else if (strcmp(key, "fn") == 0)
+	{
+
+		/*
+		 * Function invocation Separate off the func name, skipping
+		 * trailing whitespace.
 		 */
-		char *funcEnd = value;
-		char svchar;
-		char *mapFunc;
+		char	   *funcEnd = value;
+		char		svchar;
+		char	   *mapFunc;
 
 		while ((*funcEnd != '\0') && (*funcEnd != '(') &&
-			   (! isspace((unsigned char) *funcEnd)))
+			   (!isspace((unsigned char) *funcEnd)))
 			funcEnd++;
 		svchar = *funcEnd;
 		*funcEnd = '\0';
@@ -1204,28 +1325,33 @@ char key[33];
 		while ((*funcEnd != '\0') && isspace((unsigned char) *funcEnd))
 			funcEnd++;
 
-		/* We expect left parenthesis here,
-		 * else return fn body as-is since it is
-		 * one of those "function constants".
+		/*
+		 * We expect left parenthesis here, else return fn body as-is
+		 * since it is one of those "function constants".
 		 */
-		if (*funcEnd != '(') {
-			strncpy(escape, value, sizeof(escape)-1);
+		if (*funcEnd != '(')
+		{
+			strncpy(escape, value, sizeof(escape) - 1);
 			return escape;
 		}
 		mapFunc = mapFunction(key);
-		/* We could have mapFunction() return key if not in table...
-		 * - thomas 2000-04-03
+
+		/*
+		 * We could have mapFunction() return key if not in table... -
+		 * thomas 2000-04-03
 		 */
-		if (mapFunc == NULL) {
+		if (mapFunc == NULL)
+		{
 			/* If unrecognized function name, return fn body as-is */
-			strncpy(escape, value, sizeof(escape)-1);
+			strncpy(escape, value, sizeof(escape) - 1);
 			return escape;
 		}
 		/* copy mapped name and remaining input string */
 		strcpy(escape, mapFunc);
-		strncat(escape, funcEnd, sizeof(escape)-1-strlen(mapFunc));
+		strncat(escape, funcEnd, sizeof(escape) - 1 - strlen(mapFunc));
 	}
-	else {
+	else
+	{
 		/* Bogus key, leave untranslated */
 		return NULL;
 	}
@@ -1238,11 +1364,13 @@ char key[33];
 char *
 convert_money(char *s)
 {
-size_t i = 0, out = 0;
+	size_t		i = 0,
+				out = 0;
 
-	for (i = 0; i < strlen(s); i++) {
+	for (i = 0; i < strlen(s); i++)
+	{
 		if (s[i] == '$' || s[i] == ',' || s[i] == ')')
-			; /* skip these characters */
+			;					/* skip these characters */
 		else if (s[i] == '(')
 			s[out++] = '-';
 		else
@@ -1259,17 +1387,23 @@ size_t i = 0, out = 0;
 char
 parse_datetime(char *buf, SIMPLE_TIME *st)
 {
-int y,m,d,hh,mm,ss;
-int nf;
-	
+	int			y,
+				m,
+				d,
+				hh,
+				mm,
+				ss;
+	int			nf;
+
 	y = m = d = hh = mm = ss = 0;
 
-	if (buf[4] == '-')	/* year first */
-		nf = sscanf(buf, "%4d-%2d-%2d %2d:%2d:%2d", &y,&m,&d,&hh,&mm,&ss);
+	if (buf[4] == '-')			/* year first */
+		nf = sscanf(buf, "%4d-%2d-%2d %2d:%2d:%2d", &y, &m, &d, &hh, &mm, &ss);
 	else
-		nf = sscanf(buf, "%2d-%2d-%4d %2d:%2d:%2d", &m,&d,&y,&hh,&mm,&ss);
+		nf = sscanf(buf, "%2d-%2d-%4d %2d:%2d:%2d", &m, &d, &y, &hh, &mm, &ss);
 
-	if (nf == 5 || nf == 6) {
+	if (nf == 5 || nf == 6)
+	{
 		st->y = y;
 		st->m = m;
 		st->d = d;
@@ -1280,12 +1414,13 @@ int nf;
 		return TRUE;
 	}
 
-	if (buf[4] == '-')	/* year first */
+	if (buf[4] == '-')			/* year first */
 		nf = sscanf(buf, "%4d-%2d-%2d", &y, &m, &d);
 	else
 		nf = sscanf(buf, "%2d-%2d-%4d", &m, &d, &y);
 
-	if (nf == 3) {
+	if (nf == 3)
+	{
 		st->y = y;
 		st->m = m;
 		st->d = d;
@@ -1294,7 +1429,8 @@ int nf;
 	}
 
 	nf = sscanf(buf, "%2d:%2d:%2d", &hh, &mm, &ss);
-	if (nf == 2 || nf == 3) {
+	if (nf == 2 || nf == 3)
+	{
 		st->hh = hh;
 		st->mm = mm;
 		st->ss = ss;
@@ -1309,12 +1445,16 @@ int nf;
 int
 convert_linefeeds(char *si, char *dst, size_t max)
 {
-size_t i = 0, out = 0;
+	size_t		i = 0,
+				out = 0;
 
-	for (i = 0; i < strlen(si) && out < max - 1; i++) {
-		if (si[i] == '\n') {
-			/*	Only add the carriage-return if needed */
-			if (i > 0 && si[i-1] == '\r') {
+	for (i = 0; i < strlen(si) && out < max - 1; i++)
+	{
+		if (si[i] == '\n')
+		{
+			/* Only add the carriage-return if needed */
+			if (i > 0 && si[i - 1] == '\r')
+			{
 				dst[out++] = si[i];
 				continue;
 			}
@@ -1329,15 +1469,17 @@ size_t i = 0, out = 0;
 	return out;
 }
 
-/*	Change carriage-return/linefeed to just linefeed 
+/*	Change carriage-return/linefeed to just linefeed
 	Plus, escape any special characters.
 */
 char *
 convert_special_chars(char *si, char *dst, int used)
 {
-size_t i = 0, out = 0, max;
-static char sout[TEXT_FIELD_SIZE+5];
-char *p;
+	size_t		i = 0,
+				out = 0,
+				max;
+	static char sout[TEXT_FIELD_SIZE + 5];
+	char	   *p;
 
 	if (dst)
 		p = dst;
@@ -1354,8 +1496,9 @@ char *p;
 	multibyte_init();
 #endif
 
-	for (i = 0; i < max; i++) {
-		if (si[i] == '\r' && i+1 < strlen(si) && si[i+1] == '\n') 
+	for (i = 0; i < max; i++)
+	{
+		if (si[i] == '\r' && i + 1 < strlen(si) && si[i + 1] == '\n')
 			continue;
 #ifdef MULTIBYTE
 		else if (multibyte_char_check(si[i]) == 0 && (si[i] == '\'' || si[i] == '\\'))
@@ -1383,11 +1526,11 @@ convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax)
 unsigned int
 conv_from_octal(unsigned char *s)
 {
-int i, y=0;
+	int			i,
+				y = 0;
 
-	for (i = 1; i <= 3; i++) {
-		y += (s[i] - 48) * (int) pow(8, 3-i);
-	}
+	for (i = 1; i <= 3; i++)
+		y += (s[i] - 48) * (int) pow(8, 3 - i);
 
 	return y;
 
@@ -1396,18 +1539,21 @@ int i, y=0;
 unsigned int
 conv_from_hex(unsigned char *s)
 {
-int i, y=0, val;
+	int			i,
+				y = 0,
+				val;
 
-	for (i = 1; i <= 2; i++) {
+	for (i = 1; i <= 2; i++)
+	{
 
-        if (s[i] >= 'a' && s[i] <= 'f')
-            val = s[i] - 'a' + 10;
-        else if (s[i] >= 'A' && s[i] <= 'F')
-            val = s[i] - 'A' + 10;
-        else
-            val = s[i] - '0';
+		if (s[i] >= 'a' && s[i] <= 'f')
+			val = s[i] - 'a' + 10;
+		else if (s[i] >= 'A' && s[i] <= 'F')
+			val = s[i] - 'A' + 10;
+		else
+			val = s[i] - '0';
 
-		y += val * (int) pow(16, 2-i);
+		y += val * (int) pow(16, 2 - i);
 	}
 
 	return y;
@@ -1417,23 +1563,24 @@ int i, y=0, val;
 int
 convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax)
 {
-size_t i;
-int o=0;
+	size_t		i;
+	int			o = 0;
 
-	
-	for (i = 0; i < strlen(value); ) {
-		if (value[i] == '\\') {
+
+	for (i = 0; i < strlen(value);)
+	{
+		if (value[i] == '\\')
+		{
 			rgbValue[o] = conv_from_octal(&value[i]);
 			i += 4;
 		}
-		else {
+		else
 			rgbValue[o] = value[i++];
-		}
 		mylog("convert_from_pgbinary: i=%d, rgbValue[%d] = %d, %c\n", i, o, rgbValue[o], rgbValue[o]);
 		o++;
 	}
 
-	rgbValue[o] = '\0';	/* extra protection */
+	rgbValue[o] = '\0';			/* extra protection */
 
 	return o;
 }
@@ -1442,14 +1589,15 @@ int o=0;
 char *
 conv_to_octal(unsigned char val)
 {
-int i;
-static char x[6];
+	int			i;
+	static char x[6];
 
 	x[0] = '\\';
 	x[1] = '\\';
 	x[5] = '\0';
 
-	for (i = 4; i > 1; i--) {
+	for (i = 4; i > 1; i--)
+	{
 		x[i] = (val & 7) + 48;
 		val >>= 3;
 	}
@@ -1461,16 +1609,18 @@ static char x[6];
 int
 convert_to_pgbinary(unsigned char *in, char *out, int len)
 {
-int i, o=0;
+	int			i,
+				o = 0;
 
 
-	for (i = 0; i < len; i++) {
+	for (i = 0; i < len; i++)
+	{
 		mylog("convert_to_pgbinary: in[%d] = %d, %c\n", i, in[i], in[i]);
-		if ( isalnum(in[i]) || in[i] == ' ') {
+		if (isalnum(in[i]) || in[i] == ' ')
 			out[o++] = in[i];
-		}
-		else {
-			strcpy(&out[o], conv_to_octal(in[i])); 
+		else
+		{
+			strcpy(&out[o], conv_to_octal(in[i]));
 			o += 5;
 		}
 
@@ -1485,17 +1635,20 @@ int i, o=0;
 void
 encode(char *in, char *out)
 {
-	unsigned int i, o = 0;
+	unsigned int i,
+				o = 0;
 
-	for (i = 0; i < strlen(in); i++) {
-		if ( in[i] == '+') {
+	for (i = 0; i < strlen(in); i++)
+	{
+		if (in[i] == '+')
+		{
 			sprintf(&out[o], "%%2B");
 			o += 3;
 		}
-		else if ( isspace((unsigned char) in[i])) {
+		else if (isspace((unsigned char) in[i]))
 			out[o++] = '+';
-		}
-		else if ( ! isalnum((unsigned char) in[i])) {
+		else if (!isalnum((unsigned char) in[i]))
+		{
 			sprintf(&out[o], "%%%02x", (unsigned char) in[i]);
 			o += 3;
 		}
@@ -1509,14 +1662,17 @@ encode(char *in, char *out)
 void
 decode(char *in, char *out)
 {
-unsigned int i, o = 0;
+	unsigned int i,
+				o = 0;
 
-	for (i = 0; i < strlen(in); i++) { 
+	for (i = 0; i < strlen(in); i++)
+	{
 		if (in[i] == '+')
 			out[o++] = ' ';
-		else if (in[i] == '%') {
+		else if (in[i] == '%')
+		{
 			sprintf(&out[o++], "%c", conv_from_hex(&in[i]));
-			i+=2;
+			i += 2;
 		}
 		else
 			out[o++] = in[i];
@@ -1536,45 +1692,53 @@ unsigned int i, o = 0;
 
 	CURRENTLY, ONLY LONGVARBINARY is handled, since that is the only
 	data type currently mapped to a PG_TYPE_LO.  But, if any other types
-	are desired to map to a large object (PG_TYPE_LO), then that would 
+	are desired to map to a large object (PG_TYPE_LO), then that would
 	need to be handled here.  For example, LONGVARCHAR could possibly be
 	mapped to PG_TYPE_LO someday, instead of PG_TYPE_TEXT as it is now.
 */
 int
-convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue, 
+convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 		   SDWORD cbValueMax, SDWORD *pcbValue)
 {
-	Oid oid;
-	int retval, result, left = -1;
+	Oid			oid;
+	int			retval,
+				result,
+				left = -1;
 	BindInfoClass *bindInfo = NULL;
 
 
 /*	If using SQLGetData, then current_col will be set */
-	if (stmt->current_col >= 0) {
+	if (stmt->current_col >= 0)
+	{
 		bindInfo = &stmt->bindings[stmt->current_col];
 		left = bindInfo->data_left;
 	}
 
-	/*	if this is the first call for this column,
-		open the large object for reading 
-	*/
+	/*
+	 * if this is the first call for this column, open the large object
+	 * for reading
+	 */
 
-	if ( ! bindInfo || bindInfo->data_left == -1) {
+	if (!bindInfo || bindInfo->data_left == -1)
+	{
 
 		/* begin transaction if needed */
-		if(!CC_is_in_trans(stmt->hdbc)) {
+		if (!CC_is_in_trans(stmt->hdbc))
+		{
 			QResultClass *res;
-			char ok;
+			char		ok;
 
 			res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-			if (!res) {
+			if (!res)
+			{
 				stmt->errormsg = "Could not begin (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok) {
+			if (!ok)
+			{
 				stmt->errormsg = "Could not begin (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1585,53 +1749,59 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 
 		oid = atoi(value);
 		stmt->lobj_fd = lo_open(stmt->hdbc, oid, INV_READ);
-		if (stmt->lobj_fd < 0) {
+		if (stmt->lobj_fd < 0)
+		{
 			stmt->errornumber = STMT_EXEC_ERROR;
 			stmt->errormsg = "Couldnt open large object for reading.";
 			return COPY_GENERAL_ERROR;
 		}
 
-		/*	Get the size */
+		/* Get the size */
 		retval = lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_END);
-		if (retval >= 0) {
+		if (retval >= 0)
+		{
 
 			left = lo_tell(stmt->hdbc, stmt->lobj_fd);
 			if (bindInfo)
 				bindInfo->data_left = left;
 
-			/*	return to beginning */
+			/* return to beginning */
 			lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_SET);
 		}
 	}
 
-	if (left == 0) {
+	if (left == 0)
 		return COPY_NO_DATA_FOUND;
-	}
 
-	if (stmt->lobj_fd < 0) {
+	if (stmt->lobj_fd < 0)
+	{
 		stmt->errornumber = STMT_EXEC_ERROR;
 		stmt->errormsg = "Large object FD undefined for multiple read.";
 		return COPY_GENERAL_ERROR;
 	}
 
 	retval = lo_read(stmt->hdbc, stmt->lobj_fd, (char *) rgbValue, cbValueMax);
-	if (retval < 0) {
+	if (retval < 0)
+	{
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
+		{
 			QResultClass *res;
-			char ok;
+			char		ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res) {
+			if (!res)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok) {
+			if (!ok)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1656,27 +1826,31 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 		*pcbValue = left < 0 ? SQL_NO_TOTAL : left;
 
 
-	if (bindInfo && bindInfo->data_left > 0) 
+	if (bindInfo && bindInfo->data_left > 0)
 		bindInfo->data_left -= retval;
 
 
-	if (! bindInfo || bindInfo->data_left == 0) {
+	if (!bindInfo || bindInfo->data_left == 0)
+	{
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
+		{
 			QResultClass *res;
-			char ok;
+			char		ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res) {
+			if (!res)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok) {
+			if (!ok)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1685,7 +1859,7 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 			CC_set_no_trans(stmt->hdbc);
 		}
 
-		stmt->lobj_fd = -1;	/* prevent further reading */
+		stmt->lobj_fd = -1;		/* prevent further reading */
 	}
 
 
diff --git a/src/interfaces/odbc/convert.h b/src/interfaces/odbc/convert.h
index 7fd8254779075d9b2e4caa6fdc65e0d08024f51d..ae903bbafb6bbea95e090299ba82bf7b18bf095d 100644
--- a/src/interfaces/odbc/convert.h
+++ b/src/interfaces/odbc/convert.h
@@ -1,9 +1,9 @@
 
-/* File:            convert.h
+/* File:			convert.h
  *
- * Description:     See "convert.c"
+ * Description:		See "convert.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -13,39 +13,40 @@
 #include "psqlodbc.h"
 
 /* copy_and_convert results */
-#define COPY_OK                      0
-#define COPY_UNSUPPORTED_TYPE        1
+#define COPY_OK						 0
+#define COPY_UNSUPPORTED_TYPE		 1
 #define COPY_UNSUPPORTED_CONVERSION  2
-#define COPY_RESULT_TRUNCATED        3
-#define COPY_GENERAL_ERROR           4
-#define COPY_NO_DATA_FOUND           5
-
-typedef struct {
-	int m;
-	int d;
-	int y;
-	int hh;
-	int mm;
-	int ss;
+#define COPY_RESULT_TRUNCATED		 3
+#define COPY_GENERAL_ERROR			 4
+#define COPY_NO_DATA_FOUND			 5
+
+typedef struct
+{
+	int			m;
+	int			d;
+	int			y;
+	int			hh;
+	int			mm;
+	int			ss;
 } SIMPLE_TIME;
 
-int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col);
-int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, 
-						   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue);
-
-int copy_statement_with_parameters(StatementClass *stmt);
-char *convert_escape(char *value);
-char *convert_money(char *s);
-char parse_datetime(char *buf, SIMPLE_TIME *st);
-int convert_linefeeds(char *s, char *dst, size_t max);
-char *convert_special_chars(char *si, char *dst, int used);
-
-int convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax);
-int convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax);
-int convert_to_pgbinary(unsigned char *in, char *out, int len);
-void encode(char *in, char *out);
-void decode(char *in, char *out);
-int convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue, 
+int			copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col);
+int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
+					   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue);
+
+int			copy_statement_with_parameters(StatementClass *stmt);
+char	   *convert_escape(char *value);
+char	   *convert_money(char *s);
+char		parse_datetime(char *buf, SIMPLE_TIME *st);
+int			convert_linefeeds(char *s, char *dst, size_t max);
+char	   *convert_special_chars(char *si, char *dst, int used);
+
+int			convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax);
+int			convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax);
+int			convert_to_pgbinary(unsigned char *in, char *out, int len);
+void		encode(char *in, char *out);
+void		decode(char *in, char *out);
+int convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 		   SDWORD cbValueMax, SDWORD *pcbValue);
 
 #endif
diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c
index 70df018692709074c0c56d896ea6b5418c593ca4..a0d71547b7cebc5a1ae4b83ff998bf9d49531166 100644
--- a/src/interfaces/odbc/dlg_specific.c
+++ b/src/interfaces/odbc/dlg_specific.c
@@ -1,18 +1,18 @@
 
-/* Module:          dlg_specific.c
+/* Module:			dlg_specific.c
  *
- * Description:     This module contains any specific code for handling
- *                  dialog boxes such as driver/datasource options.  Both the
- *                  ConfigDSN() and the SQLDriverConnect() functions use 
- *                  functions in this module.  If you were to add a new option
- *                  to any dialog box, you would most likely only have to change
- *                  things in here rather than in 2 separate places as before.
+ * Description:		This module contains any specific code for handling
+ *					dialog boxes such as driver/datasource options.  Both the
+ *					ConfigDSN() and the SQLDriverConnect() functions use
+ *					functions in this module.  If you were to add a new option
+ *					to any dialog box, you would most likely only have to change
+ *					things in here rather than in 2 separate places as before.
  *
- * Classes:         none
+ * Classes:			none
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 /* Multibyte support	Eiji Tokuya 2001-03-15 */
@@ -22,14 +22,14 @@
 #endif
 
 #ifndef WIN32
-# include <string.h>
-# include "gpps.h"
-# define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
-# define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
-# ifndef HAVE_STRICMP
-#  define stricmp(s1,s2)      strcasecmp(s1,s2)
-#  define strnicmp(s1,s2,n)   strncasecmp(s1,s2,n)
-# endif
+#include <string.h>
+#include "gpps.h"
+#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
+#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
+#ifndef HAVE_STRICMP
+#define stricmp(s1,s2)		strcasecmp(s1,s2)
+#define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
+#endif
 #endif
 
 #include "dlg_specific.h"
@@ -55,8 +55,13 @@ extern GLOBAL_VALUES globals;
 void
 SetDlgStuff(HWND hdlg, ConnInfo *ci)
 {
-	/*	If driver attribute NOT present, then set the datasource name and description */
-	if (ci->driver[0] == '\0') {
+
+	/*
+	 * If driver attribute NOT present, then set the datasource name and
+	 * description
+	 */
+	if (ci->driver[0] == '\0')
+	{
 		SetDlgItemText(hdlg, IDC_DSNAME, ci->dsn);
 		SetDlgItemText(hdlg, IDC_DESC, ci->desc);
 	}
@@ -68,7 +73,7 @@ SetDlgStuff(HWND hdlg, ConnInfo *ci)
 	SetDlgItemText(hdlg, IDC_PORT, ci->port);
 }
 
-void 
+void
 GetDlgStuff(HWND hdlg, ConnInfo *ci)
 {
 	GetDlgItemText(hdlg, IDC_DESC, ci->desc, sizeof(ci->desc));
@@ -82,296 +87,308 @@ GetDlgStuff(HWND hdlg, ConnInfo *ci)
 
 
 
-int CALLBACK driver_optionsProc(HWND   hdlg,
-                           WORD   wMsg,
-                           WPARAM wParam,
-                           LPARAM lParam)
+int CALLBACK
+driver_optionsProc(HWND hdlg,
+				   WORD wMsg,
+				   WPARAM wParam,
+				   LPARAM lParam)
 {
-	switch (wMsg) {
-	case WM_INITDIALOG:
-
-		CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog);
-		CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
-		CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
-		CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
-		CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
-		CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
-
-		/*	Unknown (Default) Data Type sizes */
-		switch(globals.unknown_sizes) {
-		case UNKNOWNS_AS_DONTKNOW:
-			CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
-			break;
-		case UNKNOWNS_AS_LONGEST:
-			CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
-			break;
-		case UNKNOWNS_AS_MAX:
-		default:
-			CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
-			break;
-		}
-
-		CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, globals.text_as_longvarchar);
-		CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, globals.unknowns_as_longvarchar);
-		CheckDlgButton(hdlg, DRV_BOOLS_CHAR, globals.bools_as_char);
-
-		CheckDlgButton(hdlg, DRV_PARSE, globals.parse);
+	switch (wMsg)
+	{
+			case WM_INITDIALOG:
+
+			CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog);
+			CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
+			CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
+			CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
+			CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
+			CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
+
+			/* Unknown (Default) Data Type sizes */
+			switch (globals.unknown_sizes)
+			{
+				case UNKNOWNS_AS_DONTKNOW:
+					CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
+					break;
+				case UNKNOWNS_AS_LONGEST:
+					CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
+					break;
+				case UNKNOWNS_AS_MAX:
+				default:
+					CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
+					break;
+			}
 
-		CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, globals.cancel_as_freestmt);
+			CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, globals.text_as_longvarchar);
+			CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, globals.unknowns_as_longvarchar);
+			CheckDlgButton(hdlg, DRV_BOOLS_CHAR, globals.bools_as_char);
 
-		SetDlgItemInt(hdlg, DRV_CACHE_SIZE, globals.fetch_max, FALSE);
-		SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, globals.max_varchar_size, FALSE);
-		SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, globals.max_longvarchar_size, TRUE);
+			CheckDlgButton(hdlg, DRV_PARSE, globals.parse);
 
-		SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes);
+			CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, globals.cancel_as_freestmt);
 
-		/*	Driver Connection Settings */
-		SetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings);
+			SetDlgItemInt(hdlg, DRV_CACHE_SIZE, globals.fetch_max, FALSE);
+			SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, globals.max_varchar_size, FALSE);
+			SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, globals.max_longvarchar_size, TRUE);
 
-		break; 
+			SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes);
 
-	case WM_COMMAND:
-		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
-		case IDOK:
+			/* Driver Connection Settings */
+			SetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings);
 
-			globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
-			globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
-			globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
-			globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
-			globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
-			globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
+			break;
 
-			/*	Unknown (Default) Data Type sizes */
-			if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
-				globals.unknown_sizes = UNKNOWNS_AS_MAX;
-			else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
-				globals.unknown_sizes = UNKNOWNS_AS_DONTKNOW;
-			else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
-				globals.unknown_sizes = UNKNOWNS_AS_LONGEST;
-			else
-				globals.unknown_sizes = UNKNOWNS_AS_MAX;
-
-			globals.text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
-			globals.unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
-			globals.bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
-
-			globals.parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
-
-			globals.cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
-
-			globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
-			globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
-			globals.max_longvarchar_size= GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE);	/* allows for SQL_NO_TOTAL */
-
-			GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes));
-
-			/*	Driver Connection Settings */
-			GetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings, sizeof(globals.conn_settings));
-
-			updateGlobals();
-
-			/*	fall through */
-
-		case IDCANCEL:
-			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-			return TRUE;
-
-		case IDDEFAULTS:
-			CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG);
-			CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER);
-			CheckDlgButton(hdlg, DRV_KSQO, DEFAULT_KSQO);
-			CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX);
-			CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY);
-			CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH);
-	
-			CheckDlgButton(hdlg, DRV_PARSE, DEFAULT_PARSE);
-			CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, DEFAULT_CANCELASFREESTMT);
-
-			/*	Unknown Sizes */
-			CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
-			CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
-			CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
-			switch(DEFAULT_UNKNOWNSIZES) {
-			case UNKNOWNS_AS_DONTKNOW:
-				CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
-				break;
-			case UNKNOWNS_AS_LONGEST:
-				CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
-				break;
-			case UNKNOWNS_AS_MAX:
-				CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
-				break;
+		case WM_COMMAND:
+			switch (GET_WM_COMMAND_ID(wParam, lParam))
+			{
+				case IDOK:
+
+					globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
+					globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
+					globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
+					globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
+					globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
+					globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
+
+					/* Unknown (Default) Data Type sizes */
+					if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
+						globals.unknown_sizes = UNKNOWNS_AS_MAX;
+					else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
+						globals.unknown_sizes = UNKNOWNS_AS_DONTKNOW;
+					else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
+						globals.unknown_sizes = UNKNOWNS_AS_LONGEST;
+					else
+						globals.unknown_sizes = UNKNOWNS_AS_MAX;
+
+					globals.text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
+					globals.unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
+					globals.bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
+
+					globals.parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
+
+					globals.cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
+
+					globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
+					globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
+					globals.max_longvarchar_size = GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE);		/* allows for
+																												 * SQL_NO_TOTAL */
+
+					GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes));
+
+					/* Driver Connection Settings */
+					GetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings, sizeof(globals.conn_settings));
+
+					updateGlobals();
+
+					/* fall through */
+
+				case IDCANCEL:
+					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+					return TRUE;
+
+				case IDDEFAULTS:
+					CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG);
+					CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER);
+					CheckDlgButton(hdlg, DRV_KSQO, DEFAULT_KSQO);
+					CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX);
+					CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY);
+					CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH);
+
+					CheckDlgButton(hdlg, DRV_PARSE, DEFAULT_PARSE);
+					CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, DEFAULT_CANCELASFREESTMT);
+
+					/* Unknown Sizes */
+					CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
+					CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
+					CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
+					switch (DEFAULT_UNKNOWNSIZES)
+					{
+						case UNKNOWNS_AS_DONTKNOW:
+							CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
+							break;
+						case UNKNOWNS_AS_LONGEST:
+							CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
+							break;
+						case UNKNOWNS_AS_MAX:
+							CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
+							break;
+					}
+
+					CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, DEFAULT_TEXTASLONGVARCHAR);
+					CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, DEFAULT_UNKNOWNSASLONGVARCHAR);
+					CheckDlgButton(hdlg, DRV_BOOLS_CHAR, DEFAULT_BOOLSASCHAR);
+
+					SetDlgItemInt(hdlg, DRV_CACHE_SIZE, FETCH_MAX, FALSE);
+					SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, MAX_VARCHAR_SIZE, FALSE);
+					SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, TEXT_FIELD_SIZE, TRUE);
+
+					SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, DEFAULT_EXTRASYSTABLEPREFIXES);
+
+					/* Driver Connection Settings */
+					SetDlgItemText(hdlg, DRV_CONNSETTINGS, "");
+
+					break;
 			}
 
-			CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, DEFAULT_TEXTASLONGVARCHAR);
-			CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, DEFAULT_UNKNOWNSASLONGVARCHAR);
-			CheckDlgButton(hdlg, DRV_BOOLS_CHAR, DEFAULT_BOOLSASCHAR);
-
-			SetDlgItemInt(hdlg, DRV_CACHE_SIZE, FETCH_MAX, FALSE);
-			SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, MAX_VARCHAR_SIZE, FALSE);
-			SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, TEXT_FIELD_SIZE, TRUE);
-
-			SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, DEFAULT_EXTRASYSTABLEPREFIXES);
-
-			/*	Driver Connection Settings */
-			SetDlgItemText(hdlg, DRV_CONNSETTINGS, "");
-
-			break;
-		}
-
 	}
 
 	return FALSE;
 }
 
-int CALLBACK ds_optionsProc(HWND   hdlg,
-                           WORD   wMsg,
-                           WPARAM wParam,
-                           LPARAM lParam)
+int CALLBACK
+ds_optionsProc(HWND hdlg,
+			   WORD wMsg,
+			   WPARAM wParam,
+			   LPARAM lParam)
 {
-ConnInfo *ci;
-char buf[128];
-
-	switch (wMsg) {
-	case WM_INITDIALOG:
-		ci = (ConnInfo *) lParam;		
-		SetWindowLong(hdlg, DWL_USER, lParam);	/* save for OK */
-
-		/*	Change window caption */
-		if (ci->driver[0])
-			SetWindowText(hdlg, "Advanced Options (Connection)");
-		else {
-			sprintf(buf, "Advanced Options (%s)", ci->dsn);
-			SetWindowText(hdlg, buf);
-		}
+	ConnInfo   *ci;
+	char		buf[128];
+
+	switch (wMsg)
+	{
+		case WM_INITDIALOG:
+			ci = (ConnInfo *) lParam;
+			SetWindowLong(hdlg, DWL_USER, lParam);		/* save for OK */
+
+			/* Change window caption */
+			if (ci->driver[0])
+				SetWindowText(hdlg, "Advanced Options (Connection)");
+			else
+			{
+				sprintf(buf, "Advanced Options (%s)", ci->dsn);
+				SetWindowText(hdlg, buf);
+			}
 
-		/*	Readonly */
-		CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
+			/* Readonly */
+			CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
 
-		/*	Protocol */
-		if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
-			CheckDlgButton(hdlg, DS_PG62, 1);
-		else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
-			CheckDlgButton(hdlg, DS_PG63, 1);
-		else /* latest */
-			CheckDlgButton(hdlg, DS_PG64, 1);
+			/* Protocol */
+			if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
+				CheckDlgButton(hdlg, DS_PG62, 1);
+			else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
+				CheckDlgButton(hdlg, DS_PG63, 1);
+			else
+/* latest */
+				CheckDlgButton(hdlg, DS_PG64, 1);
 
 
 
-		CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
-		CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
-		CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
-		CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
+			CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
+			CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
+			CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
+			CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
 
-		EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
+			EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
 
-		/*	Datasource Connection Settings */
-		SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
-		break; 
+			/* Datasource Connection Settings */
+			SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
+			break;
 
 
-	case WM_COMMAND:
-		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
-		case DS_SHOWOIDCOLUMN:
-			mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
-			EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
-			return TRUE;
+		case WM_COMMAND:
+			switch (GET_WM_COMMAND_ID(wParam, lParam))
+			{
+				case DS_SHOWOIDCOLUMN:
+					mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
+					EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+					return TRUE;
 
 
-		case IDOK: 
+				case IDOK:
 
-			ci = (ConnInfo *)GetWindowLong(hdlg, DWL_USER);
-			mylog("IDOK: got ci = %u\n", ci);
+					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+					mylog("IDOK: got ci = %u\n", ci);
 
-			/*	Readonly */
-			sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
+					/* Readonly */
+					sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
 
-			/*	Protocol */
-			if ( IsDlgButtonChecked(hdlg, DS_PG62))
-				strcpy(ci->protocol, PG62);
-			else if ( IsDlgButtonChecked(hdlg, DS_PG63))
-				strcpy(ci->protocol, PG63);
-			else	/* latest */
-				strcpy(ci->protocol, PG64);
+					/* Protocol */
+					if (IsDlgButtonChecked(hdlg, DS_PG62))
+						strcpy(ci->protocol, PG62);
+					else if (IsDlgButtonChecked(hdlg, DS_PG63))
+						strcpy(ci->protocol, PG63);
+					else
+/* latest */
+						strcpy(ci->protocol, PG64);
 
-			sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
+					sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
 
-			sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
+					sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
 
-			/*	OID Options*/
-			sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
-			sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+					/* OID Options */
+					sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
+					sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
 
-			/*	Datasource Connection Settings */
-			GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
+					/* Datasource Connection Settings */
+					GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
 
 
-			/*	fall through */
+					/* fall through */
 
-		case IDCANCEL:
-			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-			return TRUE;
-		}
+				case IDCANCEL:
+					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+					return TRUE;
+			}
 	}
 
 	return FALSE;
 }
 
-#endif	/* WIN32 */
+#endif	 /* WIN32 */
 
 void
 makeConnectString(char *connect_string, ConnInfo *ci)
 {
-char got_dsn = (ci->dsn[0] != '\0');
-char encoded_conn_settings[LARGE_REGISTRY_LEN];
+	char		got_dsn = (ci->dsn[0] != '\0');
+	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
 
-	/*	fundamental info */
+	/* fundamental info */
 	sprintf(connect_string, "%s=%s;DATABASE=%s;SERVER=%s;PORT=%s;UID=%s;PWD=%s",
-		got_dsn ? "DSN" : "DRIVER", 
-		got_dsn ? ci->dsn : ci->driver,
-		ci->database,
-		ci->server,
-		ci->port,
-		ci->username,
-		ci->password);
+			got_dsn ? "DSN" : "DRIVER",
+			got_dsn ? ci->dsn : ci->driver,
+			ci->database,
+			ci->server,
+			ci->port,
+			ci->username,
+			ci->password);
 
 	encode(ci->conn_settings, encoded_conn_settings);
 
-	/*	extra info */
-	sprintf(&connect_string[strlen(connect_string)], 
-		";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s", 
-		ci->onlyread,
-		ci->protocol,
-		ci->fake_oid_index,
-		ci->show_oid_column,
-		ci->row_versioning,
-		ci->show_system_tables,
-		encoded_conn_settings);
+	/* extra info */
+	sprintf(&connect_string[strlen(connect_string)],
+			";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s",
+			ci->onlyread,
+			ci->protocol,
+			ci->fake_oid_index,
+			ci->show_oid_column,
+			ci->row_versioning,
+			ci->show_system_tables,
+			encoded_conn_settings);
 }
 
 void
 copyAttributes(ConnInfo *ci, char *attribute, char *value)
 {
 
-	if(stricmp(attribute, "DSN") == 0)
+	if (stricmp(attribute, "DSN") == 0)
 		strcpy(ci->dsn, value);
 
-	else if(stricmp(attribute, "driver") == 0)
+	else if (stricmp(attribute, "driver") == 0)
 		strcpy(ci->driver, value);
 
-	else if(stricmp(attribute, INI_DATABASE) == 0)
+	else if (stricmp(attribute, INI_DATABASE) == 0)
 		strcpy(ci->database, value);
 
-	else if(stricmp(attribute, INI_SERVER) == 0 || stricmp(attribute, "server") == 0)
+	else if (stricmp(attribute, INI_SERVER) == 0 || stricmp(attribute, "server") == 0)
 		strcpy(ci->server, value);
 
-	else if(stricmp(attribute, INI_USER) == 0 || stricmp(attribute, "uid") == 0)
+	else if (stricmp(attribute, INI_USER) == 0 || stricmp(attribute, "uid") == 0)
 		strcpy(ci->username, value);
 
-	else if(stricmp(attribute, INI_PASSWORD) == 0 || stricmp(attribute, "pwd") == 0)
+	else if (stricmp(attribute, INI_PASSWORD) == 0 || stricmp(attribute, "pwd") == 0)
 		strcpy(ci->password, value);
 
-	else if(stricmp(attribute, INI_PORT) == 0)
+	else if (stricmp(attribute, INI_PORT) == 0)
 		strcpy(ci->port, value);
 
 	else if (stricmp(attribute, INI_READONLY) == 0)
@@ -392,12 +409,13 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
 	else if (stricmp(attribute, INI_SHOWSYSTEMTABLES) == 0)
 		strcpy(ci->show_system_tables, value);
 
-	else if (stricmp(attribute, INI_CONNSETTINGS) == 0) {
+	else if (stricmp(attribute, INI_CONNSETTINGS) == 0)
+	{
 		decode(value, ci->conn_settings);
 		/* strcpy(ci->conn_settings, value); */
 	}
 
-	mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server,ci->database,ci->username,ci->password,ci->port,ci->onlyread,ci->protocol,ci->conn_settings);
+	mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server, ci->database, ci->username, ci->password, ci->port, ci->onlyread, ci->protocol, ci->conn_settings);
 
 }
 
@@ -427,105 +445,108 @@ getDSNdefaults(ConnInfo *ci)
 }
 
 
-void 
+void
 getDSNinfo(ConnInfo *ci, char overwrite)
 {
-char *DSN = ci->dsn;
-char encoded_conn_settings[LARGE_REGISTRY_LEN];
+	char	   *DSN = ci->dsn;
+	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
 
 /*	If a driver keyword was present, then dont use a DSN and return. */
 /*	If DSN is null and no driver, then use the default datasource. */
-	if ( DSN[0] == '\0') {
-		if ( ci->driver[0] != '\0')
+	if (DSN[0] == '\0')
+	{
+		if (ci->driver[0] != '\0')
 			return;
 		else
 			strcpy(DSN, INI_DSN);
 	}
 
 	/* brute-force chop off trailing blanks... */
-	while (*(DSN+strlen(DSN)-1) == ' ') *(DSN+strlen(DSN)-1) = '\0';
+	while (*(DSN + strlen(DSN) - 1) == ' ')
+		*(DSN + strlen(DSN) - 1) = '\0';
 
-	/*	Proceed with getting info for the given DSN. */
+	/* Proceed with getting info for the given DSN. */
 
-	if ( ci->desc[0] == '\0' || overwrite)
+	if (ci->desc[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_KDESC, "", ci->desc, sizeof(ci->desc), ODBC_INI);
 
-	if ( ci->server[0] == '\0' || overwrite)
+	if (ci->server[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SERVER, "", ci->server, sizeof(ci->server), ODBC_INI);
 
-	if ( ci->database[0] == '\0' || overwrite)
-	    SQLGetPrivateProfileString(DSN, INI_DATABASE, "", ci->database, sizeof(ci->database), ODBC_INI);
+	if (ci->database[0] == '\0' || overwrite)
+		SQLGetPrivateProfileString(DSN, INI_DATABASE, "", ci->database, sizeof(ci->database), ODBC_INI);
 
-	if ( ci->username[0] == '\0' || overwrite)
+	if (ci->username[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_USER, "", ci->username, sizeof(ci->username), ODBC_INI);
 
-	if ( ci->password[0] == '\0' || overwrite)
+	if (ci->password[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PASSWORD, "", ci->password, sizeof(ci->password), ODBC_INI);
 
-	if ( ci->port[0] == '\0' || overwrite)
+	if (ci->port[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI);
 
-	if ( ci->onlyread[0] == '\0' || overwrite)
+	if (ci->onlyread[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread, sizeof(ci->onlyread), ODBC_INI);
 
-	if ( ci->show_oid_column[0] == '\0' || overwrite)
+	if (ci->show_oid_column[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SHOWOIDCOLUMN, "", ci->show_oid_column, sizeof(ci->show_oid_column), ODBC_INI);
 
-	if ( ci->fake_oid_index[0] == '\0' || overwrite)
+	if (ci->fake_oid_index[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_FAKEOIDINDEX, "", ci->fake_oid_index, sizeof(ci->fake_oid_index), ODBC_INI);
 
-	if ( ci->row_versioning[0] == '\0' || overwrite)
+	if (ci->row_versioning[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_ROWVERSIONING, "", ci->row_versioning, sizeof(ci->row_versioning), ODBC_INI);
 
-	if ( ci->show_system_tables[0] == '\0' || overwrite)
+	if (ci->show_system_tables[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, "", ci->show_system_tables, sizeof(ci->show_system_tables), ODBC_INI);
 
-	if ( ci->protocol[0] == '\0' || overwrite)
+	if (ci->protocol[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PROTOCOL, "", ci->protocol, sizeof(ci->protocol), ODBC_INI);
 
-	if ( ci->conn_settings[0] == '\0' || overwrite) {
+	if (ci->conn_settings[0] == '\0' || overwrite)
+	{
 		SQLGetPrivateProfileString(DSN, INI_CONNSETTINGS, "", encoded_conn_settings, sizeof(encoded_conn_settings), ODBC_INI);
 		decode(encoded_conn_settings, ci->conn_settings);
 	}
 
-	if ( ci->translation_dll[0] == '\0' || overwrite)
+	if (ci->translation_dll[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_TRANSLATIONDLL, "", ci->translation_dll, sizeof(ci->translation_dll), ODBC_INI);
 
-	if ( ci->translation_option[0] == '\0' || overwrite)
+	if (ci->translation_option[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_TRANSLATIONOPTION, "", ci->translation_option, sizeof(ci->translation_option), ODBC_INI);
 
 
-	/*	Allow override of odbcinst.ini parameters here */
+	/* Allow override of odbcinst.ini parameters here */
 	getGlobalDefaults(DSN, ODBC_INI, TRUE);
 
 
-	qlog("DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n", 
-		DSN, 
-		ci->server,
-		ci->port,
-		ci->database,
-		ci->username,
-		ci->password);
+	qlog("DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n",
+		 DSN,
+		 ci->server,
+		 ci->port,
+		 ci->database,
+		 ci->username,
+		 ci->password);
 	qlog("          onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
-		ci->onlyread,
-		ci->protocol,
-		ci->show_oid_column,
-		ci->fake_oid_index,
-		ci->show_system_tables);
+		 ci->onlyread,
+		 ci->protocol,
+		 ci->show_oid_column,
+		 ci->fake_oid_index,
+		 ci->show_system_tables);
 
 #ifdef MULTIBYTE
 	check_client_encoding(ci->conn_settings);
 	qlog("          conn_settings='%s',conn_encoding='%s'\n",
-		ci->conn_settings,
-		check_client_encoding(ci->conn_settings));
+		 ci->conn_settings,
+		 check_client_encoding(ci->conn_settings));
 #else
 	qlog("          conn_settings='%s'\n",
-		ci->conn_settings);
+		 ci->conn_settings);
 #endif
 
 	qlog("          translation_dll='%s',translation_option='%s'\n",
-		ci->translation_dll,
-		ci->translation_option);
+		 ci->translation_dll,
+		 ci->translation_option);
 
 }
 
@@ -534,347 +555,359 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
 void
 writeDSNinfo(ConnInfo *ci)
 {
-char *DSN = ci->dsn;
-char encoded_conn_settings[LARGE_REGISTRY_LEN];
-
-		encode(ci->conn_settings, encoded_conn_settings);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_KDESC,
-			ci->desc,
-			ODBC_INI);
-                        
-		SQLWritePrivateProfileString(DSN,
-			INI_DATABASE,
-			ci->database,
-			ODBC_INI);
-                        
-		SQLWritePrivateProfileString(DSN,
-			INI_SERVER,
-			ci->server,
-			ODBC_INI);
+	char	   *DSN = ci->dsn;
+	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
 
-		SQLWritePrivateProfileString(DSN,
-			INI_PORT,
-			ci->port,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_USER,
-			ci->username,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_PASSWORD,
-			ci->password,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_READONLY,
-			ci->onlyread,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_SHOWOIDCOLUMN,
-			ci->show_oid_column,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_FAKEOIDINDEX,
-			ci->fake_oid_index,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_ROWVERSIONING,
-			ci->row_versioning,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_SHOWSYSTEMTABLES,
-			ci->show_system_tables,
-			ODBC_INI);
-
-		SQLWritePrivateProfileString(DSN,
-			INI_PROTOCOL,
-			ci->protocol,
-			ODBC_INI);
+	encode(ci->conn_settings, encoded_conn_settings);
 
-		SQLWritePrivateProfileString(DSN,
-			INI_CONNSETTINGS,
-			encoded_conn_settings,
-			ODBC_INI);
+	SQLWritePrivateProfileString(DSN,
+								 INI_KDESC,
+								 ci->desc,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_DATABASE,
+								 ci->database,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_SERVER,
+								 ci->server,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_PORT,
+								 ci->port,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_USER,
+								 ci->username,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_PASSWORD,
+								 ci->password,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_READONLY,
+								 ci->onlyread,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_SHOWOIDCOLUMN,
+								 ci->show_oid_column,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_FAKEOIDINDEX,
+								 ci->fake_oid_index,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_ROWVERSIONING,
+								 ci->row_versioning,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_SHOWSYSTEMTABLES,
+								 ci->show_system_tables,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_PROTOCOL,
+								 ci->protocol,
+								 ODBC_INI);
+
+	SQLWritePrivateProfileString(DSN,
+								 INI_CONNSETTINGS,
+								 encoded_conn_settings,
+								 ODBC_INI);
 }
 
 
 /*	This function reads the ODBCINST.INI portion of
 	the registry and gets any driver defaults.
 */
-void getGlobalDefaults(char *section, char *filename, char override)
+void
+getGlobalDefaults(char *section, char *filename, char override)
 {
-char temp[256];
+	char		temp[256];
 
 
-    /*	Fetch Count is stored in driver section */
-    SQLGetPrivateProfileString(section, INI_FETCH, "",
-                            temp, sizeof(temp), filename);
-	if ( temp[0] ) {
+	/* Fetch Count is stored in driver section */
+	SQLGetPrivateProfileString(section, INI_FETCH, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
+	{
 		globals.fetch_max = atoi(temp);
-		/*	sanity check if using cursors */
+		/* sanity check if using cursors */
 		if (globals.fetch_max <= 0)
 			globals.fetch_max = FETCH_MAX;
 	}
-	else if ( ! override)
+	else if (!override)
 		globals.fetch_max = FETCH_MAX;
 
 
-	/*	Socket Buffersize is stored in driver section */
-    SQLGetPrivateProfileString(section, INI_SOCKET, "",
-                            temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Socket Buffersize is stored in driver section */
+	SQLGetPrivateProfileString(section, INI_SOCKET, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.socket_buffersize = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.socket_buffersize = SOCK_BUFFER_SIZE;
 
 
-	/*	Debug is stored in the driver section */
-	SQLGetPrivateProfileString(section, INI_DEBUG, "", 
-							temp, sizeof(temp), filename);
-	if ( temp[0] )
+	/* Debug is stored in the driver section */
+	SQLGetPrivateProfileString(section, INI_DEBUG, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.debug = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.debug = DEFAULT_DEBUG;
 
 
-	/*	CommLog is stored in the driver section */
-	SQLGetPrivateProfileString(section, INI_COMMLOG, "", 
-							temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* CommLog is stored in the driver section */
+	SQLGetPrivateProfileString(section, INI_COMMLOG, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.commlog = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.commlog = DEFAULT_COMMLOG;
 
 
-	/*	Optimizer is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_OPTIMIZER, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Optimizer is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_OPTIMIZER, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.disable_optimizer = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.disable_optimizer = DEFAULT_OPTIMIZER;
 
-	/*	KSQO is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_KSQO, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* KSQO is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_KSQO, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.ksqo = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.ksqo = DEFAULT_KSQO;
 
-	/*	Recognize Unique Index is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Recognize Unique Index is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.unique_index = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.unique_index = DEFAULT_UNIQUEINDEX;
 
 
-	/*	Unknown Sizes is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] )
+	/* Unknown Sizes is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.unknown_sizes = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.unknown_sizes = DEFAULT_UNKNOWNSIZES;
 
 
-	/*	Lie about supported functions? */
-	SQLGetPrivateProfileString(section, INI_LIE, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Lie about supported functions? */
+	SQLGetPrivateProfileString(section, INI_LIE, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.lie = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.lie = DEFAULT_LIE;
 
-	/*	Parse statements */
-	SQLGetPrivateProfileString(section, INI_PARSE, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Parse statements */
+	SQLGetPrivateProfileString(section, INI_PARSE, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.parse = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.parse = DEFAULT_PARSE;
 
-	/*	SQLCancel calls SQLFreeStmt in Driver Manager */
-	SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* SQLCancel calls SQLFreeStmt in Driver Manager */
+	SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.cancel_as_freestmt = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
 
 
 
-	/*	UseDeclareFetch is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* UseDeclareFetch is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.use_declarefetch = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.use_declarefetch = DEFAULT_USEDECLAREFETCH;
 
 
-	/*	Max Varchar Size */
-	SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Max Varchar Size */
+	SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.max_varchar_size = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.max_varchar_size = MAX_VARCHAR_SIZE;
 
-	/*	Max TextField Size */
-	SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Max TextField Size */
+	SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.max_longvarchar_size = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.max_longvarchar_size = TEXT_FIELD_SIZE;
 
-	/*	Text As LongVarchar  */
-	SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Text As LongVarchar	*/
+	SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.text_as_longvarchar = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
 
-	/*	Unknowns As LongVarchar  */
-	SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Unknowns As LongVarchar	*/
+	SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.unknowns_as_longvarchar = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
 
-	/*	Bools As Char */
-	SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "", 
-				temp, sizeof(temp), filename);
-	if ( temp[0] ) 
+	/* Bools As Char */
+	SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "",
+							   temp, sizeof(temp), filename);
+	if (temp[0])
 		globals.bools_as_char = atoi(temp);
-	else if ( ! override)
+	else if (!override)
 		globals.bools_as_char = DEFAULT_BOOLSASCHAR;
 
-	/*	Extra Systable prefixes */
-	/*	Use @@@ to distinguish between blank extra prefixes and no key entry */
-	SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@", 
-			temp, sizeof(temp), filename);
-	if ( strcmp(temp, "@@@" ))	
+	/* Extra Systable prefixes */
+
+	/*
+	 * Use @@@ to distinguish between blank extra prefixes and no key
+	 * entry
+	 */
+	SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@",
+							   temp, sizeof(temp), filename);
+	if (strcmp(temp, "@@@"))
 		strcpy(globals.extra_systable_prefixes, temp);
-	else if ( ! override)
+	else if (!override)
 		strcpy(globals.extra_systable_prefixes, DEFAULT_EXTRASYSTABLEPREFIXES);
 
 	mylog("globals.extra_systable_prefixes = '%s'\n", globals.extra_systable_prefixes);
 
 
-	/*	Dont allow override of an override! */
-	if ( ! override) {
+	/* Dont allow override of an override! */
+	if (!override)
+	{
 
-		/*	ConnSettings is stored in the driver section and per datasource for override */
-		SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "", 
-					globals.conn_settings, sizeof(globals.conn_settings), filename);
+		/*
+		 * ConnSettings is stored in the driver section and per datasource
+		 * for override
+		 */
+		SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "",
+		 globals.conn_settings, sizeof(globals.conn_settings), filename);
 
-		/*	Default state for future DSN's Readonly attribute */
-		SQLGetPrivateProfileString(section, INI_READONLY, "", 
-					temp, sizeof(temp), filename);
-		if ( temp[0] ) 
+		/* Default state for future DSN's Readonly attribute */
+		SQLGetPrivateProfileString(section, INI_READONLY, "",
+								   temp, sizeof(temp), filename);
+		if (temp[0])
 			globals.onlyread = atoi(temp);
 		else
 			globals.onlyread = DEFAULT_READONLY;
 
-		/*	Default state for future DSN's protocol attribute
-			This isn't a real driver option YET.  This is more
-			intended for customization from the install.
-		*/
-		SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@", 
-				temp, sizeof(temp), filename);
-		if ( strcmp(temp, "@@@" ))	
+		/*
+		 * Default state for future DSN's protocol attribute This isn't a
+		 * real driver option YET.	This is more intended for
+		 * customization from the install.
+		 */
+		SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@",
+								   temp, sizeof(temp), filename);
+		if (strcmp(temp, "@@@"))
 			strcpy(globals.protocol, temp);
-		else 
+		else
 			strcpy(globals.protocol, DEFAULT_PROTOCOL);
-	
+
 	}
 }
 
 
 /*	This function writes any global parameters (that can be manipulated)
-	to the ODBCINST.INI portion of the registry 
+	to the ODBCINST.INI portion of the registry
 */
-void updateGlobals(void)
+void
+updateGlobals(void)
 {
-char tmp[128];
+	char		tmp[128];
 
 	sprintf(tmp, "%d", globals.fetch_max);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_FETCH, tmp, ODBCINST_INI);
+								 INI_FETCH, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.commlog);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_COMMLOG, tmp, ODBCINST_INI);
+								 INI_COMMLOG, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.disable_optimizer);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_OPTIMIZER, tmp, ODBCINST_INI);
+								 INI_OPTIMIZER, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.ksqo);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_KSQO, tmp, ODBCINST_INI);
+								 INI_KSQO, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unique_index);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_UNIQUEINDEX, tmp, ODBCINST_INI);
+								 INI_UNIQUEINDEX, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.onlyread);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_READONLY, tmp, ODBCINST_INI);
+								 INI_READONLY, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.use_declarefetch);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_USEDECLAREFETCH, tmp, ODBCINST_INI);
+								 INI_USEDECLAREFETCH, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unknown_sizes);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_UNKNOWNSIZES, tmp, ODBCINST_INI);
+								 INI_UNKNOWNSIZES, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.text_as_longvarchar);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_TEXTASLONGVARCHAR, tmp, ODBCINST_INI);
+							   INI_TEXTASLONGVARCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unknowns_as_longvarchar);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_UNKNOWNSASLONGVARCHAR, tmp, ODBCINST_INI);
+						   INI_UNKNOWNSASLONGVARCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.bools_as_char);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_BOOLSASCHAR, tmp, ODBCINST_INI);
+								 INI_BOOLSASCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.parse);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_PARSE, tmp, ODBCINST_INI);
+								 INI_PARSE, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.cancel_as_freestmt);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_CANCELASFREESTMT, tmp, ODBCINST_INI);
+								 INI_CANCELASFREESTMT, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.max_varchar_size);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_MAXVARCHARSIZE, tmp, ODBCINST_INI);
+								 INI_MAXVARCHARSIZE, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.max_longvarchar_size);
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_MAXLONGVARCHARSIZE, tmp, ODBCINST_INI);
+							  INI_MAXLONGVARCHARSIZE, tmp, ODBCINST_INI);
 
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, ODBCINST_INI);
+								 INI_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, ODBCINST_INI);
 
 	SQLWritePrivateProfileString(DBMS_NAME,
-		INI_CONNSETTINGS, globals.conn_settings, ODBCINST_INI);
+				  INI_CONNSETTINGS, globals.conn_settings, ODBCINST_INI);
 }
diff --git a/src/interfaces/odbc/dlg_specific.h b/src/interfaces/odbc/dlg_specific.h
index 1cad81105f83c3b6c3cbf136aed9d48083b3eb43..225d93f174b57506a037437758ea6d56b02d1866 100644
--- a/src/interfaces/odbc/dlg_specific.h
+++ b/src/interfaces/odbc/dlg_specific.h
@@ -1,9 +1,9 @@
 
-/* File:            dlg_specific.h
+/* File:			dlg_specific.h
  *
- * Description:     See "dlg_specific.c"
+ * Description:		See "dlg_specific.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -31,40 +31,48 @@
 
 /* INI File Stuff */
 #ifndef WIN32
-# define ODBC_INI        ".odbc.ini"
-# ifdef ODBCINSTDIR
-#  define ODBCINST_INI    ODBCINSTDIR "/odbcinst.ini"
-# else
-#  define ODBCINST_INI    "/etc/odbcinst.ini"
-# endif
-#else /* WIN32 */
-# define ODBC_INI        "ODBC.INI"         /* ODBC initialization file */
-# define ODBCINST_INI    "ODBCINST.INI"     /* ODBC Installation file */
-#endif /* WIN32 */
-
-
-#define INI_DSN           DBMS_NAME         /* Name of default Datasource in ini file (not used?) */
-#define INI_KDESC         "Description"     /* Data source description */
-#define INI_SERVER        "Servername"      /* Name of Server running the Postgres service */
-#define INI_PORT          "Port"            /* Port on which the Postmaster is listening */ 
-#define INI_DATABASE      "Database"        /* Database Name */
-#define INI_USER          "Username"        /* Default User Name */
-#define INI_PASSWORD      "Password"		/* Default Password */
-#define INI_DEBUG         "Debug"			/* Debug flag */
-#define INI_FETCH         "Fetch"			/* Fetch Max Count */
-#define INI_SOCKET        "Socket"			/* Socket buffer size */
-#define INI_READONLY      "ReadOnly"		/* Database is read only */
-#define INI_COMMLOG       "CommLog"			/* Communication to backend logging */
-#define INI_PROTOCOL      "Protocol"		/* What protocol (6.2) */
-#define INI_OPTIMIZER     "Optimizer"		/* Use backend genetic optimizer */
-#define INI_KSQO          "Ksqo"            /* Keyset query optimization */
-#define INI_CONNSETTINGS  "ConnSettings"	/* Anything to send to backend on successful connection */
-#define INI_UNIQUEINDEX   "UniqueIndex"		/* Recognize unique indexes */
-#define INI_UNKNOWNSIZES  "UnknownSizes"	/* How to handle unknown result set sizes */
+#define ODBC_INI		".odbc.ini"
+#ifdef ODBCINSTDIR
+#define ODBCINST_INI	ODBCINSTDIR "/odbcinst.ini"
+#else
+#define ODBCINST_INI	"/etc/odbcinst.ini"
+#endif
+#else							/* WIN32 */
+#define ODBC_INI		"ODBC.INI"		/* ODBC initialization file */
+#define ODBCINST_INI	"ODBCINST.INI"	/* ODBC Installation file */
+#endif	 /* WIN32 */
+
+
+#define INI_DSN			  DBMS_NAME		/* Name of default Datasource in
+										 * ini file (not used?) */
+#define INI_KDESC		  "Description" /* Data source description */
+#define INI_SERVER		  "Servername"	/* Name of Server running the
+										 * Postgres service */
+#define INI_PORT		  "Port"/* Port on which the Postmaster is
+								 * listening */
+#define INI_DATABASE	  "Database"	/* Database Name */
+#define INI_USER		  "Username"	/* Default User Name */
+#define INI_PASSWORD	  "Password"	/* Default Password */
+#define INI_DEBUG		  "Debug"		/* Debug flag */
+#define INI_FETCH		  "Fetch"		/* Fetch Max Count */
+#define INI_SOCKET		  "Socket"		/* Socket buffer size */
+#define INI_READONLY	  "ReadOnly"	/* Database is read only */
+#define INI_COMMLOG		  "CommLog"		/* Communication to backend
+										 * logging */
+#define INI_PROTOCOL	  "Protocol"	/* What protocol (6.2) */
+#define INI_OPTIMIZER	  "Optimizer"	/* Use backend genetic optimizer */
+#define INI_KSQO		  "Ksqo"/* Keyset query optimization */
+#define INI_CONNSETTINGS  "ConnSettings"		/* Anything to send to
+												 * backend on successful
+												 * connection */
+#define INI_UNIQUEINDEX   "UniqueIndex" /* Recognize unique indexes */
+#define INI_UNKNOWNSIZES  "UnknownSizes"		/* How to handle unknown
+												 * result set sizes */
 
 #define INI_CANCELASFREESTMT  "CancelAsFreeStmt"
 
-#define INI_USEDECLAREFETCH "UseDeclareFetch"		/* Use Declare/Fetch cursors */
+#define INI_USEDECLAREFETCH "UseDeclareFetch"	/* Use Declare/Fetch
+												 * cursors */
 
 /*	More ini stuff */
 #define INI_TEXTASLONGVARCHAR		"TextAsLongVarchar"
@@ -81,15 +89,16 @@
 #define INI_PARSE					"Parse"
 #define INI_EXTRASYSTABLEPREFIXES	"ExtraSysTablePrefixes"
 
-#define INI_TRANSLATIONNAME       "TranslationName"
-#define INI_TRANSLATIONDLL        "TranslationDLL"
-#define INI_TRANSLATIONOPTION     "TranslationOption"
+#define INI_TRANSLATIONNAME		  "TranslationName"
+#define INI_TRANSLATIONDLL		  "TranslationDLL"
+#define INI_TRANSLATIONOPTION	  "TranslationOption"
 
 
 /*	Connection Defaults */
 #define DEFAULT_PORT					"5432"
 #define DEFAULT_READONLY				1
-#define DEFAULT_PROTOCOL				"6.4"		/* the latest protocol is the default */
+#define DEFAULT_PROTOCOL				"6.4"	/* the latest protocol is
+												 * the default */
 #define DEFAULT_USEDECLAREFETCH			0
 #define DEFAULT_TEXTASLONGVARCHAR		1
 #define DEFAULT_UNKNOWNSASLONGVARCHAR	0
@@ -113,29 +122,30 @@
 
 #define DEFAULT_EXTRASYSTABLEPREFIXES	"dd_;"
 
-/*  prototypes */
-void getGlobalDefaults(char *section, char *filename, char override);
+/*	prototypes */
+void		getGlobalDefaults(char *section, char *filename, char override);
 
 #ifdef WIN32
-void SetDlgStuff(HWND hdlg, ConnInfo *ci);
-void GetDlgStuff(HWND hdlg, ConnInfo *ci);
-
-int CALLBACK driver_optionsProc(HWND   hdlg,
-                           WORD   wMsg,
-                           WPARAM wParam,
-                           LPARAM lParam);
-int CALLBACK ds_optionsProc(HWND   hdlg,
-                           WORD   wMsg,
-                           WPARAM wParam,
-                           LPARAM lParam);
-#endif /* WIN32 */
-
-void updateGlobals(void);
-void writeDSNinfo(ConnInfo *ci);
-void getDSNdefaults(ConnInfo *ci);
-void getDSNinfo(ConnInfo *ci, char overwrite);
-void makeConnectString(char *connect_string, ConnInfo *ci);
-void copyAttributes(ConnInfo *ci, char *attribute, char *value);
+void		SetDlgStuff(HWND hdlg, ConnInfo *ci);
+void		GetDlgStuff(HWND hdlg, ConnInfo *ci);
+
+int CALLBACK driver_optionsProc(HWND hdlg,
+				   WORD wMsg,
+				   WPARAM wParam,
+				   LPARAM lParam);
+int CALLBACK ds_optionsProc(HWND hdlg,
+			   WORD wMsg,
+			   WPARAM wParam,
+			   LPARAM lParam);
+
+#endif	 /* WIN32 */
+
+void		updateGlobals(void);
+void		writeDSNinfo(ConnInfo *ci);
+void		getDSNdefaults(ConnInfo *ci);
+void		getDSNinfo(ConnInfo *ci, char overwrite);
+void		makeConnectString(char *connect_string, ConnInfo *ci);
+void		copyAttributes(ConnInfo *ci, char *attribute, char *value);
 
 
 #endif
diff --git a/src/interfaces/odbc/drvconn.c b/src/interfaces/odbc/drvconn.c
index 2cbe6e6a87a639be1148f75d0bcc32d2fec222b6..1f5560198a1810572eb901e9aabadaef3ae4256d 100644
--- a/src/interfaces/odbc/drvconn.c
+++ b/src/interfaces/odbc/drvconn.c
@@ -1,14 +1,14 @@
 
-/* Module:          drvconn.c
+/* Module:			drvconn.c
  *
- * Description:     This module contains only routines related to 
- *                  implementing SQLDriverConnect.
+ * Description:		This module contains only routines related to
+ *					implementing SQLDriverConnect.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   SQLDriverConnect
+ * API functions:	SQLDriverConnect
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -53,45 +53,50 @@
 #include "dlg_specific.h"
 
 /* prototypes */
-void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci);
+void		dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci);
 
 #ifdef WIN32
 BOOL FAR PASCAL dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
-RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci);
+RETCODE		dconn_DoDialog(HWND hwnd, ConnInfo *ci);
+
+extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
 
-extern HINSTANCE NEAR s_hModule;               /* Saved module handle. */
 #endif
 
 extern GLOBAL_VALUES globals;
 
 
-RETCODE SQL_API SQLDriverConnect(
-                                 HDBC      hdbc,
-                                 HWND      hwnd,
-                                 UCHAR FAR *szConnStrIn,
-                                 SWORD     cbConnStrIn,
-                                 UCHAR FAR *szConnStrOut,
-                                 SWORD     cbConnStrOutMax,
-                                 SWORD FAR *pcbConnStrOut,
-                                 UWORD     fDriverCompletion)
+RETCODE SQL_API
+SQLDriverConnect(
+				 HDBC hdbc,
+				 HWND hwnd,
+				 UCHAR FAR *szConnStrIn,
+				 SWORD cbConnStrIn,
+				 UCHAR FAR *szConnStrOut,
+				 SWORD cbConnStrOutMax,
+				 SWORD FAR *pcbConnStrOut,
+				 UWORD fDriverCompletion)
 {
-static char *func = "SQLDriverConnect";
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-ConnInfo *ci;
+	static char *func = "SQLDriverConnect";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	ConnInfo   *ci;
+
 #ifdef WIN32
-RETCODE dialog_result;
+	RETCODE		dialog_result;
+
 #endif
-RETCODE result;
-char connStrIn[MAX_CONNECT_STRING];
-char connStrOut[MAX_CONNECT_STRING];
-int retval;
-char password_required = FALSE;
-int len = 0;
+	RETCODE		result;
+	char		connStrIn[MAX_CONNECT_STRING];
+	char		connStrOut[MAX_CONNECT_STRING];
+	int			retval;
+	char		password_required = FALSE;
+	int			len = 0;
 
 
 	mylog("%s: entering...\n", func);
 
-	if ( ! conn) {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -103,17 +108,17 @@ int len = 0;
 
 	ci = &(conn->connInfo);
 
-	/*	Parse the connect string and fill in conninfo for this hdbc. */
+	/* Parse the connect string and fill in conninfo for this hdbc. */
 	dconn_get_connect_attributes(connStrIn, ci);
 
-	/*	If the ConnInfo in the hdbc is missing anything, */
-	/*	this function will fill them in from the registry (assuming */
-	/*	of course there is a DSN given -- if not, it does nothing!) */
+	/* If the ConnInfo in the hdbc is missing anything, */
+	/* this function will fill them in from the registry (assuming */
+	/* of course there is a DSN given -- if not, it does nothing!) */
 	getDSNinfo(ci, CONN_DONT_OVERWRITE);
 
-	/*	Fill in any default parameters if they are not there. */
+	/* Fill in any default parameters if they are not there. */
 	getDSNdefaults(ci);
-	/*	initialize pg_version */
+	/* initialize pg_version */
 	CC_initialize_pg_version(conn);
 
 #ifdef WIN32
@@ -121,51 +126,54 @@ dialog:
 #endif
 	ci->focus_password = password_required;
 
-	switch(fDriverCompletion) {
+	switch (fDriverCompletion)
+	{
 #ifdef WIN32
-	case SQL_DRIVER_PROMPT:
-		dialog_result = dconn_DoDialog(hwnd, ci);
-		if(dialog_result != SQL_SUCCESS) {
-			return dialog_result;
-		}
-		break;
+		case SQL_DRIVER_PROMPT:
+			dialog_result = dconn_DoDialog(hwnd, ci);
+			if (dialog_result != SQL_SUCCESS)
+				return dialog_result;
+			break;
 
-	case SQL_DRIVER_COMPLETE_REQUIRED:
+		case SQL_DRIVER_COMPLETE_REQUIRED:
 
-		/*	Fall through */
+			/* Fall through */
 
-	case SQL_DRIVER_COMPLETE:
+		case SQL_DRIVER_COMPLETE:
 
-		/* Password is not a required parameter. */
-		if( ci->username[0] == '\0' ||
-			ci->server[0] == '\0' ||
-			ci->database[0] == '\0' ||
-			ci->port[0] == '\0' ||
-			password_required) { 
+			/* Password is not a required parameter. */
+			if (ci->username[0] == '\0' ||
+				ci->server[0] == '\0' ||
+				ci->database[0] == '\0' ||
+				ci->port[0] == '\0' ||
+				password_required)
+			{
 
-			dialog_result = dconn_DoDialog(hwnd, ci);
-			if(dialog_result != SQL_SUCCESS) {
-				return dialog_result;
+				dialog_result = dconn_DoDialog(hwnd, ci);
+				if (dialog_result != SQL_SUCCESS)
+					return dialog_result;
 			}
-		}
-		break;
+			break;
 #else
-	case SQL_DRIVER_PROMPT:
-	case SQL_DRIVER_COMPLETE:
-	case SQL_DRIVER_COMPLETE_REQUIRED:
+		case SQL_DRIVER_PROMPT:
+		case SQL_DRIVER_COMPLETE:
+		case SQL_DRIVER_COMPLETE_REQUIRED:
 #endif
-	case SQL_DRIVER_NOPROMPT:
-		break;
+		case SQL_DRIVER_NOPROMPT:
+			break;
 	}
 
-	/*	Password is not a required parameter unless authentication asks for it.
-		For now, I think it's better to just let the application ask over and over until
-		a password is entered (the user can always hit Cancel to get out)
-	*/
-	if( ci->username[0] == '\0' ||
+	/*
+	 * Password is not a required parameter unless authentication asks for
+	 * it. For now, I think it's better to just let the application ask
+	 * over and over until a password is entered (the user can always hit
+	 * Cancel to get out)
+	 */
+	if (ci->username[0] == '\0' ||
 		ci->server[0] == '\0' ||
-		ci->database[0] == '\0' || 
-		ci->port[0] == '\0') {
+		ci->database[0] == '\0' ||
+		ci->port[0] == '\0')
+	{
 /*		(password_required && ci->password[0] == '\0')) */
 
 		return SQL_NO_DATA_FOUND;
@@ -174,12 +182,16 @@ dialog:
 
 	/* do the actual connect */
 	retval = CC_connect(conn, password_required);
-	if (retval < 0) {		/* need a password */
-		if (fDriverCompletion == SQL_DRIVER_NOPROMPT) {
+	if (retval < 0)
+	{							/* need a password */
+		if (fDriverCompletion == SQL_DRIVER_NOPROMPT)
+		{
 			CC_log_error(func, "Need password but Driver_NoPrompt", conn);
-			return SQL_ERROR;	/* need a password but not allowed to prompt so error */
+			return SQL_ERROR;	/* need a password but not allowed to
+								 * prompt so error */
 		}
-		else {
+		else
+		{
 #ifdef WIN32
 			password_required = TRUE;
 			goto dialog;
@@ -188,39 +200,44 @@ dialog:
 #endif
 		}
 	}
-	else if (retval == 0) {
-		/*	error msg filled in above */
+	else if (retval == 0)
+	{
+		/* error msg filled in above */
 		CC_log_error(func, "Error from CC_Connect", conn);
 		return SQL_ERROR;
 	}
 
 	/*********************************************/
-	/*     Create the Output Connection String   */
+	/* Create the Output Connection String	 */
 	/*********************************************/
 	result = SQL_SUCCESS;
 
 	makeConnectString(connStrOut, ci);
 	len = strlen(connStrOut);
 
-	if(szConnStrOut) {
-
-		/*	Return the completed string to the caller. The correct method is to 
-			only construct the connect string if a dialog was put up, otherwise, 
-			it should just copy the connection input string to the output.  
-			However, it seems ok to just always	construct an output string.  There
-			are possible bad side effects on working applications (Access) by 
-			implementing the correct behavior, anyway. 
-		*/
+	if (szConnStrOut)
+	{
+
+		/*
+		 * Return the completed string to the caller. The correct method
+		 * is to only construct the connect string if a dialog was put up,
+		 * otherwise, it should just copy the connection input string to
+		 * the output. However, it seems ok to just always construct an
+		 * output string.  There are possible bad side effects on working
+		 * applications (Access) by implementing the correct behavior,
+		 * anyway.
+		 */
 		strncpy_null(szConnStrOut, connStrOut, cbConnStrOutMax);
 
-		if (len >= cbConnStrOutMax) {
+		if (len >= cbConnStrOutMax)
+		{
 			result = SQL_SUCCESS_WITH_INFO;
 			conn->errornumber = CONN_TRUNCATED;
 			conn->errormsg = "The buffer was too small for the result.";
 		}
 	}
 
-	if(pcbConnStrOut)
+	if (pcbConnStrOut)
 		*pcbConnStrOut = len;
 
 	mylog("szConnStrOut = '%s'\n", szConnStrOut);
@@ -232,108 +249,117 @@ dialog:
 }
 
 #ifdef WIN32
-RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci)
+RETCODE
+dconn_DoDialog(HWND hwnd, ConnInfo *ci)
 {
-int dialog_result;
+	int			dialog_result;
 
-mylog("dconn_DoDialog: ci = %u\n", ci);
+	mylog("dconn_DoDialog: ci = %u\n", ci);
 
-	if(hwnd) {
+	if (hwnd)
+	{
 		dialog_result = DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_CONFIG),
-									hwnd, dconn_FDriverConnectProc, (LPARAM) ci);
-		if(!dialog_result || (dialog_result == -1)) {
+							hwnd, dconn_FDriverConnectProc, (LPARAM) ci);
+		if (!dialog_result || (dialog_result == -1))
 			return SQL_NO_DATA_FOUND;
-		} else {
+		else
 			return SQL_SUCCESS;
-		}
 	}
 
 	return SQL_ERROR;
 }
 
 
-BOOL FAR PASCAL dconn_FDriverConnectProc(
-                                         HWND    hdlg,
-                                         UINT    wMsg,
-                                         WPARAM  wParam,
-                                         LPARAM  lParam)
+BOOL FAR PASCAL
+dconn_FDriverConnectProc(
+						 HWND hdlg,
+						 UINT wMsg,
+						 WPARAM wParam,
+						 LPARAM lParam)
 {
-ConnInfo *ci;
+	ConnInfo   *ci;
 
-	switch (wMsg) {
-	case WM_INITDIALOG:
-		ci = (ConnInfo *) lParam;		
+	switch (wMsg)
+	{
+		case WM_INITDIALOG:
+			ci = (ConnInfo *) lParam;
 
-		/*	Change the caption for the setup dialog */
-		SetWindowText(hdlg, "PostgreSQL Connection");
+			/* Change the caption for the setup dialog */
+			SetWindowText(hdlg, "PostgreSQL Connection");
 
-		SetWindowText(GetDlgItem(hdlg, IDC_DATASOURCE), "Connection");
+			SetWindowText(GetDlgItem(hdlg, IDC_DATASOURCE), "Connection");
 
-		/*	Hide the DSN and description fields */
-		ShowWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), SW_HIDE);
-		ShowWindow(GetDlgItem(hdlg, IDC_DSNAME), SW_HIDE);
-		ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
-		ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
+			/* Hide the DSN and description fields */
+			ShowWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), SW_HIDE);
+			ShowWindow(GetDlgItem(hdlg, IDC_DSNAME), SW_HIDE);
+			ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
+			ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
 
-		SetWindowLong(hdlg, DWL_USER, lParam);/* Save the ConnInfo for the "OK" */
+			SetWindowLong(hdlg, DWL_USER, lParam);		/* Save the ConnInfo for
+														 * the "OK" */
 
-		SetDlgStuff(hdlg, ci);
+			SetDlgStuff(hdlg, ci);
 
-		if (ci->database[0] == '\0')		
-			;	/* default focus */
-		else if (ci->server[0] == '\0')
-			SetFocus(GetDlgItem(hdlg, IDC_SERVER));
-		else if (ci->port[0] == '\0')
-			SetFocus(GetDlgItem(hdlg, IDC_PORT));
-		else if (ci->username[0] == '\0')
-			SetFocus(GetDlgItem(hdlg, IDC_USER));
-		else if (ci->focus_password)
-			SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
+			if (ci->database[0] == '\0')
+				;				/* default focus */
+			else if (ci->server[0] == '\0')
+				SetFocus(GetDlgItem(hdlg, IDC_SERVER));
+			else if (ci->port[0] == '\0')
+				SetFocus(GetDlgItem(hdlg, IDC_PORT));
+			else if (ci->username[0] == '\0')
+				SetFocus(GetDlgItem(hdlg, IDC_USER));
+			else if (ci->focus_password)
+				SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
 
 
-		break; 
+			break;
 
-	case WM_COMMAND:
-		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
-		case IDOK:
+		case WM_COMMAND:
+			switch (GET_WM_COMMAND_ID(wParam, lParam))
+			{
+				case IDOK:
 
-			ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
 
-			GetDlgStuff(hdlg, ci);
+					GetDlgStuff(hdlg, ci);
 
 
-		case IDCANCEL:
-			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-			return TRUE;
+				case IDCANCEL:
+					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+					return TRUE;
 
-		case IDC_DRIVER:
+				case IDC_DRIVER:
 
-			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
-									hdlg, driver_optionsProc, (LPARAM) NULL);
+					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+								hdlg, driver_optionsProc, (LPARAM) NULL);
 
 
-			break;
+					break;
 
-		case IDC_DATASOURCE:
+				case IDC_DATASOURCE:
 
-			ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
-			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
-									hdlg, ds_optionsProc, (LPARAM) ci);
+					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
+								   hdlg, ds_optionsProc, (LPARAM) ci);
 
-			break;
-		}
+					break;
+			}
 	}
 
 	return FALSE;
 }
 
-#endif	/* WIN32 */
+#endif	 /* WIN32 */
 
-void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci)
+void
+dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci)
 {
-char *our_connect_string;
-char *pair, *attribute, *value, *equals;
-char *strtok_arg;
+	char	   *our_connect_string;
+	char	   *pair,
+			   *attribute,
+			   *value,
+			   *equals;
+	char	   *strtok_arg;
 
 	memset(ci, 0, sizeof(ConnInfo));
 
@@ -342,29 +368,28 @@ char *strtok_arg;
 
 	mylog("our_connect_string = '%s'\n", our_connect_string);
 
-	while(1) {
+	while (1)
+	{
 		pair = strtok(strtok_arg, ";");
-		if(strtok_arg) {
+		if (strtok_arg)
 			strtok_arg = 0;
-		}
-		if(!pair) {
+		if (!pair)
 			break;
-		}
 
 		equals = strchr(pair, '=');
-		if ( ! equals)
+		if (!equals)
 			continue;
 
 		*equals = '\0';
-		attribute = pair;		/*	ex. DSN */
-		value = equals + 1;		/*	ex. 'CEO co1' */
+		attribute = pair;		/* ex. DSN */
+		value = equals + 1;		/* ex. 'CEO co1' */
 
 		mylog("attribute = '%s', value = '%s'\n", attribute, value);
 
-		if( !attribute || !value)
-			continue;          
+		if (!attribute || !value)
+			continue;
 
-		/*	Copy the appropriate value to the conninfo  */
+		/* Copy the appropriate value to the conninfo  */
 		copyAttributes(ci, attribute, value);
 
 	}
@@ -372,4 +397,3 @@ char *strtok_arg;
 
 	free(our_connect_string);
 }
-
diff --git a/src/interfaces/odbc/environ.c b/src/interfaces/odbc/environ.c
index fb8ed6869ae7b287bce241ff5681fe22fc2924e9..9aafcb14adc7cb41b5b374c225a7e41b728ee5dc 100644
--- a/src/interfaces/odbc/environ.c
+++ b/src/interfaces/odbc/environ.c
@@ -1,15 +1,15 @@
 
-/* Module:          environ.c
+/* Module:			environ.c
  *
- * Description:     This module contains routines related to 
- *                  the environment, such as storing connection handles,
- *                  and returning errors.
+ * Description:		This module contains routines related to
+ *					the environment, such as storing connection handles,
+ *					and returning errors.
  *
- * Classes:         EnvironmentClass (Functions prefix: "EN_")
+ * Classes:			EnvironmentClass (Functions prefix: "EN_")
  *
- * API functions:   SQLAllocEnv, SQLFreeEnv, SQLError
+ * API functions:	SQLAllocEnv, SQLFreeEnv, SQLError
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -26,40 +26,45 @@ extern GLOBAL_VALUES globals;
 ConnectionClass *conns[MAX_CONNECTIONS];
 
 
-RETCODE SQL_API SQLAllocEnv(HENV FAR *phenv)
+RETCODE SQL_API
+SQLAllocEnv(HENV FAR *phenv)
 {
-    static char *func = "SQLAllocEnv";
+	static char *func = "SQLAllocEnv";
 
 	mylog("**** in SQLAllocEnv ** \n");
 
 	/*
 	 * Hack for systems on which none of the constructor-making techniques
-	 * in psqlodbc.c work: if globals appears not to have been initialized,
-	 * then cause it to be initialized.  Since this should be the first
-	 * function called in this shared library, doing it here should work.
+	 * in psqlodbc.c work: if globals appears not to have been
+	 * initialized, then cause it to be initialized.  Since this should be
+	 * the first function called in this shared library, doing it here
+	 * should work.
 	 */
 	if (globals.socket_buffersize <= 0)
 		getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
 
 	*phenv = (HENV) EN_Constructor();
-	if ( ! *phenv) {
+	if (!*phenv)
+	{
 		*phenv = SQL_NULL_HENV;
 		EN_log_error(func, "Error allocating environment", NULL);
 		return SQL_ERROR;
 	}
- 
+
 	mylog("** exit SQLAllocEnv: phenv = %u **\n", *phenv);
 	return SQL_SUCCESS;
 }
 
-RETCODE SQL_API SQLFreeEnv(HENV henv)
+RETCODE SQL_API
+SQLFreeEnv(HENV henv)
 {
-static char *func = "SQLFreeEnv";
-EnvironmentClass *env = (EnvironmentClass *) henv;
+	static char *func = "SQLFreeEnv";
+	EnvironmentClass *env = (EnvironmentClass *) henv;
 
-mylog("**** in SQLFreeEnv: env = %u ** \n", env);
+	mylog("**** in SQLFreeEnv: env = %u ** \n", env);
 
-	if (env && EN_Destructor(env)) {
+	if (env && EN_Destructor(env))
+	{
 		mylog("   ok\n");
 		return SQL_SUCCESS;
 	}
@@ -69,321 +74,349 @@ mylog("**** in SQLFreeEnv: env = %u ** \n", env);
 	return SQL_ERROR;
 }
 
-/*      Returns the next SQL error information. */
-
-RETCODE SQL_API SQLError(
-        HENV       henv,
-        HDBC       hdbc,
-        HSTMT      hstmt,
-        UCHAR  FAR *szSqlState,
-        SDWORD FAR *pfNativeError,
-        UCHAR  FAR *szErrorMsg,
-        SWORD      cbErrorMsgMax,
-        SWORD  FAR *pcbErrorMsg)
+/*		Returns the next SQL error information. */
+
+RETCODE SQL_API
+SQLError(
+		 HENV henv,
+		 HDBC hdbc,
+		 HSTMT hstmt,
+		 UCHAR FAR *szSqlState,
+		 SDWORD FAR *pfNativeError,
+		 UCHAR FAR *szErrorMsg,
+		 SWORD cbErrorMsgMax,
+		 SWORD FAR *pcbErrorMsg)
 {
-char *msg;
-int status;
-    
+	char	   *msg;
+	int			status;
+
 	mylog("**** SQLError: henv=%u, hdbc=%u, hstmt=%u\n", henv, hdbc, hstmt);
 
-    if (SQL_NULL_HSTMT != hstmt) {
-	/* CC: return an error of a hstmt  */
-        StatementClass *stmt = (StatementClass *) hstmt;
-        
-        if (SC_get_error(stmt, &status, &msg)) {
+	if (SQL_NULL_HSTMT != hstmt)
+	{
+		/* CC: return an error of a hstmt  */
+		StatementClass *stmt = (StatementClass *) hstmt;
+
+		if (SC_get_error(stmt, &status, &msg))
+		{
 			mylog("SC_get_error: status = %d, msg = #%s#\n", status, msg);
-            if (NULL == msg) {
-                if (NULL != szSqlState)
-                    strcpy(szSqlState, "00000");
-                if (NULL != pcbErrorMsg)
-                    *pcbErrorMsg = 0;
-                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                    szErrorMsg[0] = '\0';
-                
-                return SQL_NO_DATA_FOUND;
-            }                
-            if (NULL != pcbErrorMsg)                
-                *pcbErrorMsg = (SWORD)strlen(msg);
-            
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-            
-            if (NULL != pfNativeError) 
-                *pfNativeError = status;
-            
-            if (NULL != szSqlState)    
-                
-                switch (status) {
-		/* now determine the SQLSTATE to be returned */
-                case STMT_TRUNCATED:
-                    strcpy(szSqlState, "01004");
-                    /* data truncated */
-                    break;
-                case STMT_INFO_ONLY:
-                    strcpy(szSqlState, "00000");
-                    /* just information that is returned, no error */
-                    break;
-                case STMT_BAD_ERROR:
-                    strcpy(szSqlState, "08S01");
-                    /* communication link failure */
-                    break;
-                case STMT_CREATE_TABLE_ERROR:
-                    strcpy(szSqlState, "S0001");
-                    /* table already exists */
-                    break;
-                case STMT_STATUS_ERROR:
-                case STMT_SEQUENCE_ERROR:
-                    strcpy(szSqlState, "S1010");
-                    /* Function sequence error */
-                    break;
-                case STMT_NO_MEMORY_ERROR:
-                    strcpy(szSqlState, "S1001");
-                    /* memory allocation failure */
-                    break;
-                case STMT_COLNUM_ERROR:
-                    strcpy(szSqlState, "S1002");
-                    /* invalid column number */
-                    break;
-                case STMT_NO_STMTSTRING:
-                    strcpy(szSqlState, "S1001");
-                    /* having no stmtstring is also a malloc problem */
-                    break;
-                case STMT_ERROR_TAKEN_FROM_BACKEND:
-                    strcpy(szSqlState, "S1000");
-                    /* general error */
-                    break;
-                case STMT_INTERNAL_ERROR:
-                    strcpy(szSqlState, "S1000");
-                    /* general error */
-                    break;  
-				case STMT_ROW_OUT_OF_RANGE:
-					strcpy(szSqlState, "S1107");
-					break;
-
-				case STMT_OPERATION_CANCELLED:
-					strcpy(szSqlState, "S1008");
-					break;
-
-                case STMT_NOT_IMPLEMENTED_ERROR:
-                    strcpy(szSqlState, "S1C00"); /* == 'driver not capable' */
-                    break;
-                case STMT_OPTION_OUT_OF_RANGE_ERROR:
-                    strcpy(szSqlState, "S1092");
-                    break;
-                case STMT_BAD_PARAMETER_NUMBER_ERROR:
-                    strcpy(szSqlState, "S1093");
-                    break;
-                case STMT_INVALID_COLUMN_NUMBER_ERROR:
-                    strcpy(szSqlState, "S1002");
-                    break;
-                case STMT_RESTRICTED_DATA_TYPE_ERROR:
-                    strcpy(szSqlState, "07006");
-                    break;
-                case STMT_INVALID_CURSOR_STATE_ERROR:
-                    strcpy(szSqlState, "24000");
-                    break;
-                case STMT_OPTION_VALUE_CHANGED:
-                    strcpy(szSqlState, "01S02");
-                    break;
-				case STMT_INVALID_CURSOR_NAME:
-                    strcpy(szSqlState, "34000");
-                    break;
-				case STMT_NO_CURSOR_NAME:
-                    strcpy(szSqlState, "S1015");
-                    break;
-                case STMT_INVALID_ARGUMENT_NO:
-                    strcpy(szSqlState, "S1009");
-                    /* invalid argument value */
-                    break;
-				case STMT_INVALID_CURSOR_POSITION:
-                    strcpy(szSqlState, "S1109");
-                    break;
-                
-				case STMT_VALUE_OUT_OF_RANGE:
-					strcpy(szSqlState, "22003");
-					break;
-
-				case STMT_OPERATION_INVALID:
-					strcpy(szSqlState, "S1011");
-					break;
-
-				case STMT_EXEC_ERROR:
-				default:
-                    strcpy(szSqlState, "S1000");
-                    /* also a general error */
-                    break;
-                }         
-
-				mylog("       szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg);
-            
-        } else {
-            if (NULL != szSqlState)
-                strcpy(szSqlState, "00000");
-            if (NULL != pcbErrorMsg)
-                *pcbErrorMsg = 0;
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                szErrorMsg[0] = '\0';
-            
+			if (NULL == msg)
+			{
+				if (NULL != szSqlState)
+					strcpy(szSqlState, "00000");
+				if (NULL != pcbErrorMsg)
+					*pcbErrorMsg = 0;
+				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+					szErrorMsg[0] = '\0';
+
+				return SQL_NO_DATA_FOUND;
+			}
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = (SWORD) strlen(msg);
+
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+
+			if (NULL != pfNativeError)
+				*pfNativeError = status;
+
+			if (NULL != szSqlState)
+
+				switch (status)
+				{
+						/* now determine the SQLSTATE to be returned */
+					case STMT_TRUNCATED:
+						strcpy(szSqlState, "01004");
+						/* data truncated */
+						break;
+					case STMT_INFO_ONLY:
+						strcpy(szSqlState, "00000");
+						/* just information that is returned, no error */
+						break;
+					case STMT_BAD_ERROR:
+						strcpy(szSqlState, "08S01");
+						/* communication link failure */
+						break;
+					case STMT_CREATE_TABLE_ERROR:
+						strcpy(szSqlState, "S0001");
+						/* table already exists */
+						break;
+					case STMT_STATUS_ERROR:
+					case STMT_SEQUENCE_ERROR:
+						strcpy(szSqlState, "S1010");
+						/* Function sequence error */
+						break;
+					case STMT_NO_MEMORY_ERROR:
+						strcpy(szSqlState, "S1001");
+						/* memory allocation failure */
+						break;
+					case STMT_COLNUM_ERROR:
+						strcpy(szSqlState, "S1002");
+						/* invalid column number */
+						break;
+					case STMT_NO_STMTSTRING:
+						strcpy(szSqlState, "S1001");
+						/* having no stmtstring is also a malloc problem */
+						break;
+					case STMT_ERROR_TAKEN_FROM_BACKEND:
+						strcpy(szSqlState, "S1000");
+						/* general error */
+						break;
+					case STMT_INTERNAL_ERROR:
+						strcpy(szSqlState, "S1000");
+						/* general error */
+						break;
+					case STMT_ROW_OUT_OF_RANGE:
+						strcpy(szSqlState, "S1107");
+						break;
+
+					case STMT_OPERATION_CANCELLED:
+						strcpy(szSqlState, "S1008");
+						break;
+
+					case STMT_NOT_IMPLEMENTED_ERROR:
+						strcpy(szSqlState, "S1C00");	/* == 'driver not
+														 * capable' */
+						break;
+					case STMT_OPTION_OUT_OF_RANGE_ERROR:
+						strcpy(szSqlState, "S1092");
+						break;
+					case STMT_BAD_PARAMETER_NUMBER_ERROR:
+						strcpy(szSqlState, "S1093");
+						break;
+					case STMT_INVALID_COLUMN_NUMBER_ERROR:
+						strcpy(szSqlState, "S1002");
+						break;
+					case STMT_RESTRICTED_DATA_TYPE_ERROR:
+						strcpy(szSqlState, "07006");
+						break;
+					case STMT_INVALID_CURSOR_STATE_ERROR:
+						strcpy(szSqlState, "24000");
+						break;
+					case STMT_OPTION_VALUE_CHANGED:
+						strcpy(szSqlState, "01S02");
+						break;
+					case STMT_INVALID_CURSOR_NAME:
+						strcpy(szSqlState, "34000");
+						break;
+					case STMT_NO_CURSOR_NAME:
+						strcpy(szSqlState, "S1015");
+						break;
+					case STMT_INVALID_ARGUMENT_NO:
+						strcpy(szSqlState, "S1009");
+						/* invalid argument value */
+						break;
+					case STMT_INVALID_CURSOR_POSITION:
+						strcpy(szSqlState, "S1109");
+						break;
+
+					case STMT_VALUE_OUT_OF_RANGE:
+						strcpy(szSqlState, "22003");
+						break;
+
+					case STMT_OPERATION_INVALID:
+						strcpy(szSqlState, "S1011");
+						break;
+
+					case STMT_EXEC_ERROR:
+					default:
+						strcpy(szSqlState, "S1000");
+						/* also a general error */
+						break;
+				}
+
+			mylog("       szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg);
+
+		}
+		else
+		{
+			if (NULL != szSqlState)
+				strcpy(szSqlState, "00000");
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = 0;
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				szErrorMsg[0] = '\0';
+
 			mylog("       returning NO_DATA_FOUND\n");
-            return SQL_NO_DATA_FOUND;
-        }
-        return SQL_SUCCESS;    
-        
-    } else if (SQL_NULL_HDBC != hdbc) {
-        ConnectionClass *conn = (ConnectionClass *) hdbc;
-        
+			return SQL_NO_DATA_FOUND;
+		}
+		return SQL_SUCCESS;
+
+	}
+	else if (SQL_NULL_HDBC != hdbc)
+	{
+		ConnectionClass *conn = (ConnectionClass *) hdbc;
+
 		mylog("calling CC_get_error\n");
-        if (CC_get_error(conn, &status, &msg)) {
+		if (CC_get_error(conn, &status, &msg))
+		{
 			mylog("CC_get_error: status = %d, msg = #%s#\n", status, msg);
-            if (NULL == msg) {
-                if (NULL != szSqlState)
-                    strcpy(szSqlState, "00000");
-                if (NULL != pcbErrorMsg)
-                    *pcbErrorMsg = 0;
-                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                    szErrorMsg[0] = '\0';
-                
-                return SQL_NO_DATA_FOUND;
-            }                
-            
-            if (NULL != pcbErrorMsg)
-                *pcbErrorMsg = (SWORD)strlen(msg);
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))    
-                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-            if (NULL != pfNativeError)    
-                *pfNativeError = status;
-            
-            if (NULL != szSqlState) 
-                switch(status) {
-				case STMT_OPTION_VALUE_CHANGED:
-				case CONN_OPTION_VALUE_CHANGED:
-                    strcpy(szSqlState, "01S02");
-					break;
-                case STMT_TRUNCATED:
-				case CONN_TRUNCATED:
-                    strcpy(szSqlState, "01004");
-                    /* data truncated */
-                    break;
-                case CONN_INIREAD_ERROR:
-                    strcpy(szSqlState, "IM002");
-                    /* data source not found */
-                    break;
-                case CONN_OPENDB_ERROR:
-                    strcpy(szSqlState, "08001");
-                    /* unable to connect to data source */
-                    break;
-				case CONN_INVALID_AUTHENTICATION:
-				case CONN_AUTH_TYPE_UNSUPPORTED:
-					strcpy(szSqlState, "28000");
-					break;
-                case CONN_STMT_ALLOC_ERROR:
-                    strcpy(szSqlState, "S1001");
-                    /* memory allocation failure */
-                    break;
-                case CONN_IN_USE:
-                    strcpy(szSqlState, "S1000");
-                    /* general error */
-                    break;
-                case CONN_UNSUPPORTED_OPTION:
-                    strcpy(szSqlState, "IM001");
-                    /* driver does not support this function */
-                case CONN_INVALID_ARGUMENT_NO:
-                    strcpy(szSqlState, "S1009");
-                    /* invalid argument value */
-                    break;
-                case CONN_TRANSACT_IN_PROGRES:
-                    strcpy(szSqlState, "S1010");
-                    /* when the user tries to switch commit mode in a transaction */
-                    /* -> function sequence error */
-                    break;
-                case CONN_NO_MEMORY_ERROR:
-                    strcpy(szSqlState, "S1001");
-                    break;
-                case CONN_NOT_IMPLEMENTED_ERROR:
-				case STMT_NOT_IMPLEMENTED_ERROR:
-                    strcpy(szSqlState, "S1C00");
-                    break;
-
-				case CONN_VALUE_OUT_OF_RANGE:
-				case STMT_VALUE_OUT_OF_RANGE:
-					strcpy(szSqlState, "22003");
-					break;
-
-                default:
-                    strcpy(szSqlState, "S1000");
-                    /* general error */
-                    break;
-                }
-       
-        } else {
+			if (NULL == msg)
+			{
+				if (NULL != szSqlState)
+					strcpy(szSqlState, "00000");
+				if (NULL != pcbErrorMsg)
+					*pcbErrorMsg = 0;
+				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+					szErrorMsg[0] = '\0';
+
+				return SQL_NO_DATA_FOUND;
+			}
+
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = (SWORD) strlen(msg);
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+			if (NULL != pfNativeError)
+				*pfNativeError = status;
+
+			if (NULL != szSqlState)
+				switch (status)
+				{
+					case STMT_OPTION_VALUE_CHANGED:
+					case CONN_OPTION_VALUE_CHANGED:
+						strcpy(szSqlState, "01S02");
+						break;
+					case STMT_TRUNCATED:
+					case CONN_TRUNCATED:
+						strcpy(szSqlState, "01004");
+						/* data truncated */
+						break;
+					case CONN_INIREAD_ERROR:
+						strcpy(szSqlState, "IM002");
+						/* data source not found */
+						break;
+					case CONN_OPENDB_ERROR:
+						strcpy(szSqlState, "08001");
+						/* unable to connect to data source */
+						break;
+					case CONN_INVALID_AUTHENTICATION:
+					case CONN_AUTH_TYPE_UNSUPPORTED:
+						strcpy(szSqlState, "28000");
+						break;
+					case CONN_STMT_ALLOC_ERROR:
+						strcpy(szSqlState, "S1001");
+						/* memory allocation failure */
+						break;
+					case CONN_IN_USE:
+						strcpy(szSqlState, "S1000");
+						/* general error */
+						break;
+					case CONN_UNSUPPORTED_OPTION:
+						strcpy(szSqlState, "IM001");
+						/* driver does not support this function */
+					case CONN_INVALID_ARGUMENT_NO:
+						strcpy(szSqlState, "S1009");
+						/* invalid argument value */
+						break;
+					case CONN_TRANSACT_IN_PROGRES:
+						strcpy(szSqlState, "S1010");
+
+						/*
+						 * when the user tries to switch commit mode in a
+						 * transaction
+						 */
+						/* -> function sequence error */
+						break;
+					case CONN_NO_MEMORY_ERROR:
+						strcpy(szSqlState, "S1001");
+						break;
+					case CONN_NOT_IMPLEMENTED_ERROR:
+					case STMT_NOT_IMPLEMENTED_ERROR:
+						strcpy(szSqlState, "S1C00");
+						break;
+
+					case CONN_VALUE_OUT_OF_RANGE:
+					case STMT_VALUE_OUT_OF_RANGE:
+						strcpy(szSqlState, "22003");
+						break;
+
+					default:
+						strcpy(szSqlState, "S1000");
+						/* general error */
+						break;
+				}
+
+		}
+		else
+		{
 			mylog("CC_Get_error returned nothing.\n");
-            if (NULL != szSqlState)
-                strcpy(szSqlState, "00000");
-            if (NULL != pcbErrorMsg)
-                *pcbErrorMsg = 0;
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                szErrorMsg[0] = '\0';
-            
-            return SQL_NO_DATA_FOUND;
-        }
-        return SQL_SUCCESS;
-        
-    } else if (SQL_NULL_HENV != henv) {
-        EnvironmentClass *env = (EnvironmentClass *)henv;
-        if(EN_get_error(env, &status, &msg)) {
+			if (NULL != szSqlState)
+				strcpy(szSqlState, "00000");
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = 0;
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				szErrorMsg[0] = '\0';
+
+			return SQL_NO_DATA_FOUND;
+		}
+		return SQL_SUCCESS;
+
+	}
+	else if (SQL_NULL_HENV != henv)
+	{
+		EnvironmentClass *env = (EnvironmentClass *) henv;
+
+		if (EN_get_error(env, &status, &msg))
+		{
 			mylog("EN_get_error: status = %d, msg = #%s#\n", status, msg);
-            if (NULL == msg) {
-                if (NULL != szSqlState)
-                    strcpy(szSqlState, "00000");
-                if (NULL != pcbErrorMsg)
-                    *pcbErrorMsg = 0;
-                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                    szErrorMsg[0] = '\0';
-
-                return SQL_NO_DATA_FOUND;
-            }                
-
-            if (NULL != pcbErrorMsg)                
-                *pcbErrorMsg = (SWORD)strlen(msg);
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-            if (NULL != pfNativeError) 
-                *pfNativeError = status;
-            
-            if(szSqlState) {
-                switch(status) {
-                case ENV_ALLOC_ERROR:
-		    /* memory allocation failure */
-                    strcpy(szSqlState, "S1001");
-                    break;
-                default:
-                    strcpy(szSqlState, "S1000");
-                    /* general error */
-                    break;
-                }
-            }
-        } else {
-            if (NULL != szSqlState)
-                strcpy(szSqlState, "00000");
-            if (NULL != pcbErrorMsg)
-                *pcbErrorMsg = 0;
-            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-                szErrorMsg[0] = '\0';
-            
-            return SQL_NO_DATA_FOUND;
-        }
-
-        return SQL_SUCCESS;
-    }
-    
-    if (NULL != szSqlState)
-        strcpy(szSqlState, "00000");
-    if (NULL != pcbErrorMsg)
-        *pcbErrorMsg = 0;
-    if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
-        szErrorMsg[0] = '\0';
-    
-    return SQL_NO_DATA_FOUND;
+			if (NULL == msg)
+			{
+				if (NULL != szSqlState)
+					strcpy(szSqlState, "00000");
+				if (NULL != pcbErrorMsg)
+					*pcbErrorMsg = 0;
+				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+					szErrorMsg[0] = '\0';
+
+				return SQL_NO_DATA_FOUND;
+			}
+
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = (SWORD) strlen(msg);
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+			if (NULL != pfNativeError)
+				*pfNativeError = status;
+
+			if (szSqlState)
+			{
+				switch (status)
+				{
+					case ENV_ALLOC_ERROR:
+						/* memory allocation failure */
+						strcpy(szSqlState, "S1001");
+						break;
+					default:
+						strcpy(szSqlState, "S1000");
+						/* general error */
+						break;
+				}
+			}
+		}
+		else
+		{
+			if (NULL != szSqlState)
+				strcpy(szSqlState, "00000");
+			if (NULL != pcbErrorMsg)
+				*pcbErrorMsg = 0;
+			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+				szErrorMsg[0] = '\0';
+
+			return SQL_NO_DATA_FOUND;
+		}
+
+		return SQL_SUCCESS;
+	}
+
+	if (NULL != szSqlState)
+		strcpy(szSqlState, "00000");
+	if (NULL != pcbErrorMsg)
+		*pcbErrorMsg = 0;
+	if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+		szErrorMsg[0] = '\0';
+
+	return SQL_NO_DATA_FOUND;
 }
 
 
@@ -395,25 +428,27 @@ int status;
 
 
 EnvironmentClass
-*EN_Constructor(void)
+		   *
+EN_Constructor(void)
 {
-EnvironmentClass *rv;
+	EnvironmentClass *rv;
 
-    rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
-    if( rv) {
+	rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
+	if (rv)
+	{
 		rv->errormsg = 0;
 		rv->errornumber = 0;
 	}
 
-    return rv;
+	return rv;
 }
 
 
 char
 EN_Destructor(EnvironmentClass *self)
 {
-int lf;
-char rv = 1;
+	int			lf;
+	char		rv = 1;
 
 	mylog("in EN_Destructor, self=%u\n", self);
 
@@ -421,7 +456,8 @@ char rv = 1;
 	/* the source--they should not be freed */
 
 	/* Free any connections belonging to this environment */
-	for (lf = 0; lf < MAX_CONNECTIONS; lf++) {
+	for (lf = 0; lf < MAX_CONNECTIONS; lf++)
+	{
 		if (conns[lf] && conns[lf]->henv == self)
 			rv = rv && CC_Destructor(conns[lf]);
 	}
@@ -434,26 +470,29 @@ char rv = 1;
 char
 EN_get_error(EnvironmentClass *self, int *number, char **message)
 {
-	if(self && self->errormsg && self->errornumber) {
+	if (self && self->errormsg && self->errornumber)
+	{
 		*message = self->errormsg;
 		*number = self->errornumber;
 		self->errormsg = 0;
 		self->errornumber = 0;
 		return 1;
-	} else {
-		return 0;
 	}
+	else
+		return 0;
 }
 
 char
 EN_add_connection(EnvironmentClass *self, ConnectionClass *conn)
 {
-int i;
+	int			i;
 
-mylog("EN_add_connection: self = %u, conn = %u\n", self, conn);
+	mylog("EN_add_connection: self = %u, conn = %u\n", self, conn);
 
-	for (i = 0; i < MAX_CONNECTIONS; i++) {
-		if ( ! conns[i]) {
+	for (i = 0; i < MAX_CONNECTIONS; i++)
+	{
+		if (!conns[i])
+		{
 			conn->henv = self;
 			conns[i] = conn;
 
@@ -469,10 +508,11 @@ mylog("EN_add_connection: self = %u, conn = %u\n", self, conn);
 char
 EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn)
 {
-int i;
+	int			i;
 
 	for (i = 0; i < MAX_CONNECTIONS; i++)
-		if (conns[i] == conn && conns[i]->status != CONN_EXECUTING) {
+		if (conns[i] == conn && conns[i]->status != CONN_EXECUTING)
+		{
 			conns[i] = NULL;
 			return TRUE;
 		}
@@ -483,9 +523,8 @@ int i;
 void
 EN_log_error(char *func, char *desc, EnvironmentClass *self)
 {
-	if (self) {
+	if (self)
 		qlog("ENVIRON ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, self->errormsg);
-	}
 	else
 		qlog("INVALID ENVIRON HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 }
diff --git a/src/interfaces/odbc/environ.h b/src/interfaces/odbc/environ.h
index 47018e7b38f2f5f108e8c1fab1431cc884541df8..c236e575c1e933f1c2b87d37e17f20aadda97a5b 100644
--- a/src/interfaces/odbc/environ.h
+++ b/src/interfaces/odbc/environ.h
@@ -1,9 +1,9 @@
 
-/* File:            environ.h
+/* File:			environ.h
  *
- * Description:     See "environ.c"
+ * Description:		See "environ.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -29,17 +29,18 @@
 #define ENV_ALLOC_ERROR 1
 
 /**********		Environment Handle	*************/
-struct EnvironmentClass_ {
-	char *errormsg;
-	int errornumber;
+struct EnvironmentClass_
+{
+	char	   *errormsg;
+	int			errornumber;
 };
 
 /*	Environment prototypes */
 EnvironmentClass *EN_Constructor(void);
-char EN_Destructor(EnvironmentClass *self);
-char EN_get_error(EnvironmentClass *self, int *number, char **message);
-char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn);
-char EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn);
-void EN_log_error(char *func, char *desc, EnvironmentClass *self);
+char		EN_Destructor(EnvironmentClass *self);
+char		EN_get_error(EnvironmentClass *self, int *number, char **message);
+char		EN_add_connection(EnvironmentClass *self, ConnectionClass *conn);
+char		EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn);
+void		EN_log_error(char *func, char *desc, EnvironmentClass *self);
 
 #endif
diff --git a/src/interfaces/odbc/execute.c b/src/interfaces/odbc/execute.c
index ac5d0b19c38dd17c7430ca69239f444e0606a4eb..356da6edcb23eda5d05f32deff82f648346dd5c3 100644
--- a/src/interfaces/odbc/execute.c
+++ b/src/interfaces/odbc/execute.c
@@ -1,15 +1,15 @@
 
-/* Module:          execute.c
+/* Module:			execute.c
  *
- * Description:     This module contains routines related to 
- *                  preparing and executing an SQL statement.
+ * Description:		This module contains routines related to
+ *					preparing and executing an SQL statement.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   SQLPrepare, SQLExecute, SQLExecDirect, SQLTransact,
- *                  SQLCancel, SQLNativeSql, SQLParamData, SQLPutData
+ * API functions:	SQLPrepare, SQLExecute, SQLExecDirect, SQLTransact,
+ *					SQLCancel, SQLNativeSql, SQLParamData, SQLPutData
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -39,66 +39,74 @@
 extern GLOBAL_VALUES globals;
 
 
-/*      Perform a Prepare on the SQL statement */
-RETCODE SQL_API SQLPrepare(HSTMT     hstmt,
-                           UCHAR FAR *szSqlStr,
-                           SDWORD    cbSqlStr)
+/*		Perform a Prepare on the SQL statement */
+RETCODE SQL_API
+SQLPrepare(HSTMT hstmt,
+		   UCHAR FAR *szSqlStr,
+		   SDWORD cbSqlStr)
 {
-static char *func = "SQLPrepare";
-StatementClass *self = (StatementClass *) hstmt;
+	static char *func = "SQLPrepare";
+	StatementClass *self = (StatementClass *) hstmt;
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if ( ! self) {
+	if (!self)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
-    
-	/*	According to the ODBC specs it is valid to call SQLPrepare mulitple times.
-		In that case, the bound SQL statement is replaced by the new one 
-	*/
 
-	switch(self->status) {
-	case STMT_PREMATURE:
-		mylog("**** SQLPrepare: STMT_PREMATURE, recycle\n");
-		SC_recycle_statement(self); /* recycle the statement, but do not remove parameter bindings */
-		break;
+	/*
+	 * According to the ODBC specs it is valid to call SQLPrepare mulitple
+	 * times. In that case, the bound SQL statement is replaced by the new
+	 * one
+	 */
+
+	switch (self->status)
+	{
+		case STMT_PREMATURE:
+			mylog("**** SQLPrepare: STMT_PREMATURE, recycle\n");
+			SC_recycle_statement(self); /* recycle the statement, but do
+										 * not remove parameter bindings */
+			break;
 
-	case STMT_FINISHED:
-		mylog("**** SQLPrepare: STMT_FINISHED, recycle\n");
-		SC_recycle_statement(self); /* recycle the statement, but do not remove parameter bindings */
-		break;
+		case STMT_FINISHED:
+			mylog("**** SQLPrepare: STMT_FINISHED, recycle\n");
+			SC_recycle_statement(self); /* recycle the statement, but do
+										 * not remove parameter bindings */
+			break;
 
-	case STMT_ALLOCATED:
-		mylog("**** SQLPrepare: STMT_ALLOCATED, copy\n");
-		self->status = STMT_READY;
-		break;
+		case STMT_ALLOCATED:
+			mylog("**** SQLPrepare: STMT_ALLOCATED, copy\n");
+			self->status = STMT_READY;
+			break;
 
-	case STMT_READY:
-		mylog("**** SQLPrepare: STMT_READY, change SQL\n");
-		break;
+		case STMT_READY:
+			mylog("**** SQLPrepare: STMT_READY, change SQL\n");
+			break;
 
-	case STMT_EXECUTING:
-		mylog("**** SQLPrepare: STMT_EXECUTING, error!\n");
+		case STMT_EXECUTING:
+			mylog("**** SQLPrepare: STMT_EXECUTING, error!\n");
 
-		self->errornumber = STMT_SEQUENCE_ERROR;
-		self->errormsg = "SQLPrepare(): The handle does not point to a statement that is ready to be executed";
-		SC_log_error(func, "", self);
+			self->errornumber = STMT_SEQUENCE_ERROR;
+			self->errormsg = "SQLPrepare(): The handle does not point to a statement that is ready to be executed";
+			SC_log_error(func, "", self);
 
-		return SQL_ERROR;
+			return SQL_ERROR;
 
-	default:
-		self->errornumber = STMT_INTERNAL_ERROR;
-		self->errormsg = "An Internal Error has occured -- Unknown statement status.";
-		SC_log_error(func, "", self);
-		return SQL_ERROR;
+		default:
+			self->errornumber = STMT_INTERNAL_ERROR;
+			self->errormsg = "An Internal Error has occured -- Unknown statement status.";
+			SC_log_error(func, "", self);
+			return SQL_ERROR;
 	}
 
 	if (self->statement)
 		free(self->statement);
 
 	self->statement = make_string(szSqlStr, cbSqlStr, NULL);
-	if ( ! self->statement) {
+	if (!self->statement)
+	{
 		self->errornumber = STMT_NO_MEMORY_ERROR;
 		self->errormsg = "No memory available to store statement";
 		SC_log_error(func, "", self);
@@ -108,8 +116,9 @@ StatementClass *self = (StatementClass *) hstmt;
 	self->prepare = TRUE;
 	self->statement_type = statement_type(self->statement);
 
-	/*	Check if connection is onlyread (only selects are allowed) */
-	if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) {
+	/* Check if connection is onlyread (only selects are allowed) */
+	if (CC_is_onlyread(self->hdbc) && STMT_UPDATE(self))
+	{
 		self->errornumber = STMT_EXEC_ERROR;
 		self->errormsg = "Connection is readonly, only select statements are allowed.";
 		SC_log_error(func, "", self);
@@ -121,22 +130,24 @@ StatementClass *self = (StatementClass *) hstmt;
 
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*      Performs the equivalent of SQLPrepare, followed by SQLExecute. */
+/*		Performs the equivalent of SQLPrepare, followed by SQLExecute. */
 
-RETCODE SQL_API SQLExecDirect(
-        HSTMT     hstmt,
-        UCHAR FAR *szSqlStr,
-        SDWORD    cbSqlStr)
+RETCODE SQL_API
+SQLExecDirect(
+			  HSTMT hstmt,
+			  UCHAR FAR *szSqlStr,
+			  SDWORD cbSqlStr)
 {
-StatementClass *stmt = (StatementClass *) hstmt;
-RETCODE result;
-static char *func = "SQLExecDirect";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	RETCODE		result;
+	static char *func = "SQLExecDirect";
+
+	mylog("%s: entering...\n", func);
 
-	mylog( "%s: entering...\n", func);
-    
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -147,7 +158,8 @@ static char *func = "SQLExecDirect";
 	/* keep a copy of the un-parametrized statement, in case */
 	/* they try to execute this statement again */
 	stmt->statement = make_string(szSqlStr, cbSqlStr, NULL);
-	if ( ! stmt->statement) {
+	if (!stmt->statement)
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "No memory available to store statement";
 		SC_log_error(func, "", stmt);
@@ -161,19 +173,20 @@ static char *func = "SQLExecDirect";
 	/* If an SQLPrepare was performed prior to this, but was left in  */
 	/* the premature state because an error occurred prior to SQLExecute */
 	/* then set the statement to finished so it can be recycled. */
-	if ( stmt->status == STMT_PREMATURE )
+	if (stmt->status == STMT_PREMATURE)
 		stmt->status = STMT_FINISHED;
 
 	stmt->statement_type = statement_type(stmt->statement);
 
-	/*	Check if connection is onlyread (only selects are allowed) */
-	if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) {
+	/* Check if connection is onlyread (only selects are allowed) */
+	if (CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt))
+	{
 		stmt->errornumber = STMT_EXEC_ERROR;
 		stmt->errormsg = "Connection is readonly, only select statements are allowed.";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
-	
+
 	mylog("%s: calling SQLExecute...\n", func);
 
 	result = SQLExecute(hstmt);
@@ -182,47 +195,55 @@ static char *func = "SQLExecDirect";
 	return result;
 }
 
-/*      Execute a prepared SQL statement */
-RETCODE SQL_API SQLExecute(
-        HSTMT   hstmt)
+/*		Execute a prepared SQL statement */
+RETCODE SQL_API
+SQLExecute(
+		   HSTMT hstmt)
 {
-static char *func="SQLExecute";
-StatementClass *stmt = (StatementClass *) hstmt;
-ConnectionClass *conn;
-int i, retval;
+	static char *func = "SQLExecute";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	ConnectionClass *conn;
+	int			i,
+				retval;
 
 
 	mylog("%s: entering...\n", func);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		mylog("%s: NULL statement so return SQL_INVALID_HANDLE\n", func);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*  If the statement is premature, it means we already executed
-		it from an SQLPrepare/SQLDescribeCol type of scenario.  So
-		just return success.
-	*/
-	if ( stmt->prepare && stmt->status == STMT_PREMATURE) {
-		stmt->status = STMT_FINISHED;       
-		if (stmt->errormsg == NULL) {
+	/*
+	 * If the statement is premature, it means we already executed it from
+	 * an SQLPrepare/SQLDescribeCol type of scenario.  So just return
+	 * success.
+	 */
+	if (stmt->prepare && stmt->status == STMT_PREMATURE)
+	{
+		stmt->status = STMT_FINISHED;
+		if (stmt->errormsg == NULL)
+		{
 			mylog("%s: premature statement but return SQL_SUCCESS\n", func);
 			return SQL_SUCCESS;
 		}
-		else {
+		else
+		{
 			SC_log_error(func, "", stmt);
 			mylog("%s: premature statement so return SQL_ERROR\n", func);
 			return SQL_ERROR;
 		}
-	}  
+	}
 
 	mylog("%s: clear errors...\n", func);
 
 	SC_clear_error(stmt);
 
 	conn = SC_get_conn(stmt);
-	if (conn->status == CONN_EXECUTING) {
+	if (conn->status == CONN_EXECUTING)
+	{
 		stmt->errormsg = "Connection is already in use.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -230,7 +251,8 @@ int i, retval;
 		return SQL_ERROR;
 	}
 
-	if ( ! stmt->statement) {
+	if (!stmt->statement)
+	{
 		stmt->errornumber = STMT_NO_STMTSTRING;
 		stmt->errormsg = "This handle does not have a SQL statement stored in it";
 		SC_log_error(func, "", stmt);
@@ -238,19 +260,22 @@ int i, retval;
 		return SQL_ERROR;
 	}
 
-	/*	If SQLExecute is being called again, recycle the statement.
-		Note this should have been done by the application in a call
-		to SQLFreeStmt(SQL_CLOSE) or SQLCancel.
-	*/
-	if (stmt->status == STMT_FINISHED) {
+	/*
+	 * If SQLExecute is being called again, recycle the statement. Note
+	 * this should have been done by the application in a call to
+	 * SQLFreeStmt(SQL_CLOSE) or SQLCancel.
+	 */
+	if (stmt->status == STMT_FINISHED)
+	{
 		mylog("%s: recycling statement (should have been done by app)...\n", func);
 		SC_recycle_statement(stmt);
 	}
 
-	/*	Check if the statement is in the correct state */
-	if ((stmt->prepare && stmt->status != STMT_READY) || 
-		(stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY)) {
-		
+	/* Check if the statement is in the correct state */
+	if ((stmt->prepare && stmt->status != STMT_READY) ||
+		(stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY))
+	{
+
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "The handle does not point to a statement that is ready to be executed";
 		SC_log_error(func, "", stmt);
@@ -259,30 +284,37 @@ int i, retval;
 	}
 
 
-	/*	The bound parameters could have possibly changed since the last execute
-		of this statement?  Therefore check for params and re-copy.
-	*/
+	/*
+	 * The bound parameters could have possibly changed since the last
+	 * execute of this statement?  Therefore check for params and re-copy.
+	 */
 	stmt->data_at_exec = -1;
-	for (i = 0; i < stmt->parameters_allocated; i++) {
-		/*	Check for data at execution parameters */
-		if ( stmt->parameters[i].data_at_exec == TRUE) {
+	for (i = 0; i < stmt->parameters_allocated; i++)
+	{
+		/* Check for data at execution parameters */
+		if (stmt->parameters[i].data_at_exec == TRUE)
+		{
 			if (stmt->data_at_exec < 0)
 				stmt->data_at_exec = 1;
 			else
 				stmt->data_at_exec++;
 		}
 	}
-	/*	If there are some data at execution parameters, return need data */
-	/*	SQLParamData and SQLPutData will be used to send params and execute the statement. */
+	/* If there are some data at execution parameters, return need data */
+
+	/*
+	 * SQLParamData and SQLPutData will be used to send params and execute
+	 * the statement.
+	 */
 	if (stmt->data_at_exec > 0)
 		return SQL_NEED_DATA;
 
 
 	mylog("%s: copying statement params: trans_status=%d, len=%d, stmt='%s'\n", func, conn->transact_status, strlen(stmt->statement), stmt->statement);
 
-	/*	Create the statement with parameters substituted. */
+	/* Create the statement with parameters substituted. */
 	retval = copy_statement_with_parameters(stmt);
-	if( retval != SQL_SUCCESS)
+	if (retval != SQL_SUCCESS)
 		/* error msg passed from above */
 		return retval;
 
@@ -296,125 +328,148 @@ int i, retval;
 
 
 
-/*      -       -       -       -       -       -       -       -       - */
-RETCODE SQL_API SQLTransact(
-        HENV    henv,
-        HDBC    hdbc,
-        UWORD   fType)
+/*		-		-		-		-		-		-		-		-		- */
+RETCODE SQL_API
+SQLTransact(
+			HENV henv,
+			HDBC hdbc,
+			UWORD fType)
 {
-static char *func = "SQLTransact";
-extern ConnectionClass *conns[];
-ConnectionClass *conn;
-QResultClass *res;
-char ok, *stmt_string;
-int lf;
+	static char *func = "SQLTransact";
+	extern ConnectionClass *conns[];
+	ConnectionClass *conn;
+	QResultClass *res;
+	char		ok,
+			   *stmt_string;
+	int			lf;
 
 	mylog("entering %s: hdbc=%u, henv=%u\n", func, hdbc, henv);
 
-	if (hdbc == SQL_NULL_HDBC && henv == SQL_NULL_HENV) {
+	if (hdbc == SQL_NULL_HDBC && henv == SQL_NULL_HENV)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/* If hdbc is null and henv is valid,
-	it means transact all connections on that henv.  
-	*/
-	if (hdbc == SQL_NULL_HDBC && henv != SQL_NULL_HENV) {
-		for (lf=0; lf <MAX_CONNECTIONS; lf++) {
+	/*
+	 * If hdbc is null and henv is valid, it means transact all
+	 * connections on that henv.
+	 */
+	if (hdbc == SQL_NULL_HDBC && henv != SQL_NULL_HENV)
+	{
+		for (lf = 0; lf < MAX_CONNECTIONS; lf++)
+		{
 			conn = conns[lf];
 
 			if (conn && conn->henv == henv)
-				if ( SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS)
+				if (SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS)
 					return SQL_ERROR;
 
 		}
-		return SQL_SUCCESS;       
+		return SQL_SUCCESS;
 	}
 
 	conn = (ConnectionClass *) hdbc;
 
-	if (fType == SQL_COMMIT) {
+	if (fType == SQL_COMMIT)
+	{
 		stmt_string = "COMMIT";
 
-	} else if (fType == SQL_ROLLBACK) {
+	}
+	else if (fType == SQL_ROLLBACK)
+	{
 		stmt_string = "ROLLBACK";
 
-	} else {
+	}
+	else
+	{
 		conn->errornumber = CONN_INVALID_ARGUMENT_NO;
-		conn->errormsg ="SQLTransact can only be called with SQL_COMMIT or SQL_ROLLBACK as parameter";
+		conn->errormsg = "SQLTransact can only be called with SQL_COMMIT or SQL_ROLLBACK as parameter";
 		CC_log_error(func, "", conn);
 		return SQL_ERROR;
-	}    
+	}
 
-	/*	If manual commit and in transaction, then proceed. */
-	if ( ! CC_is_in_autocommit(conn) &&  CC_is_in_trans(conn)) {
+	/* If manual commit and in transaction, then proceed. */
+	if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
+	{
 
 		mylog("SQLTransact: sending on conn %d '%s'\n", conn, stmt_string);
 
 		res = CC_send_query(conn, stmt_string, NULL);
 		CC_set_no_trans(conn);
 
-		if ( ! res) {
-			/*	error msg will be in the connection */
+		if (!res)
+		{
+			/* error msg will be in the connection */
 			CC_log_error(func, "", conn);
 			return SQL_ERROR;
 		}
 
-		ok = QR_command_successful(res);   
+		ok = QR_command_successful(res);
 		QR_Destructor(res);
 
-		if (!ok) {
+		if (!ok)
+		{
 			CC_log_error(func, "", conn);
 			return SQL_ERROR;
 		}
-	}    
+	}
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLCancel(
-        HSTMT   hstmt)  /* Statement to cancel. */
+RETCODE SQL_API
+SQLCancel(
+		  HSTMT hstmt)			/* Statement to cancel. */
 {
-static char *func="SQLCancel";
-StatementClass *stmt = (StatementClass *) hstmt;
-RETCODE result;
+	static char *func = "SQLCancel";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	RETCODE		result;
+
 #ifdef WIN32
-HMODULE hmodule;
-FARPROC addr;
+	HMODULE		hmodule;
+	FARPROC		addr;
+
 #endif
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	/*	Check if this can handle canceling in the middle of a SQLPutData? */
-	if ( ! stmt) {
+	/* Check if this can handle canceling in the middle of a SQLPutData? */
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*	Not in the middle of SQLParamData/SQLPutData so cancel like a close. */
-	if (stmt->data_at_exec < 0) {
+	/*
+	 * Not in the middle of SQLParamData/SQLPutData so cancel like a
+	 * close.
+	 */
+	if (stmt->data_at_exec < 0)
+	{
 
 
-		/*	MAJOR HACK for Windows to reset the driver manager's cursor state:
-			Because of what seems like a bug in the Odbc driver manager,
-			SQLCancel does not act like a SQLFreeStmt(CLOSE), as many
-			applications depend on this behavior.  So, this 
-			brute force method calls the driver manager's function on
-			behalf of the application.  
-		*/
+		/*
+		 * MAJOR HACK for Windows to reset the driver manager's cursor
+		 * state: Because of what seems like a bug in the Odbc driver
+		 * manager, SQLCancel does not act like a SQLFreeStmt(CLOSE), as
+		 * many applications depend on this behavior.  So, this brute
+		 * force method calls the driver manager's function on behalf of
+		 * the application.
+		 */
 
 #ifdef WIN32
-		if (globals.cancel_as_freestmt) {
+		if (globals.cancel_as_freestmt)
+		{
 			hmodule = GetModuleHandle("ODBC32");
 			addr = GetProcAddress(hmodule, "SQLFreeStmt");
-			result = addr( (char *) (stmt->phstmt) - 96, SQL_CLOSE);
-		}
-		else {
-			result = SQLFreeStmt( hstmt, SQL_CLOSE);
+			result = addr((char *) (stmt->phstmt) - 96, SQL_CLOSE);
 		}
+		else
+			result = SQLFreeStmt(hstmt, SQL_CLOSE);
 #else
-		result = SQLFreeStmt( hstmt, SQL_CLOSE);
+		result = SQLFreeStmt(hstmt, SQL_CLOSE);
 #endif
 
 		mylog("SQLCancel:  SQLFreeStmt returned %d\n", result);
@@ -423,9 +478,13 @@ FARPROC addr;
 		return SQL_SUCCESS;
 	}
 
-	/*	In the middle of SQLParamData/SQLPutData, so cancel that. */
-	/*	Note, any previous data-at-exec buffers will be freed in the recycle */
-	/*	if they call SQLExecDirect or SQLExecute again. */
+	/* In the middle of SQLParamData/SQLPutData, so cancel that. */
+
+	/*
+	 * Note, any previous data-at-exec buffers will be freed in the
+	 * recycle
+	 */
+	/* if they call SQLExecDirect or SQLExecute again. */
 
 	stmt->data_at_exec = -1;
 	stmt->current_exec_param = -1;
@@ -435,29 +494,31 @@ FARPROC addr;
 
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*      Returns the SQL string as modified by the driver. */
+/*		Returns the SQL string as modified by the driver. */
 /*		Currently, just copy the input string without modification */
 /*		observing buffer limits and truncation. */
-RETCODE SQL_API SQLNativeSql(
-        HDBC      hdbc,
-        UCHAR FAR *szSqlStrIn,
-        SDWORD     cbSqlStrIn,
-        UCHAR FAR *szSqlStr,
-        SDWORD     cbSqlStrMax,
-        SDWORD FAR *pcbSqlStr)
+RETCODE SQL_API
+SQLNativeSql(
+			 HDBC hdbc,
+			 UCHAR FAR *szSqlStrIn,
+			 SDWORD cbSqlStrIn,
+			 UCHAR FAR *szSqlStr,
+			 SDWORD cbSqlStrMax,
+			 SDWORD FAR *pcbSqlStr)
 {
-static char *func="SQLNativeSql";
-int len = 0;
-char *ptr;
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-RETCODE result;
+	static char *func = "SQLNativeSql";
+	int			len = 0;
+	char	   *ptr;
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	RETCODE		result;
 
-	mylog( "%s: entering...cbSqlStrIn=%d\n", func, cbSqlStrIn);
+	mylog("%s: entering...cbSqlStrIn=%d\n", func, cbSqlStrIn);
 
 	ptr = (cbSqlStrIn == 0) ? "" : make_string(szSqlStrIn, cbSqlStrIn, NULL);
-	if ( ! ptr) {
+	if (!ptr)
+	{
 		conn->errornumber = CONN_NO_MEMORY_ERROR;
 		conn->errormsg = "No memory available to store native sql string";
 		CC_log_error(func, "", conn);
@@ -467,10 +528,12 @@ RETCODE result;
 	result = SQL_SUCCESS;
 	len = strlen(ptr);
 
-	if (szSqlStr) {
+	if (szSqlStr)
+	{
 		strncpy_null(szSqlStr, ptr, cbSqlStrMax);
 
-		if (len >= cbSqlStrMax)  {
+		if (len >= cbSqlStrMax)
+		{
 			result = SQL_SUCCESS_WITH_INFO;
 			conn->errornumber = STMT_TRUNCATED;
 			conn->errormsg = "The buffer was too small for the result.";
@@ -482,39 +545,44 @@ RETCODE result;
 
 	free(ptr);
 
-    return result;
+	return result;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*      Supplies parameter data at execution time.      Used in conjuction with */
-/*      SQLPutData. */
+/*		Supplies parameter data at execution time.		Used in conjuction with */
+/*		SQLPutData. */
 
-RETCODE SQL_API SQLParamData(
-        HSTMT   hstmt,
-        PTR FAR *prgbValue)
+RETCODE SQL_API
+SQLParamData(
+			 HSTMT hstmt,
+			 PTR FAR *prgbValue)
 {
-static char *func = "SQLParamData";
-StatementClass *stmt = (StatementClass *) hstmt;
-int i, retval;
+	static char *func = "SQLParamData";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	int			i,
+				retval;
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	mylog("%s: data_at_exec=%d, params_alloc=%d\n", func, stmt->data_at_exec, stmt->parameters_allocated);
 
-	if (stmt->data_at_exec < 0) {
+	if (stmt->data_at_exec < 0)
+	{
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "No execution-time parameters for this statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->data_at_exec > stmt->parameters_allocated) {
+	if (stmt->data_at_exec > stmt->parameters_allocated)
+	{
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "Too many execution-time parameters were present";
 		SC_log_error(func, "", stmt);
@@ -522,16 +590,19 @@ int i, retval;
 	}
 
 	/* close the large object */
-	if ( stmt->lobj_fd >= 0) {
+	if (stmt->lobj_fd >= 0)
+	{
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
+		{
 			QResultClass *res;
-			char ok;
+			char		ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res) {
+			if (!res)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				SC_log_error(func, "", stmt);
@@ -539,7 +610,8 @@ int i, retval;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok) {
+			if (!ok)
+			{
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				SC_log_error(func, "", stmt);
@@ -553,8 +625,9 @@ int i, retval;
 	}
 
 
-	/*	Done, now copy the params and then execute the statement */
-	if (stmt->data_at_exec == 0) {
+	/* Done, now copy the params and then execute the statement */
+	if (stmt->data_at_exec == 0)
+	{
 		retval = copy_statement_with_parameters(stmt);
 		if (retval != SQL_SUCCESS)
 			return retval;
@@ -564,14 +637,17 @@ int i, retval;
 		return SC_execute(stmt);
 	}
 
-	/*	Set beginning param;  if first time SQLParamData is called , start at 0.
-		Otherwise, start at the last parameter + 1.
-	*/
-	i = stmt->current_exec_param >= 0 ? stmt->current_exec_param+1 : 0;
-
-	/*	At least 1 data at execution parameter, so Fill in the token value */
-	for ( ; i < stmt->parameters_allocated; i++) {
-		if (stmt->parameters[i].data_at_exec == TRUE) {
+	/*
+	 * Set beginning param;  if first time SQLParamData is called , start
+	 * at 0. Otherwise, start at the last parameter + 1.
+	 */
+	i = stmt->current_exec_param >= 0 ? stmt->current_exec_param + 1 : 0;
+
+	/* At least 1 data at execution parameter, so Fill in the token value */
+	for (; i < stmt->parameters_allocated; i++)
+	{
+		if (stmt->parameters[i].data_at_exec == TRUE)
+		{
 			stmt->data_at_exec--;
 			stmt->current_exec_param = i;
 			stmt->put_data = FALSE;
@@ -583,31 +659,35 @@ int i, retval;
 	return SQL_NEED_DATA;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-/*      Supplies parameter data at execution time.      Used in conjunction with */
-/*      SQLParamData. */
+/*		Supplies parameter data at execution time.		Used in conjunction with */
+/*		SQLParamData. */
 
-RETCODE SQL_API SQLPutData(
-        HSTMT   hstmt,
-        PTR     rgbValue,
-        SDWORD  cbValue)
+RETCODE SQL_API
+SQLPutData(
+		   HSTMT hstmt,
+		   PTR rgbValue,
+		   SDWORD cbValue)
 {
-static char *func = "SQLPutData";
-StatementClass *stmt = (StatementClass *) hstmt;
-int old_pos, retval;
-ParameterInfoClass *current_param;
-char *buffer;
+	static char *func = "SQLPutData";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	int			old_pos,
+				retval;
+	ParameterInfoClass *current_param;
+	char	   *buffer;
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	
-	if (stmt->current_exec_param < 0) {
+
+	if (stmt->current_exec_param < 0)
+	{
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "Previous call was not SQLPutData or SQLParamData";
 		SC_log_error(func, "", stmt);
@@ -616,14 +696,16 @@ char *buffer;
 
 	current_param = &(stmt->parameters[stmt->current_exec_param]);
 
-	if ( ! stmt->put_data) {	/* first call */
+	if (!stmt->put_data)
+	{							/* first call */
 
 		mylog("SQLPutData: (1) cbValue = %d\n", cbValue);
 
 		stmt->put_data = TRUE;
 
 		current_param->EXEC_used = (SDWORD *) malloc(sizeof(SDWORD));
-		if ( ! current_param->EXEC_used) {
+		if (!current_param->EXEC_used)
+		{
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Out of memory in SQLPutData (1)";
 			SC_log_error(func, "", stmt);
@@ -636,16 +718,19 @@ char *buffer;
 			return SQL_SUCCESS;
 
 
-		/*	Handle Long Var Binary with Large Objects */
-		if ( current_param->SQLType == SQL_LONGVARBINARY) {
+		/* Handle Long Var Binary with Large Objects */
+		if (current_param->SQLType == SQL_LONGVARBINARY)
+		{
 
 			/* begin transaction if needed */
-			if(!CC_is_in_trans(stmt->hdbc)) {
+			if (!CC_is_in_trans(stmt->hdbc))
+			{
 				QResultClass *res;
-				char ok;
+				char		ok;
 
 				res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-				if (!res) {
+				if (!res)
+				{
 					stmt->errormsg = "Could not begin (in-line) a transaction";
 					stmt->errornumber = STMT_EXEC_ERROR;
 					SC_log_error(func, "", stmt);
@@ -653,7 +738,8 @@ char *buffer;
 				}
 				ok = QR_command_successful(res);
 				QR_Destructor(res);
-				if (!ok) {
+				if (!ok)
+				{
 					stmt->errormsg = "Could not begin (in-line) a transaction";
 					stmt->errornumber = STMT_EXEC_ERROR;
 					SC_log_error(func, "", stmt);
@@ -663,22 +749,24 @@ char *buffer;
 				CC_set_in_trans(stmt->hdbc);
 			}
 
-			/*	store the oid */
+			/* store the oid */
 			current_param->lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
-			if (current_param->lobj_oid == 0) {
+			if (current_param->lobj_oid == 0)
+			{
 				stmt->errornumber = STMT_EXEC_ERROR;
 				stmt->errormsg = "Couldnt create large object.";
 				SC_log_error(func, "", stmt);
 				return SQL_ERROR;
 			}
 
-			/*	major hack -- to allow convert to see somethings there */
-			/*					have to modify convert to handle this better */
+			/* major hack -- to allow convert to see somethings there */
+			/* have to modify convert to handle this better */
 			current_param->EXEC_buffer = (char *) &current_param->lobj_oid;
 
-			/*	store the fd */
+			/* store the fd */
 			stmt->lobj_fd = lo_open(stmt->hdbc, current_param->lobj_oid, INV_WRITE);
-			if ( stmt->lobj_fd < 0) {
+			if (stmt->lobj_fd < 0)
+			{
 				stmt->errornumber = STMT_EXEC_ERROR;
 				stmt->errormsg = "Couldnt open large object for writing.";
 				SC_log_error(func, "", stmt);
@@ -689,20 +777,26 @@ char *buffer;
 			mylog("lo_write: cbValue=%d, wrote %d bytes\n", cbValue, retval);
 
 		}
-		else {	/* for handling text fields and small binaries */
+		else
+		{						/* for handling text fields and small
+								 * binaries */
 
-			if (cbValue == SQL_NTS) {
+			if (cbValue == SQL_NTS)
+			{
 				current_param->EXEC_buffer = strdup(rgbValue);
-				if ( ! current_param->EXEC_buffer) {
+				if (!current_param->EXEC_buffer)
+				{
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (2)";
 					SC_log_error(func, "", stmt);
 					return SQL_ERROR;
 				}
 			}
-			else {
+			else
+			{
 				current_param->EXEC_buffer = malloc(cbValue + 1);
-				if ( ! current_param->EXEC_buffer) {
+				if (!current_param->EXEC_buffer)
+				{
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (2)";
 					SC_log_error(func, "", stmt);
@@ -714,11 +808,13 @@ char *buffer;
 		}
 	}
 
-	else {	/* calling SQLPutData more than once */
+	else
+	{							/* calling SQLPutData more than once */
 
 		mylog("SQLPutData: (>1) cbValue = %d\n", cbValue);
 
-		if (current_param->SQLType == SQL_LONGVARBINARY) {
+		if (current_param->SQLType == SQL_LONGVARBINARY)
+		{
 
 			/* the large object fd is in EXEC_buffer */
 			retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue);
@@ -726,13 +822,17 @@ char *buffer;
 
 			*current_param->EXEC_used += cbValue;
 
-		} else {
+		}
+		else
+		{
 
 			buffer = current_param->EXEC_buffer;
 
-			if (cbValue == SQL_NTS) {
+			if (cbValue == SQL_NTS)
+			{
 				buffer = realloc(buffer, strlen(buffer) + strlen(rgbValue) + 1);
-				if ( ! buffer) {
+				if (!buffer)
+				{
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (3)";
 					SC_log_error(func, "", stmt);
@@ -744,11 +844,12 @@ char *buffer;
 
 				*current_param->EXEC_used = cbValue;
 
-				/*	reassign buffer incase realloc moved it */
+				/* reassign buffer incase realloc moved it */
 				current_param->EXEC_buffer = buffer;
 
 			}
-			else if (cbValue > 0) {
+			else if (cbValue > 0)
+			{
 
 				old_pos = *current_param->EXEC_used;
 
@@ -758,7 +859,8 @@ char *buffer;
 
 				/* dont lose the old pointer in case out of memory */
 				buffer = realloc(current_param->EXEC_buffer, *current_param->EXEC_used + 1);
-				if ( ! buffer) {
+				if (!buffer)
+				{
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (3)";
 					SC_log_error(func, "", stmt);
@@ -768,11 +870,12 @@ char *buffer;
 				memcpy(&buffer[old_pos], rgbValue, cbValue);
 				buffer[*current_param->EXEC_used] = '\0';
 
-				/*	reassign buffer incase realloc moved it */
+				/* reassign buffer incase realloc moved it */
 				current_param->EXEC_buffer = buffer;
-				
+
 			}
-			else {
+			else
+			{
 				SC_log_error(func, "bad cbValue", stmt);
 				return SQL_ERROR;
 			}
diff --git a/src/interfaces/odbc/gpps.c b/src/interfaces/odbc/gpps.c
index dbcfe4925f63e99113e8678137664bdcd18fa119..0496f45a0134e1223b4b3a09ee1155de0895c743 100644
--- a/src/interfaces/odbc/gpps.c
+++ b/src/interfaces/odbc/gpps.c
@@ -13,7 +13,7 @@
 #ifndef WIN32
 
 #if HAVE_CONFIG_H
-#include "config.h"	/* produced by configure */
+#include "config.h"				/* produced by configure */
 #endif
 
 #include <stdio.h>
@@ -38,82 +38,86 @@
 
 
 DWORD
-GetPrivateProfileString(char *theSection,	/* section name */
-			char *theKey,		/* search key name */
-			char *theDefault,	/* default value if not found */
-			char *theReturnBuffer,	/* return value stored here */
-			size_t theReturnBufferLength,	/* byte length of return buffer */
-			char *theIniFileName)		/* pathname of ini file to search */
+GetPrivateProfileString(char *theSection,		/* section name */
+						char *theKey,	/* search key name */
+						char *theDefault,		/* default value if not
+												 * found */
+						char *theReturnBuffer,	/* return value stored
+												 * here */
+						size_t theReturnBufferLength,	/* byte length of return
+														 * buffer */
+						char *theIniFileName)	/* pathname of ini file to
+												 * search */
 {
-	char buf[MAXPGPATH];
-	char* ptr = 0;
-	FILE* aFile = 0;
-	size_t aLength;
-	char aLine[2048];
-	char *aValue;
-	char *aStart;
-	char *aString;
-	size_t aLineLength;
-	size_t aReturnLength = 0;
-	BOOL aSectionFound = FALSE;
-	BOOL aKeyFound = FALSE;
-	int j = 0;
+	char		buf[MAXPGPATH];
+	char	   *ptr = 0;
+	FILE	   *aFile = 0;
+	size_t		aLength;
+	char		aLine[2048];
+	char	   *aValue;
+	char	   *aStart;
+	char	   *aString;
+	size_t		aLineLength;
+	size_t		aReturnLength = 0;
+	BOOL		aSectionFound = FALSE;
+	BOOL		aKeyFound = FALSE;
+	int			j = 0;
 
 	j = strlen(theIniFileName) + 1;
-	ptr = (char*)getpwuid(getuid());	/* get user info */
+	ptr = (char *) getpwuid(getuid());	/* get user info */
 
-	if( ptr == NULL)
+	if (ptr == NULL)
 	{
-		if( MAXPGPATH-1 < j )
-			theIniFileName[MAXPGPATH-1] = '\0';
+		if (MAXPGPATH - 1 < j)
+			theIniFileName[MAXPGPATH - 1] = '\0';
 
-		sprintf(buf,"%s",theIniFileName);
+		sprintf(buf, "%s", theIniFileName);
 	}
-	ptr = ((struct passwd*)ptr)->pw_dir;	/* get user home dir */
-	if( ptr == NULL || *ptr == '\0' )
+	ptr = ((struct passwd *) ptr)->pw_dir;		/* get user home dir */
+	if (ptr == NULL || *ptr == '\0')
 		ptr = "/home";
 
-	/* This doesn't make it so we find an ini file but allows normal
-	 * processing to continue further on down. The likelihood is that
-	 * the file won't be found and thus the default value will be
-	 * returned.
-	*/
-	if( MAXPGPATH-1 < strlen(ptr) + j )
+	/*
+	 * This doesn't make it so we find an ini file but allows normal
+	 * processing to continue further on down. The likelihood is that the
+	 * file won't be found and thus the default value will be returned.
+	 */
+	if (MAXPGPATH - 1 < strlen(ptr) + j)
 	{
-		if( MAXPGPATH-1 < strlen(ptr) )
-			ptr[MAXPGPATH-1] = '\0';
+		if (MAXPGPATH - 1 < strlen(ptr))
+			ptr[MAXPGPATH - 1] = '\0';
 		else
-			theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
+			theIniFileName[MAXPGPATH - 1 - strlen(ptr)] = '\0';
 	}
 
-	sprintf( buf, "%s/%s",ptr,theIniFileName );
+	sprintf(buf, "%s/%s", ptr, theIniFileName);
 
-	  /* This code makes it so that a file in the users home dir
-	   * overrides a the "default" file as passed in
-	  */
-	aFile = (FILE*)(buf ? fopen(buf, PG_BINARY_R) : NULL);
-	if(!aFile) {
-		sprintf(buf,"%s",theIniFileName);
-		aFile = (FILE*)(buf ? fopen(buf, PG_BINARY_R) : NULL);
+	/*
+	 * This code makes it so that a file in the users home dir overrides a
+	 * the "default" file as passed in
+	 */
+	aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
+	if (!aFile)
+	{
+		sprintf(buf, "%s", theIniFileName);
+		aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
 	}
 
 
 	aLength = (theDefault == NULL) ? 0 : strlen(theDefault);
 
-	if(theReturnBufferLength == 0 || theReturnBuffer == NULL)
+	if (theReturnBufferLength == 0 || theReturnBuffer == NULL)
 	{
-		if(aFile)
-		{
+		if (aFile)
 			fclose(aFile);
-		}
 		return 0;
 	}
 
-	if(aFile == NULL)
+	if (aFile == NULL)
 	{
 		/* no ini file specified, return the default */
 
-		++aLength;	/* room for NULL char */
+		++aLength;				/* room for NULL char */
 		aLength = theReturnBufferLength < aLength ?
 			theReturnBufferLength : aLength;
 		strncpy(theReturnBuffer, theDefault, aLength);
@@ -122,86 +126,79 @@ GetPrivateProfileString(char *theSection,	/* section name */
 	}
 
 
-	while(fgets(aLine, sizeof(aLine), aFile) != NULL)
+	while (fgets(aLine, sizeof(aLine), aFile) != NULL)
 	{
 		aLineLength = strlen(aLine);
 		/* strip final '\n' */
-		if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
-		{
+		if (aLineLength > 0 && aLine[aLineLength - 1] == '\n')
 			aLine[aLineLength - 1] = '\0';
-		}
-		switch(*aLine)
+		switch (*aLine)
 		{
-			case ' ': /* blank line */
-			case ';': /* comment line */
+			case ' ':			/* blank line */
+			case ';':			/* comment line */
 				continue;
-			break;
+				break;
 
-			case '[':	/* section marker */
+			case '[':			/* section marker */
 
-				if( (aString = strchr(aLine, ']')) )
+				if ((aString = strchr(aLine, ']')))
 				{
 					aStart = aLine + 1;
 					aString--;
-					while (isspace((unsigned char) *aStart)) aStart++;
-					while (isspace((unsigned char) *aString)) aString--;
-					*(aString+1) = '\0';
+					while (isspace((unsigned char) *aStart))
+						aStart++;
+					while (isspace((unsigned char) *aString))
+						aString--;
+					*(aString + 1) = '\0';
 
 					/* accept as matched if NULL key or exact match */
 
-					if(!theSection || !strcmp(aStart, theSection))
+					if (!theSection || !strcmp(aStart, theSection))
 						aSectionFound = TRUE;
 					else
 						aSectionFound = FALSE;
 				}
 
-			break;
+				break;
 
 			default:
 
 				/* try to match value keys if in proper section */
 
-				if(aSectionFound)
+				if (aSectionFound)
 				{
 					/* try to match requested key */
 
-					if( (aString = aValue = strchr(aLine, '=')) )
+					if ((aString = aValue = strchr(aLine, '=')))
 					{
 						*aValue = '\0';
 						++aValue;
 
 						/* strip leading blanks in value field */
 
-						while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
-						{
+						while (*aValue == ' ' && aValue < aLine + sizeof(aLine))
 							*aValue++ = '\0';
-						}
-						if(aValue >= aLine + sizeof(aLine))
-						{
+						if (aValue >= aLine + sizeof(aLine))
 							aValue = "";
-						}
 					}
 					else
-					{
 						aValue = "";
-					}
 
 					aStart = aLine;
-					while (isspace((unsigned char) *aStart)) aStart++;
+					while (isspace((unsigned char) *aStart))
+						aStart++;
 
 					/* strip trailing blanks from key */
 
-					if(aString)
+					if (aString)
 					{
-						while(--aString >= aStart && *aString == ' ')
-						{
+						while (--aString >= aStart && *aString == ' ')
 							*aString = '\0';
-						}
 					}
 
 					/* see if key is matched */
 
-					if(theKey == NULL || !strcmp(theKey, aStart))
+					if (theKey == NULL || !strcmp(theKey, aStart))
 					{
 						/* matched -- first, terminate value part */
 
@@ -212,7 +209,7 @@ GetPrivateProfileString(char *theSection,	/* section name */
 
 						aString = aValue + aLength - 1;
 
-						while(--aString > aValue && *aString == ' ')
+						while (--aString > aValue && *aString == ' ')
 						{
 							*aString = '\0';
 							--aLength;
@@ -220,7 +217,7 @@ GetPrivateProfileString(char *theSection,	/* section name */
 
 						/* unquote value if quoted */
 
-						if(aLength >= 2 && aValue[0] == '"' &&
+						if (aLength >= 2 && aValue[0] == '"' &&
 							aValue[aLength - 1] == '"')
 						{
 							/* string quoted with double quotes */
@@ -233,7 +230,7 @@ GetPrivateProfileString(char *theSection,	/* section name */
 						{
 							/* single quotes allowed also... */
 
-							if(aLength >= 2 && aValue[0] == '\'' &&
+							if (aLength >= 2 && aValue[0] == '\'' &&
 								aValue[aLength - 1] == '\'')
 							{
 								aValue[aLength - 1] = '\0';
@@ -245,23 +242,23 @@ GetPrivateProfileString(char *theSection,	/* section name */
 						/* compute maximum length copyable */
 
 						aLineLength = (aLength <
-							theReturnBufferLength - aReturnLength) ? aLength :
+						theReturnBufferLength - aReturnLength) ? aLength :
 							theReturnBufferLength - aReturnLength;
 
 						/* do the copy to return buffer */
 
-						if(aLineLength)
+						if (aLineLength)
 						{
 							strncpy(&theReturnBuffer[aReturnLength],
-								aValue, aLineLength);
+									aValue, aLineLength);
 							aReturnLength += aLineLength;
-							if(aReturnLength < theReturnBufferLength)
+							if (aReturnLength < theReturnBufferLength)
 							{
 								theReturnBuffer[aReturnLength] = '\0';
 								++aReturnLength;
 							}
 						}
-						if(aFile)
+						if (aFile)
 						{
 							fclose(aFile);
 							aFile = NULL;
@@ -271,17 +268,16 @@ GetPrivateProfileString(char *theSection,	/* section name */
 					}
 				}
 
-			break;
+				break;
 		}
 	}
 
-	if(aFile)
-	{
+	if (aFile)
 		fclose(aFile);
-	}
 
-	if(!aKeyFound) {	/* key wasn't found return default */
-		++aLength;	/* room for NULL char */
+	if (!aKeyFound)
+	{							/* key wasn't found return default */
+		++aLength;				/* room for NULL char */
 		aLength = theReturnBufferLength < aLength ?
 			theReturnBufferLength : aLength;
 		strncpy(theReturnBuffer, theDefault, aLength);
@@ -292,10 +288,11 @@ GetPrivateProfileString(char *theSection,	/* section name */
 }
 
 DWORD
-WritePrivateProfileString(char *theSection,	/* section name */
-			  char *theKey,		/* write key name */
-			  char *theBuffer,	/* input buffer */
-			  char *theIniFileName)	/* pathname of ini file to write */
+WritePrivateProfileString(char *theSection,		/* section name */
+						  char *theKey, /* write key name */
+						  char *theBuffer,		/* input buffer */
+						  char *theIniFileName) /* pathname of ini file to
+												 * write */
 {
 	return 0;
 }
@@ -306,69 +303,74 @@ WritePrivateProfileString(char *theSection,	/* section name */
  * I find out different.
  */
 DWORD
-WritePrivateProfileString(char *theSection,	/* section name */
-			  char *theKey,		/* write key name */
-			  char *theBuffer,	/* input buffer */
-			  char *theIniFileName)	/* pathname of ini file to write */
+WritePrivateProfileString(char *theSection,		/* section name */
+						  char *theKey, /* write key name */
+						  char *theBuffer,		/* input buffer */
+						  char *theIniFileName) /* pathname of ini file to
+												 * write */
 {
-	char buf[MAXPGPATH];
-	char* ptr = 0;
-	FILE* aFile = 0;
-	size_t aLength;
-	char aLine[2048];
-	char *aValue;
-	char *aString;
-	size_t aLineLength;
-	size_t aReturnLength = 0;
-
-	BOOL aSectionFound = FALSE;
-	BOOL keyFound = FALSE;
-	int j = 0;
+	char		buf[MAXPGPATH];
+	char	   *ptr = 0;
+	FILE	   *aFile = 0;
+	size_t		aLength;
+	char		aLine[2048];
+	char	   *aValue;
+	char	   *aString;
+	size_t		aLineLength;
+	size_t		aReturnLength = 0;
+
+	BOOL		aSectionFound = FALSE;
+	BOOL		keyFound = FALSE;
+	int			j = 0;
 
 	/* If this isn't correct processing we'll change it later  */
-	if(theSection == NULL || theKey == NULL || theBuffer == NULL ||
-		theIniFileName == NULL) return 0;
+	if (theSection == NULL || theKey == NULL || theBuffer == NULL ||
+		theIniFileName == NULL)
+		return 0;
 
 	aLength = strlen(theBuffer);
-	if(aLength == 0) return 0;
+	if (aLength == 0)
+		return 0;
 
 	j = strlen(theIniFileName) + 1;
-	ptr = (char*)getpwuid(getuid());	/* get user info */
+	ptr = (char *) getpwuid(getuid());	/* get user info */
 
-	if( ptr == NULL)
+	if (ptr == NULL)
 	{
-		if( MAXPGPATH-1 < j )
-			theIniFileName[MAXPGPATH-1] = '\0';
+		if (MAXPGPATH - 1 < j)
+			theIniFileName[MAXPGPATH - 1] = '\0';
 
-		sprintf(buf,"%s",theIniFileName);
+		sprintf(buf, "%s", theIniFileName);
 	}
-	ptr = ((struct passwd*)ptr)->pw_dir;	/* get user home dir */
-	if( ptr == NULL || *ptr == '\0' )
+	ptr = ((struct passwd *) ptr)->pw_dir;		/* get user home dir */
+	if (ptr == NULL || *ptr == '\0')
 		ptr = "/home";
 
 	/* This doesn't make it so we find an ini file but allows normal */
-	/*  processing to continue further on down. The likelihood is that */
+	/* processing to continue further on down. The likelihood is that */
 	/* the file won't be found and thus the default value will be */
 	/* returned. */
 	/* */
-	if( MAXPGPATH-1 < strlen(ptr) + j )
+	if (MAXPGPATH - 1 < strlen(ptr) + j)
 	{
-		if( MAXPGPATH-1 < strlen(ptr) )
-			ptr[MAXPGPATH-1] = '\0';
+		if (MAXPGPATH - 1 < strlen(ptr))
+			ptr[MAXPGPATH - 1] = '\0';
 		else
-			theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
+			theIniFileName[MAXPGPATH - 1 - strlen(ptr)] = '\0';
 	}
 
-	sprintf( buf, "%s/%s",ptr,theIniFileName );
+	sprintf(buf, "%s/%s", ptr, theIniFileName);
 
 	/* This code makes it so that a file in the users home dir */
-	/*  overrides a the "default" file as passed in */
+	/* overrides a the "default" file as passed in */
 	/* */
-	aFile = (FILE*)(buf ? fopen(buf, "r+") : NULL);
-	if(!aFile) {
-		sprintf(buf,"%s",theIniFileName);
-		aFile = (FILE*)(buf ? fopen(buf, "r+") : NULL);
-		if(!aFile) return 0;
+	aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
+	if (!aFile)
+	{
+		sprintf(buf, "%s", theIniFileName);
+		aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
+		if (!aFile)
+			return 0;
 	}
 
 
@@ -378,104 +380,92 @@ WritePrivateProfileString(char *theSection,	/* section name */
 	/* exists we have to overwrite it. If it doesn't exist */
 	/* we just write a new line to the file. */
 	/* */
-	while(fgets(aLine, sizeof(aLine), aFile) != NULL)
+	while (fgets(aLine, sizeof(aLine), aFile) != NULL)
 	{
 		aLineLength = strlen(aLine);
 		/* strip final '\n' */
-		if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
-		{
+		if (aLineLength > 0 && aLine[aLineLength - 1] == '\n')
 			aLine[aLineLength - 1] = '\0';
-		}
-		switch(*aLine)
+		switch (*aLine)
 		{
-			case ' ': /* blank line */
-			case ';': /* comment line */
+			case ' ':			/* blank line */
+			case ';':			/* comment line */
 				continue;
-			break;
+				break;
 
-			case '[':	/* section marker */
+			case '[':			/* section marker */
 
-				if( (aString = strchr(aLine, ']')) )
+				if ((aString = strchr(aLine, ']')))
 				{
 					*aString = '\0';
 
 					/* accept as matched if key exact match */
 
-					if(!strcmp(aLine + 1, theSection))
-					{
+					if (!strcmp(aLine + 1, theSection))
 						aSectionFound = TRUE;
-					}
 				}
 
-			break;
+				break;
 
 			default:
 
 				/* try to match value keys if in proper section */
 
-				if(aSectionFound)
+				if (aSectionFound)
 				{
 					/* try to match requested key */
 
-					if( (aString = aValue = strchr(aLine, '=')) )
+					if ((aString = aValue = strchr(aLine, '=')))
 					{
 						*aValue = '\0';
 						++aValue;
 
 						/* strip leading blanks in value field */
 
-						while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
-						{
+						while (*aValue == ' ' && aValue < aLine + sizeof(aLine))
 							*aValue++ = '\0';
-						}
-						if(aValue >= aLine + sizeof(aLine))
-						{
+						if (aValue >= aLine + sizeof(aLine))
 							aValue = "";
-						}
 					}
 					else
-					{
 						aValue = "";
-					}
 
 					/* strip trailing blanks from key */
 
-					if(aString)
+					if (aString)
 					{
-						while(--aString >= aLine && *aString == ' ')
-						{
+						while (--aString >= aLine && *aString == ' ')
 							*aString = '\0';
-						}
 					}
 
 					/* see if key is matched */
 
-					if(!strcmp(theKey, aLine))
+					if (!strcmp(theKey, aLine))
 					{
 						keyFound = TRUE;
 						/* matched -- first, terminate value part */
 
 						/* overwrite current value */
-						fseek(aFile,-aLineLength,SEEK_CUR);
+						fseek(aFile, -aLineLength, SEEK_CUR);
 						/* overwrite key and value */
-						sprintf(aLine,"%s = %s\n",theKey,theBuffer);
-						fputs(aLine,aFile);
-						}
+						sprintf(aLine, "%s = %s\n", theKey, theBuffer);
+						fputs(aLine, aFile);
 					}
 				}
-
-			break;
 		}
+
+		break;
 	}
+}
 
-	if(!keyFound) {		/* theKey wasn't in file so  */
-	if(aFile)
-	{
+if (!keyFound)
+{								/* theKey wasn't in file so  */
+	if (aFile)
 		fclose(aFile);
-	}
 
 	return aReturnLength > 0 ? aReturnLength - 1 : 0;
 }
+
 #endif
 
 
diff --git a/src/interfaces/odbc/gpps.h b/src/interfaces/odbc/gpps.h
index c2c81965f09c95077bd6d2092a84b4202d067bae..95d559ff9ba4bbae56849b2924021891bfa17fc1 100644
--- a/src/interfaces/odbc/gpps.h
+++ b/src/interfaces/odbc/gpps.h
@@ -13,25 +13,32 @@
 #endif
 
 #ifdef __cplusplus
-extern "C" {
+extern		"C"
+{
 #endif
 
-DWORD
-GetPrivateProfileString(char *theSection,   /* section name */
-			char *theKey, /* search key name */
-			char *theDefault, /* default value if not found */
-			char *theReturnBuffer, /* return valuse stored here */
-			size_t theBufferLength,	/* byte length of return buffer */
-			char *theIniFileName); /* pathname of ini file to search */
+	DWORD
+				GetPrivateProfileString(char *theSection,		/* section name */
+													char *theKey,		/* search key name */
+													char *theDefault,	/* default value if not
+																		 * found */
+													char *theReturnBuffer,		/* return valuse stored
+																				 * here */
+												  size_t theBufferLength,		/* byte length of return
+																				 * buffer */
+													char *theIniFileName);		/* pathname of ini file
+																				 * to search */
 
-DWORD
-WritePrivateProfileString(char *theSection,	/* section name */
-			  char *theKey,		/* write key name */
-			  char *theBuffer,	/* input buffer */
-			  char *theIniFileName); /* pathname of ini file to write */
+	DWORD
+				WritePrivateProfileString(char *theSection,		/* section name */
+													  char *theKey,		/* write key name */
+													  char *theBuffer,	/* input buffer */
+												   char *theIniFileName);		/* pathname of ini file
+																				 * to write */
 
 #ifdef __cplusplus
 }
+
 #endif
 
 #ifndef WIN32
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 685248eeb7c8d10269b19165ad6191aaaef2a729..764cb3a58890552d1688910d0eff46ccb2a8cb36 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -1,18 +1,18 @@
 
-/* Module:          info.c
+/* Module:			info.c
  *
- * Description:     This module contains routines related to
- *                  ODBC informational functions.
+ * Description:		This module contains routines related to
+ *					ODBC informational functions.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   SQLGetInfo, SQLGetTypeInfo, SQLGetFunctions, 
- *                  SQLTables, SQLColumns, SQLStatistics, SQLSpecialColumns,
- *                  SQLPrimaryKeys, SQLForeignKeys, 
- *                  SQLProcedureColumns(NI), SQLProcedures(NI), 
- *                  SQLTablePrivileges(NI), SQLColumnPrivileges(NI)
+ * API functions:	SQLGetInfo, SQLGetTypeInfo, SQLGetFunctions,
+ *					SQLTables, SQLColumns, SQLStatistics, SQLSpecialColumns,
+ *					SQLPrimaryKeys, SQLForeignKeys,
+ *					SQLProcedureColumns(NI), SQLProcedures(NI),
+ *					SQLTablePrivileges(NI), SQLColumnPrivileges(NI)
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -31,7 +31,7 @@
 #include <ctype.h>
 #else
 #include <windows.h>
-#include <sql.h> 
+#include <sql.h>
 #include <sqlext.h>
 #endif
 
@@ -57,589 +57,636 @@
 extern GLOBAL_VALUES globals;
 
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLGetInfo(
-        HDBC      hdbc,
-        UWORD     fInfoType,
-        PTR       rgbInfoValue,
-        SWORD     cbInfoValueMax,
-        SWORD FAR *pcbInfoValue)
+RETCODE SQL_API
+SQLGetInfo(
+		   HDBC hdbc,
+		   UWORD fInfoType,
+		   PTR rgbInfoValue,
+		   SWORD cbInfoValueMax,
+		   SWORD FAR *pcbInfoValue)
 {
-static char *func = "SQLGetInfo";
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-ConnInfo *ci;
-char *p = NULL, tmp[MAX_INFO_STRING];
-int len = 0, value = 0;
-RETCODE result;
-
-	mylog( "%s: entering...fInfoType=%d\n", func, fInfoType);
-
-	if ( ! conn) {
+	static char *func = "SQLGetInfo";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	ConnInfo   *ci;
+	char	   *p = NULL,
+				tmp[MAX_INFO_STRING];
+	int			len = 0,
+				value = 0;
+	RETCODE		result;
+
+	mylog("%s: entering...fInfoType=%d\n", func, fInfoType);
+
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	ci = &conn->connInfo;
 
-    switch (fInfoType) {
-    case SQL_ACCESSIBLE_PROCEDURES: /* ODBC 1.0 */
-		p = "N";
-        break;
-
-    case SQL_ACCESSIBLE_TABLES: /* ODBC 1.0 */
-		p = "N";
-        break;
-
-    case SQL_ACTIVE_CONNECTIONS: /* ODBC 1.0 */
-        len = 2;
-        value = MAX_CONNECTIONS;
-        break;
-
-    case SQL_ACTIVE_STATEMENTS: /* ODBC 1.0 */
-        len = 2;
-        value = 0;
-        break;
-
-    case SQL_ALTER_TABLE: /* ODBC 2.0 */
-        len = 4;
-        value = SQL_AT_ADD_COLUMN;
-        break;
-
-    case SQL_BOOKMARK_PERSISTENCE: /* ODBC 2.0 */
-		/* very simple bookmark support */        
-		len = 4;
-        value = globals.use_declarefetch ? 0 : (SQL_BP_SCROLL);		
-        break;
-
-    case SQL_COLUMN_ALIAS: /* ODBC 2.0 */
-		p = "N";
-        break;
-
-    case SQL_CONCAT_NULL_BEHAVIOR: /* ODBC 1.0 */
-        len = 2;
-        value = SQL_CB_NON_NULL;
-        break;
-
-    case SQL_CONVERT_BIGINT:
-    case SQL_CONVERT_BINARY:
-    case SQL_CONVERT_BIT:
-    case SQL_CONVERT_CHAR:
-    case SQL_CONVERT_DATE:
-    case SQL_CONVERT_DECIMAL:
-    case SQL_CONVERT_DOUBLE:
-    case SQL_CONVERT_FLOAT:
-    case SQL_CONVERT_INTEGER:
-    case SQL_CONVERT_LONGVARBINARY:
-    case SQL_CONVERT_LONGVARCHAR:
-    case SQL_CONVERT_NUMERIC:
-    case SQL_CONVERT_REAL:
-    case SQL_CONVERT_SMALLINT:
-    case SQL_CONVERT_TIME:
-    case SQL_CONVERT_TIMESTAMP:
-    case SQL_CONVERT_TINYINT:
-    case SQL_CONVERT_VARBINARY:
-    case SQL_CONVERT_VARCHAR: /* ODBC 1.0 */
-		len = 4;
-        value = fInfoType;
-        break;
-
-    case SQL_CONVERT_FUNCTIONS: /* ODBC 1.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_CORRELATION_NAME: /* ODBC 1.0 */
-
-		/*	Saying no correlation name makes Query not work right.
-			value = SQL_CN_NONE;
-		*/
-		len = 2;
-        value = SQL_CN_ANY;
-        break;
-
-    case SQL_CURSOR_COMMIT_BEHAVIOR: /* ODBC 1.0 */
-        len = 2;
-        value = SQL_CB_CLOSE;
-        break;
-
-    case SQL_CURSOR_ROLLBACK_BEHAVIOR: /* ODBC 1.0 */
-        len = 2;
-        value = SQL_CB_CLOSE;
-        break;
-
-    case SQL_DATA_SOURCE_NAME: /* ODBC 1.0 */
-		p = CC_get_DSN(conn);
-        break;
-
-    case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
-		p = CC_is_onlyread(conn) ? "Y" : "N";
-        break;
-
-    case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */
-
-		/*	Returning the database name causes problems in MS Query.
-			It generates query like: "SELECT DISTINCT a FROM byronncrap3 crap3"
-
-			p = CC_get_database(conn);
-		*/
-		p = "";    
-		break;
-
-    case SQL_DBMS_NAME: /* ODBC 1.0 */
-		p = DBMS_NAME;
-        break;
-
-    case SQL_DBMS_VER: /* ODBC 1.0 */
-		/* The ODBC spec wants ##.##.#### ...whatever... so prepend the driver */
-		/* version number to the dbms version string */
-		sprintf(tmp, "%s %s", POSTGRESDRIVERVERSION, conn->pg_version);
-		p = tmp;
-        break;
-
-    case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
-		len = 4;
-        value = SQL_TXN_READ_COMMITTED; /*SQL_TXN_SERIALIZABLE; */
-        break;
-
-    case SQL_DRIVER_NAME: /* ODBC 1.0 */
-        p = DRIVER_FILE_NAME;
-        break;
-
-    case SQL_DRIVER_ODBC_VER:
-		p = DRIVER_ODBC_VER;
-        break;
-
-    case SQL_DRIVER_VER: /* ODBC 1.0 */
-        p = POSTGRESDRIVERVERSION;
-        break;
-
-    case SQL_EXPRESSIONS_IN_ORDERBY: /* ODBC 1.0 */
-		p = "N";
-        break;
-
-    case SQL_FETCH_DIRECTION: /* ODBC 1.0 */
-		len = 4;
-        value = globals.use_declarefetch ? (SQL_FD_FETCH_NEXT) : (SQL_FD_FETCH_NEXT |
-                                   SQL_FD_FETCH_FIRST |
-                                   SQL_FD_FETCH_LAST |
-                                   SQL_FD_FETCH_PRIOR |
-                                   SQL_FD_FETCH_ABSOLUTE |
-								   SQL_FD_FETCH_RELATIVE | 
-								   SQL_FD_FETCH_BOOKMARK);
-        break;
-
-    case SQL_FILE_USAGE: /* ODBC 2.0 */
-		len = 2;
-        value = SQL_FILE_NOT_SUPPORTED;
-        break;
-
-    case SQL_GETDATA_EXTENSIONS: /* ODBC 2.0 */
-		len = 4;
-        value = (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND | SQL_GD_BLOCK);
-        break;
-
-    case SQL_GROUP_BY: /* ODBC 2.0 */
-		len = 2;
-        value = SQL_GB_GROUP_BY_EQUALS_SELECT;
-        break;
-
-    case SQL_IDENTIFIER_CASE: /* ODBC 1.0 */
-        /*	are identifiers case-sensitive (yes, but only when quoted.  If not quoted, they
-			default to lowercase)
-		*/
-		len = 2;
-        value = SQL_IC_LOWER;
-        break;
-
-    case SQL_IDENTIFIER_QUOTE_CHAR: /* ODBC 1.0 */
-        /* the character used to quote "identifiers" */
-		p = PG_VERSION_LE(conn, 6.2) ? " " : "\"";
-        break;
-
-    case SQL_KEYWORDS: /* ODBC 2.0 */
-		p = "";
-        break;
-
-    case SQL_LIKE_ESCAPE_CLAUSE: /* ODBC 2.0 */
-		/*	is there a character that escapes '%' and '_' in a LIKE clause?
-			not as far as I can tell
-		*/
-        p = "N";
-        break;
-
-    case SQL_LOCK_TYPES: /* ODBC 2.0 */
-		len = 4;
-        value = globals.lie ? (SQL_LCK_NO_CHANGE | SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK) : SQL_LCK_NO_CHANGE;
-        break;
-
-    case SQL_MAX_BINARY_LITERAL_LEN: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_MAX_CHAR_LITERAL_LEN: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_MAX_COLUMN_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = MAX_COLUMN_LEN;
-        break;
-
-    case SQL_MAX_COLUMNS_IN_GROUP_BY: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_COLUMNS_IN_INDEX: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_COLUMNS_IN_ORDER_BY: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_COLUMNS_IN_SELECT: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_COLUMNS_IN_TABLE: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_CURSOR_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = MAX_CURSOR_LEN;
-        break;
-
-    case SQL_MAX_INDEX_SIZE: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_MAX_OWNER_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_PROCEDURE_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_QUALIFIER_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_ROW_SIZE: /* ODBC 2.0 */
-		len = 4;
-		if (PG_VERSION_GE(conn, 7.1)) { /* Large Rowa in 7.1+ */
-			value = MAX_ROW_SIZE;
-		} else { /* Without the Toaster we're limited to the blocksize */
-			value = BLCKSZ;
-		}
-        break;
-
-    case SQL_MAX_ROW_SIZE_INCLUDES_LONG: /* ODBC 2.0 */
-        /*	does the preceding value include LONGVARCHAR and LONGVARBINARY
-			fields?   Well, it does include longvarchar, but not longvarbinary.
-		*/
-		p = "Y";
-        break;
-
-    case SQL_MAX_STATEMENT_LEN: /* ODBC 2.0 */
-        /* maybe this should be 0? */
-		len = 4;
-		if (PG_VERSION_GE(conn, 7.0)) { /* Long Queries in 7.0+ */
-			value = MAX_STATEMENT_LEN;
-		} else if (PG_VERSION_GE(conn, 6.5)) /* Prior to 7.0 we used 2*BLCKSZ */
-			value = (2*BLCKSZ);
-		else /* Prior to 6.5 we used BLCKSZ */
-			value = BLCKSZ;
-
-        break;
-
-    case SQL_MAX_TABLE_NAME_LEN: /* ODBC 1.0 */
-		len = 2;
-        value = MAX_TABLE_LEN;
-        break;
-
-    case SQL_MAX_TABLES_IN_SELECT: /* ODBC 2.0 */
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MAX_USER_NAME_LEN:
-		len = 2;
-        value = 0;
-        break;
-
-    case SQL_MULT_RESULT_SETS: /* ODBC 1.0 */
-        /* Don't support multiple result sets but say yes anyway? */
-		p = "Y";
-        break;
-
-    case SQL_MULTIPLE_ACTIVE_TXN: /* ODBC 1.0 */
-		p = "Y";
-        break;
-
-    case SQL_NEED_LONG_DATA_LEN: /* ODBC 2.0 */
-		/*	Dont need the length, SQLPutData can handle any size and multiple calls */
-		p = "N";
-        break;
-
-    case SQL_NON_NULLABLE_COLUMNS: /* ODBC 1.0 */
-		len = 2;
-        value = SQL_NNC_NON_NULL;
-        break;
-
-    case SQL_NULL_COLLATION: /* ODBC 2.0 */
-        /* where are nulls sorted? */
-		len = 2;
-        value = SQL_NC_END;
-        break;
-
-    case SQL_NUMERIC_FUNCTIONS: /* ODBC 1.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_ODBC_API_CONFORMANCE: /* ODBC 1.0 */
-		len = 2;
-        value = SQL_OAC_LEVEL1;
-        break;
-
-    case SQL_ODBC_SAG_CLI_CONFORMANCE: /* ODBC 1.0 */
-		len = 2;
-        value = SQL_OSCC_NOT_COMPLIANT;
-        break;
-
-    case SQL_ODBC_SQL_CONFORMANCE: /* ODBC 1.0 */
-		len = 2;
-        value = SQL_OSC_CORE;
-        break;
-
-    case SQL_ODBC_SQL_OPT_IEF: /* ODBC 1.0 */
-		p = "N";
-        break;
-
-	case SQL_OJ_CAPABILITIES: /* ODBC 2.01 */
-		len = 4;
-		if (PG_VERSION_GE(conn, 7.1)) { /* OJs in 7.1+ */
-			value = (SQL_OJ_LEFT |
-					SQL_OJ_RIGHT |
-					SQL_OJ_FULL |
-					SQL_OJ_NESTED |
-					SQL_OJ_NOT_ORDERED |
-					SQL_OJ_INNER |
-					SQL_OJ_ALL_COMPARISON_OPS);
-		} else { /* OJs not in <7.1 */
+	switch (fInfoType)
+	{
+		case SQL_ACCESSIBLE_PROCEDURES: /* ODBC 1.0 */
+			p = "N";
+			break;
+
+		case SQL_ACCESSIBLE_TABLES:		/* ODBC 1.0 */
+			p = "N";
+			break;
+
+		case SQL_ACTIVE_CONNECTIONS:	/* ODBC 1.0 */
+			len = 2;
+			value = MAX_CONNECTIONS;
+			break;
+
+		case SQL_ACTIVE_STATEMENTS:		/* ODBC 1.0 */
+			len = 2;
 			value = 0;
-		}
-		break;
+			break;
+
+		case SQL_ALTER_TABLE:	/* ODBC 2.0 */
+			len = 4;
+			value = SQL_AT_ADD_COLUMN;
+			break;
 
-    case SQL_ORDER_BY_COLUMNS_IN_SELECT: /* ODBC 2.0 */
-		p = (PG_VERSION_LE(conn, 6.3)) ? "Y" : "N";		
-        break;
+		case SQL_BOOKMARK_PERSISTENCE:	/* ODBC 2.0 */
+			/* very simple bookmark support */
+			len = 4;
+			value = globals.use_declarefetch ? 0 : (SQL_BP_SCROLL);
+			break;
+
+		case SQL_COLUMN_ALIAS:	/* ODBC 2.0 */
+			p = "N";
+			break;
+
+		case SQL_CONCAT_NULL_BEHAVIOR:	/* ODBC 1.0 */
+			len = 2;
+			value = SQL_CB_NON_NULL;
+			break;
+
+		case SQL_CONVERT_BIGINT:
+		case SQL_CONVERT_BINARY:
+		case SQL_CONVERT_BIT:
+		case SQL_CONVERT_CHAR:
+		case SQL_CONVERT_DATE:
+		case SQL_CONVERT_DECIMAL:
+		case SQL_CONVERT_DOUBLE:
+		case SQL_CONVERT_FLOAT:
+		case SQL_CONVERT_INTEGER:
+		case SQL_CONVERT_LONGVARBINARY:
+		case SQL_CONVERT_LONGVARCHAR:
+		case SQL_CONVERT_NUMERIC:
+		case SQL_CONVERT_REAL:
+		case SQL_CONVERT_SMALLINT:
+		case SQL_CONVERT_TIME:
+		case SQL_CONVERT_TIMESTAMP:
+		case SQL_CONVERT_TINYINT:
+		case SQL_CONVERT_VARBINARY:
+		case SQL_CONVERT_VARCHAR:		/* ODBC 1.0 */
+			len = 4;
+			value = fInfoType;
+			break;
+
+		case SQL_CONVERT_FUNCTIONS:		/* ODBC 1.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_CORRELATION_NAME:		/* ODBC 1.0 */
+
+			/*
+			 * Saying no correlation name makes Query not work right.
+			 * value = SQL_CN_NONE;
+			 */
+			len = 2;
+			value = SQL_CN_ANY;
+			break;
+
+		case SQL_CURSOR_COMMIT_BEHAVIOR:		/* ODBC 1.0 */
+			len = 2;
+			value = SQL_CB_CLOSE;
+			break;
+
+		case SQL_CURSOR_ROLLBACK_BEHAVIOR:		/* ODBC 1.0 */
+			len = 2;
+			value = SQL_CB_CLOSE;
+			break;
+
+		case SQL_DATA_SOURCE_NAME:		/* ODBC 1.0 */
+			p = CC_get_DSN(conn);
+			break;
+
+		case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
+			p = CC_is_onlyread(conn) ? "Y" : "N";
+			break;
+
+		case SQL_DATABASE_NAME:/* Support for old ODBC 1.0 Apps */
+
+			/*
+			 * Returning the database name causes problems in MS Query. It
+			 * generates query like: "SELECT DISTINCT a FROM byronncrap3
+			 * crap3"
+			 *
+			 * p = CC_get_database(conn);
+			 */
+			p = "";
+			break;
+
+		case SQL_DBMS_NAME:		/* ODBC 1.0 */
+			p = DBMS_NAME;
+			break;
+
+		case SQL_DBMS_VER:		/* ODBC 1.0 */
+
+			/*
+			 * The ODBC spec wants ##.##.#### ...whatever... so prepend
+			 * the driver
+			 */
+			/* version number to the dbms version string */
+			sprintf(tmp, "%s %s", POSTGRESDRIVERVERSION, conn->pg_version);
+			p = tmp;
+			break;
+
+		case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
+			len = 4;
+			value = SQL_TXN_READ_COMMITTED;		/* SQL_TXN_SERIALIZABLE; */
+			break;
+
+		case SQL_DRIVER_NAME:	/* ODBC 1.0 */
+			p = DRIVER_FILE_NAME;
+			break;
+
+		case SQL_DRIVER_ODBC_VER:
+			p = DRIVER_ODBC_VER;
+			break;
+
+		case SQL_DRIVER_VER:	/* ODBC 1.0 */
+			p = POSTGRESDRIVERVERSION;
+			break;
+
+		case SQL_EXPRESSIONS_IN_ORDERBY:		/* ODBC 1.0 */
+			p = "N";
+			break;
+
+		case SQL_FETCH_DIRECTION:		/* ODBC 1.0 */
+			len = 4;
+			value = globals.use_declarefetch ? (SQL_FD_FETCH_NEXT) : (SQL_FD_FETCH_NEXT |
+													 SQL_FD_FETCH_FIRST |
+													  SQL_FD_FETCH_LAST |
+													 SQL_FD_FETCH_PRIOR |
+												  SQL_FD_FETCH_ABSOLUTE |
+												  SQL_FD_FETCH_RELATIVE |
+												  SQL_FD_FETCH_BOOKMARK);
+			break;
+
+		case SQL_FILE_USAGE:	/* ODBC 2.0 */
+			len = 2;
+			value = SQL_FILE_NOT_SUPPORTED;
+			break;
+
+		case SQL_GETDATA_EXTENSIONS:	/* ODBC 2.0 */
+			len = 4;
+			value = (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND | SQL_GD_BLOCK);
+			break;
+
+		case SQL_GROUP_BY:		/* ODBC 2.0 */
+			len = 2;
+			value = SQL_GB_GROUP_BY_EQUALS_SELECT;
+			break;
+
+		case SQL_IDENTIFIER_CASE:		/* ODBC 1.0 */
+
+			/*
+			 * are identifiers case-sensitive (yes, but only when quoted.
+			 * If not quoted, they default to lowercase)
+			 */
+			len = 2;
+			value = SQL_IC_LOWER;
+			break;
+
+		case SQL_IDENTIFIER_QUOTE_CHAR: /* ODBC 1.0 */
+			/* the character used to quote "identifiers" */
+			p = PG_VERSION_LE(conn, 6.2) ? " " : "\"";
+			break;
+
+		case SQL_KEYWORDS:		/* ODBC 2.0 */
+			p = "";
+			break;
+
+		case SQL_LIKE_ESCAPE_CLAUSE:	/* ODBC 2.0 */
+
+			/*
+			 * is there a character that escapes '%' and '_' in a LIKE
+			 * clause? not as far as I can tell
+			 */
+			p = "N";
+			break;
+
+		case SQL_LOCK_TYPES:	/* ODBC 2.0 */
+			len = 4;
+			value = globals.lie ? (SQL_LCK_NO_CHANGE | SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK) : SQL_LCK_NO_CHANGE;
+			break;
+
+		case SQL_MAX_BINARY_LITERAL_LEN:		/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_MAX_CHAR_LITERAL_LEN:	/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_MAX_COLUMN_NAME_LEN:	/* ODBC 1.0 */
+			len = 2;
+			value = MAX_COLUMN_LEN;
+			break;
+
+		case SQL_MAX_COLUMNS_IN_GROUP_BY:		/* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_COLUMNS_IN_INDEX:	/* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
 
-    case SQL_OUTER_JOINS: /* ODBC 1.0 */
-		if (PG_VERSION_GE(conn, 7.1)) { /* OJs in 7.1+ */
+		case SQL_MAX_COLUMNS_IN_ORDER_BY:		/* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_COLUMNS_IN_SELECT: /* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_COLUMNS_IN_TABLE:	/* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_CURSOR_NAME_LEN:	/* ODBC 1.0 */
+			len = 2;
+			value = MAX_CURSOR_LEN;
+			break;
+
+		case SQL_MAX_INDEX_SIZE:		/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_MAX_OWNER_NAME_LEN:	/* ODBC 1.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_PROCEDURE_NAME_LEN:		/* ODBC 1.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_QUALIFIER_NAME_LEN:		/* ODBC 1.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_ROW_SIZE:	/* ODBC 2.0 */
+			len = 4;
+			if (PG_VERSION_GE(conn, 7.1))
+			{					/* Large Rowa in 7.1+ */
+				value = MAX_ROW_SIZE;
+			}
+			else
+			{					/* Without the Toaster we're limited to
+								 * the blocksize */
+				value = BLCKSZ;
+			}
+			break;
+
+		case SQL_MAX_ROW_SIZE_INCLUDES_LONG:	/* ODBC 2.0 */
+
+			/*
+			 * does the preceding value include LONGVARCHAR and
+			 * LONGVARBINARY fields?   Well, it does include longvarchar,
+			 * but not longvarbinary.
+			 */
 			p = "Y";
-		} else { /* OJs not in <7.1 */
+			break;
+
+		case SQL_MAX_STATEMENT_LEN:		/* ODBC 2.0 */
+			/* maybe this should be 0? */
+			len = 4;
+			if (PG_VERSION_GE(conn, 7.0))
+			{					/* Long Queries in 7.0+ */
+				value = MAX_STATEMENT_LEN;
+			}
+			else if (PG_VERSION_GE(conn, 6.5))	/* Prior to 7.0 we used
+												 * 2*BLCKSZ */
+				value = (2 * BLCKSZ);
+			else
+/* Prior to 6.5 we used BLCKSZ */
+				value = BLCKSZ;
+
+			break;
+
+		case SQL_MAX_TABLE_NAME_LEN:	/* ODBC 1.0 */
+			len = 2;
+			value = MAX_TABLE_LEN;
+			break;
+
+		case SQL_MAX_TABLES_IN_SELECT:	/* ODBC 2.0 */
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MAX_USER_NAME_LEN:
+			len = 2;
+			value = 0;
+			break;
+
+		case SQL_MULT_RESULT_SETS:		/* ODBC 1.0 */
+			/* Don't support multiple result sets but say yes anyway? */
+			p = "Y";
+			break;
+
+		case SQL_MULTIPLE_ACTIVE_TXN:	/* ODBC 1.0 */
+			p = "Y";
+			break;
+
+		case SQL_NEED_LONG_DATA_LEN:	/* ODBC 2.0 */
+
+			/*
+			 * Dont need the length, SQLPutData can handle any size and
+			 * multiple calls
+			 */
 			p = "N";
-		}
-        break;
-
-    case SQL_OWNER_TERM: /* ODBC 1.0 */
-		p = "owner";
-        break;
-
-    case SQL_OWNER_USAGE: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_POS_OPERATIONS: /* ODBC 2.0 */
-		len = 4;
-        value = globals.lie ? (SQL_POS_POSITION | SQL_POS_REFRESH | SQL_POS_UPDATE | SQL_POS_DELETE | SQL_POS_ADD) : (SQL_POS_POSITION | SQL_POS_REFRESH);
-        break;
-
-    case SQL_POSITIONED_STATEMENTS: /* ODBC 2.0 */
-		len = 4;
-        value = globals.lie ? (SQL_PS_POSITIONED_DELETE | 
-								SQL_PS_POSITIONED_UPDATE | 
-								SQL_PS_SELECT_FOR_UPDATE) : 0;
-        break;
-
-    case SQL_PROCEDURE_TERM: /* ODBC 1.0 */
-        p = "procedure";
-        break;
-
-    case SQL_PROCEDURES: /* ODBC 1.0 */
-		p = "Y";
-        break;
-
-    case SQL_QUALIFIER_LOCATION: /* ODBC 2.0 */
-		len = 2;
-        value = SQL_QL_START;
-        break;
-
-    case SQL_QUALIFIER_NAME_SEPARATOR: /* ODBC 1.0 */
-		p = "";
-        break;
-
-    case SQL_QUALIFIER_TERM: /* ODBC 1.0 */
-		p = "";
-        break;
-
-    case SQL_QUALIFIER_USAGE: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_QUOTED_IDENTIFIER_CASE: /* ODBC 2.0 */
-        /* are "quoted" identifiers case-sensitive?  YES! */
-		len = 2;
-        value = SQL_IC_SENSITIVE;
-        break;
-
-    case SQL_ROW_UPDATES: /* ODBC 1.0 */
-        /*  Driver doesn't support keyset-driven or mixed cursors, so
-			not much point in saying row updates are supported
-		*/
-        p = globals.lie ? "Y" : "N";
-        break;
-
-    case SQL_SCROLL_CONCURRENCY: /* ODBC 1.0 */
-		len = 4;
-        value = globals.lie ? (SQL_SCCO_READ_ONLY | 
-								SQL_SCCO_LOCK | 
-								SQL_SCCO_OPT_ROWVER | 
-								SQL_SCCO_OPT_VALUES) : (SQL_SCCO_READ_ONLY);
-        break;
-
-    case SQL_SCROLL_OPTIONS: /* ODBC 1.0 */
-		len = 4;
-        value = globals.lie ? (SQL_SO_FORWARD_ONLY | 
-								SQL_SO_STATIC | 
-								SQL_SO_KEYSET_DRIVEN | 
-								SQL_SO_DYNAMIC | 
-								SQL_SO_MIXED) : (globals.use_declarefetch ? SQL_SO_FORWARD_ONLY : (SQL_SO_FORWARD_ONLY | SQL_SO_STATIC));
-        break;
-
-    case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */
-		p = "";
-        break;
-
-    case SQL_SERVER_NAME: /* ODBC 1.0 */
-		p = CC_get_server(conn);
-        break;
-
-    case SQL_SPECIAL_CHARACTERS: /* ODBC 2.0 */
-        p = "_";
-        break;
-
-    case SQL_STATIC_SENSITIVITY: /* ODBC 2.0 */
-		len = 4;
-        value = globals.lie ? (SQL_SS_ADDITIONS | SQL_SS_DELETIONS | SQL_SS_UPDATES) : 0;
-        break;
-
-    case SQL_STRING_FUNCTIONS: /* ODBC 1.0 */
-		len = 4;
-        value = (SQL_FN_STR_CONCAT |
-				SQL_FN_STR_LCASE | 
-				SQL_FN_STR_LENGTH | 
-				SQL_FN_STR_LOCATE | 
-				SQL_FN_STR_LTRIM | 
-				SQL_FN_STR_RTRIM |
-				SQL_FN_STR_SUBSTRING |
-				SQL_FN_STR_UCASE);
-        break;
-
-    case SQL_SUBQUERIES: /* ODBC 2.0 */
-		/* postgres 6.3 supports subqueries */
-		len = 4;
-        value = (SQL_SQ_QUANTIFIED |
-				SQL_SQ_IN |
-				SQL_SQ_EXISTS |
-				SQL_SQ_COMPARISON);
-        break;
-
-    case SQL_SYSTEM_FUNCTIONS: /* ODBC 1.0 */
-		len = 4;
-		value = 0;
-        break;
-
-    case SQL_TABLE_TERM: /* ODBC 1.0 */
-		p = "table";
-        break;
-
-    case SQL_TIMEDATE_ADD_INTERVALS: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_TIMEDATE_DIFF_INTERVALS: /* ODBC 2.0 */
-		len = 4;
-        value = 0;
-        break;
-
-    case SQL_TIMEDATE_FUNCTIONS: /* ODBC 1.0 */
-		len = 4;
-        value = (SQL_FN_TD_NOW);
-        break;
-
-    case SQL_TXN_CAPABLE: /* ODBC 1.0 */
-        /* Postgres can deal with create or drop table statements in a transaction */
-		len = 2;
-        value = SQL_TC_ALL;
-        break;
-
-    case SQL_TXN_ISOLATION_OPTION: /* ODBC 1.0 */
-		len = 4;
-        value = SQL_TXN_READ_COMMITTED; /* SQL_TXN_SERIALIZABLE; */
-        break;
-
-    case SQL_UNION: /* ODBC 2.0 */
-		/*  unions with all supported in postgres 6.3 */
-		len = 4;
-        value = (SQL_U_UNION | SQL_U_UNION_ALL);
-        break;
-
-    case SQL_USER_NAME: /* ODBC 1.0 */
-		p = CC_get_username(conn);
-        break;
-
-    default:
-        /* unrecognized key */
-        conn->errormsg = "Unrecognized key passed to SQLGetInfo.";
-        conn->errornumber = CONN_NOT_IMPLEMENTED_ERROR;
-		CC_log_error(func, "", conn);
-        return SQL_ERROR;
-    }
+			break;
+
+		case SQL_NON_NULLABLE_COLUMNS:	/* ODBC 1.0 */
+			len = 2;
+			value = SQL_NNC_NON_NULL;
+			break;
+
+		case SQL_NULL_COLLATION:		/* ODBC 2.0 */
+			/* where are nulls sorted? */
+			len = 2;
+			value = SQL_NC_END;
+			break;
+
+		case SQL_NUMERIC_FUNCTIONS:		/* ODBC 1.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_ODBC_API_CONFORMANCE:	/* ODBC 1.0 */
+			len = 2;
+			value = SQL_OAC_LEVEL1;
+			break;
+
+		case SQL_ODBC_SAG_CLI_CONFORMANCE:		/* ODBC 1.0 */
+			len = 2;
+			value = SQL_OSCC_NOT_COMPLIANT;
+			break;
+
+		case SQL_ODBC_SQL_CONFORMANCE:	/* ODBC 1.0 */
+			len = 2;
+			value = SQL_OSC_CORE;
+			break;
+
+		case SQL_ODBC_SQL_OPT_IEF:		/* ODBC 1.0 */
+			p = "N";
+			break;
+
+		case SQL_OJ_CAPABILITIES:		/* ODBC 2.01 */
+			len = 4;
+			if (PG_VERSION_GE(conn, 7.1))
+			{					/* OJs in 7.1+ */
+				value = (SQL_OJ_LEFT |
+						 SQL_OJ_RIGHT |
+						 SQL_OJ_FULL |
+						 SQL_OJ_NESTED |
+						 SQL_OJ_NOT_ORDERED |
+						 SQL_OJ_INNER |
+						 SQL_OJ_ALL_COMPARISON_OPS);
+			}
+			else
+			{					/* OJs not in <7.1 */
+				value = 0;
+			}
+			break;
+
+		case SQL_ORDER_BY_COLUMNS_IN_SELECT:	/* ODBC 2.0 */
+			p = (PG_VERSION_LE(conn, 6.3)) ? "Y" : "N";
+			break;
+
+		case SQL_OUTER_JOINS:	/* ODBC 1.0 */
+			if (PG_VERSION_GE(conn, 7.1))
+			{					/* OJs in 7.1+ */
+				p = "Y";
+			}
+			else
+			{					/* OJs not in <7.1 */
+				p = "N";
+			}
+			break;
+
+		case SQL_OWNER_TERM:	/* ODBC 1.0 */
+			p = "owner";
+			break;
+
+		case SQL_OWNER_USAGE:	/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_POS_OPERATIONS:		/* ODBC 2.0 */
+			len = 4;
+			value = globals.lie ? (SQL_POS_POSITION | SQL_POS_REFRESH | SQL_POS_UPDATE | SQL_POS_DELETE | SQL_POS_ADD) : (SQL_POS_POSITION | SQL_POS_REFRESH);
+			break;
+
+		case SQL_POSITIONED_STATEMENTS: /* ODBC 2.0 */
+			len = 4;
+			value = globals.lie ? (SQL_PS_POSITIONED_DELETE |
+								   SQL_PS_POSITIONED_UPDATE |
+								   SQL_PS_SELECT_FOR_UPDATE) : 0;
+			break;
+
+		case SQL_PROCEDURE_TERM:		/* ODBC 1.0 */
+			p = "procedure";
+			break;
+
+		case SQL_PROCEDURES:	/* ODBC 1.0 */
+			p = "Y";
+			break;
+
+		case SQL_QUALIFIER_LOCATION:	/* ODBC 2.0 */
+			len = 2;
+			value = SQL_QL_START;
+			break;
+
+		case SQL_QUALIFIER_NAME_SEPARATOR:		/* ODBC 1.0 */
+			p = "";
+			break;
+
+		case SQL_QUALIFIER_TERM:		/* ODBC 1.0 */
+			p = "";
+			break;
+
+		case SQL_QUALIFIER_USAGE:		/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_QUOTED_IDENTIFIER_CASE:		/* ODBC 2.0 */
+			/* are "quoted" identifiers case-sensitive?  YES! */
+			len = 2;
+			value = SQL_IC_SENSITIVE;
+			break;
+
+		case SQL_ROW_UPDATES:	/* ODBC 1.0 */
+
+			/*
+			 * Driver doesn't support keyset-driven or mixed cursors, so
+			 * not much point in saying row updates are supported
+			 */
+			p = globals.lie ? "Y" : "N";
+			break;
+
+		case SQL_SCROLL_CONCURRENCY:	/* ODBC 1.0 */
+			len = 4;
+			value = globals.lie ? (SQL_SCCO_READ_ONLY |
+								   SQL_SCCO_LOCK |
+								   SQL_SCCO_OPT_ROWVER |
+							 SQL_SCCO_OPT_VALUES) : (SQL_SCCO_READ_ONLY);
+			break;
+
+		case SQL_SCROLL_OPTIONS:		/* ODBC 1.0 */
+			len = 4;
+			value = globals.lie ? (SQL_SO_FORWARD_ONLY |
+								   SQL_SO_STATIC |
+								   SQL_SO_KEYSET_DRIVEN |
+								   SQL_SO_DYNAMIC |
+								   SQL_SO_MIXED) : (globals.use_declarefetch ? SQL_SO_FORWARD_ONLY : (SQL_SO_FORWARD_ONLY | SQL_SO_STATIC));
+			break;
+
+		case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */
+			p = "";
+			break;
+
+		case SQL_SERVER_NAME:	/* ODBC 1.0 */
+			p = CC_get_server(conn);
+			break;
+
+		case SQL_SPECIAL_CHARACTERS:	/* ODBC 2.0 */
+			p = "_";
+			break;
+
+		case SQL_STATIC_SENSITIVITY:	/* ODBC 2.0 */
+			len = 4;
+			value = globals.lie ? (SQL_SS_ADDITIONS | SQL_SS_DELETIONS | SQL_SS_UPDATES) : 0;
+			break;
+
+		case SQL_STRING_FUNCTIONS:		/* ODBC 1.0 */
+			len = 4;
+			value = (SQL_FN_STR_CONCAT |
+					 SQL_FN_STR_LCASE |
+					 SQL_FN_STR_LENGTH |
+					 SQL_FN_STR_LOCATE |
+					 SQL_FN_STR_LTRIM |
+					 SQL_FN_STR_RTRIM |
+					 SQL_FN_STR_SUBSTRING |
+					 SQL_FN_STR_UCASE);
+			break;
+
+		case SQL_SUBQUERIES:	/* ODBC 2.0 */
+			/* postgres 6.3 supports subqueries */
+			len = 4;
+			value = (SQL_SQ_QUANTIFIED |
+					 SQL_SQ_IN |
+					 SQL_SQ_EXISTS |
+					 SQL_SQ_COMPARISON);
+			break;
+
+		case SQL_SYSTEM_FUNCTIONS:		/* ODBC 1.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_TABLE_TERM:	/* ODBC 1.0 */
+			p = "table";
+			break;
+
+		case SQL_TIMEDATE_ADD_INTERVALS:		/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_TIMEDATE_DIFF_INTERVALS:		/* ODBC 2.0 */
+			len = 4;
+			value = 0;
+			break;
+
+		case SQL_TIMEDATE_FUNCTIONS:	/* ODBC 1.0 */
+			len = 4;
+			value = (SQL_FN_TD_NOW);
+			break;
+
+		case SQL_TXN_CAPABLE:	/* ODBC 1.0 */
+
+			/*
+			 * Postgres can deal with create or drop table statements in a
+			 * transaction
+			 */
+			len = 2;
+			value = SQL_TC_ALL;
+			break;
+
+		case SQL_TXN_ISOLATION_OPTION:	/* ODBC 1.0 */
+			len = 4;
+			value = SQL_TXN_READ_COMMITTED;		/* SQL_TXN_SERIALIZABLE; */
+			break;
+
+		case SQL_UNION: /* ODBC 2.0 */
+			/* unions with all supported in postgres 6.3 */
+			len = 4;
+			value = (SQL_U_UNION | SQL_U_UNION_ALL);
+			break;
+
+		case SQL_USER_NAME:		/* ODBC 1.0 */
+			p = CC_get_username(conn);
+			break;
+
+		default:
+			/* unrecognized key */
+			conn->errormsg = "Unrecognized key passed to SQLGetInfo.";
+			conn->errornumber = CONN_NOT_IMPLEMENTED_ERROR;
+			CC_log_error(func, "", conn);
+			return SQL_ERROR;
+	}
 
 	result = SQL_SUCCESS;
 
-	mylog("SQLGetInfo: p='%s', len=%d, value=%d, cbMax=%d\n", p?p:"<NULL>", len, value, cbInfoValueMax);
+	mylog("SQLGetInfo: p='%s', len=%d, value=%d, cbMax=%d\n", p ? p : "<NULL>", len, value, cbInfoValueMax);
 
-	/*	NOTE, that if rgbInfoValue is NULL, then no warnings or errors should
-		result and just pcbInfoValue is returned, which indicates what length 
-		would be required if a real buffer had been passed in.
-	*/
-	if (p) {  /* char/binary data */
+	/*
+	 * NOTE, that if rgbInfoValue is NULL, then no warnings or errors
+	 * should result and just pcbInfoValue is returned, which indicates
+	 * what length would be required if a real buffer had been passed in.
+	 */
+	if (p)
+	{							/* char/binary data */
 		len = strlen(p);
 
-		if (rgbInfoValue) {
-			strncpy_null((char *)rgbInfoValue, p, (size_t)cbInfoValueMax);
+		if (rgbInfoValue)
+		{
+			strncpy_null((char *) rgbInfoValue, p, (size_t) cbInfoValueMax);
 
-			if (len >= cbInfoValueMax)  {
+			if (len >= cbInfoValueMax)
+			{
 				result = SQL_SUCCESS_WITH_INFO;
 				conn->errornumber = STMT_TRUNCATED;
 				conn->errormsg = "The buffer was too small for the result.";
@@ -647,41 +694,46 @@ RETCODE result;
 		}
 	}
 
-	else {	/* numeric data */
-		
-		if (rgbInfoValue) {
-		
-			if (len == 2 ) 
-				*((WORD *)rgbInfoValue) = (WORD) value;
+	else
+	{							/* numeric data */
+
+		if (rgbInfoValue)
+		{
+
+			if (len == 2)
+				*((WORD *) rgbInfoValue) = (WORD) value;
 			else if (len == 4)
-				*((DWORD *)rgbInfoValue) = (DWORD) value;
+				*((DWORD *) rgbInfoValue) = (DWORD) value;
 		}
 	}
 
-	if (pcbInfoValue) 
+	if (pcbInfoValue)
 		*pcbInfoValue = len;
 
 	return result;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
 
-RETCODE SQL_API SQLGetTypeInfo(
-        HSTMT   hstmt,
-        SWORD   fSqlType)
+RETCODE SQL_API
+SQLGetTypeInfo(
+			   HSTMT hstmt,
+			   SWORD fSqlType)
 {
-static char *func = "SQLGetTypeInfo";
-StatementClass *stmt = (StatementClass *) hstmt;
-TupleNode *row;
-int i;
+	static char *func = "SQLGetTypeInfo";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	TupleNode  *row;
+	int			i;
+
 /* Int4 type; */
-Int4 pgType; 
-Int2 sqlType;
+	Int4		pgType;
+	Int2		sqlType;
 
 	mylog("%s: entering...fSqlType = %d\n", func, fSqlType);
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -689,7 +741,8 @@ Int2 sqlType;
 
 	stmt->manual_result = TRUE;
 	stmt->result = QR_Constructor();
-	if( ! stmt->result) {
+	if (!stmt->result)
+	{
 		SC_log_error(func, "Error creating result.", stmt);
 		return SQL_ERROR;
 	}
@@ -713,13 +766,15 @@ Int2 sqlType;
 	QR_set_field_info(stmt->result, 13, "MINIMUM_SCALE", PG_TYPE_INT2, 2);
 	QR_set_field_info(stmt->result, 14, "MAXIMUM_SCALE", PG_TYPE_INT2, 2);
 
-	for(i=0, sqlType = sqlTypes[0]; sqlType; sqlType = sqlTypes[++i]) {
+	for (i = 0, sqlType = sqlTypes[0]; sqlType; sqlType = sqlTypes[++i])
+	{
 		pgType = sqltype_to_pgtype(sqlType);
 
-		if (fSqlType == SQL_ALL_TYPES || fSqlType == sqlType) {
-			row = (TupleNode *)malloc(sizeof(TupleNode) + (15 - 1)*sizeof(TupleField));
+		if (fSqlType == SQL_ALL_TYPES || fSqlType == sqlType)
+		{
+			row = (TupleNode *) malloc(sizeof(TupleNode) + (15 - 1) *sizeof(TupleField));
 
-			/*	These values can't be NULL */
+			/* These values can't be NULL */
 			set_tuplefield_string(&row->tuple[0], pgtype_to_name(stmt, pgType));
 			set_tuplefield_int2(&row->tuple[1], (Int2) sqlType);
 			set_tuplefield_int2(&row->tuple[6], pgtype_nullable(stmt, pgType));
@@ -727,10 +782,13 @@ Int2 sqlType;
 			set_tuplefield_int2(&row->tuple[8], pgtype_searchable(stmt, pgType));
 			set_tuplefield_int2(&row->tuple[10], pgtype_money(stmt, pgType));
 
-			/*	Localized data-source dependent data type name (always NULL) */
-			set_tuplefield_null(&row->tuple[12]);	
+			/*
+			 * Localized data-source dependent data type name (always
+			 * NULL)
+			 */
+			set_tuplefield_null(&row->tuple[12]);
 
-			/*	These values can be NULL */
+			/* These values can be NULL */
 			set_nullfield_int4(&row->tuple[2], pgtype_precision(stmt, pgType, PG_STATIC, PG_STATIC));
 			set_nullfield_string(&row->tuple[3], pgtype_literal_prefix(stmt, pgType));
 			set_nullfield_string(&row->tuple[4], pgtype_literal_suffix(stmt, pgType));
@@ -745,30 +803,34 @@ Int2 sqlType;
 	}
 
 
-    stmt->status = STMT_FINISHED;
-    stmt->currTuple = -1;
+	stmt->status = STMT_FINISHED;
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLGetFunctions(
-        HDBC      hdbc,
-        UWORD     fFunction,
-        UWORD FAR *pfExists)
+RETCODE SQL_API
+SQLGetFunctions(
+				HDBC hdbc,
+				UWORD fFunction,
+				UWORD FAR *pfExists)
 {
-static char *func="SQLGetFunctions";
+	static char *func = "SQLGetFunctions";
 
-	mylog( "%s: entering...\n", func);
+	mylog("%s: entering...\n", func);
 
-    if (fFunction == SQL_API_ALL_FUNCTIONS) {
+	if (fFunction == SQL_API_ALL_FUNCTIONS)
+	{
 
-		if (globals.lie) {
-			int i;
-			memset(pfExists, 0, sizeof(UWORD)*100);
+		if (globals.lie)
+		{
+			int			i;
+
+			memset(pfExists, 0, sizeof(UWORD) * 100);
 
 			pfExists[SQL_API_SQLALLOCENV] = TRUE;
 			pfExists[SQL_API_SQLFREEENV] = TRUE;
@@ -777,179 +839,309 @@ static char *func="SQLGetFunctions";
 			for (i = SQL_EXT_API_START; i <= SQL_EXT_API_LAST; i++)
 				pfExists[i] = TRUE;
 		}
-		else {
-			memset(pfExists, 0, sizeof(UWORD)*100);
+		else
+		{
+			memset(pfExists, 0, sizeof(UWORD) * 100);
 
 			/* ODBC core functions */
-			pfExists[SQL_API_SQLALLOCCONNECT]     = TRUE;
-			pfExists[SQL_API_SQLALLOCENV]         = TRUE;
-			pfExists[SQL_API_SQLALLOCSTMT]        = TRUE;
-			pfExists[SQL_API_SQLBINDCOL]          = TRUE;  
-			pfExists[SQL_API_SQLCANCEL]           = TRUE;
-			pfExists[SQL_API_SQLCOLATTRIBUTES]    = TRUE;
-			pfExists[SQL_API_SQLCONNECT]          = TRUE;
-			pfExists[SQL_API_SQLDESCRIBECOL]      = TRUE;  /* partial */
-			pfExists[SQL_API_SQLDISCONNECT]       = TRUE;
-			pfExists[SQL_API_SQLERROR]            = TRUE;
-			pfExists[SQL_API_SQLEXECDIRECT]       = TRUE;
-			pfExists[SQL_API_SQLEXECUTE]          = TRUE;
-			pfExists[SQL_API_SQLFETCH]            = TRUE;
-			pfExists[SQL_API_SQLFREECONNECT]      = TRUE;
-			pfExists[SQL_API_SQLFREEENV]          = TRUE;
-			pfExists[SQL_API_SQLFREESTMT]         = TRUE;
-			pfExists[SQL_API_SQLGETCURSORNAME]    = TRUE;
-			pfExists[SQL_API_SQLNUMRESULTCOLS]    = TRUE;
-			pfExists[SQL_API_SQLPREPARE]          = TRUE;  /* complete? */
-			pfExists[SQL_API_SQLROWCOUNT]         = TRUE;
-			pfExists[SQL_API_SQLSETCURSORNAME]    = TRUE;
-			pfExists[SQL_API_SQLSETPARAM]         = FALSE; /* odbc 1.0 */
-			pfExists[SQL_API_SQLTRANSACT]         = TRUE;
+			pfExists[SQL_API_SQLALLOCCONNECT] = TRUE;
+			pfExists[SQL_API_SQLALLOCENV] = TRUE;
+			pfExists[SQL_API_SQLALLOCSTMT] = TRUE;
+			pfExists[SQL_API_SQLBINDCOL] = TRUE;
+			pfExists[SQL_API_SQLCANCEL] = TRUE;
+			pfExists[SQL_API_SQLCOLATTRIBUTES] = TRUE;
+			pfExists[SQL_API_SQLCONNECT] = TRUE;
+			pfExists[SQL_API_SQLDESCRIBECOL] = TRUE;	/* partial */
+			pfExists[SQL_API_SQLDISCONNECT] = TRUE;
+			pfExists[SQL_API_SQLERROR] = TRUE;
+			pfExists[SQL_API_SQLEXECDIRECT] = TRUE;
+			pfExists[SQL_API_SQLEXECUTE] = TRUE;
+			pfExists[SQL_API_SQLFETCH] = TRUE;
+			pfExists[SQL_API_SQLFREECONNECT] = TRUE;
+			pfExists[SQL_API_SQLFREEENV] = TRUE;
+			pfExists[SQL_API_SQLFREESTMT] = TRUE;
+			pfExists[SQL_API_SQLGETCURSORNAME] = TRUE;
+			pfExists[SQL_API_SQLNUMRESULTCOLS] = TRUE;
+			pfExists[SQL_API_SQLPREPARE] = TRUE;		/* complete? */
+			pfExists[SQL_API_SQLROWCOUNT] = TRUE;
+			pfExists[SQL_API_SQLSETCURSORNAME] = TRUE;
+			pfExists[SQL_API_SQLSETPARAM] = FALSE;		/* odbc 1.0 */
+			pfExists[SQL_API_SQLTRANSACT] = TRUE;
 
 			/* ODBC level 1 functions */
-			pfExists[SQL_API_SQLBINDPARAMETER]    = TRUE;
-			pfExists[SQL_API_SQLCOLUMNS]          = TRUE;
-			pfExists[SQL_API_SQLDRIVERCONNECT]    = TRUE;
-			pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE;  /* partial */
-			pfExists[SQL_API_SQLGETDATA]          = TRUE;
-			pfExists[SQL_API_SQLGETFUNCTIONS]     = TRUE;                                                       
-			pfExists[SQL_API_SQLGETINFO]          = TRUE;
-			pfExists[SQL_API_SQLGETSTMTOPTION]    = TRUE;  /* partial */
-			pfExists[SQL_API_SQLGETTYPEINFO]      = TRUE;
-			pfExists[SQL_API_SQLPARAMDATA]        = TRUE;
-			pfExists[SQL_API_SQLPUTDATA]          = TRUE;
-			pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE;  /* partial */
-			pfExists[SQL_API_SQLSETSTMTOPTION]    = TRUE;
-			pfExists[SQL_API_SQLSPECIALCOLUMNS]   = TRUE;
-			pfExists[SQL_API_SQLSTATISTICS]       = TRUE;
-			pfExists[SQL_API_SQLTABLES]           = TRUE;
+			pfExists[SQL_API_SQLBINDPARAMETER] = TRUE;
+			pfExists[SQL_API_SQLCOLUMNS] = TRUE;
+			pfExists[SQL_API_SQLDRIVERCONNECT] = TRUE;
+			pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE;		/* partial */
+			pfExists[SQL_API_SQLGETDATA] = TRUE;
+			pfExists[SQL_API_SQLGETFUNCTIONS] = TRUE;
+			pfExists[SQL_API_SQLGETINFO] = TRUE;
+			pfExists[SQL_API_SQLGETSTMTOPTION] = TRUE;	/* partial */
+			pfExists[SQL_API_SQLGETTYPEINFO] = TRUE;
+			pfExists[SQL_API_SQLPARAMDATA] = TRUE;
+			pfExists[SQL_API_SQLPUTDATA] = TRUE;
+			pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE;		/* partial */
+			pfExists[SQL_API_SQLSETSTMTOPTION] = TRUE;
+			pfExists[SQL_API_SQLSPECIALCOLUMNS] = TRUE;
+			pfExists[SQL_API_SQLSTATISTICS] = TRUE;
+			pfExists[SQL_API_SQLTABLES] = TRUE;
 
 			/* ODBC level 2 functions */
-			pfExists[SQL_API_SQLBROWSECONNECT]    = FALSE;
+			pfExists[SQL_API_SQLBROWSECONNECT] = FALSE;
 			pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
-			pfExists[SQL_API_SQLDATASOURCES]      = FALSE;  /* only implemented by DM */
-			pfExists[SQL_API_SQLDESCRIBEPARAM]    = FALSE;	/* not properly implemented */
-			pfExists[SQL_API_SQLDRIVERS]          = FALSE;  /* only implemented by DM */
-			pfExists[SQL_API_SQLEXTENDEDFETCH]    = TRUE;
-			pfExists[SQL_API_SQLFOREIGNKEYS]      = TRUE;
-			pfExists[SQL_API_SQLMORERESULTS]      = TRUE;
-			pfExists[SQL_API_SQLNATIVESQL]        = TRUE;
-			pfExists[SQL_API_SQLNUMPARAMS]        = TRUE;
-			pfExists[SQL_API_SQLPARAMOPTIONS]     = FALSE;
-			pfExists[SQL_API_SQLPRIMARYKEYS]      = TRUE;
+			pfExists[SQL_API_SQLDATASOURCES] = FALSE;	/* only implemented by
+														 * DM */
+			pfExists[SQL_API_SQLDESCRIBEPARAM] = FALSE; /* not properly
+														 * implemented */
+			pfExists[SQL_API_SQLDRIVERS] = FALSE;		/* only implemented by
+														 * DM */
+			pfExists[SQL_API_SQLEXTENDEDFETCH] = TRUE;
+			pfExists[SQL_API_SQLFOREIGNKEYS] = TRUE;
+			pfExists[SQL_API_SQLMORERESULTS] = TRUE;
+			pfExists[SQL_API_SQLNATIVESQL] = TRUE;
+			pfExists[SQL_API_SQLNUMPARAMS] = TRUE;
+			pfExists[SQL_API_SQLPARAMOPTIONS] = FALSE;
+			pfExists[SQL_API_SQLPRIMARYKEYS] = TRUE;
 			pfExists[SQL_API_SQLPROCEDURECOLUMNS] = FALSE;
-			pfExists[SQL_API_SQLPROCEDURES]       = FALSE;
-			pfExists[SQL_API_SQLSETPOS]           = TRUE;
-			pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE;	/* odbc 1.0 */
-			pfExists[SQL_API_SQLTABLEPRIVILEGES]  = FALSE;
+			pfExists[SQL_API_SQLPROCEDURES] = FALSE;
+			pfExists[SQL_API_SQLSETPOS] = TRUE;
+			pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE;		/* odbc 1.0 */
+			pfExists[SQL_API_SQLTABLEPRIVILEGES] = FALSE;
 		}
-    } else {
+	}
+	else
+	{
 
 		if (globals.lie)
 			*pfExists = TRUE;
 
-		else {
-
-			switch(fFunction) {
-			case SQL_API_SQLALLOCCONNECT:     *pfExists = TRUE; break;
-			case SQL_API_SQLALLOCENV:         *pfExists = TRUE; break;
-			case SQL_API_SQLALLOCSTMT:        *pfExists = TRUE; break;
-			case SQL_API_SQLBINDCOL:          *pfExists = TRUE; break;
-			case SQL_API_SQLCANCEL:           *pfExists = TRUE; break;
-			case SQL_API_SQLCOLATTRIBUTES:    *pfExists = TRUE; break;
-			case SQL_API_SQLCONNECT:          *pfExists = TRUE; break;
-			case SQL_API_SQLDESCRIBECOL:      *pfExists = TRUE; break;  /* partial */
-			case SQL_API_SQLDISCONNECT:       *pfExists = TRUE; break;
-			case SQL_API_SQLERROR:            *pfExists = TRUE; break;
-			case SQL_API_SQLEXECDIRECT:       *pfExists = TRUE; break;
-			case SQL_API_SQLEXECUTE:          *pfExists = TRUE; break;
-			case SQL_API_SQLFETCH:            *pfExists = TRUE; break;
-			case SQL_API_SQLFREECONNECT:      *pfExists = TRUE; break;
-			case SQL_API_SQLFREEENV:          *pfExists = TRUE; break;
-			case SQL_API_SQLFREESTMT:         *pfExists = TRUE; break;
-			case SQL_API_SQLGETCURSORNAME:    *pfExists = TRUE; break;
-			case SQL_API_SQLNUMRESULTCOLS:    *pfExists = TRUE; break;
-			case SQL_API_SQLPREPARE:          *pfExists = TRUE; break;
-			case SQL_API_SQLROWCOUNT:         *pfExists = TRUE; break;
-			case SQL_API_SQLSETCURSORNAME:    *pfExists = TRUE; break;
-			case SQL_API_SQLSETPARAM:         *pfExists = FALSE; break; /* odbc 1.0 */
-			case SQL_API_SQLTRANSACT:         *pfExists = TRUE; break;
-
-				/* ODBC level 1 functions */
-			case SQL_API_SQLBINDPARAMETER:    *pfExists = TRUE; break;
-			case SQL_API_SQLCOLUMNS:          *pfExists = TRUE; break;
-			case SQL_API_SQLDRIVERCONNECT:    *pfExists = TRUE; break;
-			case SQL_API_SQLGETCONNECTOPTION: *pfExists = TRUE; break;  /* partial */
-			case SQL_API_SQLGETDATA:          *pfExists = TRUE; break;
-			case SQL_API_SQLGETFUNCTIONS:     *pfExists = TRUE; break;
-			case SQL_API_SQLGETINFO:          *pfExists = TRUE; break;
-			case SQL_API_SQLGETSTMTOPTION:    *pfExists = TRUE; break;  /* partial */
-			case SQL_API_SQLGETTYPEINFO:      *pfExists = TRUE; break;
-			case SQL_API_SQLPARAMDATA:        *pfExists = TRUE; break;
-			case SQL_API_SQLPUTDATA:          *pfExists = TRUE; break;
-			case SQL_API_SQLSETCONNECTOPTION: *pfExists = TRUE; break;  /* partial */
-			case SQL_API_SQLSETSTMTOPTION:    *pfExists = TRUE; break;
-			case SQL_API_SQLSPECIALCOLUMNS:   *pfExists = TRUE; break;
-			case SQL_API_SQLSTATISTICS:       *pfExists = TRUE; break;
-			case SQL_API_SQLTABLES:           *pfExists = TRUE; break;
-
-				/* ODBC level 2 functions */
-			case SQL_API_SQLBROWSECONNECT:    *pfExists = FALSE; break;
-			case SQL_API_SQLCOLUMNPRIVILEGES: *pfExists = FALSE; break;
-			case SQL_API_SQLDATASOURCES:      *pfExists = FALSE; break;  /* only implemented by DM */
-			case SQL_API_SQLDESCRIBEPARAM:    *pfExists = FALSE; break;  /* not properly implemented */
-			case SQL_API_SQLDRIVERS:          *pfExists = FALSE; break;  /* only implemented by DM */
-			case SQL_API_SQLEXTENDEDFETCH:    *pfExists = TRUE; break;
-			case SQL_API_SQLFOREIGNKEYS:      *pfExists = TRUE; break;
-			case SQL_API_SQLMORERESULTS:      *pfExists = TRUE; break;
-			case SQL_API_SQLNATIVESQL:        *pfExists = TRUE; break;
-			case SQL_API_SQLNUMPARAMS:        *pfExists = TRUE; break;
-			case SQL_API_SQLPARAMOPTIONS:     *pfExists = FALSE; break;
-			case SQL_API_SQLPRIMARYKEYS:      *pfExists = TRUE; break;
-			case SQL_API_SQLPROCEDURECOLUMNS: *pfExists = FALSE; break;
-			case SQL_API_SQLPROCEDURES:       *pfExists = FALSE; break;
-			case SQL_API_SQLSETPOS:           *pfExists = TRUE; break;
-			case SQL_API_SQLSETSCROLLOPTIONS: *pfExists = TRUE; break;	/* odbc 1.0 */
-			case SQL_API_SQLTABLEPRIVILEGES:  *pfExists = FALSE; break;
+		else
+		{
+
+			switch (fFunction)
+			{
+				case SQL_API_SQLALLOCCONNECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLALLOCENV:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLALLOCSTMT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLBINDCOL:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLCANCEL:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLCOLATTRIBUTES:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLCONNECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLDESCRIBECOL:
+					*pfExists = TRUE;
+					break;		/* partial */
+				case SQL_API_SQLDISCONNECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLERROR:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLEXECDIRECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLEXECUTE:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLFETCH:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLFREECONNECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLFREEENV:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLFREESTMT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLGETCURSORNAME:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLNUMRESULTCOLS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLPREPARE:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLROWCOUNT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSETCURSORNAME:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSETPARAM:
+					*pfExists = FALSE;
+					break;		/* odbc 1.0 */
+				case SQL_API_SQLTRANSACT:
+					*pfExists = TRUE;
+					break;
+
+					/* ODBC level 1 functions */
+				case SQL_API_SQLBINDPARAMETER:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLCOLUMNS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLDRIVERCONNECT:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLGETCONNECTOPTION:
+					*pfExists = TRUE;
+					break;		/* partial */
+				case SQL_API_SQLGETDATA:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLGETFUNCTIONS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLGETINFO:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLGETSTMTOPTION:
+					*pfExists = TRUE;
+					break;		/* partial */
+				case SQL_API_SQLGETTYPEINFO:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLPARAMDATA:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLPUTDATA:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSETCONNECTOPTION:
+					*pfExists = TRUE;
+					break;		/* partial */
+				case SQL_API_SQLSETSTMTOPTION:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSPECIALCOLUMNS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSTATISTICS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLTABLES:
+					*pfExists = TRUE;
+					break;
+
+					/* ODBC level 2 functions */
+				case SQL_API_SQLBROWSECONNECT:
+					*pfExists = FALSE;
+					break;
+				case SQL_API_SQLCOLUMNPRIVILEGES:
+					*pfExists = FALSE;
+					break;
+				case SQL_API_SQLDATASOURCES:
+					*pfExists = FALSE;
+					break;		/* only implemented by DM */
+				case SQL_API_SQLDESCRIBEPARAM:
+					*pfExists = FALSE;
+					break;		/* not properly implemented */
+				case SQL_API_SQLDRIVERS:
+					*pfExists = FALSE;
+					break;		/* only implemented by DM */
+				case SQL_API_SQLEXTENDEDFETCH:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLFOREIGNKEYS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLMORERESULTS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLNATIVESQL:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLNUMPARAMS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLPARAMOPTIONS:
+					*pfExists = FALSE;
+					break;
+				case SQL_API_SQLPRIMARYKEYS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLPROCEDURECOLUMNS:
+					*pfExists = FALSE;
+					break;
+				case SQL_API_SQLPROCEDURES:
+					*pfExists = FALSE;
+					break;
+				case SQL_API_SQLSETPOS:
+					*pfExists = TRUE;
+					break;
+				case SQL_API_SQLSETSCROLLOPTIONS:
+					*pfExists = TRUE;
+					break;		/* odbc 1.0 */
+				case SQL_API_SQLTABLEPRIVILEGES:
+					*pfExists = FALSE;
+					break;
 			}
 		}
-    }
+	}
 
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
 
 
-RETCODE SQL_API SQLTables(
-                          HSTMT       hstmt,
-                          UCHAR FAR * szTableQualifier,
-                          SWORD       cbTableQualifier,
-                          UCHAR FAR * szTableOwner,
-                          SWORD       cbTableOwner,
-                          UCHAR FAR * szTableName,
-                          SWORD       cbTableName,
-                          UCHAR FAR * szTableType,
-                          SWORD       cbTableType)
+RETCODE SQL_API
+SQLTables(
+		  HSTMT hstmt,
+		  UCHAR FAR *szTableQualifier,
+		  SWORD cbTableQualifier,
+		  UCHAR FAR *szTableOwner,
+		  SWORD cbTableOwner,
+		  UCHAR FAR *szTableName,
+		  SWORD cbTableName,
+		  UCHAR FAR *szTableType,
+		  SWORD cbTableType)
 {
-static char *func = "SQLTables";
-StatementClass *stmt = (StatementClass *) hstmt;
-StatementClass *tbl_stmt;
-TupleNode *row;
-HSTMT htbl_stmt;
-RETCODE result;
-char *tableType;
-char tables_query[STD_STATEMENT_LEN];
-char table_name[MAX_INFO_STRING], table_owner[MAX_INFO_STRING], relkind_or_hasrules[MAX_INFO_STRING];
-ConnectionClass *conn;
-ConnInfo *ci;
-char *prefix[32], prefixes[MEDIUM_REGISTRY_LEN];
-char *table_type[32], table_types[MAX_INFO_STRING];
-char show_system_tables, show_regular_tables, show_views;
-char regular_table, view, systable;
-int i;
-
-mylog("%s: entering...stmt=%u\n", func, stmt);
-
-	if( ! stmt) {
+	static char *func = "SQLTables";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	StatementClass *tbl_stmt;
+	TupleNode  *row;
+	HSTMT		htbl_stmt;
+	RETCODE		result;
+	char	   *tableType;
+	char		tables_query[STD_STATEMENT_LEN];
+	char		table_name[MAX_INFO_STRING],
+				table_owner[MAX_INFO_STRING],
+				relkind_or_hasrules[MAX_INFO_STRING];
+	ConnectionClass *conn;
+	ConnInfo   *ci;
+	char	   *prefix[32],
+				prefixes[MEDIUM_REGISTRY_LEN];
+	char	   *table_type[32],
+				table_types[MAX_INFO_STRING];
+	char		show_system_tables,
+				show_regular_tables,
+				show_views;
+	char		regular_table,
+				view,
+				systable;
+	int			i;
+
+	mylog("%s: entering...stmt=%u\n", func, stmt);
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -960,8 +1152,9 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	conn = (ConnectionClass *) (stmt->hdbc);
 	ci = &stmt->hdbc->connInfo;
 
-	result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLTables result.";
 		SC_log_error(func, "", stmt);
@@ -970,14 +1163,17 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
 	/* ********************************************************************** */
-	/*	Create the query to find out the tables */
+	/* Create the query to find out the tables */
 	/* ********************************************************************** */
 
-	if (PG_VERSION_GE(conn, 7.1)) { /* view is represented by its relkind since 7.1 */
+	if (PG_VERSION_GE(conn, 7.1))
+	{							/* view is represented by its relkind
+								 * since 7.1 */
 		strcpy(tables_query, "select relname, usename, relkind from pg_class, pg_user");
 		strcat(tables_query, " where relkind in ('r', 'v')");
 	}
-	else {
+	else
+	{
 		strcpy(tables_query, "select relname, usename, relhasrules from pg_class, pg_user");
 		strcat(tables_query, " where relkind = 'r'");
 	}
@@ -986,58 +1182,64 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	my_strcat(tables_query, " and relname like '%.*s'", szTableName, cbTableName);
 
 
-	/*	Parse the extra systable prefix  */
+	/* Parse the extra systable prefix	*/
 	strcpy(prefixes, globals.extra_systable_prefixes);
 	i = 0;
 	prefix[i] = strtok(prefixes, ";");
-	while (prefix[i] && i<32) {
+	while (prefix[i] && i < 32)
+	{
 		prefix[++i] = strtok(NULL, ";");
 	}
 
-	/*	Parse the desired table types to return */
+	/* Parse the desired table types to return */
 	show_system_tables = FALSE;
 	show_regular_tables = FALSE;
 	show_views = FALSE;
 
-	/*	make_string mallocs memory */
+	/* make_string mallocs memory */
 	tableType = make_string(szTableType, cbTableType, NULL);
-	if (tableType) {
+	if (tableType)
+	{
 		strcpy(table_types, tableType);
 		free(tableType);
 		i = 0;
 		table_type[i] = strtok(table_types, ",");
-		while (table_type[i] && i<32) {
+		while (table_type[i] && i < 32)
 			table_type[++i] = strtok(NULL, ",");
-		}
 
-		/*	Check for desired table types to return */
+		/* Check for desired table types to return */
 		i = 0;
-		while (table_type[i]) {
-			if ( strstr(table_type[i], "SYSTEM TABLE"))
+		while (table_type[i])
+		{
+			if (strstr(table_type[i], "SYSTEM TABLE"))
 				show_system_tables = TRUE;
-			else if ( strstr(table_type[i], "TABLE"))
+			else if (strstr(table_type[i], "TABLE"))
 				show_regular_tables = TRUE;
-			else if ( strstr(table_type[i], "VIEW"))
+			else if (strstr(table_type[i], "VIEW"))
 				show_views = TRUE;
 
 			i++;
 		}
 	}
-	else {
+	else
+	{
 		show_regular_tables = TRUE;
 		show_views = TRUE;
 	}
 
-	/*  If not interested in SYSTEM TABLES then filter them out
-		to save some time on the query.  If treating system tables
-		as regular tables, then dont filter either.
-	*/
-	if ( ! atoi(ci->show_system_tables) && ! show_system_tables) {
+	/*
+	 * If not interested in SYSTEM TABLES then filter them out to save
+	 * some time on the query.	If treating system tables as regular
+	 * tables, then dont filter either.
+	 */
+	if (!atoi(ci->show_system_tables) && !show_system_tables)
+	{
 		strcat(tables_query, " and relname !~ '^" POSTGRES_SYS_PREFIX);
 
-		/*	Also filter out user-defined system table types */
+		/* Also filter out user-defined system table types */
 		i = 0;
-		while(prefix[i]) {
+		while (prefix[i])
+		{
 			strcat(tables_query, "|^");
 			strcat(tables_query, prefix[i]);
 			i++;
@@ -1048,8 +1250,9 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 
 	/* match users */
-	if (PG_VERSION_LT(conn, 7.1)) /* filter out large objects in older versions */ 
-		strcat(tables_query, " and relname !~ '^xinv[0-9]+'"); 
+	if (PG_VERSION_LT(conn, 7.1))		/* filter out large objects in
+										 * older versions */
+		strcat(tables_query, " and relname !~ '^xinv[0-9]+'");
 
 	strcat(tables_query, " and usesysid = relowner");
 	strcat(tables_query, " order by relname");
@@ -1057,7 +1260,8 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	/* ********************************************************************** */
 
 	result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
@@ -1065,37 +1269,41 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 		return SQL_ERROR;
 	}
 
-    result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
-                        table_name, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
+						table_name, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(htbl_stmt, 2, SQL_C_CHAR,
-                        table_owner, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(htbl_stmt, 2, SQL_C_CHAR,
+						table_owner, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
-    result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-                        relkind_or_hasrules, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		return SQL_ERROR;
+	}
+	result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
+						relkind_or_hasrules, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	stmt->result = QR_Constructor();
-	if(!stmt->result) {
+	if (!stmt->result)
+	{
 		stmt->errormsg = "Couldn't allocate memory for SQLTables result.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
@@ -1104,9 +1312,13 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	}
 
 	/* the binding structure for a statement is not set up until */
-	/* a statement is actually executed, so we'll have to do this ourselves. */
+
+	/*
+	 * a statement is actually executed, so we'll have to do this
+	 * ourselves.
+	 */
 	extend_bindings(stmt, 5);
-	
+
 	/* set the field names */
 	QR_set_num_fields(stmt->result, 5);
 	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
@@ -1117,23 +1329,28 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 	/* add the tuples */
 	result = SQLFetch(htbl_stmt);
-	while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
+	{
 
-		/*	Determine if this table name is a system table.
-			If treating system tables as regular tables, then 
-			no need to do this test.
-		*/		
+		/*
+		 * Determine if this table name is a system table. If treating
+		 * system tables as regular tables, then no need to do this test.
+		 */
 		systable = FALSE;
-		if( ! atoi(ci->show_system_tables)) {
+		if (!atoi(ci->show_system_tables))
+		{
 
-			if ( strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
+			if (strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
 				systable = TRUE;
 
-			else {			/* Check extra system table prefixes */
+			else
+			{					/* Check extra system table prefixes */
 				i = 0;
-				while (prefix[i]) {
+				while (prefix[i])
+				{
 					mylog("table_name='%s', prefix[%d]='%s'\n", table_name, i, prefix[i]);
-					if (strncmp(table_name, prefix[i], strlen(prefix[i])) == 0) {
+					if (strncmp(table_name, prefix[i], strlen(prefix[i])) == 0)
+					{
 						systable = TRUE;
 						break;
 					}
@@ -1142,24 +1359,29 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 			}
 		}
 
-		/*	Determine if the table name is a view */
-		if (PG_VERSION_GE(conn, 7.1)) /* view is represented by its relkind since 7.1 */
+		/* Determine if the table name is a view */
+		if (PG_VERSION_GE(conn, 7.1))	/* view is represented by its
+										 * relkind since 7.1 */
 			view = (relkind_or_hasrules[0] == 'v');
 		else
 			view = (relkind_or_hasrules[0] == '1');
 
-		/*	It must be a regular table */
-		regular_table = ( ! systable && ! view);
+		/* It must be a regular table */
+		regular_table = (!systable && !view);
+
 
+		/* Include the row in the result set if meets all criteria */
 
-		/*	Include the row in the result set if meets all criteria */
-		/*	NOTE: Unsupported table types (i.e., LOCAL TEMPORARY, ALIAS, etc)
-					will return nothing */
-		if ( (systable && show_system_tables) ||
-			 (view && show_views) || 
-			 (regular_table && show_regular_tables)) {
+		/*
+		 * NOTE: Unsupported table types (i.e., LOCAL TEMPORARY, ALIAS,
+		 * etc) will return nothing
+		 */
+		if ((systable && show_system_tables) ||
+			(view && show_views) ||
+			(regular_table && show_regular_tables))
+		{
 
-			row = (TupleNode *)malloc(sizeof(TupleNode) + (5 - 1) * sizeof(TupleField));
+			row = (TupleNode *) malloc(sizeof(TupleNode) + (5 - 1) *sizeof(TupleField));
 
 			set_tuplefield_string(&row->tuple[0], "");
 
@@ -1179,8 +1401,9 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 			QR_add_tuple(stmt->result, row);
 		}
 		result = SQLFetch(htbl_stmt);
-    }
-	if(result != SQL_NO_DATA_FOUND) {
+	}
+	if (result != SQL_NO_DATA_FOUND)
+	{
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
@@ -1205,36 +1428,48 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 
 
-RETCODE SQL_API SQLColumns(
-                           HSTMT        hstmt,
-                           UCHAR FAR *  szTableQualifier,
-                           SWORD        cbTableQualifier,
-                           UCHAR FAR *  szTableOwner,
-                           SWORD        cbTableOwner,
-                           UCHAR FAR *  szTableName,
-                           SWORD        cbTableName,
-                           UCHAR FAR *  szColumnName,
-                           SWORD        cbColumnName)
+RETCODE SQL_API
+SQLColumns(
+		   HSTMT hstmt,
+		   UCHAR FAR *szTableQualifier,
+		   SWORD cbTableQualifier,
+		   UCHAR FAR *szTableOwner,
+		   SWORD cbTableOwner,
+		   UCHAR FAR *szTableName,
+		   SWORD cbTableName,
+		   UCHAR FAR *szColumnName,
+		   SWORD cbColumnName)
 {
-static char *func = "SQLColumns";
-StatementClass *stmt = (StatementClass *) hstmt;
-TupleNode *row;
-HSTMT hcol_stmt;
-StatementClass *col_stmt;
-char columns_query[STD_STATEMENT_LEN];
-RETCODE result;
-char table_owner[MAX_INFO_STRING], table_name[MAX_INFO_STRING], field_name[MAX_INFO_STRING], field_type_name[MAX_INFO_STRING];
-Int2 field_number, result_cols, scale;
-Int4 field_type, the_type, field_length, mod_length, precision;
-char useStaticPrecision;
-char not_null[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
-ConnInfo *ci;
-ConnectionClass *conn;
+	static char *func = "SQLColumns";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	TupleNode  *row;
+	HSTMT		hcol_stmt;
+	StatementClass *col_stmt;
+	char		columns_query[STD_STATEMENT_LEN];
+	RETCODE		result;
+	char		table_owner[MAX_INFO_STRING],
+				table_name[MAX_INFO_STRING],
+				field_name[MAX_INFO_STRING],
+				field_type_name[MAX_INFO_STRING];
+	Int2		field_number,
+				result_cols,
+				scale;
+	Int4		field_type,
+				the_type,
+				field_length,
+				mod_length,
+				precision;
+	char		useStaticPrecision;
+	char		not_null[MAX_INFO_STRING],
+				relhasrules[MAX_INFO_STRING];
+	ConnInfo   *ci;
+	ConnectionClass *conn;
 
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -1246,13 +1481,17 @@ ConnectionClass *conn;
 	ci = &stmt->hdbc->connInfo;
 
 	/* ********************************************************************** */
-	/*	Create the query to find out the columns (Note: pre 6.3 did not have the atttypmod field) */
+
+	/*
+	 * Create the query to find out the columns (Note: pre 6.3 did not
+	 * have the atttypmod field)
+	 */
 	/* ********************************************************************** */
 	sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid"
-			", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules"
+	   ", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules"
 			" from pg_user u, pg_class c, pg_attribute a, pg_type t"
 			" where u.usesysid = c.relowner"
-			" and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
+	  " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
 			PG_VERSION_LE(conn, 6.2) ? "a.attlen" : "a.atttypmod");
 
 	my_strcat(columns_query, " and c.relname like '%.*s'", szTableName, cbTableName);
@@ -1261,186 +1500,206 @@ ConnectionClass *conn;
 
 	/* give the output in the order the columns were defined */
 	/* when the table was created */
-    strcat(columns_query, " order by attnum");
-    /* ********************************************************************** */
+	strcat(columns_query, " order by attnum");
+	/* ********************************************************************** */
 
-    result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLColumns result.";
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 	col_stmt = (StatementClass *) hcol_stmt;
 
 	mylog("SQLColumns: hcol_stmt = %u, col_stmt = %u\n", hcol_stmt, col_stmt);
 
-    result = SQLExecDirect(hcol_stmt, columns_query,
-                           strlen(columns_query));
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLExecDirect(hcol_stmt, columns_query,
+						   strlen(columns_query));
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
-                        table_owner, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
+						table_owner, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 2, SQL_C_CHAR,
-                        table_name, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 2, SQL_C_CHAR,
+						table_name, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 3, SQL_C_CHAR,
-                        field_name, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 3, SQL_C_CHAR,
+						field_name, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 4, SQL_C_LONG,
-                        &field_type, 4, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 4, SQL_C_LONG,
+						&field_type, 4, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 5, SQL_C_CHAR,
-                        field_type_name, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 5, SQL_C_CHAR,
+						field_type_name, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 6, SQL_C_SHORT,
-                        &field_number, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 6, SQL_C_SHORT,
+						&field_number, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 7, SQL_C_LONG,
-                        &field_length, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 7, SQL_C_LONG,
+						&field_length, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 8, SQL_C_LONG,
-                        &mod_length, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 8, SQL_C_LONG,
+						&mod_length, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 9, SQL_C_CHAR,
-                        not_null, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 9, SQL_C_CHAR,
+						not_null, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 10, SQL_C_CHAR,
-                        relhasrules, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 10, SQL_C_CHAR,
+						relhasrules, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    stmt->result = QR_Constructor();
-    if(!stmt->result) {
+	stmt->result = QR_Constructor();
+	if (!stmt->result)
+	{
 		stmt->errormsg = "Couldn't allocate memory for SQLColumns result.";
-        stmt->errornumber = STMT_NO_MEMORY_ERROR;
+		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
+
+	/* the binding structure for a statement is not set up until */
 
-    /* the binding structure for a statement is not set up until */
-    /* a statement is actually executed, so we'll have to do this ourselves. */
+	/*
+	 * a statement is actually executed, so we'll have to do this
+	 * ourselves.
+	 */
 	result_cols = 14;
-    extend_bindings(stmt, result_cols);
-
-    /* set the field names */
-    QR_set_num_fields(stmt->result, result_cols);
-    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 4, "DATA_TYPE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 5, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 6, "PRECISION", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 7, "LENGTH", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
-
-    /*	User defined fields */
-    QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
+	extend_bindings(stmt, result_cols);
+
+	/* set the field names */
+	QR_set_num_fields(stmt->result, result_cols);
+	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 4, "DATA_TYPE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 5, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 6, "PRECISION", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 7, "LENGTH", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
+
+	/* User defined fields */
+	QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
 	QR_set_field_info(stmt->result, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
 
-	
+
 	result = SQLFetch(hcol_stmt);
 
 
-	/*	Only show oid if option AND there are other columns AND 
-		it's not being called by SQLStatistics .
-		Always show OID if it's a system table
-	*/
+	/*
+	 * Only show oid if option AND there are other columns AND it's not
+	 * being called by SQLStatistics . Always show OID if it's a system
+	 * table
+	 */
 
-	if (result != SQL_ERROR && ! stmt->internal) {
+	if (result != SQL_ERROR && !stmt->internal)
+	{
 
-		if (relhasrules[0] != '1' && 
-		    (atoi(ci->show_oid_column) || 
-			 strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)) {
+		if (relhasrules[0] != '1' &&
+			(atoi(ci->show_oid_column) ||
+			 strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0))
+		{
 
-			/*	For OID fields */
+			/* For OID fields */
 			the_type = PG_TYPE_OID;
-			row = (TupleNode *)malloc(sizeof(TupleNode) +
-									  (result_cols - 1) * sizeof(TupleField));
+			row = (TupleNode *) malloc(sizeof(TupleNode) +
+								  (result_cols - 1) *sizeof(TupleField));
 
 			set_tuplefield_string(&row->tuple[0], "");
 			/* see note in SQLTables() */
-			/*      set_tuplefield_string(&row->tuple[1], table_owner); */
+			/* set_tuplefield_string(&row->tuple[1], table_owner); */
 			set_tuplefield_string(&row->tuple[1], "");
 			set_tuplefield_string(&row->tuple[2], table_name);
 			set_tuplefield_string(&row->tuple[3], "oid");
@@ -1463,64 +1722,69 @@ ConnectionClass *conn;
 
 	}
 
-    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
-        row = (TupleNode *)malloc(sizeof(TupleNode) +
-                                  (result_cols - 1) * sizeof(TupleField));
-
-
-        set_tuplefield_string(&row->tuple[0], "");
-        /* see note in SQLTables() */
-        /*      set_tuplefield_string(&row->tuple[1], table_owner); */
-        set_tuplefield_string(&row->tuple[1], "");
-        set_tuplefield_string(&row->tuple[2], table_name);
-        set_tuplefield_string(&row->tuple[3], field_name);
-        set_tuplefield_int2(&row->tuple[4], pgtype_to_sqltype(stmt, field_type));
-        set_tuplefield_string(&row->tuple[5], field_type_name);
-
+	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
+	{
+		row = (TupleNode *) malloc(sizeof(TupleNode) +
+								   (result_cols - 1) *sizeof(TupleField));
 
-		/*	Some Notes about Postgres Data Types:
 
-			VARCHAR - the length is stored in the pg_attribute.atttypmod field
-			BPCHAR  - the length is also stored as varchar is
-
-			NUMERIC - the scale is stored in atttypmod as follows:
-					precision = ((atttypmod - VARHDRSZ) >> 16) & 0xffff
-					scale     = (atttypmod - VARHDRSZ) & 0xffff
-
-
-		*/
+		set_tuplefield_string(&row->tuple[0], "");
+		/* see note in SQLTables() */
+		/* set_tuplefield_string(&row->tuple[1], table_owner); */
+		set_tuplefield_string(&row->tuple[1], "");
+		set_tuplefield_string(&row->tuple[2], table_name);
+		set_tuplefield_string(&row->tuple[3], field_name);
+		set_tuplefield_int2(&row->tuple[4], pgtype_to_sqltype(stmt, field_type));
+		set_tuplefield_string(&row->tuple[5], field_type_name);
+
+
+		/*
+		 * Some Notes about Postgres Data Types:
+		 *
+		 * VARCHAR - the length is stored in the pg_attribute.atttypmod field
+		 * BPCHAR  - the length is also stored as varchar is
+		 *
+		 * NUMERIC - the scale is stored in atttypmod as follows: precision =
+		 * ((atttypmod - VARHDRSZ) >> 16) & 0xffff scale	 = (atttypmod
+		 * - VARHDRSZ) & 0xffff
+		 *
+		 *
+		 */
 		qlog("SQLColumns: table='%s',field_name='%s',type=%d,sqltype=%d,name='%s'\n",
-			table_name,field_name,field_type,pgtype_to_sqltype,field_type_name);
+			 table_name, field_name, field_type, pgtype_to_sqltype, field_type_name);
 
 		useStaticPrecision = TRUE;
 
-		if (field_type == PG_TYPE_NUMERIC) {
+		if (field_type == PG_TYPE_NUMERIC)
+		{
 			if (mod_length >= 4)
-				mod_length -= 4;			/* the length is in atttypmod - 4 */
+				mod_length -= 4;/* the length is in atttypmod - 4 */
 
-			if (mod_length >= 0) {
+			if (mod_length >= 0)
+			{
 				useStaticPrecision = FALSE;
 
 				precision = (mod_length >> 16) & 0xffff;
 				scale = mod_length & 0xffff;
 
-				mylog("SQLColumns: field type is NUMERIC: field_type = %d, mod_length=%d, precision=%d, scale=%d\n", field_type, mod_length, precision, scale );
+				mylog("SQLColumns: field type is NUMERIC: field_type = %d, mod_length=%d, precision=%d, scale=%d\n", field_type, mod_length, precision, scale);
 
-				set_tuplefield_int4(&row->tuple[7], precision + 2);  /* sign+dec.point */
+				set_tuplefield_int4(&row->tuple[7], precision + 2);		/* sign+dec.point */
 				set_tuplefield_int4(&row->tuple[6], precision);
-				set_tuplefield_int4(&row->tuple[12], precision + 2); /* sign+dec.point */
+				set_tuplefield_int4(&row->tuple[12], precision + 2);	/* sign+dec.point */
 				set_nullfield_int2(&row->tuple[8], scale);
 			}
 		}
 
 
-        if((field_type == PG_TYPE_VARCHAR) ||
-		   (field_type == PG_TYPE_BPCHAR)) {
+		if ((field_type == PG_TYPE_VARCHAR) ||
+			(field_type == PG_TYPE_BPCHAR))
+		{
 
 			useStaticPrecision = FALSE;
 
 			if (mod_length >= 4)
-				mod_length -= 4;			/* the length is in atttypmod - 4 */
+				mod_length -= 4;/* the length is in atttypmod - 4 */
 
 			if (mod_length > globals.max_varchar_size || mod_length <= 0)
 				mod_length = globals.max_varchar_size;
@@ -1531,44 +1795,47 @@ ConnectionClass *conn;
 			set_tuplefield_int4(&row->tuple[6], mod_length);
 			set_tuplefield_int4(&row->tuple[12], mod_length);
 			set_nullfield_int2(&row->tuple[8], pgtype_scale(stmt, field_type, PG_STATIC));
-        } 
-		
-		if (useStaticPrecision) {
+		}
+
+		if (useStaticPrecision)
+		{
 			mylog("SQLColumns: field type is OTHER: field_type = %d, pgtype_length = %d\n", field_type, pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
 
-            set_tuplefield_int4(&row->tuple[7], pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
+			set_tuplefield_int4(&row->tuple[7], pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_tuplefield_int4(&row->tuple[6], pgtype_precision(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_tuplefield_int4(&row->tuple[12], pgtype_display_size(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_nullfield_int2(&row->tuple[8], pgtype_scale(stmt, field_type, PG_STATIC));
-        }
+		}
 
 		set_nullfield_int2(&row->tuple[9], pgtype_radix(stmt, field_type));
 		set_tuplefield_int2(&row->tuple[10], (Int2) (not_null[0] == '1' ? SQL_NO_NULLS : pgtype_nullable(stmt, field_type)));
 		set_tuplefield_string(&row->tuple[11], "");
 		set_tuplefield_int4(&row->tuple[13], field_type);
 
-        QR_add_tuple(stmt->result, row);
+		QR_add_tuple(stmt->result, row);
 
 
-        result = SQLFetch(hcol_stmt);
+		result = SQLFetch(hcol_stmt);
 
-    }
-    if(result != SQL_NO_DATA_FOUND) {
+	}
+	if (result != SQL_NO_DATA_FOUND)
+	{
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-	/*	Put the row version column at the end so it might not be */
-	/*	mistaken for a key field. */
-	if ( relhasrules[0] != '1' && ! stmt->internal && atoi(ci->row_versioning)) {
-		/*	For Row Versioning fields */
+	/* Put the row version column at the end so it might not be */
+	/* mistaken for a key field. */
+	if (relhasrules[0] != '1' && !stmt->internal && atoi(ci->row_versioning))
+	{
+		/* For Row Versioning fields */
 		the_type = PG_TYPE_INT4;
 
-		row = (TupleNode *)malloc(sizeof(TupleNode) +
-								  (result_cols - 1) * sizeof(TupleField));
+		row = (TupleNode *) malloc(sizeof(TupleNode) +
+								   (result_cols - 1) *sizeof(TupleField));
 
 		set_tuplefield_string(&row->tuple[0], "");
 		set_tuplefield_string(&row->tuple[1], "");
@@ -1590,115 +1857,122 @@ ConnectionClass *conn;
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-    stmt->status = STMT_FINISHED;
+	stmt->status = STMT_FINISHED;
 
-    /* set up the current tuple pointer for SQLFetch */
-    stmt->currTuple = -1;
+	/* set up the current tuple pointer for SQLFetch */
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 	mylog("SQLColumns(): EXIT,  stmt=%u\n", stmt);
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
-RETCODE SQL_API SQLSpecialColumns(
-                                  HSTMT        hstmt,
-                                  UWORD        fColType,
-                                  UCHAR FAR *  szTableQualifier,
-                                  SWORD        cbTableQualifier,
-                                  UCHAR FAR *  szTableOwner,
-                                  SWORD        cbTableOwner,
-                                  UCHAR FAR *  szTableName,
-                                  SWORD        cbTableName,
-                                  UWORD        fScope,
-                                  UWORD        fNullable)
+RETCODE SQL_API
+SQLSpecialColumns(
+				  HSTMT hstmt,
+				  UWORD fColType,
+				  UCHAR FAR *szTableQualifier,
+				  SWORD cbTableQualifier,
+				  UCHAR FAR *szTableOwner,
+				  SWORD cbTableOwner,
+				  UCHAR FAR *szTableName,
+				  SWORD cbTableName,
+				  UWORD fScope,
+				  UWORD fNullable)
 {
-static char *func = "SQLSpecialColumns";
-TupleNode *row;
-StatementClass *stmt = (StatementClass *) hstmt;
-ConnInfo *ci;
-HSTMT hcol_stmt;
-StatementClass *col_stmt;
-char columns_query[STD_STATEMENT_LEN];
-RETCODE result;
-char relhasrules[MAX_INFO_STRING];
+	static char *func = "SQLSpecialColumns";
+	TupleNode  *row;
+	StatementClass *stmt = (StatementClass *) hstmt;
+	ConnInfo   *ci;
+	HSTMT		hcol_stmt;
+	StatementClass *col_stmt;
+	char		columns_query[STD_STATEMENT_LEN];
+	RETCODE		result;
+	char		relhasrules[MAX_INFO_STRING];
 
 
 
-mylog("%s: entering...stmt=%u\n", func, stmt);
+	mylog("%s: entering...stmt=%u\n", func, stmt);
 
-    if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
-    }
+		return SQL_INVALID_HANDLE;
+	}
 	ci = &stmt->hdbc->connInfo;
 
 	stmt->manual_result = TRUE;
 
 
 	/* ********************************************************************** */
-	/*	Create the query to find out if this is a view or not... */
+	/* Create the query to find out if this is a view or not... */
 	/* ********************************************************************** */
 	sprintf(columns_query, "select c.relhasrules "
-		"from pg_user u, pg_class c where "
-		"u.usesysid = c.relowner");
+			"from pg_user u, pg_class c where "
+			"u.usesysid = c.relowner");
 
 	my_strcat(columns_query, " and c.relname like '%.*s'", szTableName, cbTableName);
 	my_strcat(columns_query, " and u.usename like '%.*s'", szTableOwner, cbTableOwner);
 
 
-    result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLSpecialColumns result.";
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 	col_stmt = (StatementClass *) hcol_stmt;
 
 	mylog("SQLSpecialColumns: hcol_stmt = %u, col_stmt = %u\n", hcol_stmt, col_stmt);
 
-    result = SQLExecDirect(hcol_stmt, columns_query,
-                           strlen(columns_query));
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLExecDirect(hcol_stmt, columns_query,
+						   strlen(columns_query));
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
-                        relhasrules, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
+						relhasrules, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	result = SQLFetch(hcol_stmt);
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 
-    stmt->result = QR_Constructor();
-    extend_bindings(stmt, 8);
-
-    QR_set_num_fields(stmt->result, 8);
-    QR_set_field_info(stmt->result, 0, "SCOPE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 1, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 2, "DATA_TYPE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 3, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 4, "PRECISION", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 5, "LENGTH", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 6, "SCALE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 7, "PSEUDO_COLUMN", PG_TYPE_INT2, 2);
-
-    if ( relhasrules[0] != '1' ) {
+	stmt->result = QR_Constructor();
+	extend_bindings(stmt, 8);
+
+	QR_set_num_fields(stmt->result, 8);
+	QR_set_field_info(stmt->result, 0, "SCOPE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 1, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 2, "DATA_TYPE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 3, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 4, "PRECISION", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 5, "LENGTH", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 6, "SCALE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 7, "PSEUDO_COLUMN", PG_TYPE_INT2, 2);
+
+	if (relhasrules[0] != '1')
+	{
 		/* use the oid value for the rowid */
-		if(fColType == SQL_BEST_ROWID) {
-			row = (TupleNode *)malloc(sizeof(TupleNode) + (8 - 1) * sizeof(TupleField));
+		if (fColType == SQL_BEST_ROWID)
+		{
+			row = (TupleNode *) malloc(sizeof(TupleNode) + (8 - 1) *sizeof(TupleField));
 
 			set_tuplefield_int2(&row->tuple[0], SQL_SCOPE_SESSION);
 			set_tuplefield_string(&row->tuple[1], "oid");
@@ -1711,12 +1985,15 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 			QR_add_tuple(stmt->result, row);
 
-		} else if(fColType == SQL_ROWVER) {
+		}
+		else if (fColType == SQL_ROWVER)
+		{
 
-			Int2 the_type = PG_TYPE_INT4;
+			Int2		the_type = PG_TYPE_INT4;
 
-			if (atoi(ci->row_versioning)) {
-				row = (TupleNode *)malloc(sizeof(TupleNode) + (8 - 1) * sizeof(TupleField));
+			if (atoi(ci->row_versioning))
+			{
+				row = (TupleNode *) malloc(sizeof(TupleNode) + (8 - 1) *sizeof(TupleField));
 
 				set_tuplefield_null(&row->tuple[0]);
 				set_tuplefield_string(&row->tuple[1], "xmin");
@@ -1734,103 +2011,116 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 
 
-    stmt->status = STMT_FINISHED;
-    stmt->currTuple = -1;
+	stmt->status = STMT_FINISHED;
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	mylog("SQLSpecialColumns(): EXIT,  stmt=%u\n", stmt);
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
-RETCODE SQL_API SQLStatistics(
-                              HSTMT         hstmt,
-                              UCHAR FAR *   szTableQualifier,
-                              SWORD         cbTableQualifier,
-                              UCHAR FAR *   szTableOwner,
-                              SWORD         cbTableOwner,
-                              UCHAR FAR *   szTableName,
-                              SWORD         cbTableName,
-                              UWORD         fUnique,
-                              UWORD         fAccuracy)
+RETCODE SQL_API
+SQLStatistics(
+			  HSTMT hstmt,
+			  UCHAR FAR *szTableQualifier,
+			  SWORD cbTableQualifier,
+			  UCHAR FAR *szTableOwner,
+			  SWORD cbTableOwner,
+			  UCHAR FAR *szTableName,
+			  SWORD cbTableName,
+			  UWORD fUnique,
+			  UWORD fAccuracy)
 {
-static char *func="SQLStatistics";
-StatementClass *stmt = (StatementClass *) hstmt;
-char index_query[STD_STATEMENT_LEN];
-HSTMT hindx_stmt;
-RETCODE result;
-char *table_name;
-char index_name[MAX_INFO_STRING];
-short fields_vector[16];
-char isunique[10], isclustered[10];
-SDWORD index_name_len, fields_vector_len;
-TupleNode *row;
-int i;
-HSTMT hcol_stmt;
-StatementClass *col_stmt, *indx_stmt;
-char column_name[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
-char **column_names = 0;
-Int4 column_name_len;
-int total_columns = 0;
-char error = TRUE;
-ConnInfo *ci;
-char buf[256];
-
-mylog("%s: entering...stmt=%u\n", func, stmt);
-
-    if( ! stmt) {
+	static char *func = "SQLStatistics";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	char		index_query[STD_STATEMENT_LEN];
+	HSTMT		hindx_stmt;
+	RETCODE		result;
+	char	   *table_name;
+	char		index_name[MAX_INFO_STRING];
+	short		fields_vector[16];
+	char		isunique[10],
+				isclustered[10];
+	SDWORD		index_name_len,
+				fields_vector_len;
+	TupleNode  *row;
+	int			i;
+	HSTMT		hcol_stmt;
+	StatementClass *col_stmt,
+			   *indx_stmt;
+	char		column_name[MAX_INFO_STRING],
+				relhasrules[MAX_INFO_STRING];
+	char	  **column_names = 0;
+	Int4		column_name_len;
+	int			total_columns = 0;
+	char		error = TRUE;
+	ConnInfo   *ci;
+	char		buf[256];
+
+	mylog("%s: entering...stmt=%u\n", func, stmt);
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
-    }
+		return SQL_INVALID_HANDLE;
+	}
 
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
 	ci = &stmt->hdbc->connInfo;
 
-    stmt->result = QR_Constructor();
-    if(!stmt->result) {
-        stmt->errormsg = "Couldn't allocate memory for SQLStatistics result.";
-        stmt->errornumber = STMT_NO_MEMORY_ERROR;
+	stmt->result = QR_Constructor();
+	if (!stmt->result)
+	{
+		stmt->errormsg = "Couldn't allocate memory for SQLStatistics result.";
+		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
-
-    /* the binding structure for a statement is not set up until */
-    /* a statement is actually executed, so we'll have to do this ourselves. */
-    extend_bindings(stmt, 13);
-
-    /* set the field names */
-    QR_set_num_fields(stmt->result, 13);
-    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 3, "NON_UNIQUE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 4, "INDEX_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 5, "INDEX_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 6, "TYPE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 7, "SEQ_IN_INDEX", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 8, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 9, "COLLATION", PG_TYPE_CHAR, 1);
-    QR_set_field_info(stmt->result, 10, "CARDINALITY", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 11, "PAGES", PG_TYPE_INT4, 4);
-    QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
-
-
-    /* only use the table name... the owner should be redundant, and */
-    /* we never use qualifiers. */
+		return SQL_ERROR;
+	}
+
+	/* the binding structure for a statement is not set up until */
+
+	/*
+	 * a statement is actually executed, so we'll have to do this
+	 * ourselves.
+	 */
+	extend_bindings(stmt, 13);
+
+	/* set the field names */
+	QR_set_num_fields(stmt->result, 13);
+	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 3, "NON_UNIQUE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 4, "INDEX_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 5, "INDEX_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 6, "TYPE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 7, "SEQ_IN_INDEX", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 8, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 9, "COLLATION", PG_TYPE_CHAR, 1);
+	QR_set_field_info(stmt->result, 10, "CARDINALITY", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 11, "PAGES", PG_TYPE_INT4, 4);
+	QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
+
+
+	/* only use the table name... the owner should be redundant, and */
+	/* we never use qualifiers. */
 	table_name = make_string(szTableName, cbTableName, NULL);
-	if ( ! table_name) {
-        stmt->errormsg = "No table name passed to SQLStatistics.";
-        stmt->errornumber = STMT_INTERNAL_ERROR;
+	if (!table_name)
+	{
+		stmt->errormsg = "No table name passed to SQLStatistics.";
+		stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	/* we need to get a list of the field names first, */
 	/* so we can return them later. */
-	result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for columns.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		goto SEEYA;
@@ -1838,23 +2128,27 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 	col_stmt = (StatementClass *) hcol_stmt;
 
-	/*	"internal" prevents SQLColumns from returning the oid if it is being shown.
-		This would throw everything off.
-	*/
+	/*
+	 * "internal" prevents SQLColumns from returning the oid if it is
+	 * being shown. This would throw everything off.
+	 */
 	col_stmt->internal = TRUE;
-	result = SQLColumns(hcol_stmt, "", 0, "", 0, 
-				table_name, (SWORD) strlen(table_name), "", 0);
+	result = SQLColumns(hcol_stmt, "", 0, "", 0,
+						table_name, (SWORD) strlen(table_name), "", 0);
 	col_stmt->internal = FALSE;
 
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-			stmt->errormsg = col_stmt->errormsg;        /* "SQLColumns failed in SQLStatistics."; */
-			stmt->errornumber = col_stmt->errornumber;  /* STMT_EXEC_ERROR; */
-			SQLFreeStmt(hcol_stmt, SQL_DROP);
-			goto SEEYA;
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = col_stmt->errormsg;	/* "SQLColumns failed in
+												 * SQLStatistics."; */
+		stmt->errornumber = col_stmt->errornumber;		/* STMT_EXEC_ERROR; */
+		SQLFreeStmt(hcol_stmt, SQL_DROP);
+		goto SEEYA;
 	}
 	result = SQLBindCol(hcol_stmt, 4, SQL_C_CHAR,
-				column_name, MAX_INFO_STRING, &column_name_len);
-	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+						column_name, MAX_INFO_STRING, &column_name_len);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
@@ -1863,38 +2157,43 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 	}
 
 	result = SQLFetch(hcol_stmt);
-	while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
+	{
 		total_columns++;
 
-		column_names = 
-		(char **)realloc(column_names, 
-				 total_columns * sizeof(char *));
-		column_names[total_columns-1] = 
-		(char *)malloc(strlen(column_name)+1);
-		strcpy(column_names[total_columns-1], column_name);
+		column_names =
+			(char **) realloc(column_names,
+							  total_columns * sizeof(char *));
+		column_names[total_columns - 1] =
+			(char *) malloc(strlen(column_name) + 1);
+		strcpy(column_names[total_columns - 1], column_name);
 
 		mylog("SQLStatistics: column_name = '%s'\n", column_name);
 
 		result = SQLFetch(hcol_stmt);
 	}
-	if(result != SQL_NO_DATA_FOUND || total_columns == 0) {
-			stmt->errormsg = SC_create_errormsg(hcol_stmt); /* "Couldn't get column names in SQLStatistics."; */
-			stmt->errornumber = col_stmt->errornumber;
-			SQLFreeStmt(hcol_stmt, SQL_DROP);
-   			goto SEEYA;
+	if (result != SQL_NO_DATA_FOUND || total_columns == 0)
+	{
+		stmt->errormsg = SC_create_errormsg(hcol_stmt); /* "Couldn't get column
+														 * names in
+														 * SQLStatistics."; */
+		stmt->errornumber = col_stmt->errornumber;
+		SQLFreeStmt(hcol_stmt, SQL_DROP);
+		goto SEEYA;
 
 	}
-	
+
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 
 	/* get a list of indexes on this table */
-    result = SQLAllocStmt( stmt->hdbc, &hindx_stmt);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &hindx_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for indices.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		goto SEEYA;
 
-    }
+	}
 	indx_stmt = (StatementClass *) hindx_stmt;
 
 	sprintf(index_query, "select c.relname, i.indkey, i.indisunique"
@@ -1903,69 +2202,83 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 			" where c.oid = i.indexrelid and d.relname = '%s'"
 			" and d.oid = i.indrelid", table_name);
 
-    result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-		stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "Couldn't execute index query (w/SQLExecDirect) in SQLStatistics."; */
+	result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = SC_create_errormsg(hindx_stmt);		/* "Couldn't execute
+																 * index query
+																 * (w/SQLExecDirect) in
+																 * SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-  		goto SEEYA;
+		goto SEEYA;
 
-    }
+	}
 
-    /* bind the index name column */
-    result = SQLBindCol(hindx_stmt, 1, SQL_C_CHAR,
-                        index_name, MAX_INFO_STRING, &index_name_len);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-		stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
+	/* bind the index name column */
+	result = SQLBindCol(hindx_stmt, 1, SQL_C_CHAR,
+						index_name, MAX_INFO_STRING, &index_name_len);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
+												 * in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-   		goto SEEYA;
-
-    }
-    /* bind the vector column */
-    result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
-                        fields_vector, 32, &fields_vector_len);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
+		goto SEEYA;
+
+	}
+	/* bind the vector column */
+	result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
+						fields_vector, 32, &fields_vector_len);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
+												 * in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
 
-    }
-    /* bind the "is unique" column */
-    result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
-                        isunique, sizeof(isunique), NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
+	}
+	/* bind the "is unique" column */
+	result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
+						isunique, sizeof(isunique), NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
+												 * in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-    }
+	}
 
-    /* bind the "is clustered" column */
-    result = SQLBindCol(hindx_stmt, 4, SQL_C_CHAR,
-                        isclustered, sizeof(isclustered), NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
-		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
+	/* bind the "is clustered" column */
+	result = SQLBindCol(hindx_stmt, 4, SQL_C_CHAR,
+						isclustered, sizeof(isclustered), NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
+		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
+												 * in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
 
-    }
+	}
 
-    result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR,
-                        relhasrules, MAX_INFO_STRING, NULL);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR,
+						relhasrules, MAX_INFO_STRING, NULL);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = indx_stmt->errormsg;
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-        goto SEEYA;
-    }
+		goto SEEYA;
+	}
 
-	/*	fake index of OID */
-	if ( relhasrules[0] != '1' && atoi(ci->show_oid_column) && atoi(ci->fake_oid_index)) {
-		row = (TupleNode *)malloc(sizeof(TupleNode) + 
-					  (13 - 1) * sizeof(TupleField));
+	/* fake index of OID */
+	if (relhasrules[0] != '1' && atoi(ci->show_oid_column) && atoi(ci->fake_oid_index))
+	{
+		row = (TupleNode *) malloc(sizeof(TupleNode) +
+								   (13 - 1) *sizeof(TupleField));
 
 		/* no table qualifier */
 		set_tuplefield_string(&row->tuple[0], "");
@@ -1975,14 +2288,17 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 
 		/* non-unique index? */
 		set_tuplefield_int2(&row->tuple[3], (Int2) (globals.unique_index ? FALSE : TRUE));
-		
+
 		/* no index qualifier */
 		set_tuplefield_string(&row->tuple[4], "");
 
 		sprintf(buf, "%s_idx_fake_oid", table_name);
 		set_tuplefield_string(&row->tuple[5], buf);
 
-		/* Clustered index?  I think non-clustered should be type OTHER not HASHED */
+		/*
+		 * Clustered index?  I think non-clustered should be type OTHER
+		 * not HASHED
+		 */
 		set_tuplefield_int2(&row->tuple[6], (Int2) SQL_INDEX_OTHER);
 		set_tuplefield_int2(&row->tuple[7], (Int2) 1);
 
@@ -1995,18 +2311,21 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 		QR_add_tuple(stmt->result, row);
 	}
 
-    result = SQLFetch(hindx_stmt);
-    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+	result = SQLFetch(hindx_stmt);
+	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
+	{
 
-      /*	If only requesting unique indexs, then just return those. */
-		if (fUnique == SQL_INDEX_ALL || 
-			(fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) {
+		/* If only requesting unique indexs, then just return those. */
+		if (fUnique == SQL_INDEX_ALL ||
+			(fUnique == SQL_INDEX_UNIQUE && atoi(isunique)))
+		{
 			i = 0;
 			/* add a row in this table for each field in the index */
-			while(i < 16 && fields_vector[i] != 0) {
+			while (i < 16 && fields_vector[i] != 0)
+			{
 
-				row = (TupleNode *)malloc(sizeof(TupleNode) + 
-							  (13 - 1) * sizeof(TupleField));
+				row = (TupleNode *) malloc(sizeof(TupleNode) +
+										   (13 - 1) *sizeof(TupleField));
 
 				/* no table qualifier */
 				set_tuplefield_string(&row->tuple[0], "");
@@ -2019,26 +2338,32 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 					set_tuplefield_int2(&row->tuple[3], (Int2) (atoi(isunique) ? FALSE : TRUE));
 				else
 					set_tuplefield_int2(&row->tuple[3], TRUE);
-				
+
 				/* no index qualifier */
 				set_tuplefield_string(&row->tuple[4], "");
 				set_tuplefield_string(&row->tuple[5], index_name);
 
-				/* Clustered index?  I think non-clustered should be type OTHER not HASHED */
+				/*
+				 * Clustered index?  I think non-clustered should be type
+				 * OTHER not HASHED
+				 */
 				set_tuplefield_int2(&row->tuple[6], (Int2) (atoi(isclustered) ? SQL_INDEX_CLUSTERED : SQL_INDEX_OTHER));
-				set_tuplefield_int2(&row->tuple[7], (Int2) (i+1));
+				set_tuplefield_int2(&row->tuple[7], (Int2) (i + 1));
 
-				if(fields_vector[i] == OID_ATTNUM) {
+				if (fields_vector[i] == OID_ATTNUM)
+				{
 					set_tuplefield_string(&row->tuple[8], "oid");
 					mylog("SQLStatistics: column name = oid\n");
 				}
-				else if(fields_vector[i] < 0 || fields_vector[i] > total_columns) {
+				else if (fields_vector[i] < 0 || fields_vector[i] > total_columns)
+				{
 					set_tuplefield_string(&row->tuple[8], "UNKNOWN");
 					mylog("SQLStatistics: column name = UNKNOWN\n");
 				}
-				else {
-					set_tuplefield_string(&row->tuple[8], column_names[fields_vector[i]-1]);
-					mylog("SQLStatistics: column name = '%s'\n", column_names[fields_vector[i]-1]);
+				else
+				{
+					set_tuplefield_string(&row->tuple[8], column_names[fields_vector[i] - 1]);
+					mylog("SQLStatistics: column name = '%s'\n", column_names[fields_vector[i] - 1]);
 				}
 
 				set_tuplefield_string(&row->tuple[9], "A");
@@ -2051,23 +2376,25 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 			}
 		}
 
-        result = SQLFetch(hindx_stmt);
-    }
-    if(result != SQL_NO_DATA_FOUND) {
-		stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "SQLFetch failed in SQLStatistics."; */
+		result = SQLFetch(hindx_stmt);
+	}
+	if (result != SQL_NO_DATA_FOUND)
+	{
+		stmt->errormsg = SC_create_errormsg(hindx_stmt);		/* "SQLFetch failed in
+																 * SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-    }
+	}
 
 	SQLFreeStmt(hindx_stmt, SQL_DROP);
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-    stmt->status = STMT_FINISHED;
+	stmt->status = STMT_FINISHED;
 
-    /* set up the current tuple pointer for SQLFetch */
-    stmt->currTuple = -1;
+	/* set up the current tuple pointer for SQLFetch */
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
@@ -2076,14 +2403,14 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
 SEEYA:
 	/* These things should be freed on any error ALSO! */
 	free(table_name);
-    for(i = 0; i < total_columns; i++) {
+	for (i = 0; i < total_columns; i++)
 		free(column_names[i]);
-    }
-    free(column_names);
+	free(column_names);
 
 	mylog("SQLStatistics(): EXIT, %s, stmt=%u\n", error ? "error" : "success", stmt);
 
-	if (error) {
+	if (error)
+	{
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
@@ -2091,99 +2418,109 @@ SEEYA:
 		return SQL_SUCCESS;
 }
 
-RETCODE SQL_API SQLColumnPrivileges(
-                                    HSTMT        hstmt,
-                                    UCHAR FAR *  szTableQualifier,
-                                    SWORD        cbTableQualifier,
-                                    UCHAR FAR *  szTableOwner,
-                                    SWORD        cbTableOwner,
-                                    UCHAR FAR *  szTableName,
-                                    SWORD        cbTableName,
-                                    UCHAR FAR *  szColumnName,
-                                    SWORD        cbColumnName)
+RETCODE SQL_API
+SQLColumnPrivileges(
+					HSTMT hstmt,
+					UCHAR FAR *szTableQualifier,
+					SWORD cbTableQualifier,
+					UCHAR FAR *szTableOwner,
+					SWORD cbTableOwner,
+					UCHAR FAR *szTableName,
+					SWORD cbTableName,
+					UCHAR FAR *szColumnName,
+					SWORD cbColumnName)
 {
-static char *func="SQLColumnPrivileges";
+	static char *func = "SQLColumnPrivileges";
 
 	mylog("%s: entering...\n", func);
 
 /*	Neither Access or Borland care about this. */
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-    return SQL_ERROR;
+	return SQL_ERROR;
 }
 
 
 /* SQLPrimaryKeys()
  * Retrieve the primary key columns for the specified table.
  */
-RETCODE SQL_API SQLPrimaryKeys(
-                               HSTMT         hstmt,
-                               UCHAR FAR *   szTableQualifier,
-                               SWORD         cbTableQualifier,
-                               UCHAR FAR *   szTableOwner,
-                               SWORD         cbTableOwner,
-                               UCHAR FAR *   szTableName,
-                               SWORD         cbTableName)
+RETCODE SQL_API
+SQLPrimaryKeys(
+			   HSTMT hstmt,
+			   UCHAR FAR *szTableQualifier,
+			   SWORD cbTableQualifier,
+			   UCHAR FAR *szTableOwner,
+			   SWORD cbTableOwner,
+			   UCHAR FAR *szTableName,
+			   SWORD cbTableName)
 {
-static char *func = "SQLPrimaryKeys";
-StatementClass *stmt = (StatementClass *) hstmt;
-TupleNode *row;
-RETCODE result;
-int seq = 0;
-HSTMT htbl_stmt;
-StatementClass *tbl_stmt;
-char tables_query[STD_STATEMENT_LEN];
-char attname[MAX_INFO_STRING];
-SDWORD attname_len;
-char pktab[MAX_TABLE_LEN + 1];
-Int2 result_cols;
+	static char *func = "SQLPrimaryKeys";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	TupleNode  *row;
+	RETCODE		result;
+	int			seq = 0;
+	HSTMT		htbl_stmt;
+	StatementClass *tbl_stmt;
+	char		tables_query[STD_STATEMENT_LEN];
+	char		attname[MAX_INFO_STRING];
+	SDWORD		attname_len;
+	char		pktab[MAX_TABLE_LEN + 1];
+	Int2		result_cols;
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
-    if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
-    }
+		return SQL_INVALID_HANDLE;
+	}
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
-    stmt->result = QR_Constructor();
-    if(!stmt->result) {
-        stmt->errormsg = "Couldn't allocate memory for SQLPrimaryKeys result.";
-        stmt->errornumber = STMT_NO_MEMORY_ERROR;
+	stmt->result = QR_Constructor();
+	if (!stmt->result)
+	{
+		stmt->errormsg = "Couldn't allocate memory for SQLPrimaryKeys result.";
+		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
+
+	/* the binding structure for a statement is not set up until */
 
-    /* the binding structure for a statement is not set up until */
-    /* a statement is actually executed, so we'll have to do this ourselves. */
+	/*
+	 * a statement is actually executed, so we'll have to do this
+	 * ourselves.
+	 */
 	result_cols = 6;
-    extend_bindings(stmt, result_cols);
-	
-    /* set the field names */
-    QR_set_num_fields(stmt->result, result_cols);
-    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 4, "KEY_SEQ", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 5, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-
-
-    result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	extend_bindings(stmt, result_cols);
+
+	/* set the field names */
+	QR_set_num_fields(stmt->result, result_cols);
+	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 4, "KEY_SEQ", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 5, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+
+
+	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for Primary Key result.";
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
 	pktab[0] = '\0';
 	make_string(szTableName, cbTableName, pktab);
-	if ( pktab[0] == '\0') {
+	if (pktab[0] == '\0')
+	{
 		stmt->errormsg = "No Table specified to SQLPrimaryKeys.";
-	    stmt->errornumber = STMT_INTERNAL_ERROR;
+		stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
 		return SQL_ERROR;
@@ -2192,12 +2529,13 @@ Int2 result_cols;
 #if 0
 	sprintf(tables_query, "select distinct on (attnum) a2.attname, a2.attnum from pg_attribute a1, pg_attribute a2, pg_class c, pg_index i where c.relname = '%s_pkey' AND c.oid = i.indexrelid AND a1.attrelid = c.oid AND a2.attrelid = c.oid AND (i.indkey[0] = a1.attnum OR i.indkey[1] = a1.attnum OR i.indkey[2] = a1.attnum OR i.indkey[3] = a1.attnum OR i.indkey[4] = a1.attnum OR i.indkey[5] = a1.attnum OR i.indkey[6] = a1.attnum OR i.indkey[7] = a1.attnum) order by a2.attnum", pktab);
 #else
-	/* Simplified query to remove assumptions about
-	 * number of possible index columns.
-	 * Courtesy of Tom Lane - thomas 2000-03-21
+
+	/*
+	 * Simplified query to remove assumptions about number of possible
+	 * index columns. Courtesy of Tom Lane - thomas 2000-03-21
 	 */
 	sprintf(tables_query, "select ta.attname, ia.attnum"
-			" from pg_attribute ta, pg_attribute ia, pg_class c, pg_index i"
+		 " from pg_attribute ta, pg_attribute ia, pg_class c, pg_index i"
 			" where c.relname = '%s_pkey'"
 			" AND c.oid = i.indexrelid"
 			" AND ia.attrelid = i.indexrelid"
@@ -2209,174 +2547,200 @@ Int2 result_cols;
 
 	mylog("SQLPrimaryKeys: tables_query='%s'\n", tables_query);
 
-    result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
-                        attname, MAX_INFO_STRING, &attname_len);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
+						attname, MAX_INFO_STRING, &attname_len);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    result = SQLFetch(htbl_stmt);
+	result = SQLFetch(htbl_stmt);
 
-    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
+	{
 
-        row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
+		row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
 
-        set_tuplefield_null(&row->tuple[0]);
+		set_tuplefield_null(&row->tuple[0]);
 
-		/* I have to hide the table owner from Access, otherwise it
-		 * insists on referring to the table as 'owner.table'.
-		 * (this is valid according to the ODBC SQL grammar, but
-		 * Postgres won't support it.)
+		/*
+		 * I have to hide the table owner from Access, otherwise it
+		 * insists on referring to the table as 'owner.table'. (this is
+		 * valid according to the ODBC SQL grammar, but Postgres won't
+		 * support it.)
 		 */
-        set_tuplefield_string(&row->tuple[1], "");
-        set_tuplefield_string(&row->tuple[2], pktab);
-        set_tuplefield_string(&row->tuple[3], attname);
+		set_tuplefield_string(&row->tuple[1], "");
+		set_tuplefield_string(&row->tuple[2], pktab);
+		set_tuplefield_string(&row->tuple[3], attname);
 		set_tuplefield_int2(&row->tuple[4], (Int2) (++seq));
 		set_tuplefield_null(&row->tuple[5]);
 
-        QR_add_tuple(stmt->result, row);
+		QR_add_tuple(stmt->result, row);
 
 		mylog(">> primaryKeys: pktab = '%s', attname = '%s', seq = %d\n", pktab, attname, seq);
 
-        result = SQLFetch(htbl_stmt);
-    }
+		result = SQLFetch(htbl_stmt);
+	}
 
-    if(result != SQL_NO_DATA_FOUND) {
+	if (result != SQL_NO_DATA_FOUND)
+	{
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	SQLFreeStmt(htbl_stmt, SQL_DROP);
 
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-    stmt->status = STMT_FINISHED;
+	stmt->status = STMT_FINISHED;
 
-    /* set up the current tuple pointer for SQLFetch */
-    stmt->currTuple = -1;
+	/* set up the current tuple pointer for SQLFetch */
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	mylog("SQLPrimaryKeys(): EXIT, stmt=%u\n", stmt);
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
-RETCODE SQL_API SQLForeignKeys(
-                               HSTMT         hstmt,
-                               UCHAR FAR *   szPkTableQualifier,
-                               SWORD         cbPkTableQualifier,
-                               UCHAR FAR *   szPkTableOwner,
-                               SWORD         cbPkTableOwner,
-                               UCHAR FAR *   szPkTableName,
-                               SWORD         cbPkTableName,
-                               UCHAR FAR *   szFkTableQualifier,
-                               SWORD         cbFkTableQualifier,
-                               UCHAR FAR *   szFkTableOwner,
-                               SWORD         cbFkTableOwner,
-                               UCHAR FAR *   szFkTableName,
-                               SWORD         cbFkTableName)
+RETCODE SQL_API
+SQLForeignKeys(
+			   HSTMT hstmt,
+			   UCHAR FAR *szPkTableQualifier,
+			   SWORD cbPkTableQualifier,
+			   UCHAR FAR *szPkTableOwner,
+			   SWORD cbPkTableOwner,
+			   UCHAR FAR *szPkTableName,
+			   SWORD cbPkTableName,
+			   UCHAR FAR *szFkTableQualifier,
+			   SWORD cbFkTableQualifier,
+			   UCHAR FAR *szFkTableOwner,
+			   SWORD cbFkTableOwner,
+			   UCHAR FAR *szFkTableName,
+			   SWORD cbFkTableName)
 {
-static char *func = "SQLForeignKeys";
-StatementClass *stmt = (StatementClass *) hstmt;
-TupleNode *row;
-HSTMT htbl_stmt, hpkey_stmt;
-StatementClass *tbl_stmt;
-RETCODE result, keyresult;
-char tables_query[STD_STATEMENT_LEN];
-char trig_deferrable[2];
-char trig_initdeferred[2];
-char trig_args[1024];
-char upd_rule[MAX_TABLE_LEN], del_rule[MAX_TABLE_LEN];
-char pk_table_needed[MAX_TABLE_LEN + 1];
-char fk_table_needed[MAX_TABLE_LEN + 1];
-char *pkey_ptr, *fkey_ptr, *pk_table, *fk_table;
-int i, j, k, num_keys;
-SWORD trig_nargs, upd_rule_type=0, del_rule_type=0;
+	static char *func = "SQLForeignKeys";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	TupleNode  *row;
+	HSTMT		htbl_stmt,
+				hpkey_stmt;
+	StatementClass *tbl_stmt;
+	RETCODE		result,
+				keyresult;
+	char		tables_query[STD_STATEMENT_LEN];
+	char		trig_deferrable[2];
+	char		trig_initdeferred[2];
+	char		trig_args[1024];
+	char		upd_rule[MAX_TABLE_LEN],
+				del_rule[MAX_TABLE_LEN];
+	char		pk_table_needed[MAX_TABLE_LEN + 1];
+	char		fk_table_needed[MAX_TABLE_LEN + 1];
+	char	   *pkey_ptr,
+			   *fkey_ptr,
+			   *pk_table,
+			   *fk_table;
+	int			i,
+				j,
+				k,
+				num_keys;
+	SWORD		trig_nargs,
+				upd_rule_type = 0,
+				del_rule_type = 0;
+
 #if (ODBCVER >= 0x0300)
-SWORD defer_type;
+	SWORD		defer_type;
+
 #endif
-char pkey[MAX_INFO_STRING];
-Int2 result_cols;
+	char		pkey[MAX_INFO_STRING];
+	Int2		result_cols;
 
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
 
-    if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
-    }
-	
+		return SQL_INVALID_HANDLE;
+	}
+
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
-    stmt->result = QR_Constructor();
-    if(!stmt->result) {
+	stmt->result = QR_Constructor();
+	if (!stmt->result)
+	{
 		stmt->errormsg = "Couldn't allocate memory for SQLForeignKeys result.";
-        stmt->errornumber = STMT_NO_MEMORY_ERROR;
+		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
+
+	/* the binding structure for a statement is not set up until */
 
-    /* the binding structure for a statement is not set up until */
-    /* a statement is actually executed, so we'll have to do this ourselves. */
+	/*
+	 * a statement is actually executed, so we'll have to do this
+	 * ourselves.
+	 */
 	result_cols = 14;
-    extend_bindings(stmt, result_cols);
-
-    /* set the field names */
-    QR_set_num_fields(stmt->result, result_cols);
-    QR_set_field_info(stmt->result, 0, "PKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 1, "PKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 2, "PKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 3, "PKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 4, "FKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 5, "FKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 6, "FKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 7, "FKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 8, "KEY_SEQ", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 9, "UPDATE_RULE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 10, "DELETE_RULE", PG_TYPE_INT2, 2);
-    QR_set_field_info(stmt->result, 11, "FK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 12, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-    QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	extend_bindings(stmt, result_cols);
+
+	/* set the field names */
+	QR_set_num_fields(stmt->result, result_cols);
+	QR_set_field_info(stmt->result, 0, "PKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 1, "PKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 2, "PKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 3, "PKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 4, "FKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 5, "FKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 6, "FKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 7, "FKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 8, "KEY_SEQ", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 9, "UPDATE_RULE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 10, "DELETE_RULE", PG_TYPE_INT2, 2);
+	QR_set_field_info(stmt->result, 11, "FK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 12, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+	QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
 #if (ODBCVER >= 0x0300)
 	QR_set_field_info(stmt->result, 14, "DEFERRABILITY", PG_TYPE_INT2, 2);
-#endif /* ODBCVER >= 0x0300 */
+#endif	 /* ODBCVER >= 0x0300 */
 
-    /* also, things need to think that this statement is finished so */
-    /* the results can be retrieved. */
-    stmt->status = STMT_FINISHED;
+	/* also, things need to think that this statement is finished so */
+	/* the results can be retrieved. */
+	stmt->status = STMT_FINISHED;
 
-    /* set up the current tuple pointer for SQLFetch */
-    stmt->currTuple = -1;
+	/* set up the current tuple pointer for SQLFetch */
+	stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 
-    result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
-    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
+	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	{
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLForeignKeys result.";
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
@@ -2386,53 +2750,57 @@ Int2 result_cols;
 	make_string(szPkTableName, cbPkTableName, pk_table_needed);
 	make_string(szFkTableName, cbFkTableName, fk_table_needed);
 
-	/*	Case #2 -- Get the foreign keys in the specified table (fktab) that 
-		refer to the primary keys of other table(s).
-	*/
-	if (fk_table_needed[0] != '\0') {
+	/*
+	 * Case #2 -- Get the foreign keys in the specified table (fktab) that
+	 * refer to the primary keys of other table(s).
+	 */
+	if (fk_table_needed[0] != '\0')
+	{
 		mylog("%s: entering Foreign Key Case #2", func);
 		sprintf(tables_query, "SELECT	pt.tgargs, "
-								"		pt.tgnargs, "
-								"		pt.tgdeferrable, "
-								"		pt.tginitdeferred, "
-								"		pg_proc.proname, "
-								"		pg_proc_1.proname "
-								"FROM	pg_class pc, "
-								"		pg_proc pg_proc, "
-								"		pg_proc pg_proc_1, "
-								"		pg_trigger pg_trigger, "
-								"		pg_trigger pg_trigger_1, "
-								"		pg_proc pp, "
-								"		pg_trigger pt "
-								"WHERE	pt.tgrelid = pc.oid "
-								"AND pp.oid = pt.tgfoid "
-								"AND pg_trigger.tgconstrrelid = pc.oid "
-								"AND pg_proc.oid = pg_trigger.tgfoid "
-								"AND pg_trigger_1.tgfoid = pg_proc_1.oid "
-								"AND pg_trigger_1.tgconstrrelid = pc.oid "
-								"AND ((pc.relname='%s') "
-								"AND (pp.proname LIKE '%%ins') "
-								"AND (pg_proc.proname LIKE '%%upd') "
-								"AND (pg_proc_1.proname LIKE '%%del') "
-								"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
-								"AND (pg_trigger.tgconstrname=pt.tgconstrname) "
-								"AND (pg_trigger_1.tgrelid=pt.tgconstrrelid) "
-								"AND (pg_trigger_1.tgconstrname=pt.tgconstrname))", 
-				fk_table_needed);		
+				"		pt.tgnargs, "
+				"		pt.tgdeferrable, "
+				"		pt.tginitdeferred, "
+				"		pg_proc.proname, "
+				"		pg_proc_1.proname "
+				"FROM	pg_class pc, "
+				"		pg_proc pg_proc, "
+				"		pg_proc pg_proc_1, "
+				"		pg_trigger pg_trigger, "
+				"		pg_trigger pg_trigger_1, "
+				"		pg_proc pp, "
+				"		pg_trigger pt "
+				"WHERE	pt.tgrelid = pc.oid "
+				"AND pp.oid = pt.tgfoid "
+				"AND pg_trigger.tgconstrrelid = pc.oid "
+				"AND pg_proc.oid = pg_trigger.tgfoid "
+				"AND pg_trigger_1.tgfoid = pg_proc_1.oid "
+				"AND pg_trigger_1.tgconstrrelid = pc.oid "
+				"AND ((pc.relname='%s') "
+				"AND (pp.proname LIKE '%%ins') "
+				"AND (pg_proc.proname LIKE '%%upd') "
+				"AND (pg_proc_1.proname LIKE '%%del') "
+				"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
+				"AND (pg_trigger.tgconstrname=pt.tgconstrname) "
+				"AND (pg_trigger_1.tgrelid=pt.tgconstrrelid) "
+				"AND (pg_trigger_1.tgconstrname=pt.tgconstrname))",
+				fk_table_needed);
 
 		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
 
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
-    		SQLFreeStmt(htbl_stmt, SQL_DROP);
+			SQLFreeStmt(htbl_stmt, SQL_DROP);
 			return SQL_ERROR;
 		}
 
 		result = SQLBindCol(htbl_stmt, 1, SQL_C_BINARY,
 							trig_args, sizeof(trig_args), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2442,7 +2810,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 2, SQL_C_SHORT,
 							&trig_nargs, 0, NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2451,8 +2820,9 @@ Int2 result_cols;
 		}
 
 		result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-							trig_deferrable, sizeof(trig_deferrable), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+						 trig_deferrable, sizeof(trig_deferrable), NULL);
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2461,8 +2831,9 @@ Int2 result_cols;
 		}
 
 		result = SQLBindCol(htbl_stmt, 4, SQL_C_CHAR,
-							trig_initdeferred, sizeof(trig_initdeferred), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+					 trig_initdeferred, sizeof(trig_initdeferred), NULL);
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2472,7 +2843,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 5, SQL_C_CHAR,
 							upd_rule, sizeof(upd_rule), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2482,7 +2854,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 6, SQL_C_CHAR,
 							del_rule, sizeof(del_rule), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2494,7 +2867,8 @@ Int2 result_cols;
 		if (result == SQL_NO_DATA_FOUND)
 			return SQL_SUCCESS;
 
-		if(result != SQL_SUCCESS) {
+		if (result != SQL_SUCCESS)
+		{
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2502,8 +2876,9 @@ Int2 result_cols;
 			return SQL_ERROR;
 		}
 
-		keyresult = SQLAllocStmt( stmt->hdbc, &hpkey_stmt);
-		if((keyresult != SQL_SUCCESS) && (keyresult != SQL_SUCCESS_WITH_INFO)) {
+		keyresult = SQLAllocStmt(stmt->hdbc, &hpkey_stmt);
+		if ((keyresult != SQL_SUCCESS) && (keyresult != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Couldn't allocate statement for SQLForeignKeys (pkeys) result.";
 			SC_log_error(func, "", stmt);
@@ -2511,8 +2886,9 @@ Int2 result_cols;
 		}
 
 		keyresult = SQLBindCol(hpkey_stmt, 4, SQL_C_CHAR,
-								pkey, sizeof(pkey), NULL);
-		if (keyresult != SQL_SUCCESS) {
+							   pkey, sizeof(pkey), NULL);
+		if (keyresult != SQL_SUCCESS)
+		{
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Couldn't bindcol for primary keys for SQLForeignKeys result.";
 			SC_log_error(func, "", stmt);
@@ -2520,31 +2896,35 @@ Int2 result_cols;
 			return SQL_ERROR;
 		}
 
-		while (result == SQL_SUCCESS) {
+		while (result == SQL_SUCCESS)
+		{
 
-			/*	Compute the number of keyparts.	*/
+			/* Compute the number of keyparts. */
 			num_keys = (trig_nargs - 4) / 2;
 
 			mylog("Foreign Key Case#2: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys);
 
 			pk_table = trig_args;
 
-			/*	Get to the PK Table Name */
+			/* Get to the PK Table Name */
 			for (k = 0; k < 2; k++)
 				pk_table += strlen(pk_table) + 1;
 
-			/*	If there is a pk table specified, then check it. */
-			if (pk_table_needed[0] != '\0') {
+			/* If there is a pk table specified, then check it. */
+			if (pk_table_needed[0] != '\0')
+			{
 
-				/*	If it doesn't match, then continue */
-				if ( strcmp(pk_table, pk_table_needed)) {	
+				/* If it doesn't match, then continue */
+				if (strcmp(pk_table, pk_table_needed))
+				{
 					result = SQLFetch(htbl_stmt);
 					continue;
 				}
 			}
 
 			keyresult = SQLPrimaryKeys(hpkey_stmt, NULL, 0, NULL, 0, pk_table, SQL_NTS);
-			if (keyresult != SQL_SUCCESS) {
+			if (keyresult != SQL_SUCCESS)
+			{
 				stmt->errornumber = STMT_NO_MEMORY_ERROR;
 				stmt->errormsg = "Couldn't get primary keys for SQLForeignKeys result.";
 				SC_log_error(func, "", stmt);
@@ -2553,77 +2933,77 @@ Int2 result_cols;
 			}
 
 
-			/*	Check that the key listed is the primary key */
+			/* Check that the key listed is the primary key */
 			keyresult = SQLFetch(hpkey_stmt);
 
-			/*	Get to first primary key */
+			/* Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++) {
+			for (k = 0; k < num_keys; k++)
+			{
 				mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_ptr, pkey);
-				if ( keyresult != SQL_SUCCESS || strcmp(pkey_ptr, pkey)) {
+				if (keyresult != SQL_SUCCESS || strcmp(pkey_ptr, pkey))
+				{
 					num_keys = 0;
 					break;
 				}
 
-				/*	Get to next primary key */
+				/* Get to next primary key */
 				for (k = 0; k < 2; k++)
 					pkey_ptr += strlen(pkey_ptr) + 1;
 
 				keyresult = SQLFetch(hpkey_stmt);
 			}
 
-			/*	Set to first fk column */
+			/* Set to first fk column */
 			fkey_ptr = trig_args;
 			for (k = 0; k < 4; k++)
 				fkey_ptr += strlen(fkey_ptr) + 1;
 
 			/* Set update and delete actions for foreign keys */
-			if (!strcmp(upd_rule, "RI_FKey_cascade_upd")) {
+			if (!strcmp(upd_rule, "RI_FKey_cascade_upd"))
 				upd_rule_type = SQL_CASCADE;
-			} else if (!strcmp(upd_rule, "RI_FKey_noaction_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_noaction_upd"))
 				upd_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_restrict_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_restrict_upd"))
 				upd_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd"))
 				upd_rule_type = SQL_SET_DEFAULT;
-			} else if (!strcmp(upd_rule, "RI_FKey_setnull_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setnull_upd"))
 				upd_rule_type = SQL_SET_NULL;
-			}
-			
-			if (!strcmp(upd_rule, "RI_FKey_cascade_del")) {
+
+			if (!strcmp(upd_rule, "RI_FKey_cascade_del"))
 				del_rule_type = SQL_CASCADE;
-			} else if (!strcmp(upd_rule, "RI_FKey_noaction_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_noaction_del"))
 				del_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_restrict_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_restrict_del"))
 				del_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setdefault_del"))
 				del_rule_type = SQL_SET_DEFAULT;
-			} else if (!strcmp(upd_rule, "RI_FKey_setnull_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setnull_del"))
 				del_rule_type = SQL_SET_NULL;
-			}
 
 #if (ODBCVER >= 0x0300)
 			/* Set deferrability type */
-			if (!strcmp(trig_initdeferred, "y")) {
+			if (!strcmp(trig_initdeferred, "y"))
 				defer_type = SQL_INITIALLY_DEFERRED;
-			} else if (!strcmp(trig_deferrable, "y")) {
+			else if (!strcmp(trig_deferrable, "y"))
 				defer_type = SQL_INITIALLY_IMMEDIATE;
-			} else {
+			else
 				defer_type = SQL_NOT_DEFERRABLE;
-			}
-#endif /* ODBCVER >= 0x0300 */
+#endif	 /* ODBCVER >= 0x0300 */
 
-			/*	Get to first primary key */
+			/* Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++) {
+			for (k = 0; k < num_keys; k++)
+			{
 
-				row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
+				row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
 
 				mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table, pkey_ptr);
 				set_tuplefield_null(&row->tuple[0]);
@@ -2646,12 +3026,13 @@ Int2 result_cols;
 				set_tuplefield_string(&row->tuple[13], trig_args);
 #if (ODBCVER >= 0x0300)
 				set_tuplefield_int2(&row->tuple[14], defer_type);
-#endif /* ODBCVER >= 0x0300 */
+#endif	 /* ODBCVER >= 0x0300 */
 
 				QR_add_tuple(stmt->result, row);
 
 				/* next primary/foreign key */
-				for (i = 0; i < 2; i++) {
+				for (i = 0; i < 2; i++)
+				{
 					fkey_ptr += strlen(fkey_ptr) + 1;
 					pkey_ptr += strlen(pkey_ptr) + 1;
 				}
@@ -2662,53 +3043,58 @@ Int2 result_cols;
 		SQLFreeStmt(hpkey_stmt, SQL_DROP);
 	}
 
-	/*	Case #1 -- Get the foreign keys in other tables that refer to the primary key
-		in the specified table (pktab).  i.e., Who points to me?
-	*/
-    else if (pk_table_needed[0] != '\0') {
+	/*
+	 * Case #1 -- Get the foreign keys in other tables that refer to the
+	 * primary key in the specified table (pktab).	i.e., Who points to
+	 * me?
+	 */
+	else if (pk_table_needed[0] != '\0')
+	{
 
 		sprintf(tables_query, "SELECT	pg_trigger.tgargs, "
-								"		pg_trigger.tgnargs, "
-								"		pg_trigger.tgdeferrable, "
-								"		pg_trigger.tginitdeferred, "
-								"		pg_proc.proname, "
-								"		pg_proc_1.proname "
-								"FROM	pg_class pg_class, "
-								"		pg_class pg_class_1, "
-								"		pg_class pg_class_2, "
-								"		pg_proc pg_proc, "
-								"		pg_proc pg_proc_1, "
-								"		pg_trigger pg_trigger, "
-								"		pg_trigger pg_trigger_1, "
-								"		pg_trigger pg_trigger_2 "
-								"WHERE	pg_trigger.tgconstrrelid = pg_class.oid "
-								"	AND pg_trigger.tgrelid = pg_class_1.oid "
-								"	AND pg_trigger_1.tgfoid = pg_proc_1.oid "
-								"	AND pg_trigger_1.tgconstrrelid = pg_class_1.oid "
-								"	AND pg_trigger_2.tgconstrrelid = pg_class_2.oid "
-								"	AND pg_trigger_2.tgfoid = pg_proc.oid "
-								"	AND pg_class_2.oid = pg_trigger.tgrelid "
-								"	AND ("
-								"		 (pg_class.relname='%s') "
-								"	AND  (pg_proc.proname Like '%%upd') "
-								"	AND  (pg_proc_1.proname Like '%%del')"
-								"	AND	 (pg_trigger_1.tgrelid = pg_trigger.tgconstrrelid) "
-								"	AND	 (pg_trigger_2.tgrelid = pg_trigger.tgconstrrelid) "
-								"		)",
+				"		pg_trigger.tgnargs, "
+				"		pg_trigger.tgdeferrable, "
+				"		pg_trigger.tginitdeferred, "
+				"		pg_proc.proname, "
+				"		pg_proc_1.proname "
+				"FROM	pg_class pg_class, "
+				"		pg_class pg_class_1, "
+				"		pg_class pg_class_2, "
+				"		pg_proc pg_proc, "
+				"		pg_proc pg_proc_1, "
+				"		pg_trigger pg_trigger, "
+				"		pg_trigger pg_trigger_1, "
+				"		pg_trigger pg_trigger_2 "
+				"WHERE	pg_trigger.tgconstrrelid = pg_class.oid "
+				"	AND pg_trigger.tgrelid = pg_class_1.oid "
+				"	AND pg_trigger_1.tgfoid = pg_proc_1.oid "
+				"	AND pg_trigger_1.tgconstrrelid = pg_class_1.oid "
+				"	AND pg_trigger_2.tgconstrrelid = pg_class_2.oid "
+				"	AND pg_trigger_2.tgfoid = pg_proc.oid "
+				"	AND pg_class_2.oid = pg_trigger.tgrelid "
+				"	AND ("
+				"		 (pg_class.relname='%s') "
+				"	AND  (pg_proc.proname Like '%%upd') "
+				"	AND  (pg_proc_1.proname Like '%%del')"
+				"	AND	 (pg_trigger_1.tgrelid = pg_trigger.tgconstrrelid) "
+				"	AND	 (pg_trigger_2.tgrelid = pg_trigger.tgconstrrelid) "
+				"		)",
 				pk_table_needed);
 
 		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
-    		SQLFreeStmt(htbl_stmt, SQL_DROP);
+			SQLFreeStmt(htbl_stmt, SQL_DROP);
 			return SQL_ERROR;
 		}
 
 		result = SQLBindCol(htbl_stmt, 1, SQL_C_BINARY,
 							trig_args, sizeof(trig_args), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2718,7 +3104,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 2, SQL_C_SHORT,
 							&trig_nargs, 0, NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2727,8 +3114,9 @@ Int2 result_cols;
 		}
 
 		result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-							trig_deferrable, sizeof(trig_deferrable), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+						 trig_deferrable, sizeof(trig_deferrable), NULL);
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2737,8 +3125,9 @@ Int2 result_cols;
 		}
 
 		result = SQLBindCol(htbl_stmt, 4, SQL_C_CHAR,
-							trig_initdeferred, sizeof(trig_initdeferred), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+					 trig_initdeferred, sizeof(trig_initdeferred), NULL);
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2748,7 +3137,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 5, SQL_C_CHAR,
 							upd_rule, sizeof(upd_rule), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2758,7 +3148,8 @@ Int2 result_cols;
 
 		result = SQLBindCol(htbl_stmt, 6, SQL_C_CHAR,
 							del_rule, sizeof(del_rule), NULL);
-		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		{
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2770,7 +3161,8 @@ Int2 result_cols;
 		if (result == SQL_NO_DATA_FOUND)
 			return SQL_SUCCESS;
 
-		if(result != SQL_SUCCESS) {
+		if (result != SQL_SUCCESS)
+		{
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2778,79 +3170,78 @@ Int2 result_cols;
 			return SQL_ERROR;
 		}
 
-		while (result == SQL_SUCCESS) {
+		while (result == SQL_SUCCESS)
+		{
 
-			/*	Calculate the number of key parts */
+			/* Calculate the number of key parts */
 			num_keys = (trig_nargs - 4) / 2;;
 
-			/*	Handle action (i.e., 'cascade', 'restrict', 'setnull') */
-			if (!strcmp(upd_rule, "RI_FKey_cascade_upd")) {
+			/* Handle action (i.e., 'cascade', 'restrict', 'setnull') */
+			if (!strcmp(upd_rule, "RI_FKey_cascade_upd"))
 				upd_rule_type = SQL_CASCADE;
-			} else if (!strcmp(upd_rule, "RI_FKey_noaction_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_noaction_upd"))
 				upd_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_restrict_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_restrict_upd"))
 				upd_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd"))
 				upd_rule_type = SQL_SET_DEFAULT;
-			} else if (!strcmp(upd_rule, "RI_FKey_setnull_upd")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setnull_upd"))
 				upd_rule_type = SQL_SET_NULL;
-			}
-			
-			if (!strcmp(upd_rule, "RI_FKey_cascade_del")) {
+
+			if (!strcmp(upd_rule, "RI_FKey_cascade_del"))
 				del_rule_type = SQL_CASCADE;
-			} else if (!strcmp(upd_rule, "RI_FKey_noaction_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_noaction_del"))
 				del_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_restrict_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_restrict_del"))
 				del_rule_type = SQL_NO_ACTION;
-			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setdefault_del"))
 				del_rule_type = SQL_SET_DEFAULT;
-			} else if (!strcmp(upd_rule, "RI_FKey_setnull_del")) {
+			else if (!strcmp(upd_rule, "RI_FKey_setnull_del"))
 				del_rule_type = SQL_SET_NULL;
-			}			
 
 #if (ODBCVER >= 0x0300)
 			/* Set deferrability type */
-			if (!strcmp(trig_initdeferred, "y")) {
+			if (!strcmp(trig_initdeferred, "y"))
 				defer_type = SQL_INITIALLY_DEFERRED;
-			} else if (!strcmp(trig_deferrable, "y")) {
+			else if (!strcmp(trig_deferrable, "y"))
 				defer_type = SQL_INITIALLY_IMMEDIATE;
-			} else {
+			else
 				defer_type = SQL_NOT_DEFERRABLE;
-			}
-#endif /* ODBCVER >= 0x0300 */
+#endif	 /* ODBCVER >= 0x0300 */
 
 			mylog("Foreign Key Case#1: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys);
 
-			/*	Get to first primary key */
+			/* Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
 
-			/*	Get to first foreign table */
+			/* Get to first foreign table */
 			fk_table = trig_args;
 			fk_table += strlen(fk_table) + 1;
 
 			/* Get to first foreign key */
 			fkey_ptr = trig_args;
-			for (k = 0; k < 4; k++) 
+			for (k = 0; k < 4; k++)
 				fkey_ptr += strlen(fkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++) {
+			for (k = 0; k < num_keys; k++)
+			{
 
 				mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_ptr, fk_table, fkey_ptr);
 
-					row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
+				row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
 
 				mylog("pk_table_needed = '%s', pkey_ptr = '%s'\n", pk_table_needed, pkey_ptr);
-					set_tuplefield_null(&row->tuple[0]);
-					set_tuplefield_string(&row->tuple[1], "");
+				set_tuplefield_null(&row->tuple[0]);
+				set_tuplefield_string(&row->tuple[1], "");
 				set_tuplefield_string(&row->tuple[2], pk_table_needed);
 				set_tuplefield_string(&row->tuple[3], pkey_ptr);
 
 				mylog("fk_table = '%s', fkey_ptr = '%s'\n", fk_table, fkey_ptr);
-					set_tuplefield_null(&row->tuple[4]);
-					set_tuplefield_string(&row->tuple[5], "");
+				set_tuplefield_null(&row->tuple[4]);
+				set_tuplefield_string(&row->tuple[5], "");
 				set_tuplefield_string(&row->tuple[6], fk_table);
 				set_tuplefield_string(&row->tuple[7], fkey_ptr);
 
@@ -2860,20 +3251,21 @@ Int2 result_cols;
 				set_nullfield_int2(&row->tuple[9], (Int2) upd_rule_type);
 				set_nullfield_int2(&row->tuple[10], (Int2) del_rule_type);
 
-					set_tuplefield_null(&row->tuple[11]);
-					set_tuplefield_null(&row->tuple[12]);
+				set_tuplefield_null(&row->tuple[11]);
+				set_tuplefield_null(&row->tuple[12]);
 
 				set_tuplefield_string(&row->tuple[13], trig_args);
 
 #if (ODBCVER >= 0x0300)
 				mylog("defer_type = '%s'", defer_type);
 				set_tuplefield_int2(&row->tuple[14], defer_type);
-#endif /* ODBCVER >= 0x0300 */
+#endif	 /* ODBCVER >= 0x0300 */
 
 				QR_add_tuple(stmt->result, row);
 
-				/*	next primary/foreign key */
-				for (j = 0; j < 2; j++) {
+				/* next primary/foreign key */
+				for (j = 0; j < 2; j++)
+				{
 					pkey_ptr += strlen(pkey_ptr) + 1;
 					fkey_ptr += strlen(fkey_ptr) + 1;
 				}
@@ -2881,8 +3273,9 @@ Int2 result_cols;
 
 			result = SQLFetch(htbl_stmt);
 		}
-    }
-	else {
+	}
+	else
+	{
 		stmt->errormsg = "No tables specified to SQLForeignKeys.";
 		stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
@@ -2893,60 +3286,63 @@ Int2 result_cols;
 	SQLFreeStmt(htbl_stmt, SQL_DROP);
 
 	mylog("SQLForeignKeys(): EXIT, stmt=%u\n", stmt);
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
 
 
-RETCODE SQL_API SQLProcedureColumns(
-                                    HSTMT         hstmt,
-                                    UCHAR FAR *   szProcQualifier,
-                                    SWORD         cbProcQualifier,
-                                    UCHAR FAR *   szProcOwner,
-                                    SWORD         cbProcOwner,
-                                    UCHAR FAR *   szProcName,
-                                    SWORD         cbProcName,
-                                    UCHAR FAR *   szColumnName,
-                                    SWORD         cbColumnName)
+RETCODE SQL_API
+SQLProcedureColumns(
+					HSTMT hstmt,
+					UCHAR FAR *szProcQualifier,
+					SWORD cbProcQualifier,
+					UCHAR FAR *szProcOwner,
+					SWORD cbProcOwner,
+					UCHAR FAR *szProcName,
+					SWORD cbProcName,
+					UCHAR FAR *szColumnName,
+					SWORD cbColumnName)
 {
-static char *func="SQLProcedureColumns";
+	static char *func = "SQLProcedureColumns";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-    return SQL_ERROR;
+	return SQL_ERROR;
 }
 
-RETCODE SQL_API SQLProcedures(
-                              HSTMT          hstmt,
-                              UCHAR FAR *    szProcQualifier,
-                              SWORD          cbProcQualifier,
-                              UCHAR FAR *    szProcOwner,
-                              SWORD          cbProcOwner,
-                              UCHAR FAR *    szProcName,
-                              SWORD          cbProcName)
+RETCODE SQL_API
+SQLProcedures(
+			  HSTMT hstmt,
+			  UCHAR FAR *szProcQualifier,
+			  SWORD cbProcQualifier,
+			  UCHAR FAR *szProcOwner,
+			  SWORD cbProcOwner,
+			  UCHAR FAR *szProcName,
+			  SWORD cbProcName)
 {
-static char *func="SQLProcedures";
+	static char *func = "SQLProcedures";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-    return SQL_ERROR;
+	return SQL_ERROR;
 }
 
-RETCODE SQL_API SQLTablePrivileges(
-                                   HSTMT           hstmt,
-                                   UCHAR FAR *     szTableQualifier,
-                                   SWORD           cbTableQualifier,
-                                   UCHAR FAR *     szTableOwner,
-                                   SWORD           cbTableOwner,
-                                   UCHAR FAR *     szTableName,
-                                   SWORD           cbTableName)
+RETCODE SQL_API
+SQLTablePrivileges(
+				   HSTMT hstmt,
+				   UCHAR FAR *szTableQualifier,
+				   SWORD cbTableQualifier,
+				   UCHAR FAR *szTableOwner,
+				   SWORD cbTableOwner,
+				   UCHAR FAR *szTableName,
+				   SWORD cbTableName)
 {
-static char *func="SQLTablePrivileges";
+	static char *func = "SQLTablePrivileges";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-    return SQL_ERROR;
+	return SQL_ERROR;
 }
diff --git a/src/interfaces/odbc/iodbc.h b/src/interfaces/odbc/iodbc.h
index ab6a6015adad547454b06af22b634c74c58ac303..ef3df399a6c082774610b9e155773e5154ea906c 100644
--- a/src/interfaces/odbc/iodbc.h
+++ b/src/interfaces/odbc/iodbc.h
@@ -1,66 +1,66 @@
-#ifndef	_IODBC_H
-#define	_IODBC_H
-
-# if	!defined(WIN32) && !defined(WIN32_SYSTEM) 
-#  define	_UNIX_
-
-#  include	<stdlib.h>
-#  include	<sys/types.h>
-
-#  define	MEM_ALLOC(size)	(malloc((size_t)(size)))
-#  define	MEM_FREE(ptr)	{if(ptr) free(ptr);}
-
-#  define	STRCPY(t, s)	(strcpy((char*)(t), (char*)(s)))	
-#  define	STRNCPY(t,s,n)	(strncpy((char*)(t), (char*)(s), (size_t)(n)))
-#  define	STRCAT(t, s)	(strcat((char*)(t), (char*)(s)))
-#  define	STRNCAT(t,s,n)	(strncat((char*)(t), (char*)(s), (size_t)(n)))
-#  define	STREQ(a, b)	(strcmp((char*)(a), (char*)(b)) == 0)
-#  define	STRLEN(str)	((str)? strlen((char*)(str)):0)
-
-#  define	EXPORT
-#  define	CALLBACK
-#  define	FAR
-
-   typedef 	signed short	SSHOR;
-   typedef	short		WORD;
-   typedef 	long		DWORD;
-
-   typedef	WORD		WPARAM;
-   typedef	DWORD		LPARAM;
-   typedef	void*		HWND;
-   typedef	int		BOOL;
-
-# endif	/* _UNIX_ */
-
-# if	defined(WIN32) || defined(WIN32_SYSTEM)
-
-#  include	<windows.h>
-#  include	<windowsx.h>
-
-#  ifdef	_MSVC_
-#   define	MEM_ALLOC(size)	(fmalloc((size_t)(size)))
-#   define	MEM_FREE(ptr)	((ptr)? ffree((PTR)(ptr)):0))
-#   define	STRCPY(t, s)	(fstrcpy((char FAR*)(t), (char FAR*)(s)))
-#   define	STRNCPY(t,s,n)	(fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
-#   define	STRLEN(str)	((str)? fstrlen((char FAR*)(str)):0)
-#   define	STREQ(a, b)	(fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
-#  endif
-
-#  ifdef	_BORLAND_
-#   define	MEM_ALLOC(size)	(farmalloc((unsigned long)(size))
-#   define	MEM_FREE(ptr)	((ptr)? farfree((void far*)(ptr)):0)
-#   define	STRCPY(t, s)	(_fstrcpy((char FAR*)(t), (char FAR*)(s)))
-#   define	STRNCPY(t,s,n)	(_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
-#   define      STRLEN(str)     ((str)? _fstrlen((char FAR*)(str)):0)
-#   define      STREQ(a, b)     (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
-#  endif
-
-# endif	/* WIN32 */
-
-# define	SYSERR		(-1)
-
-# ifndef	NULL
-#   define	NULL		((void FAR*)0UL)
-# endif
+#ifndef _IODBC_H
+#define _IODBC_H
+
+#if    !defined(WIN32) && !defined(WIN32_SYSTEM)
+#define   _UNIX_
+
+#include  <stdlib.h>
+#include  <sys/types.h>
+
+#define   MEM_ALLOC(size) (malloc((size_t)(size)))
+#define   MEM_FREE(ptr)   {if(ptr) free(ptr);}
+
+#define   STRCPY(t, s)	  (strcpy((char*)(t), (char*)(s)))
+#define   STRNCPY(t,s,n)  (strncpy((char*)(t), (char*)(s), (size_t)(n)))
+#define   STRCAT(t, s)	  (strcat((char*)(t), (char*)(s)))
+#define   STRNCAT(t,s,n)  (strncat((char*)(t), (char*)(s), (size_t)(n)))
+#define   STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
+#define   STRLEN(str) ((str)? strlen((char*)(str)):0)
+
+#define   EXPORT
+#define   CALLBACK
+#define   FAR
+
+typedef signed short SSHOR;
+typedef short WORD;
+typedef long DWORD;
+
+typedef WORD WPARAM;
+typedef DWORD LPARAM;
+typedef void *HWND;
+typedef int BOOL;
+
+#endif	 /* _UNIX_ */
+
+#if    defined(WIN32) || defined(WIN32_SYSTEM)
+
+#include  <windows.h>
+#include  <windowsx.h>
+
+#ifdef	  _MSVC_
+#define  MEM_ALLOC(size) (fmalloc((size_t)(size)))
+#define  MEM_FREE(ptr)	 ((ptr)? ffree((PTR)(ptr)):0))
+#define  STRCPY(t, s)	 (fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#define  STRNCPY(t,s,n)  (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#define  STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0)
+#define  STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#endif
+
+#ifdef	  _BORLAND_
+#define  MEM_ALLOC(size) (farmalloc((unsigned long)(size))
+#define  MEM_FREE(ptr)	 ((ptr)? farfree((void far*)(ptr)):0)
+#define  STRCPY(t, s)	 (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#define  STRNCPY(t,s,n)  (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#define		 STRLEN(str)	 ((str)? _fstrlen((char FAR*)(str)):0)
+#define		 STREQ(a, b)	 (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#endif
+
+#endif	 /* WIN32 */
+
+#define    SYSERR	   (-1)
+
+#ifndef    NULL
+#define  NULL		 ((void FAR*)0UL)
+#endif
 
 #endif
diff --git a/src/interfaces/odbc/isql.h b/src/interfaces/odbc/isql.h
index deeddd3db04242300ff64c5d8722990418e1ab6b..dc2c8295cd044db4b7199cb8a032108839328618 100644
--- a/src/interfaces/odbc/isql.h
+++ b/src/interfaces/odbc/isql.h
@@ -2,97 +2,97 @@
 * include path to be used to create ODBC compliant applications.
 */
 #ifndef _INTRINSIC_SQL_H
-# define _INTRINSIC_SQL_H
+#define _INTRINSIC_SQL_H
 
-typedef unsigned char		UCHAR;
-typedef long int		SDWORD;
-typedef short int		SWORD;
-typedef unsigned long int	UDWORD; 
-typedef unsigned short int	UWORD;
+typedef unsigned char UCHAR;
+typedef long int SDWORD;
+typedef short int SWORD;
+typedef unsigned long int UDWORD;
+typedef unsigned short int UWORD;
 
-typedef void FAR*		PTR;
+typedef void FAR *PTR;
 
-typedef void FAR*		HENV;
-typedef void FAR*		HDBC;
-typedef void FAR*		HSTMT;
+typedef void FAR *HENV;
+typedef void FAR *HDBC;
+typedef void FAR *HSTMT;
 
-typedef signed short		RETCODE;
+typedef signed short RETCODE;
 
-# ifdef WIN32
-#   define SQL_API			__stdcall
-# else
-#   define SQL_API			EXPORT CALLBACK
-# endif
+#ifdef WIN32
+#define SQL_API			 __stdcall
+#else
+#define SQL_API			 EXPORT CALLBACK
+#endif
 
-# define ODBCVER			0x0250
+#define ODBCVER			   0x0250
 
-# define SQL_MAX_MESSAGE_LENGTH		512
-# define SQL_MAX_DSN_LENGTH		32
+#define SQL_MAX_MESSAGE_LENGTH	   512
+#define SQL_MAX_DSN_LENGTH	   32
 
 /* return code */
-# define SQL_INVALID_HANDLE		(-2)
-# define SQL_ERROR			(-1)
-# define SQL_SUCCESS 			0
-# define SQL_SUCCESS_WITH_INFO		1
-# define SQL_NO_DATA_FOUND		100
+#define SQL_INVALID_HANDLE	   (-2)
+#define SQL_ERROR		   (-1)
+#define SQL_SUCCESS			   0
+#define SQL_SUCCESS_WITH_INFO	   1
+#define SQL_NO_DATA_FOUND	   100
 
 /* standard SQL datatypes (agree with ANSI type numbering) */
-# define SQL_CHAR			1
-# define SQL_NUMERIC 			2
-# define SQL_DECIMAL 			3
-# define SQL_INTEGER 			4
-# define SQL_SMALLINT			5
-# define SQL_FLOAT			6
-# define SQL_REAL			7
-# define SQL_DOUBLE			8
-# define SQL_VARCHAR 			12
-
-# define SQL_TYPE_MIN			SQL_CHAR
-# define SQL_TYPE_NULL			0
-# define SQL_TYPE_MAX			SQL_VARCHAR
+#define SQL_CHAR		   1
+#define SQL_NUMERIC			   2
+#define SQL_DECIMAL			   3
+#define SQL_INTEGER			   4
+#define SQL_SMALLINT		   5
+#define SQL_FLOAT		   6
+#define SQL_REAL		   7
+#define SQL_DOUBLE		   8
+#define SQL_VARCHAR			   12
+
+#define SQL_TYPE_MIN		   SQL_CHAR
+#define SQL_TYPE_NULL		   0
+#define SQL_TYPE_MAX		   SQL_VARCHAR
 
 /* C to SQL datatype mapping */
-# define SQL_C_CHAR			SQL_CHAR
-# define SQL_C_LONG			SQL_INTEGER
-# define SQL_C_SHORT   			SQL_SMALLINT
-# define SQL_C_FLOAT   			SQL_REAL
-# define SQL_C_DOUBLE			SQL_DOUBLE
-# define SQL_C_DEFAULT 			99
+#define SQL_C_CHAR		   SQL_CHAR
+#define SQL_C_LONG		   SQL_INTEGER
+#define SQL_C_SHORT			   SQL_SMALLINT
+#define SQL_C_FLOAT			   SQL_REAL
+#define SQL_C_DOUBLE		   SQL_DOUBLE
+#define SQL_C_DEFAULT		   99
 
-# define SQL_NO_NULLS			0
-# define SQL_NULLABLE			1
-# define SQL_NULLABLE_UNKNOWN		2
+#define SQL_NO_NULLS		   0
+#define SQL_NULLABLE		   1
+#define SQL_NULLABLE_UNKNOWN	   2
 
 /* some special length values */
-# define SQL_NULL_DATA			(-1)
-# define SQL_DATA_AT_EXEC		(-2)
-# define SQL_NTS 			(-3)
+#define SQL_NULL_DATA		   (-1)
+#define SQL_DATA_AT_EXEC	   (-2)
+#define SQL_NTS			   (-3)
 
 /* SQLFreeStmt flag values */
-# define SQL_CLOSE			0
-# define SQL_DROP			1
-# define SQL_UNBIND			2
-# define SQL_RESET_PARAMS		3
+#define SQL_CLOSE		   0
+#define SQL_DROP		   1
+#define SQL_UNBIND		   2
+#define SQL_RESET_PARAMS	   3
 
 /* SQLTransact flag values */
-# define SQL_COMMIT			0
-# define SQL_ROLLBACK			1
+#define SQL_COMMIT		   0
+#define SQL_ROLLBACK		   1
 
 /* SQLColAttributes flag values */
-# define SQL_COLUMN_COUNT            	0
-# define SQL_COLUMN_LABEL		18
-# define SQL_COLATT_OPT_MAX		SQL_COLUMN_LABEL
-# define SQL_COLUMN_DRIVER_START	1000
+#define SQL_COLUMN_COUNT			   0
+#define SQL_COLUMN_LABEL	   18
+#define SQL_COLATT_OPT_MAX	   SQL_COLUMN_LABEL
+#define SQL_COLUMN_DRIVER_START    1000
 
-# define SQL_COLATT_OPT_MIN		SQL_COLUMN_COUNT
+#define SQL_COLATT_OPT_MIN	   SQL_COLUMN_COUNT
 
 /* Null handles */
-# define SQL_NULL_HENV			0
-# define SQL_NULL_HDBC			0
-# define SQL_NULL_HSTMT			0
+#define SQL_NULL_HENV		   0
+#define SQL_NULL_HDBC		   0
+#define SQL_NULL_HSTMT		   0
 
 /* All code below has been added to the original isql.h coming from iodbc */
-typedef unsigned char	BYTE;
+typedef unsigned char BYTE;
 
 /* More SQLColAttributes flag values */
 #define SQL_COLUMN_NAME			1
@@ -116,9 +116,9 @@ typedef unsigned char	BYTE;
 /* SQLColAttributes Searchable flags */
 #define SQL_UNSEARCHABLE	0
 #define SQL_LIKE_ONLY		1
-#define SQL_ALL_EXCEPT_LIKE	2
+#define SQL_ALL_EXCEPT_LIKE 2
 #define SQL_SEARCHABLE		3
-#define SQL_PRED_SEARCHABLE	SQL_SEARCHABLE
+#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE
 
 /* SQLColAttributes Updateable flags */
 #define SQL_ATTR_READONLY		0
@@ -126,112 +126,113 @@ typedef unsigned char	BYTE;
 #define SQL_ATTR_READWRITE_UNKNOWN	2
 
 /*
- *  function prototypes previously not contained in isql.h
+ *	function prototypes previously not contained in isql.h
  */
 #ifdef __cplusplus
-extern "C"
+extern		"C"
 {
 #endif
 
-RETCODE SQL_API SQLAllocConnect (HENV henv,
-	HDBC FAR * phdbc);
-RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
-RETCODE SQL_API SQLAllocStmt (HDBC hdbc,
-	HSTMT FAR * phstmt);
-RETCODE SQL_API SQLBindCol (HSTMT hstmt,
-	UWORD icol,
-	SWORD fCType,
-	PTR rgbValue,
-	SDWORD cbValueMax,
-	SDWORD FAR * pcbValue);
-
-RETCODE SQL_API SQLCancel (HSTMT hstmt);
-
-RETCODE SQL_API SQLColAttributes (HSTMT hstmt,
-	UWORD icol,
-	UWORD fDescType,
-	PTR rgbDesc,
-	SWORD cbDescMax,
-	SWORD FAR * pcbDesc,
-	SDWORD FAR * pfDesc);
-
-RETCODE SQL_API SQLConnect (HDBC hdbc,
-	UCHAR FAR * szDSN,
-	SWORD cbDSN,
-	UCHAR FAR * szUID,
-	SWORD cbUID,
-	UCHAR FAR * szAuthStr,
-	SWORD cbAuthStr);
-
-RETCODE SQL_API SQLDescribeCol (HSTMT hstmt,
-	UWORD icol,
-	UCHAR FAR * szColName,
-	SWORD cbColNameMax,
-	SWORD FAR * pcbColName,
-	SWORD FAR * pfSqlType,
-	UDWORD FAR * pcbColDef,
-	SWORD FAR * pibScale,
-	SWORD FAR * pfNullable);
-
-RETCODE SQL_API SQLDisconnect (HDBC hdbc);
-
-RETCODE SQL_API SQLError (HENV henv,
-	HDBC hdbc,
-	HSTMT hstmt,
-	UCHAR FAR * szSqlState,
-	SDWORD FAR * pfNativeError,
-	UCHAR FAR * szErrorMsg,
-	SWORD cbErrorMsgMax,
-	SWORD FAR * pcbErrorMsg);
-
-RETCODE SQL_API SQLExecDirect (HSTMT hstmt,
-	UCHAR FAR * szSqlStr,
-	SDWORD cbSqlStr);
-
-RETCODE SQL_API SQLExecute (HSTMT hstmt);
-
-RETCODE SQL_API SQLFetch (HSTMT hstmt);
-
-RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
-
-RETCODE SQL_API SQLFreeEnv (HENV henv);
-
-RETCODE SQL_API SQLFreeStmt (HSTMT hstmt,
-	UWORD fOption);
-
-RETCODE SQL_API SQLGetCursorName (HSTMT hstmt,
-	UCHAR FAR * szCursor,
-	SWORD cbCursorMax,
-	SWORD FAR * pcbCursor);
-
-RETCODE SQL_API SQLNumResultCols (HSTMT hstmt,
-	SWORD FAR * pccol);
-
-RETCODE SQL_API SQLPrepare (HSTMT hstmt,
-	UCHAR FAR * szSqlStr,
-	SDWORD cbSqlStr);
-
-RETCODE SQL_API SQLRowCount (HSTMT hstmt,
-	SDWORD FAR * pcrow);
-
-RETCODE SQL_API SQLSetCursorName (HSTMT hstmt,
-	UCHAR FAR * szCursor,
-	SWORD cbCursor);
-
-RETCODE SQL_API SQLTransact (HENV henv,
-	HDBC hdbc,
-	UWORD fType);
-
-RETCODE SQL_API SQLSetParam (HSTMT hstmt,
-	UWORD ipar,
-	SWORD fCType,
-	SWORD fSqlType,
-	UDWORD cbColDef,
-	SWORD ibScale,
-	PTR rgbValue,
-	SDWORD FAR * pcbValue);
+	RETCODE SQL_API SQLAllocConnect(HENV henv,
+												HDBC FAR *phdbc);
+	RETCODE SQL_API SQLAllocEnv(HENV FAR *phenv);
+	RETCODE SQL_API SQLAllocStmt(HDBC hdbc,
+											 HSTMT FAR *phstmt);
+	RETCODE SQL_API SQLBindCol(HSTMT hstmt,
+										   UWORD icol,
+										   SWORD fCType,
+										   PTR rgbValue,
+										   SDWORD cbValueMax,
+										   SDWORD FAR *pcbValue);
+
+	RETCODE SQL_API SQLCancel(HSTMT hstmt);
+
+	RETCODE SQL_API SQLColAttributes(HSTMT hstmt,
+												 UWORD icol,
+												 UWORD fDescType,
+												 PTR rgbDesc,
+												 SWORD cbDescMax,
+												 SWORD FAR *pcbDesc,
+												 SDWORD FAR *pfDesc);
+
+	RETCODE SQL_API SQLConnect(HDBC hdbc,
+										   UCHAR FAR *szDSN,
+										   SWORD cbDSN,
+										   UCHAR FAR *szUID,
+										   SWORD cbUID,
+										   UCHAR FAR *szAuthStr,
+										   SWORD cbAuthStr);
+
+	RETCODE SQL_API SQLDescribeCol(HSTMT hstmt,
+											   UWORD icol,
+											   UCHAR FAR *szColName,
+											   SWORD cbColNameMax,
+											   SWORD FAR *pcbColName,
+											   SWORD FAR *pfSqlType,
+											   UDWORD FAR *pcbColDef,
+											   SWORD FAR *pibScale,
+											   SWORD FAR *pfNullable);
+
+	RETCODE SQL_API SQLDisconnect(HDBC hdbc);
+
+	RETCODE SQL_API SQLError(HENV henv,
+										 HDBC hdbc,
+										 HSTMT hstmt,
+										 UCHAR FAR *szSqlState,
+										 SDWORD FAR *pfNativeError,
+										 UCHAR FAR *szErrorMsg,
+										 SWORD cbErrorMsgMax,
+										 SWORD FAR *pcbErrorMsg);
+
+	RETCODE SQL_API SQLExecDirect(HSTMT hstmt,
+											  UCHAR FAR *szSqlStr,
+											  SDWORD cbSqlStr);
+
+	RETCODE SQL_API SQLExecute(HSTMT hstmt);
+
+	RETCODE SQL_API SQLFetch(HSTMT hstmt);
+
+	RETCODE SQL_API SQLFreeConnect(HDBC hdbc);
+
+	RETCODE SQL_API SQLFreeEnv(HENV henv);
+
+	RETCODE SQL_API SQLFreeStmt(HSTMT hstmt,
+											UWORD fOption);
+
+	RETCODE SQL_API SQLGetCursorName(HSTMT hstmt,
+												 UCHAR FAR *szCursor,
+												 SWORD cbCursorMax,
+												 SWORD FAR *pcbCursor);
+
+	RETCODE SQL_API SQLNumResultCols(HSTMT hstmt,
+												 SWORD FAR *pccol);
+
+	RETCODE SQL_API SQLPrepare(HSTMT hstmt,
+										   UCHAR FAR *szSqlStr,
+										   SDWORD cbSqlStr);
+
+	RETCODE SQL_API SQLRowCount(HSTMT hstmt,
+											SDWORD FAR *pcrow);
+
+	RETCODE SQL_API SQLSetCursorName(HSTMT hstmt,
+												 UCHAR FAR *szCursor,
+												 SWORD cbCursor);
+
+	RETCODE SQL_API SQLTransact(HENV henv,
+											HDBC hdbc,
+											UWORD fType);
+
+	RETCODE SQL_API SQLSetParam(HSTMT hstmt,
+											UWORD ipar,
+											SWORD fCType,
+											SWORD fSqlType,
+											UDWORD cbColDef,
+											SWORD ibScale,
+											PTR rgbValue,
+											SDWORD FAR *pcbValue);
 
 #ifdef __cplusplus
 }
+
+#endif
 #endif
-#endif  
diff --git a/src/interfaces/odbc/isqlext.h b/src/interfaces/odbc/isqlext.h
index b14b15af198a14eeee0e20db81633ebc843fff22..fd8e39385f0ef02a654e91fac95537eab9f13c1e 100644
--- a/src/interfaces/odbc/isqlext.h
+++ b/src/interfaces/odbc/isqlext.h
@@ -2,213 +2,213 @@
 * missing function prototypes and appropriate #defines. It is designed
 * to be a drop in replacement for isqlext.h from iodbc.
 */
-#ifndef	_INTRINSIC_SQLEXT_H
-# define _INTRINSIC_SQLEXT_H
+#ifndef _INTRINSIC_SQLEXT_H
+#define _INTRINSIC_SQLEXT_H
 
-# include "isql.h"
+#include "isql.h"
 
-# define SQL_STILL_EXECUTING 		2
-# define SQL_NEED_DATA			99
+#define SQL_STILL_EXECUTING		   2
+#define SQL_NEED_DATA		   99
 
 /* extend SQL datatypes */
-# define SQL_DATE			9
-# define SQL_TIME			10
-# define SQL_TIMESTAMP			11
-# define SQL_LONGVARCHAR 		(-1)
-# define SQL_BINARY			(-2)
-# define SQL_VARBINARY			(-3)
-# define SQL_LONGVARBINARY		(-4)
-# define SQL_BIGINT			(-5)
-# define SQL_TINYINT 			(-6)
-# define SQL_BIT 			(-7)	/* conflict with SQL3 ??? */
-# define SQL_TYPE_DRIVER_START		(-80)
+#define SQL_DATE		   9
+#define SQL_TIME		   10
+#define SQL_TIMESTAMP		   11
+#define SQL_LONGVARCHAR		   (-1)
+#define SQL_BINARY		   (-2)
+#define SQL_VARBINARY		   (-3)
+#define SQL_LONGVARBINARY	   (-4)
+#define SQL_BIGINT		   (-5)
+#define SQL_TINYINT			   (-6)
+#define SQL_BIT			   (-7) /* conflict with SQL3 ??? */
+#define SQL_TYPE_DRIVER_START	   (-80)
 
 /* C to SQL datatype mapping */
-# define SQL_C_DATE			SQL_DATE
-# define SQL_C_TIME			SQL_TIME
-# define SQL_C_TIMESTAMP 		SQL_TIMESTAMP
-# define SQL_C_BINARY			SQL_BINARY
-# define SQL_C_BIT			SQL_BIT
-# define SQL_C_TINYINT			SQL_TINYINT
-
-# define SQL_SIGNED_OFFSET		(-20)
-# define SQL_UNSIGNED_OFFSET		(-22)
-
-# define SQL_C_SLONG			(SQL_C_LONG  + SQL_SIGNED_OFFSET)
-# define SQL_C_SSHORT			(SQL_C_SHORT + SQL_SIGNED_OFFSET)
-# define SQL_C_STINYINT			(SQL_TINYINT + SQL_SIGNED_OFFSET)
-# define SQL_C_ULONG 			(SQL_C_LONG  + SQL_UNSIGNED_OFFSET)
-# define SQL_C_USHORT			(SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_UTINYINT			(SQL_TINYINT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_BOOKMARK			SQL_C_ULONG 			
-
-# if defined(SQL_TYPE_MIN)
-#   undef  SQL_TYPE_MIN  
-#   define SQL_TYPE_MIN			SQL_BIT	
-/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then, 
- *	SQL_TYPE_MIN need to be defined as SQL_TINYINT 
+#define SQL_C_DATE		   SQL_DATE
+#define SQL_C_TIME		   SQL_TIME
+#define SQL_C_TIMESTAMP		   SQL_TIMESTAMP
+#define SQL_C_BINARY		   SQL_BINARY
+#define SQL_C_BIT		   SQL_BIT
+#define SQL_C_TINYINT		   SQL_TINYINT
+
+#define SQL_SIGNED_OFFSET	   (-20)
+#define SQL_UNSIGNED_OFFSET		   (-22)
+
+#define SQL_C_SLONG			   (SQL_C_LONG	+ SQL_SIGNED_OFFSET)
+#define SQL_C_SSHORT		   (SQL_C_SHORT + SQL_SIGNED_OFFSET)
+#define SQL_C_STINYINT		   (SQL_TINYINT + SQL_SIGNED_OFFSET)
+#define SQL_C_ULONG			   (SQL_C_LONG	+ SQL_UNSIGNED_OFFSET)
+#define SQL_C_USHORT		   (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
+#define SQL_C_UTINYINT		   (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
+#define SQL_C_BOOKMARK		   SQL_C_ULONG
+
+#if defined(SQL_TYPE_MIN)
+#undef	SQL_TYPE_MIN
+#define SQL_TYPE_MIN		 SQL_BIT
+/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
+ *	SQL_TYPE_MIN need to be defined as SQL_TINYINT
  *	(i.e. -6).
  */
-# endif
+#endif
 
-# define SQL_ALL_TYPES			0
+#define SQL_ALL_TYPES		   0
 
 /* SQLDriverConnect flag values */
-# define SQL_DRIVER_NOPROMPT		0
-# define SQL_DRIVER_COMPLETE		1
-# define SQL_DRIVER_PROMPT		2
-# define SQL_DRIVER_COMPLETE_REQUIRED	3
+#define SQL_DRIVER_NOPROMPT		   0
+#define SQL_DRIVER_COMPLETE		   1
+#define SQL_DRIVER_PROMPT	   2
+#define SQL_DRIVER_COMPLETE_REQUIRED   3
 
 /* SQLSetParam extensions */
-# define SQL_DEFAULT_PARAM		(-5)
-# define SQL_IGNORE			(-6)
+#define SQL_DEFAULT_PARAM	   (-5)
+#define SQL_IGNORE		   (-6)
 
 /* function number for SQLGetFunctions and _iodbcdm_getproc */
-# define SQL_API_SQLALLOCCONNECT	1   
-# define SQL_API_SQLALLOCENV		2
-# define SQL_API_SQLALLOCSTMT		3
-# define SQL_API_SQLBINDCOL		4
-# define SQL_API_SQLCANCEL		5
-# define SQL_API_SQLCOLATTRIBUTES	6
-# define SQL_API_SQLCONNECT		7
-# define SQL_API_SQLDESCRIBECOL		8
-# define SQL_API_SQLDISCONNECT		9
-# define SQL_API_SQLERROR		10
-# define SQL_API_SQLEXECDIRECT		11
-# define SQL_API_SQLEXECUTE		12
-# define SQL_API_SQLFETCH		13
-# define SQL_API_SQLFREECONNECT		14
-# define SQL_API_SQLFREEENV		15
-# define SQL_API_SQLFREESTMT		16 
-# define SQL_API_SQLGETCURSORNAME	17
-# define SQL_API_SQLNUMRESULTCOLS	18
-# define SQL_API_SQLPREPARE		19
-# define SQL_API_SQLROWCOUNT		20
-# define SQL_API_SQLSETCURSORNAME	21
-# define SQL_API_SQLSETPARAM		22
-# define SQL_API_SQLTRANSACT		23
-
-# define SQL_NUM_FUNCTIONS		23
-
-# define SQL_EXT_API_START		40
-
-# define SQL_API_SQLCOLUMNS		40
-
-# define SQL_API_SQLDRIVERCONNECT	41
-# define SQL_API_SQLGETCONNECTOPTION	42
-# define SQL_API_SQLGETDATA		43
-# define SQL_API_SQLGETFUNCTIONS	44
-# define SQL_API_SQLGETINFO		45
-# define SQL_API_SQLGETSTMTOPTION	46
-# define SQL_API_SQLGETTYPEINFO		47
-# define SQL_API_SQLPARAMDATA		48
-# define SQL_API_SQLPUTDATA		49
-# define SQL_API_SQLSETCONNECTOPTION	50
-# define SQL_API_SQLSETSTMTOPTION	51
-# define SQL_API_SQLSPECIALCOLUMNS	52
-# define SQL_API_SQLSTATISTICS		53
-# define SQL_API_SQLTABLES		54
-
-# define SQL_API_SQLBROWSECONNECT	55
-# define SQL_API_SQLCOLUMNPRIVILEGES	56
-# define SQL_API_SQLDATASOURCES		57
-# define SQL_API_SQLDESCRIBEPARAM	58
-# define SQL_API_SQLEXTENDEDFETCH	59
-# define SQL_API_SQLFOREIGNKEYS		60
-# define SQL_API_SQLMORERESULTS		61
-# define SQL_API_SQLNATIVESQL		62
-# define SQL_API_SQLNUMPARAMS		63
-# define SQL_API_SQLPARAMOPTIONS	64
-# define SQL_API_SQLPRIMARYKEYS		65
-# define SQL_API_SQLPROCEDURECOLUMNS	66
-# define SQL_API_SQLPROCEDURES		67
-# define SQL_API_SQLSETPOS		68
-# define SQL_API_SQLSETSCROLLOPTIONS	69
-# define SQL_API_SQLTABLEPRIVILEGES	70
-
-# define SQL_API_SQLDRIVERS          	71
-# define SQL_API_SQLBINDPARAMETER	72
-# define SQL_EXT_API_LAST		SQL_API_SQLBINDPARAMETER
+#define SQL_API_SQLALLOCCONNECT    1
+#define SQL_API_SQLALLOCENV		   2
+#define SQL_API_SQLALLOCSTMT	   3
+#define SQL_API_SQLBINDCOL	   4
+#define SQL_API_SQLCANCEL	   5
+#define SQL_API_SQLCOLATTRIBUTES   6
+#define SQL_API_SQLCONNECT	   7
+#define SQL_API_SQLDESCRIBECOL	   8
+#define SQL_API_SQLDISCONNECT	   9
+#define SQL_API_SQLERROR	   10
+#define SQL_API_SQLEXECDIRECT	   11
+#define SQL_API_SQLEXECUTE	   12
+#define SQL_API_SQLFETCH	   13
+#define SQL_API_SQLFREECONNECT	   14
+#define SQL_API_SQLFREEENV	   15
+#define SQL_API_SQLFREESTMT		   16
+#define SQL_API_SQLGETCURSORNAME   17
+#define SQL_API_SQLNUMRESULTCOLS   18
+#define SQL_API_SQLPREPARE	   19
+#define SQL_API_SQLROWCOUNT		   20
+#define SQL_API_SQLSETCURSORNAME   21
+#define SQL_API_SQLSETPARAM		   22
+#define SQL_API_SQLTRANSACT		   23
+
+#define SQL_NUM_FUNCTIONS	   23
+
+#define SQL_EXT_API_START	   40
+
+#define SQL_API_SQLCOLUMNS	   40
+
+#define SQL_API_SQLDRIVERCONNECT   41
+#define SQL_API_SQLGETCONNECTOPTION    42
+#define SQL_API_SQLGETDATA	   43
+#define SQL_API_SQLGETFUNCTIONS    44
+#define SQL_API_SQLGETINFO	   45
+#define SQL_API_SQLGETSTMTOPTION   46
+#define SQL_API_SQLGETTYPEINFO	   47
+#define SQL_API_SQLPARAMDATA	   48
+#define SQL_API_SQLPUTDATA	   49
+#define SQL_API_SQLSETCONNECTOPTION    50
+#define SQL_API_SQLSETSTMTOPTION   51
+#define SQL_API_SQLSPECIALCOLUMNS  52
+#define SQL_API_SQLSTATISTICS	   53
+#define SQL_API_SQLTABLES	   54
+
+#define SQL_API_SQLBROWSECONNECT   55
+#define SQL_API_SQLCOLUMNPRIVILEGES    56
+#define SQL_API_SQLDATASOURCES	   57
+#define SQL_API_SQLDESCRIBEPARAM   58
+#define SQL_API_SQLEXTENDEDFETCH   59
+#define SQL_API_SQLFOREIGNKEYS	   60
+#define SQL_API_SQLMORERESULTS	   61
+#define SQL_API_SQLNATIVESQL	   62
+#define SQL_API_SQLNUMPARAMS	   63
+#define SQL_API_SQLPARAMOPTIONS    64
+#define SQL_API_SQLPRIMARYKEYS	   65
+#define SQL_API_SQLPROCEDURECOLUMNS    66
+#define SQL_API_SQLPROCEDURES	   67
+#define SQL_API_SQLSETPOS	   68
+#define SQL_API_SQLSETSCROLLOPTIONS    69
+#define SQL_API_SQLTABLEPRIVILEGES 70
+
+#define SQL_API_SQLDRIVERS			   71
+#define SQL_API_SQLBINDPARAMETER   72
+#define SQL_EXT_API_LAST	   SQL_API_SQLBINDPARAMETER
 #define SQL_NUM_EXTENSIONS	(SQL_EXT_API_LAST - SQL_EXT_API_START + 1)
 
-# define SQL_API_ALL_FUNCTIONS		0
+#define SQL_API_ALL_FUNCTIONS	   0
 
 /* SQLGetInfo infor number */
-# define SQL_INFO_FIRST			0
-# define SQL_DRIVER_HDBC		3
-# define SQL_DRIVER_HENV		4
-# define SQL_DRIVER_HSTMT		5
-# define SQL_DRIVER_NAME		6
-# define SQL_ODBC_VER			10
-# define SQL_CURSOR_COMMIT_BEHAVIOR	23
-# define SQL_CURSOR_ROLLBACK_BEHAVIOR	24
-# define SQL_DEFAULT_TXN_ISOLATION	26
+#define SQL_INFO_FIRST		   0
+#define SQL_DRIVER_HDBC		   3
+#define SQL_DRIVER_HENV		   4
+#define SQL_DRIVER_HSTMT	   5
+#define SQL_DRIVER_NAME		   6
+#define SQL_ODBC_VER		   10
+#define SQL_CURSOR_COMMIT_BEHAVIOR 23
+#define SQL_CURSOR_ROLLBACK_BEHAVIOR   24
+#define SQL_DEFAULT_TXN_ISOLATION  26
 
-# define SQL_TXN_ISOLATION_OPTION	72
-# define SQL_NON_NULLABLE_COLUMNS	75
+#define SQL_TXN_ISOLATION_OPTION   72
+#define SQL_NON_NULLABLE_COLUMNS   75
 
-# define SQL_DRIVER_HLIB		76
-# define SQL_DRIVER_ODBC_VER		77
+#define SQL_DRIVER_HLIB		   76
+#define SQL_DRIVER_ODBC_VER		   77
 
-# define SQL_QUALIFIER_LOCATION		114
+#define SQL_QUALIFIER_LOCATION	   114
 
-# define SQL_INFO_LAST			SQL_QUALIFIER_LOCATION
+#define SQL_INFO_LAST		   SQL_QUALIFIER_LOCATION
 
-# define SQL_INFO_DRIVER_START		1000
+#define SQL_INFO_DRIVER_START	   1000
 
 
 /* SQL_TXN_ISOLATION_OPTION masks */
-# define SQL_TXN_READ_UNCOMMITTED	0x00000001L
-# define SQL_TXN_READ_COMMITTED		0x00000002L
-# define SQL_TXN_REPEATABLE_READ 	0x00000004L
-# define SQL_TXN_SERIALIZABLE		0x00000008L
-# define SQL_TXN_VERSIONING		0x00000010L
+#define SQL_TXN_READ_UNCOMMITTED   0x00000001L
+#define SQL_TXN_READ_COMMITTED	   0x00000002L
+#define SQL_TXN_REPEATABLE_READ    0x00000004L
+#define SQL_TXN_SERIALIZABLE	   0x00000008L
+#define SQL_TXN_VERSIONING	   0x00000010L
 
 /* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
 
-# define SQL_CB_DELETE			0x0000
-# define SQL_CB_CLOSE			0x0001
-# define SQL_CB_PRESERVE		0x0002
+#define SQL_CB_DELETE		   0x0000
+#define SQL_CB_CLOSE		   0x0001
+#define SQL_CB_PRESERVE		   0x0002
 
 /* options for SQLGetStmtOption/SQLSetStmtOption */
-# define SQL_QUERY_TIMEOUT		0
-# define SQL_MAX_ROWS			1
-# define SQL_NOSCAN			2
-# define SQL_MAX_LENGTH			3
-# define SQL_ASYNC_ENABLE		4
-# define SQL_BIND_TYPE			5
-# define SQL_CURSOR_TYPE 		6
-# define SQL_CONCURRENCY 		7
-# define SQL_KEYSET_SIZE 		8
-# define SQL_ROWSET_SIZE 		9
-# define SQL_SIMULATE_CURSOR 		10
-# define SQL_RETRIEVE_DATA		11
-# define SQL_USE_BOOKMARKS		12
-# define SQL_GET_BOOKMARK		13	/* GetStmtOption Only */
-# define SQL_ROW_NUMBER			14	/* GetStmtOption Only */
-# define SQL_STMT_OPT_MAX		SQL_ROW_NUMBER
-
-# define SQL_STMT_OPT_MIN		SQL_QUERY_TIMEOUT
+#define SQL_QUERY_TIMEOUT	   0
+#define SQL_MAX_ROWS		   1
+#define SQL_NOSCAN		   2
+#define SQL_MAX_LENGTH		   3
+#define SQL_ASYNC_ENABLE	   4
+#define SQL_BIND_TYPE		   5
+#define SQL_CURSOR_TYPE		   6
+#define SQL_CONCURRENCY		   7
+#define SQL_KEYSET_SIZE		   8
+#define SQL_ROWSET_SIZE		   9
+#define SQL_SIMULATE_CURSOR		   10
+#define SQL_RETRIEVE_DATA	   11
+#define SQL_USE_BOOKMARKS	   12
+#define SQL_GET_BOOKMARK	   13		/* GetStmtOption Only */
+#define SQL_ROW_NUMBER		   14		/* GetStmtOption Only */
+#define SQL_STMT_OPT_MAX	   SQL_ROW_NUMBER
+
+#define SQL_STMT_OPT_MIN	   SQL_QUERY_TIMEOUT
 
 /*
  * ODBC 3.0 renames the above to SQL_ATTR_ values. At this time I don't
  * know if they have also been renumbered or not, I will assume not.
  */
-# define SQL_ATTR_QUERY_TIMEOUT		0
-# define SQL_ATTR_MAX_ROWS		1
-# define SQL_ATTR_NOSCAN		2
-# define SQL_ATTR_MAX_LENGTH		3
-# define SQL_ATTR_ASYNC_ENABLE		4
-# define SQL_ATTR_BIND_TYPE		5
-# define SQL_ATTR_CURSOR_TYPE 		6
-# define SQL_ATTR_CONCURRENCY 		7
-# define SQL_ATTR_KEYSET_SIZE 		8
-# define SQL_ATTR_ROWSET_SIZE 		9
-# define SQL_ATTR_SIMULATE_CURSOR 	10
-# define SQL_ATTR_RETRIEVE_DATA		11
-# define SQL_ATTR_USE_BOOKMARKS		12
-# define SQL_ATTR_GET_BOOKMARK		13	/* GetStmtOption Only */
-# define SQL_ATTR_ROW_NUMBER		14	/* GetStmtOption Only */
+#define SQL_ATTR_QUERY_TIMEOUT	   0
+#define SQL_ATTR_MAX_ROWS	   1
+#define SQL_ATTR_NOSCAN		   2
+#define SQL_ATTR_MAX_LENGTH		   3
+#define SQL_ATTR_ASYNC_ENABLE	   4
+#define SQL_ATTR_BIND_TYPE	   5
+#define SQL_ATTR_CURSOR_TYPE	   6
+#define SQL_ATTR_CONCURRENCY	   7
+#define SQL_ATTR_KEYSET_SIZE	   8
+#define SQL_ATTR_ROWSET_SIZE	   9
+#define SQL_ATTR_SIMULATE_CURSOR   10
+#define SQL_ATTR_RETRIEVE_DATA	   11
+#define SQL_ATTR_USE_BOOKMARKS	   12
+#define SQL_ATTR_GET_BOOKMARK	   13	/* GetStmtOption Only */
+#define SQL_ATTR_ROW_NUMBER		   14	/* GetStmtOption Only */
 
 /* New in ODBC 3.0	*/
 #define SQL_ATTR_APP_PARAM_DESC		15
@@ -216,7 +216,7 @@
 #define SQL_ATTR_CURSOR_SCROLLABLE	17
 #define SQL_ATTR_CURSOR_SENSITITY	18
 #define SQL_ATTR_ENABLE_AUTO_IPD	19
-#define SQL_ATTR_FETCH_BOOKMARK_PTR	20
+#define SQL_ATTR_FETCH_BOOKMARK_PTR 20
 #define SQL_ATTR_IMP_PARAM_DESC		21
 #define SQL_ATTR_IMP_ROW_DESC		22
 #define SQL_ATTR_METADATA_ID		23
@@ -236,80 +236,80 @@
 #define SQL_STMT_ATTR_MAX		SQL_ATTR_ROWS_FETCHED_PTR
 
 /* SQL_QUERY_TIMEOUT options */
-# define SQL_QUERY_TIMEOUT_DEFAULT	0UL
+#define SQL_QUERY_TIMEOUT_DEFAULT  0UL
 
 /* SQL_MAX_ROWS options */
-# define SQL_MAX_ROWS_DEFAULT		0UL
+#define SQL_MAX_ROWS_DEFAULT	   0UL
 
 /* SQL_MAX_LENGTH options */
-# define SQL_MAX_LENGTH_DEFAULT		0UL
+#define SQL_MAX_LENGTH_DEFAULT	   0UL
 
 /* SQL_CONCURRENCY options */
-# define SQL_CONCUR_READ_ONLY		1
-# define SQL_CONCUR_LOCK 		2
-# define SQL_CONCUR_ROWVER		3
-# define SQL_CONCUR_VALUES		4
+#define SQL_CONCUR_READ_ONLY	   1
+#define SQL_CONCUR_LOCK		   2
+#define SQL_CONCUR_ROWVER	   3
+#define SQL_CONCUR_VALUES	   4
 
 /* options for SQLSetConnectOption/SQLGetConnectOption */
-# define SQL_ACCESS_MODE 		101
-# define SQL_AUTOCOMMIT			102
-# define SQL_LOGIN_TIMEOUT		103
-# define SQL_OPT_TRACE			104
-# define SQL_OPT_TRACEFILE		105
-# define SQL_TRANSLATE_DLL		106
-# define SQL_TRANSLATE_OPTION		107
-# define SQL_TXN_ISOLATION		108
-# define SQL_CURRENT_QUALIFIER		109
-# define SQL_ODBC_CURSORS		110
-# define SQL_QUIET_MODE			111
-# define SQL_PACKET_SIZE 		112
-# define SQL_CONN_OPT_MAX		SQL_PACKET_SIZE
-# define SQL_CONNECT_OPT_DRVR_START	1000
-
-# define SQL_CONN_OPT_MIN		SQL_ACCESS_MODE
+#define SQL_ACCESS_MODE		   101
+#define SQL_AUTOCOMMIT		   102
+#define SQL_LOGIN_TIMEOUT	   103
+#define SQL_OPT_TRACE		   104
+#define SQL_OPT_TRACEFILE	   105
+#define SQL_TRANSLATE_DLL	   106
+#define SQL_TRANSLATE_OPTION	   107
+#define SQL_TXN_ISOLATION	   108
+#define SQL_CURRENT_QUALIFIER	   109
+#define SQL_ODBC_CURSORS	   110
+#define SQL_QUIET_MODE		   111
+#define SQL_PACKET_SIZE		   112
+#define SQL_CONN_OPT_MAX	   SQL_PACKET_SIZE
+#define SQL_CONNECT_OPT_DRVR_START 1000
+
+#define SQL_CONN_OPT_MIN	   SQL_ACCESS_MODE
 
 /* SQL_ACCESS_MODE options */
-# define SQL_MODE_READ_WRITE 		0UL
-# define SQL_MODE_READ_ONLY		1UL
-# define SQL_MODE_DEFAULT		SQL_MODE_READ_WRITE
+#define SQL_MODE_READ_WRITE		   0UL
+#define SQL_MODE_READ_ONLY	   1UL
+#define SQL_MODE_DEFAULT	   SQL_MODE_READ_WRITE
 
 /* SQL_AUTOCOMMIT options */
-# define SQL_AUTOCOMMIT_OFF		0UL
-# define SQL_AUTOCOMMIT_ON		1UL
-# define SQL_AUTOCOMMIT_DEFAULT		SQL_AUTOCOMMIT_ON
+#define SQL_AUTOCOMMIT_OFF	   0UL
+#define SQL_AUTOCOMMIT_ON	   1UL
+#define SQL_AUTOCOMMIT_DEFAULT	   SQL_AUTOCOMMIT_ON
 
 /* SQL_LOGIN_TIMEOUT options */
-# define SQL_LOGIN_TIMEOUT_DEFAULT	15UL
+#define SQL_LOGIN_TIMEOUT_DEFAULT  15UL
 
 /* SQL_OPT_TRACE options */
-# define SQL_OPT_TRACE_OFF		0UL
-# define SQL_OPT_TRACE_ON		1UL
-# define SQL_OPT_TRACE_DEFAULT		SQL_OPT_TRACE_OFF
-# define SQL_OPT_TRACE_FILE_DEFAULT	"odbc.log"
+#define SQL_OPT_TRACE_OFF	   0UL
+#define SQL_OPT_TRACE_ON	   1UL
+#define SQL_OPT_TRACE_DEFAULT	   SQL_OPT_TRACE_OFF
+#define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log"
 
 /* SQL_ODBC_CURSORS options */
-# define SQL_CUR_USE_IF_NEEDED		0UL
-# define SQL_CUR_USE_ODBC		1UL
-# define SQL_CUR_USE_DRIVER		2UL
-# define SQL_CUR_DEFAULT 		SQL_CUR_USE_DRIVER
+#define SQL_CUR_USE_IF_NEEDED	   0UL
+#define SQL_CUR_USE_ODBC	   1UL
+#define SQL_CUR_USE_DRIVER	   2UL
+#define SQL_CUR_DEFAULT		   SQL_CUR_USE_DRIVER
 
 /* Column types and scopes in SQLSpecialColumns. */
-# define SQL_BEST_ROWID			1
-# define SQL_ROWVER			2
+#define SQL_BEST_ROWID		   1
+#define SQL_ROWVER		   2
 
-# define SQL_SCOPE_CURROW		0
-# define SQL_SCOPE_TRANSACTION		1
-# define SQL_SCOPE_SESSION		2
+#define SQL_SCOPE_CURROW	   0
+#define SQL_SCOPE_TRANSACTION	   1
+#define SQL_SCOPE_SESSION	   2
 
 
 /* SQLExtendedFetch flag values */
-# define SQL_FETCH_NEXT			1
-# define SQL_FETCH_FIRST 		2
-# define SQL_FETCH_LAST			3
-# define SQL_FETCH_PRIOR		4
-# define SQL_FETCH_ABSOLUTE		5
-# define SQL_FETCH_RELATIVE		6
-# define SQL_FETCH_BOOKMARK		8
+#define SQL_FETCH_NEXT		   1
+#define SQL_FETCH_FIRST		   2
+#define SQL_FETCH_LAST		   3
+#define SQL_FETCH_PRIOR		   4
+#define SQL_FETCH_ABSOLUTE	   5
+#define SQL_FETCH_RELATIVE	   6
+#define SQL_FETCH_BOOKMARK	   8
 
 /* Defines for SQLBindParameter/SQLProcedureColumns */
 #define SQL_PARAM_TYPE_UNKNOWN		0
@@ -320,21 +320,21 @@
 #define SQL_RETURN_VALUE		5
 
 /* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
-# define SQL_PARAM_TYPE_DEFAULT		SQL_PARAM_INPUT_OUTPUT
-# define SQL_SETPARAM_VALUE_MAX		(-1L)
+#define SQL_PARAM_TYPE_DEFAULT	   SQL_PARAM_INPUT_OUTPUT
+#define SQL_SETPARAM_VALUE_MAX	   (-1L)
 
 /* SQLStatistics flag values */
-# define SQL_INDEX_UNIQUE		0
-# define SQL_INDEX_ALL			1
+#define SQL_INDEX_UNIQUE	   0
+#define SQL_INDEX_ALL		   1
 
-# define SQL_QUICK			0
-# define SQL_ENSURE			1
+#define SQL_QUICK		   0
+#define SQL_ENSURE		   1
 
 /* SQLSetScrollOption flag values */
-# define SQL_SCROLL_FORWARD_ONLY	0L
-# define SQL_SCROLL_KEYSET_DRIVEN	(-1L)
-# define SQL_SCROLL_DYNAMIC		(-2L)
-# define SQL_SCROLL_STATIC		(-3L) 
+#define SQL_SCROLL_FORWARD_ONLY    0L
+#define SQL_SCROLL_KEYSET_DRIVEN   (-1L)
+#define SQL_SCROLL_DYNAMIC	   (-2L)
+#define SQL_SCROLL_STATIC	   (-3L)
 
 /* Everything below has been added to the original isqlext.h that comes
  * with iodbc.
@@ -345,58 +345,67 @@
 #define DOUBLE	double
 
 /* SQL DATA TYPES */
-typedef	UCHAR	SQLCHAR;
-typedef SWORD	SQLSMALLINT;
-typedef UWORD	SQLUSMALLINT;
-typedef SDWORD	SQLINTEGER;
-typedef UDWORD	SQLUINTEGER;
-typedef FLOAT	SQLREAL;
-typedef DOUBLE	SQLDOUBLE;
-typedef DOUBLE	SQLFLOAT;
-typedef SCHAR	SQLSCHAR;
-typedef UDWORD	BOOKMARK;
-
-#ifdef GCC	/* Because I know GCC supports 64 bit ints */
+typedef UCHAR SQLCHAR;
+typedef SWORD SQLSMALLINT;
+typedef UWORD SQLUSMALLINT;
+typedef SDWORD SQLINTEGER;
+typedef UDWORD SQLUINTEGER;
+typedef FLOAT SQLREAL;
+typedef DOUBLE SQLDOUBLE;
+typedef DOUBLE SQLFLOAT;
+typedef SCHAR SQLSCHAR;
+typedef UDWORD BOOKMARK;
+
+#ifdef GCC						/* Because I know GCC supports 64 bit ints */
 
 typedef long long int ODBCINT64;
-typedef unsigned ODBCINT64	SQLUBIGINT;
-typedef ODBCINT64		SQLBIGINT;
+typedef unsigned ODBCINT64 SQLUBIGINT;
+typedef ODBCINT64 SQLBIGINT;
 
-#else		/* Used even on platforms with 64 bit ints but not GCC */
+#else							/* Used even on platforms with 64 bit ints
+								 * but not GCC */
 
-typedef struct {
+typedef struct
+{
 	SQLUINTEGER dwLowWord;
 	SQLUINTEGER dwHighWord;
 } SQLUBIGINT;
 
-typedef struct {
+typedef struct
+{
 	SQLUINTEGER dwLowWord;
-	SQLINTEGER  dwHighWord;
+	SQLINTEGER	dwHighWord;
 } SQLBIGINT;
 
-#endif /* GCC */
-
-typedef struct tagDATE_STRUCT {
-	SQLSMALLINT	year;
-	SQLUSMALLINT	month;
-	SQLUSMALLINT	day;
-} DATE_STRUCT,SQL_DATE_STRUCT;
-
-typedef struct tagTIME_STRUCT {
-	SQLUSMALLINT	hour;
-	SQLUSMALLINT	minute;
-	SQLUSMALLINT	second;
-} TIME_STRUCT,SQL_TIME_STRUCT;
-
-typedef struct tagTIMESTAMP_STRUCT {
-	SQLSMALLINT	year;
-	SQLUSMALLINT	month;
-	SQLUSMALLINT	day;
-	SQLUSMALLINT	hour;
-	SQLUSMALLINT	minute;
-	SQLUSMALLINT	second;
-	SQLUINTEGER	fraction;
-} TIMESTAMP_STRUCT,SQL_TIMESTAMP_STRUCT;
+#endif	 /* GCC */
+
+typedef struct tagDATE_STRUCT
+{
+	SQLSMALLINT year;
+	SQLUSMALLINT month;
+	SQLUSMALLINT day;
+} DATE_STRUCT,
+SQL_DATE_STRUCT;
+
+typedef struct tagTIME_STRUCT
+{
+	SQLUSMALLINT hour;
+	SQLUSMALLINT minute;
+	SQLUSMALLINT second;
+} TIME_STRUCT,
+SQL_TIME_STRUCT;
+
+typedef struct tagTIMESTAMP_STRUCT
+{
+	SQLSMALLINT year;
+	SQLUSMALLINT month;
+	SQLUSMALLINT day;
+	SQLUSMALLINT hour;
+	SQLUSMALLINT minute;
+	SQLUSMALLINT second;
+	SQLUINTEGER fraction;
+} TIMESTAMP_STRUCT,
+SQL_TIMESTAMP_STRUCT;
 
 /* postodbc doesn't use these but what the heck */
 /* Don't know what SQL_MAX_NUMERIC_LEN should be so I can't include this. It's
@@ -411,14 +420,16 @@ typedef struct tagSQL_NUMERIC_STRUCT {
 
 */
 
-typedef struct tagSQLGUID {
-	DWORD	Data1;
-	WORD	Data2;
-	WORD	Data3;
-	BYTE	Data4[8];
+typedef struct tagSQLGUID
+{
+	DWORD		Data1;
+	WORD		Data2;
+	WORD		Data3;
+	BYTE		Data4[8];
 } SQLGUID;
 
-typedef enum {
+typedef enum
+{
 	SQL_IS_YEAR = 1,
 	SQL_IS_MONTH = 2,
 	SQL_IS_DAY = 3,
@@ -434,26 +445,30 @@ typedef enum {
 	SQL_IS_MINUTE_TO_SECOND = 13
 } SQLINTERVAL;
 
-typedef struct tagSQL_YEAR_MONTH {
-	SQLUINTEGER	year;
-	SQLUINTEGER	month;
+typedef struct tagSQL_YEAR_MONTH
+{
+	SQLUINTEGER year;
+	SQLUINTEGER month;
 } SQL_YEAR_MONTH_STRUCT;
 
-typedef struct tagSQL_DAY_SECOND {
-	SQLUINTEGER	day;
-	SQLUINTEGER	hour;
-	SQLUINTEGER	minute;
-	SQLUINTEGER	second;
-	SQLUINTEGER	fraction;
+typedef struct tagSQL_DAY_SECOND
+{
+	SQLUINTEGER day;
+	SQLUINTEGER hour;
+	SQLUINTEGER minute;
+	SQLUINTEGER second;
+	SQLUINTEGER fraction;
 } SQL_DAY_SECOND_STRUCT;
 
-typedef struct tagSQL_INTERVAL_STRUCT {
-	SQLINTERVAL	interval_type;
-	SQLSMALLINT	interval_sign;
-	union {
-		SQL_YEAR_MONTH_STRUCT	year_month;
-		SQL_DAY_SECOND_STRUCT	day_second;
-	} intval;
+typedef struct tagSQL_INTERVAL_STRUCT
+{
+	SQLINTERVAL interval_type;
+	SQLSMALLINT interval_sign;
+	union
+	{
+		SQL_YEAR_MONTH_STRUCT year_month;
+		SQL_DAY_SECOND_STRUCT day_second;
+	}			intval;
 } SQL_INTERVAL_STRUCT;
 
 #define SQL_MAX_OPTION_STRING_LENGTH	256
@@ -491,8 +506,8 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_INTERVAL_DAY_TO_HOUR	(-87)
 #define SQL_INTERVAL_DAY_TO_MINUTE	(-88)
 #define SQL_INTERVAL_DAY_TO_SECOND	(-89)
-#define SQL_INTERVAL_HOUR_TO_MINUTE	(-90)
-#define SQL_INTERVAL_HOUR_TO_SECOND	(-91)
+#define SQL_INTERVAL_HOUR_TO_MINUTE (-90)
+#define SQL_INTERVAL_HOUR_TO_SECOND (-91)
 #define SQL_INTERVAL_MINUTE_TO_SECOND	(-92)
 
 #define SQL_UNICODE			(-95)
@@ -519,7 +534,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_C_INTERVAL_DAY_TO_SECOND	SQL_INTERVAL_DAY_TO_SECOND
 #define SQL_C_INTERVAL_HOUR_TO_MINUTE	SQL_INTERVAL_HOUR_TO_MINUTE
 #define SQL_C_INTERVAL_HOUR_TO_SECOND	SQL_INTERVAL_HOUR_TO_SECOND
-#define SQL_C_INTERVAL_MINUTE_TO_SECOND	SQL_INTERVAL_MINUTE_TO_SECOND
+#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND
 #define SQL_C_NUMERIC		SQL_NUMERIC
 #define SQL_C_VARBOOKMARK	SQL_C_BINARY
 #define SQL_C_SBIGINT		(SQL_BIGINT + SQL_SIGNED_OFFSET)
@@ -532,11 +547,11 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_NO_TOTAL			(-4)
 
 /* SQLBindParameter */
-#define SQL_LEN_DATA_AT_EXEC_OFFSET	(-100)
+#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
 #define SQL_LEN_DATA_AT_EXEC(length)	(-length+SQL_LEN_DATA_AT_EXEC_OFFSET)
 
 #define SQL_LEN_BINARY_ATTR_OFFSET	(-100)
-#define SQL_LEN_BINARY_ATTR(length)	(-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
+#define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
 
 /* SQLExtendedFetch - row status */
 #define SQL_ROW_SUCCESS		0
@@ -555,7 +570,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 
 /* SQLForeignKeys - Deferrability (ODBC 3.0) */
 #define SQL_INITIALLY_DEFERRED	5
-#define SQL_INITIALLY_IMMEDIATE	6
+#define SQL_INITIALLY_IMMEDIATE 6
 #define SQL_NOT_DEFFERABLE	2
 
 /* Constants not in isqlext.h but needed by the driver. I have no idea
@@ -566,109 +581,109 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 */
 
 /*
- *  SQLGetInfo
+ *	SQLGetInfo
  */
 #define SQL_ACTIVE_CONNECTIONS			0
 #define SQL_ACTIVE_STATEMENTS			1
 #define SQL_DATA_SOURCE_NAME			2
-#define SQL_DRIVER_VER				7 
+#define SQL_DRIVER_VER				7
 #define SQL_FETCH_DIRECTION			8
-#define SQL_ODBC_API_CONFORMANCE		9 
-#define SQL_ROW_UPDATES				11 
-#define SQL_ODBC_SAG_CLI_CONFORMANCE		12 
+#define SQL_ODBC_API_CONFORMANCE		9
+#define SQL_ROW_UPDATES				11
+#define SQL_ODBC_SAG_CLI_CONFORMANCE		12
 #define SQL_SERVER_NAME				13
 #define SQL_SEARCH_PATTERN_ESCAPE		14
-#define SQL_ODBC_SQL_CONFORMANCE		15 
+#define SQL_ODBC_SQL_CONFORMANCE		15
 #define SQL_DBMS_NAME				17
 #define SQL_DBMS_VER				18
 #define SQL_ACCESSIBLE_TABLES			19
 #define SQL_ACCESSIBLE_PROCEDURES		20
-#define SQL_PROCEDURES				21 
-#define SQL_CONCAT_NULL_BEHAVIOR		22 
+#define SQL_PROCEDURES				21
+#define SQL_CONCAT_NULL_BEHAVIOR		22
 #define SQL_DATA_SOURCE_READ_ONLY		25
-#define SQL_EXPRESSIONS_IN_ORDERBY		27 
+#define SQL_EXPRESSIONS_IN_ORDERBY		27
 #define SQL_IDENTIFIER_CASE			28
 #define SQL_IDENTIFIER_QUOTE_CHAR		29
 #define SQL_MAX_COLUMN_NAME_LEN			30
 #define SQL_MAX_CURSOR_NAME_LEN			31
 #define SQL_MAX_OWNER_NAME_LEN			32
-#define SQL_MAX_PROCEDURE_NAME_LEN		33 
+#define SQL_MAX_PROCEDURE_NAME_LEN		33
 #define SQL_MAX_QUALIFIER_NAME_LEN		34
 #define SQL_MAX_TABLE_NAME_LEN			35
-#define SQL_MULT_RESULT_SETS			36 
-#define SQL_MULTIPLE_ACTIVE_TXN			37 
-#define SQL_OUTER_JOINS				38 
-#define SQL_OWNER_TERM				39 
-#define SQL_PROCEDURE_TERM			40 
-#define SQL_QUALIFIER_NAME_SEPARATOR		41 
-#define SQL_QUALIFIER_TERM			42 
+#define SQL_MULT_RESULT_SETS			36
+#define SQL_MULTIPLE_ACTIVE_TXN			37
+#define SQL_OUTER_JOINS				38
+#define SQL_OWNER_TERM				39
+#define SQL_PROCEDURE_TERM			40
+#define SQL_QUALIFIER_NAME_SEPARATOR		41
+#define SQL_QUALIFIER_TERM			42
 #define SQL_SCROLL_CONCURRENCY			43
-#define SQL_SCROLL_OPTIONS			44 
-#define SQL_TABLE_TERM				45 
+#define SQL_SCROLL_OPTIONS			44
+#define SQL_TABLE_TERM				45
 #define SQL_TXN_CAPABLE				46
 #define SQL_USER_NAME				47
-#define SQL_CONVERT_FUNCTIONS			48 
-#define SQL_NUMERIC_FUNCTIONS			49 
-#define SQL_STRING_FUNCTIONS			50 
-#define SQL_SYSTEM_FUNCTIONS			51 
-#define SQL_TIMEDATE_FUNCTIONS			52 
-#define SQL_CONVERT_BIGINT			53 
-#define SQL_CONVERT_BINARY			54 
-#define SQL_CONVERT_BIT				55 
-#define SQL_CONVERT_CHAR			56 
-#define SQL_CONVERT_DATE			57 
-#define SQL_CONVERT_DECIMAL			58 
-#define SQL_CONVERT_DOUBLE			59 
-#define SQL_CONVERT_FLOAT			60 
-#define SQL_CONVERT_INTEGER			61 
-#define SQL_CONVERT_LONGVARCHAR			62 
-#define SQL_CONVERT_NUMERIC			63 
-#define SQL_CONVERT_REAL			64 
-#define SQL_CONVERT_SMALLINT			65 
-#define SQL_CONVERT_TIME			66 
-#define SQL_CONVERT_TIMESTAMP			67 
-#define SQL_CONVERT_TINYINT			68 
-#define SQL_CONVERT_VARBINARY			69 
-#define SQL_CONVERT_VARCHAR			70 
-#define SQL_CONVERT_LONGVARBINARY		71 
+#define SQL_CONVERT_FUNCTIONS			48
+#define SQL_NUMERIC_FUNCTIONS			49
+#define SQL_STRING_FUNCTIONS			50
+#define SQL_SYSTEM_FUNCTIONS			51
+#define SQL_TIMEDATE_FUNCTIONS			52
+#define SQL_CONVERT_BIGINT			53
+#define SQL_CONVERT_BINARY			54
+#define SQL_CONVERT_BIT				55
+#define SQL_CONVERT_CHAR			56
+#define SQL_CONVERT_DATE			57
+#define SQL_CONVERT_DECIMAL			58
+#define SQL_CONVERT_DOUBLE			59
+#define SQL_CONVERT_FLOAT			60
+#define SQL_CONVERT_INTEGER			61
+#define SQL_CONVERT_LONGVARCHAR			62
+#define SQL_CONVERT_NUMERIC			63
+#define SQL_CONVERT_REAL			64
+#define SQL_CONVERT_SMALLINT			65
+#define SQL_CONVERT_TIME			66
+#define SQL_CONVERT_TIMESTAMP			67
+#define SQL_CONVERT_TINYINT			68
+#define SQL_CONVERT_VARBINARY			69
+#define SQL_CONVERT_VARCHAR			70
+#define SQL_CONVERT_LONGVARBINARY		71
 #define SQL_ODBC_SQL_OPT_IEF			73
-#define SQL_CORRELATION_NAME			74 
-#define SQL_LOCK_TYPES				78 
-#define SQL_POS_OPERATIONS			79 
-#define SQL_POSITIONED_STATEMENTS		80 
+#define SQL_CORRELATION_NAME			74
+#define SQL_LOCK_TYPES				78
+#define SQL_POS_OPERATIONS			79
+#define SQL_POSITIONED_STATEMENTS		80
 #define SQL_GETDATA_EXTENSIONS			81
-#define SQL_BOOKMARK_PERSISTENCE		82 
-#define SQL_STATIC_SENSITIVITY			83 
-#define SQL_FILE_USAGE				84 
+#define SQL_BOOKMARK_PERSISTENCE		82
+#define SQL_STATIC_SENSITIVITY			83
+#define SQL_FILE_USAGE				84
 #define SQL_NULL_COLLATION			85
 #define SQL_ALTER_TABLE				86
-#define SQL_COLUMN_ALIAS			87 
-#define SQL_GROUP_BY				88 
-#define SQL_KEYWORDS				89 
+#define SQL_COLUMN_ALIAS			87
+#define SQL_GROUP_BY				88
+#define SQL_KEYWORDS				89
 #define SQL_ORDER_BY_COLUMNS_IN_SELECT		90
-#define SQL_OWNER_USAGE				91 
-#define SQL_QUALIFIER_USAGE			92 
-#define SQL_QUOTED_IDENTIFIER_CASE		93 
+#define SQL_OWNER_USAGE				91
+#define SQL_QUALIFIER_USAGE			92
+#define SQL_QUOTED_IDENTIFIER_CASE		93
 #define SQL_SPECIAL_CHARACTERS			94
-#define SQL_SUBQUERIES				95 
-#define SQL_UNION				96 
+#define SQL_SUBQUERIES				95
+#define SQL_UNION				96
 #define SQL_MAX_COLUMNS_IN_GROUP_BY		97
 #define SQL_MAX_COLUMNS_IN_INDEX		98
 #define SQL_MAX_COLUMNS_IN_ORDER_BY		99
 #define SQL_MAX_COLUMNS_IN_SELECT		100
 #define SQL_MAX_COLUMNS_IN_TABLE		101
 #define SQL_MAX_INDEX_SIZE			102
-#define SQL_MAX_ROW_SIZE_INCLUDES_LONG		103 
+#define SQL_MAX_ROW_SIZE_INCLUDES_LONG		103
 #define SQL_MAX_ROW_SIZE			104
 #define SQL_MAX_STATEMENT_LEN			105
 #define SQL_MAX_TABLES_IN_SELECT		106
 #define SQL_MAX_USER_NAME_LEN			107
-#define SQL_MAX_CHAR_LITERAL_LEN		108 
-#define SQL_TIMEDATE_ADD_INTERVALS		109 
-#define SQL_TIMEDATE_DIFF_INTERVALS		110 
-#define SQL_NEED_LONG_DATA_LEN			111 
-#define SQL_MAX_BINARY_LITERAL_LEN		112 
-#define SQL_LIKE_ESCAPE_CLAUSE			113 
+#define SQL_MAX_CHAR_LITERAL_LEN		108
+#define SQL_TIMEDATE_ADD_INTERVALS		109
+#define SQL_TIMEDATE_DIFF_INTERVALS		110
+#define SQL_NEED_LONG_DATA_LEN			111
+#define SQL_MAX_BINARY_LITERAL_LEN		112
+#define SQL_LIKE_ESCAPE_CLAUSE			113
 
 #define SQL_OJ_CAPABILITIES			65003
 /* ODBC 3.0 alias */
@@ -709,7 +724,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_CVT_REAL		0x00000040L
 #define SQL_CVT_DOUBLE		0x00000080L
 #define SQL_CVT_VARCHAR		0x00000100L
-#define SQL_CVT_LONGVARCHAR	0x00000200L
+#define SQL_CVT_LONGVARCHAR 0x00000200L
 #define SQL_CVT_BINARY		0x00000400L
 #define SQL_CVT_VARBINARY	0x00000800L
 #define SQL_CVT_BIT		0x00001000L
@@ -721,20 +736,20 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_CVT_LONGVARBINARY	0x00040000L
 
 
-/*  extras added in ODBC 3.0 */
-#define SQL_CVT_INTERVAL_YEAR_MONTH	0x00080000L
+/*	extras added in ODBC 3.0 */
+#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L
 #define SQL_CVT_INTERVAL_DAY_TIME	0x00100000L
 
 /*
- *  concat null behaviour(2 byte val)
+ *	concat null behaviour(2 byte val)
  */
-#define SQL_CB_NULL 			0x0000
-#define SQL_CB_NON_NULL		 	0x0001
+#define SQL_CB_NULL				0x0000
+#define SQL_CB_NON_NULL			0x0001
 
 /*
- *  correlation name
+ *	correlation name
  */
-#define SQL_CN_NONE 			0x0000
+#define SQL_CN_NONE				0x0000
 #define SQL_CN_DIFFERENT		0x0001
 #define SQL_CN_ANY			0x0002
 
@@ -763,7 +778,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_FN_CVT_CONVERT	0x00000001L
 #define SQL_FN_CVT_CAST		0x00000002L
 
-/* 
+/*
  * File Usage. A SQLUSMALLINT indicating how a singel-tier driver treats
  * files in a data source.
  */
@@ -772,7 +787,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_FILE_QUALIFIER	0x0002
 #define SQL_FILE_CATALOG	SQL_FILE_CATALOG
 
-/* 
+/*
  * GetData Extensions. A SQLUINTEGER(4 bytes) bitmask enumerating extensions
  * to SQLGetData.
  */
@@ -781,14 +796,14 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_GD_BLOCK		0x00000004L
 #define SQL_GD_BOUND		0x00000008L
 
-/* 
+/*
  * Group By. A SQLUSMALLINT value specifying the relationship between the
  * columns in the GROUP BY clause and the non-aggregated columns in the
  * select list.
 */
 #define SQL_GB_NOT_SUPPORTED		0x0000
 #define SQL_GB_GROUP_BY_EQUALS_SELECT	0x0001
-#define SQL_GB_GROUP_BY_CONTAINS_SELECT	0x0002
+#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002
 #define SQL_GB_NO_RELATION		0x0003
 
 /* added in ODBC 3.0 */
@@ -892,24 +907,24 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_OSC_CORE		0x0001
 #define SQL_OSC_EXTENDED	0x0002
 
-/* 
+/*
  * Owner Usage. A SQLUINTEGER bitmask.
  */
 #define SQL_OU_DML_STATEMENTS		0x00000001L
-#define SQL_OU_PROCEDURE_INVOCATION	0x00000002L
+#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L
 #define SQL_OU_TABLE_DEFINITION		0x00000004L
 #define SQL_OU_INDEX_DEFINITION		0x00000008L
-#define SQL_OU_PRIVILEGE_DEFINITION	0x00000010L
+#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L
 
 /*
  * Schema Usage. A SQLUINTEGER bitmask enumerating the statements in which
  * schemas can be used. Renamed in ODBC 3.0 from SQL_OWNER_USAGE
  */
 #define SQL_SU_DML_STATEMENTS		SQL_OU_DML_STATEMENTS
-#define SQL_SU_PROCEDURE_INVOCATION	SQL_OU_PROCEDURE_INVOCATION
+#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION
 #define SQL_SU_TABLE_DEFINITION		SQL_OU_TABLE_DEFINITION
 #define SQL_SU_INDEX_DEFINITION		SQL_OU_INDEX_DEFINITION
-#define SQL_SU_PRIVILEGE_DEFINITION	SQL_OU_PRIVILEGE_DEFINITION
+#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION
 
 /*
  * Pos. Operations. A SQLINTEGER bitmask enumerating the supported operations
@@ -922,12 +937,12 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_POS_ADD		0x00000010L
 
 /*
- *  SQLSetPos
+ *	SQLSetPos
  */
 #define SQL_ENTIRE_ROWSET		0
 
 #define SQL_POSITION	0
-#define SQL_REFRESH	1
+#define SQL_REFRESH 1
 #define SQL_UPDATE	2
 #define SQL_DELETE	3
 #define SQL_ADD		4
@@ -935,22 +950,22 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 /*
  * SQLSetPos Lock options
 */
-#define SQL_LOCK_NO_CHANGE		0 	
-#define SQL_LOCK_EXCLUSIVE		1		
-#define SQL_LOCK_UNLOCK 		2
+#define SQL_LOCK_NO_CHANGE		0
+#define SQL_LOCK_EXCLUSIVE		1
+#define SQL_LOCK_UNLOCK			2
 
-#define SQL_POSITION_TO(hstmt,irow) 	\
-    SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
+#define SQL_POSITION_TO(hstmt,irow)		\
+	SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
 #define SQL_LOCK_RECORD(hstmt,irow,fLock) \
-    SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
+	SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
 #define SQL_REFRESH_RECORD(hstmt,irow,fLock) \
-    SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
+	SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
 #define SQL_UPDATE_RECORD(hstmt,irow) \
-    SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
+	SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
 #define SQL_DELETE_RECORD(hstmt,irow) \
-    SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
+	SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
 #define SQL_ADD_RECORD(hstmt,irow) \
-    SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
+	SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
 
 /*
  * Positioned Statements. A SQLINTEGER bitmask enumerating the supported
@@ -966,21 +981,21 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_QL_START		0x0001
 #define SQL_QL_END		0x0002
 
-/* 
+/*
  * Qualifier Usage. A SQLUINTEGER bitmask.
  */
 #define SQL_QU_DML_STATEMENTS		0x00000001L
-#define SQL_QU_PROCEDURE_INVOCATION	0x00000002L
+#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L
 #define SQL_QU_TABLE_DEFINITION		0x00000004L
 #define SQL_QU_INDEX_DEFINITION		0x00000008L
-#define SQL_QU_PRIVILEGE_DEFINITION	0x00000010L
+#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L
 
 /* The above is renamed in ODBC 3.0 to Catalog Usage. */
 #define SQL_CU_DML_STATEMENTS		SQL_QU_DML_STATEMENTS
-#define SQL_CU_PROCEDURE_INVOCATION	SQL_QU_PROCEDURE_INVOCATION
+#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION
 #define SQL_CU_TABLE_DEFINITION		SQL_QU_TABLE_DEFINITION
 #define SQL_CU_INDEX_DEFINITION		SQL_QU_INDEX_DEFINITION
-#define SQL_CU_PRIVILEGE_DEFINITION	SQL_QU_PRIVILEGE_DEFINITION
+#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION
 
 /* ODBC 3.0 renamed the above to Catalog Location. */
 #define SQL_CL_START		SQL_QL_START
@@ -996,7 +1011,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_SCCO_OPT_VALUES		0x00000008L
 
 
-/* 
+/*
  * Scroll Options. A SQLUINTEGER bitmask enumerating the scroll options
  * supported for scrollable cursors.
  */
@@ -1014,7 +1029,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
  */
 #define SQL_SS_ADDITIONS		0x00000001L
 #define SQL_SS_DELETIONS		0x00000002L
-#define SQL_SS_UPDATES			0x00000004L 
+#define SQL_SS_UPDATES			0x00000004L
 
 /*
  * String Functions. A SQLUINTEGER bitmask enumerating the scalar string
@@ -1043,7 +1058,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 /* introduced in ODBC 3.0 */
 #define SQL_FN_STR_BIT_LENGTH		0x00080000L
 #define SQL_FN_STR_CHAR_LENGTH		0x00100000L
-#define SQL_FN_STR_CHARACTER_LENGTH	0x00200000L
+#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L
 #define SQL_FN_STR_OCTET_LENGTH		0x00400000L
 #define SQL_FN_STR_POSITION		0x00800000L
 
@@ -1061,14 +1076,14 @@ typedef struct tagSQL_INTERVAL_STRUCT {
  * System Functions. A SQLUINTEGER bitmask enumerating the scalar system
  * functions supported by the driver and associated data source.
  */
-#define SQL_FN_SYS_USERNAME		0x00000001L 
+#define SQL_FN_SYS_USERNAME		0x00000001L
 #define SQL_FN_SYS_DBNAME		0x00000002L
 #define SQL_FN_SYS_IFNULL		0x00000004L
 
 /*
  * Time-Date add and diff intervals. A SQLUINTEGER bitmask enumerating the
  * timestamp intervals supported by the driver and associated data source
- *  for the TIMESTAMPADD and TIMESTAMPDIFF scalar function.
+ *	for the TIMESTAMPADD and TIMESTAMPDIFF scalar function.
  */
 #define SQL_FN_TSI_FRAC_SECOND		0x00000001L
 #define SQL_FN_TSI_SECOND		0x00000002L
@@ -1105,7 +1120,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 /* Added in ODBC 3.0 */
 #define SQL_FN_TD_CURRENT_DATE		0x00020000L
 #define SQL_FN_TD_CURRENT_TIME		0x00040000L
-#define SQL_FN_TD_CURRENT_TIMESTAMP	0x00080000L
+#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L
 #define SQL_FN_TD_EXTRACT		0x00100000L
 
 /*
@@ -1128,7 +1143,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 
 /* SQLStatistics: Type, Smallint */
 #define SQL_TABLE_STAT		0
-#define SQL_INDEX_CLUSTERED	1
+#define SQL_INDEX_CLUSTERED 1
 #define SQL_INDEX_HASHED	2
 #define SQL_INDEX_OTHER		3
 
@@ -1139,7 +1154,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 
 /* SQLSpecialColumns: PSEUDO_COLUMN: Smallint */
 #define SQL_PC_UNKNOWN		0
-#define SQL_PC_PSEUDO		1		
+#define SQL_PC_PSEUDO		1
 #define SQL_PC_NOT_PSEUDO	2
 
 /* SQLSet/Get/StmtOptions: ASYNC_ENABLE. A SQLUINTEGER */
@@ -1153,7 +1168,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
  */
 #define SQL_CONCUR_DEFAULT	SQL_CONCUR_READ_ONLY
 
-/* 
+/*
  * SQLSet/GetStmtOptions: CURSOR_SCROLLABLE. A SQLUINTEGER. Added in ODBC
  * 3.0.
  */
@@ -1161,7 +1176,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_SCROLLABLE		1UL
 #define SQL_CURSOR_SCROLLABLE_DEFAULT	SQL_NONSCROLLABLE
 
-/* 
+/*
  * SQLSet/GetStmtOptions: CURSOR_SENSITITY. A SQLUINTEGER. Added in ODBC
  * 3.0.
  */
@@ -1170,15 +1185,15 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_SENSITIVIE		2UL
 #define SQL_CURSOR_SENSITIVITY_DEFAULT	SQL_UNSPECIFIED
 
-/* 
+/*
  * SQLSet/GetStmtOptions: CURSOR_TYPE: A SQLUINTEGER value that specifies the
  * cursor type
  */
-#define	SQL_CURSOR_FORWARD_ONLY		0UL
+#define SQL_CURSOR_FORWARD_ONLY		0UL
 #define SQL_CURSOR_KEYSET_DRIVEN	1UL
 #define SQL_CURSOR_DYNAMIC		2UL
 #define SQL_CURSOR_STATIC		3UL
-#define SQL_CURSOR_DEFAULT	SQL_CURSOR_FORWARD_ONLY 
+#define SQL_CURSOR_DEFAULT	SQL_CURSOR_FORWARD_ONLY
 
 /*
  * ENABLE_AUTO_IPD: A SQLUINTEGER, either SQL_TRUE or SQL_FALSE. Default
@@ -1211,7 +1226,7 @@ typedef struct tagSQL_INTERVAL_STRUCT {
  *
 */
 #define SQL_PARAM_SUCCESS		0
-#define SQL_PARAM_SUCCESS_WITH_INFO	6
+#define SQL_PARAM_SUCCESS_WITH_INFO 6
 #define SQL_PARAM_ERROR			5
 #define SQL_PARAM_UNUSED		7
 #define SQL_PARAM_DIAG_UNAVAILABLE	1
@@ -1236,12 +1251,12 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_ROW_IGNORE		1
 
 /*
- *  SQL_ROWSET_SIZE
+ *	SQL_ROWSET_SIZE
  */
-#define SQL_ROWSET_SIZE_DEFAULT 	1UL
+#define SQL_ROWSET_SIZE_DEFAULT		1UL
 
 /*
- *  SQL_KEYSET_SIZE
+ *	SQL_KEYSET_SIZE
  */
 #define SQL_KEYSET_SIZE_DEFAULT		0UL
 
@@ -1261,29 +1276,29 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 #define SQL_UB_OFF		0UL
 #define SQL_UB_ON		1UL
 #define SQL_UB_FIXED		SQL_UB_ON	/* Deprecated in ODBC 3.0 */
-#define SQL_UB_VARIABLE		2UL	/* Added in ODBC 3.0 */
+#define SQL_UB_VARIABLE		2UL /* Added in ODBC 3.0 */
 #define SQL_UB_DEFAULT		SQL_UB_OFF
 
 /* Deprecated */
-#define SQL_DATABASE_NAME		16 
-#define SQL_FD_FETCH_PREV		SQL_FD_FETCH_PRIOR 
-#define SQL_FETCH_PREV			SQL_FETCH_PRIOR 
-#define SQL_CONCUR_TIMESTAMP		SQL_CONCUR_ROWVER 
-#define SQL_SCCO_OPT_TIMESTAMP		SQL_SCCO_OPT_ROWVER 
-#define SQL_CC_DELETE			SQL_CB_DELETE 
-#define SQL_CR_DELETE			SQL_CB_DELETE 
-#define SQL_CC_CLOSE			SQL_CB_CLOSE 
-#define SQL_CR_CLOSE			SQL_CB_CLOSE 
-#define SQL_CC_PRESERVE			SQL_CB_PRESERVE 
-#define SQL_CR_PRESERVE			SQL_CB_PRESERVE 
-#define SQL_FETCH_RESUME                7     
-#define SQL_SCROLL_FORWARD_ONLY         0L
-#define SQL_SCROLL_KEYSET_DRIVEN        (-1L)
-#define SQL_SCROLL_DYNAMIC              (-2L)
-#define SQL_SCROLL_STATIC               (-3L)
- 
+#define SQL_DATABASE_NAME		16
+#define SQL_FD_FETCH_PREV		SQL_FD_FETCH_PRIOR
+#define SQL_FETCH_PREV			SQL_FETCH_PRIOR
+#define SQL_CONCUR_TIMESTAMP		SQL_CONCUR_ROWVER
+#define SQL_SCCO_OPT_TIMESTAMP		SQL_SCCO_OPT_ROWVER
+#define SQL_CC_DELETE			SQL_CB_DELETE
+#define SQL_CR_DELETE			SQL_CB_DELETE
+#define SQL_CC_CLOSE			SQL_CB_CLOSE
+#define SQL_CR_CLOSE			SQL_CB_CLOSE
+#define SQL_CC_PRESERVE			SQL_CB_PRESERVE
+#define SQL_CR_PRESERVE			SQL_CB_PRESERVE
+#define SQL_FETCH_RESUME				7
+#define SQL_SCROLL_FORWARD_ONLY			0L
+#define SQL_SCROLL_KEYSET_DRIVEN		(-1L)
+#define SQL_SCROLL_DYNAMIC				(-2L)
+#define SQL_SCROLL_STATIC				(-3L)
+
 /*
- *  ODBC keywords
+ *	ODBC keywords
  */
 #define SQL_ODBC_KEYWORDS \
 "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
@@ -1317,223 +1332,225 @@ typedef struct tagSQL_INTERVAL_STRUCT {
 "UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
 "VALUE,,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR"
 
-# ifdef __cplusplus
-	extern  "C" {
-# endif
+#ifdef __cplusplus
+extern		"C"
+{
+#endif
 
-RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
-RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
+	RETCODE SQL_API SQLSetConnectOption(HDBC, UWORD, UDWORD);
+	RETCODE SQL_API SQLNumResultCols(HSTMT, SWORD FAR *);
 
 /*
- *   function prototypes previously missing from isqlext.h
+ *	 function prototypes previously missing from isqlext.h
  */
-RETCODE SQL_API SQLColumns (HSTMT hstmt, 
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName,
-	UCHAR FAR * szColumnName,
-	SWORD cbColumnName);
-
-RETCODE SQL_API SQLDriverConnect (HDBC hdbc,
-	HWND hwnd,
-	UCHAR FAR * szConnStrIn,
-	SWORD cbConnStrIn,
-	UCHAR FAR * szConnStrOut,
-	SWORD cbConnStrOutMax,
-	SWORD FAR * pcbConnStrOut,
-	UWORD fDriverCompletion);
-
-RETCODE SQL_API SQLGetConnectOption (HDBC hdbc,
-	UWORD fOption,
-	PTR pvParam);
-
-RETCODE SQL_API SQLGetData (HSTMT hstmt,
-	UWORD icol,
-	SWORD fCType,
-	PTR rgbValue,
-	SDWORD cbValueMax,
-	SDWORD FAR * pcbValue);
-
-RETCODE SQL_API SQLGetFunctions (HDBC hdbc,
-	UWORD fFunction,
-	UWORD FAR * pfExists);
-
-RETCODE SQL_API SQLGetInfo (HDBC hdbc,
-	UWORD fInfoType,
-	PTR rgbInfoValue,
-	SWORD cbInfoValueMax,
-	SWORD FAR * pcbInfoValue);
-
-RETCODE SQL_API SQLGetStmtOption (HSTMT hstmt,
-	UWORD fOption,
-	PTR pvParam);
-
-RETCODE SQL_API SQLGetTypeInfo (HSTMT hstmt,
-	SWORD fSqlType);
-
-RETCODE SQL_API SQLParamData (HSTMT hstmt,
-	PTR FAR * prgbValue);
-
-RETCODE SQL_API SQLPutData (HSTMT hstmt,
-	PTR rgbValue,
-	SDWORD cbValue);
-
-RETCODE SQL_API SQLSetStmtOption (HSTMT hstmt,
-	UWORD fOption,
-	UDWORD vParam);
-
-RETCODE SQL_API SQLSpecialColumns (HSTMT hstmt,
-	UWORD fColType,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName,
-	UWORD fScope,
-	UWORD fNullable);
-
-RETCODE SQL_API SQLStatistics (HSTMT hstmt,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName,
-	UWORD fUnique,
-	UWORD fAccuracy);
-
-RETCODE SQL_API SQLTables (HSTMT hstmt,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName,
-	UCHAR FAR * szTableType,
-	SWORD cbTableType);
-
-RETCODE SQL_API SQLBrowseConnect (HDBC hdbc,
-	UCHAR FAR * szConnStrIn,
-	SWORD cbConnStrIn,
-	UCHAR FAR * szConnStrOut, 
-	SWORD cbConnStrOutMax,
-	SWORD FAR * pcbConnStrOut);
-
-RETCODE SQL_API SQLColumnPrivileges (HSTMT hstmt,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName,
-	UCHAR FAR * szColumnName,
-	SWORD cbColumnName);
-
-RETCODE SQL_API SQLDescribeParam (HSTMT hstmt,
-	UWORD ipar,
-	SWORD FAR * pfSqlType,
-	UDWORD FAR * pcbColDef,
-	SWORD FAR * pibScale,
-	SWORD FAR * pfNullable);
-
-RETCODE SQL_API SQLExtendedFetch (HSTMT hstmt,
-	UWORD fFetchType,
-	SDWORD irow,
-	UDWORD FAR * pcrow,
-	UWORD FAR * rgfRowStatus);
-
-RETCODE SQL_API SQLForeignKeys (HSTMT hstmt,
-	UCHAR FAR * szPkTableQualifier,
-	SWORD cbPkTableQualifier,
-	UCHAR FAR * szPkTableOwner,
-	SWORD cbPkTableOwner,
-	UCHAR FAR * szPkTableName,
-	SWORD cbPkTableName,
-	UCHAR FAR * szFkTableQualifier,
-	SWORD cbFkTableQualifier,
-	UCHAR FAR * szFkTableOwner,
-	SWORD cbFkTableOwner,
-	UCHAR FAR * szFkTableName,
-	SWORD cbFkTableName);
-
-RETCODE SQL_API SQLMoreResults (HSTMT hstmt);
-
-RETCODE SQL_API SQLNativeSql (HDBC hdbc,
-	UCHAR FAR * szSqlStrIn,
-	SDWORD cbSqlStrIn,
-	UCHAR FAR * szSqlStr,
-	SDWORD cbSqlStrMax,
-	SDWORD FAR * pcbSqlStr);
-
-RETCODE SQL_API SQLNumParams (HSTMT hstmt,
-	SWORD FAR * pcpar);
-
-RETCODE SQL_API SQLParamOptions (HSTMT hstmt,
-	UDWORD crow,
-	UDWORD FAR * pirow);
-
-RETCODE SQL_API SQLPrimaryKeys (HSTMT hstmt,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName);
-
-RETCODE SQL_API SQLProcedureColumns (HSTMT hstmt,
-	UCHAR FAR * szProcQualifier,
-	SWORD cbProcQualifier,
-	UCHAR FAR * szProcOwner,
-	SWORD cbProcOwner,
-	UCHAR FAR * szProcName,
-	SWORD cbProcName,
-	UCHAR FAR * szColumnName,
-	SWORD cbColumnName);
-
-RETCODE SQL_API SQLProcedures (HSTMT hstmt,
-	UCHAR FAR * szProcQualifier,
-	SWORD cbProcQualifier,
-	UCHAR FAR * szProcOwner,
-	SWORD cbProcOwner,
-	UCHAR FAR * szProcName,
-	SWORD cbProcName);
-
-RETCODE SQL_API SQLSetPos (HSTMT hstmt,
-	UWORD irow,
-	UWORD fOption,
-	UWORD fLock);
-
-RETCODE SQL_API SQLTablePrivileges (HSTMT hstmt,
-	UCHAR FAR * szTableQualifier,
-	SWORD cbTableQualifier,
-	UCHAR FAR * szTableOwner,
-	SWORD cbTableOwner,
-	UCHAR FAR * szTableName,
-	SWORD cbTableName);
-
-RETCODE SQL_API SQLBindParameter (HSTMT hstmt,
-	UWORD ipar,
-	SWORD fParamType,
-	SWORD fCType,
-	SWORD fSqlType,
-	UDWORD cbColDef,
-	SWORD ibScale,
-	PTR rgbValue,
-	SDWORD cbValueMax,
-	SDWORD FAR * pcbValue);
-
-RETCODE SQL_API SQLSetScrollOptions (HSTMT hstmt,
-	UWORD fConcurrency,
-	SDWORD crowKeyset,
-	UWORD crowRowset);
-
-
-# ifdef __cplusplus
-	}
-# endif
+	RETCODE SQL_API SQLColumns(HSTMT hstmt,
+										   UCHAR FAR *szTableQualifier,
+										   SWORD cbTableQualifier,
+										   UCHAR FAR *szTableOwner,
+										   SWORD cbTableOwner,
+										   UCHAR FAR *szTableName,
+										   SWORD cbTableName,
+										   UCHAR FAR *szColumnName,
+										   SWORD cbColumnName);
+
+	RETCODE SQL_API SQLDriverConnect(HDBC hdbc,
+												 HWND hwnd,
+												 UCHAR FAR *szConnStrIn,
+												 SWORD cbConnStrIn,
+												 UCHAR FAR *szConnStrOut,
+												 SWORD cbConnStrOutMax,
+												 SWORD FAR *pcbConnStrOut,
+												 UWORD fDriverCompletion);
+
+	RETCODE SQL_API SQLGetConnectOption(HDBC hdbc,
+													UWORD fOption,
+													PTR pvParam);
+
+	RETCODE SQL_API SQLGetData(HSTMT hstmt,
+										   UWORD icol,
+										   SWORD fCType,
+										   PTR rgbValue,
+										   SDWORD cbValueMax,
+										   SDWORD FAR *pcbValue);
+
+	RETCODE SQL_API SQLGetFunctions(HDBC hdbc,
+												UWORD fFunction,
+												UWORD FAR *pfExists);
+
+	RETCODE SQL_API SQLGetInfo(HDBC hdbc,
+										   UWORD fInfoType,
+										   PTR rgbInfoValue,
+										   SWORD cbInfoValueMax,
+										   SWORD FAR *pcbInfoValue);
+
+	RETCODE SQL_API SQLGetStmtOption(HSTMT hstmt,
+												 UWORD fOption,
+												 PTR pvParam);
+
+	RETCODE SQL_API SQLGetTypeInfo(HSTMT hstmt,
+											   SWORD fSqlType);
+
+	RETCODE SQL_API SQLParamData(HSTMT hstmt,
+											 PTR FAR *prgbValue);
+
+	RETCODE SQL_API SQLPutData(HSTMT hstmt,
+										   PTR rgbValue,
+										   SDWORD cbValue);
+
+	RETCODE SQL_API SQLSetStmtOption(HSTMT hstmt,
+												 UWORD fOption,
+												 UDWORD vParam);
+
+	RETCODE SQL_API SQLSpecialColumns(HSTMT hstmt,
+												  UWORD fColType,
+											 UCHAR FAR *szTableQualifier,
+												  SWORD cbTableQualifier,
+												  UCHAR FAR *szTableOwner,
+												  SWORD cbTableOwner,
+												  UCHAR FAR *szTableName,
+												  SWORD cbTableName,
+												  UWORD fScope,
+												  UWORD fNullable);
+
+	RETCODE SQL_API SQLStatistics(HSTMT hstmt,
+											  UCHAR FAR *szTableQualifier,
+											  SWORD cbTableQualifier,
+											  UCHAR FAR *szTableOwner,
+											  SWORD cbTableOwner,
+											  UCHAR FAR *szTableName,
+											  SWORD cbTableName,
+											  UWORD fUnique,
+											  UWORD fAccuracy);
+
+	RETCODE SQL_API SQLTables(HSTMT hstmt,
+										  UCHAR FAR *szTableQualifier,
+										  SWORD cbTableQualifier,
+										  UCHAR FAR *szTableOwner,
+										  SWORD cbTableOwner,
+										  UCHAR FAR *szTableName,
+										  SWORD cbTableName,
+										  UCHAR FAR *szTableType,
+										  SWORD cbTableType);
+
+	RETCODE SQL_API SQLBrowseConnect(HDBC hdbc,
+												 UCHAR FAR *szConnStrIn,
+												 SWORD cbConnStrIn,
+												 UCHAR FAR *szConnStrOut,
+												 SWORD cbConnStrOutMax,
+											   SWORD FAR *pcbConnStrOut);
+
+	RETCODE SQL_API SQLColumnPrivileges(HSTMT hstmt,
+											 UCHAR FAR *szTableQualifier,
+												  SWORD cbTableQualifier,
+												 UCHAR FAR *szTableOwner,
+													SWORD cbTableOwner,
+												  UCHAR FAR *szTableName,
+													SWORD cbTableName,
+												 UCHAR FAR *szColumnName,
+													SWORD cbColumnName);
+
+	RETCODE SQL_API SQLDescribeParam(HSTMT hstmt,
+												 UWORD ipar,
+												 SWORD FAR *pfSqlType,
+												 UDWORD FAR *pcbColDef,
+												 SWORD FAR *pibScale,
+												 SWORD FAR *pfNullable);
+
+	RETCODE SQL_API SQLExtendedFetch(HSTMT hstmt,
+												 UWORD fFetchType,
+												 SDWORD irow,
+												 UDWORD FAR *pcrow,
+												 UWORD FAR *rgfRowStatus);
+
+	RETCODE SQL_API SQLForeignKeys(HSTMT hstmt,
+										   UCHAR FAR *szPkTableQualifier,
+											   SWORD cbPkTableQualifier,
+											   UCHAR FAR *szPkTableOwner,
+											   SWORD cbPkTableOwner,
+											   UCHAR FAR *szPkTableName,
+											   SWORD cbPkTableName,
+										   UCHAR FAR *szFkTableQualifier,
+											   SWORD cbFkTableQualifier,
+											   UCHAR FAR *szFkTableOwner,
+											   SWORD cbFkTableOwner,
+											   UCHAR FAR *szFkTableName,
+											   SWORD cbFkTableName);
+
+	RETCODE SQL_API SQLMoreResults(HSTMT hstmt);
+
+	RETCODE SQL_API SQLNativeSql(HDBC hdbc,
+											 UCHAR FAR *szSqlStrIn,
+											 SDWORD cbSqlStrIn,
+											 UCHAR FAR *szSqlStr,
+											 SDWORD cbSqlStrMax,
+											 SDWORD FAR *pcbSqlStr);
+
+	RETCODE SQL_API SQLNumParams(HSTMT hstmt,
+											 SWORD FAR *pcpar);
+
+	RETCODE SQL_API SQLParamOptions(HSTMT hstmt,
+												UDWORD crow,
+												UDWORD FAR *pirow);
+
+	RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt,
+											 UCHAR FAR *szTableQualifier,
+											   SWORD cbTableQualifier,
+											   UCHAR FAR *szTableOwner,
+											   SWORD cbTableOwner,
+											   UCHAR FAR *szTableName,
+											   SWORD cbTableName);
+
+	RETCODE SQL_API SQLProcedureColumns(HSTMT hstmt,
+											  UCHAR FAR *szProcQualifier,
+													SWORD cbProcQualifier,
+												  UCHAR FAR *szProcOwner,
+													SWORD cbProcOwner,
+													UCHAR FAR *szProcName,
+													SWORD cbProcName,
+												 UCHAR FAR *szColumnName,
+													SWORD cbColumnName);
+
+	RETCODE SQL_API SQLProcedures(HSTMT hstmt,
+											  UCHAR FAR *szProcQualifier,
+											  SWORD cbProcQualifier,
+											  UCHAR FAR *szProcOwner,
+											  SWORD cbProcOwner,
+											  UCHAR FAR *szProcName,
+											  SWORD cbProcName);
+
+	RETCODE SQL_API SQLSetPos(HSTMT hstmt,
+										  UWORD irow,
+										  UWORD fOption,
+										  UWORD fLock);
+
+	RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt,
+											 UCHAR FAR *szTableQualifier,
+												   SWORD cbTableQualifier,
+												 UCHAR FAR *szTableOwner,
+												   SWORD cbTableOwner,
+												   UCHAR FAR *szTableName,
+												   SWORD cbTableName);
+
+	RETCODE SQL_API SQLBindParameter(HSTMT hstmt,
+												 UWORD ipar,
+												 SWORD fParamType,
+												 SWORD fCType,
+												 SWORD fSqlType,
+												 UDWORD cbColDef,
+												 SWORD ibScale,
+												 PTR rgbValue,
+												 SDWORD cbValueMax,
+												 SDWORD FAR *pcbValue);
+
+	RETCODE SQL_API SQLSetScrollOptions(HSTMT hstmt,
+													UWORD fConcurrency,
+													SDWORD crowKeyset,
+													UWORD crowRowset);
+
+
+#ifdef __cplusplus
+}
+
+#endif
 
 #endif
diff --git a/src/interfaces/odbc/lobj.c b/src/interfaces/odbc/lobj.c
index 8d98ee33e4fd62ffc706157c873af3cec636f605..f3cab52574dbc2bcabd49080020cc17f7ace95c2 100644
--- a/src/interfaces/odbc/lobj.c
+++ b/src/interfaces/odbc/lobj.c
@@ -1,14 +1,14 @@
 
-/* Module:          lobj.c
+/* Module:			lobj.c
  *
- * Description:     This module contains routines related to manipulating
- *                  large objects.
+ * Description:		This module contains routines related to manipulating
+ *					large objects.
  *
- * Classes:         none
+ * Classes:			none
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -19,15 +19,16 @@
 Oid
 lo_creat(ConnectionClass *conn, int mode)
 {
-LO_ARG argv[1];
-int retval, result_len;
+	LO_ARG		argv[1];
+	int			retval,
+				result_len;
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = mode;
 
-	if ( ! CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
-		return 0;	/* invalid oid */
+	if (!CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
+		return 0;				/* invalid oid */
 	else
 		return retval;
 
@@ -37,9 +38,9 @@ int retval, result_len;
 int
 lo_open(ConnectionClass *conn, int lobjId, int mode)
 {
-int fd;
-int result_len;
-LO_ARG argv[2];
+	int			fd;
+	int			result_len;
+	LO_ARG		argv[2];
 
 
 	argv[0].isint = 1;
@@ -50,7 +51,7 @@ LO_ARG argv[2];
 	argv[1].len = 4;
 	argv[1].u.integer = mode;
 
-	if ( ! CC_send_function(conn, LO_OPEN, &fd, &result_len, 1, argv, 2))
+	if (!CC_send_function(conn, LO_OPEN, &fd, &result_len, 1, argv, 2))
 		return -1;
 
 	if (fd >= 0 && lo_lseek(conn, fd, 0L, SEEK_SET) < 0)
@@ -59,18 +60,19 @@ LO_ARG argv[2];
 	return fd;
 }
 
-int 
+int
 lo_close(ConnectionClass *conn, int fd)
 {
-LO_ARG argv[1];
-int retval, result_len;
+	LO_ARG		argv[1];
+	int			retval,
+				result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = fd;
 
-	if ( ! CC_send_function(conn, LO_CLOSE, &retval, &result_len, 1, argv, 1))
+	if (!CC_send_function(conn, LO_CLOSE, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
@@ -82,8 +84,8 @@ int retval, result_len;
 int
 lo_read(ConnectionClass *conn, int fd, char *buf, int len)
 {
-LO_ARG argv[2];
-int result_len;
+	LO_ARG		argv[2];
+	int			result_len;
 
 
 	argv[0].isint = 1;
@@ -94,7 +96,7 @@ int result_len;
 	argv[1].len = 4;
 	argv[1].u.integer = len;
 
-	if ( ! CC_send_function(conn, LO_READ, (int *) buf, &result_len, 0, argv, 2))
+	if (!CC_send_function(conn, LO_READ, (int *) buf, &result_len, 0, argv, 2))
 		return -1;
 
 	else
@@ -104,8 +106,9 @@ int result_len;
 int
 lo_write(ConnectionClass *conn, int fd, char *buf, int len)
 {
-LO_ARG argv[2];
-int retval, result_len;
+	LO_ARG		argv[2];
+	int			retval,
+				result_len;
 
 
 	if (len <= 0)
@@ -119,7 +122,7 @@ int retval, result_len;
 	argv[1].len = len;
 	argv[1].u.ptr = (char *) buf;
 
-	if ( ! CC_send_function(conn, LO_WRITE, &retval, &result_len, 1, argv, 2))
+	if (!CC_send_function(conn, LO_WRITE, &retval, &result_len, 1, argv, 2))
 		return -1;
 
 	else
@@ -129,8 +132,9 @@ int retval, result_len;
 int
 lo_lseek(ConnectionClass *conn, int fd, int offset, int whence)
 {
-LO_ARG argv[3];
-int retval, result_len;
+	LO_ARG		argv[3];
+	int			retval,
+				result_len;
 
 
 	argv[0].isint = 1;
@@ -145,7 +149,7 @@ int retval, result_len;
 	argv[2].len = 4;
 	argv[2].u.integer = whence;
 
-	if ( ! CC_send_function(conn, LO_LSEEK, &retval, &result_len, 1, argv, 3))
+	if (!CC_send_function(conn, LO_LSEEK, &retval, &result_len, 1, argv, 3))
 		return -1;
 
 	else
@@ -155,43 +159,37 @@ int retval, result_len;
 int
 lo_tell(ConnectionClass *conn, int fd)
 {
-LO_ARG argv[1];
-int retval, result_len;
+	LO_ARG		argv[1];
+	int			retval,
+				result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = fd;
 
-	if ( ! CC_send_function(conn, LO_TELL, &retval, &result_len, 1, argv, 1))
+	if (!CC_send_function(conn, LO_TELL, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
 		return retval;
 }
 
-int 
+int
 lo_unlink(ConnectionClass *conn, Oid lobjId)
 {
-LO_ARG argv[1];
-int retval, result_len;
+	LO_ARG		argv[1];
+	int			retval,
+				result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = lobjId;
 
-	if ( ! CC_send_function(conn, LO_UNLINK, &retval, &result_len, 1, argv, 1))
+	if (!CC_send_function(conn, LO_UNLINK, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
 		return retval;
 }
-
-
-
-
-
-
-
-
diff --git a/src/interfaces/odbc/lobj.h b/src/interfaces/odbc/lobj.h
index 8c4a3075d15ed3f6a0c9fee38daf7535c54dd163..fa28542b0ad68ba9e6eecaccc0e4ff5fbc9cf94c 100644
--- a/src/interfaces/odbc/lobj.h
+++ b/src/interfaces/odbc/lobj.h
@@ -1,9 +1,9 @@
 
-/* File:            lobj.h
+/* File:			lobj.h
  *
- * Description:     See "lobj.c"
+ * Description:		See "lobj.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -13,14 +13,15 @@
 
 #include "psqlodbc.h"
 
-struct lo_arg {
-	int		isint;
-	int		len;
+struct lo_arg
+{
+	int			isint;
+	int			len;
 	union
 	{
-		int		integer;
-		char	*ptr;
-	} u;
+		int			integer;
+		char	   *ptr;
+	}			u;
 };
 
 #define LO_CREAT		957
@@ -35,14 +36,13 @@ struct lo_arg {
 #define INV_WRITE		0x00020000
 #define INV_READ		0x00040000
 
-Oid lo_creat(ConnectionClass *conn, int mode);
-int lo_open(ConnectionClass *conn, int lobjId, int mode);
-int lo_close(ConnectionClass *conn, int fd);
-int lo_read(ConnectionClass *conn, int fd, char *buf, int len);
-int lo_write(ConnectionClass *conn, int fd, char *buf, int len);
-int lo_lseek(ConnectionClass *conn, int fd, int offset, int len);
-int lo_tell(ConnectionClass *conn, int fd);
-int lo_unlink(ConnectionClass *conn, Oid lobjId);
+Oid			lo_creat(ConnectionClass *conn, int mode);
+int			lo_open(ConnectionClass *conn, int lobjId, int mode);
+int			lo_close(ConnectionClass *conn, int fd);
+int			lo_read(ConnectionClass *conn, int fd, char *buf, int len);
+int			lo_write(ConnectionClass *conn, int fd, char *buf, int len);
+int			lo_lseek(ConnectionClass *conn, int fd, int offset, int len);
+int			lo_tell(ConnectionClass *conn, int fd);
+int			lo_unlink(ConnectionClass *conn, Oid lobjId);
 
 #endif
-
diff --git a/src/interfaces/odbc/misc.c b/src/interfaces/odbc/misc.c
index 5d0a19c375e5dd9d39395480d42a5c16978496b0..18d7c8c6c4c24e8fd2971c06d48b326ec4ecff22 100644
--- a/src/interfaces/odbc/misc.c
+++ b/src/interfaces/odbc/misc.c
@@ -1,14 +1,14 @@
 
-/* Module:          misc.c
+/* Module:			misc.c
  *
- * Description:     This module contains miscellaneous routines
- *                  such as for debugging/logging and string functions.
+ * Description:		This module contains miscellaneous routines
+ *					such as for debugging/logging and string functions.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -25,49 +25,54 @@
 #include <sys/types.h>
 #include <unistd.h>
 #else
-#include <process.h>	/* Byron: is this where Windows keeps def. of getpid ? */
+#include <process.h>			/* Byron: is this where Windows keeps def.
+								 * of getpid ? */
 #endif
 
 extern GLOBAL_VALUES globals;
-void generate_filename(char*,char*,char*);
+void		generate_filename(char *, char *, char *);
 
 void
-generate_filename(char* dirname,char* prefix,char* filename)
+generate_filename(char *dirname, char *prefix, char *filename)
 {
-	int pid = 0;
+	int			pid = 0;
+
 #ifndef WIN32
 	struct passwd *ptr = 0;
+
 	ptr = getpwuid(getuid());
 #endif
 	pid = getpid();
-	if(dirname == 0 || filename == 0)
+	if (dirname == 0 || filename == 0)
 		return;
 
-	strcpy(filename,dirname);
-	strcat(filename,DIRSEPARATOR);
-	if(prefix != 0)
-		strcat(filename,prefix);
+	strcpy(filename, dirname);
+	strcat(filename, DIRSEPARATOR);
+	if (prefix != 0)
+		strcat(filename, prefix);
 #ifndef WIN32
-	strcat(filename,ptr->pw_name);
+	strcat(filename, ptr->pw_name);
 #endif
-	sprintf(filename,"%s%u%s",filename,pid,".log");
+	sprintf(filename, "%s%u%s", filename, pid, ".log");
 	return;
 }
 
 #ifdef MY_LOG
 
 void
-mylog(char * fmt, ...)
+mylog(char *fmt,...)
 {
-	va_list args;
-	char filebuf[80];
-	FILE* LOGFP = globals.mylogFP;
+	va_list		args;
+	char		filebuf[80];
+	FILE	   *LOGFP = globals.mylogFP;
 
-	if ( globals.debug) {
+	if (globals.debug)
+	{
 		va_start(args, fmt);
 
-		if (! LOGFP) {
-			generate_filename(MYLOGDIR,MYLOGFILE,filebuf);
+		if (!LOGFP)
+		{
+			generate_filename(MYLOGDIR, MYLOGFILE, filebuf);
 			LOGFP = fopen(filebuf, PG_BINARY_W);
 			globals.mylogFP = LOGFP;
 			setbuf(LOGFP, NULL);
@@ -79,23 +84,26 @@ mylog(char * fmt, ...)
 		va_end(args);
 	}
 }
+
 #endif
 
 
 #ifdef Q_LOG
 
 void
-qlog(char * fmt, ...)
+qlog(char *fmt,...)
 {
-	va_list args;
-	char filebuf[80];
-	FILE* LOGFP = globals.qlogFP;
+	va_list		args;
+	char		filebuf[80];
+	FILE	   *LOGFP = globals.qlogFP;
 
-	if ( globals.commlog) {
+	if (globals.commlog)
+	{
 		va_start(args, fmt);
 
-		if (! LOGFP) {
-			generate_filename(QLOGDIR,QLOGFILE,filebuf);
+		if (!LOGFP)
+		{
+			generate_filename(QLOGDIR, QLOGFILE, filebuf);
 			LOGFP = fopen(filebuf, PG_BINARY_W);
 			globals.qlogFP = LOGFP;
 			setbuf(LOGFP, NULL);
@@ -107,9 +115,10 @@ qlog(char * fmt, ...)
 		va_end(args);
 	}
 }
+
 #endif
 
-/*  Undefine these because windows.h will redefine and cause a warning */
+/*	Undefine these because windows.h will redefine and cause a warning */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -136,7 +145,8 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 	if (dst_len <= 0)
 		return STRCPY_FAIL;
 
-	if (src_len == SQL_NULL_DATA) {
+	if (src_len == SQL_NULL_DATA)
+	{
 		dst[0] = '\0';
 		return STRCPY_NULL;
 	}
@@ -146,14 +156,17 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 	if (src_len <= 0)
 		return STRCPY_FAIL;
 
-	else {
-		if (src_len < dst_len) {
+	else
+	{
+		if (src_len < dst_len)
+		{
 			memcpy(dst, src, src_len);
 			dst[src_len] = '\0';
 		}
-		else {
-			memcpy(dst, src, dst_len-1);
-			dst[dst_len-1] = '\0';	/* truncated */
+		else
+		{
+			memcpy(dst, src, dst_len - 1);
+			dst[dst_len - 1] = '\0';	/* truncated */
 			return STRCPY_TRUNCATED;
 		}
 	}
@@ -165,28 +178,29 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 /* the destination string if src has len characters or more. */
 /* instead, I want it to copy up to len-1 characters and always */
 /* terminate the destination string. */
-char *strncpy_null(char *dst, const char *src, int len)
+char *
+strncpy_null(char *dst, const char *src, int len)
 {
-int i;
+	int			i;
 
 
-	if (NULL != dst) {
+	if (NULL != dst)
+	{
 
-		/*  Just in case, check for special lengths */
-		if (len == SQL_NULL_DATA) {
+		/* Just in case, check for special lengths */
+		if (len == SQL_NULL_DATA)
+		{
 			dst[0] = '\0';
 			return NULL;
 		}
 		else if (len == SQL_NTS)
 			len = strlen(src) + 1;
 
-		for(i = 0; src[i] && i < len - 1; i++) {
+		for (i = 0; src[i] && i < len - 1; i++)
 			dst[i] = src[i];
-		}
 
-		if(len > 0) {
+		if (len > 0)
 			dst[i] = '\0';
-		}
 	}
 	return dst;
 }
@@ -197,22 +211,24 @@ int i;
 char *
 make_string(char *s, int len, char *buf)
 {
-int length;
-char *str;
+	int			length;
+	char	   *str;
 
-	if(s && (len > 0 || (len == SQL_NTS && strlen(s) > 0))) {
+	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0)))
+	{
 		length = (len > 0) ? len : strlen(s);
 
-		if (buf) {
-			strncpy_null(buf, s, length+1);
+		if (buf)
+		{
+			strncpy_null(buf, s, length + 1);
 			return buf;
 		}
 
 		str = malloc(length + 1);
-		if ( ! str)
+		if (!str)
 			return NULL;
 
-		strncpy_null(str, s, length+1);
+		strncpy_null(str, s, length + 1);
 		return str;
 	}
 
@@ -227,10 +243,11 @@ char *
 my_strcat(char *buf, char *fmt, char *s, int len)
 {
 
-	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0))) {
-		int length = (len > 0) ? len : strlen(s);
+	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0)))
+	{
+		int			length = (len > 0) ? len : strlen(s);
 
-		int pos = strlen(buf);
+		int			pos = strlen(buf);
 
 		sprintf(&buf[pos], fmt, length, s);
 		return buf;
@@ -238,24 +255,26 @@ my_strcat(char *buf, char *fmt, char *s, int len)
 	return NULL;
 }
 
-void remove_newlines(char *string)
+void
+remove_newlines(char *string)
 {
 	unsigned int i;
 
-	for(i=0; i < strlen(string); i++) {
-		if((string[i] == '\n') ||
-		   (string[i] == '\r')) {
+	for (i = 0; i < strlen(string); i++)
+	{
+		if ((string[i] == '\n') ||
+			(string[i] == '\r'))
 			string[i] = ' ';
-		}
 	}
 }
 
 char *
 trim(char *s)
 {
-	int i;
+	int			i;
 
-	for (i = strlen(s) - 1; i >= 0; i--) {
+	for (i = strlen(s) - 1; i >= 0; i--)
+	{
 		if (s[i] == ' ')
 			s[i] = '\0';
 		else
diff --git a/src/interfaces/odbc/misc.h b/src/interfaces/odbc/misc.h
index ebe56ea9d80bf429b3682991216f7d03c00e9fc3..e5e916465eda201503ca769806cf71e4aed71dff 100644
--- a/src/interfaces/odbc/misc.h
+++ b/src/interfaces/odbc/misc.h
@@ -1,9 +1,9 @@
 
-/* File:            misc.h
+/* File:			misc.h
  *
- * Description:     See "misc.c"
+ * Description:		See "misc.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -39,35 +39,37 @@
 
 
 #ifdef MY_LOG
-  #define MYLOGFILE	"mylog_"
-  #ifndef WIN32
-    #define MYLOGDIR	"/tmp"
-  #else
-    #define MYLOGDIR	"c:"
-  #endif
-  extern void mylog(char * fmt, ...);
+#define MYLOGFILE "mylog_"
+#ifndef WIN32
+#define MYLOGDIR	"/tmp"
+#else
+#define MYLOGDIR	"c:"
+#endif
+extern void mylog(char *fmt,...);
+
 #else
-  #ifndef WIN32
-    #define mylog(args...)	/* GNU convention for variable arguments */
-  #else
-    #define mylog    /* mylog */
-  #endif
+#ifndef WIN32
+#define mylog(args...)			/* GNU convention for variable arguments */
+#else
+#define mylog					/* mylog */
+#endif
 #endif
 
 #ifdef Q_LOG
-  #define QLOGFILE	"psqlodbc_"
-  #ifndef WIN32
-    #define QLOGDIR		"/tmp"
-  #else
-    #define QLOGDIR		"c:"
-  #endif
-  extern void qlog(char * fmt, ...);
+#define QLOGFILE  "psqlodbc_"
+#ifndef WIN32
+#define QLOGDIR		"/tmp"
+#else
+#define QLOGDIR		"c:"
+#endif
+extern void qlog(char *fmt,...);
+
 #else
-  #ifndef WIN32
-    #define qlog(args...)	/* GNU convention for variable arguments */
-  #else
-    #define qlog    /* qlog */
-  #endif
+#ifndef WIN32
+#define qlog(args...)			/* GNU convention for variable arguments */
+#else
+#define qlog					/* qlog */
+#endif
 #endif
 
 #ifndef WIN32
@@ -78,20 +80,20 @@
 
 #ifdef WIN32
 #define PG_BINARY	O_BINARY
-#define	PG_BINARY_R	"rb"
-#define	PG_BINARY_W	"wb"
+#define PG_BINARY_R "rb"
+#define PG_BINARY_W "wb"
 #else
-#define	PG_BINARY	0
-#define	PG_BINARY_R	"r"
-#define	PG_BINARY_W	"w"
+#define PG_BINARY	0
+#define PG_BINARY_R "r"
+#define PG_BINARY_W "w"
 #endif
 
 
-void remove_newlines(char *string);
-char *strncpy_null(char *dst, const char *src, int len);
-char *trim(char *string);
-char *make_string(char *s, int len, char *buf);
-char *my_strcat(char *buf, char *fmt, char *s, int len);
+void		remove_newlines(char *string);
+char	   *strncpy_null(char *dst, const char *src, int len);
+char	   *trim(char *string);
+char	   *make_string(char *s, int len, char *buf);
+char	   *my_strcat(char *buf, char *fmt, char *s, int len);
 
 /* defines for return value of my_strcpy */
 #define STRCPY_SUCCESS		1
@@ -99,6 +101,6 @@ char *my_strcat(char *buf, char *fmt, char *s, int len);
 #define STRCPY_TRUNCATED	-1
 #define STRCPY_NULL			-2
 
-int my_strcpy(char *dst, int dst_len, char *src, int src_len);
+int			my_strcpy(char *dst, int dst_len, char *src, int src_len);
 
 #endif
diff --git a/src/interfaces/odbc/multibyte.c b/src/interfaces/odbc/multibyte.c
index 316ca40efbd02f3d4e03613876145dd2c7c890a1..19acb5bd60eba194cf968334d035825cad9c7bf4 100644
--- a/src/interfaces/odbc/multibyte.c
+++ b/src/interfaces/odbc/multibyte.c
@@ -5,71 +5,74 @@
  *
  *					Create 2001-03-03 Eiji Tokuya
  *
- */		
+ */
 #include <string.h>
 #include "multibyte.h"
 
-int multibyte_client_encoding ;	/* Multibyte Client Encoding. */
-int multibyte_status ;		/* Multibyte Odds and ends character. */
+int			multibyte_client_encoding;	/* Multibyte Client Encoding. */
+int			multibyte_status;	/* Multibyte Odds and ends character. */
 
-unsigned char *multibyte_strchr(unsigned char *s,unsigned char c)
+unsigned char *
+multibyte_strchr(unsigned char *s, unsigned char c)
 {
-	int mb_st = 0 ,i = 0;
+	int			mb_st = 0,
+				i = 0;
+
 	while (!(mb_st == 0 && (s[i] == c || s[i] == 0)))
 	{
 		if (s[i] == 0)
 			return (0);
-		switch ( multibyte_client_encoding )
+		switch (multibyte_client_encoding)
 		{
 			case SJIS:
-			{
-				if (mb_st < 2 && s[i] > 0x80 && !(s[i] > 0x9f && s[i] < 0xe0))
-					mb_st = 2;
-				else if (mb_st == 2)
+				{
+					if (mb_st < 2 && s[i] > 0x80 && !(s[i] > 0x9f && s[i] < 0xe0))
+						mb_st = 2;
+					else if (mb_st == 2)
 						mb_st = 1;
 					else
 						mb_st = 0;
-			}
-			break;
+				}
+				break;
 
 
 /* Chinese Big5 Support. */
-		case BIG5:
-			{
-				if ( mb_st < 2 && s[i] > 0xA0 )
+			case BIG5:
+				{
+					if (mb_st < 2 && s[i] > 0xA0)
 						mb_st = 2;
-				else if ( mb_st == 2 )
+					else if (mb_st == 2)
 						mb_st = 1;
 					else
 						mb_st = 0;
-			}
-			break;
-		default:
-			{
-				mb_st = 0;
-			}
+				}
+				break;
+			default:
+					mb_st = 0;
 		}
 		i++;
 	}
 #ifdef _DEBUG
-	qlog("i = %d\n",i);
+	qlog("i = %d\n", i);
 #endif
 	return (s + i);
 }
 
-void multibyte_init(void)
+void
+multibyte_init(void)
 {
 	multibyte_status = 0;
 }
 
-unsigned char *check_client_encoding(unsigned char *str)
+unsigned char *
+check_client_encoding(unsigned char *str)
 {
-	if(strstr(str,"%27SJIS%27")||strstr(str,"'SJIS'")||strstr(str,"'sjis'"))
+	if (strstr(str, "%27SJIS%27") || strstr(str, "'SJIS'") || strstr(str, "'sjis'"))
 	{
 		multibyte_client_encoding = SJIS;
 		return ("SJIS");
 	}
-	if(strstr(str,"%27BIG5%27")||strstr(str,"'BIG5'")||strstr(str,"'big5'"))
+	if (strstr(str, "%27BIG5%27") || strstr(str, "'BIG5'") || strstr(str, "'big5'"))
 	{
 		multibyte_client_encoding = BIG5;
 		return ("BIG5");
@@ -77,48 +80,47 @@ unsigned char *check_client_encoding(unsigned char *str)
 	return ("OHTER");
 }
 
-/* 
+/*
  * Multibyte Status Function.
  *	Input	char
  *	Output	0	: 1 Byte Character.
  *			1	: MultibyteCharacter Last Byte.
  *			N	: MultibyteCharacter Fast or Middle Byte.
  */
-int multibyte_char_check(unsigned char s)
+int
+multibyte_char_check(unsigned char s)
 {
-	switch ( multibyte_client_encoding )
+	switch (multibyte_client_encoding)
 	{
 /* Japanese Shift-JIS(CP932) Support. */
-		case SJIS:
-		{
-			if ( multibyte_status < 2 && s > 0x80 && !(s > 0x9f && s < 0xE0))
-				multibyte_status = 2;
-			else if (multibyte_status == 2)
-				multibyte_status = 1;
-			else
-				multibyte_status = 0;
-		}
-		break;
+			case SJIS:
+			{
+				if (multibyte_status < 2 && s > 0x80 && !(s > 0x9f && s < 0xE0))
+					multibyte_status = 2;
+				else if (multibyte_status == 2)
+					multibyte_status = 1;
+				else
+					multibyte_status = 0;
+			}
+			break;
+
 
-		
 /* Chinese Big5(CP950) Support. */
-	case BIG5:
-		{
-			if ( multibyte_status < 2 && s > 0xA0)
-				multibyte_status = 2;
-			else if (multibyte_status == 2)
-				multibyte_status = 1;
-			else
+		case BIG5:
+			{
+				if (multibyte_status < 2 && s > 0xA0)
+					multibyte_status = 2;
+				else if (multibyte_status == 2)
+					multibyte_status = 1;
+				else
+					multibyte_status = 0;
+			}
+			break;
+		default:
 				multibyte_status = 0;
-		}
-		break;
-	default:
-		{
-			multibyte_status = 0;
-		}
 	}
 #ifdef _DEBUG
-	qlog("multibyte_client_encoding = %d   s = 0x%02X   multibyte_stat = %d\n", multibyte_client_encoding, s, multibyte_status );
+	qlog("multibyte_client_encoding = %d   s = 0x%02X   multibyte_stat = %d\n", multibyte_client_encoding, s, multibyte_status);
 #endif
-	return( multibyte_status );
+	return (multibyte_status);
 }
diff --git a/src/interfaces/odbc/multibyte.h b/src/interfaces/odbc/multibyte.h
index 7b35ba57aebcee0fb05d0682c922827e27e11cbe..0a865ac0b15c1bbacde9c89ef36b285268860369 100644
--- a/src/interfaces/odbc/multibyte.h
+++ b/src/interfaces/odbc/multibyte.h
@@ -6,34 +6,34 @@
  */
 
 /* PostgreSQL client encoding */
-#define SQL_ASCII		0	/* SQL/ASCII */
-#define EUC_JP			1	/* EUC for Japanese */
-#define EUC_CN			2	/* EUC for Chinese */
-#define EUC_KR			3	/* EUC for Korean */
-#define EUC_TW			4	/* EUC for Taiwan */
-#define UNICODE			5	/* Unicode UTF-8 */
-#define MULE_INTERNAL	6	/* Mule internal code */
-#define LATIN1			7	/* ISO-8859 Latin 1 */
-#define LATIN2			8	/* ISO-8859 Latin 2 */
-#define LATIN3			9	/* ISO-8859 Latin 3 */
-#define LATIN4			10	/* ISO-8859 Latin 4 */
-#define LATIN5			11	/* ISO-8859 Latin 5 */
-#define LATIN6			12	/* ISO-8859 Latin 6 */
-#define LATIN7			13	/* ISO-8859 Latin 7 */
-#define LATIN8			14	/* ISO-8859 Latin 8 */
-#define LATIN9			15	/* ISO-8859 Latin 9 */
-#define KOI8			16	/* KOI8-R */
-#define WIN				17	/* windows-1251 */
-#define ALT				18	/* Alternativny Variant (MS-DOS CP866) */
-#define SJIS			32	/* Shift JIS */
-#define BIG5			33	/* Big5 */
-#define WIN1250			34	/* windows-1250 */
+#define SQL_ASCII		0		/* SQL/ASCII */
+#define EUC_JP			1		/* EUC for Japanese */
+#define EUC_CN			2		/* EUC for Chinese */
+#define EUC_KR			3		/* EUC for Korean */
+#define EUC_TW			4		/* EUC for Taiwan */
+#define UNICODE			5		/* Unicode UTF-8 */
+#define MULE_INTERNAL	6		/* Mule internal code */
+#define LATIN1			7		/* ISO-8859 Latin 1 */
+#define LATIN2			8		/* ISO-8859 Latin 2 */
+#define LATIN3			9		/* ISO-8859 Latin 3 */
+#define LATIN4			10		/* ISO-8859 Latin 4 */
+#define LATIN5			11		/* ISO-8859 Latin 5 */
+#define LATIN6			12		/* ISO-8859 Latin 6 */
+#define LATIN7			13		/* ISO-8859 Latin 7 */
+#define LATIN8			14		/* ISO-8859 Latin 8 */
+#define LATIN9			15		/* ISO-8859 Latin 9 */
+#define KOI8			16		/* KOI8-R */
+#define WIN				17		/* windows-1251 */
+#define ALT				18		/* Alternativny Variant (MS-DOS CP866) */
+#define SJIS			32		/* Shift JIS */
+#define BIG5			33		/* Big5 */
+#define WIN1250			34		/* windows-1250 */
 
 
-extern int multibyte_client_encoding ;	/* Multibyte client encoding. */
-extern int multibyte_status ;			/* Multibyte charcter status. */
+extern int	multibyte_client_encoding;	/* Multibyte client encoding. */
+extern int	multibyte_status;	/* Multibyte charcter status. */
 
-void multibyte_init(void);
+void		multibyte_init(void);
 unsigned char *check_client_encoding(unsigned char *str);
-int multibyte_char_check(unsigned char s);
+int			multibyte_char_check(unsigned char s);
 unsigned char *multibyte_strchr(unsigned char *s, unsigned char c);
diff --git a/src/interfaces/odbc/options.c b/src/interfaces/odbc/options.c
index ccc419299dd62a8b28f93491caa45f1e8d257481..3dc3a40c7deeed28f9937c13517d485b7b4b477a 100644
--- a/src/interfaces/odbc/options.c
+++ b/src/interfaces/odbc/options.c
@@ -1,15 +1,15 @@
 
-/* Module:          options.c
+/* Module:			options.c
  *
- * Description:     This module contains routines for getting/setting
- *                  connection and statement options.
+ * Description:		This module contains routines for getting/setting
+ *					connection and statement options.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   SQLSetConnectOption, SQLSetStmtOption, SQLGetConnectOption,
- *                  SQLGetStmtOption
+ * API functions:	SQLSetConnectOption, SQLSetStmtOption, SQLGetConnectOption,
+ *					SQLGetStmtOption
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -38,207 +38,246 @@
 
 extern GLOBAL_VALUES globals;
 
-RETCODE set_statement_option(ConnectionClass *conn, 
-							 StatementClass *stmt, 
-							 UWORD   fOption,
-							 UDWORD  vParam);
+RETCODE set_statement_option(ConnectionClass *conn,
+					 StatementClass *stmt,
+					 UWORD fOption,
+					 UDWORD vParam);
 
 
 
-RETCODE set_statement_option(ConnectionClass *conn, 
-							 StatementClass *stmt, 
-							 UWORD   fOption,
-							 UDWORD  vParam)
+RETCODE
+set_statement_option(ConnectionClass *conn,
+					 StatementClass *stmt,
+					 UWORD fOption,
+					 UDWORD vParam)
 {
-static char *func="set_statement_option";
-char changed = FALSE;
+	static char *func = "set_statement_option";
+	char		changed = FALSE;
 
 
-	switch(fOption) {
-	case SQL_ASYNC_ENABLE:/* ignored */
-		break;
+	switch (fOption)
+	{
+		case SQL_ASYNC_ENABLE:	/* ignored */
+			break;
 
-	case SQL_BIND_TYPE:		
-		/* now support multi-column and multi-row binding */
-		if (conn) conn->stmtOptions.bind_size = vParam;
-		if (stmt) stmt->options.bind_size = vParam;
-		break;
+		case SQL_BIND_TYPE:
+			/* now support multi-column and multi-row binding */
+			if (conn)
+				conn->stmtOptions.bind_size = vParam;
+			if (stmt)
+				stmt->options.bind_size = vParam;
+			break;
 
-	case SQL_CONCURRENCY:
-		/*	positioned update isn't supported so cursor concurrency is read-only */
+		case SQL_CONCURRENCY:
 
-		if (conn) conn->stmtOptions.scroll_concurrency = vParam;
-		if (stmt) stmt->options.scroll_concurrency = vParam;
-		break;
+			/*
+			 * positioned update isn't supported so cursor concurrency is
+			 * read-only
+			 */
 
-		/*
-		if (globals.lie) {
-			if (conn) conn->stmtOptions.scroll_concurrency = vParam;
-			if (stmt) stmt->options.scroll_concurrency = vParam;
-		}
-		else {
+			if (conn)
+				conn->stmtOptions.scroll_concurrency = vParam;
+			if (stmt)
+				stmt->options.scroll_concurrency = vParam;
+			break;
 
-			if (conn) conn->stmtOptions.scroll_concurrency = SQL_CONCUR_READ_ONLY;
-			if (stmt) stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY;
+			/*
+			 * if (globals.lie) { if (conn)
+			 * conn->stmtOptions.scroll_concurrency = vParam; if (stmt)
+			 * stmt->options.scroll_concurrency = vParam; } else {
+			 *
+			 * if (conn) conn->stmtOptions.scroll_concurrency =
+			 * SQL_CONCUR_READ_ONLY; if (stmt)
+			 * stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY;
+			 *
+			 * if (vParam != SQL_CONCUR_READ_ONLY) changed = TRUE; } break;
+			 */
+
+		case SQL_CURSOR_TYPE:
+
+			/*
+			 * if declare/fetch, then type can only be forward. otherwise,
+			 * it can only be forward or static.
+			 */
+			mylog("SetStmtOption(): SQL_CURSOR_TYPE = %d\n", vParam);
+
+			if (globals.lie)
+			{
+
+				if (conn)
+					conn->stmtOptions.cursor_type = vParam;
+				if (stmt)
+					stmt->options.cursor_type = vParam;
 
-			if (vParam != SQL_CONCUR_READ_ONLY)
-				changed = TRUE;
-		}
-		break;
-		*/
-		
-	case SQL_CURSOR_TYPE:
-		/*	if declare/fetch, then type can only be forward.
-			otherwise, it can only be forward or static.
-		*/
-		mylog("SetStmtOption(): SQL_CURSOR_TYPE = %d\n", vParam);
+			}
+			else
+			{
+				if (globals.use_declarefetch)
+				{
+
+					if (conn)
+						conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY;
+					if (stmt)
+						stmt->options.cursor_type = SQL_CURSOR_FORWARD_ONLY;
+
+					if (vParam != SQL_CURSOR_FORWARD_ONLY)
+						changed = TRUE;
+				}
+				else
+				{
+					if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC)
+					{
+
+						if (conn)
+							conn->stmtOptions.cursor_type = vParam;		/* valid type */
+						if (stmt)
+							stmt->options.cursor_type = vParam; /* valid type */
+					}
+					else
+					{
+
+						if (conn)
+							conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC;
+						if (stmt)
+							stmt->options.cursor_type = SQL_CURSOR_STATIC;
+
+						changed = TRUE;
+					}
+				}
+			}
+			break;
 
-		if (globals.lie) {
+		case SQL_KEYSET_SIZE:	/* ignored, but saved and returned	*/
+			mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = %d\n", vParam);
 
-			if (conn) conn->stmtOptions.cursor_type = vParam;
-			if (stmt) stmt->options.cursor_type = vParam;
+			if (conn)
+				conn->stmtOptions.keyset_size = vParam;
+			if (stmt)
+				stmt->options.keyset_size = vParam;
 
-		}
-		else {
-			if (globals.use_declarefetch) {
+			break;
 
-				if (conn) conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY;
-				if (stmt) stmt->options.cursor_type = SQL_CURSOR_FORWARD_ONLY;
+			/*
+			 * if (globals.lie) stmt->keyset_size = vParam; else {
+			 * stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			 * stmt->errormsg = "Driver does not support keyset size
+			 * option"; SC_log_error(func, "", stmt); return SQL_ERROR; }
+			 */
+
+		case SQL_MAX_LENGTH:	/* ignored, but saved */
+			mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = %d\n", vParam);
+			if (conn)
+				conn->stmtOptions.maxLength = vParam;
+			if (stmt)
+				stmt->options.maxLength = vParam;
+			break;
 
-				if (vParam != SQL_CURSOR_FORWARD_ONLY) 
-					changed = TRUE;
-			}
-			else {
-				if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) {
+		case SQL_MAX_ROWS:		/* ignored, but saved */
+			mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = %d\n", vParam);
+			if (conn)
+				conn->stmtOptions.maxRows = vParam;
+			if (stmt)
+				stmt->options.maxRows = vParam;
+			break;
 
-					if (conn) conn->stmtOptions.cursor_type = vParam;		/* valid type */
-					if (stmt) stmt->options.cursor_type = vParam;		/* valid type */
-				}
-				else {
+		case SQL_NOSCAN:		/* ignored */
+			mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
+			break;
 
-					if (conn) conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC;
-					if (stmt) stmt->options.cursor_type = SQL_CURSOR_STATIC;
+		case SQL_QUERY_TIMEOUT:/* ignored */
+			mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
+			/* "0" returned in SQLGetStmtOption */
+			break;
 
-					changed = TRUE;
-				}
-			}
-		}
-		break;
+		case SQL_RETRIEVE_DATA:/* ignored, but saved */
+			mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
+			if (conn)
+				conn->stmtOptions.retrieve_data = vParam;
+			if (stmt)
+				stmt->options.retrieve_data = vParam;
+			break;
 
-	case SQL_KEYSET_SIZE: /* ignored, but saved and returned  */
-		mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = %d\n", vParam);
+		case SQL_ROWSET_SIZE:
+			mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = %d\n", vParam);
 
-		if (conn) conn->stmtOptions.keyset_size = vParam;
-		if (stmt) stmt->options.keyset_size = vParam;
 
-		break;
+			/*
+			 * Save old rowset size for SQLExtendedFetch purposes If the
+			 * rowset_size is being changed since the last call to fetch
+			 * rows.
+			 */
 
-		/*
-		if (globals.lie)
-			stmt->keyset_size = vParam;
-		else {
-			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			stmt->errormsg = "Driver does not support keyset size option";
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
-		}
-		*/
-
-	case SQL_MAX_LENGTH:/* ignored, but saved */
-		mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = %d\n", vParam);
-		if (conn) conn->stmtOptions.maxLength = vParam;
-		if (stmt) stmt->options.maxLength = vParam;
-		break;
-
-	case SQL_MAX_ROWS: /* ignored, but saved */
-		mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = %d\n", vParam);
-		if (conn) conn->stmtOptions.maxRows = vParam;
-		if (stmt) stmt->options.maxRows = vParam;
-		break;
-
-	case SQL_NOSCAN: /* ignored */
-		mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
-		break;
-
-	case SQL_QUERY_TIMEOUT: /* ignored */
-		mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
-		/*	"0" returned in SQLGetStmtOption */
-		break;
-
-	case SQL_RETRIEVE_DATA: /* ignored, but saved */
-		mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
-		if (conn) conn->stmtOptions.retrieve_data = vParam;
-		if (stmt) stmt->options.retrieve_data = vParam;
-		break;
-
-	case SQL_ROWSET_SIZE:
-		mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = %d\n", vParam);
-
-
-		/*	Save old rowset size for SQLExtendedFetch purposes 
-			If the rowset_size is being changed since the last call
-			to fetch rows.
-		*/
-
-		if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0 )
-			stmt->save_rowset_size = stmt->options.rowset_size;
-
-		if (vParam < 1) {
-			vParam = 1;
-			changed = TRUE;
-		}
+			if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0)
+				stmt->save_rowset_size = stmt->options.rowset_size;
 
-		if (conn) conn->stmtOptions.rowset_size = vParam;
-		if (stmt) stmt->options.rowset_size = vParam;
+			if (vParam < 1)
+			{
+				vParam = 1;
+				changed = TRUE;
+			}
 
-		break;
+			if (conn)
+				conn->stmtOptions.rowset_size = vParam;
+			if (stmt)
+				stmt->options.rowset_size = vParam;
 
-	case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */
-		if (stmt) {
-			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			stmt->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
-			SC_log_error(func, "", stmt);
-		}
-		if (conn) {
-			conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			conn->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
-			CC_log_error(func, "", conn);
-		}
-		return SQL_ERROR;
+			break;
 
-	case SQL_USE_BOOKMARKS:
+		case SQL_SIMULATE_CURSOR:		/* NOT SUPPORTED */
+			if (stmt)
+			{
+				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+				stmt->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
+				SC_log_error(func, "", stmt);
+			}
+			if (conn)
+			{
+				conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+				conn->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
+				CC_log_error(func, "", conn);
+			}
+			return SQL_ERROR;
 
-		if (stmt) stmt->options.use_bookmarks = vParam;
-		if (conn) conn->stmtOptions.use_bookmarks = vParam;
-		break;
+		case SQL_USE_BOOKMARKS:
 
-    default:
-		{
-		char option[64];
+			if (stmt)
+				stmt->options.use_bookmarks = vParam;
+			if (conn)
+				conn->stmtOptions.use_bookmarks = vParam;
+			break;
 
-		if (stmt) {
-			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			stmt->errormsg = "Unknown statement option (Set)";
-			sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-			SC_log_error(func, option, stmt);
-		}
-		if (conn) {
-			conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			conn->errormsg = "Unknown statement option (Set)";
-			sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-			CC_log_error(func, option, conn);
-		}
+		default:
+			{
+				char		option[64];
+
+				if (stmt)
+				{
+					stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+					stmt->errormsg = "Unknown statement option (Set)";
+					sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+					SC_log_error(func, option, stmt);
+				}
+				if (conn)
+				{
+					conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+					conn->errormsg = "Unknown statement option (Set)";
+					sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+					CC_log_error(func, option, conn);
+				}
 
-        return SQL_ERROR;
-		}
-    }
+				return SQL_ERROR;
+			}
+	}
 
-	if (changed) {
-		if (stmt) {
+	if (changed)
+	{
+		if (stmt)
+		{
 			stmt->errormsg = "Requested value changed.";
 			stmt->errornumber = STMT_OPTION_VALUE_CHANGED;
 		}
-		if (conn) {
+		if (conn)
+		{
 			conn->errormsg = "Requested value changed.";
 			conn->errornumber = STMT_OPTION_VALUE_CHANGED;
 		}
@@ -251,133 +290,145 @@ char changed = FALSE;
 
 
 /* Implements only SQL_AUTOCOMMIT */
-RETCODE SQL_API SQLSetConnectOption(
-        HDBC    hdbc,
-        UWORD   fOption,
-        UDWORD  vParam)
+RETCODE SQL_API
+SQLSetConnectOption(
+					HDBC hdbc,
+					UWORD fOption,
+					UDWORD vParam)
 {
-static char *func="SQLSetConnectOption";
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-char changed = FALSE;
-RETCODE retval;
-int i;
+	static char *func = "SQLSetConnectOption";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	char		changed = FALSE;
+	RETCODE		retval;
+	int			i;
 
 	mylog("%s: entering...\n", func);
 
-	if ( ! conn)  {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 
-	switch (fOption) {
-	/* Statement Options 
-	   (apply to all stmts on the connection and become defaults for new stmts)
-	*/
-	case SQL_ASYNC_ENABLE:
-	case SQL_BIND_TYPE:		
-	case SQL_CONCURRENCY:
-	case SQL_CURSOR_TYPE:
-	case SQL_KEYSET_SIZE: 
-	case SQL_MAX_LENGTH:
-	case SQL_MAX_ROWS:
-	case SQL_NOSCAN: 
-	case SQL_QUERY_TIMEOUT:
-	case SQL_RETRIEVE_DATA:
-	case SQL_ROWSET_SIZE:
-	case SQL_SIMULATE_CURSOR:
-	case SQL_USE_BOOKMARKS:
-
-		/*	Affect all current Statements */
-		for (i = 0; i < conn->num_stmts; i++) {
-			if ( conn->stmts[i]) {
-				set_statement_option(NULL, conn->stmts[i], fOption, vParam);
+	switch (fOption)
+	{
+
+			/*
+			 * Statement Options (apply to all stmts on the connection and
+			 * become defaults for new stmts)
+			 */
+		case SQL_ASYNC_ENABLE:
+		case SQL_BIND_TYPE:
+		case SQL_CONCURRENCY:
+		case SQL_CURSOR_TYPE:
+		case SQL_KEYSET_SIZE:
+		case SQL_MAX_LENGTH:
+		case SQL_MAX_ROWS:
+		case SQL_NOSCAN:
+		case SQL_QUERY_TIMEOUT:
+		case SQL_RETRIEVE_DATA:
+		case SQL_ROWSET_SIZE:
+		case SQL_SIMULATE_CURSOR:
+		case SQL_USE_BOOKMARKS:
+
+			/* Affect all current Statements */
+			for (i = 0; i < conn->num_stmts; i++)
+			{
+				if (conn->stmts[i])
+					set_statement_option(NULL, conn->stmts[i], fOption, vParam);
 			}
-		}
 
-		/*	Become the default for all future statements on this connection */
-		retval = set_statement_option(conn, NULL, fOption, vParam);
+			/*
+			 * Become the default for all future statements on this
+			 * connection
+			 */
+			retval = set_statement_option(conn, NULL, fOption, vParam);
 
-		if (retval == SQL_SUCCESS_WITH_INFO)
-			changed = TRUE;
-		else if (retval == SQL_ERROR)
-			return SQL_ERROR;
+			if (retval == SQL_SUCCESS_WITH_INFO)
+				changed = TRUE;
+			else if (retval == SQL_ERROR)
+				return SQL_ERROR;
 
-		break;
+			break;
 
-	/**********************************/
-	/*****	Connection Options  *******/	
-	/**********************************/
+			/**********************************/
+			/*****	Connection Options	*******/
+			/**********************************/
 
-	case SQL_ACCESS_MODE: /* ignored */
-		break;
+		case SQL_ACCESS_MODE:	/* ignored */
+			break;
 
-	case SQL_AUTOCOMMIT:
+		case SQL_AUTOCOMMIT:
 
-		if (CC_is_in_trans(conn)) {
-			conn->errormsg = "Cannot switch commit mode while a transaction is in progress";
-			conn->errornumber = CONN_TRANSACT_IN_PROGRES;
-			CC_log_error(func, "", conn);
-			return SQL_ERROR;
-		}
+			if (CC_is_in_trans(conn))
+			{
+				conn->errormsg = "Cannot switch commit mode while a transaction is in progress";
+				conn->errornumber = CONN_TRANSACT_IN_PROGRES;
+				CC_log_error(func, "", conn);
+				return SQL_ERROR;
+			}
+
+			mylog("SQLSetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam);
+
+			switch (vParam)
+			{
+				case SQL_AUTOCOMMIT_OFF:
+					CC_set_autocommit_off(conn);
+					break;
 
-		mylog("SQLSetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam);
+				case SQL_AUTOCOMMIT_ON:
+					CC_set_autocommit_on(conn);
+					break;
+
+				default:
+					conn->errormsg = "Illegal parameter value for SQL_AUTOCOMMIT";
+					conn->errornumber = CONN_INVALID_ARGUMENT_NO;
+					CC_log_error(func, "", conn);
+					return SQL_ERROR;
+			}
 
-		switch(vParam) {
-		case SQL_AUTOCOMMIT_OFF:
-			CC_set_autocommit_off(conn);
 			break;
 
-		case SQL_AUTOCOMMIT_ON:
-			CC_set_autocommit_on(conn);
+		case SQL_CURRENT_QUALIFIER:		/* ignored */
+			break;
+
+		case SQL_LOGIN_TIMEOUT:/* ignored */
+			break;
+
+		case SQL_PACKET_SIZE:	/* ignored */
+			break;
+
+		case SQL_QUIET_MODE:	/* ignored */
+			break;
+
+		case SQL_TXN_ISOLATION:/* ignored */
+			break;
+
+			/* These options should be handled by driver manager */
+		case SQL_ODBC_CURSORS:
+		case SQL_OPT_TRACE:
+		case SQL_OPT_TRACEFILE:
+		case SQL_TRANSLATE_DLL:
+		case SQL_TRANSLATE_OPTION:
+			CC_log_error(func, "This connect option (Set) is only used by the Driver Manager", conn);
 			break;
 
 		default:
-			conn->errormsg = "Illegal parameter value for SQL_AUTOCOMMIT";
-			conn->errornumber = CONN_INVALID_ARGUMENT_NO;
-			CC_log_error(func, "", conn);
-			return SQL_ERROR;
-		}
+			{
+				char		option[64];
 
-		break;
-
-	case SQL_CURRENT_QUALIFIER: /* ignored */
-		break;
-
-	case SQL_LOGIN_TIMEOUT: /* ignored */
-		break;
-
-	case SQL_PACKET_SIZE:	/* ignored */
-		break;
-
-	case SQL_QUIET_MODE:	/* ignored */
-		break;
-
-	case SQL_TXN_ISOLATION: /* ignored */
-		break;
-		
-	/*	These options should be handled by driver manager */
-	case SQL_ODBC_CURSORS:
-	case SQL_OPT_TRACE:
-	case SQL_OPT_TRACEFILE:
-	case SQL_TRANSLATE_DLL:
-	case SQL_TRANSLATE_OPTION:
-		CC_log_error(func, "This connect option (Set) is only used by the Driver Manager", conn);
-		break;
-
-	default:
-		{ 
-		char option[64];
-		conn->errormsg = "Unknown connect option (Set)";
-		conn->errornumber = CONN_UNSUPPORTED_OPTION;
-		sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-		CC_log_error(func, option, conn);
-		return SQL_ERROR;
-		}
+				conn->errormsg = "Unknown connect option (Set)";
+				conn->errornumber = CONN_UNSUPPORTED_OPTION;
+				sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+				CC_log_error(func, option, conn);
+				return SQL_ERROR;
+			}
 
-	}    
+	}
 
-	if (changed) {
+	if (changed)
+	{
 		conn->errornumber = CONN_OPTION_VALUE_CHANGED;
 		conn->errormsg = "Requested value changed.";
 		return SQL_SUCCESS_WITH_INFO;
@@ -386,90 +437,95 @@ int i;
 		return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
 /* This function just can tell you whether you are in Autcommit mode or not */
-RETCODE SQL_API SQLGetConnectOption(
-        HDBC    hdbc,
-        UWORD   fOption,
-        PTR     pvParam)
+RETCODE SQL_API
+SQLGetConnectOption(
+					HDBC hdbc,
+					UWORD fOption,
+					PTR pvParam)
 {
-static char *func="SQLGetConnectOption";
-ConnectionClass *conn = (ConnectionClass *) hdbc;
+	static char *func = "SQLGetConnectOption";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
 
 	mylog("%s: entering...\n", func);
 
-	if (! conn)  {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	switch (fOption) {
-	case SQL_ACCESS_MODE:/* NOT SUPPORTED */
-		*((UDWORD *) pvParam) = SQL_MODE_READ_WRITE;
-		break;
+	switch (fOption)
+	{
+		case SQL_ACCESS_MODE:	/* NOT SUPPORTED */
+			*((UDWORD *) pvParam) = SQL_MODE_READ_WRITE;
+			break;
 
-	case SQL_AUTOCOMMIT:
-		*((UDWORD *)pvParam) = (UDWORD)( CC_is_in_autocommit(conn) ?
-						SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
-		break;
+		case SQL_AUTOCOMMIT:
+			*((UDWORD *) pvParam) = (UDWORD) (CC_is_in_autocommit(conn) ?
+								 SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
+			break;
 
-	case SQL_CURRENT_QUALIFIER:	/* don't use qualifiers */
-		if(pvParam)
-			strcpy(pvParam, "");
+		case SQL_CURRENT_QUALIFIER:		/* don't use qualifiers */
+			if (pvParam)
+				strcpy(pvParam, "");
 
-		break;
+			break;
 
-	case SQL_LOGIN_TIMEOUT: /* NOT SUPPORTED */
-		*((UDWORD *) pvParam) = 0;
-		break;
+		case SQL_LOGIN_TIMEOUT:/* NOT SUPPORTED */
+			*((UDWORD *) pvParam) = 0;
+			break;
 
-	case SQL_PACKET_SIZE: /* NOT SUPPORTED */
-		*((UDWORD *) pvParam) = globals.socket_buffersize;
-		break;
+		case SQL_PACKET_SIZE:	/* NOT SUPPORTED */
+			*((UDWORD *) pvParam) = globals.socket_buffersize;
+			break;
 
-	case SQL_QUIET_MODE:/* NOT SUPPORTED */
-		*((UDWORD *) pvParam) = (UDWORD) NULL;
-		break;
+		case SQL_QUIET_MODE:	/* NOT SUPPORTED */
+			*((UDWORD *) pvParam) = (UDWORD) NULL;
+			break;
 
-	case SQL_TXN_ISOLATION:/* NOT SUPPORTED */
-		*((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE;
-		break;
+		case SQL_TXN_ISOLATION:/* NOT SUPPORTED */
+			*((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE;
+			break;
 
-	/*	These options should be handled by driver manager */
-	case SQL_ODBC_CURSORS:
-	case SQL_OPT_TRACE:
-	case SQL_OPT_TRACEFILE:
-	case SQL_TRANSLATE_DLL:
-	case SQL_TRANSLATE_OPTION:
-		CC_log_error(func, "This connect option (Get) is only used by the Driver Manager", conn);
-		break;
+			/* These options should be handled by driver manager */
+		case SQL_ODBC_CURSORS:
+		case SQL_OPT_TRACE:
+		case SQL_OPT_TRACEFILE:
+		case SQL_TRANSLATE_DLL:
+		case SQL_TRANSLATE_OPTION:
+			CC_log_error(func, "This connect option (Get) is only used by the Driver Manager", conn);
+			break;
 
-	default:
-		{
-		char option[64];
-		conn->errormsg = "Unknown connect option (Get)";
-		conn->errornumber = CONN_UNSUPPORTED_OPTION;
-		sprintf(option, "fOption=%d", fOption);
-		CC_log_error(func, option, conn);
-		return SQL_ERROR;
-		break;
-		}
+		default:
+			{
+				char		option[64];
 
-	}    
+				conn->errormsg = "Unknown connect option (Get)";
+				conn->errornumber = CONN_UNSUPPORTED_OPTION;
+				sprintf(option, "fOption=%d", fOption);
+				CC_log_error(func, option, conn);
+				return SQL_ERROR;
+				break;
+			}
+
+	}
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLSetStmtOption(
-        HSTMT   hstmt,
-        UWORD   fOption,
-        UDWORD  vParam)
+RETCODE SQL_API
+SQLSetStmtOption(
+				 HSTMT hstmt,
+				 UWORD fOption,
+				 UDWORD vParam)
 {
-static char *func="SQLSetStmtOption";
-StatementClass *stmt = (StatementClass *) hstmt;
+	static char *func = "SQLSetStmtOption";
+	StatementClass *stmt = (StatementClass *) hstmt;
 
 	mylog("%s: entering...\n", func);
 
@@ -477,7 +533,8 @@ StatementClass *stmt = (StatementClass *) hstmt;
 	/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
 	/* and expects the driver to reduce it to the real value */
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -486,16 +543,17 @@ StatementClass *stmt = (StatementClass *) hstmt;
 }
 
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
-RETCODE SQL_API SQLGetStmtOption(
-        HSTMT   hstmt,
-        UWORD   fOption,
-        PTR     pvParam)
+RETCODE SQL_API
+SQLGetStmtOption(
+				 HSTMT hstmt,
+				 UWORD fOption,
+				 PTR pvParam)
 {
-static char *func="SQLGetStmtOption";
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *res;
+	static char *func = "SQLGetStmtOption";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
 
 	mylog("%s: entering...\n", func);
 
@@ -503,115 +561,123 @@ QResultClass *res;
 	/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
 	/* and expects the driver to reduce it to the real value */
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	switch(fOption) {
-	case SQL_GET_BOOKMARK:
-	case SQL_ROW_NUMBER:
-
-		res = stmt->result;
-
-		if ( stmt->manual_result || ! globals.use_declarefetch) {
-			/* make sure we're positioned on a valid row */
-			if((stmt->currTuple < 0) ||
-			   (stmt->currTuple >= QR_get_num_tuples(res))) {
-				stmt->errormsg = "Not positioned on a valid row.";
-				stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
-				SC_log_error(func, "", stmt);
-				return SQL_ERROR;
+	switch (fOption)
+	{
+		case SQL_GET_BOOKMARK:
+		case SQL_ROW_NUMBER:
+
+			res = stmt->result;
+
+			if (stmt->manual_result || !globals.use_declarefetch)
+			{
+				/* make sure we're positioned on a valid row */
+				if ((stmt->currTuple < 0) ||
+					(stmt->currTuple >= QR_get_num_tuples(res)))
+				{
+					stmt->errormsg = "Not positioned on a valid row.";
+					stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
+					SC_log_error(func, "", stmt);
+					return SQL_ERROR;
+				}
 			}
-		}
-		else {
-			if (stmt->currTuple == -1 || ! res || ! res->tupleField) {
-				stmt->errormsg = "Not positioned on a valid row.";
-				stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
+			else
+			{
+				if (stmt->currTuple == -1 || !res || !res->tupleField)
+				{
+					stmt->errormsg = "Not positioned on a valid row.";
+					stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
+					SC_log_error(func, "", stmt);
+					return SQL_ERROR;
+				}
+			}
+
+			if (fOption == SQL_GET_BOOKMARK && stmt->options.use_bookmarks == SQL_UB_OFF)
+			{
+				stmt->errormsg = "Operation invalid because use bookmarks not enabled.";
+				stmt->errornumber = STMT_OPERATION_INVALID;
 				SC_log_error(func, "", stmt);
 				return SQL_ERROR;
 			}
-		}
 
-		if (fOption == SQL_GET_BOOKMARK && stmt->options.use_bookmarks == SQL_UB_OFF) {
-			stmt->errormsg = "Operation invalid because use bookmarks not enabled.";
-			stmt->errornumber = STMT_OPERATION_INVALID;
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
-		}
+			*((UDWORD *) pvParam) = SC_get_bookmark(stmt);
 
-		*((UDWORD *) pvParam) = SC_get_bookmark(stmt);
-		
-		break;
+			break;
 
-	case SQL_ASYNC_ENABLE:	/* NOT SUPPORTED */
-		*((SDWORD *) pvParam) = SQL_ASYNC_ENABLE_OFF;
-		break;
+		case SQL_ASYNC_ENABLE:	/* NOT SUPPORTED */
+			*((SDWORD *) pvParam) = SQL_ASYNC_ENABLE_OFF;
+			break;
 
-	case SQL_BIND_TYPE:
-		*((SDWORD *) pvParam) = stmt->options.bind_size;
-		break;
+		case SQL_BIND_TYPE:
+			*((SDWORD *) pvParam) = stmt->options.bind_size;
+			break;
 
-	case SQL_CONCURRENCY: /* NOT REALLY SUPPORTED */
-		mylog("GetStmtOption(): SQL_CONCURRENCY\n");
-		*((SDWORD *)pvParam) = stmt->options.scroll_concurrency;
-		break;
+		case SQL_CONCURRENCY:	/* NOT REALLY SUPPORTED */
+			mylog("GetStmtOption(): SQL_CONCURRENCY\n");
+			*((SDWORD *) pvParam) = stmt->options.scroll_concurrency;
+			break;
 
-	case SQL_CURSOR_TYPE: /* PARTIAL SUPPORT */
-		mylog("GetStmtOption(): SQL_CURSOR_TYPE\n");
-		*((SDWORD *)pvParam) = stmt->options.cursor_type;
-		break;
+		case SQL_CURSOR_TYPE:	/* PARTIAL SUPPORT */
+			mylog("GetStmtOption(): SQL_CURSOR_TYPE\n");
+			*((SDWORD *) pvParam) = stmt->options.cursor_type;
+			break;
 
-	case SQL_KEYSET_SIZE: /* NOT SUPPORTED, but saved */
-		mylog("GetStmtOption(): SQL_KEYSET_SIZE\n");
-		*((SDWORD *)pvParam) = stmt->options.keyset_size;
-		break;
+		case SQL_KEYSET_SIZE:	/* NOT SUPPORTED, but saved */
+			mylog("GetStmtOption(): SQL_KEYSET_SIZE\n");
+			*((SDWORD *) pvParam) = stmt->options.keyset_size;
+			break;
 
-	case SQL_MAX_LENGTH: /* NOT SUPPORTED, but saved */
-		*((SDWORD *)pvParam) = stmt->options.maxLength;
-		break;
+		case SQL_MAX_LENGTH:	/* NOT SUPPORTED, but saved */
+			*((SDWORD *) pvParam) = stmt->options.maxLength;
+			break;
 
-	case SQL_MAX_ROWS: /* NOT SUPPORTED, but saved */
-		*((SDWORD *)pvParam) = stmt->options.maxRows;
-		mylog("GetSmtOption: MAX_ROWS, returning %d\n", stmt->options.maxRows);
-		break;
+		case SQL_MAX_ROWS:		/* NOT SUPPORTED, but saved */
+			*((SDWORD *) pvParam) = stmt->options.maxRows;
+			mylog("GetSmtOption: MAX_ROWS, returning %d\n", stmt->options.maxRows);
+			break;
 
-	case SQL_NOSCAN:/* NOT SUPPORTED */
-		*((SDWORD *) pvParam) = SQL_NOSCAN_ON;
-		break;
+		case SQL_NOSCAN:		/* NOT SUPPORTED */
+			*((SDWORD *) pvParam) = SQL_NOSCAN_ON;
+			break;
 
-	case SQL_QUERY_TIMEOUT: /* NOT SUPPORTED */
-		*((SDWORD *) pvParam) = 0;
-		break;
+		case SQL_QUERY_TIMEOUT:/* NOT SUPPORTED */
+			*((SDWORD *) pvParam) = 0;
+			break;
 
-	case SQL_RETRIEVE_DATA: /* NOT SUPPORTED, but saved */
-		*((SDWORD *) pvParam) = stmt->options.retrieve_data;
-		break;
+		case SQL_RETRIEVE_DATA:/* NOT SUPPORTED, but saved */
+			*((SDWORD *) pvParam) = stmt->options.retrieve_data;
+			break;
 
-	case SQL_ROWSET_SIZE:
-		*((SDWORD *) pvParam) = stmt->options.rowset_size;
-		break;
+		case SQL_ROWSET_SIZE:
+			*((SDWORD *) pvParam) = stmt->options.rowset_size;
+			break;
 
-	case SQL_SIMULATE_CURSOR:/* NOT SUPPORTED */
-		*((SDWORD *) pvParam) = SQL_SC_NON_UNIQUE;
-		break;
+		case SQL_SIMULATE_CURSOR:		/* NOT SUPPORTED */
+			*((SDWORD *) pvParam) = SQL_SC_NON_UNIQUE;
+			break;
 
-	case SQL_USE_BOOKMARKS:
-		*((SDWORD *) pvParam) = stmt->options.use_bookmarks;
-		break;
+		case SQL_USE_BOOKMARKS:
+			*((SDWORD *) pvParam) = stmt->options.use_bookmarks;
+			break;
 
-	default:
-		{
-		char option[64];
-		stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-		stmt->errormsg = "Unknown statement option (Get)";
-		sprintf(option, "fOption=%d", fOption);
-		SC_log_error(func, option, stmt);
-		return SQL_ERROR;
-		}
+		default:
+			{
+				char		option[64];
+
+				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+				stmt->errormsg = "Unknown statement option (Get)";
+				sprintf(option, "fOption=%d", fOption);
+				SC_log_error(func, option, stmt);
+				return SQL_ERROR;
+			}
 	}
 
 	return SQL_SUCCESS;
 }
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
diff --git a/src/interfaces/odbc/parse.c b/src/interfaces/odbc/parse.c
index a5f046f179da52eddca2ea526d3a372d019b9a57..6d018a97017b10c82a84a4268134cb7ecd77932b 100644
--- a/src/interfaces/odbc/parse.c
+++ b/src/interfaces/odbc/parse.c
@@ -1,20 +1,20 @@
 
-/* Module:          parse.c
+/* Module:			parse.c
  *
- * Description:     This module contains routines related to parsing SQL statements.
- *                  This can be useful for two reasons:
+ * Description:		This module contains routines related to parsing SQL statements.
+ *					This can be useful for two reasons:
  *
- *                  1. So the query does not actually have to be executed to return data about it
+ *					1. So the query does not actually have to be executed to return data about it
  *
- *                  2. To be able to return information about precision, nullability, aliases, etc.
- *                     in the functions SQLDescribeCol and SQLColAttributes.  Currently, Postgres
- *                     doesn't return any information about these things in a query.
+ *					2. To be able to return information about precision, nullability, aliases, etc.
+ *					   in the functions SQLDescribeCol and SQLColAttributes.  Currently, Postgres
+ *					   doesn't return any information about these things in a query.
  *
- * Classes:         none
+ * Classes:			none
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 /* Multibyte support	Eiji Tokuya 2001-03-15 */
@@ -38,7 +38,7 @@
 
 #ifndef WIN32
 #ifndef HAVE_STRICMP
-#define stricmp(s1,s2) 		strcasecmp(s1,s2)
+#define stricmp(s1,s2)		strcasecmp(s1,s2)
 #define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
 #endif
 #endif
@@ -47,16 +47,17 @@
 #define TAB_INCR	8
 #define COL_INCR	16
 
-char *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
-void getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k);
-char searchColInfo(COL_INFO *col_info, FIELD_INFO *fi);
+char	   *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
+void		getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k);
+char		searchColInfo(COL_INFO *col_info, FIELD_INFO *fi);
 
 char *
 getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric)
 {
-int i = 0;
-int out = 0;
-char qc, in_escape = FALSE;
+	int			i = 0;
+	int			out = 0;
+	char		qc,
+				in_escape = FALSE;
 
 	if (smax <= 1)
 		return NULL;
@@ -64,48 +65,62 @@ char qc, in_escape = FALSE;
 	smax--;
 
 	/* skip leading delimiters */
-	while (isspace((unsigned char) s[i]) || s[i] == ',') {
+	while (isspace((unsigned char) s[i]) || s[i] == ',')
+	{
 		/* mylog("skipping '%c'\n", s[i]); */
 		i++;
 	}
 
-	if (s[0] == '\0') {
+	if (s[0] == '\0')
+	{
 		token[0] = '\0';
 		return NULL;
 	}
 
-	if (quote) *quote = FALSE;
-	if (dquote) *dquote = FALSE;
-	if (numeric) *numeric = FALSE;
+	if (quote)
+		*quote = FALSE;
+	if (dquote)
+		*dquote = FALSE;
+	if (numeric)
+		*numeric = FALSE;
 
 	/* get the next token */
-	while ( ! isspace((unsigned char) s[i]) && s[i] != ',' &&
-			s[i] != '\0' && out != smax) {
+	while (!isspace((unsigned char) s[i]) && s[i] != ',' &&
+		   s[i] != '\0' && out != smax)
+	{
 
-		/*	Handle quoted stuff */
-		if ( out == 0 && (s[i] == '\"' || s[i] == '\'')) {
+		/* Handle quoted stuff */
+		if (out == 0 && (s[i] == '\"' || s[i] == '\''))
+		{
 			qc = s[i];
-			if (qc == '\"') {
-				if (dquote) *dquote = TRUE;
+			if (qc == '\"')
+			{
+				if (dquote)
+					*dquote = TRUE;
 			}
-			if (qc == '\'') {
-				if (quote) *quote = TRUE;
+			if (qc == '\'')
+			{
+				if (quote)
+					*quote = TRUE;
 			}
 
-			i++;		/* dont return the quote */
-			while (s[i] != '\0' && out != smax) {  
-				if (s[i] == qc && ! in_escape) {
+			i++;				/* dont return the quote */
+			while (s[i] != '\0' && out != smax)
+			{
+				if (s[i] == qc && !in_escape)
 					break;
-				}
 #ifdef MULTIBYTE
-				if (multibyte_char_check(s[i]) == 0 && s[i] == '\\' && ! in_escape) {
+				if (multibyte_char_check(s[i]) == 0 && s[i] == '\\' && !in_escape)
+				{
 #else
-				if (s[i] == '\\' && ! in_escape) {
+				if (s[i] == '\\' && !in_escape)
+				{
 #endif
 					in_escape = TRUE;
 				}
-				else {
-					in_escape = FALSE;	
+				else
+				{
+					in_escape = FALSE;
 					token[out++] = s[i];
 				}
 				i++;
@@ -115,20 +130,24 @@ char qc, in_escape = FALSE;
 			break;
 		}
 
-		/*	Check for numeric literals */
-		if ( out == 0 && isdigit((unsigned char) s[i])) {
-			if (numeric) *numeric = TRUE;
+		/* Check for numeric literals */
+		if (out == 0 && isdigit((unsigned char) s[i]))
+		{
+			if (numeric)
+				*numeric = TRUE;
 			token[out++] = s[i++];
-			while ( isalnum((unsigned char) s[i]) || s[i] == '.')
+			while (isalnum((unsigned char) s[i]) || s[i] == '.')
 				token[out++] = s[i++];
 
 			break;
 		}
 
-		if ( ispunct((unsigned char) s[i]) && s[i] != '_') {
+		if (ispunct((unsigned char) s[i]) && s[i] != '_')
+		{
 			mylog("got ispunct: s[%d] = '%c'\n", i, s[i]);
 
-			if (out == 0) {
+			if (out == 0)
+			{
 				token[out++] = s[i++];
 				break;
 			}
@@ -146,25 +165,30 @@ char qc, in_escape = FALSE;
 
 	token[out] = '\0';
 
-	/*	find the delimiter  */
-	while ( isspace((unsigned char) s[i]))
+	/* find the delimiter  */
+	while (isspace((unsigned char) s[i]))
 		i++;
 
-	/*	return the most priority delimiter */
-	if (s[i] == ',')  {
-		if (delim) *delim = s[i];
+	/* return the most priority delimiter */
+	if (s[i] == ',')
+	{
+		if (delim)
+			*delim = s[i];
 	}
-	else if (s[i] == '\0') {
-		if (delim) *delim = '\0';
+	else if (s[i] == '\0')
+	{
+		if (delim)
+			*delim = '\0';
 	}
-	else  {
-		if (delim) *delim = ' ';
+	else
+	{
+		if (delim)
+			*delim = ' ';
 	}
 
 	/* skip trailing blanks  */
-	while ( isspace((unsigned char) s[i])) {
+	while (isspace((unsigned char) s[i]))
 		i++;
-	}
 
 	return &s[i];
 }
@@ -195,23 +219,25 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
 	if (fi->name[0] == '\0')
 		strcpy(fi->name, QR_get_value_manual(col_info->result, k, 3));
 
-	fi->type = atoi( QR_get_value_manual(col_info->result, k, 13));
-	fi->precision = atoi( QR_get_value_manual(col_info->result, k, 6));
-	fi->length = atoi( QR_get_value_manual(col_info->result, k, 7));
-	fi->nullable = atoi( QR_get_value_manual(col_info->result, k, 10));
-	fi->display_size = atoi( QR_get_value_manual(col_info->result, k, 12));
+	fi->type = atoi(QR_get_value_manual(col_info->result, k, 13));
+	fi->precision = atoi(QR_get_value_manual(col_info->result, k, 6));
+	fi->length = atoi(QR_get_value_manual(col_info->result, k, 7));
+	fi->nullable = atoi(QR_get_value_manual(col_info->result, k, 10));
+	fi->display_size = atoi(QR_get_value_manual(col_info->result, k, 12));
 }
 
 char
 searchColInfo(COL_INFO *col_info, FIELD_INFO *fi)
 {
-int k;
-char *col;
+	int			k;
+	char	   *col;
 
 
-	for (k = 0; k < QR_get_num_tuples(col_info->result); k++) {
+	for (k = 0; k < QR_get_num_tuples(col_info->result); k++)
+	{
 		col = QR_get_value_manual(col_info->result, k, 3);
-		if ( ! strcmp(col, fi->name)) {
+		if (!strcmp(col, fi->name))
+		{
 			getColInfo(col_info, fi, k);
 
 			mylog("PARSE: searchColInfo: \n");
@@ -226,20 +252,37 @@ char *col;
 char
 parse_statement(StatementClass *stmt)
 {
-static char *func="parse_statement";
-char token[256];
-char delim, quote, dquote, numeric, unquoted;
-char *ptr;
-char in_select = FALSE, in_distinct = FALSE, in_on = FALSE, in_from = FALSE, in_where = FALSE, in_table = FALSE;
-char in_field = FALSE, in_expr = FALSE, in_func = FALSE, in_dot = FALSE, in_as = FALSE;
-int j, i, k = 0, n, blevel = 0;
-FIELD_INFO **fi;
-TABLE_INFO **ti;
-char parse;
-ConnectionClass *conn = stmt->hdbc;
-HSTMT hcol_stmt;
-StatementClass *col_stmt;
-RETCODE result;
+	static char *func = "parse_statement";
+	char		token[256];
+	char		delim,
+				quote,
+				dquote,
+				numeric,
+				unquoted;
+	char	   *ptr;
+	char		in_select = FALSE,
+				in_distinct = FALSE,
+				in_on = FALSE,
+				in_from = FALSE,
+				in_where = FALSE,
+				in_table = FALSE;
+	char		in_field = FALSE,
+				in_expr = FALSE,
+				in_func = FALSE,
+				in_dot = FALSE,
+				in_as = FALSE;
+	int			j,
+				i,
+				k = 0,
+				n,
+				blevel = 0;
+	FIELD_INFO **fi;
+	TABLE_INFO **ti;
+	char		parse;
+	ConnectionClass *conn = stmt->hdbc;
+	HSTMT		hcol_stmt;
+	StatementClass *col_stmt;
+	RETCODE		result;
 
 
 	mylog("%s: entering...\n", func);
@@ -251,34 +294,39 @@ RETCODE result;
 	stmt->nfld = 0;
 	stmt->ntab = 0;
 
-	while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL) {
+	while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL)
+	{
 
-		unquoted = ! ( quote || dquote );
+		unquoted = !(quote || dquote);
 
 		mylog("unquoted=%d, quote=%d, dquote=%d, numeric=%d, delim='%c', token='%s', ptr='%s'\n", unquoted, quote, dquote, numeric, delim, token, ptr);
 
-		if ( unquoted && ! stricmp(token, "select")) {
+		if (unquoted && !stricmp(token, "select"))
+		{
 			in_select = TRUE;
 
 			mylog("SELECT\n");
 			continue;
 		}
 
-		if ( unquoted && in_select && ! stricmp(token, "distinct")) {
+		if (unquoted && in_select && !stricmp(token, "distinct"))
+		{
 			in_distinct = TRUE;
 
 			mylog("DISTINCT\n");
 			continue;
 		}
 
-		if ( unquoted && ! stricmp(token, "into")) {
+		if (unquoted && !stricmp(token, "into"))
+		{
 			in_select = FALSE;
 
 			mylog("INTO\n");
 			continue;
 		}
 
-		if ( unquoted && ! stricmp(token, "from")) {
+		if (unquoted && !stricmp(token, "from"))
+		{
 			in_select = FALSE;
 			in_from = TRUE;
 
@@ -286,11 +334,12 @@ RETCODE result;
 			continue;
 		}
 
-		if ( unquoted && (! stricmp(token, "where") ||
-			! stricmp(token, "union") || 
-			! stricmp(token, "order") || 
-			! stricmp(token, "group") || 
-			! stricmp(token, "having"))) {
+		if (unquoted && (!stricmp(token, "where") ||
+						 !stricmp(token, "union") ||
+						 !stricmp(token, "order") ||
+						 !stricmp(token, "group") ||
+						 !stricmp(token, "having")))
+		{
 
 			in_select = FALSE;
 			in_from = FALSE;
@@ -300,44 +349,53 @@ RETCODE result;
 			break;
 		}
 
-		if (in_select) {
+		if (in_select)
+		{
 
-			if ( in_distinct) {
+			if (in_distinct)
+			{
 				mylog("in distinct\n");
 
-				if (unquoted && ! stricmp(token, "on")) {
+				if (unquoted && !stricmp(token, "on"))
+				{
 					in_on = TRUE;
 					mylog("got on\n");
 					continue;
 				}
-				if (in_on) {
+				if (in_on)
+				{
 					in_distinct = FALSE;
 					in_on = FALSE;
-					continue;		/*	just skip the unique on field */
+					continue;	/* just skip the unique on field */
 				}
 				mylog("done distinct\n");
 				in_distinct = FALSE;
 			}
 
-			if ( in_expr || in_func) {		/* just eat the expression */
+			if (in_expr || in_func)
+			{					/* just eat the expression */
 				mylog("in_expr=%d or func=%d\n", in_expr, in_func);
 				if (quote || dquote)
 					continue;
 
-				if (in_expr && blevel == 0 && delim == ',') {
+				if (in_expr && blevel == 0 && delim == ',')
+				{
 					mylog("**** in_expr and Got comma\n");
 					in_expr = FALSE;
 					in_field = FALSE;
 				}
 
-				else if (token[0] == '(') {
+				else if (token[0] == '(')
+				{
 					blevel++;
 					mylog("blevel++ = %d\n", blevel);
 				}
-				else if (token[0] == ')') {
+				else if (token[0] == ')')
+				{
 					blevel--;
 					mylog("blevel-- = %d\n", blevel);
-					if (delim==',') {
+					if (delim == ',')
+					{
 						in_func = FALSE;
 						in_expr = FALSE;
 						in_field = FALSE;
@@ -346,43 +404,50 @@ RETCODE result;
 				continue;
 			}
 
-			if ( ! in_field) {
+			if (!in_field)
+			{
 
-				if ( ! token[0])
+				if (!token[0])
 					continue;
 
-				if ( ! (stmt->nfld % FLD_INCR)) {
+				if (!(stmt->nfld % FLD_INCR))
+				{
 					mylog("reallocing at nfld=%d\n", stmt->nfld);
 					fi = (FIELD_INFO **) realloc(fi, (stmt->nfld + FLD_INCR) * sizeof(FIELD_INFO *));
-					if ( ! fi) {
+					if (!fi)
+					{
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
 					stmt->fi = fi;
 				}
 
-				fi[stmt->nfld] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
-				if (fi[stmt->nfld] == NULL) {
+				fi[stmt->nfld] = (FIELD_INFO *) malloc(sizeof(FIELD_INFO));
+				if (fi[stmt->nfld] == NULL)
+				{
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
 
-				/*	Initialize the field info */
+				/* Initialize the field info */
 				memset(fi[stmt->nfld], 0, sizeof(FIELD_INFO));
 
-				/*	double quotes are for qualifiers */
+				/* double quotes are for qualifiers */
 				if (dquote)
 					fi[stmt->nfld]->dquote = TRUE;
 
-				if (quote) {
+				if (quote)
+				{
 					fi[stmt->nfld++]->quote = TRUE;
 					continue;
 				}
-				else if (numeric) {
+				else if (numeric)
+				{
 					mylog("**** got numeric: nfld = %d\n", stmt->nfld);
 					fi[stmt->nfld]->numeric = TRUE;
 				}
-				else if (token[0] == '(') {		/* expression */
+				else if (token[0] == '(')
+				{				/* expression */
 					mylog("got EXPRESSION\n");
 					fi[stmt->nfld++]->expr = TRUE;
 					in_expr = TRUE;
@@ -390,33 +455,34 @@ RETCODE result;
 					continue;
 				}
 
-				else {
+				else
+				{
 					strcpy(fi[stmt->nfld]->name, token);
 					fi[stmt->nfld]->dot[0] = '\0';
 				}
 				mylog("got field='%s', dot='%s'\n", fi[stmt->nfld]->name, fi[stmt->nfld]->dot);
 
-				if (delim == ',') {
+				if (delim == ',')
 					mylog("comma (1)\n");
-				}
-				else {
+				else
 					in_field = TRUE;
-				}
 				stmt->nfld++;
 				continue;
 			}
 
 			/**************************/
-			/*	We are in a field now */
+			/* We are in a field now */
 			/**************************/
-			if (in_dot) {
+			if (in_dot)
+			{
 				stmt->nfld--;
 				strcpy(fi[stmt->nfld]->dot, fi[stmt->nfld]->name);
 				strcpy(fi[stmt->nfld]->name, token);
 				stmt->nfld++;
 				in_dot = FALSE;
 
-				if (delim == ',') {
+				if (delim == ',')
+				{
 					mylog("in_dot: got comma\n");
 					in_field = FALSE;
 				}
@@ -424,7 +490,8 @@ RETCODE result;
 				continue;
 			}
 
-			if (in_as) {
+			if (in_as)
+			{
 				stmt->nfld--;
 				strcpy(fi[stmt->nfld]->alias, token);
 				mylog("alias for field '%s' is '%s'\n", fi[stmt->nfld]->name, fi[stmt->nfld]->alias);
@@ -433,58 +500,69 @@ RETCODE result;
 
 				stmt->nfld++;
 
-				if (delim == ',') {
+				if (delim == ',')
 					mylog("comma(2)\n");
-				}
 				continue;
 			}
 
-			/*	Function */
-			if (token[0] == '(') {
+			/* Function */
+			if (token[0] == '(')
+			{
 				in_func = TRUE;
 				blevel = 1;
-				fi[stmt->nfld-1]->func = TRUE;
-				/*	name will have the function name -- maybe useful some day */
-				mylog("**** got function = '%s'\n", fi[stmt->nfld-1]->name);
+				fi[stmt->nfld - 1]->func = TRUE;
+
+				/*
+				 * name will have the function name -- maybe useful some
+				 * day
+				 */
+				mylog("**** got function = '%s'\n", fi[stmt->nfld - 1]->name);
 				continue;
 			}
 
-			if (token[0] == '.') {
-				in_dot = TRUE;	
+			if (token[0] == '.')
+			{
+				in_dot = TRUE;
 				mylog("got dot\n");
 				continue;
 			}
 
-			if ( ! stricmp(token, "as")) {
+			if (!stricmp(token, "as"))
+			{
 				in_as = TRUE;
 				mylog("got AS\n");
 				continue;
 			}
 
-			/*	otherwise, it's probably an expression */
+			/* otherwise, it's probably an expression */
 			in_expr = TRUE;
-			fi[stmt->nfld-1]->expr = TRUE;
-			fi[stmt->nfld-1]->name[0] = '\0';
+			fi[stmt->nfld - 1]->expr = TRUE;
+			fi[stmt->nfld - 1]->name[0] = '\0';
 			mylog("*** setting expression\n");
 
 		}
 
-		if (in_from) {
+		if (in_from)
+		{
 
-			if ( ! in_table) {
-				if ( ! token[0])
+			if (!in_table)
+			{
+				if (!token[0])
 					continue;
 
-				if ( ! (stmt->ntab % TAB_INCR)) {
+				if (!(stmt->ntab % TAB_INCR))
+				{
 					ti = (TABLE_INFO **) realloc(ti, (stmt->ntab + TAB_INCR) * sizeof(TABLE_INFO *));
-					if ( ! ti) {
+					if (!ti)
+					{
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
 					stmt->ti = ti;
 				}
 				ti[stmt->ntab] = (TABLE_INFO *) malloc(sizeof(TABLE_INFO));
-				if (ti[stmt->ntab] == NULL) {
+				if (ti[stmt->ntab] == NULL)
+				{
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
@@ -494,57 +572,61 @@ RETCODE result;
 				strcpy(ti[stmt->ntab]->name, token);
 				mylog("got table = '%s'\n", ti[stmt->ntab]->name);
 
-				if (delim == ',') {
+				if (delim == ',')
 					mylog("more than 1 tables\n");
-				}
-				else {
+				else
 					in_table = TRUE;
-				}
 				stmt->ntab++;
 				continue;
 			}
 
-			strcpy(ti[stmt->ntab-1]->alias, token);
-			mylog("alias for table '%s' is '%s'\n", ti[stmt->ntab-1]->name, ti[stmt->ntab-1]->alias);
+			strcpy(ti[stmt->ntab - 1]->alias, token);
+			mylog("alias for table '%s' is '%s'\n", ti[stmt->ntab - 1]->name, ti[stmt->ntab - 1]->alias);
 			in_table = FALSE;
-			if (delim == ',') {
+			if (delim == ',')
 				mylog("more than 1 tables\n");
-			}
 		}
 	}
 
 
 	/*************************************************/
-	/*	Resolve any possible field names with tables */
+	/* Resolve any possible field names with tables */
 	/*************************************************/
 
 	parse = TRUE;
 
-	/*	Resolve field names with tables */
-	for (i = 0; i < stmt->nfld; i++) {
+	/* Resolve field names with tables */
+	for (i = 0; i < stmt->nfld; i++)
+	{
 
-		if (fi[i]->func || fi[i]->expr || fi[i]->numeric) {
+		if (fi[i]->func || fi[i]->expr || fi[i]->numeric)
+		{
 			fi[i]->ti = NULL;
 			fi[i]->type = -1;
 			parse = FALSE;
 			continue;
 		}
 
-		else if (fi[i]->quote) {		/* handle as text */
+		else if (fi[i]->quote)
+		{						/* handle as text */
 			fi[i]->ti = NULL;
 			fi[i]->type = PG_TYPE_TEXT;
 			fi[i]->precision = 0;
 			continue;
-		} 
+		}
 
-		/*	it's a dot, resolve to table or alias */
-		else if (fi[i]->dot[0]) {
-			for (k = 0; k < stmt->ntab; k++) {
-				if ( ! stricmp(ti[k]->name, fi[i]->dot)) {
+		/* it's a dot, resolve to table or alias */
+		else if (fi[i]->dot[0])
+		{
+			for (k = 0; k < stmt->ntab; k++)
+			{
+				if (!stricmp(ti[k]->name, fi[i]->dot))
+				{
 					fi[i]->ti = ti[k];
 					break;
 				}
-				else if ( ! stricmp(ti[k]->alias, fi[i]->dot)) {
+				else if (!stricmp(ti[k]->alias, fi[i]->dot))
+				{
 					fi[i]->ti = ti[k];
 					break;
 				}
@@ -557,41 +639,47 @@ RETCODE result;
 	mylog("--------------------------------------------\n");
 	mylog("nfld=%d, ntab=%d\n", stmt->nfld, stmt->ntab);
 
-	for (i=0; i < stmt->nfld; i++) {
+	for (i = 0; i < stmt->nfld; i++)
+	{
 		mylog("Field %d:  expr=%d, func=%d, quote=%d, dquote=%d, numeric=%d, name='%s', alias='%s', dot='%s'\n", i, fi[i]->expr, fi[i]->func, fi[i]->quote, fi[i]->dquote, fi[i]->numeric, fi[i]->name, fi[i]->alias, fi[i]->dot);
 		if (fi[i]->ti)
-		mylog("     ----> table_name='%s', table_alias='%s'\n", fi[i]->ti->name, fi[i]->ti->alias);
+			mylog("     ----> table_name='%s', table_alias='%s'\n", fi[i]->ti->name, fi[i]->ti->alias);
 	}
 
-	for (i=0; i < stmt->ntab; i++) {
+	for (i = 0; i < stmt->ntab; i++)
 		mylog("Table %d: name='%s', alias='%s'\n", i, ti[i]->name, ti[i]->alias);
-	}
 
 
 	/******************************************************/
-	/*	Now save the SQLColumns Info for the parse tables */
+	/* Now save the SQLColumns Info for the parse tables */
 	/******************************************************/
 
 
-	/*	Call SQLColumns for each table and store the result */
-	for (i = 0; i < stmt->ntab; i++) {
+	/* Call SQLColumns for each table and store the result */
+	for (i = 0; i < stmt->ntab; i++)
+	{
+
+		/* See if already got it */
+		char		found = FALSE;
 
-		/*	See if already got it */
-		char found = FALSE;
-		for (k = 0; k < conn->ntables; k++) {
-			if ( ! stricmp(conn->col_info[k]->name, ti[i]->name)) {
+		for (k = 0; k < conn->ntables; k++)
+		{
+			if (!stricmp(conn->col_info[k]->name, ti[i]->name))
+			{
 				mylog("FOUND col_info table='%s'\n", ti[i]->name);
 				found = TRUE;
 				break;
 			}
 		}
-				
-		if ( ! found) {
+
+		if (!found)
+		{
 
 			mylog("PARSE: Getting SQLColumns for table[%d]='%s'\n", i, ti[i]->name);
 
-			result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
-			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+			result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
+			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+			{
 				stmt->errormsg = "SQLAllocStmt failed in parse_statement for columns.";
 				stmt->errornumber = STMT_NO_MEMORY_ERROR;
 				stmt->parse_status = STMT_PARSE_FATAL;
@@ -601,18 +689,21 @@ RETCODE result;
 			col_stmt = (StatementClass *) hcol_stmt;
 			col_stmt->internal = TRUE;
 
-			result = SQLColumns(hcol_stmt, "", 0, "", 0, 
+			result = SQLColumns(hcol_stmt, "", 0, "", 0,
 						ti[i]->name, (SWORD) strlen(ti[i]->name), "", 0);
-		
+
 			mylog("        Past SQLColumns\n");
-			if (result == SQL_SUCCESS) {
+			if (result == SQL_SUCCESS)
+			{
 				mylog("      Success\n");
-				if ( ! (conn->ntables % COL_INCR)) {
+				if (!(conn->ntables % COL_INCR))
+				{
 
 					mylog("PARSE: Allocing col_info at ntables=%d\n", conn->ntables);
 
 					conn->col_info = (COL_INFO **) realloc(conn->col_info, (conn->ntables + COL_INCR) * sizeof(COL_INFO *));
-					if ( ! conn->col_info) {
+					if (!conn->col_info)
+					{
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
@@ -620,18 +711,23 @@ RETCODE result;
 
 				mylog("PARSE: malloc at conn->col_info[%d]\n", conn->ntables);
 				conn->col_info[conn->ntables] = (COL_INFO *) malloc(sizeof(COL_INFO));
-				if ( ! conn->col_info[conn->ntables]) {
+				if (!conn->col_info[conn->ntables])
+				{
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
 
-				/*	Store the table name and the SQLColumns result structure */
+				/*
+				 * Store the table name and the SQLColumns result
+				 * structure
+				 */
 				strcpy(conn->col_info[conn->ntables]->name, ti[i]->name);
 				conn->col_info[conn->ntables]->result = col_stmt->result;
 
-				/*	The connection will now free the result structures, so make
-					sure that the statement doesn't free it 
-				*/
+				/*
+				 * The connection will now free the result structures, so
+				 * make sure that the statement doesn't free it
+				 */
 				col_stmt->result = NULL;
 
 				conn->ntables++;
@@ -639,13 +735,14 @@ RETCODE result;
 				SQLFreeStmt(hcol_stmt, SQL_DROP);
 				mylog("Created col_info table='%s', ntables=%d\n", ti[i]->name, conn->ntables);
 			}
-			else {
+			else
+			{
 				SQLFreeStmt(hcol_stmt, SQL_DROP);
 				break;
 			}
 		}
 
-		/*	Associate a table from the statement with a SQLColumn info */
+		/* Associate a table from the statement with a SQLColumn info */
 		ti[i]->col_info = conn->col_info[k];
 		mylog("associate col_info: i=%d, k=%d\n", i, k);
 	}
@@ -654,54 +751,64 @@ RETCODE result;
 	mylog("Done SQLColumns\n");
 
 	/******************************************************/
-	/*	Now resolve the fields to point to column info    */
+	/* Now resolve the fields to point to column info	 */
 	/******************************************************/
 
 
 
-	for (i = 0; i < stmt->nfld;) {
+	for (i = 0; i < stmt->nfld;)
+	{
 
-		/*	Dont worry about functions or quotes */
-		if (fi[i]->func || fi[i]->quote || fi[i]->numeric) {
+		/* Dont worry about functions or quotes */
+		if (fi[i]->func || fi[i]->quote || fi[i]->numeric)
+		{
 			i++;
 			continue;
 		}
 
-		/*	Stars get expanded to all fields in the table */
-		else if (fi[i]->name[0] == '*') {
+		/* Stars get expanded to all fields in the table */
+		else if (fi[i]->name[0] == '*')
+		{
 
-			char do_all_tables;
-			int total_cols, old_alloc, new_size, cols;
-			int increased_cols;
+			char		do_all_tables;
+			int			total_cols,
+						old_alloc,
+						new_size,
+						cols;
+			int			increased_cols;
 
 			mylog("expanding field %d\n", i);
 
-			total_cols = 0;	
+			total_cols = 0;
 
-			if (fi[i]->ti)	/*	The star represents only the qualified table */
+			if (fi[i]->ti)		/* The star represents only the qualified
+								 * table */
 				total_cols = QR_get_num_tuples(fi[i]->ti->col_info->result);
 
-			else {	/*	The star represents all tables */
+			else
+			{					/* The star represents all tables */
 
-				/*	Calculate the total number of columns after expansion */
-				for (k = 0; k < stmt->ntab; k++) {
+				/* Calculate the total number of columns after expansion */
+				for (k = 0; k < stmt->ntab; k++)
 					total_cols += QR_get_num_tuples(ti[k]->col_info->result);
-				}
 			}
 			increased_cols = total_cols - 1;
 
-			/*	Allocate some more field pointers if necessary */
+			/* Allocate some more field pointers if necessary */
 			/*------------------------------------------------------------- */
-			old_alloc = ((stmt->nfld  - 1) / FLD_INCR + 1) * FLD_INCR;
+			old_alloc = ((stmt->nfld - 1) / FLD_INCR + 1) * FLD_INCR;
 			new_size = stmt->nfld + increased_cols;
 
-			mylog("k=%d, increased_cols=%d, old_alloc=%d, new_size=%d\n", k,increased_cols,old_alloc,new_size);
+			mylog("k=%d, increased_cols=%d, old_alloc=%d, new_size=%d\n", k, increased_cols, old_alloc, new_size);
+
+			if (new_size > old_alloc)
+			{
+				int			new_alloc = ((new_size / FLD_INCR) + 1) * FLD_INCR;
 
-			if (new_size > old_alloc) {
-				int new_alloc = ((new_size / FLD_INCR) + 1) * FLD_INCR;
 				mylog("need more cols: new_alloc = %d\n", new_alloc);
 				fi = (FIELD_INFO **) realloc(fi, new_alloc * sizeof(FIELD_INFO *));
-				if ( ! fi) {
+				if (!fi)
+				{
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
@@ -709,43 +816,52 @@ RETCODE result;
 			}
 
 			/*------------------------------------------------------------- */
-			/*	copy any other fields (if there are any) up past the expansion */
-			for (j = stmt->nfld - 1; j > i; j--) {
+
+			/*
+			 * copy any other fields (if there are any) up past the
+			 * expansion
+			 */
+			for (j = stmt->nfld - 1; j > i; j--)
+			{
 				mylog("copying field %d to %d\n", j, increased_cols + j);
 				fi[increased_cols + j] = fi[j];
 			}
 			mylog("done copying fields\n");
 
 			/*------------------------------------------------------------- */
-			/*	Set the new number of fields */
+			/* Set the new number of fields */
 			stmt->nfld += increased_cols;
 			mylog("stmt->nfld now at %d\n", stmt->nfld);
 
 
 			/*------------------------------------------------------------- */
-			/*	copy the new field info */
+			/* copy the new field info */
 
 
 			do_all_tables = (fi[i]->ti ? FALSE : TRUE);
 
-			for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++) {
+			for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++)
+			{
 
 				TABLE_INFO *the_ti = do_all_tables ? ti[k] : fi[i]->ti;
 
 				cols = QR_get_num_tuples(the_ti->col_info->result);
 
-				for (n = 0; n < cols; n++) {
+				for (n = 0; n < cols; n++)
+				{
 					mylog("creating field info: n=%d\n", n);
 					/* skip malloc (already did it for the Star) */
-					if (k > 0 || n > 0) {
+					if (k > 0 || n > 0)
+					{
 						mylog("allocating field info at %d\n", n + i);
-						fi[n + i] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
-						if (fi[n + i] == NULL) {
+						fi[n + i] = (FIELD_INFO *) malloc(sizeof(FIELD_INFO));
+						if (fi[n + i] == NULL)
+						{
 							stmt->parse_status = STMT_PARSE_FATAL;
 							return FALSE;
 						}
 					}
-					/*	Initialize the new space (or the * field) */
+					/* Initialize the new space (or the * field) */
 					memset(fi[n + i], 0, sizeof(FIELD_INFO));
 					fi[n + i]->ti = the_ti;
 
@@ -763,22 +879,28 @@ RETCODE result;
 			/*------------------------------------------------------------- */
 		}
 
-		/*	We either know which table the field was in because it was qualified 
-			with a table name or alias -OR- there was only 1 table.
-		*/
-		else if (fi[i]->ti) {
+		/*
+		 * We either know which table the field was in because it was
+		 * qualified with a table name or alias -OR- there was only 1
+		 * table.
+		 */
+		else if (fi[i]->ti)
+		{
 
-			if ( ! searchColInfo(fi[i]->ti->col_info, fi[i]))
+			if (!searchColInfo(fi[i]->ti->col_info, fi[i]))
 				parse = FALSE;
 
 			i++;
 		}
 
-		/*	Don't know the table -- search all tables in "from" list */
-		else {
+		/* Don't know the table -- search all tables in "from" list */
+		else
+		{
 			parse = FALSE;
-			for (k = 0; k < stmt->ntab; k++) {
-				if ( searchColInfo(ti[k]->col_info, fi[i])) {
+			for (k = 0; k < stmt->ntab; k++)
+			{
+				if (searchColInfo(ti[k]->col_info, fi[i]))
+				{
 					fi[i]->ti = ti[k];	/* now know the table */
 					parse = TRUE;
 					break;
@@ -789,7 +911,7 @@ RETCODE result;
 	}
 
 
-	if ( ! parse)
+	if (!parse)
 		stmt->parse_status = STMT_PARSE_INCOMPLETE;
 	else
 		stmt->parse_status = STMT_PARSE_COMPLETE;
@@ -798,4 +920,3 @@ RETCODE result;
 	mylog("done parse_statement: parse=%d, parse_status=%d\n", parse, stmt->parse_status);
 	return parse;
 }
-
diff --git a/src/interfaces/odbc/pgtypes.c b/src/interfaces/odbc/pgtypes.c
index ebee8ab262f55eff03741817143a4a1e7bfd65a4..a70d989e6679e38915e5d2570cef2d3f78a3576c 100644
--- a/src/interfaces/odbc/pgtypes.c
+++ b/src/interfaces/odbc/pgtypes.c
@@ -1,17 +1,17 @@
 
-/* Module:          pgtypes.c
+/* Module:			pgtypes.c
  *
- * Description:     This module contains routines for getting information
- *                  about the supported Postgres data types.  Only the function
- *                  pgtype_to_sqltype() returns an unknown condition.  All other
- *                  functions return a suitable default so that even data types that
- *                  are not directly supported can be used (it is handled as char data).
+ * Description:		This module contains routines for getting information
+ *					about the supported Postgres data types.  Only the function
+ *					pgtype_to_sqltype() returns an unknown condition.  All other
+ *					functions return a suitable default so that even data types that
+ *					are not directly supported can be used (it is handled as char data).
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -39,48 +39,48 @@
 
 extern GLOBAL_VALUES globals;
 
-Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4		getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
 
 
-/* these are the types we support.  all of the pgtype_ functions should */
-/* return values for each one of these.                                 */
-/* Even types not directly supported are handled as character types	
+/* these are the types we support.	all of the pgtype_ functions should */
+/* return values for each one of these.									*/
+/* Even types not directly supported are handled as character types
    so all types should work (points, etc.) */
 
 /* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo.  Instead, all
-   the SQL TYPES are reported and mapped to a corresponding Postgres Type 
+   the SQL TYPES are reported and mapped to a corresponding Postgres Type
 */
 /*
-Int4 pgtypes_defined[]  = { 
+Int4 pgtypes_defined[]	= {
 				PG_TYPE_CHAR,
 				PG_TYPE_CHAR2,
 				PG_TYPE_CHAR4,
-			    PG_TYPE_CHAR8,
+				PG_TYPE_CHAR8,
 				PG_TYPE_CHAR16,
-			    PG_TYPE_NAME,
-			    PG_TYPE_VARCHAR,
-			    PG_TYPE_BPCHAR,
+				PG_TYPE_NAME,
+				PG_TYPE_VARCHAR,
+				PG_TYPE_BPCHAR,
 				PG_TYPE_DATE,
 				PG_TYPE_TIME,
 				PG_TYPE_DATETIME,
 				PG_TYPE_ABSTIME,
 				PG_TYPE_TIMESTAMP,
-			    PG_TYPE_TEXT,
-			    PG_TYPE_INT2,
-			    PG_TYPE_INT4,
-			    PG_TYPE_FLOAT4,
-			    PG_TYPE_FLOAT8,
-			    PG_TYPE_OID,
+				PG_TYPE_TEXT,
+				PG_TYPE_INT2,
+				PG_TYPE_INT4,
+				PG_TYPE_FLOAT4,
+				PG_TYPE_FLOAT8,
+				PG_TYPE_OID,
 				PG_TYPE_MONEY,
 				PG_TYPE_BOOL,
 				PG_TYPE_BYTEA,
 				PG_TYPE_LO,
-			    0 };
+				0 };
 */
 
 
 /*	These are NOW the SQL Types reported in SQLGetTypeInfo.  */
-Int2 sqlTypes [] = {
+Int2		sqlTypes[] = {
 	SQL_BIGINT,
 	/* SQL_BINARY, -- Commented out because VarBinary is more correct. */
 	SQL_BIT,
@@ -103,232 +103,303 @@ Int2 sqlTypes [] = {
 	0
 };
 
-Int4 sqltype_to_pgtype(SWORD fSqlType)
+Int4
+sqltype_to_pgtype(SWORD fSqlType)
 {
-Int4 pgType;
+	Int4		pgType;
 
-	switch(fSqlType) {
+	switch (fSqlType)
+	{
 
-	case SQL_BINARY:
-		pgType = PG_TYPE_BYTEA;
-		break;
+		case SQL_BINARY:
+			pgType = PG_TYPE_BYTEA;
+			break;
 
-	case SQL_CHAR:
-		pgType = PG_TYPE_BPCHAR;
-		break;
+		case SQL_CHAR:
+			pgType = PG_TYPE_BPCHAR;
+			break;
 
-	case SQL_BIT:
-		pgType = globals.bools_as_char ? PG_TYPE_CHAR : PG_TYPE_BOOL;
-		break;
+		case SQL_BIT:
+			pgType = globals.bools_as_char ? PG_TYPE_CHAR : PG_TYPE_BOOL;
+			break;
 
-	case SQL_DATE:
-		pgType = PG_TYPE_DATE;
-		break;
+		case SQL_DATE:
+			pgType = PG_TYPE_DATE;
+			break;
 
-	case SQL_DOUBLE:
-	case SQL_FLOAT:
-		pgType = PG_TYPE_FLOAT8;
-		break;
+		case SQL_DOUBLE:
+		case SQL_FLOAT:
+			pgType = PG_TYPE_FLOAT8;
+			break;
 
-	case SQL_DECIMAL:
-	case SQL_NUMERIC:
-		pgType = PG_TYPE_NUMERIC;
-		break;
+		case SQL_DECIMAL:
+		case SQL_NUMERIC:
+			pgType = PG_TYPE_NUMERIC;
+			break;
 
-	case SQL_BIGINT:
-		pgType = PG_TYPE_INT8;
-		break;
+		case SQL_BIGINT:
+			pgType = PG_TYPE_INT8;
+			break;
 
-	case SQL_INTEGER:
-		pgType = PG_TYPE_INT4;
-		break;
+		case SQL_INTEGER:
+			pgType = PG_TYPE_INT4;
+			break;
 
-	case SQL_LONGVARBINARY:
-		pgType = PG_TYPE_LO;
-		break;
+		case SQL_LONGVARBINARY:
+			pgType = PG_TYPE_LO;
+			break;
 
-	case SQL_LONGVARCHAR:
-		pgType = globals.text_as_longvarchar ? PG_TYPE_TEXT : PG_TYPE_VARCHAR;
-		break;
+		case SQL_LONGVARCHAR:
+			pgType = globals.text_as_longvarchar ? PG_TYPE_TEXT : PG_TYPE_VARCHAR;
+			break;
 
-	case SQL_REAL:
-		pgType = PG_TYPE_FLOAT4;
-		break;
+		case SQL_REAL:
+			pgType = PG_TYPE_FLOAT4;
+			break;
 
-	case SQL_SMALLINT:
-	case SQL_TINYINT:
-		pgType = PG_TYPE_INT2;
-		break;
+		case SQL_SMALLINT:
+		case SQL_TINYINT:
+			pgType = PG_TYPE_INT2;
+			break;
 
-	case SQL_TIME:
-		pgType = PG_TYPE_TIME;
-		break;
+		case SQL_TIME:
+			pgType = PG_TYPE_TIME;
+			break;
 
-	case SQL_TIMESTAMP:
-		pgType = PG_TYPE_DATETIME;
-		break;
+		case SQL_TIMESTAMP:
+			pgType = PG_TYPE_DATETIME;
+			break;
 
-	case SQL_VARBINARY:
-		pgType = PG_TYPE_BYTEA;
-		break;
+		case SQL_VARBINARY:
+			pgType = PG_TYPE_BYTEA;
+			break;
 
-	case SQL_VARCHAR:
-		pgType = PG_TYPE_VARCHAR;
-		break;
+		case SQL_VARCHAR:
+			pgType = PG_TYPE_VARCHAR;
+			break;
 
-	default:
-	  	pgType = 0;	/* ??? */
-		break;
+		default:
+			pgType = 0;			/* ??? */
+			break;
 	}
 
 	return pgType;
 }
 
-/*	There are two ways of calling this function:  
+/*	There are two ways of calling this function:
 	1.	When going through the supported PG types (SQLGetTypeInfo)
 	2.	When taking any type id (SQLColumns, SQLGetData)
 
 	The first type will always work because all the types defined are returned here.
-	The second type will return a default based on global parameter when it does not 
-	know.  	This allows for supporting
+	The second type will return a default based on global parameter when it does not
+	know.	This allows for supporting
 	types that are unknown.  All other pg routines in here return a suitable default.
 */
-Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
+Int2
+pgtype_to_sqltype(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_CHAR:
-	case PG_TYPE_CHAR2:
-	case PG_TYPE_CHAR4:
-	case PG_TYPE_CHAR8:
-	case PG_TYPE_NAME:  		return SQL_CHAR;        
-
-	case PG_TYPE_BPCHAR:		return SQL_CHAR;
-
-	case PG_TYPE_VARCHAR:		return SQL_VARCHAR;
-
-	case PG_TYPE_TEXT:			return globals.text_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
-
-	case PG_TYPE_BYTEA:			return SQL_VARBINARY;
-	case PG_TYPE_LO:			return SQL_LONGVARBINARY;
-
-	case PG_TYPE_INT2:          return SQL_SMALLINT;
-
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:          return SQL_INTEGER;
-
-	/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
-	case PG_TYPE_INT8:			return SQL_CHAR;
-
-	case PG_TYPE_NUMERIC:		return SQL_NUMERIC;
-
-	case PG_TYPE_FLOAT4:        return SQL_REAL;
-	case PG_TYPE_FLOAT8:        return SQL_FLOAT;
-	case PG_TYPE_DATE:			return SQL_DATE;
-	case PG_TYPE_TIME:			return SQL_TIME;
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:		
-	case PG_TYPE_TIMESTAMP:		return SQL_TIMESTAMP;
-	case PG_TYPE_MONEY:			return SQL_FLOAT;
-	case PG_TYPE_BOOL:			return globals.bools_as_char ? SQL_CHAR : SQL_BIT;
-
-	default:                
-
-		/*	first, check to see if 'type' is in list.  If not, look up with query.
-			Add oid, name to list.  If it's already in list, just return.
-		*/
-		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
+	switch (type)
+	{
+			case PG_TYPE_CHAR:
+			case PG_TYPE_CHAR2:
+			case PG_TYPE_CHAR4:
+			case PG_TYPE_CHAR8:
+			case PG_TYPE_NAME:return SQL_CHAR;
+
+		case PG_TYPE_BPCHAR:
+			return SQL_CHAR;
+
+		case PG_TYPE_VARCHAR:
+			return SQL_VARCHAR;
+
+		case PG_TYPE_TEXT:
+			return globals.text_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
+
+		case PG_TYPE_BYTEA:
+			return SQL_VARBINARY;
+		case PG_TYPE_LO:
 			return SQL_LONGVARBINARY;
 
-		return globals.unknowns_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
+		case PG_TYPE_INT2:
+			return SQL_SMALLINT;
+
+		case PG_TYPE_OID:
+		case PG_TYPE_XID:
+		case PG_TYPE_INT4:
+			return SQL_INTEGER;
+
+			/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
+		case PG_TYPE_INT8:
+			return SQL_CHAR;
+
+		case PG_TYPE_NUMERIC:
+			return SQL_NUMERIC;
+
+		case PG_TYPE_FLOAT4:
+			return SQL_REAL;
+		case PG_TYPE_FLOAT8:
+			return SQL_FLOAT;
+		case PG_TYPE_DATE:
+			return SQL_DATE;
+		case PG_TYPE_TIME:
+			return SQL_TIME;
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			return SQL_TIMESTAMP;
+		case PG_TYPE_MONEY:
+			return SQL_FLOAT;
+		case PG_TYPE_BOOL:
+			return globals.bools_as_char ? SQL_CHAR : SQL_BIT;
+
+		default:
+
+			/*
+			 * first, check to see if 'type' is in list.  If not, look up
+			 * with query. Add oid, name to list.  If it's already in
+			 * list, just return.
+			 */
+			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
+												 * type is available */
+				return SQL_LONGVARBINARY;
+
+			return globals.unknowns_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
 	}
 }
 
-Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type)
+Int2
+pgtype_to_ctype(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_INT8:			return SQL_C_CHAR;
-	case PG_TYPE_NUMERIC:		return SQL_C_CHAR;
-	case PG_TYPE_INT2:          return SQL_C_SSHORT;
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:          return SQL_C_SLONG;
-	case PG_TYPE_FLOAT4:        return SQL_C_FLOAT;
-	case PG_TYPE_FLOAT8:        return SQL_C_DOUBLE;
-	case PG_TYPE_DATE:			return SQL_C_DATE;
-	case PG_TYPE_TIME:			return SQL_C_TIME;
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:
-	case PG_TYPE_TIMESTAMP:		return SQL_C_TIMESTAMP;
-	case PG_TYPE_MONEY:			return SQL_C_FLOAT;
-	case PG_TYPE_BOOL:			return globals.bools_as_char ? SQL_C_CHAR : SQL_C_BIT;
-
-	case PG_TYPE_BYTEA:			return SQL_C_BINARY;
-	case PG_TYPE_LO:			return SQL_C_BINARY;
-
-	default:                    
-
-		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
+	switch (type)
+	{
+			case PG_TYPE_INT8:return SQL_C_CHAR;
+		case PG_TYPE_NUMERIC:
+			return SQL_C_CHAR;
+		case PG_TYPE_INT2:
+			return SQL_C_SSHORT;
+		case PG_TYPE_OID:
+		case PG_TYPE_XID:
+		case PG_TYPE_INT4:
+			return SQL_C_SLONG;
+		case PG_TYPE_FLOAT4:
+			return SQL_C_FLOAT;
+		case PG_TYPE_FLOAT8:
+			return SQL_C_DOUBLE;
+		case PG_TYPE_DATE:
+			return SQL_C_DATE;
+		case PG_TYPE_TIME:
+			return SQL_C_TIME;
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			return SQL_C_TIMESTAMP;
+		case PG_TYPE_MONEY:
+			return SQL_C_FLOAT;
+		case PG_TYPE_BOOL:
+			return globals.bools_as_char ? SQL_C_CHAR : SQL_C_BIT;
+
+		case PG_TYPE_BYTEA:
 			return SQL_C_BINARY;
+		case PG_TYPE_LO:
+			return SQL_C_BINARY;
+
+		default:
+
+			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
+												 * type is available */
+				return SQL_C_BINARY;
 
-		return SQL_C_CHAR;
+			return SQL_C_CHAR;
 	}
 }
 
-char *pgtype_to_name(StatementClass *stmt, Int4 type)
+char *
+pgtype_to_name(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_CHAR:          return "char";
-	case PG_TYPE_CHAR2:			return "char2";
-	case PG_TYPE_CHAR4:			return "char4";
-	case PG_TYPE_CHAR8:         return "char8";
-	case PG_TYPE_INT8:			return "int8";
-	case PG_TYPE_NUMERIC:		return "numeric";
-	case PG_TYPE_VARCHAR:       return "varchar";
-	case PG_TYPE_BPCHAR:        return "char";
-	case PG_TYPE_TEXT:          return "text";
-	case PG_TYPE_NAME:          return "name";
-	case PG_TYPE_INT2:          return "int2";
-	case PG_TYPE_OID:           return "oid";
-	case PG_TYPE_INT4:          return "int4";
-	case PG_TYPE_FLOAT4:        return "float4";
-	case PG_TYPE_FLOAT8:        return "float8";
-	case PG_TYPE_DATE:			return "date";
-	case PG_TYPE_TIME:			return "time";
-	case PG_TYPE_ABSTIME:		return "abstime";
-	case PG_TYPE_DATETIME:		return "datetime";
-	case PG_TYPE_TIMESTAMP:		return "timestamp";
-	case PG_TYPE_MONEY:			return "money";
-	case PG_TYPE_BOOL:			return "bool";
-	case PG_TYPE_BYTEA:			return "bytea";
-
-	case PG_TYPE_LO:			return PG_TYPE_LO_NAME;
-
-	default:                    
-		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
+	switch (type)
+	{
+			case PG_TYPE_CHAR:return "char";
+		case PG_TYPE_CHAR2:
+			return "char2";
+		case PG_TYPE_CHAR4:
+			return "char4";
+		case PG_TYPE_CHAR8:
+			return "char8";
+		case PG_TYPE_INT8:
+			return "int8";
+		case PG_TYPE_NUMERIC:
+			return "numeric";
+		case PG_TYPE_VARCHAR:
+			return "varchar";
+		case PG_TYPE_BPCHAR:
+			return "char";
+		case PG_TYPE_TEXT:
+			return "text";
+		case PG_TYPE_NAME:
+			return "name";
+		case PG_TYPE_INT2:
+			return "int2";
+		case PG_TYPE_OID:
+			return "oid";
+		case PG_TYPE_INT4:
+			return "int4";
+		case PG_TYPE_FLOAT4:
+			return "float4";
+		case PG_TYPE_FLOAT8:
+			return "float8";
+		case PG_TYPE_DATE:
+			return "date";
+		case PG_TYPE_TIME:
+			return "time";
+		case PG_TYPE_ABSTIME:
+			return "abstime";
+		case PG_TYPE_DATETIME:
+			return "datetime";
+		case PG_TYPE_TIMESTAMP:
+			return "timestamp";
+		case PG_TYPE_MONEY:
+			return "money";
+		case PG_TYPE_BOOL:
+			return "bool";
+		case PG_TYPE_BYTEA:
+			return "bytea";
+
+		case PG_TYPE_LO:
 			return PG_TYPE_LO_NAME;
 
-		/* "unknown" can actually be used in alter table because it is a real PG type! */
-		return "unknown";	
-	}    
+		default:
+			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
+												 * type is available */
+				return PG_TYPE_LO_NAME;
+
+			/*
+			 * "unknown" can actually be used in alter table because it is
+			 * a real PG type!
+			 */
+			return "unknown";
+	}
 }
 
 static Int2
 getNumericScale(StatementClass *stmt, Int4 type, int col)
 {
-Int4 atttypmod;
-QResultClass *result;
-ColumnInfoClass *flds;
+	Int4		atttypmod;
+	QResultClass *result;
+	ColumnInfoClass *flds;
 
-mylog("getNumericScale: type=%d, col=%d, unknown = %d\n", type,col);
+	mylog("getNumericScale: type=%d, col=%d, unknown = %d\n", type, col);
 
 	if (col < 0)
 		return PG_NUMERIC_MAX_SCALE;
 
 	result = SC_get_Result(stmt);
 
-	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
-	if (stmt->manual_result) {
+	/*
+	 * Manual Result Sets -- use assigned column width (i.e., from
+	 * set_tuplefield_string)
+	 */
+	if (stmt->manual_result)
+	{
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -337,30 +408,34 @@ mylog("getNumericScale: type=%d, col=%d, unknown = %d\n", type,col);
 	}
 
 	atttypmod = QR_get_atttypmod(result, col);
-	if ( atttypmod > -1 )
+	if (atttypmod > -1)
 		return (atttypmod & 0xffff);
 	else
-		return ( QR_get_display_size(result, col) ? 
-			QR_get_display_size(result, col) : 
-			PG_NUMERIC_MAX_SCALE);
+		return (QR_get_display_size(result, col) ?
+				QR_get_display_size(result, col) :
+				PG_NUMERIC_MAX_SCALE);
 }
 
 static Int4
 getNumericPrecision(StatementClass *stmt, Int4 type, int col)
 {
-Int4 atttypmod;
-QResultClass *result;
-ColumnInfoClass *flds;
+	Int4		atttypmod;
+	QResultClass *result;
+	ColumnInfoClass *flds;
 
-mylog("getNumericPrecision: type=%d, col=%d, unknown = %d\n", type,col);
+	mylog("getNumericPrecision: type=%d, col=%d, unknown = %d\n", type, col);
 
 	if (col < 0)
 		return PG_NUMERIC_MAX_PRECISION;
 
 	result = SC_get_Result(stmt);
 
-	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
-	if (stmt->manual_result) {
+	/*
+	 * Manual Result Sets -- use assigned column width (i.e., from
+	 * set_tuplefield_string)
+	 */
+	if (stmt->manual_result)
+	{
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -369,55 +444,62 @@ mylog("getNumericPrecision: type=%d, col=%d, unknown = %d\n", type,col);
 	}
 
 	atttypmod = QR_get_atttypmod(result, col);
-	if ( atttypmod > -1 )
+	if (atttypmod > -1)
 		return (atttypmod >> 16) & 0xffff;
 	else
-		return ( QR_get_display_size(result, col) >= 0 ? 
-			QR_get_display_size(result, col) : 
-			PG_NUMERIC_MAX_PRECISION );
+		return (QR_get_display_size(result, col) >= 0 ?
+				QR_get_display_size(result, col) :
+				PG_NUMERIC_MAX_PRECISION);
 }
 
 Int4
 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
-int p = -1, maxsize;
-QResultClass *result;
-ColumnInfoClass *flds;
-
-mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unknown_size_as);
-
-	/*	Assign Maximum size based on parameters */
-	switch(type) {
-	case PG_TYPE_TEXT:
-		if (globals.text_as_longvarchar)
-			maxsize = globals.max_longvarchar_size;
-		else
-			maxsize = globals.max_varchar_size;
-		break;
-
-	case PG_TYPE_VARCHAR:
-	case PG_TYPE_BPCHAR:
-		maxsize = globals.max_varchar_size;
-		break;
-
-	default:
-		if (globals.unknowns_as_longvarchar)
-			maxsize = globals.max_longvarchar_size;
-		else
+	int			p = -1,
+				maxsize;
+	QResultClass *result;
+	ColumnInfoClass *flds;
+
+	mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type, col, handle_unknown_size_as);
+
+	/* Assign Maximum size based on parameters */
+	switch (type)
+	{
+		case PG_TYPE_TEXT:
+			if (globals.text_as_longvarchar)
+				maxsize = globals.max_longvarchar_size;
+			else
+				maxsize = globals.max_varchar_size;
+			break;
+
+		case PG_TYPE_VARCHAR:
+		case PG_TYPE_BPCHAR:
 			maxsize = globals.max_varchar_size;
-		break;
+			break;
+
+		default:
+			if (globals.unknowns_as_longvarchar)
+				maxsize = globals.max_longvarchar_size;
+			else
+				maxsize = globals.max_varchar_size;
+			break;
 	}
 
-	/*	Static Precision (i.e., the Maximum Precision of the datatype)
-		This has nothing to do with a result set.
-	*/
+	/*
+	 * Static Precision (i.e., the Maximum Precision of the datatype) This
+	 * has nothing to do with a result set.
+	 */
 	if (col < 0)
 		return maxsize;
 
 	result = SC_get_Result(stmt);
 
-	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
-	if (stmt->manual_result) {
+	/*
+	 * Manual Result Sets -- use assigned column width (i.e., from
+	 * set_tuplefield_string)
+	 */
+	if (stmt->manual_result)
+	{
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -425,11 +507,12 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
 			return maxsize;
 	}
 
-	/*	Size is unknown -- handle according to parameter */
+	/* Size is unknown -- handle according to parameter */
 	if (QR_get_atttypmod(result, col) > -1)
 		return QR_get_atttypmod(result, col);
 
-	if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST) {
+	if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST)
+	{
 		p = QR_get_display_size(result, col);
 		mylog("getCharPrecision: LONGEST: p = %d\n", p);
 	}
@@ -440,351 +523,424 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
 		return p;
 }
 
-/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, PG_TYPE_NUMERIC, SQLColumns will 
+/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, PG_TYPE_NUMERIC, SQLColumns will
 	override this length with the atttypmod length from pg_attribute .
 
 	If col >= 0, then will attempt to get the info from the result set.
 	This is used for functions SQLDescribeCol and SQLColAttributes.
 */
-Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4
+pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
 
-	switch(type) {
+	switch (type)
+	{
 
-	case PG_TYPE_CHAR:			return 1;
-	case PG_TYPE_CHAR2:			return 2;
-	case PG_TYPE_CHAR4:			return 4;
-	case PG_TYPE_CHAR8:       	return 8;
+			case PG_TYPE_CHAR:return 1;
+		case PG_TYPE_CHAR2:
+			return 2;
+		case PG_TYPE_CHAR4:
+			return 4;
+		case PG_TYPE_CHAR8:
+			return 8;
 
-	case PG_TYPE_NAME:			return NAME_FIELD_SIZE;
+		case PG_TYPE_NAME:
+			return NAME_FIELD_SIZE;
 
-	case PG_TYPE_INT2:          return 5;
+		case PG_TYPE_INT2:
+			return 5;
 
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:          return 10;
+		case PG_TYPE_OID:
+		case PG_TYPE_XID:
+		case PG_TYPE_INT4:
+			return 10;
 
-	case PG_TYPE_INT8:			return 19;   /* signed */
+		case PG_TYPE_INT8:
+			return 19;			/* signed */
 
-	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col);
+		case PG_TYPE_NUMERIC:
+			return getNumericPrecision(stmt, type, col);
 
-	case PG_TYPE_FLOAT4:        
-	case PG_TYPE_MONEY:			return 7;
+		case PG_TYPE_FLOAT4:
+		case PG_TYPE_MONEY:
+			return 7;
 
-	case PG_TYPE_FLOAT8:        return 15;
+		case PG_TYPE_FLOAT8:
+			return 15;
 
-	case PG_TYPE_DATE:			return 10;
-	case PG_TYPE_TIME:			return 8;
+		case PG_TYPE_DATE:
+			return 10;
+		case PG_TYPE_TIME:
+			return 8;
 
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:		
-	case PG_TYPE_TIMESTAMP:		return 19;
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			return 19;
 
-	case PG_TYPE_BOOL:			return 1;
+		case PG_TYPE_BOOL:
+			return 1;
 
-	case PG_TYPE_LO:			return SQL_NO_TOTAL;
+		case PG_TYPE_LO:
+			return SQL_NO_TOTAL;
 
-	default:
+		default:
 
-		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
-			return SQL_NO_TOTAL;
+			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
+												 * type is available */
+				return SQL_NO_TOTAL;
 
-		/*	Handle Character types and unknown types */
-		return getCharPrecision(stmt, type, col, handle_unknown_size_as);
-    }
+			/* Handle Character types and unknown types */
+			return getCharPrecision(stmt, type, col, handle_unknown_size_as);
+	}
 }
 
-Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4
+pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
 
-	switch(type) {
-	case PG_TYPE_INT2:			return 6;
+	switch (type)
+	{
+			case PG_TYPE_INT2:return 6;
+
+		case PG_TYPE_OID:
+		case PG_TYPE_XID:
+			return 10;
 
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:			return 10;
+		case PG_TYPE_INT4:
+			return 11;
 
-	case PG_TYPE_INT4:			return 11;
+		case PG_TYPE_INT8:
+			return 20;			/* signed: 19 digits + sign */
 
-	case PG_TYPE_INT8:			return 20;	/* signed: 19 digits + sign */
+		case PG_TYPE_NUMERIC:
+			return getNumericPrecision(stmt, type, col) + 2;
 
-	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col) + 2;
+		case PG_TYPE_MONEY:
+			return 15;			/* ($9,999,999.99) */
 
-	case PG_TYPE_MONEY:			return 15;	/* ($9,999,999.99) */
+		case PG_TYPE_FLOAT4:
+			return 13;
 
-	case PG_TYPE_FLOAT4:		return 13;
+		case PG_TYPE_FLOAT8:
+			return 22;
 
-	case PG_TYPE_FLOAT8:		return 22;
-	
-	/*	Character types use regular precision */
-	default:
-		return pgtype_precision(stmt, type, col, handle_unknown_size_as);
+			/* Character types use regular precision */
+		default:
+			return pgtype_precision(stmt, type, col, handle_unknown_size_as);
 	}
 }
 
-/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, SQLColumns will 
-	override this length with the atttypmod length from pg_attribute 
+/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, SQLColumns will
+	override this length with the atttypmod length from pg_attribute
 */
-Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4
+pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
 
-	switch(type) {
+	switch (type)
+	{
 
-	case PG_TYPE_INT2:          return 2;
+			case PG_TYPE_INT2:return 2;
 
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:          return 4;
+		case PG_TYPE_OID:
+		case PG_TYPE_XID:
+		case PG_TYPE_INT4:
+			return 4;
 
-	case PG_TYPE_INT8:			return 20;	/* signed: 19 digits + sign */
+		case PG_TYPE_INT8:
+			return 20;			/* signed: 19 digits + sign */
 
-	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col) + 2;
+		case PG_TYPE_NUMERIC:
+			return getNumericPrecision(stmt, type, col) + 2;
 
-	case PG_TYPE_FLOAT4:
-	case PG_TYPE_MONEY:			return 4;
+		case PG_TYPE_FLOAT4:
+		case PG_TYPE_MONEY:
+			return 4;
 
-	case PG_TYPE_FLOAT8:        return 8;
+		case PG_TYPE_FLOAT8:
+			return 8;
 
-	case PG_TYPE_DATE:
-	case PG_TYPE_TIME:			return 6;
+		case PG_TYPE_DATE:
+		case PG_TYPE_TIME:
+			return 6;
 
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:
-	case PG_TYPE_TIMESTAMP:		return 16;
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			return 16;
 
 
-	/*	Character types (and NUMERIC) use the default precision */
-	default:	
-		return pgtype_precision(stmt, type, col, handle_unknown_size_as);
-    }
+			/* Character types (and NUMERIC) use the default precision */
+		default:
+			return pgtype_precision(stmt, type, col, handle_unknown_size_as);
+	}
 }
 
-Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col)
+Int2
+pgtype_scale(StatementClass *stmt, Int4 type, int col)
 {
-	switch(type) {
-
-	case PG_TYPE_INT2:
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:
-	case PG_TYPE_INT8:
-	case PG_TYPE_FLOAT4:
-	case PG_TYPE_FLOAT8:
-	case PG_TYPE_MONEY:
-	case PG_TYPE_BOOL:
-
-	/*	Number of digits to the right of the decimal point in "yyyy-mm=dd hh:mm:ss[.f...]" */
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:		
-	case PG_TYPE_TIMESTAMP:		return 0;
-
-	case PG_TYPE_NUMERIC:		return getNumericScale(stmt,type,col);
-
-	default:					return -1;
+	switch (type)
+	{
+
+			case PG_TYPE_INT2:
+			case PG_TYPE_OID:
+			case PG_TYPE_XID:
+			case PG_TYPE_INT4:
+			case PG_TYPE_INT8:
+			case PG_TYPE_FLOAT4:
+			case PG_TYPE_FLOAT8:
+			case PG_TYPE_MONEY:
+			case PG_TYPE_BOOL:
+
+			/*
+			 * Number of digits to the right of the decimal point in
+			 * "yyyy-mm=dd hh:mm:ss[.f...]"
+			 */
+			case PG_TYPE_ABSTIME:
+			case PG_TYPE_DATETIME:
+			case PG_TYPE_TIMESTAMP:return 0;
+
+		case PG_TYPE_NUMERIC:
+			return getNumericScale(stmt, type, col);
+
+		default:
+			return -1;
 	}
 }
 
 
-Int2 pgtype_radix(StatementClass *stmt, Int4 type)
+Int2
+pgtype_radix(StatementClass *stmt, Int4 type)
 {
-    switch(type) {
-    case PG_TYPE_INT2:
-    case PG_TYPE_OID:
-    case PG_TYPE_INT4:
-	case PG_TYPE_INT8:
-	case PG_TYPE_NUMERIC:
-    case PG_TYPE_FLOAT4:
-	case PG_TYPE_MONEY:
-    case PG_TYPE_FLOAT8:        return 10;
-
-    default:                    return -1;
-    }
+	switch (type)
+	{
+			case PG_TYPE_INT2:
+			case PG_TYPE_OID:
+			case PG_TYPE_INT4:
+			case PG_TYPE_INT8:
+			case PG_TYPE_NUMERIC:
+			case PG_TYPE_FLOAT4:
+			case PG_TYPE_MONEY:
+			case PG_TYPE_FLOAT8:return 10;
+
+		default:
+			return -1;
+	}
 }
 
-Int2 pgtype_nullable(StatementClass *stmt, Int4 type)
+Int2
+pgtype_nullable(StatementClass *stmt, Int4 type)
 {
-	return SQL_NULLABLE;	/* everything should be nullable */
+	return SQL_NULLABLE;		/* everything should be nullable */
 }
 
-Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type)
+Int2
+pgtype_auto_increment(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-
-	case PG_TYPE_INT2:         
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:         
-	case PG_TYPE_FLOAT4:       
-	case PG_TYPE_MONEY:
-	case PG_TYPE_BOOL:
-	case PG_TYPE_FLOAT8:
-	case PG_TYPE_INT8:
-	case PG_TYPE_NUMERIC:
-
-	case PG_TYPE_DATE:
-	case PG_TYPE_TIME:			
-	case PG_TYPE_ABSTIME:		
-	case PG_TYPE_DATETIME:		
-	case PG_TYPE_TIMESTAMP:		return FALSE;
-
-	default:					return -1;
-	}    
+	switch (type)
+	{
+
+			case PG_TYPE_INT2:
+			case PG_TYPE_OID:
+			case PG_TYPE_XID:
+			case PG_TYPE_INT4:
+			case PG_TYPE_FLOAT4:
+			case PG_TYPE_MONEY:
+			case PG_TYPE_BOOL:
+			case PG_TYPE_FLOAT8:
+			case PG_TYPE_INT8:
+			case PG_TYPE_NUMERIC:
+
+			case PG_TYPE_DATE:
+			case PG_TYPE_TIME:
+			case PG_TYPE_ABSTIME:
+			case PG_TYPE_DATETIME:
+			case PG_TYPE_TIMESTAMP:return FALSE;
+
+		default:
+			return -1;
+	}
 }
 
-Int2 pgtype_case_sensitive(StatementClass *stmt, Int4 type)
+Int2
+pgtype_case_sensitive(StatementClass *stmt, Int4 type)
 {
-    switch(type) {
-    case PG_TYPE_CHAR:          
+	switch (type)
+	{
+			case PG_TYPE_CHAR:
 
-	case PG_TYPE_CHAR2:
-	case PG_TYPE_CHAR4:
-    case PG_TYPE_CHAR8:         
+			case PG_TYPE_CHAR2:
+			case PG_TYPE_CHAR4:
+			case PG_TYPE_CHAR8:
 
-    case PG_TYPE_VARCHAR:       
-    case PG_TYPE_BPCHAR:
-    case PG_TYPE_TEXT:
-    case PG_TYPE_NAME:          return TRUE;
+			case PG_TYPE_VARCHAR:
+			case PG_TYPE_BPCHAR:
+			case PG_TYPE_TEXT:
+			case PG_TYPE_NAME:return TRUE;
 
-    default:                    return FALSE;
-    }
+		default:
+			return FALSE;
+	}
 }
 
-Int2 pgtype_money(StatementClass *stmt, Int4 type)
+Int2
+pgtype_money(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_MONEY:			return TRUE;
-	default:					return FALSE;
-	}    
+	switch (type)
+	{
+			case PG_TYPE_MONEY:return TRUE;
+		default:
+			return FALSE;
+	}
 }
 
-Int2 pgtype_searchable(StatementClass *stmt, Int4 type)
+Int2
+pgtype_searchable(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_CHAR:          
-	case PG_TYPE_CHAR2:
-	case PG_TYPE_CHAR4:			
-	case PG_TYPE_CHAR8:
-
-	case PG_TYPE_VARCHAR:       
-	case PG_TYPE_BPCHAR:
-	case PG_TYPE_TEXT:
-	case PG_TYPE_NAME:          return SQL_SEARCHABLE;
-
-	default:					return SQL_ALL_EXCEPT_LIKE;
-	}    
+	switch (type)
+	{
+			case PG_TYPE_CHAR:
+			case PG_TYPE_CHAR2:
+			case PG_TYPE_CHAR4:
+			case PG_TYPE_CHAR8:
+
+			case PG_TYPE_VARCHAR:
+			case PG_TYPE_BPCHAR:
+			case PG_TYPE_TEXT:
+			case PG_TYPE_NAME:return SQL_SEARCHABLE;
+
+		default:
+			return SQL_ALL_EXCEPT_LIKE;
+	}
 }
 
-Int2 pgtype_unsigned(StatementClass *stmt, Int4 type)
+Int2
+pgtype_unsigned(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:			return TRUE;
-
-	case PG_TYPE_INT2:
-	case PG_TYPE_INT4:
-	case PG_TYPE_INT8:
-	case PG_TYPE_NUMERIC:
-	case PG_TYPE_FLOAT4:
-	case PG_TYPE_FLOAT8:
-	case PG_TYPE_MONEY:			return FALSE;
-
-	default:					return -1;
+	switch (type)
+	{
+			case PG_TYPE_OID:
+			case PG_TYPE_XID:return TRUE;
+
+		case PG_TYPE_INT2:
+		case PG_TYPE_INT4:
+		case PG_TYPE_INT8:
+		case PG_TYPE_NUMERIC:
+		case PG_TYPE_FLOAT4:
+		case PG_TYPE_FLOAT8:
+		case PG_TYPE_MONEY:
+			return FALSE;
+
+		default:
+			return -1;
 	}
 }
 
-char *pgtype_literal_prefix(StatementClass *stmt, Int4 type)
+char *
+pgtype_literal_prefix(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-
-	case PG_TYPE_INT2:
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:
-	case PG_TYPE_INT8:
-	case PG_TYPE_NUMERIC:
-	case PG_TYPE_FLOAT4:
-	case PG_TYPE_FLOAT8:        
-	case PG_TYPE_MONEY:			return NULL;
-
-	default:					return "'";
+	switch (type)
+	{
+
+			case PG_TYPE_INT2:
+			case PG_TYPE_OID:
+			case PG_TYPE_XID:
+			case PG_TYPE_INT4:
+			case PG_TYPE_INT8:
+			case PG_TYPE_NUMERIC:
+			case PG_TYPE_FLOAT4:
+			case PG_TYPE_FLOAT8:
+			case PG_TYPE_MONEY:return NULL;
+
+		default:
+			return "'";
 	}
 }
 
-char *pgtype_literal_suffix(StatementClass *stmt, Int4 type)
+char *
+pgtype_literal_suffix(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-
-	case PG_TYPE_INT2:
-	case PG_TYPE_OID:
-	case PG_TYPE_XID:
-	case PG_TYPE_INT4:
-	case PG_TYPE_INT8:
-	case PG_TYPE_NUMERIC:
-	case PG_TYPE_FLOAT4:
-	case PG_TYPE_FLOAT8:        
-	case PG_TYPE_MONEY:			return NULL;
-
-	default:					return "'";
+	switch (type)
+	{
+
+			case PG_TYPE_INT2:
+			case PG_TYPE_OID:
+			case PG_TYPE_XID:
+			case PG_TYPE_INT4:
+			case PG_TYPE_INT8:
+			case PG_TYPE_NUMERIC:
+			case PG_TYPE_FLOAT4:
+			case PG_TYPE_FLOAT8:
+			case PG_TYPE_MONEY:return NULL;
+
+		default:
+			return "'";
 	}
 }
 
-char *pgtype_create_params(StatementClass *stmt, Int4 type)
+char *
+pgtype_create_params(StatementClass *stmt, Int4 type)
 {
-	switch(type) {
-	case PG_TYPE_CHAR:
-	case PG_TYPE_VARCHAR:		return "max. length";
-	default:					return NULL;
+	switch (type)
+	{
+			case PG_TYPE_CHAR:
+			case PG_TYPE_VARCHAR:return "max. length";
+		default:
+			return NULL;
 	}
 }
 
 
-Int2 sqltype_to_default_ctype(Int2 sqltype)
+Int2
+sqltype_to_default_ctype(Int2 sqltype)
 {
-    /* from the table on page 623 of ODBC 2.0 Programmer's Reference */
-    /* (Appendix D) */
-    switch(sqltype) {
-    case SQL_CHAR: 
-    case SQL_VARCHAR:
-    case SQL_LONGVARCHAR:
-    case SQL_DECIMAL:
-    case SQL_NUMERIC:
-    case SQL_BIGINT:
-		return SQL_C_CHAR;
-
-    case SQL_BIT:
-		return SQL_C_BIT;
-
-    case SQL_TINYINT:
-		return SQL_C_STINYINT;
-
-    case SQL_SMALLINT:
-		return SQL_C_SSHORT;
-
-    case SQL_INTEGER:
-		return SQL_C_SLONG;
-
-    case SQL_REAL:
-		return SQL_C_FLOAT;
-
-    case SQL_FLOAT:
-    case SQL_DOUBLE:
-		return SQL_C_DOUBLE;
-
-    case SQL_BINARY:
-    case SQL_VARBINARY:
-    case SQL_LONGVARBINARY:
-		return SQL_C_BINARY;
+	/* from the table on page 623 of ODBC 2.0 Programmer's Reference */
+	/* (Appendix D) */
+	switch (sqltype)
+	{
+			case SQL_CHAR:
+			case SQL_VARCHAR:
+			case SQL_LONGVARCHAR:
+			case SQL_DECIMAL:
+			case SQL_NUMERIC:
+			case SQL_BIGINT:
+			return SQL_C_CHAR;
+
+		case SQL_BIT:
+			return SQL_C_BIT;
+
+		case SQL_TINYINT:
+			return SQL_C_STINYINT;
+
+		case SQL_SMALLINT:
+			return SQL_C_SSHORT;
+
+		case SQL_INTEGER:
+			return SQL_C_SLONG;
+
+		case SQL_REAL:
+			return SQL_C_FLOAT;
+
+		case SQL_FLOAT:
+		case SQL_DOUBLE:
+			return SQL_C_DOUBLE;
+
+		case SQL_BINARY:
+		case SQL_VARBINARY:
+		case SQL_LONGVARBINARY:
+			return SQL_C_BINARY;
 
-    case SQL_DATE:
-		return SQL_C_DATE;
+		case SQL_DATE:
+			return SQL_C_DATE;
 
-    case SQL_TIME:
-		return SQL_C_TIME;
+		case SQL_TIME:
+			return SQL_C_TIME;
 
-    case SQL_TIMESTAMP:
-		return SQL_C_TIMESTAMP;
+		case SQL_TIMESTAMP:
+			return SQL_C_TIMESTAMP;
 
-    default:			/* should never happen */
-		return SQL_C_CHAR;	
-    }
+		default:				/* should never happen */
+			return SQL_C_CHAR;
+	}
 }
-
diff --git a/src/interfaces/odbc/pgtypes.h b/src/interfaces/odbc/pgtypes.h
index f9c48ff64f11cca54f5a45670435a30f77fc6aac..d2ba015b7b1280e8d78e53643ae8d9faac76d3bf 100644
--- a/src/interfaces/odbc/pgtypes.h
+++ b/src/interfaces/odbc/pgtypes.h
@@ -1,9 +1,9 @@
 
-/* File:            pgtypes.h
+/* File:			pgtypes.h
  *
- * Description:     See "pgtypes.c"
+ * Description:		See "pgtypes.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,48 +17,48 @@
 
 
 #if 0
-#define PG_TYPE_LO			???? 	/* waiting for permanent type */
+#define PG_TYPE_LO			????/* waiting for permanent type */
 #endif
 
-#define PG_TYPE_BOOL         16
-#define PG_TYPE_BYTEA        17
-#define PG_TYPE_CHAR         18
-#define PG_TYPE_NAME         19
-#define PG_TYPE_INT8         20
-#define PG_TYPE_INT2         21
-#define PG_TYPE_INT2VECTOR   22
-#define PG_TYPE_INT4         23
-#define PG_TYPE_REGPROC      24
-#define PG_TYPE_TEXT         25
-#define PG_TYPE_OID          26
-#define PG_TYPE_TID          27
-#define PG_TYPE_XID          28
-#define PG_TYPE_CID          29
-#define PG_TYPE_OIDVECTOR    30
-#define PG_TYPE_SET          32
-#define PG_TYPE_CHAR2       409
-#define PG_TYPE_CHAR4       410
-#define PG_TYPE_CHAR8       411
-#define PG_TYPE_POINT       600
-#define PG_TYPE_LSEG        601
-#define PG_TYPE_PATH        602
-#define PG_TYPE_BOX         603
-#define PG_TYPE_POLYGON     604
-#define PG_TYPE_FILENAME    605
-#define PG_TYPE_FLOAT4      700
-#define PG_TYPE_FLOAT8      701
-#define PG_TYPE_ABSTIME     702
-#define PG_TYPE_RELTIME     703
-#define PG_TYPE_TINTERVAL   704
-#define PG_TYPE_UNKNOWN     705
+#define PG_TYPE_BOOL		 16
+#define PG_TYPE_BYTEA		 17
+#define PG_TYPE_CHAR		 18
+#define PG_TYPE_NAME		 19
+#define PG_TYPE_INT8		 20
+#define PG_TYPE_INT2		 21
+#define PG_TYPE_INT2VECTOR	 22
+#define PG_TYPE_INT4		 23
+#define PG_TYPE_REGPROC		 24
+#define PG_TYPE_TEXT		 25
+#define PG_TYPE_OID			 26
+#define PG_TYPE_TID			 27
+#define PG_TYPE_XID			 28
+#define PG_TYPE_CID			 29
+#define PG_TYPE_OIDVECTOR	 30
+#define PG_TYPE_SET			 32
+#define PG_TYPE_CHAR2		409
+#define PG_TYPE_CHAR4		410
+#define PG_TYPE_CHAR8		411
+#define PG_TYPE_POINT		600
+#define PG_TYPE_LSEG		601
+#define PG_TYPE_PATH		602
+#define PG_TYPE_BOX			603
+#define PG_TYPE_POLYGON		604
+#define PG_TYPE_FILENAME	605
+#define PG_TYPE_FLOAT4		700
+#define PG_TYPE_FLOAT8		701
+#define PG_TYPE_ABSTIME		702
+#define PG_TYPE_RELTIME		703
+#define PG_TYPE_TINTERVAL	704
+#define PG_TYPE_UNKNOWN		705
 #define PG_TYPE_MONEY		790
-#define PG_TYPE_OIDINT2     810
-#define PG_TYPE_OIDINT4     910
-#define PG_TYPE_OIDNAME     911
-#define PG_TYPE_BPCHAR     1042
+#define PG_TYPE_OIDINT2		810
+#define PG_TYPE_OIDINT4		910
+#define PG_TYPE_OIDNAME		911
+#define PG_TYPE_BPCHAR	   1042
 #define PG_TYPE_VARCHAR    1043
-#define PG_TYPE_DATE       1082
-#define PG_TYPE_TIME       1083
+#define PG_TYPE_DATE	   1082
+#define PG_TYPE_TIME	   1083
 #define PG_TYPE_DATETIME   1184
 #define PG_TYPE_TIMESTAMP  1296
 #define PG_TYPE_NUMERIC    1700
@@ -67,32 +67,31 @@
 extern Int2 sqlTypes[];
 
 /*	Defines for pgtype_precision */
-#define PG_STATIC		-1	
+#define PG_STATIC		-1
 
-Int4 sqltype_to_pgtype(Int2 fSqlType);
+Int4		sqltype_to_pgtype(Int2 fSqlType);
 
-Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type);
-Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type);
-char *pgtype_to_name(StatementClass *stmt, Int4 type);
+Int2		pgtype_to_sqltype(StatementClass *stmt, Int4 type);
+Int2		pgtype_to_ctype(StatementClass *stmt, Int4 type);
+char	   *pgtype_to_name(StatementClass *stmt, Int4 type);
 
 /*	These functions can use static numbers or result sets(col parameter) */
-Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-
-Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col);
-Int2 pgtype_radix(StatementClass *stmt, Int4 type);
-Int2 pgtype_nullable(StatementClass *stmt, Int4 type);
-Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type);
-Int2 pgtype_case_sensitive(StatementClass *stmt, Int4 type);
-Int2 pgtype_money(StatementClass *stmt, Int4 type);
-Int2 pgtype_searchable(StatementClass *stmt, Int4 type);
-Int2 pgtype_unsigned(StatementClass *stmt, Int4 type);
-char *pgtype_literal_prefix(StatementClass *stmt, Int4 type);
-char *pgtype_literal_suffix(StatementClass *stmt, Int4 type);
-char *pgtype_create_params(StatementClass *stmt, Int4 type);
-
-Int2 sqltype_to_default_ctype(Int2 sqltype);
+Int4		pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4		pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4		pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+
+Int2		pgtype_scale(StatementClass *stmt, Int4 type, int col);
+Int2		pgtype_radix(StatementClass *stmt, Int4 type);
+Int2		pgtype_nullable(StatementClass *stmt, Int4 type);
+Int2		pgtype_auto_increment(StatementClass *stmt, Int4 type);
+Int2		pgtype_case_sensitive(StatementClass *stmt, Int4 type);
+Int2		pgtype_money(StatementClass *stmt, Int4 type);
+Int2		pgtype_searchable(StatementClass *stmt, Int4 type);
+Int2		pgtype_unsigned(StatementClass *stmt, Int4 type);
+char	   *pgtype_literal_prefix(StatementClass *stmt, Int4 type);
+char	   *pgtype_literal_suffix(StatementClass *stmt, Int4 type);
+char	   *pgtype_create_params(StatementClass *stmt, Int4 type);
+
+Int2		sqltype_to_default_ctype(Int2 sqltype);
 
 #endif
-
diff --git a/src/interfaces/odbc/psqlodbc.c b/src/interfaces/odbc/psqlodbc.c
index dbf4029a4acf9f77c6ae0d4aa93849860f27e22e..95ef452cbc5292324222183df679b4c5b52a9523 100644
--- a/src/interfaces/odbc/psqlodbc.c
+++ b/src/interfaces/odbc/psqlodbc.c
@@ -1,15 +1,15 @@
 
-/* Module:          psqlodbc.c
+/* Module:			psqlodbc.c
  *
- * Description:     This module contains the main entry point (DllMain) for the library.
- *                  It also contains functions to get and set global variables for the
- *                  driver in the registry.
+ * Description:		This module contains the main entry point (DllMain) for the library.
+ *					It also contains functions to get and set global variables for the
+ *					driver in the registry.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -36,57 +36,60 @@ GLOBAL_VALUES globals;
 RETCODE SQL_API SQLDummyOrdinal(void);
 
 #ifdef WIN32
-HINSTANCE NEAR s_hModule;               /* Saved module handle. */
+HINSTANCE NEAR s_hModule;		/* Saved module handle. */
 
 /*	This is where the Driver Manager attaches to this Driver */
-BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 
+BOOL WINAPI
+DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
 {
-WORD wVersionRequested; 
-WSADATA wsaData; 
+	WORD		wVersionRequested;
+	WSADATA		wsaData;
 
-	switch (ul_reason_for_call) {
-	case DLL_PROCESS_ATTACH:
-		s_hModule = hInst;				/* Save for dialog boxes */
+	switch (ul_reason_for_call)
+	{
+		case DLL_PROCESS_ATTACH:
+			s_hModule = hInst;	/* Save for dialog boxes */
 
-		/*	Load the WinSock Library */
-		wVersionRequested = MAKEWORD(1, 1); 
+			/* Load the WinSock Library */
+			wVersionRequested = MAKEWORD(1, 1);
 
-		if ( WSAStartup(wVersionRequested, &wsaData))
-			return FALSE;
+			if (WSAStartup(wVersionRequested, &wsaData))
+				return FALSE;
 
-		/*	Verify that this is the minimum version of WinSock */
-		if ( LOBYTE( wsaData.wVersion ) != 1 || 
-			HIBYTE( wsaData.wVersion ) != 1 ) { 
+			/* Verify that this is the minimum version of WinSock */
+			if (LOBYTE(wsaData.wVersion) != 1 ||
+				HIBYTE(wsaData.wVersion) != 1)
+			{
 
-			WSACleanup(); 
-			return FALSE;
-		}
+				WSACleanup();
+				return FALSE;
+			}
 
-		getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
-		break;
+			getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
+			break;
 
-	case DLL_THREAD_ATTACH:
-		break;
+		case DLL_THREAD_ATTACH:
+			break;
 
-	case DLL_PROCESS_DETACH:
+		case DLL_PROCESS_DETACH:
 
-		WSACleanup();
+			WSACleanup();
 
-		return TRUE;
+			return TRUE;
 
-	case DLL_THREAD_DETACH:
-		break;
+		case DLL_THREAD_DETACH:
+			break;
 
-	default:
-		break;
+		default:
+			break;
 	}
 
-	return TRUE;                                                                
-                                                                                
-	UNREFERENCED_PARAMETER(lpReserved);                                         
+	return TRUE;
+
+	UNREFERENCED_PARAMETER(lpReserved);
 }
 
-#else	/* not WIN32 */
+#else							/* not WIN32 */
 
 #ifndef TRUE
 #define TRUE	(BOOL)1
@@ -97,7 +100,7 @@ WSADATA wsaData;
 
 #ifdef __GNUC__
 
-/* This function is called at library initialization time.  */
+/* This function is called at library initialization time.	*/
 
 static BOOL
 __attribute__((constructor))
@@ -107,7 +110,7 @@ init(void)
 	return TRUE;
 }
 
-#else /* not __GNUC__ */
+#else							/* not __GNUC__ */
 
 /* These two functions do shared library initialziation on UNIX, well at least
  * on Linux. I don't know about other systems.
@@ -125,9 +128,9 @@ _fini(void)
 	return TRUE;
 }
 
-#endif /* not __GNUC__ */
+#endif	 /* not __GNUC__ */
 
-#endif /* not WIN32 */
+#endif	 /* not WIN32 */
 
 /*	This function is used to cause the Driver Manager to
 	call functions by number rather than name, which is faster.
@@ -135,8 +138,8 @@ _fini(void)
 	Driver Manager do this.  Also, the ordinal values of the
 	functions must match the value of fFunction in SQLGetFunctions()
 */
-RETCODE SQL_API SQLDummyOrdinal(void)
+RETCODE SQL_API
+SQLDummyOrdinal(void)
 {
 	return SQL_SUCCESS;
 }
-
diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h
index d1785c56e1ef939f0cca85fd7b8450ecdff3aee3..82706d7863a7531f5c1d1073f40544b02467192f 100644
--- a/src/interfaces/odbc/psqlodbc.h
+++ b/src/interfaces/odbc/psqlodbc.h
@@ -1,12 +1,12 @@
 
-/* File:            psqlodbc.h
+/* File:			psqlodbc.h
  *
- * Description:     This file contains defines and declarations that are related to
- *                  the entire driver.
+ * Description:		This file contains defines and declarations that are related to
+ *					the entire driver.
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
- * $Id: psqlodbc.h,v 1.39 2001/03/16 01:17:23 inoue Exp $
+ * $Id: psqlodbc.h,v 1.40 2001/03/22 04:01:35 momjian Exp $
  */
 
 #ifndef __PSQLODBC_H__
@@ -16,7 +16,7 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>	/* for FILE* pointers: see GLOBAL_VALUES */
+#include <stdio.h>				/* for FILE* pointers: see GLOBAL_VALUES */
 
 #ifndef WIN32
 #define Int4 long int
@@ -25,6 +25,7 @@
 #define UInt2 unsigned short
 typedef float SFLOAT;
 typedef double SDOUBLE;
+
 #else
 #define Int4 int
 #define UInt4 unsigned int
@@ -38,8 +39,8 @@ typedef UInt4 Oid;
 #define ODBCVER				0x0250
 #define DRIVER_ODBC_VER		"02.50"
 
-#define DRIVERNAME             "PostgreSQL ODBC"
-#define DBMS_NAME              "PostgreSQL"
+#define DRIVERNAME			   "PostgreSQL ODBC"
+#define DBMS_NAME			   "PostgreSQL"
 
 #define POSTGRESDRIVERVERSION  "07.01.0004"
 
@@ -51,17 +52,21 @@ typedef UInt4 Oid;
 
 /* Limits */
 #ifdef WIN32
-#define BLCKSZ                      4096
+#define BLCKSZ						4096
 #endif
 
-#define MAX_MESSAGE_LEN				65536   /* This puts a limit on query size but I don't */
-											/* see an easy way round this - DJP 24-1-2001 */
+#define MAX_MESSAGE_LEN				65536		/* This puts a limit on
+												 * query size but I don't */
+ /* see an easy way round this - DJP 24-1-2001 */
 #define MAX_CONNECT_STRING			4096
 #define ERROR_MSG_LENGTH			4096
-#define FETCH_MAX					100		/* default number of rows to cache for declare/fetch */
+#define FETCH_MAX					100 /* default number of rows to cache
+										 * for declare/fetch */
 #define TUPLE_MALLOC_INC			100
-#define SOCK_BUFFER_SIZE			4096	/* default socket buffer size */
-#define MAX_CONNECTIONS				128		/* conns per environment (arbitrary)  */
+#define SOCK_BUFFER_SIZE			4096		/* default socket buffer
+												 * size */
+#define MAX_CONNECTIONS				128 /* conns per environment
+										 * (arbitrary)	*/
 #define MAX_FIELDS					512
 #define BYTELEN						8
 #define VARHDRSZ					sizeof(Int4)
@@ -71,28 +76,33 @@ typedef UInt4 Oid;
 #define MAX_CURSOR_LEN				32
 
 /*	Registry length limits */
-#define LARGE_REGISTRY_LEN			4096	/* used for special cases */
-#define MEDIUM_REGISTRY_LEN			256		/* normal size for user,database,etc. */
-#define SMALL_REGISTRY_LEN			10		/* for 1/0 settings */
+#define LARGE_REGISTRY_LEN			4096		/* used for special cases */
+#define MEDIUM_REGISTRY_LEN			256 /* normal size for
+										 * user,database,etc. */
+#define SMALL_REGISTRY_LEN			10	/* for 1/0 settings */
 
 
 /*	These prefixes denote system tables */
-#define POSTGRES_SYS_PREFIX	"pg_"
+#define POSTGRES_SYS_PREFIX "pg_"
 #define KEYS_TABLE			"dd_fkey"
 
 /*	Info limits */
 #define MAX_INFO_STRING		128
 #define MAX_KEYPARTS		20
-#define MAX_KEYLEN			512			/*	max key of the form "date+outlet+invoice" */
-#define MAX_ROW_SIZE		0 /* Unlimited rowsize with the Tuple Toaster */
-#define MAX_STATEMENT_LEN	0 /* Unlimited statement size with 7.0 */
+#define MAX_KEYLEN			512 /* max key of the form
+								 * "date+outlet+invoice" */
+#define MAX_ROW_SIZE		0	/* Unlimited rowsize with the Tuple
+								 * Toaster */
+#define MAX_STATEMENT_LEN	0	/* Unlimited statement size with 7.0 */
 
 /* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
 /* Now that's 0, lets use this instead. DJP 24-1-2001 */
 #define STD_STATEMENT_LEN	MAX_MESSAGE_LEN
 
-#define PG62	"6.2"		/* "Protocol" key setting to force Postgres 6.2 */
-#define PG63	"6.3"		/* "Protocol" key setting to force postgres 6.3 */
+#define PG62	"6.2"			/* "Protocol" key setting to force
+								 * Postgres 6.2 */
+#define PG63	"6.3"			/* "Protocol" key setting to force
+								 * postgres 6.3 */
 #define PG64	"6.4"
 
 typedef struct ConnectionClass_ ConnectionClass;
@@ -112,61 +122,69 @@ typedef struct lo_arg LO_ARG;
 
 typedef struct GlobalValues_
 {
-	int					fetch_max;
-	int					socket_buffersize;
-	int					unknown_sizes;
-	int					max_varchar_size;
-	int					max_longvarchar_size;
-	char				debug;
-	char				commlog;
-	char				disable_optimizer;
-	char				ksqo;
-	char				unique_index;
-	char				onlyread; /* readonly is reserved on Digital C++ compiler */
-	char				use_declarefetch;
-	char				text_as_longvarchar;
-	char				unknowns_as_longvarchar;
-	char				bools_as_char;
-	char				lie;
-	char				parse;
-	char				cancel_as_freestmt;
-	char				extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
-	char				conn_settings[LARGE_REGISTRY_LEN];
-	char				protocol[SMALL_REGISTRY_LEN];
-
-
-	FILE*				mylogFP;
-	FILE*				qlogFP;	
+	int			fetch_max;
+	int			socket_buffersize;
+	int			unknown_sizes;
+	int			max_varchar_size;
+	int			max_longvarchar_size;
+	char		debug;
+	char		commlog;
+	char		disable_optimizer;
+	char		ksqo;
+	char		unique_index;
+	char		onlyread;		/* readonly is reserved on Digital C++
+								 * compiler */
+	char		use_declarefetch;
+	char		text_as_longvarchar;
+	char		unknowns_as_longvarchar;
+	char		bools_as_char;
+	char		lie;
+	char		parse;
+	char		cancel_as_freestmt;
+	char		extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
+	char		conn_settings[LARGE_REGISTRY_LEN];
+	char		protocol[SMALL_REGISTRY_LEN];
+
+
+	FILE	   *mylogFP;
+	FILE	   *qlogFP;
 } GLOBAL_VALUES;
 
-typedef struct StatementOptions_ {
-	int maxRows;
-	int maxLength;
-	int rowset_size;
-	int keyset_size;
-	int cursor_type;
-	int scroll_concurrency;
-	int retrieve_data;
-	int bind_size;		        /* size of each structure if using Row Binding */
-	int use_bookmarks;
+typedef struct StatementOptions_
+{
+	int			maxRows;
+	int			maxLength;
+	int			rowset_size;
+	int			keyset_size;
+	int			cursor_type;
+	int			scroll_concurrency;
+	int			retrieve_data;
+	int			bind_size;		/* size of each structure if using Row
+								 * Binding */
+	int			use_bookmarks;
 } StatementOptions;
 
 /*	Used to pass extra query info to send_query */
-typedef struct QueryInfo_ {
-	int				row_size;
-	QResultClass	*result_in;
-	char			*cursor;
+typedef struct QueryInfo_
+{
+	int			row_size;
+	QResultClass *result_in;
+	char	   *cursor;
 } QueryInfo;
 
 
-#define PG_TYPE_LO				-999	/* hack until permanent type available */
+#define PG_TYPE_LO				-999	/* hack until permanent type
+										 * available */
 #define PG_TYPE_LO_NAME			"lo"
-#define OID_ATTNUM				-2		/* the attnum in pg_index of the oid */
+#define OID_ATTNUM				-2		/* the attnum in pg_index of the
+										 * oid */
 
 /* sizes */
-#define TEXT_FIELD_SIZE			8190	/* size of text fields (not including null term) */
+#define TEXT_FIELD_SIZE			8190	/* size of text fields (not
+										 * including null term) */
 #define NAME_FIELD_SIZE			32		/* size of name fields */
-#define MAX_VARCHAR_SIZE		254		/* maximum size of a varchar (not including null term) */
+#define MAX_VARCHAR_SIZE		254		/* maximum size of a varchar (not
+										 * including null term) */
 
 #define PG_NUMERIC_MAX_PRECISION	1000
 #define PG_NUMERIC_MAX_SCALE		1000
diff --git a/src/interfaces/odbc/qresult.c b/src/interfaces/odbc/qresult.c
index 2f17c64334449438b406f6557017fd2ddcf5f546..4f532291c11da65858fd92bc294ddf53511fd7ce 100644
--- a/src/interfaces/odbc/qresult.c
+++ b/src/interfaces/odbc/qresult.c
@@ -1,20 +1,20 @@
 
-/* Module:          qresult.c
+/* Module:			qresult.c
  *
- * Description:     This module contains functions related to 
- *                  managing result information (i.e, fetching rows from the backend,
- *                  managing the tuple cache, etc.) and retrieving it.
- *                  Depending on the situation, a QResultClass will hold either data
- *                  from the backend or a manually built result (see "qresult.h" to
- *                  see which functions/macros are for manual or backend results.
- *                  For manually built results, the QResultClass simply points to 
- *                  TupleList and ColumnInfo structures, which actually hold the data.
+ * Description:		This module contains functions related to
+ *					managing result information (i.e, fetching rows from the backend,
+ *					managing the tuple cache, etc.) and retrieving it.
+ *					Depending on the situation, a QResultClass will hold either data
+ *					from the backend or a manually built result (see "qresult.h" to
+ *					see which functions/macros are for manual or backend results.
+ *					For manually built results, the QResultClass simply points to
+ *					TupleList and ColumnInfo structures, which actually hold the data.
  *
- * Classes:         QResultClass (Functions prefix: "QR_")
+ * Classes:			QResultClass (Functions prefix: "QR_")
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -32,23 +32,23 @@
 
 extern GLOBAL_VALUES globals;
 
-/*  Used for building a Manual Result only */
+/*	Used for building a Manual Result only */
 /*	All info functions call this function to create the manual result set. */
-void 
+void
 QR_set_num_fields(QResultClass *self, int new_num_fields)
 {
 	mylog("in QR_set_num_fields\n");
 
-    CI_set_num_fields(self->fields, new_num_fields);
-    if(self->manual_tuples) 
-        TL_Destructor(self->manual_tuples);
+	CI_set_num_fields(self->fields, new_num_fields);
+	if (self->manual_tuples)
+		TL_Destructor(self->manual_tuples);
 
-    self->manual_tuples = TL_Constructor(new_num_fields);
+	self->manual_tuples = TL_Constructor(new_num_fields);
 
 	mylog("exit QR_set_num_fields\n");
 }
 
-void 
+void
 QR_set_position(QResultClass *self, int pos)
 {
 	self->tupleField = self->backend_tuples + ((self->base + pos) * self->num_fields);
@@ -60,7 +60,7 @@ QR_set_cache_size(QResultClass *self, int cache_size)
 	self->cache_size = cache_size;
 }
 
-void 
+void
 QR_set_rowset_size(QResultClass *self, int rowset_size)
 {
 	self->rowset_size = rowset_size;
@@ -73,27 +73,29 @@ QR_inc_base(QResultClass *self, int base_inc)
 }
 
 /************************************/
-/* CLASS QResult                    */
+/* CLASS QResult					*/
 /************************************/
 
 QResultClass *
 QR_Constructor(void)
 {
-QResultClass *rv;
+	QResultClass *rv;
 
 	mylog("in QR_Constructor\n");
 	rv = (QResultClass *) malloc(sizeof(QResultClass));
 
-	if (rv != NULL) {
+	if (rv != NULL)
+	{
 		rv->status = PGRES_EMPTY_QUERY;
 
 		/* construct the column info */
-		if ( ! (rv->fields = CI_Constructor())) {
+		if (!(rv->fields = CI_Constructor()))
+		{
 			free(rv);
 			return NULL;
 		}
-		rv->manual_tuples = NULL;	
-		rv->backend_tuples = NULL;	
+		rv->manual_tuples = NULL;
+		rv->backend_tuples = NULL;
 		rv->message = NULL;
 		rv->command = NULL;
 		rv->notice = NULL;
@@ -126,26 +128,26 @@ QR_Destructor(QResultClass *self)
 	if (self->manual_tuples)
 		TL_Destructor(self->manual_tuples);
 
-	/*	If conn is defined, then we may have used "backend_tuples", */
-	/*	so in case we need to, free it up.  Also, close the cursor. */
+	/* If conn is defined, then we may have used "backend_tuples", */
+	/* so in case we need to, free it up.  Also, close the cursor. */
 	if (self->conn && self->conn->sock && CC_is_in_trans(self->conn))
 		QR_close(self);			/* close the cursor if there is one */
 
-	QR_free_memory(self);	/* safe to call anyway */
+	QR_free_memory(self);		/* safe to call anyway */
 
-	/*	Should have been freed in the close() but just in case... */
+	/* Should have been freed in the close() but just in case... */
 	if (self->cursor)
 		free(self->cursor);
 
-	/*	Free up column info */
+	/* Free up column info */
 	if (self->fields)
 		CI_Destructor(self->fields);
 
-	/*	Free command info (this is from strdup()) */
+	/* Free command info (this is from strdup()) */
 	if (self->command)
 		free(self->command);
 
-	/*	Free notice info (this is from strdup()) */
+	/* Free notice info (this is from strdup()) */
 	if (self->notice)
 		free(self->notice);
 
@@ -164,7 +166,7 @@ QR_set_command(QResultClass *self, char *msg)
 	self->command = msg ? strdup(msg) : NULL;
 }
 
-void 
+void
 QR_set_notice(QResultClass *self, char *msg)
 {
 	if (self->notice)
@@ -173,27 +175,32 @@ QR_set_notice(QResultClass *self, char *msg)
 	self->notice = msg ? strdup(msg) : NULL;
 }
 
-void 
+void
 QR_free_memory(QResultClass *self)
 {
-register int lf, row;
-register TupleField *tuple = self->backend_tuples;
-int fcount = self->fcount;
-int num_fields = self->num_fields;
+	register int lf,
+				row;
+	register TupleField *tuple = self->backend_tuples;
+	int			fcount = self->fcount;
+	int			num_fields = self->num_fields;
 
 	mylog("QResult: free memory in, fcount=%d\n", fcount);
 
-	if ( self->backend_tuples) {
+	if (self->backend_tuples)
+	{
 
-		for (row = 0; row < fcount; row++) {
+		for (row = 0; row < fcount; row++)
+		{
 			mylog("row = %d, num_fields = %d\n", row, num_fields);
-			for (lf=0; lf < num_fields; lf++) {
-				if (tuple[lf].value != NULL) {
+			for (lf = 0; lf < num_fields; lf++)
+			{
+				if (tuple[lf].value != NULL)
+				{
 					mylog("free [lf=%d] %u\n", lf, tuple[lf].value);
 					free(tuple[lf].value);
 				}
 			}
-			tuple += num_fields;  /* next row */
+			tuple += num_fields;/* next row */
 		}
 
 		free(self->backend_tuples);
@@ -209,37 +216,42 @@ int num_fields = self->num_fields;
 char
 QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 {
-int tuple_size;
-
-	/*	If called from send_query the first time (conn != NULL),  */
-	/*	then set the inTuples state, */
-	/*	and read the tuples.  If conn is NULL, */
-	/*	it implies that we are being called from next_tuple(), */
-	/*	like to get more rows so don't call next_tuple again! */
-	if (conn != NULL) {
+	int			tuple_size;
+
+	/* If called from send_query the first time (conn != NULL),  */
+	/* then set the inTuples state, */
+	/* and read the tuples.  If conn is NULL, */
+	/* it implies that we are being called from next_tuple(), */
+	/* like to get more rows so don't call next_tuple again! */
+	if (conn != NULL)
+	{
 		self->conn = conn;
 
-		mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n",  (cursor==NULL)?"":cursor, self->cursor);
+		mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n", (cursor == NULL) ? "" : cursor, self->cursor);
 
 		if (self->cursor)
 			free(self->cursor);
 
-		if ( globals.use_declarefetch) {
-			if (! cursor || cursor[0] == '\0') {
+		if (globals.use_declarefetch)
+		{
+			if (!cursor || cursor[0] == '\0')
+			{
 				self->status = PGRES_INTERNAL_ERROR;
 				QR_set_message(self, "Internal Error -- no cursor for fetch");
 				return FALSE;
 			}
 			self->cursor = strdup(cursor);
 		}
- 
-		/*	Read the field attributes. */
-		/*	$$$$ Should do some error control HERE! $$$$ */
-		if ( CI_read_fields(self->fields, self->conn)) {
+
+		/* Read the field attributes. */
+		/* $$$$ Should do some error control HERE! $$$$ */
+		if (CI_read_fields(self->fields, self->conn))
+		{
 			self->status = PGRES_FIELDS_OK;
 			self->num_fields = CI_get_num_fields(self->fields);
 		}
-		else {
+		else
+		{
 			self->status = PGRES_BAD_RESPONSE;
 			QR_set_message(self, "Error reading field information");
 			return FALSE;
@@ -247,7 +259,7 @@ int tuple_size;
 
 		mylog("QR_fetch_tuples: past CI_read_fields: num_fields = %d\n", self->num_fields);
 
-		if (globals.use_declarefetch) 
+		if (globals.use_declarefetch)
 			tuple_size = self->cache_size;
 		else
 			tuple_size = TUPLE_MALLOC_INC;
@@ -255,8 +267,9 @@ int tuple_size;
 		/* allocate memory for the tuple cache */
 		mylog("MALLOC: tuple_size = %d, size = %d\n", tuple_size, self->num_fields * sizeof(TupleField) * tuple_size);
 		self->backend_tuples = (TupleField *) malloc(self->num_fields * sizeof(TupleField) * tuple_size);
-		if ( ! self->backend_tuples) {
-			self->status = PGRES_FATAL_ERROR; 
+		if (!self->backend_tuples)
+		{
+			self->status = PGRES_FATAL_ERROR;
 			QR_set_message(self, "Could not get memory for tuple cache.");
 			return FALSE;
 		}
@@ -264,19 +277,21 @@ int tuple_size;
 		self->inTuples = TRUE;
 
 
-		/*  Force a read to occur in next_tuple */
-		self->fcount = tuple_size+1;
-		self->fetch_count = tuple_size+1;
+		/* Force a read to occur in next_tuple */
+		self->fcount = tuple_size + 1;
+		self->fetch_count = tuple_size + 1;
 		self->base = 0;
 
 		return QR_next_tuple(self);
 	}
-	else {
+	else
+	{
 
-		/*	Always have to read the field attributes. */
-		/*	But we dont have to reallocate memory for them! */
+		/* Always have to read the field attributes. */
+		/* But we dont have to reallocate memory for them! */
 
-		if ( ! CI_read_fields(NULL, self->conn)) {
+		if (!CI_read_fields(NULL, self->conn))
+		{
 			self->status = PGRES_BAD_RESPONSE;
 			QR_set_message(self, "Error reading field information");
 			return FALSE;
@@ -290,10 +305,11 @@ int tuple_size;
 int
 QR_close(QResultClass *self)
 {
-QResultClass *res;
+	QResultClass *res;
 
-	if (globals.use_declarefetch && self->conn && self->cursor) {
-		char buf[64];
+	if (globals.use_declarefetch && self->conn && self->cursor)
+	{
+		char		buf[64];
 
 		sprintf(buf, "close %s", self->cursor);
 		mylog("QResult: closing cursor: '%s'\n", buf);
@@ -306,22 +322,25 @@ QResultClass *res;
 		free(self->cursor);
 		self->cursor = NULL;
 
-		if (res == NULL) {
+		if (res == NULL)
+		{
 			self->status = PGRES_FATAL_ERROR;
 			QR_set_message(self, "Error closing cursor.");
 			return FALSE;
 		}
 		QR_Destructor(res);
 
-		/*	End the transaction if there are no cursors left on this conn */
-		if (CC_cursor_count(self->conn) == 0) {
+		/* End the transaction if there are no cursors left on this conn */
+		if (CC_cursor_count(self->conn) == 0)
+		{
 			mylog("QResult: END transaction on conn=%u\n", self->conn);
 
 			res = CC_send_query(self->conn, "END", NULL);
 
 			CC_set_no_trans(self->conn);
 
-			if (res == NULL) {
+			if (res == NULL)
+			{
 				self->status = PGRES_FATAL_ERROR;
 				QR_set_message(self, "Error ending transaction.");
 				return FALSE;
@@ -338,54 +357,65 @@ QResultClass *res;
 int
 QR_next_tuple(QResultClass *self)
 {
-int id;
-QResultClass *res;
-SocketClass *sock;
+	int			id;
+	QResultClass *res;
+	SocketClass *sock;
+
 /* Speed up access */
-int fetch_count = self->fetch_count;
-int fcount = self->fcount;
-int fetch_size, offset= 0;
-int end_tuple = self->rowset_size + self->base;
-char corrected = FALSE;
-TupleField *the_tuples = self->backend_tuples;
-static char msgbuffer[MAX_MESSAGE_LEN+1];
-char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont need static */
-char fetch[128];
-QueryInfo qi;
-
-	if (fetch_count < fcount) {	/* return a row from cache */
+	int			fetch_count = self->fetch_count;
+	int			fcount = self->fcount;
+	int			fetch_size,
+				offset = 0;
+	int			end_tuple = self->rowset_size + self->base;
+	char		corrected = FALSE;
+	TupleField *the_tuples = self->backend_tuples;
+	static char msgbuffer[MAX_MESSAGE_LEN + 1];
+	char		cmdbuffer[MAX_MESSAGE_LEN + 1]; /* QR_set_command() dups
+												 * this string so dont
+												 * need static */
+	char		fetch[128];
+	QueryInfo	qi;
+
+	if (fetch_count < fcount)
+	{							/* return a row from cache */
 		mylog("next_tuple: fetch_count < fcount: returning tuple %d, fcount = %d\n", fetch_count, fcount);
-		self->tupleField = the_tuples + (fetch_count * self->num_fields); /* next row */
+		self->tupleField = the_tuples + (fetch_count * self->num_fields);		/* next row */
 		self->fetch_count++;
 		return TRUE;
 	}
-	else if (self->fcount < self->cache_size) {   /* last row from cache */
-		  /*	We are done because we didn't even get CACHE_SIZE tuples */
-		  mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count);
-		  self->tupleField = NULL;
-		  self->status = PGRES_END_TUPLES;
-		  return -1;	/* end of tuples */
+	else if (self->fcount < self->cache_size)
+	{							/* last row from cache */
+		/* We are done because we didn't even get CACHE_SIZE tuples */
+		mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count);
+		self->tupleField = NULL;
+		self->status = PGRES_END_TUPLES;
+		return -1;				/* end of tuples */
 	}
-	else {	
-		/*	See if we need to fetch another group of rows.
-			We may be being called from send_query(), and
-			if so, don't send another fetch, just fall through
-			and read the tuples.
-		*/
+	else
+	{
+
+		/*
+		 * See if we need to fetch another group of rows. We may be being
+		 * called from send_query(), and if so, don't send another fetch,
+		 * just fall through and read the tuples.
+		 */
 		self->tupleField = NULL;
 
-		if ( ! self->inTuples) {
+		if (!self->inTuples)
+		{
 
-			if ( ! globals.use_declarefetch) {
+			if (!globals.use_declarefetch)
+			{
 				mylog("next_tuple: ALL_ROWS: done, fcount = %d, fetch_count = %d\n", fcount, fetch_count);
 				self->tupleField = NULL;
 				self->status = PGRES_END_TUPLES;
-				return -1;	/* end of tuples */
+				return -1;		/* end of tuples */
 			}
 
-			if (self->base == fcount) {		/* not a correction */
+			if (self->base == fcount)
+			{					/* not a correction */
 
-				/*	Determine the optimum cache size.  */
+				/* Determine the optimum cache size.  */
 				if (globals.fetch_max % self->rowset_size == 0)
 					fetch_size = globals.fetch_max;
 				else if (self->rowset_size < globals.fetch_max)
@@ -394,9 +424,10 @@ QueryInfo qi;
 					fetch_size = self->rowset_size;
 
 				self->cache_size = fetch_size;
-				self->fetch_count = 1;		
-			} 
-			else {	/* need to correct */
+				self->fetch_count = 1;
+			}
+			else
+			{					/* need to correct */
 
 				corrected = TRUE;
 
@@ -411,8 +442,9 @@ QueryInfo qi;
 
 
 			self->backend_tuples = (TupleField *) realloc(self->backend_tuples, self->num_fields * sizeof(TupleField) * self->cache_size);
-			if ( ! self->backend_tuples) {
-				self->status = PGRES_FATAL_ERROR; 
+			if (!self->backend_tuples)
+			{
+				self->status = PGRES_FATAL_ERROR;
 				QR_set_message(self, "Out of memory while reading tuples.");
 				return FALSE;
 			}
@@ -420,29 +452,34 @@ QueryInfo qi;
 
 			mylog("next_tuple: sending actual fetch (%d) query '%s'\n", fetch_size, fetch);
 
-			/*	don't read ahead for the next tuple (self) ! */
+			/* don't read ahead for the next tuple (self) ! */
 			qi.row_size = self->cache_size;
 			qi.result_in = self;
 			qi.cursor = NULL;
 			res = CC_send_query(self->conn, fetch, &qi);
-			if (res == NULL) {
+			if (res == NULL)
+			{
 				self->status = PGRES_FATAL_ERROR;
 				QR_set_message(self, "Error fetching next group.");
 				return FALSE;
 			}
 			self->inTuples = TRUE;
 		}
-		else {
+		else
+		{
 			mylog("next_tuple: inTuples = true, falling through: fcount = %d, fetch_count = %d\n", self->fcount, self->fetch_count);
-			/*	This is a pre-fetch (fetching rows right after query
-				but before any real SQLFetch() calls.  This is done
-				so the field attributes are available.
-			*/
+
+			/*
+			 * This is a pre-fetch (fetching rows right after query but
+			 * before any real SQLFetch() calls.  This is done so the
+			 * field attributes are available.
+			 */
 			self->fetch_count = 0;
 		}
 	}
 
-	if ( ! corrected) {
+	if (!corrected)
+	{
 		self->base = 0;
 		self->fcount = 0;
 	}
@@ -451,88 +488,98 @@ QueryInfo qi;
 	sock = CC_get_socket(self->conn);
 	self->tupleField = NULL;
 
-	for ( ; ;) {
+	for (;;)
+	{
 
 		id = SOCK_get_char(sock);
 
-		switch (id) {
-		case 'T': /* Tuples within tuples cannot be handled */
-			self->status = PGRES_BAD_RESPONSE;
-			QR_set_message(self, "Tuples within tuples cannot be handled");
-			return FALSE;
-		case 'B': /* Tuples in binary format */
-		case 'D': /* Tuples in ASCII format  */
-
-			if ( ! globals.use_declarefetch && self->fcount > 0 && ! (self->fcount % TUPLE_MALLOC_INC)) {
-				size_t old_size = self->fcount * self->num_fields * sizeof(TupleField);
-				mylog("REALLOC: old_size = %d\n", old_size);
+		switch (id)
+		{
+			case 'T':			/* Tuples within tuples cannot be handled */
+				self->status = PGRES_BAD_RESPONSE;
+				QR_set_message(self, "Tuples within tuples cannot be handled");
+				return FALSE;
+			case 'B':			/* Tuples in binary format */
+			case 'D':			/* Tuples in ASCII format  */
+
+				if (!globals.use_declarefetch && self->fcount > 0 && !(self->fcount % TUPLE_MALLOC_INC))
+				{
+					size_t		old_size = self->fcount * self->num_fields * sizeof(TupleField);
+
+					mylog("REALLOC: old_size = %d\n", old_size);
+
+					self->backend_tuples = (TupleField *) realloc(self->backend_tuples, old_size + (self->num_fields * sizeof(TupleField) * TUPLE_MALLOC_INC));
+					if (!self->backend_tuples)
+					{
+						self->status = PGRES_FATAL_ERROR;
+						QR_set_message(self, "Out of memory while reading tuples.");
+						return FALSE;
+					}
+				}
 
-				self->backend_tuples = (TupleField *) realloc(self->backend_tuples, old_size + (self->num_fields * sizeof(TupleField) * TUPLE_MALLOC_INC));
-				if ( ! self->backend_tuples) {
-					self->status = PGRES_FATAL_ERROR; 
-					QR_set_message(self, "Out of memory while reading tuples.");
+				if (!QR_read_tuple(self, (char) (id == 0)))
+				{
+					self->status = PGRES_BAD_RESPONSE;
+					QR_set_message(self, "Error reading the tuple");
 					return FALSE;
 				}
-			}
 
-			if ( ! QR_read_tuple(self, (char) (id == 0))) {
-				self->status = PGRES_BAD_RESPONSE;
-				QR_set_message(self, "Error reading the tuple");
-				return FALSE;
-			}
-			
-			self->fcount++;
-			break;	/* continue reading */
+				self->fcount++;
+				break;			/* continue reading */
 
 
-		case 'C': /* End of tuple list */
-			SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
-			QR_set_command(self, cmdbuffer);
+			case 'C':			/* End of tuple list */
+				SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
+				QR_set_command(self, cmdbuffer);
 
-			mylog("end of tuple list -- setting inUse to false: this = %u\n", self);
+				mylog("end of tuple list -- setting inUse to false: this = %u\n", self);
 
-			self->inTuples = FALSE;
-			if (self->fcount > 0) {
+				self->inTuples = FALSE;
+				if (self->fcount > 0)
+				{
 
-				qlog("    [ fetched %d rows ]\n", self->fcount);
-				mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount);
+					qlog("    [ fetched %d rows ]\n", self->fcount);
+					mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount);
 
-				/*  set to first row */
-				self->tupleField = self->backend_tuples + (offset * self->num_fields);
-				return TRUE;
-			} 
-			else { /*	We are surely done here (we read 0 tuples) */
-				qlog("    [ fetched 0 rows ]\n");
-				mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
-				return -1;	/* end of tuples */
-			}
+					/* set to first row */
+					self->tupleField = self->backend_tuples + (offset * self->num_fields);
+					return TRUE;
+				}
+				else
+				{				/* We are surely done here (we read 0
+								 * tuples) */
+					qlog("    [ fetched 0 rows ]\n");
+					mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
+					return -1;	/* end of tuples */
+				}
 
-		case 'E': /* Error */
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			QR_set_message(self, msgbuffer);
-			self->status = PGRES_FATAL_ERROR;
+			case 'E':			/* Error */
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				QR_set_message(self, msgbuffer);
+				self->status = PGRES_FATAL_ERROR;
 
-			if ( ! strncmp(msgbuffer, "FATAL", 5))
-				CC_set_no_trans(self->conn);
+				if (!strncmp(msgbuffer, "FATAL", 5))
+					CC_set_no_trans(self->conn);
 
-			qlog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
+				qlog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
 
-			return FALSE;
+				return FALSE;
 
-		case 'N': /* Notice */
-			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-			QR_set_message(self, msgbuffer);
-			self->status = PGRES_NONFATAL_ERROR;
-			qlog("NOTICE from backend in next_tuple: '%s'\n", msgbuffer);
-			continue;
-
-		default: /* this should only happen if the backend dumped core */
-			mylog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
-			qlog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
-			QR_set_message(self, "Unexpected result from backend. It probably crashed");
-			self->status = PGRES_FATAL_ERROR;
-			CC_set_no_trans(self->conn);
-			return FALSE;
+			case 'N':			/* Notice */
+				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+				QR_set_message(self, msgbuffer);
+				self->status = PGRES_NONFATAL_ERROR;
+				qlog("NOTICE from backend in next_tuple: '%s'\n", msgbuffer);
+				continue;
+
+			default:			/* this should only happen if the backend
+								 * dumped core */
+				mylog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
+				qlog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
+				QR_set_message(self, "Unexpected result from backend. It probably crashed");
+				self->status = PGRES_FATAL_ERROR;
+				CC_set_no_trans(self->conn);
+				return FALSE;
 		}
 	}
 	return TRUE;
@@ -541,17 +588,18 @@ QueryInfo qi;
 char
 QR_read_tuple(QResultClass *self, char binary)
 {
-Int2 field_lf;
-TupleField *this_tuplefield;
-char bmp, bitmap[MAX_FIELDS];        /* Max. len of the bitmap */
-Int2 bitmaplen;                       /* len of the bitmap in bytes */
-Int2 bitmap_pos;
-Int2 bitcnt;
-Int4 len;
-char *buffer;
-int num_fields = self->num_fields;	/* speed up access */
-SocketClass *sock = CC_get_socket(self->conn);
-ColumnInfoClass *flds;
+	Int2		field_lf;
+	TupleField *this_tuplefield;
+	char		bmp,
+				bitmap[MAX_FIELDS];		/* Max. len of the bitmap */
+	Int2		bitmaplen;		/* len of the bitmap in bytes */
+	Int2		bitmap_pos;
+	Int2		bitcnt;
+	Int4		len;
+	char	   *buffer;
+	int			num_fields = self->num_fields;	/* speed up access */
+	SocketClass *sock = CC_get_socket(self->conn);
+	ColumnInfoClass *flds;
 
 
 	/* set the current row to read the fields into */
@@ -562,31 +610,36 @@ ColumnInfoClass *flds;
 		bitmaplen++;
 
 	/*
-		At first the server sends a bitmap that indicates which
-		database fields are null
-	*/
+	 * At first the server sends a bitmap that indicates which database
+	 * fields are null
+	 */
 	SOCK_get_n_char(sock, bitmap, bitmaplen);
 
 	bitmap_pos = 0;
 	bitcnt = 0;
 	bmp = bitmap[bitmap_pos];
 
-	for(field_lf = 0; field_lf < num_fields; field_lf++) {
+	for (field_lf = 0; field_lf < num_fields; field_lf++)
+	{
 		/* Check if the current field is NULL */
-		if(!(bmp & 0200)) {
+		if (!(bmp & 0200))
+		{
 			/* YES, it is NULL ! */
 			this_tuplefield[field_lf].len = 0;
 			this_tuplefield[field_lf].value = 0;
-		} else {
+		}
+		else
+		{
+
 			/*
-			NO, the field is not null. so get at first the
-			length of the field (four bytes)
-			*/
+			 * NO, the field is not null. so get at first the length of
+			 * the field (four bytes)
+			 */
 			len = SOCK_get_int(sock, VARHDRSZ);
 			if (!binary)
 				len -= VARHDRSZ;
 
-			buffer = (char *)malloc(len+1);
+			buffer = (char *) malloc(len + 1);
 			SOCK_get_n_char(sock, buffer, len);
 			buffer[len] = '\0';
 
@@ -595,27 +648,31 @@ ColumnInfoClass *flds;
 			this_tuplefield[field_lf].len = len;
 			this_tuplefield[field_lf].value = buffer;
 
-			/*	This can be used to set the longest length of the column for any
-				row in the tuple cache.  It would not be accurate for varchar and
-				text fields to use this since a tuple cache is only 100 rows.
-				Bpchar can be handled since the strlen of all rows is fixed,
-				assuming there are not 100 nulls in a row!
-			*/
+			/*
+			 * This can be used to set the longest length of the column
+			 * for any row in the tuple cache.	It would not be accurate
+			 * for varchar and text fields to use this since a tuple cache
+			 * is only 100 rows. Bpchar can be handled since the strlen of
+			 * all rows is fixed, assuming there are not 100 nulls in a
+			 * row!
+			 */
 
 			flds = self->fields;
 			if (flds->display_size[field_lf] < len)
 				flds->display_size[field_lf] = len;
 		}
+
 		/*
-		Now adjust for the next bit to be scanned in the
-		next loop.
-		*/
+		 * Now adjust for the next bit to be scanned in the next loop.
+		 */
 		bitcnt++;
-		if (BYTELEN == bitcnt) {
+		if (BYTELEN == bitcnt)
+		{
 			bitmap_pos++;
 			bmp = bitmap[bitmap_pos];
 			bitcnt = 0;
-		} else
+		}
+		else
 			bmp <<= 1;
 	}
 	self->currTuple++;
diff --git a/src/interfaces/odbc/qresult.h b/src/interfaces/odbc/qresult.h
index d9362eb953b0d1f3ea8cd89f5c45766f231321f2..a617c99b4d3958d556b8e8458d6488805a458d01 100644
--- a/src/interfaces/odbc/qresult.h
+++ b/src/interfaces/odbc/qresult.h
@@ -1,9 +1,9 @@
 
-/* File:            qresult.h
+/* File:			qresult.h
  *
- * Description:     See "qresult.c"
+ * Description:		See "qresult.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,69 +17,76 @@
 #include "psqlodbc.h"
 #include "tuple.h"
 
-enum QueryResultCode_ {
-  PGRES_EMPTY_QUERY = 0,
-  PGRES_COMMAND_OK,  /* a query command that doesn't return */
-                    /* anything was executed properly by the backend */
-  PGRES_TUPLES_OK,  /* a query command that returns tuples */
-                   /* was executed properly by the backend, PGresult */
-                   /* contains the resulttuples */
-  PGRES_COPY_OUT,
-  PGRES_COPY_IN,
-  PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the backend */
-  PGRES_NONFATAL_ERROR,
-  PGRES_FATAL_ERROR,
-  PGRES_FIELDS_OK,	/* field information from a query was successful */
-  PGRES_END_TUPLES,
-  PGRES_INTERNAL_ERROR
+enum QueryResultCode_
+{
+	PGRES_EMPTY_QUERY = 0,
+	PGRES_COMMAND_OK,			/* a query command that doesn't return */
+	/* anything was executed properly by the backend */
+	PGRES_TUPLES_OK,			/* a query command that returns tuples */
+	/* was executed properly by the backend, PGresult */
+	/* contains the resulttuples */
+	PGRES_COPY_OUT,
+	PGRES_COPY_IN,
+	PGRES_BAD_RESPONSE,			/* an unexpected response was recv'd from
+								 * the backend */
+	PGRES_NONFATAL_ERROR,
+	PGRES_FATAL_ERROR,
+	PGRES_FIELDS_OK,			/* field information from a query was
+								 * successful */
+	PGRES_END_TUPLES,
+	PGRES_INTERNAL_ERROR
 };
 typedef enum QueryResultCode_ QueryResultCode;
 
 
-struct QResultClass_ {
-    ColumnInfoClass *fields;			/* the Column information */
-    TupleListClass *manual_tuples;		/* manual result tuple list */
-	ConnectionClass *conn;				/* the connection this result is using (backend) */
+struct QResultClass_
+{
+	ColumnInfoClass *fields;	/* the Column information */
+	TupleListClass *manual_tuples;		/* manual result tuple list */
+	ConnectionClass *conn;		/* the connection this result is using
+								 * (backend) */
 
-	/*	Stuff for declare/fetch tuples */
-	int fetch_count;					/* logical rows read so far */
-	int fcount;							/* actual rows read in the fetch */
-	int currTuple;
-	int base;
+	/* Stuff for declare/fetch tuples */
+	int			fetch_count;	/* logical rows read so far */
+	int			fcount;			/* actual rows read in the fetch */
+	int			currTuple;
+	int			base;
 
-	int num_fields;						/* number of fields in the result */
-	int cache_size;
-	int rowset_size;
+	int			num_fields;		/* number of fields in the result */
+	int			cache_size;
+	int			rowset_size;
 
-    QueryResultCode status;
+	QueryResultCode status;
 
-    char *message;
-	char *cursor;						/* The name of the cursor for select statements */
-	char *command;
-	char *notice;
+	char	   *message;
+	char	   *cursor;			/* The name of the cursor for select
+								 * statements */
+	char	   *command;
+	char	   *notice;
 
-	TupleField *backend_tuples;			/* data from the backend (the tuple cache) */
-	TupleField *tupleField;				/* current backend tuple being retrieved */
+	TupleField *backend_tuples; /* data from the backend (the tuple cache) */
+	TupleField *tupleField;		/* current backend tuple being retrieved */
 
-	char inTuples;						/* is a fetch of rows from the backend in progress? */
-	char aborted;					/* was aborted?*/
+	char		inTuples;		/* is a fetch of rows from the backend in
+								 * progress? */
+	char		aborted;		/* was aborted? */
 };
 
 #define QR_get_fields(self)				(self->fields)
 
 
 /*	These functions are for retrieving data from the qresult */
-#define QR_get_value_manual(self, tupleno, fieldno)	(TL_get_fieldval(self->manual_tuples, tupleno, fieldno))
-#define QR_get_value_backend(self, fieldno)			(self->tupleField[fieldno].value) 
+#define QR_get_value_manual(self, tupleno, fieldno) (TL_get_fieldval(self->manual_tuples, tupleno, fieldno))
+#define QR_get_value_backend(self, fieldno)			(self->tupleField[fieldno].value)
 #define QR_get_value_backend_row(self, tupleno, fieldno) ((self->backend_tuples + (tupleno * self->num_fields))[fieldno].value)
 
 /*	These functions are used by both manual and backend results */
 #define QR_NumResultCols(self)				(CI_get_num_fields(self->fields))
 #define QR_get_fieldname(self, fieldno_)	(CI_get_fieldname(self->fields, fieldno_))
-#define QR_get_fieldsize(self, fieldno_)	(CI_get_fieldsize(self->fields, fieldno_))    
-#define QR_get_display_size(self, fieldno_)	(CI_get_display_size(self->fields, fieldno_))    
-#define QR_get_atttypmod(self, fieldno_)	(CI_get_atttypmod(self->fields, fieldno_))    
-#define QR_get_field_type(self, fieldno_)   (CI_get_oid(self->fields, fieldno_))
+#define QR_get_fieldsize(self, fieldno_)	(CI_get_fieldsize(self->fields, fieldno_))
+#define QR_get_display_size(self, fieldno_) (CI_get_display_size(self->fields, fieldno_))
+#define QR_get_atttypmod(self, fieldno_)	(CI_get_atttypmod(self->fields, fieldno_))
+#define QR_get_field_type(self, fieldno_)	(CI_get_oid(self->fields, fieldno_))
 
 /*	These functions are used only for manual result sets */
 #define QR_get_num_tuples(self)				(self->manual_tuples ? TL_get_num_tuples(self->manual_tuples) : self->fcount)
@@ -104,20 +111,20 @@ struct QResultClass_ {
 
 /*	Core Functions */
 QResultClass *QR_Constructor(void);
-void QR_Destructor(QResultClass *self);
-char QR_read_tuple(QResultClass *self, char binary);
-int QR_next_tuple(QResultClass *self);
-int QR_close(QResultClass *self);
-char QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor);
-void QR_free_memory(QResultClass *self);
-void QR_set_command(QResultClass *self, char *msg);
-void QR_set_notice(QResultClass *self, char *msg);
-
-void QR_set_num_fields(QResultClass *self, int new_num_fields); /* manual result only */
-
-void QR_inc_base(QResultClass *self, int base_inc);
-void QR_set_cache_size(QResultClass *self, int cache_size);
-void QR_set_rowset_size(QResultClass *self, int rowset_size);
-void QR_set_position(QResultClass *self, int pos);
- 
+void		QR_Destructor(QResultClass *self);
+char		QR_read_tuple(QResultClass *self, char binary);
+int			QR_next_tuple(QResultClass *self);
+int			QR_close(QResultClass *self);
+char		QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor);
+void		QR_free_memory(QResultClass *self);
+void		QR_set_command(QResultClass *self, char *msg);
+void		QR_set_notice(QResultClass *self, char *msg);
+
+void		QR_set_num_fields(QResultClass *self, int new_num_fields);	/* manual result only */
+
+void		QR_inc_base(QResultClass *self, int base_inc);
+void		QR_set_cache_size(QResultClass *self, int cache_size);
+void		QR_set_rowset_size(QResultClass *self, int rowset_size);
+void		QR_set_position(QResultClass *self, int pos);
+
 #endif
diff --git a/src/interfaces/odbc/resource.h b/src/interfaces/odbc/resource.h
index c823241d7e41c87d76f6d90aead7d95ab049e525..213f6f5d8c0054f778b0cf35fc1fb8a3e6954fe2 100644
--- a/src/interfaces/odbc/resource.h
+++ b/src/interfaces/odbc/resource.h
@@ -2,61 +2,61 @@
 /* Microsoft Developer Studio generated include file. */
 /* Used by psqlodbc.rc */
 
-#define IDS_BADDSN                      1
-#define IDS_MSGTITLE                    2
-#define DLG_OPTIONS_DRV                 102
-#define DLG_OPTIONS_DS                  103
-#define IDC_DSNAME                      400
-#define IDC_DSNAMETEXT                  401
-#define IDC_DESC                        404
-#define IDC_SERVER                      407
-#define IDC_DATABASE                    408
-#define DLG_CONFIG                      1001
-#define IDC_PORT                        1002
-#define IDC_USER                        1006
-#define IDC_PASSWORD                    1009
-#define DS_READONLY                     1011
-#define DS_SHOWOIDCOLUMN                1012
-#define DS_FAKEOIDINDEX                 1013
-#define DRV_COMMLOG                     1014
-#define DS_PG62                         1016
-#define IDC_DATASOURCE                  1018
-#define DRV_OPTIMIZER                   1019
-#define DS_CONNSETTINGS                 1020
-#define IDC_DRIVER                      1021
-#define DRV_CONNSETTINGS                1031
-#define DRV_UNIQUEINDEX                 1032
-#define DRV_UNKNOWN_MAX                 1035
-#define DRV_UNKNOWN_DONTKNOW            1036
-#define DRV_READONLY                    1037
-#define IDC_DESCTEXT                    1039
-#define DRV_MSG_LABEL                   1040
-#define DRV_UNKNOWN_LONGEST             1041
-#define DRV_TEXT_LONGVARCHAR            1043
-#define DRV_UNKNOWNS_LONGVARCHAR        1044
-#define DRV_CACHE_SIZE                  1045
-#define DRV_VARCHAR_SIZE                1046
-#define DRV_LONGVARCHAR_SIZE            1047
-#define IDDEFAULTS                      1048
-#define DRV_USEDECLAREFETCH             1049
-#define DRV_BOOLS_CHAR                  1050
-#define DS_SHOWSYSTEMTABLES             1051
-#define DRV_EXTRASYSTABLEPREFIXES       1051
-#define DS_ROWVERSIONING                1052
-#define DRV_PARSE                       1052
-#define DRV_CANCELASFREESTMT            1053
-#define IDC_OPTIONS                     1054
-#define DRV_KSQO                        1055
-#define DS_PG64                         1057
-#define DS_PG63                         1058
+#define IDS_BADDSN						1
+#define IDS_MSGTITLE					2
+#define DLG_OPTIONS_DRV					102
+#define DLG_OPTIONS_DS					103
+#define IDC_DSNAME						400
+#define IDC_DSNAMETEXT					401
+#define IDC_DESC						404
+#define IDC_SERVER						407
+#define IDC_DATABASE					408
+#define DLG_CONFIG						1001
+#define IDC_PORT						1002
+#define IDC_USER						1006
+#define IDC_PASSWORD					1009
+#define DS_READONLY						1011
+#define DS_SHOWOIDCOLUMN				1012
+#define DS_FAKEOIDINDEX					1013
+#define DRV_COMMLOG						1014
+#define DS_PG62							1016
+#define IDC_DATASOURCE					1018
+#define DRV_OPTIMIZER					1019
+#define DS_CONNSETTINGS					1020
+#define IDC_DRIVER						1021
+#define DRV_CONNSETTINGS				1031
+#define DRV_UNIQUEINDEX					1032
+#define DRV_UNKNOWN_MAX					1035
+#define DRV_UNKNOWN_DONTKNOW			1036
+#define DRV_READONLY					1037
+#define IDC_DESCTEXT					1039
+#define DRV_MSG_LABEL					1040
+#define DRV_UNKNOWN_LONGEST				1041
+#define DRV_TEXT_LONGVARCHAR			1043
+#define DRV_UNKNOWNS_LONGVARCHAR		1044
+#define DRV_CACHE_SIZE					1045
+#define DRV_VARCHAR_SIZE				1046
+#define DRV_LONGVARCHAR_SIZE			1047
+#define IDDEFAULTS						1048
+#define DRV_USEDECLAREFETCH				1049
+#define DRV_BOOLS_CHAR					1050
+#define DS_SHOWSYSTEMTABLES				1051
+#define DRV_EXTRASYSTABLEPREFIXES		1051
+#define DS_ROWVERSIONING				1052
+#define DRV_PARSE						1052
+#define DRV_CANCELASFREESTMT			1053
+#define IDC_OPTIONS						1054
+#define DRV_KSQO						1055
+#define DS_PG64							1057
+#define DS_PG63							1058
 
 /* Next default values for new objects */
 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        104
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1060
-#define _APS_NEXT_SYMED_VALUE           101
+#define _APS_NEXT_RESOURCE_VALUE		104
+#define _APS_NEXT_COMMAND_VALUE			40001
+#define _APS_NEXT_CONTROL_VALUE			1060
+#define _APS_NEXT_SYMED_VALUE			101
 #endif
 #endif
diff --git a/src/interfaces/odbc/results.c b/src/interfaces/odbc/results.c
index b4eedda79daece6fc8f7a598b85083a70f95ff4d..781982ed4ce02c157cfaa164ef93c43c900510a5 100644
--- a/src/interfaces/odbc/results.c
+++ b/src/interfaces/odbc/results.c
@@ -1,17 +1,17 @@
 
-/* Module:          results.c
+/* Module:			results.c
  *
- * Description:     This module contains functions related to 
- *                  retrieving result information through the ODBC API.
+ * Description:		This module contains functions related to
+ *					retrieving result information through the ODBC API.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   SQLRowCount, SQLNumResultCols, SQLDescribeCol, SQLColAttributes,
- *                  SQLGetData, SQLFetch, SQLExtendedFetch, 
- *                  SQLMoreResults(NI), SQLSetPos, SQLSetScrollOptions(NI),
- *                  SQLSetCursorName, SQLGetCursorName
+ * API functions:	SQLRowCount, SQLNumResultCols, SQLDescribeCol, SQLColAttributes,
+ *					SQLGetData, SQLFetch, SQLExtendedFetch,
+ *					SQLMoreResults(NI), SQLSetPos, SQLSetScrollOptions(NI),
+ *					SQLSetCursorName, SQLGetCursorName
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -28,7 +28,7 @@
 #include "bind.h"
 #include "qresult.h"
 #include "convert.h"
-#include "pgtypes.h" 
+#include "pgtypes.h"
 
 #include <stdio.h>
 
@@ -44,103 +44,122 @@ extern GLOBAL_VALUES globals;
 
 
 
-RETCODE SQL_API SQLRowCount(
-        HSTMT      hstmt,
-        SDWORD FAR *pcrow)
+RETCODE SQL_API
+SQLRowCount(
+			HSTMT hstmt,
+			SDWORD FAR *pcrow)
 {
-static char *func="SQLRowCount";
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *res;
-char *msg, *ptr;
-
-	if ( ! stmt) {
+	static char *func = "SQLRowCount";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
+	char	   *msg,
+			   *ptr;
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
-	if (stmt->manual_result) {
+	if (stmt->manual_result)
+	{
 		if (pcrow)
 			*pcrow = -1;
 		return SQL_SUCCESS;
 	}
 
-	if(stmt->statement_type == STMT_TYPE_SELECT) {
-		if (stmt->status == STMT_FINISHED) {
+	if (stmt->statement_type == STMT_TYPE_SELECT)
+	{
+		if (stmt->status == STMT_FINISHED)
+		{
 			res = SC_get_Result(stmt);
 
-			if(res && pcrow) {
+			if (res && pcrow)
+			{
 				*pcrow = globals.use_declarefetch ? -1 : QR_get_num_tuples(res);
 				return SQL_SUCCESS;
 			}
 		}
-	} else {
+	}
+	else
+	{
 
 		res = SC_get_Result(stmt);
-		if (res && pcrow) {
+		if (res && pcrow)
+		{
 			msg = QR_get_command(res);
 			mylog("*** msg = '%s'\n", msg);
-			trim(msg);	/*	get rid of trailing spaces */
+			trim(msg);			/* get rid of trailing spaces */
 			ptr = strrchr(msg, ' ');
-			if (ptr) {
-				*pcrow = atoi(ptr+1);
+			if (ptr)
+			{
+				*pcrow = atoi(ptr + 1);
 				mylog("**** SQLRowCount(): THE ROWS: *pcrow = %d\n", *pcrow);
 			}
-			else {
+			else
+			{
 				*pcrow = -1;
 
 				mylog("**** SQLRowCount(): NO ROWS: *pcrow = %d\n", *pcrow);
 			}
 
-		return SQL_SUCCESS;
+			return SQL_SUCCESS;
 		}
 	}
 
 	SC_log_error(func, "Bad return value", stmt);
-	return SQL_ERROR;     
+	return SQL_ERROR;
 }
 
 
-/*      This returns the number of columns associated with the database */
-/*      attached to "hstmt". */
+/*		This returns the number of columns associated with the database */
+/*		attached to "hstmt". */
 
 
-RETCODE SQL_API SQLNumResultCols(
-        HSTMT     hstmt,
-        SWORD FAR *pccol)
-{       
-static char *func="SQLNumResultCols";
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *result;
-char parse_ok;
+RETCODE SQL_API
+SQLNumResultCols(
+				 HSTMT hstmt,
+				 SWORD FAR *pccol)
+{
+	static char *func = "SQLNumResultCols";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *result;
+	char		parse_ok;
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	SC_clear_error(stmt);    
+	SC_clear_error(stmt);
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
+	{
 
-		if (stmt->parse_status == STMT_PARSE_NONE) {
+		if (stmt->parse_status == STMT_PARSE_NONE)
+		{
 			mylog("SQLNumResultCols: calling parse_statement on stmt=%u\n", stmt);
 			parse_statement(stmt);
 		}
 
-		if (stmt->parse_status != STMT_PARSE_FATAL) {
+		if (stmt->parse_status != STMT_PARSE_FATAL)
+		{
 			parse_ok = TRUE;
 			*pccol = stmt->nfld;
 			mylog("PARSE: SQLNumResultCols: *pccol = %d\n", *pccol);
 		}
 	}
 
-	if ( ! parse_ok) {
+	if (!parse_ok)
+	{
 
-		SC_pre_execute(stmt);       
+		SC_pre_execute(stmt);
 		result = SC_get_Result(stmt);
 
 		mylog("SQLNumResultCols: result = %u, status = %d, numcols = %d\n", result, stmt->status, result != NULL ? QR_NumResultCols(result) : -1);
-		if (( ! result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)) ) {
+		if ((!result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
+		{
 			/* no query has been executed on this statement */
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			stmt->errormsg = "No query has been executed with that handle";
@@ -155,59 +174,65 @@ char parse_ok;
 }
 
 
-/*      -       -       -       -       -       -       -       -       - */
+/*		-		-		-		-		-		-		-		-		- */
 
 
 
-/*      Return information about the database column the user wants */
-/*      information about. */
-RETCODE SQL_API SQLDescribeCol(
-        HSTMT      hstmt,
-        UWORD      icol,
-        UCHAR  FAR *szColName,
-        SWORD      cbColNameMax,
-        SWORD  FAR *pcbColName,
-        SWORD  FAR *pfSqlType,
-        UDWORD FAR *pcbColDef,
-        SWORD  FAR *pibScale,
-        SWORD  FAR *pfNullable)
+/*		Return information about the database column the user wants */
+/*		information about. */
+RETCODE SQL_API
+SQLDescribeCol(
+			   HSTMT hstmt,
+			   UWORD icol,
+			   UCHAR FAR *szColName,
+			   SWORD cbColNameMax,
+			   SWORD FAR *pcbColName,
+			   SWORD FAR *pfSqlType,
+			   UDWORD FAR *pcbColDef,
+			   SWORD FAR *pibScale,
+			   SWORD FAR *pfNullable)
 {
-static char *func="SQLDescribeCol";
-    /* gets all the information about a specific column */
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *res;
-char *col_name = NULL;
-Int4 fieldtype = 0;
-int precision = 0;
-ConnInfo *ci;
-char parse_ok;
-char buf[255];
-int len = 0;
-RETCODE result;
+	static char *func = "SQLDescribeCol";
+
+	/* gets all the information about a specific column */
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
+	char	   *col_name = NULL;
+	Int4		fieldtype = 0;
+	int			precision = 0;
+	ConnInfo   *ci;
+	char		parse_ok;
+	char		buf[255];
+	int			len = 0;
+	RETCODE		result;
 
 
 	mylog("%s: entering...\n", func);
 
-    if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
+		return SQL_INVALID_HANDLE;
 	}
 
 	ci = &(stmt->hdbc->connInfo);
 
-    SC_clear_error(stmt);
+	SC_clear_error(stmt);
 
-	/*	Dont check for bookmark column.  This is the responsibility
-		of the driver manager.  
-	*/
+	/*
+	 * Dont check for bookmark column.	This is the responsibility of the
+	 * driver manager.
+	 */
 
-	icol--;		/* use zero based column numbers */
+	icol--;						/* use zero based column numbers */
 
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
+	{
 
-		if (stmt->parse_status == STMT_PARSE_NONE) {
+		if (stmt->parse_status == STMT_PARSE_NONE)
+		{
 			mylog("SQLDescribeCol: calling parse_statement on stmt=%u\n", stmt);
 			parse_statement(stmt);
 		}
@@ -215,9 +240,11 @@ RETCODE result;
 
 		mylog("PARSE: DescribeCol: icol=%d, stmt=%u, stmt->nfld=%d, stmt->fi=%u\n", icol, stmt, stmt->nfld, stmt->fi);
 
-		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) {
+		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
+		{
 
-			if (icol >= stmt->nfld) {
+			if (icol >= stmt->nfld)
+			{
 				stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 				stmt->errormsg = "Invalid column number in DescribeCol.";
 				SC_log_error(func, "", stmt);
@@ -236,16 +263,20 @@ RETCODE result;
 	}
 
 
-	/*	If couldn't parse it OR the field being described was not parsed (i.e., because
-		it was a function or expression, etc, then do it the old fashioned way.
-	*/
-	if ( ! parse_ok) {
+	/*
+	 * If couldn't parse it OR the field being described was not parsed
+	 * (i.e., because it was a function or expression, etc, then do it the
+	 * old fashioned way.
+	 */
+	if (!parse_ok)
+	{
 		SC_pre_execute(stmt);
-	
+
 		res = SC_get_Result(stmt);
 
 		mylog("**** SQLDescribeCol: res = %u, stmt->status = %d, !finished=%d, !premature=%d\n", res, stmt->status, stmt->status != STMT_FINISHED, stmt->status != STMT_PREMATURE);
-		if ( (NULL == res) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE))) {
+		if ((NULL == res) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
+		{
 			/* no query has been executed on this statement */
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			stmt->errormsg = "No query has been assigned to this statement.";
@@ -253,7 +284,8 @@ RETCODE result;
 			return SQL_ERROR;
 		}
 
-		if (icol >= QR_NumResultCols(res)) {
+		if (icol >= QR_NumResultCols(res))
+		{
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			stmt->errormsg = "Invalid column number in DescribeCol.";
 			sprintf(buf, "Col#=%d, #Cols=%d", icol, QR_NumResultCols(res));
@@ -262,9 +294,10 @@ RETCODE result;
 		}
 
 		col_name = QR_get_fieldname(res, icol);
-        fieldtype = QR_get_field_type(res, icol);
+		fieldtype = QR_get_field_type(res, icol);
 
-		precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes);  /* atoi(ci->unknown_sizes) */
+		precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes);		/* atoi(ci->unknown_sizes
+																						 * ) */
 	}
 
 	mylog("describeCol: col %d fieldname = '%s'\n", icol, col_name);
@@ -275,39 +308,43 @@ RETCODE result;
 	result = SQL_SUCCESS;
 
 	/************************/
-	/*		COLUMN NAME     */
+	/* COLUMN NAME	   */
 	/************************/
 	len = strlen(col_name);
 
 	if (pcbColName)
 		*pcbColName = len;
 
-	if (szColName) {
+	if (szColName)
+	{
 		strncpy_null(szColName, col_name, cbColNameMax);
 
-		if (len >= cbColNameMax)  {
+		if (len >= cbColNameMax)
+		{
 			result = SQL_SUCCESS_WITH_INFO;
 			stmt->errornumber = STMT_TRUNCATED;
 			stmt->errormsg = "The buffer was too small for the result.";
 		}
-    }
+	}
 
 
 	/************************/
-	/*		SQL TYPE        */
+	/* SQL TYPE		   */
 	/************************/
-    if (pfSqlType) {
-        *pfSqlType = pgtype_to_sqltype(stmt, fieldtype);
+	if (pfSqlType)
+	{
+		*pfSqlType = pgtype_to_sqltype(stmt, fieldtype);
 
 		mylog("describeCol: col %d *pfSqlType = %d\n", icol, *pfSqlType);
 	}
 
 	/************************/
-	/*		PRECISION       */
+	/* PRECISION	   */
 	/************************/
-    if (pcbColDef) {
+	if (pcbColDef)
+	{
 
-		if ( precision < 0)
+		if (precision < 0)
 			precision = 0;		/* "I dont know" */
 
 		*pcbColDef = precision;
@@ -316,94 +353,110 @@ RETCODE result;
 	}
 
 	/************************/
-	/*		SCALE           */
+	/* SCALE		   */
 	/************************/
-    if (pibScale) {
-        Int2 scale;
-        scale = pgtype_scale(stmt, fieldtype, icol);
-        if(scale == -1) { scale = 0; }
-        
-        *pibScale = scale;
+	if (pibScale)
+	{
+		Int2		scale;
+
+		scale = pgtype_scale(stmt, fieldtype, icol);
+		if (scale == -1)
+			scale = 0;
+
+		*pibScale = scale;
 		mylog("describeCol: col %d  *pibScale = %d\n", icol, *pibScale);
-    }
+	}
 
 	/************************/
-	/*		NULLABILITY     */
+	/* NULLABILITY	   */
 	/************************/
-    if (pfNullable) {
+	if (pfNullable)
+	{
 		*pfNullable = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, fieldtype);
 
 		mylog("describeCol: col %d  *pfNullable = %d\n", icol, *pfNullable);
-    }
+	}
 
-    return result;
+	return result;
 }
 
-/*      Returns result column descriptor information for a result set. */
-
-RETCODE SQL_API SQLColAttributes(
-        HSTMT      hstmt,
-        UWORD      icol,
-        UWORD      fDescType,
-        PTR        rgbDesc,
-        SWORD      cbDescMax,
-        SWORD  FAR *pcbDesc,
-        SDWORD FAR *pfDesc)
+/*		Returns result column descriptor information for a result set. */
+
+RETCODE SQL_API
+SQLColAttributes(
+				 HSTMT hstmt,
+				 UWORD icol,
+				 UWORD fDescType,
+				 PTR rgbDesc,
+				 SWORD cbDescMax,
+				 SWORD FAR *pcbDesc,
+				 SDWORD FAR *pfDesc)
 {
-static char *func = "SQLColAttributes";
-StatementClass *stmt = (StatementClass *) hstmt;
-Int4 field_type = 0;
-ConnInfo *ci;
-int unknown_sizes;
-int cols = 0;
-char parse_ok;
-RETCODE result;
-char *p = NULL;
-int len = 0, value = 0;
+	static char *func = "SQLColAttributes";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	Int4		field_type = 0;
+	ConnInfo   *ci;
+	int			unknown_sizes;
+	int			cols = 0;
+	char		parse_ok;
+	RETCODE		result;
+	char	   *p = NULL;
+	int			len = 0,
+				value = 0;
 
 	mylog("%s: entering...\n", func);
 
-	if( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	ci = &(stmt->hdbc->connInfo);
 
-	/*	Dont check for bookmark column.  This is the responsibility
-		of the driver manager.  For certain types of arguments, the column
-		number is ignored anyway, so it may be 0.
-	*/
+	/*
+	 * Dont check for bookmark column.	This is the responsibility of the
+	 * driver manager.	For certain types of arguments, the column number
+	 * is ignored anyway, so it may be 0.
+	 */
 
 	icol--;
 
-	unknown_sizes = globals.unknown_sizes;          /* atoi(ci->unknown_sizes); */
-	if (unknown_sizes == UNKNOWNS_AS_DONTKNOW)		/* not appropriate for SQLColAttributes() */
+	unknown_sizes = globals.unknown_sizes;		/* atoi(ci->unknown_sizes);
+												 *	*/
+	if (unknown_sizes == UNKNOWNS_AS_DONTKNOW)	/* not appropriate for
+												 * SQLColAttributes() */
 		unknown_sizes = UNKNOWNS_AS_MAX;
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
+	{
 
-		if (stmt->parse_status == STMT_PARSE_NONE) {
+		if (stmt->parse_status == STMT_PARSE_NONE)
+		{
 			mylog("SQLColAttributes: calling parse_statement\n");
 			parse_statement(stmt);
 		}
 
 		cols = stmt->nfld;
 
-		/*	Column Count is a special case.  The Column number is ignored
-			in this case.
-		*/
-		if (fDescType == SQL_COLUMN_COUNT) {
+		/*
+		 * Column Count is a special case.	The Column number is ignored
+		 * in this case.
+		 */
+		if (fDescType == SQL_COLUMN_COUNT)
+		{
 			if (pfDesc)
 				*pfDesc = cols;
 
 			return SQL_SUCCESS;
 		}
 
-		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) {
+		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
+		{
 
-			if (icol >= cols) {
+			if (icol >= cols)
+			{
 				stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 				stmt->errormsg = "Invalid column number in ColAttributes.";
 				SC_log_error(func, "", stmt);
@@ -416,12 +469,14 @@ int len = 0, value = 0;
 		}
 	}
 
-	if ( ! parse_ok) {
-		SC_pre_execute(stmt);       
+	if (!parse_ok)
+	{
+		SC_pre_execute(stmt);
 
 		mylog("**** SQLColAtt: result = %u, status = %d, numcols = %d\n", stmt->result, stmt->status, stmt->result != NULL ? QR_NumResultCols(stmt->result) : -1);
 
-		if ( (NULL == stmt->result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)) ) {
+		if ((NULL == stmt->result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
+		{
 			stmt->errormsg = "Can't get column attributes: no result found.";
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			SC_log_error(func, "", stmt);
@@ -430,17 +485,20 @@ int len = 0, value = 0;
 
 		cols = QR_NumResultCols(stmt->result);
 
-		/*	Column Count is a special case.  The Column number is ignored
-			in this case.
-		*/
-		if (fDescType == SQL_COLUMN_COUNT) {
+		/*
+		 * Column Count is a special case.	The Column number is ignored
+		 * in this case.
+		 */
+		if (fDescType == SQL_COLUMN_COUNT)
+		{
 			if (pfDesc)
 				*pfDesc = cols;
 
 			return SQL_SUCCESS;
 		}
 
-		if (icol >= cols) {
+		if (icol >= cols)
+		{
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			stmt->errormsg = "Invalid column number in ColAttributes.";
 			SC_log_error(func, "", stmt);
@@ -452,137 +510,146 @@ int len = 0, value = 0;
 
 	mylog("colAttr: col %d field_type = %d\n", icol, field_type);
 
-	switch(fDescType) {
-	case SQL_COLUMN_AUTO_INCREMENT:
-		value  = pgtype_auto_increment(stmt, field_type);
-		if (value == -1)  /*  non-numeric becomes FALSE (ODBC Doc) */
-			value = FALSE;
-				
-		break;
+	switch (fDescType)
+	{
+		case SQL_COLUMN_AUTO_INCREMENT:
+			value = pgtype_auto_increment(stmt, field_type);
+			if (value == -1)	/* non-numeric becomes FALSE (ODBC Doc) */
+				value = FALSE;
 
-	case SQL_COLUMN_CASE_SENSITIVE:
-		value = pgtype_case_sensitive(stmt, field_type);
-		break;
+			break;
 
-	/* 	This special case is handled above.
+		case SQL_COLUMN_CASE_SENSITIVE:
+			value = pgtype_case_sensitive(stmt, field_type);
+			break;
 
-	case SQL_COLUMN_COUNT: 
-	*/
+			/*
+			 * This special case is handled above.
+			 *
+			 * case SQL_COLUMN_COUNT:
+			 */
 
-    case SQL_COLUMN_DISPLAY_SIZE:
-		value = (parse_ok) ? stmt->fi[icol]->display_size : pgtype_display_size(stmt, field_type, icol, unknown_sizes);
+		case SQL_COLUMN_DISPLAY_SIZE:
+			value = (parse_ok) ? stmt->fi[icol]->display_size : pgtype_display_size(stmt, field_type, icol, unknown_sizes);
 
-		mylog("SQLColAttributes: col %d, display_size= %d\n", icol, value);
+			mylog("SQLColAttributes: col %d, display_size= %d\n", icol, value);
 
-        break;
+			break;
 
-	case SQL_COLUMN_LABEL:
-		if (parse_ok && stmt->fi[icol]->alias[0] != '\0') {
-			p = stmt->fi[icol]->alias;
+		case SQL_COLUMN_LABEL:
+			if (parse_ok && stmt->fi[icol]->alias[0] != '\0')
+			{
+				p = stmt->fi[icol]->alias;
 
-			mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
-			break;
+				mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
+				break;
 
-		}	/* otherwise same as column name -- FALL THROUGH!!! */
+			}					/* otherwise same as column name -- FALL
+								 * THROUGH!!! */
 
-	case SQL_COLUMN_NAME:
+		case SQL_COLUMN_NAME:
 
-		p = (parse_ok) ? stmt->fi[icol]->name : QR_get_fieldname(stmt->result, icol);
+			p = (parse_ok) ? stmt->fi[icol]->name : QR_get_fieldname(stmt->result, icol);
 
-		mylog("SQLColAttr: COLUMN_NAME = '%s'\n", p);
-		break;
+			mylog("SQLColAttr: COLUMN_NAME = '%s'\n", p);
+			break;
 
-	case SQL_COLUMN_LENGTH:
-		value = (parse_ok) ? stmt->fi[icol]->length :  pgtype_length(stmt, field_type, icol, unknown_sizes); 
+		case SQL_COLUMN_LENGTH:
+			value = (parse_ok) ? stmt->fi[icol]->length : pgtype_length(stmt, field_type, icol, unknown_sizes);
 
-		mylog("SQLColAttributes: col %d, length = %d\n", icol, value);
-        break;
+			mylog("SQLColAttributes: col %d, length = %d\n", icol, value);
+			break;
 
-	case SQL_COLUMN_MONEY:
-		value = pgtype_money(stmt, field_type);
-		break;
+		case SQL_COLUMN_MONEY:
+			value = pgtype_money(stmt, field_type);
+			break;
 
-	case SQL_COLUMN_NULLABLE:
-		value = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, field_type);
-		break;
+		case SQL_COLUMN_NULLABLE:
+			value = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, field_type);
+			break;
 
-	case SQL_COLUMN_OWNER_NAME:
-		p = "";
-		break;
+		case SQL_COLUMN_OWNER_NAME:
+			p = "";
+			break;
 
-	case SQL_COLUMN_PRECISION:
-		value = (parse_ok) ? stmt->fi[icol]->precision : pgtype_precision(stmt, field_type, icol, unknown_sizes);
+		case SQL_COLUMN_PRECISION:
+			value = (parse_ok) ? stmt->fi[icol]->precision : pgtype_precision(stmt, field_type, icol, unknown_sizes);
 
-		mylog("SQLColAttributes: col %d, precision = %d\n", icol, value);
-        break;
+			mylog("SQLColAttributes: col %d, precision = %d\n", icol, value);
+			break;
 
-	case SQL_COLUMN_QUALIFIER_NAME:
-		p = "";
-		break;
+		case SQL_COLUMN_QUALIFIER_NAME:
+			p = "";
+			break;
 
-	case SQL_COLUMN_SCALE:
-		value = pgtype_scale(stmt, field_type, icol);
-		break;
+		case SQL_COLUMN_SCALE:
+			value = pgtype_scale(stmt, field_type, icol);
+			break;
 
-	case SQL_COLUMN_SEARCHABLE:
-		value = pgtype_searchable(stmt, field_type);
-		break;
+		case SQL_COLUMN_SEARCHABLE:
+			value = pgtype_searchable(stmt, field_type);
+			break;
 
-    case SQL_COLUMN_TABLE_NAME:
+		case SQL_COLUMN_TABLE_NAME:
 
-		p = (parse_ok && stmt->fi[icol]->ti) ? stmt->fi[icol]->ti->name : "";
+			p = (parse_ok && stmt->fi[icol]->ti) ? stmt->fi[icol]->ti->name : "";
 
-		mylog("SQLColAttr: TABLE_NAME = '%s'\n", p);
-        break;
+			mylog("SQLColAttr: TABLE_NAME = '%s'\n", p);
+			break;
 
-	case SQL_COLUMN_TYPE:
-		value = pgtype_to_sqltype(stmt, field_type);
-		break;
+		case SQL_COLUMN_TYPE:
+			value = pgtype_to_sqltype(stmt, field_type);
+			break;
 
-	case SQL_COLUMN_TYPE_NAME:
-		p = pgtype_to_name(stmt, field_type);
-		break;
+		case SQL_COLUMN_TYPE_NAME:
+			p = pgtype_to_name(stmt, field_type);
+			break;
 
-	case SQL_COLUMN_UNSIGNED:
-		value = pgtype_unsigned(stmt, field_type);
-		if(value == -1)	/* non-numeric becomes TRUE (ODBC Doc) */
-			value = TRUE;
+		case SQL_COLUMN_UNSIGNED:
+			value = pgtype_unsigned(stmt, field_type);
+			if (value == -1)	/* non-numeric becomes TRUE (ODBC Doc) */
+				value = TRUE;
 
-		break;
+			break;
 
-	case SQL_COLUMN_UPDATABLE:
-		/*	Neither Access or Borland care about this.
+		case SQL_COLUMN_UPDATABLE:
 
-		if (field_type == PG_TYPE_OID)
-			*pfDesc = SQL_ATTR_READONLY;
-		else
-		*/
+			/*
+			 * Neither Access or Borland care about this.
+			 *
+			 * if (field_type == PG_TYPE_OID) pfDesc = SQL_ATTR_READONLY;
+			 * else
+			 */
 
-		value = SQL_ATTR_WRITE;
+			value = SQL_ATTR_WRITE;
 
-		mylog("SQLColAttr: UPDATEABLE = %d\n", value);
-		break;
-    }
+			mylog("SQLColAttr: UPDATEABLE = %d\n", value);
+			break;
+	}
 
 	result = SQL_SUCCESS;
 
-	if (p) {  /* char/binary data */
+	if (p)
+	{							/* char/binary data */
 		len = strlen(p);
 
-		if (rgbDesc) {
-			strncpy_null((char *)rgbDesc, p, (size_t)cbDescMax);
+		if (rgbDesc)
+		{
+			strncpy_null((char *) rgbDesc, p, (size_t) cbDescMax);
 
-			if (len >= cbDescMax)  {
+			if (len >= cbDescMax)
+			{
 				result = SQL_SUCCESS_WITH_INFO;
 				stmt->errornumber = STMT_TRUNCATED;
 				stmt->errormsg = "The buffer was too small for the result.";
 			}
 		}
 
-		if (pcbDesc) 
+		if (pcbDesc)
 			*pcbDesc = len;
 	}
-	else {	/* numeric data */
+	else
+	{							/* numeric data */
 
 		if (pfDesc)
 			*pfDesc = value;
@@ -590,79 +657,89 @@ int len = 0, value = 0;
 	}
 
 
-    return result;
+	return result;
 }
 
-/*      Returns result data for a single column in the current row. */
+/*		Returns result data for a single column in the current row. */
 
-RETCODE SQL_API SQLGetData(
-        HSTMT      hstmt,
-        UWORD      icol,
-        SWORD      fCType,
-        PTR        rgbValue,
-        SDWORD     cbValueMax,
-        SDWORD FAR *pcbValue)
+RETCODE SQL_API
+SQLGetData(
+		   HSTMT hstmt,
+		   UWORD icol,
+		   SWORD fCType,
+		   PTR rgbValue,
+		   SDWORD cbValueMax,
+		   SDWORD FAR *pcbValue)
 {
-static char *func="SQLGetData";
-QResultClass *res;
-StatementClass *stmt = (StatementClass *) hstmt;
-int num_cols, num_rows;
-Int4 field_type;
-void *value = NULL;
-int result;
-char get_bookmark = FALSE;
-
-mylog("SQLGetData: enter, stmt=%u\n", stmt);
-
-    if( ! stmt) {
+	static char *func = "SQLGetData";
+	QResultClass *res;
+	StatementClass *stmt = (StatementClass *) hstmt;
+	int			num_cols,
+				num_rows;
+	Int4		field_type;
+	void	   *value = NULL;
+	int			result;
+	char		get_bookmark = FALSE;
+
+	mylog("SQLGetData: enter, stmt=%u\n", stmt);
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
-        return SQL_INVALID_HANDLE;
-    }
+		return SQL_INVALID_HANDLE;
+	}
 	res = stmt->result;
 
-    if (STMT_EXECUTING == stmt->status) {
-        stmt->errormsg = "Can't get data while statement is still executing.";
-        stmt->errornumber = STMT_SEQUENCE_ERROR;
+	if (STMT_EXECUTING == stmt->status)
+	{
+		stmt->errormsg = "Can't get data while statement is still executing.";
+		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    if (stmt->status != STMT_FINISHED) {
-        stmt->errornumber = STMT_STATUS_ERROR;
-        stmt->errormsg = "GetData can only be called after the successful execution on a SQL statement";
+	if (stmt->status != STMT_FINISHED)
+	{
+		stmt->errornumber = STMT_STATUS_ERROR;
+		stmt->errormsg = "GetData can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    if (icol == 0) {
+	if (icol == 0)
+	{
 
-		if (stmt->options.use_bookmarks == SQL_UB_OFF) {
+		if (stmt->options.use_bookmarks == SQL_UB_OFF)
+		{
 			stmt->errornumber = STMT_COLNUM_ERROR;
 			stmt->errormsg = "Attempt to retrieve bookmark with bookmark usage disabled";
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
 
-		/*	Make sure it is the bookmark data type */
-		if (fCType != SQL_C_BOOKMARK) {
+		/* Make sure it is the bookmark data type */
+		if (fCType != SQL_C_BOOKMARK)
+		{
 			stmt->errormsg = "Column 0 is not of type SQL_C_BOOKMARK";
 			stmt->errornumber = STMT_PROGRAM_TYPE_OUT_OF_RANGE;
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
-		
+
 		get_bookmark = TRUE;
 
-    }
+	}
 
-	else {
+	else
+	{
 
 		/* use zero-based column numbers */
 		icol--;
 
 		/* make sure the column number is valid */
 		num_cols = QR_NumResultCols(res);
-		if (icol >= num_cols) {
+		if (icol >= num_cols)
+		{
 			stmt->errormsg = "Invalid column number.";
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			SC_log_error(func, "", stmt);
@@ -670,11 +747,13 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
 		}
 	}
 
-	if ( stmt->manual_result || ! globals.use_declarefetch) {
+	if (stmt->manual_result || !globals.use_declarefetch)
+	{
 		/* make sure we're positioned on a valid row */
 		num_rows = QR_get_num_tuples(res);
-		if((stmt->currTuple < 0) ||
-		   (stmt->currTuple >= num_rows)) {
+		if ((stmt->currTuple < 0) ||
+			(stmt->currTuple >= num_rows))
+		{
 			stmt->errormsg = "Not positioned on a valid row for GetData.";
 			stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
 			SC_log_error(func, "", stmt);
@@ -682,31 +761,33 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
 		}
 		mylog("     num_rows = %d\n", num_rows);
 
-		if ( ! get_bookmark) {
-			if ( stmt->manual_result) {
+		if (!get_bookmark)
+		{
+			if (stmt->manual_result)
 				value = QR_get_value_manual(res, stmt->currTuple, icol);
-			}
-			else {
+			else
 				value = QR_get_value_backend_row(res, stmt->currTuple, icol);
-			}
 			mylog("     value = '%s'\n", value);
 		}
 	}
-	else { /* it's a SOCKET result (backend data) */
-		if (stmt->currTuple == -1 || ! res || ! res->tupleField) {
+	else
+	{							/* it's a SOCKET result (backend data) */
+		if (stmt->currTuple == -1 || !res || !res->tupleField)
+		{
 			stmt->errormsg = "Not positioned on a valid row for GetData.";
 			stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
 
-		if ( ! get_bookmark)
+		if (!get_bookmark)
 			value = QR_get_value_backend(res, icol);
 
 		mylog("  socket: value = '%s'\n", value);
 	}
 
-	if ( get_bookmark) {
+	if (get_bookmark)
+	{
 		*((UDWORD *) rgbValue) = SC_get_bookmark(stmt);
 
 		if (pcbValue)
@@ -721,85 +802,91 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
 
 	stmt->current_col = icol;
 
-    result = copy_and_convert_field(stmt, field_type, value, 
-                                    fCType, rgbValue, cbValueMax, pcbValue);
+	result = copy_and_convert_field(stmt, field_type, value,
+								 fCType, rgbValue, cbValueMax, pcbValue);
 
 	stmt->current_col = -1;
 
-	switch(result) {
-	case COPY_OK:
-		return SQL_SUCCESS;
+	switch (result)
+	{
+		case COPY_OK:
+			return SQL_SUCCESS;
 
-	case COPY_UNSUPPORTED_TYPE:
-		stmt->errormsg = "Received an unsupported type from Postgres.";
-		stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
+		case COPY_UNSUPPORTED_TYPE:
+			stmt->errormsg = "Received an unsupported type from Postgres.";
+			stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
 
-	case COPY_UNSUPPORTED_CONVERSION:
-		stmt->errormsg = "Couldn't handle the necessary data type conversion.";
-		stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
+		case COPY_UNSUPPORTED_CONVERSION:
+			stmt->errormsg = "Couldn't handle the necessary data type conversion.";
+			stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
 
-	case COPY_RESULT_TRUNCATED:
-		stmt->errornumber = STMT_TRUNCATED;
-		stmt->errormsg = "The buffer was too small for the result.";
-		return SQL_SUCCESS_WITH_INFO;
+		case COPY_RESULT_TRUNCATED:
+			stmt->errornumber = STMT_TRUNCATED;
+			stmt->errormsg = "The buffer was too small for the result.";
+			return SQL_SUCCESS_WITH_INFO;
 
-	case COPY_GENERAL_ERROR:	/* error msg already filled in */
-		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
+		case COPY_GENERAL_ERROR:		/* error msg already filled in */
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
 
-	case COPY_NO_DATA_FOUND:
-		/* SC_log_error(func, "no data found", stmt); */
-		return SQL_NO_DATA_FOUND;
+		case COPY_NO_DATA_FOUND:
+			/* SC_log_error(func, "no data found", stmt); */
+			return SQL_NO_DATA_FOUND;
 
-    default:
-        stmt->errormsg = "Unrecognized return value from copy_and_convert_field.";
-        stmt->errornumber = STMT_INTERNAL_ERROR;
-		SC_log_error(func, "", stmt);
-        return SQL_ERROR;
-    }
+		default:
+			stmt->errormsg = "Unrecognized return value from copy_and_convert_field.";
+			stmt->errornumber = STMT_INTERNAL_ERROR;
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
+	}
 }
 
 
 
-/*      Returns data for bound columns in the current row ("hstmt->iCursor"), */
-/*      advances the cursor. */
+/*		Returns data for bound columns in the current row ("hstmt->iCursor"), */
+/*		advances the cursor. */
 
-RETCODE SQL_API SQLFetch(
-        HSTMT   hstmt)
+RETCODE SQL_API
+SQLFetch(
+		 HSTMT hstmt)
 {
-static char *func = "SQLFetch";
-StatementClass *stmt = (StatementClass *) hstmt;   
-QResultClass *res;
+	static char *func = "SQLFetch";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
 
-mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
+	mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	SC_clear_error(stmt);
 
-	if ( ! (res = stmt->result)) {
+	if (!(res = stmt->result))
+	{
 		stmt->errormsg = "Null statement result in SQLFetch.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/*	Not allowed to bind a bookmark column when using SQLFetch. */
-	if ( stmt->bookmark.buffer) {
+	/* Not allowed to bind a bookmark column when using SQLFetch. */
+	if (stmt->bookmark.buffer)
+	{
 		stmt->errornumber = STMT_COLNUM_ERROR;
 		stmt->errormsg = "Not allowed to bind a bookmark column when using SQLFetch";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status == STMT_EXECUTING) {
+	if (stmt->status == STMT_EXECUTING)
+	{
 		stmt->errormsg = "Can't fetch while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -807,14 +894,16 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
 	}
 
 
-	if (stmt->status != STMT_FINISHED) {
+	if (stmt->status != STMT_FINISHED)
+	{
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "Fetch can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->bindings == NULL) {
+	if (stmt->bindings == NULL)
+	{
 		/* just to avoid a crash if the user insists on calling this */
 		/* function even if SQL_ExecDirect has reported an Error */
 		stmt->errormsg = "Bindings were not allocated properly.";
@@ -824,36 +913,43 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
 	}
 
 	QR_set_rowset_size(res, 1);
-	QR_inc_base(res, stmt->last_fetch_count);	
+	QR_inc_base(res, stmt->last_fetch_count);
 
 	return SC_fetch(stmt);
 }
 
-/*      This fetchs a block of data (rowset). */
+/*		This fetchs a block of data (rowset). */
 
-RETCODE SQL_API SQLExtendedFetch(
-        HSTMT      hstmt,
-        UWORD      fFetchType,
-        SDWORD     irow,
-        UDWORD FAR *pcrow,
-        UWORD  FAR *rgfRowStatus)
+RETCODE SQL_API
+SQLExtendedFetch(
+				 HSTMT hstmt,
+				 UWORD fFetchType,
+				 SDWORD irow,
+				 UDWORD FAR *pcrow,
+				 UWORD FAR *rgfRowStatus)
 {
-static char *func = "SQLExtendedFetch";
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *res;
-int num_tuples, i, save_rowset_size;
-RETCODE result;
-char truncated, error;
-
-mylog("SQLExtendedFetch: stmt=%u\n", stmt);
-
-	if ( ! stmt) {
+	static char *func = "SQLExtendedFetch";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
+	int			num_tuples,
+				i,
+				save_rowset_size;
+	RETCODE		result;
+	char		truncated,
+				error;
+
+	mylog("SQLExtendedFetch: stmt=%u\n", stmt);
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if ( globals.use_declarefetch && ! stmt->manual_result) {
-		if ( fFetchType != SQL_FETCH_NEXT) {
+	if (globals.use_declarefetch && !stmt->manual_result)
+	{
+		if (fFetchType != SQL_FETCH_NEXT)
+		{
 			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
 			stmt->errormsg = "Unsupported fetch type for SQLExtendedFetch with UseDeclareFetch option.";
 			return SQL_ERROR;
@@ -862,36 +958,44 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
 
 	SC_clear_error(stmt);
 
-	if ( ! (res = stmt->result)) {
+	if (!(res = stmt->result))
+	{
 		stmt->errormsg = "Null statement result in SQLExtendedFetch.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/*	If a bookmark colunmn is bound but bookmark usage is off, then error */
-	if (stmt->bookmark.buffer && stmt->options.use_bookmarks == SQL_UB_OFF) {
+	/*
+	 * If a bookmark colunmn is bound but bookmark usage is off, then
+	 * error
+	 */
+	if (stmt->bookmark.buffer && stmt->options.use_bookmarks == SQL_UB_OFF)
+	{
 		stmt->errornumber = STMT_COLNUM_ERROR;
 		stmt->errormsg = "Attempt to retrieve bookmark with bookmark usage disabled";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status == STMT_EXECUTING) {
+	if (stmt->status == STMT_EXECUTING)
+	{
 		stmt->errormsg = "Can't fetch while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status != STMT_FINISHED) {
+	if (stmt->status != STMT_FINISHED)
+	{
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "ExtendedFetch can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->bindings == NULL) {
+	if (stmt->bindings == NULL)
+	{
 		/* just to avoid a crash if the user insists on calling this */
 		/* function even if SQL_ExecDirect has reported an Error */
 		stmt->errormsg = "Bindings were not allocated properly.";
@@ -900,7 +1004,7 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
 		return SQL_ERROR;
 	}
 
-	/*	Initialize to no rows fetched */
+	/* Initialize to no rows fetched */
 	if (rgfRowStatus)
 		for (i = 0; i < stmt->options.rowset_size; i++)
 			*(rgfRowStatus + i) = SQL_ROW_NOROW;
@@ -910,150 +1014,170 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
 
 	num_tuples = QR_get_num_tuples(res);
 
-	/*	Save and discard the saved rowset size */
+	/* Save and discard the saved rowset size */
 	save_rowset_size = stmt->save_rowset_size;
 	stmt->save_rowset_size = -1;
 
-	switch (fFetchType)  {
-	case SQL_FETCH_NEXT:
+	switch (fFetchType)
+	{
+		case SQL_FETCH_NEXT:
 
-		/*	From the odbc spec... If positioned before the start of the RESULT SET,
-			then this should be equivalent to SQL_FETCH_FIRST.
-		*/
+			/*
+			 * From the odbc spec... If positioned before the start of the
+			 * RESULT SET, then this should be equivalent to
+			 * SQL_FETCH_FIRST.
+			 */
 
-		if (stmt->rowset_start < 0)
-			stmt->rowset_start = 0;
+			if (stmt->rowset_start < 0)
+				stmt->rowset_start = 0;
 
-		else {
-			
-			stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size);
-		}
+			else
+			{
 
-		mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
-		break;
+				stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size);
+			}
 
-	case SQL_FETCH_PRIOR:
-		mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+			mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+			break;
 
+		case SQL_FETCH_PRIOR:
+			mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-		/*	From the odbc spec... If positioned after the end of the RESULT SET,
-			then this should be equivalent to SQL_FETCH_LAST.
-		*/
 
-		if (stmt->rowset_start >= num_tuples) {
-			stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
+			/*
+			 * From the odbc spec... If positioned after the end of the
+			 * RESULT SET, then this should be equivalent to
+			 * SQL_FETCH_LAST.
+			 */
 
-		}
-		else {
+			if (stmt->rowset_start >= num_tuples)
+			{
+				stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
 
-			stmt->rowset_start -= stmt->options.rowset_size;
+			}
+			else
+			{
 
-		}
+				stmt->rowset_start -= stmt->options.rowset_size;
 
-		break;
+			}
 
-	case SQL_FETCH_FIRST:
-		mylog("SQL_FETCH_FIRST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+			break;
 
-		stmt->rowset_start = 0;
-		break;
+		case SQL_FETCH_FIRST:
+			mylog("SQL_FETCH_FIRST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-	case SQL_FETCH_LAST:
-		mylog("SQL_FETCH_LAST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+			stmt->rowset_start = 0;
+			break;
 
-		stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size) ;
-		break;
+		case SQL_FETCH_LAST:
+			mylog("SQL_FETCH_LAST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-	case SQL_FETCH_ABSOLUTE:
-		mylog("SQL_FETCH_ABSOLUTE: num_tuples=%d, currtuple=%d, irow=%d\n", num_tuples, stmt->currTuple, irow);
+			stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
+			break;
 
-		/*	Position before result set, but dont fetch anything */
-		if (irow == 0) {
-			stmt->rowset_start = -1;
-			stmt->currTuple = -1;
-			return SQL_NO_DATA_FOUND;
-		}
-		/*	Position before the desired row */
-		else if (irow > 0) {
-			stmt->rowset_start = irow - 1;
-		}
-		/*	Position with respect to the end of the result set */
-		else {
-			stmt->rowset_start = num_tuples + irow;
-		}    
+		case SQL_FETCH_ABSOLUTE:
+			mylog("SQL_FETCH_ABSOLUTE: num_tuples=%d, currtuple=%d, irow=%d\n", num_tuples, stmt->currTuple, irow);
 
-		break;
+			/* Position before result set, but dont fetch anything */
+			if (irow == 0)
+			{
+				stmt->rowset_start = -1;
+				stmt->currTuple = -1;
+				return SQL_NO_DATA_FOUND;
+			}
+			/* Position before the desired row */
+			else if (irow > 0)
+				stmt->rowset_start = irow - 1;
+			/* Position with respect to the end of the result set */
+			else
+				stmt->rowset_start = num_tuples + irow;
 
-	case SQL_FETCH_RELATIVE:
-		
-		/*	Refresh the current rowset -- not currently implemented, but lie anyway */
-		if (irow == 0) {
 			break;
-		}
 
-		stmt->rowset_start += irow;
+		case SQL_FETCH_RELATIVE:
 
-		
-		break;
+			/*
+			 * Refresh the current rowset -- not currently implemented,
+			 * but lie anyway
+			 */
+			if (irow == 0)
+				break;
 
-	case SQL_FETCH_BOOKMARK:
+			stmt->rowset_start += irow;
 
-		stmt->rowset_start = irow - 1;
-		break;
 
-	default:
-		SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt);
-		return SQL_ERROR;   
+			break;
 
-	}           
+		case SQL_FETCH_BOOKMARK:
+
+			stmt->rowset_start = irow - 1;
+			break;
+
+		default:
+			SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt);
+			return SQL_ERROR;
+
+	}
 
 
 	/***********************************/
-	/*	CHECK FOR PROPER CURSOR STATE  */
+	/* CHECK FOR PROPER CURSOR STATE  */
 	/***********************************/
-	/*	Handle Declare Fetch style specially because the end is not really the end... */
-	if ( globals.use_declarefetch && ! stmt->manual_result) {
-		if (QR_end_tuples(res)) {
+
+	/*
+	 * Handle Declare Fetch style specially because the end is not really
+	 * the end...
+	 */
+	if (globals.use_declarefetch && !stmt->manual_result)
+	{
+		if (QR_end_tuples(res))
 			return SQL_NO_DATA_FOUND;
-		}
 	}
-	else {
-		/*	If *new* rowset is after the result_set, return no data found */
-		if (stmt->rowset_start >= num_tuples) {
+	else
+	{
+		/* If *new* rowset is after the result_set, return no data found */
+		if (stmt->rowset_start >= num_tuples)
+		{
 			stmt->rowset_start = num_tuples;
 			return SQL_NO_DATA_FOUND;
 		}
 	}
 
-	/*	If *new* rowset is prior to result_set, return no data found */
-	if (stmt->rowset_start < 0) {
-		if (stmt->rowset_start + stmt->options.rowset_size <= 0) {
+	/* If *new* rowset is prior to result_set, return no data found */
+	if (stmt->rowset_start < 0)
+	{
+		if (stmt->rowset_start + stmt->options.rowset_size <= 0)
+		{
 			stmt->rowset_start = -1;
 			return SQL_NO_DATA_FOUND;
 		}
-		else {	/*	overlap with beginning of result set, so get first rowset */
+		else
+		{						/* overlap with beginning of result set,
+								 * so get first rowset */
 			stmt->rowset_start = 0;
 		}
 	}
 
-	/*	currTuple is always 1 row prior to the rowset */
+	/* currTuple is always 1 row prior to the rowset */
 	stmt->currTuple = stmt->rowset_start - 1;
 
-	/*	increment the base row in the tuple cache */
+	/* increment the base row in the tuple cache */
 	QR_set_rowset_size(res, stmt->options.rowset_size);
-	QR_inc_base(res, stmt->last_fetch_count);	
-		
-	/*	Physical Row advancement occurs for each row fetched below */
+	QR_inc_base(res, stmt->last_fetch_count);
+
+	/* Physical Row advancement occurs for each row fetched below */
 
 	mylog("SQLExtendedFetch: new currTuple = %d\n", stmt->currTuple);
 
 	truncated = error = FALSE;
-	for (i = 0; i < stmt->options.rowset_size; i++) {
+	for (i = 0; i < stmt->options.rowset_size; i++)
+	{
 
 		stmt->bind_row = i;		/* set the binding location */
 		result = SC_fetch(stmt);
 
-		/*	Determine Function status */
+		/* Determine Function status */
 		if (result == SQL_NO_DATA_FOUND)
 			break;
 		else if (result == SQL_SUCCESS_WITH_INFO)
@@ -1061,35 +1185,36 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
 		else if (result == SQL_ERROR)
 			error = TRUE;
 
-		/*	Determine Row Status */
-		if (rgfRowStatus) {
-			if (result == SQL_ERROR) 
+		/* Determine Row Status */
+		if (rgfRowStatus)
+		{
+			if (result == SQL_ERROR)
 				*(rgfRowStatus + i) = SQL_ROW_ERROR;
 			else
-				*(rgfRowStatus + i)= SQL_ROW_SUCCESS;
+				*(rgfRowStatus + i) = SQL_ROW_SUCCESS;
 		}
 	}
 
-	/*	Save the fetch count for SQLSetPos */
-	stmt->last_fetch_count= i;
+	/* Save the fetch count for SQLSetPos */
+	stmt->last_fetch_count = i;
 
-	/*	Reset next binding row */
+	/* Reset next binding row */
 	stmt->bind_row = 0;
 
-	/*	Move the cursor position to the first row in the result set. */
+	/* Move the cursor position to the first row in the result set. */
 	stmt->currTuple = stmt->rowset_start;
 
-	/*	For declare/fetch, need to reset cursor to beginning of rowset */
-	if (globals.use_declarefetch && ! stmt->manual_result) {
+	/* For declare/fetch, need to reset cursor to beginning of rowset */
+	if (globals.use_declarefetch && !stmt->manual_result)
 		QR_set_position(res, 0);
-	}
 
-	/*	Set the number of rows retrieved */
+	/* Set the number of rows retrieved */
 	if (pcrow)
 		*pcrow = i;
 
 	if (i == 0)
-		return SQL_NO_DATA_FOUND;		/*	Only DeclareFetch should wind up here */
+		return SQL_NO_DATA_FOUND;		/* Only DeclareFetch should wind
+										 * up here */
 	else if (error)
 		return SQL_ERROR;
 	else if (truncated)
@@ -1100,43 +1225,49 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
 }
 
 
-/*      This determines whether there are more results sets available for */
-/*      the "hstmt". */
+/*		This determines whether there are more results sets available for */
+/*		the "hstmt". */
 
 /* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
-RETCODE SQL_API SQLMoreResults(
-        HSTMT   hstmt)
+RETCODE SQL_API
+SQLMoreResults(
+			   HSTMT hstmt)
 {
 	return SQL_NO_DATA_FOUND;
 }
 
-/*     This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
+/*	   This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
 /*	   This will be useful (so far) only when using SQLGetData after SQLExtendedFetch.	 */
-RETCODE SQL_API SQLSetPos(
-        HSTMT   hstmt,
-        UWORD   irow,
-        UWORD   fOption,
-        UWORD   fLock)
+RETCODE SQL_API
+SQLSetPos(
+		  HSTMT hstmt,
+		  UWORD irow,
+		  UWORD fOption,
+		  UWORD fLock)
 {
-static char *func = "SQLSetPos";
-StatementClass *stmt = (StatementClass *) hstmt;
-QResultClass *res;
-int num_cols, i;
-BindInfoClass *bindings = stmt->bindings;
-
-	if ( ! stmt) {
+	static char *func = "SQLSetPos";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	QResultClass *res;
+	int			num_cols,
+				i;
+	BindInfoClass *bindings = stmt->bindings;
+
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (fOption != SQL_POSITION && fOption != SQL_REFRESH) {
+	if (fOption != SQL_POSITION && fOption != SQL_REFRESH)
+	{
 		stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
 		stmt->errormsg = "Only SQL_POSITION/REFRESH is supported for SQLSetPos";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if ( ! (res = stmt->result)) {
+	if (!(res = stmt->result))
+	{
 		stmt->errormsg = "Null statement result in SQLSetPos.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -1144,14 +1275,16 @@ BindInfoClass *bindings = stmt->bindings;
 	}
 	num_cols = QR_NumResultCols(res);
 
-	if (irow == 0) {
+	if (irow == 0)
+	{
 		stmt->errornumber = STMT_ROW_OUT_OF_RANGE;
 		stmt->errormsg = "Driver does not support Bulk operations.";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (irow > stmt->last_fetch_count) {
+	if (irow > stmt->last_fetch_count)
+	{
 		stmt->errornumber = STMT_ROW_OUT_OF_RANGE;
 		stmt->errormsg = "Row value out of range";
 		SC_log_error(func, "", stmt);
@@ -1160,7 +1293,7 @@ BindInfoClass *bindings = stmt->bindings;
 
 	irow--;
 
-	/*	Reset for SQLGetData */
+	/* Reset for SQLGetData */
 	for (i = 0; i < num_cols; i++)
 		bindings[i].data_left = -1;
 
@@ -1172,73 +1305,80 @@ BindInfoClass *bindings = stmt->bindings;
 
 }
 
-/*      Sets options that control the behavior of cursors. */
+/*		Sets options that control the behavior of cursors. */
 
-RETCODE SQL_API SQLSetScrollOptions(
-        HSTMT      hstmt,
-        UWORD      fConcurrency,
-        SDWORD  crowKeyset,
-        UWORD      crowRowset)
+RETCODE SQL_API
+SQLSetScrollOptions(
+					HSTMT hstmt,
+					UWORD fConcurrency,
+					SDWORD crowKeyset,
+					UWORD crowRowset)
 {
-static char *func = "SQLSetScrollOptions";
+	static char *func = "SQLSetScrollOptions";
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
 	return SQL_ERROR;
 }
 
 
-/*      Set the cursor name on a statement handle */
+/*		Set the cursor name on a statement handle */
 
-RETCODE SQL_API SQLSetCursorName(
-        HSTMT     hstmt,
-        UCHAR FAR *szCursor,
-        SWORD     cbCursor)
+RETCODE SQL_API
+SQLSetCursorName(
+				 HSTMT hstmt,
+				 UCHAR FAR *szCursor,
+				 SWORD cbCursor)
 {
-static char *func="SQLSetCursorName";
-StatementClass *stmt = (StatementClass *) hstmt;
-int len;
+	static char *func = "SQLSetCursorName";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	int			len;
 
-mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCursor, cbCursor);
+	mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCursor, cbCursor);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	len = (cbCursor == SQL_NTS) ? strlen(szCursor) : cbCursor;
 
-	if (len <= 0 || len > sizeof(stmt->cursor_name) - 1) {
+	if (len <= 0 || len > sizeof(stmt->cursor_name) - 1)
+	{
 		stmt->errornumber = STMT_INVALID_CURSOR_NAME;
 		stmt->errormsg = "Invalid Cursor Name";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	strncpy_null(stmt->cursor_name, szCursor, len+1);
+	strncpy_null(stmt->cursor_name, szCursor, len + 1);
 	return SQL_SUCCESS;
 }
 
-/*      Return the cursor name for a statement handle */
+/*		Return the cursor name for a statement handle */
 
-RETCODE SQL_API SQLGetCursorName(
-        HSTMT     hstmt,
-        UCHAR FAR *szCursor,
-        SWORD     cbCursorMax,
-        SWORD FAR *pcbCursor)
+RETCODE SQL_API
+SQLGetCursorName(
+				 HSTMT hstmt,
+				 UCHAR FAR *szCursor,
+				 SWORD cbCursorMax,
+				 SWORD FAR *pcbCursor)
 {
-static char *func="SQLGetCursorName";
-StatementClass *stmt = (StatementClass *) hstmt;
-int len = 0;
-RETCODE result;
+	static char *func = "SQLGetCursorName";
+	StatementClass *stmt = (StatementClass *) hstmt;
+	int			len = 0;
+	RETCODE		result;
 
-mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n", hstmt, szCursor, cbCursorMax, pcbCursor);
+	mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n", hstmt, szCursor, cbCursorMax, pcbCursor);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if ( stmt->cursor_name[0] == '\0') {
+	if (stmt->cursor_name[0] == '\0')
+	{
 		stmt->errornumber = STMT_NO_CURSOR_NAME;
 		stmt->errormsg = "No Cursor name available";
 		SC_log_error(func, "", stmt);
@@ -1248,10 +1388,12 @@ mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n",
 	result = SQL_SUCCESS;
 	len = strlen(stmt->cursor_name);
 
-	if (szCursor) {
+	if (szCursor)
+	{
 		strncpy_null(szCursor, stmt->cursor_name, cbCursorMax);
 
-		if (len >= cbCursorMax)  {
+		if (len >= cbCursorMax)
+		{
 			result = SQL_SUCCESS_WITH_INFO;
 			stmt->errornumber = STMT_TRUNCATED;
 			stmt->errormsg = "The buffer was too small for the result.";
@@ -1263,5 +1405,3 @@ mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n",
 
 	return result;
 }
-
-
diff --git a/src/interfaces/odbc/setup.c b/src/interfaces/odbc/setup.c
index 8c3ba4d02ae4d0bbd20948cafd681b3c504a3cd3..d4950da32cb99f2f8f8c71e433c7c3b9b7a25488 100644
--- a/src/interfaces/odbc/setup.c
+++ b/src/interfaces/odbc/setup.c
@@ -1,15 +1,15 @@
 
-/* Module:          setup.c
+/* Module:			setup.c
  *
- * Description:     This module contains the setup functions for 
- *                  adding/modifying a Data Source in the ODBC.INI portion
- *                  of the registry.
+ * Description:		This module contains the setup functions for
+ *					adding/modifying a Data Source in the ODBC.INI portion
+ *					of the registry.
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   ConfigDSN
+ * API functions:	ConfigDSN
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  *************************************************************************************/
 
@@ -26,288 +26,313 @@
 
 #define INTFUNC  __stdcall
 
-extern HINSTANCE NEAR s_hModule;               /* Saved module handle. */
+extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
 extern GLOBAL_VALUES globals;
 
 /* Constants --------------------------------------------------------------- */
-#define MIN(x,y)      ((x) < (y) ? (x) : (y))
+#define MIN(x,y)	  ((x) < (y) ? (x) : (y))
 
 #ifdef WIN32
-#define MAXPGPATH       (255+1)
+#define MAXPGPATH		(255+1)
 #endif
 
-#define MAXKEYLEN       (15+1)            /* Max keyword length */
-#define MAXDESC         (255+1)           /* Max description length */
-#define MAXDSNAME       (32+1)            /* Max data source name length */
+#define MAXKEYLEN		(15+1)	/* Max keyword length */
+#define MAXDESC			(255+1) /* Max description length */
+#define MAXDSNAME		(32+1)	/* Max data source name length */
 
 
 /* Globals ----------------------------------------------------------------- */
 /* NOTE:  All these are used by the dialog procedures */
-typedef struct tagSETUPDLG {
-        HWND       hwndParent;                   /* Parent window handle */
-        LPCSTR     lpszDrvr;                     /* Driver description */
-		ConnInfo   ci;
-        char       szDSN[MAXDSNAME];             /* Original data source name */
-        BOOL       fNewDSN;                      /* New data source flag */
-        BOOL       fDefault;                     /* Default data source flag */
+typedef struct tagSETUPDLG
+{
+	HWND		hwndParent;		/* Parent window handle */
+	LPCSTR		lpszDrvr;		/* Driver description */
+	ConnInfo	ci;
+	char		szDSN[MAXDSNAME];		/* Original data source name */
+	BOOL		fNewDSN;		/* New data source flag */
+	BOOL		fDefault;		/* Default data source flag */
 
-} SETUPDLG, FAR *LPSETUPDLG;
+}			SETUPDLG, FAR *LPSETUPDLG;
 
 
 
 /* Prototypes -------------------------------------------------------------- */
 void INTFUNC CenterDialog(HWND hdlg);
-int  CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam);
-void INTFUNC ParseAttributes (LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
+int CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam);
+void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
 BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
 
 
 /* ConfigDSN ---------------------------------------------------------------
-  Description:  ODBC Setup entry point
-                This entry point is called by the ODBC Installer
-                (see file header for more details)
-  Input      :  hwnd ----------- Parent window handle
-                fRequest ------- Request type (i.e., add, config, or remove)
-                lpszDriver ----- Driver name
-                lpszAttributes - data source attribute string
-  Output     :  TRUE success, FALSE otherwise
+  Description:	ODBC Setup entry point
+				This entry point is called by the ODBC Installer
+				(see file header for more details)
+  Input		 :	hwnd ----------- Parent window handle
+				fRequest ------- Request type (i.e., add, config, or remove)
+				lpszDriver ----- Driver name
+				lpszAttributes - data source attribute string
+  Output	 :	TRUE success, FALSE otherwise
 --------------------------------------------------------------------------*/
 
-BOOL CALLBACK ConfigDSN (HWND    hwnd,
-                         WORD    fRequest,
-                         LPCSTR  lpszDriver,
-                         LPCSTR  lpszAttributes)
+BOOL CALLBACK
+ConfigDSN(HWND hwnd,
+		  WORD fRequest,
+		  LPCSTR lpszDriver,
+		  LPCSTR lpszAttributes)
 {
-BOOL  fSuccess;                                            /* Success/fail flag */
-GLOBALHANDLE hglbAttr;
-LPSETUPDLG lpsetupdlg;
-        
+	BOOL		fSuccess;		/* Success/fail flag */
+	GLOBALHANDLE hglbAttr;
+	LPSETUPDLG	lpsetupdlg;
+
 
 	/* Allocate attribute array */
-        hglbAttr = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(SETUPDLG));
-        if (!hglbAttr)
-                return FALSE;
-        lpsetupdlg = (LPSETUPDLG)GlobalLock(hglbAttr);
-
-        /* Parse attribute string */
-        if (lpszAttributes)
-                ParseAttributes(lpszAttributes, lpsetupdlg);
-
-        /* Save original data source name */
-        if (lpsetupdlg->ci.dsn[0])
-                lstrcpy(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn);
-        else
-                lpsetupdlg->szDSN[0] = '\0';
-
-        /* Remove data source */
-        if (ODBC_REMOVE_DSN == fRequest) {
+	hglbAttr = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(SETUPDLG));
+	if (!hglbAttr)
+		return FALSE;
+	lpsetupdlg = (LPSETUPDLG) GlobalLock(hglbAttr);
+
+	/* Parse attribute string */
+	if (lpszAttributes)
+		ParseAttributes(lpszAttributes, lpsetupdlg);
+
+	/* Save original data source name */
+	if (lpsetupdlg->ci.dsn[0])
+		lstrcpy(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn);
+	else
+		lpsetupdlg->szDSN[0] = '\0';
+
+	/* Remove data source */
+	if (ODBC_REMOVE_DSN == fRequest)
+	{
 		/* Fail if no data source name was supplied */
-                if (!lpsetupdlg->ci.dsn[0])
-                        fSuccess = FALSE;
+		if (!lpsetupdlg->ci.dsn[0])
+			fSuccess = FALSE;
 
-                /* Otherwise remove data source from ODBC.INI */
-                else
-                        fSuccess = SQLRemoveDSNFromIni(lpsetupdlg->ci.dsn);
-        }
+		/* Otherwise remove data source from ODBC.INI */
+		else
+			fSuccess = SQLRemoveDSNFromIni(lpsetupdlg->ci.dsn);
+	}
 
-        /* Add or Configure data source */
-        else {
+	/* Add or Configure data source */
+	else
+	{
 		/* Save passed variables for global access (e.g., dialog access) */
-                lpsetupdlg->hwndParent = hwnd;
-                lpsetupdlg->lpszDrvr     = lpszDriver;
-                lpsetupdlg->fNewDSN      = (ODBC_ADD_DSN == fRequest);
-                lpsetupdlg->fDefault     = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN);
-
-                /* Display the appropriate dialog (if parent window handle supplied) */
-                if (hwnd) {
-			  /* Display dialog(s) */
-                          fSuccess = (IDOK == DialogBoxParam(s_hModule,
-                                                                MAKEINTRESOURCE(DLG_CONFIG),
-                                                                hwnd,
-                                                                ConfigDlgProc,
-                                                                (LONG)(LPSTR)lpsetupdlg));
-                }
-
-                else if (lpsetupdlg->ci.dsn[0])
-                        fSuccess = SetDSNAttributes(hwnd, lpsetupdlg);
-                else
-                        fSuccess = FALSE;
-        }
-
-        GlobalUnlock(hglbAttr);
-        GlobalFree(hglbAttr);
-
-        return fSuccess;
+		lpsetupdlg->hwndParent = hwnd;
+		lpsetupdlg->lpszDrvr = lpszDriver;
+		lpsetupdlg->fNewDSN = (ODBC_ADD_DSN == fRequest);
+		lpsetupdlg->fDefault = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN);
+
+		/*
+		 * Display the appropriate dialog (if parent window handle
+		 * supplied)
+		 */
+		if (hwnd)
+		{
+			/* Display dialog(s) */
+			fSuccess = (IDOK == DialogBoxParam(s_hModule,
+											 MAKEINTRESOURCE(DLG_CONFIG),
+											   hwnd,
+											   ConfigDlgProc,
+											 (LONG) (LPSTR) lpsetupdlg));
+		}
+
+		else if (lpsetupdlg->ci.dsn[0])
+			fSuccess = SetDSNAttributes(hwnd, lpsetupdlg);
+		else
+			fSuccess = FALSE;
+	}
+
+	GlobalUnlock(hglbAttr);
+	GlobalFree(hglbAttr);
+
+	return fSuccess;
 }
 
 
 /* CenterDialog ------------------------------------------------------------
-        Description:  Center the dialog over the frame window
-        Input      :  hdlg -- Dialog window handle
-        Output     :  None
+		Description:  Center the dialog over the frame window
+		Input	   :  hdlg -- Dialog window handle
+		Output	   :  None
 --------------------------------------------------------------------------*/
-void INTFUNC CenterDialog(HWND hdlg)
+void INTFUNC
+CenterDialog(HWND hdlg)
 {
-        HWND    hwndFrame;
-        RECT    rcDlg, rcScr, rcFrame;
-        int             cx, cy;
-
-        hwndFrame = GetParent(hdlg);
-
-        GetWindowRect(hdlg, &rcDlg);
-        cx = rcDlg.right  - rcDlg.left;
-        cy = rcDlg.bottom - rcDlg.top;
-
-        GetClientRect(hwndFrame, &rcFrame);
-        ClientToScreen(hwndFrame, (LPPOINT)(&rcFrame.left));
-        ClientToScreen(hwndFrame, (LPPOINT)(&rcFrame.right));
-        rcDlg.top    = rcFrame.top  + (((rcFrame.bottom - rcFrame.top) - cy) >> 1);
-        rcDlg.left   = rcFrame.left + (((rcFrame.right - rcFrame.left) - cx) >> 1);
-        rcDlg.bottom = rcDlg.top  + cy;
-        rcDlg.right  = rcDlg.left + cx;
-
-        GetWindowRect(GetDesktopWindow(), &rcScr);
-        if (rcDlg.bottom > rcScr.bottom)
-        {
-                rcDlg.bottom = rcScr.bottom;
-                rcDlg.top    = rcDlg.bottom - cy;
-        }
-        if (rcDlg.right  > rcScr.right)
-        {
-                rcDlg.right = rcScr.right;
-                rcDlg.left  = rcDlg.right - cx;
-        }
-
-        if (rcDlg.left < 0) rcDlg.left = 0;
-        if (rcDlg.top  < 0) rcDlg.top  = 0;
-
-        MoveWindow(hdlg, rcDlg.left, rcDlg.top, cx, cy, TRUE);
-        return;
+	HWND		hwndFrame;
+	RECT		rcDlg,
+				rcScr,
+				rcFrame;
+	int			cx,
+				cy;
+
+	hwndFrame = GetParent(hdlg);
+
+	GetWindowRect(hdlg, &rcDlg);
+	cx = rcDlg.right - rcDlg.left;
+	cy = rcDlg.bottom - rcDlg.top;
+
+	GetClientRect(hwndFrame, &rcFrame);
+	ClientToScreen(hwndFrame, (LPPOINT) (&rcFrame.left));
+	ClientToScreen(hwndFrame, (LPPOINT) (&rcFrame.right));
+	rcDlg.top = rcFrame.top + (((rcFrame.bottom - rcFrame.top) - cy) >> 1);
+	rcDlg.left = rcFrame.left + (((rcFrame.right - rcFrame.left) - cx) >> 1);
+	rcDlg.bottom = rcDlg.top + cy;
+	rcDlg.right = rcDlg.left + cx;
+
+	GetWindowRect(GetDesktopWindow(), &rcScr);
+	if (rcDlg.bottom > rcScr.bottom)
+	{
+		rcDlg.bottom = rcScr.bottom;
+		rcDlg.top = rcDlg.bottom - cy;
+	}
+	if (rcDlg.right > rcScr.right)
+	{
+		rcDlg.right = rcScr.right;
+		rcDlg.left = rcDlg.right - cx;
+	}
+
+	if (rcDlg.left < 0)
+		rcDlg.left = 0;
+	if (rcDlg.top < 0)
+		rcDlg.top = 0;
+
+	MoveWindow(hdlg, rcDlg.left, rcDlg.top, cx, cy, TRUE);
+	return;
 }
 
 /* ConfigDlgProc -----------------------------------------------------------
-  Description:  Manage add data source name dialog
-  Input      :  hdlg --- Dialog window handle
-                wMsg --- Message
-                wParam - Message parameter
-                lParam - Message parameter
-  Output     :  TRUE if message processed, FALSE otherwise
+  Description:	Manage add data source name dialog
+  Input		 :	hdlg --- Dialog window handle
+				wMsg --- Message
+				wParam - Message parameter
+				lParam - Message parameter
+  Output	 :	TRUE if message processed, FALSE otherwise
 --------------------------------------------------------------------------*/
 
 
-int CALLBACK ConfigDlgProc(HWND   hdlg,
-                           WORD   wMsg,
-                           WPARAM wParam,
-                           LPARAM lParam)
+int CALLBACK
+ConfigDlgProc(HWND hdlg,
+			  WORD wMsg,
+			  WPARAM wParam,
+			  LPARAM lParam)
 {
 
-	switch (wMsg) {
-	/* Initialize the dialog */
-	case WM_INITDIALOG:
+	switch (wMsg)
 	{
-		LPSETUPDLG lpsetupdlg = (LPSETUPDLG) lParam;
-		ConnInfo *ci = &lpsetupdlg->ci;
+			/* Initialize the dialog */
+			case WM_INITDIALOG:
+			{
+				LPSETUPDLG	lpsetupdlg = (LPSETUPDLG) lParam;
+				ConnInfo   *ci = &lpsetupdlg->ci;
 
-		/*	Hide the driver connect message */
-		ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
+				/* Hide the driver connect message */
+				ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
 
-		SetWindowLong(hdlg, DWL_USER, lParam);
-		CenterDialog(hdlg);                             /* Center dialog */
+				SetWindowLong(hdlg, DWL_USER, lParam);
+				CenterDialog(hdlg);		/* Center dialog */
 
-		/* NOTE: Values supplied in the attribute string will always */
-		/*       override settings in ODBC.INI */
+				/*
+				 * NOTE: Values supplied in the attribute string will
+				 * always
+				 */
+				/* override settings in ODBC.INI */
 
-		/*	Get the rest of the common attributes */
-		getDSNinfo(ci, CONN_DONT_OVERWRITE);
+				/* Get the rest of the common attributes */
+				getDSNinfo(ci, CONN_DONT_OVERWRITE);
 
-		/*	Fill in any defaults */
-		getDSNdefaults(ci);
+				/* Fill in any defaults */
+				getDSNdefaults(ci);
 
 
-		/* Initialize dialog fields */
-		SetDlgStuff(hdlg, ci);
+				/* Initialize dialog fields */
+				SetDlgStuff(hdlg, ci);
 
 
-		if (lpsetupdlg->fDefault) {
-			EnableWindow(GetDlgItem(hdlg, IDC_DSNAME), FALSE);
-			EnableWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), FALSE);
-		}
-		else
-			SendDlgItemMessage(hdlg, IDC_DSNAME,
-				EM_LIMITTEXT, (WPARAM)(MAXDSNAME-1), 0L);
+				if (lpsetupdlg->fDefault)
+				{
+					EnableWindow(GetDlgItem(hdlg, IDC_DSNAME), FALSE);
+					EnableWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), FALSE);
+				}
+				else
+					SendDlgItemMessage(hdlg, IDC_DSNAME,
+							 EM_LIMITTEXT, (WPARAM) (MAXDSNAME - 1), 0L);
 
-		SendDlgItemMessage(hdlg, IDC_DESC,
-			EM_LIMITTEXT, (WPARAM)(MAXDESC-1), 0L);
-		return TRUE;                                            /* Focus was not set */
-    }
+				SendDlgItemMessage(hdlg, IDC_DESC,
+							   EM_LIMITTEXT, (WPARAM) (MAXDESC - 1), 0L);
+				return TRUE;	/* Focus was not set */
+			}
 
 
-	/* Process buttons */
-	case WM_COMMAND:
+			/* Process buttons */
+		case WM_COMMAND:
 
-		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
-		/* Ensure the OK button is enabled only when a data source name */
-		/* is entered */
-		case IDC_DSNAME:
-			if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
+			switch (GET_WM_COMMAND_ID(wParam, lParam))
 			{
-				char    szItem[MAXDSNAME];              /* Edit control text */
 
-				/* Enable/disable the OK button */
-				EnableWindow(GetDlgItem(hdlg, IDOK),
-					GetDlgItemText(hdlg, IDC_DSNAME,
-					szItem, sizeof(szItem)));
+					/*
+					 * Ensure the OK button is enabled only when a data
+					 * source name
+					 */
+					/* is entered */
+				case IDC_DSNAME:
+					if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
+					{
+						char		szItem[MAXDSNAME];	/* Edit control text */
 
-				return TRUE;
-			}
-			break;
+						/* Enable/disable the OK button */
+						EnableWindow(GetDlgItem(hdlg, IDOK),
+									 GetDlgItemText(hdlg, IDC_DSNAME,
+												szItem, sizeof(szItem)));
 
-		/* Accept results */
-		case IDOK:
-		{
-			LPSETUPDLG lpsetupdlg;
+						return TRUE;
+					}
+					break;
 
-			lpsetupdlg = (LPSETUPDLG)GetWindowLong(hdlg, DWL_USER);
-			/* Retrieve dialog values */
-			if (!lpsetupdlg->fDefault)
-					GetDlgItemText(hdlg, IDC_DSNAME,
-							lpsetupdlg->ci.dsn,
-							sizeof(lpsetupdlg->ci.dsn));
+					/* Accept results */
+				case IDOK:
+					{
+						LPSETUPDLG	lpsetupdlg;
 
+						lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
+						/* Retrieve dialog values */
+						if (!lpsetupdlg->fDefault)
+							GetDlgItemText(hdlg, IDC_DSNAME,
+										   lpsetupdlg->ci.dsn,
+										   sizeof(lpsetupdlg->ci.dsn));
 
-			/*	Get Dialog Values */
-			GetDlgStuff(hdlg, &lpsetupdlg->ci);
 
-			/* Update ODBC.INI */
-			SetDSNAttributes(hdlg, lpsetupdlg);
-        }
+						/* Get Dialog Values */
+						GetDlgStuff(hdlg, &lpsetupdlg->ci);
 
-		/* Return to caller */
-		case IDCANCEL:
-			EndDialog(hdlg, wParam);
-			return TRUE;
+						/* Update ODBC.INI */
+						SetDSNAttributes(hdlg, lpsetupdlg);
+					}
 
-		case IDC_DRIVER:
+					/* Return to caller */
+				case IDCANCEL:
+					EndDialog(hdlg, wParam);
+					return TRUE;
 
-			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
-									hdlg, driver_optionsProc, (LPARAM) NULL);
+				case IDC_DRIVER:
 
-			return TRUE;
+					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+								hdlg, driver_optionsProc, (LPARAM) NULL);
 
-		case IDC_DATASOURCE:
-			{
-			LPSETUPDLG lpsetupdlg;
+					return TRUE;
+
+				case IDC_DATASOURCE:
+					{
+						LPSETUPDLG	lpsetupdlg;
 
-			lpsetupdlg = (LPSETUPDLG)GetWindowLong(hdlg, DWL_USER);
+						lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
 
-			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
-									hdlg, ds_optionsProc, (LPARAM) &lpsetupdlg->ci);
+						DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
+						 hdlg, ds_optionsProc, (LPARAM) &lpsetupdlg->ci);
 
-			return TRUE;
+						return TRUE;
+					}
 			}
-		}
 
-		break;
+			break;
 	}
 
 	/* Message not processed */
@@ -316,97 +341,98 @@ int CALLBACK ConfigDlgProc(HWND   hdlg,
 
 
 /* ParseAttributes ---------------------------------------------------------
-  Description:  Parse attribute string moving values into the aAttr array
-  Input      :  lpszAttributes - Pointer to attribute string
-  Output     :  None (global aAttr normally updated)
+  Description:	Parse attribute string moving values into the aAttr array
+  Input		 :	lpszAttributes - Pointer to attribute string
+  Output	 :	None (global aAttr normally updated)
 --------------------------------------------------------------------------*/
-void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
+void INTFUNC
+ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
 {
-LPCSTR  lpsz;
-LPCSTR  lpszStart;
-char    aszKey[MAXKEYLEN];
-int     cbKey;
-char    value[MAXPGPATH];
-
-		memset(&lpsetupdlg->ci, 0, sizeof(ConnInfo));
-
-        for (lpsz=lpszAttributes; *lpsz; lpsz++)
-        {  /*  Extract key name (e.g., DSN), it must be terminated by an equals */
-                lpszStart = lpsz;
-                for (;; lpsz++)
-                {
-                        if (!*lpsz)
-                                return;         /* No key was found */
-                        else if (*lpsz == '=')
-                                break;          /* Valid key found */
-                }
-                /* Determine the key's index in the key table (-1 if not found) */
-                cbKey    = lpsz - lpszStart;
-                if (cbKey < sizeof(aszKey))
-                {
-
-                        _fmemcpy(aszKey, lpszStart, cbKey);
-                        aszKey[cbKey] = '\0';
-                }
-
-                /* Locate end of key value */
-                lpszStart = ++lpsz;
-                for (; *lpsz; lpsz++);
-
-
-                /* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */
-                _fmemcpy(value, lpszStart, MIN(lpsz-lpszStart+1, MAXPGPATH));
-
-				mylog("aszKey='%s', value='%s'\n", aszKey, value);
-
-				/*	Copy the appropriate value to the conninfo  */
-				copyAttributes(&lpsetupdlg->ci, aszKey, value);
-        }
-        return;
+	LPCSTR		lpsz;
+	LPCSTR		lpszStart;
+	char		aszKey[MAXKEYLEN];
+	int			cbKey;
+	char		value[MAXPGPATH];
+
+	memset(&lpsetupdlg->ci, 0, sizeof(ConnInfo));
+
+	for (lpsz = lpszAttributes; *lpsz; lpsz++)
+	{							/* Extract key name (e.g., DSN), it must
+								 * be terminated by an equals */
+		lpszStart = lpsz;
+		for (;; lpsz++)
+		{
+			if (!*lpsz)
+				return;			/* No key was found */
+			else if (*lpsz == '=')
+				break;			/* Valid key found */
+		}
+		/* Determine the key's index in the key table (-1 if not found) */
+		cbKey = lpsz - lpszStart;
+		if (cbKey < sizeof(aszKey))
+		{
+
+			_fmemcpy(aszKey, lpszStart, cbKey);
+			aszKey[cbKey] = '\0';
+		}
+
+		/* Locate end of key value */
+		lpszStart = ++lpsz;
+		for (; *lpsz; lpsz++);
+
+
+		/* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */
+		_fmemcpy(value, lpszStart, MIN(lpsz - lpszStart + 1, MAXPGPATH));
+
+		mylog("aszKey='%s', value='%s'\n", aszKey, value);
+
+		/* Copy the appropriate value to the conninfo  */
+		copyAttributes(&lpsetupdlg->ci, aszKey, value);
+	}
+	return;
 }
 
 
 /* SetDSNAttributes --------------------------------------------------------
-  Description:  Write data source attributes to ODBC.INI
-  Input      :  hwnd - Parent window handle (plus globals)
-  Output     :  TRUE if successful, FALSE otherwise
+  Description:	Write data source attributes to ODBC.INI
+  Input		 :	hwnd - Parent window handle (plus globals)
+  Output	 :	TRUE if successful, FALSE otherwise
 --------------------------------------------------------------------------*/
 
-BOOL INTFUNC SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
+BOOL INTFUNC
+SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
 {
-LPCSTR  lpszDSN;                                                /* Pointer to data source name */
-    
-        lpszDSN = lpsetupdlg->ci.dsn;
+	LPCSTR		lpszDSN;		/* Pointer to data source name */
 
-        /* Validate arguments */
-        if (lpsetupdlg->fNewDSN && !*lpsetupdlg->ci.dsn)
-                return FALSE;
+	lpszDSN = lpsetupdlg->ci.dsn;
 
-        /* Write the data source name */
-        if (!SQLWriteDSNToIni(lpszDSN, lpsetupdlg->lpszDrvr))
-        {
-                if (hwndParent)
-                {
-                        char  szBuf[MAXPGPATH];
-                        char  szMsg[MAXPGPATH];
+	/* Validate arguments */
+	if (lpsetupdlg->fNewDSN && !*lpsetupdlg->ci.dsn)
+		return FALSE;
 
-                        LoadString(s_hModule, IDS_BADDSN, szBuf, sizeof(szBuf));
-                        wsprintf(szMsg, szBuf, lpszDSN);
-                        LoadString(s_hModule, IDS_MSGTITLE, szBuf, sizeof(szBuf));
-                        MessageBox(hwndParent, szMsg, szBuf, MB_ICONEXCLAMATION | MB_OK);
-                }
-                return FALSE;
-        }
+	/* Write the data source name */
+	if (!SQLWriteDSNToIni(lpszDSN, lpsetupdlg->lpszDrvr))
+	{
+		if (hwndParent)
+		{
+			char		szBuf[MAXPGPATH];
+			char		szMsg[MAXPGPATH];
+
+			LoadString(s_hModule, IDS_BADDSN, szBuf, sizeof(szBuf));
+			wsprintf(szMsg, szBuf, lpszDSN);
+			LoadString(s_hModule, IDS_MSGTITLE, szBuf, sizeof(szBuf));
+			MessageBox(hwndParent, szMsg, szBuf, MB_ICONEXCLAMATION | MB_OK);
+		}
+		return FALSE;
+	}
 
 
-        /* Update ODBC.INI */
-		writeDSNinfo(&lpsetupdlg->ci);
+	/* Update ODBC.INI */
+	writeDSNinfo(&lpsetupdlg->ci);
 
 
 	/* If the data source name has changed, remove the old name */
-        if (lstrcmpi(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn))
-        {
-                SQLRemoveDSNFromIni(lpsetupdlg->szDSN);
-        }
-        return TRUE;
+	if (lstrcmpi(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn))
+		SQLRemoveDSNFromIni(lpsetupdlg->szDSN);
+	return TRUE;
 }
diff --git a/src/interfaces/odbc/socket.c b/src/interfaces/odbc/socket.c
index 555f9bff4cc2d54040e55838306e9fa11289edf1..c4d0a1bec8874ffe7509e25b75e8a08c07f7c924 100644
--- a/src/interfaces/odbc/socket.c
+++ b/src/interfaces/odbc/socket.c
@@ -1,14 +1,14 @@
 
-/* Module:          socket.c
+/* Module:			socket.c
  *
- * Description:     This module contains functions for low level socket
- *                  operations (connecting/reading/writing to the backend)
+ * Description:		This module contains functions for low level socket
+ *					operations (connecting/reading/writing to the backend)
  *
- * Classes:         SocketClass (Functions prefix: "SOCK_")
+ * Classes:			SocketClass (Functions prefix: "SOCK_")
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -20,7 +20,7 @@
 
 #ifndef WIN32
 #include <stdlib.h>
-#include <string.h>	/* for memset */
+#include <string.h>				/* for memset */
 #endif
 
 extern GLOBAL_VALUES globals;
@@ -39,51 +39,53 @@ extern GLOBAL_VALUES globals;
 void
 SOCK_clear_error(SocketClass *self)
 {
-	self->errornumber = 0; 
-	self->errormsg = NULL; 
+	self->errornumber = 0;
+	self->errormsg = NULL;
 }
 
-SocketClass * 
+SocketClass *
 SOCK_Constructor()
 {
-SocketClass *rv;
+	SocketClass *rv;
 
-    rv = (SocketClass *) malloc(sizeof(SocketClass));
+	rv = (SocketClass *) malloc(sizeof(SocketClass));
 
-    if (rv != NULL) {
-		rv->socket = (SOCKETFD) -1;
+	if (rv != NULL)
+	{
+		rv->socket = (SOCKETFD) - 1;
 		rv->buffer_filled_in = 0;
 		rv->buffer_filled_out = 0;
 		rv->buffer_read_in = 0;
 
 		rv->buffer_in = (unsigned char *) malloc(globals.socket_buffersize);
-		if ( ! rv->buffer_in)
+		if (!rv->buffer_in)
 		{
 			free(rv);
 			return NULL;
 		}
 
 		rv->buffer_out = (unsigned char *) malloc(globals.socket_buffersize);
-		if ( ! rv->buffer_out)
+		if (!rv->buffer_out)
 		{
 			free(rv->buffer_in);
 			free(rv);
 			return NULL;
 		}
-		
-        rv->errormsg = NULL;
-        rv->errornumber = 0;
+
+		rv->errormsg = NULL;
+		rv->errornumber = 0;
 
 		rv->reverse = FALSE;
-    } 
-    return rv;
+	}
+	return rv;
 
 }
 
 void
 SOCK_Destructor(SocketClass *self)
 {
-	if (self->socket != -1) {
+	if (self->socket != -1)
+	{
 		SOCK_put_char(self, 'X');
 		SOCK_flush_output(self);
 		closesocket(self->socket);
@@ -100,28 +102,31 @@ SOCK_Destructor(SocketClass *self)
 }
 
 
-char 
+char
 SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname)
 {
-struct hostent *host;
-struct sockaddr_in sadr;
-unsigned long iaddr;
+	struct hostent *host;
+	struct sockaddr_in sadr;
+	unsigned long iaddr;
 
-	if (self->socket != -1) {
+	if (self->socket != -1)
+	{
 		self->errornumber = SOCKET_ALREADY_CONNECTED;
 		self->errormsg = "Socket is already connected";
 		return 0;
 	}
 
-	memset((char *)&sadr, 0, sizeof(sadr));
+	memset((char *) &sadr, 0, sizeof(sadr));
 
-	/*	If it is a valid IP address, use it.
-		Otherwise use hostname lookup. 
-	*/
+	/*
+	 * If it is a valid IP address, use it. Otherwise use hostname lookup.
+	 */
 	iaddr = inet_addr(hostname);
-	if (iaddr == INADDR_NONE) {
+	if (iaddr == INADDR_NONE)
+	{
 		host = gethostbyname(hostname);
-		if (host == NULL) {
+		if (host == NULL)
+		{
 			self->errornumber = SOCKET_HOST_NOT_FOUND;
 			self->errormsg = "Could not resolve hostname.";
 			return 0;
@@ -129,177 +134,187 @@ unsigned long iaddr;
 		memcpy(&(sadr.sin_addr), host->h_addr, host->h_length);
 	}
 	else
-		memcpy(&(sadr.sin_addr), (struct in_addr *) &iaddr, sizeof(iaddr));
+		memcpy(&(sadr.sin_addr), (struct in_addr *) & iaddr, sizeof(iaddr));
 
 	sadr.sin_family = AF_INET;
 	sadr.sin_port = htons(port);
 
 	self->socket = socket(AF_INET, SOCK_STREAM, 0);
-	if (self->socket == -1) {
+	if (self->socket == -1)
+	{
 		self->errornumber = SOCKET_COULD_NOT_CREATE_SOCKET;
 		self->errormsg = "Could not create Socket.";
 		return 0;
 	}
 
-	if ( connect(self->socket, (struct sockaddr *)&(sadr),
-			sizeof(sadr))  < 0) {
+	if (connect(self->socket, (struct sockaddr *) & (sadr),
+				sizeof(sadr)) < 0)
+	{
 
 		self->errornumber = SOCKET_COULD_NOT_CONNECT;
 		self->errormsg = "Could not connect to remote socket.";
 		closesocket(self->socket);
-		self->socket = (SOCKETFD) -1;
+		self->socket = (SOCKETFD) - 1;
 		return 0;
 	}
 	return 1;
 }
 
 
-void 
+void
 SOCK_get_n_char(SocketClass *self, char *buffer, int len)
 {
-int lf;
+	int			lf;
 
-	if ( ! buffer) {
+	if (!buffer)
+	{
 		self->errornumber = SOCKET_NULLPOINTER_PARAMETER;
 		self->errormsg = "get_n_char was called with NULL-Pointer";
 		return;
 	}
 
-	for(lf=0; lf < len; lf++)
+	for (lf = 0; lf < len; lf++)
 		buffer[lf] = SOCK_get_next_byte(self);
 }
 
 
-void 
+void
 SOCK_put_n_char(SocketClass *self, char *buffer, int len)
 {
-int lf;
+	int			lf;
 
-	if ( ! buffer) {
+	if (!buffer)
+	{
 		self->errornumber = SOCKET_NULLPOINTER_PARAMETER;
 		self->errormsg = "put_n_char was called with NULL-Pointer";
 		return;
 	}
 
-	for(lf=0; lf < len; lf++)
-		SOCK_put_next_byte(self, (unsigned char)buffer[lf]);
+	for (lf = 0; lf < len; lf++)
+		SOCK_put_next_byte(self, (unsigned char) buffer[lf]);
 }
 
 
-/*  bufsize must include room for the null terminator 
-	will read at most bufsize-1 characters + null. 
+/*	bufsize must include room for the null terminator
+	will read at most bufsize-1 characters + null.
 */
-void 
+void
 SOCK_get_string(SocketClass *self, char *buffer, int bufsize)
 {
-register int lf = 0;
+	register int lf = 0;
 
 	for (lf = 0; lf < bufsize; lf++)
-		if ( ! (buffer[lf] = SOCK_get_next_byte(self)))
+		if (!(buffer[lf] = SOCK_get_next_byte(self)))
 			return;
-		
-	buffer[bufsize-1] = '\0';
+
+	buffer[bufsize - 1] = '\0';
 }
 
 
-void 
+void
 SOCK_put_string(SocketClass *self, char *string)
 {
-register int lf;
-int len;
+	register int lf;
+	int			len;
 
-	len = strlen(string)+1;
+	len = strlen(string) + 1;
 
-	for(lf = 0; lf < len; lf++)
-		SOCK_put_next_byte(self, (unsigned char)string[lf]);
+	for (lf = 0; lf < len; lf++)
+		SOCK_put_next_byte(self, (unsigned char) string[lf]);
 }
 
 
-int 
+int
 SOCK_get_int(SocketClass *self, short len)
 {
-char buf[4];
-
-	switch (len) {
-	case 2:
-		SOCK_get_n_char(self, buf, len);
-		if (self->reverse)
-			return *((unsigned short *) buf);
-		else
-			return ntohs( *((unsigned short *) buf) );
-
-	case 4:
-		SOCK_get_n_char(self, buf, len);
-		if (self->reverse)
-			return *((unsigned int *) buf);
-		else
-			return ntohl( *((unsigned int *) buf) );
-
-	default:
-		self->errornumber = SOCKET_GET_INT_WRONG_LENGTH;
-		self->errormsg = "Cannot read ints of that length";
-		return 0;
+	char		buf[4];
+
+	switch (len)
+	{
+		case 2:
+			SOCK_get_n_char(self, buf, len);
+			if (self->reverse)
+				return *((unsigned short *) buf);
+			else
+				return ntohs(*((unsigned short *) buf));
+
+		case 4:
+			SOCK_get_n_char(self, buf, len);
+			if (self->reverse)
+				return *((unsigned int *) buf);
+			else
+				return ntohl(*((unsigned int *) buf));
+
+		default:
+			self->errornumber = SOCKET_GET_INT_WRONG_LENGTH;
+			self->errormsg = "Cannot read ints of that length";
+			return 0;
 	}
 }
 
 
-void 
+void
 SOCK_put_int(SocketClass *self, int value, short len)
 {
-unsigned int rv;
+	unsigned int rv;
 
-	switch (len) {
-	case 2:
-		rv = self->reverse ? value : htons( (unsigned short) value);
-		SOCK_put_n_char(self, (char *) &rv, 2);
-		return;
+	switch (len)
+	{
+		case 2:
+			rv = self->reverse ? value : htons((unsigned short) value);
+			SOCK_put_n_char(self, (char *) &rv, 2);
+			return;
 
-	case 4:
-		rv = self->reverse ? value : htonl( (unsigned int) value);
-		SOCK_put_n_char(self, (char *) &rv, 4);
-		return;
+		case 4:
+			rv = self->reverse ? value : htonl((unsigned int) value);
+			SOCK_put_n_char(self, (char *) &rv, 4);
+			return;
 
-	default:
-		self->errornumber = SOCKET_PUT_INT_WRONG_LENGTH;
-		self->errormsg = "Cannot write ints of that length";
-		return;
-	 }
+		default:
+			self->errornumber = SOCKET_PUT_INT_WRONG_LENGTH;
+			self->errormsg = "Cannot write ints of that length";
+			return;
+	}
 }
 
 
-void 
+void
 SOCK_flush_output(SocketClass *self)
 {
-int written;
+	int			written;
 
-	written = send(self->socket, (char *)self->buffer_out, self->buffer_filled_out, 0);
-	if (written != self->buffer_filled_out) {
+	written = send(self->socket, (char *) self->buffer_out, self->buffer_filled_out, 0);
+	if (written != self->buffer_filled_out)
+	{
 		self->errornumber = SOCKET_WRITE_ERROR;
 		self->errormsg = "Could not flush socket buffer.";
 	}
 	self->buffer_filled_out = 0;
 }
 
-unsigned char 
+unsigned char
 SOCK_get_next_byte(SocketClass *self)
 {
 
-	if (self->buffer_read_in >= self->buffer_filled_in) {
+	if (self->buffer_read_in >= self->buffer_filled_in)
+	{
 		/* there are no more bytes left in the buffer so */
-	  	/* reload the buffer */
+		/* reload the buffer */
 
 		self->buffer_read_in = 0;
-		self->buffer_filled_in = recv(self->socket, (char *)self->buffer_in, globals.socket_buffersize, 0);
+		self->buffer_filled_in = recv(self->socket, (char *) self->buffer_in, globals.socket_buffersize, 0);
 
 		mylog("read %d, global_socket_buffersize=%d\n", self->buffer_filled_in, globals.socket_buffersize);
 
-		if (self->buffer_filled_in < 0) {
+		if (self->buffer_filled_in < 0)
+		{
 			self->errornumber = SOCKET_READ_ERROR;
 			self->errormsg = "Error while reading from the socket.";
 			self->buffer_filled_in = 0;
 			return 0;
 		}
-		if (self->buffer_filled_in == 0) {
+		if (self->buffer_filled_in == 0)
+		{
 			self->errornumber = SOCKET_CLOSED;
 			self->errormsg = "Socket has been closed.";
 			self->buffer_filled_in = 0;
@@ -309,17 +324,19 @@ SOCK_get_next_byte(SocketClass *self)
 	return self->buffer_in[self->buffer_read_in++];
 }
 
-void 
+void
 SOCK_put_next_byte(SocketClass *self, unsigned char next_byte)
 {
-int bytes_sent;
+	int			bytes_sent;
 
 	self->buffer_out[self->buffer_filled_out++] = next_byte;
 
-	if (self->buffer_filled_out == globals.socket_buffersize) {
+	if (self->buffer_filled_out == globals.socket_buffersize)
+	{
 		/* buffer is full, so write it out */
-		bytes_sent = send(self->socket, (char *)self->buffer_out, globals.socket_buffersize, 0);
-		if (bytes_sent != globals.socket_buffersize) {
+		bytes_sent = send(self->socket, (char *) self->buffer_out, globals.socket_buffersize, 0);
+		if (bytes_sent != globals.socket_buffersize)
+		{
 			self->errornumber = SOCKET_WRITE_ERROR;
 			self->errormsg = "Error while writing to the socket.";
 		}
diff --git a/src/interfaces/odbc/socket.h b/src/interfaces/odbc/socket.h
index 0b4b9101d6fa483b19a54e6e80f0048e572fa102..48ef197ff2cd50077dde529a53248ee345b167f1 100644
--- a/src/interfaces/odbc/socket.h
+++ b/src/interfaces/odbc/socket.h
@@ -1,9 +1,9 @@
 
-/* File:            socket.h
+/* File:			socket.h
  *
- * Description:     See "socket.c"
+ * Description:		See "socket.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -25,10 +25,11 @@
 #define closesocket(xxx) close(xxx)
 #define SOCKETFD int
 
-#ifndef       INADDR_NONE
+#ifndef		  INADDR_NONE
 #ifndef _IN_ADDR_T
 #define _IN_ADDR_T
-typedef unsigned int    in_addr_t;
+typedef unsigned int in_addr_t;
+
 #endif
 #define INADDR_NONE ((in_addr_t)-1)
 #endif
@@ -52,20 +53,22 @@ typedef unsigned int    in_addr_t;
 #define SOCKET_CLOSED 10
 
 
-struct SocketClass_ {
+struct SocketClass_
+{
 
-	int buffer_filled_in;
-	int buffer_filled_out;
-	int buffer_read_in;
+	int			buffer_filled_in;
+	int			buffer_filled_out;
+	int			buffer_read_in;
 	unsigned char *buffer_in;
 	unsigned char *buffer_out;
 
-	SOCKETFD socket;
+	SOCKETFD	socket;
 
-	char *errormsg;
-	int errornumber;
+	char	   *errormsg;
+	int			errornumber;
 
-	char reverse;	/* used to handle Postgres 6.2 protocol (reverse byte order) */
+	char		reverse;		/* used to handle Postgres 6.2 protocol
+								 * (reverse byte order) */
 
 };
 
@@ -80,17 +83,17 @@ struct SocketClass_ {
 
 /* Socket prototypes */
 SocketClass *SOCK_Constructor(void);
-void SOCK_Destructor(SocketClass *self);
-char SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname);
-void SOCK_get_n_char(SocketClass *self, char *buffer, int len);
-void SOCK_put_n_char(SocketClass *self, char *buffer, int len);
-void SOCK_get_string(SocketClass *self, char *buffer, int bufsize);
-void SOCK_put_string(SocketClass *self, char *string);
-int SOCK_get_int(SocketClass *self, short len);
-void SOCK_put_int(SocketClass *self, int value, short len);
-void SOCK_flush_output(SocketClass *self);
+void		SOCK_Destructor(SocketClass *self);
+char		SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname);
+void		SOCK_get_n_char(SocketClass *self, char *buffer, int len);
+void		SOCK_put_n_char(SocketClass *self, char *buffer, int len);
+void		SOCK_get_string(SocketClass *self, char *buffer, int bufsize);
+void		SOCK_put_string(SocketClass *self, char *string);
+int			SOCK_get_int(SocketClass *self, short len);
+void		SOCK_put_int(SocketClass *self, int value, short len);
+void		SOCK_flush_output(SocketClass *self);
 unsigned char SOCK_get_next_byte(SocketClass *self);
-void SOCK_put_next_byte(SocketClass *self, unsigned char next_byte);
-void SOCK_clear_error(SocketClass *self);
+void		SOCK_put_next_byte(SocketClass *self, unsigned char next_byte);
+void		SOCK_clear_error(SocketClass *self);
 
 #endif
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c
index 6c0d8552176b97889ea5d2aa79cc32256dee06b8..aadcad2e67565dcac050cfc82e46c0e582645db5 100644
--- a/src/interfaces/odbc/statement.c
+++ b/src/interfaces/odbc/statement.c
@@ -1,14 +1,14 @@
 
-/* Module:          statement.c
+/* Module:			statement.c
  *
- * Description:     This module contains functions related to creating
- *                  and manipulating a statement.
+ * Description:		This module contains functions related to creating
+ *					and manipulating a statement.
  *
- * Classes:         StatementClass (Functions prefix: "SC_")
+ * Classes:			StatementClass (Functions prefix: "SC_")
  *
- * API functions:   SQLAllocStmt, SQLFreeStmt
+ * API functions:	SQLAllocStmt, SQLFreeStmt
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -39,40 +39,65 @@ extern GLOBAL_VALUES globals;
 
 #ifndef WIN32
 #ifndef HAVE_STRICMP
-#define stricmp(s1,s2) 		strcasecmp(s1,s2)
+#define stricmp(s1,s2)		strcasecmp(s1,s2)
 #define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
 #endif
 #endif
 #define PRN_NULLCHECK
 
 /*	Map sql commands to statement types */
-static struct {
-	int  type;
-	char *s;
-} Statement_Type[] = {
-	{ STMT_TYPE_SELECT, "SELECT" },
-	{ STMT_TYPE_INSERT, "INSERT" },
-	{ STMT_TYPE_UPDATE, "UPDATE" },
-	{ STMT_TYPE_DELETE, "DELETE" },
-	{ STMT_TYPE_CREATE, "CREATE" },
-	{ STMT_TYPE_ALTER,  "ALTER"  },
-	{ STMT_TYPE_DROP,   "DROP"   },
-	{ STMT_TYPE_GRANT,  "GRANT"  },
-	{ STMT_TYPE_REVOKE, "REVOKE" },
-	{      0,            NULL    }
+static struct
+{
+	int			type;
+	char	   *s;
+}			Statement_Type[] =
+
+{
+	{
+		STMT_TYPE_SELECT, "SELECT"
+	},
+	{
+		STMT_TYPE_INSERT, "INSERT"
+	},
+	{
+		STMT_TYPE_UPDATE, "UPDATE"
+	},
+	{
+		STMT_TYPE_DELETE, "DELETE"
+	},
+	{
+		STMT_TYPE_CREATE, "CREATE"
+	},
+	{
+		STMT_TYPE_ALTER, "ALTER"
+	},
+	{
+		STMT_TYPE_DROP, "DROP"
+	},
+	{
+		STMT_TYPE_GRANT, "GRANT"
+	},
+	{
+		STMT_TYPE_REVOKE, "REVOKE"
+	},
+	{
+		0, NULL
+	}
 };
 
 
-RETCODE SQL_API SQLAllocStmt(HDBC      hdbc,
-			     HSTMT FAR *phstmt)
+RETCODE SQL_API
+SQLAllocStmt(HDBC hdbc,
+			 HSTMT FAR *phstmt)
 {
-static char *func="SQLAllocStmt";
-ConnectionClass *conn = (ConnectionClass *) hdbc;
-StatementClass *stmt;
+	static char *func = "SQLAllocStmt";
+	ConnectionClass *conn = (ConnectionClass *) hdbc;
+	StatementClass *stmt;
 
 	mylog("%s: entering...\n", func);
 
-	if( ! conn) {
+	if (!conn)
+	{
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -81,7 +106,8 @@ StatementClass *stmt;
 
 	mylog("**** SQLAllocStmt: hdbc = %u, stmt = %u\n", hdbc, stmt);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		conn->errornumber = CONN_STMT_ALLOC_ERROR;
 		conn->errormsg = "No more memory to allocate a further SQL-statement";
 		*phstmt = SQL_NULL_HSTMT;
@@ -89,56 +115,65 @@ StatementClass *stmt;
 		return SQL_ERROR;
 	}
 
-    if ( ! CC_add_statement(conn, stmt)) {
-	conn->errormsg = "Maximum number of connections exceeded.";
-	conn->errornumber = CONN_STMT_ALLOC_ERROR;
+	if (!CC_add_statement(conn, stmt))
+	{
+		conn->errormsg = "Maximum number of connections exceeded.";
+		conn->errornumber = CONN_STMT_ALLOC_ERROR;
 		CC_log_error(func, "", conn);
-	SC_Destructor(stmt);
+		SC_Destructor(stmt);
 		*phstmt = SQL_NULL_HSTMT;
-	return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
 	*phstmt = (HSTMT) stmt;
 
-	/*	Copy default statement options based from Connection options
-	*/
+	/*
+	 * Copy default statement options based from Connection options
+	 */
 	stmt->options = conn->stmtOptions;
 
 
-	/*	Save the handle for later */
+	/* Save the handle for later */
 	stmt->phstmt = phstmt;
 
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
 
-RETCODE SQL_API SQLFreeStmt(HSTMT     hstmt,
-			    UWORD     fOption)
+RETCODE SQL_API
+SQLFreeStmt(HSTMT hstmt,
+			UWORD fOption)
 {
-static char *func="SQLFreeStmt";
-StatementClass *stmt = (StatementClass *) hstmt;
+	static char *func = "SQLFreeStmt";
+	StatementClass *stmt = (StatementClass *) hstmt;
 
 	mylog("%s: entering...hstmt=%u, fOption=%d\n", func, hstmt, fOption);
 
-	if ( ! stmt) {
+	if (!stmt)
+	{
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (fOption == SQL_DROP) {
+	if (fOption == SQL_DROP)
+	{
 		ConnectionClass *conn = stmt->hdbc;
 
 		/* Remove the statement from the connection's statement list */
-		if ( conn) {
-			if ( ! CC_remove_statement(conn, stmt)) {
+		if (conn)
+		{
+			if (!CC_remove_statement(conn, stmt))
+			{
 				stmt->errornumber = STMT_SEQUENCE_ERROR;
 				stmt->errormsg = "Statement is currently executing a transaction.";
 				SC_log_error(func, "", stmt);
-				return SQL_ERROR;  /* stmt may be executing a transaction */
+				return SQL_ERROR;		/* stmt may be executing a
+										 * transaction */
 			}
 
-			/*	Free any cursors and discard any result info */
-			if (stmt->result) {
+			/* Free any cursors and discard any result info */
+			if (stmt->result)
+			{
 				QR_Destructor(stmt->result);
 				stmt->result = NULL;
 			}
@@ -147,29 +182,38 @@ StatementClass *stmt = (StatementClass *) hstmt;
 		/* Destroy the statement and free any results, cursors, etc. */
 		SC_Destructor(stmt);
 
-    } else if (fOption == SQL_UNBIND) {
+	}
+	else if (fOption == SQL_UNBIND)
+	{
 		SC_unbind_cols(stmt);
 
-    } else if (fOption == SQL_CLOSE) {
+	}
+	else if (fOption == SQL_CLOSE)
+	{
 		/* this should discard all the results, but leave the statement */
 		/* itself in place (it can be executed again) */
-	if (!SC_recycle_statement(stmt)) {
-		/*	errormsg passed in above */
+		if (!SC_recycle_statement(stmt))
+		{
+			/* errormsg passed in above */
 			SC_log_error(func, "", stmt);
-	    return SQL_ERROR;
+			return SQL_ERROR;
 		}
 
-    } else if(fOption == SQL_RESET_PARAMS) {
+	}
+	else if (fOption == SQL_RESET_PARAMS)
+	{
 		SC_free_params(stmt, STMT_FREE_PARAMS_ALL);
 
-    } else {
-	stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
-	stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
+	}
+	else
+	{
+		stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
+		stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
 		SC_log_error(func, "", stmt);
-	return SQL_ERROR;
-    }
+		return SQL_ERROR;
+	}
 
-    return SQL_SUCCESS;
+	return SQL_SUCCESS;
 }
 
 
@@ -194,11 +238,12 @@ InitializeStatementOptions(StatementOptions *opt)
 StatementClass *
 SC_Constructor(void)
 {
-StatementClass *rv;
+	StatementClass *rv;
 
 	rv = (StatementClass *) malloc(sizeof(StatementClass));
-	if (rv) {
-		rv->hdbc = NULL;       /* no connection associated yet */
+	if (rv)
+	{
+		rv->hdbc = NULL;		/* no connection associated yet */
 		rv->phstmt = NULL;
 		rv->result = NULL;
 		rv->manual_result = FALSE;
@@ -237,7 +282,7 @@ StatementClass *rv;
 		rv->lobj_fd = -1;
 		rv->cursor_name[0] = '\0';
 
-		/*	Parse Stuff */
+		/* Parse Stuff */
 		rv->ti = NULL;
 		rv->fi = NULL;
 		rv->ntab = 0;
@@ -245,7 +290,7 @@ StatementClass *rv;
 		rv->parse_status = STMT_PARSE_NONE;
 
 
-		/*  Clear Statement Options -- defaults will be set in AllocStmt */
+		/* Clear Statement Options -- defaults will be set in AllocStmt */
 		memset(&rv->options, 0, sizeof(StatementOptions));
 	}
 	return rv;
@@ -256,15 +301,17 @@ SC_Destructor(StatementClass *self)
 {
 
 	mylog("SC_Destructor: self=%u, self->result=%u, self->hdbc=%u\n", self, self->result, self->hdbc);
-	if (STMT_EXECUTING == self->status) {
+	if (STMT_EXECUTING == self->status)
+	{
 		self->errornumber = STMT_SEQUENCE_ERROR;
 		self->errormsg = "Statement is currently executing a transaction.";
 		return FALSE;
 	}
 
-	if (self->result) {
-		if ( ! self->hdbc)
-			self->result->conn = NULL;  /* prevent any dbase activity */
+	if (self->result)
+	{
+		if (!self->hdbc)
+			self->result->conn = NULL;	/* prevent any dbase activity */
 
 		QR_Destructor(self->result);
 	}
@@ -274,29 +321,38 @@ SC_Destructor(StatementClass *self)
 
 	SC_free_params(self, STMT_FREE_PARAMS_ALL);
 
-	/* the memory pointed to by the bindings is not deallocated by the driver */
-	/* by by the application that uses that driver, so we don't have to care  */
+	/*
+	 * the memory pointed to by the bindings is not deallocated by the
+	 * driver
+	 */
+
+	/*
+	 * by by the application that uses that driver, so we don't have to
+	 * care
+	 */
 	/* about that here. */
 	if (self->bindings)
 		free(self->bindings);
 
 
-	/*	Free the parsed table information */
-	if (self->ti) {
-		int i;
-		for (i = 0; i < self->ntab; i++) {
+	/* Free the parsed table information */
+	if (self->ti)
+	{
+		int			i;
+
+		for (i = 0; i < self->ntab; i++)
 			free(self->ti[i]);
-		}
 
 		free(self->ti);
 	}
 
-	/*	Free the parsed field information */
-	if (self->fi) {
-		int i;
-		for (i = 0; i < self->nfld; i++) {
+	/* Free the parsed field information */
+	if (self->fi)
+	{
+		int			i;
+
+		for (i = 0; i < self->nfld; i++)
 			free(self->fi[i]);
-		}
 		free(self->fi);
 	}
 
@@ -314,22 +370,26 @@ SC_Destructor(StatementClass *self)
 void
 SC_free_params(StatementClass *self, char option)
 {
-int i;
+	int			i;
 
 	mylog("SC_free_params:  ENTER, self=%d\n", self);
 
-	if( ! self->parameters)
+	if (!self->parameters)
 		return;
 
-	for (i = 0; i < self->parameters_allocated; i++) {
-		if (self->parameters[i].data_at_exec == TRUE) {
+	for (i = 0; i < self->parameters_allocated; i++)
+	{
+		if (self->parameters[i].data_at_exec == TRUE)
+		{
 
-			if (self->parameters[i].EXEC_used) {
+			if (self->parameters[i].EXEC_used)
+			{
 				free(self->parameters[i].EXEC_used);
 				self->parameters[i].EXEC_used = NULL;
 			}
 
-			if (self->parameters[i].EXEC_buffer) {
+			if (self->parameters[i].EXEC_buffer)
+			{
 				if (self->parameters[i].SQLType != SQL_LONGVARBINARY)
 					free(self->parameters[i].EXEC_buffer);
 				self->parameters[i].EXEC_buffer = NULL;
@@ -340,7 +400,8 @@ int i;
 	self->current_exec_param = -1;
 	self->put_data = FALSE;
 
-	if (option == STMT_FREE_PARAMS_ALL) {
+	if (option == STMT_FREE_PARAMS_ALL)
+	{
 		free(self->parameters);
 		self->parameters = NULL;
 		self->parameters_allocated = 0;
@@ -353,14 +414,14 @@ int i;
 int
 statement_type(char *statement)
 {
-int i;
+	int			i;
 
 	/* ignore leading whitespace in query string */
 	while (*statement && isspace((unsigned char) *statement))
 		statement++;
 
 	for (i = 0; Statement_Type[i].s; i++)
-		if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
+		if (!strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
 			return Statement_Type[i].type;
 
 	return STMT_TYPE_OTHER;
@@ -374,12 +435,13 @@ int i;
 char
 SC_recycle_statement(StatementClass *self)
 {
-ConnectionClass *conn;
+	ConnectionClass *conn;
 
-mylog("recycle statement: self= %u\n", self);
+	mylog("recycle statement: self= %u\n", self);
 
-	/*	This would not happen */
-	if (self->status == STMT_EXECUTING) {
+	/* This would not happen */
+	if (self->status == STMT_EXECUTING)
+	{
 		self->errornumber = STMT_SEQUENCE_ERROR;
 		self->errormsg = "Statement is currently executing a transaction.";
 		return FALSE;
@@ -389,72 +451,81 @@ mylog("recycle statement: self= %u\n", self);
 	self->errornumber = 0;
 	self->errormsg_created = FALSE;
 
-	switch (self->status) {
-	case STMT_ALLOCATED:
-		/* this statement does not need to be recycled */
-		return TRUE;
+	switch (self->status)
+	{
+		case STMT_ALLOCATED:
+			/* this statement does not need to be recycled */
+			return TRUE;
 
-	case STMT_READY:
-		break;
+		case STMT_READY:
+			break;
 
-	case STMT_PREMATURE:
-		/*	Premature execution of the statement might have caused the start of a transaction.
-			If so, we have to rollback that transaction.
-		*/
-		conn = SC_get_conn(self);
-		if ( ! CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) {
+		case STMT_PREMATURE:
 
-			QResultClass *res = CC_send_query(conn, "ABORT", NULL);
-			QR_Destructor(res);
-			CC_set_no_trans(conn);
-		}
-		break;
+			/*
+			 * Premature execution of the statement might have caused the
+			 * start of a transaction. If so, we have to rollback that
+			 * transaction.
+			 */
+			conn = SC_get_conn(self);
+			if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
+			{
 
-	case STMT_FINISHED:
-		break;
+				QResultClass *res = CC_send_query(conn, "ABORT", NULL);
 
-	default:
-		self->errormsg = "An internal error occured while recycling statements";
-		self->errornumber = STMT_INTERNAL_ERROR;
-		return FALSE;
+				QR_Destructor(res);
+				CC_set_no_trans(conn);
+			}
+			break;
+
+		case STMT_FINISHED:
+			break;
+
+		default:
+			self->errormsg = "An internal error occured while recycling statements";
+			self->errornumber = STMT_INTERNAL_ERROR;
+			return FALSE;
 	}
 
-	/*	Free the parsed table information */
-	if (self->ti) {
-		int i;
-		for (i = 0; i < self->ntab; i++) {
+	/* Free the parsed table information */
+	if (self->ti)
+	{
+		int			i;
+
+		for (i = 0; i < self->ntab; i++)
 			free(self->ti[i]);
-		}
 
 		free(self->ti);
 		self->ti = NULL;
 		self->ntab = 0;
 	}
 
-	/*	Free the parsed field information */
-	if (self->fi) {
-		int i;
-		for (i = 0; i < self->nfld; i++) {
+	/* Free the parsed field information */
+	if (self->fi)
+	{
+		int			i;
+
+		for (i = 0; i < self->nfld; i++)
 			free(self->fi[i]);
-		}
 		free(self->fi);
 		self->fi = NULL;
 		self->nfld = 0;
 	}
 	self->parse_status = STMT_PARSE_NONE;
 
-	/*	Free any cursors */
-	if (self->result) {
+	/* Free any cursors */
+	if (self->result)
+	{
 		QR_Destructor(self->result);
 		self->result = NULL;
 	}
 
 	/****************************************************************/
-	/*	Reset only parameters that have anything to do with results */
+	/* Reset only parameters that have anything to do with results */
 	/****************************************************************/
 
 	self->status = STMT_READY;
-	self->manual_result = FALSE;	/* very important */
+	self->manual_result = FALSE;/* very important */
 
 	self->currTuple = -1;
 	self->rowset_start = -1;
@@ -468,9 +539,9 @@ mylog("recycle statement: self= %u\n", self);
 
 	self->lobj_fd = -1;
 
-	/*	Free any data at exec params before the statement is executed */
-	/*	again.  If not, then there will be a memory leak when */
-	/*	the next SQLParamData/SQLPutData is called. */
+	/* Free any data at exec params before the statement is executed */
+	/* again.  If not, then there will be a memory leak when */
+	/* the next SQLParamData/SQLPutData is called. */
 	SC_free_params(self, STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY);
 
 	return TRUE;
@@ -483,12 +554,14 @@ SC_pre_execute(StatementClass *self)
 
 	mylog("SC_pre_execute: status = %d\n", self->status);
 
-	if (self->status == STMT_READY) {
+	if (self->status == STMT_READY)
+	{
 		mylog("              preprocess: status = READY\n");
 
 		SQLExecute(self);
 
-		if (self->status == STMT_FINISHED) {
+		if (self->status == STMT_FINISHED)
+		{
 			mylog("              preprocess: after status = FINISHED, so set PREMATURE\n");
 			self->status = STMT_PREMATURE;
 		}
@@ -499,9 +572,10 @@ SC_pre_execute(StatementClass *self)
 char
 SC_unbind_cols(StatementClass *self)
 {
-Int2 lf;
+	Int2		lf;
 
-	for(lf = 0; lf < self->bindings_allocated; lf++) {
+	for (lf = 0; lf < self->bindings_allocated; lf++)
+	{
 		self->bindings[lf].data_left = -1;
 		self->bindings[lf].buflen = 0;
 		self->bindings[lf].buffer = NULL;
@@ -512,7 +586,7 @@ Int2 lf;
 	self->bookmark.buffer = NULL;
 	self->bookmark.used = NULL;
 
-    return 1;
+	return 1;
 }
 
 void
@@ -529,10 +603,10 @@ SC_clear_error(StatementClass *self)
 char *
 SC_create_errormsg(StatementClass *self)
 {
-QResultClass *res = self->result;
-ConnectionClass *conn = self->hdbc;
-int pos;
-static char msg[4096];
+	QResultClass *res = self->result;
+	ConnectionClass *conn = self->hdbc;
+	int			pos;
+	static char msg[4096];
 
 	msg[0] = '\0';
 
@@ -542,15 +616,18 @@ static char msg[4096];
 	else if (self->errormsg)
 		strcpy(msg, self->errormsg);
 
-	if (conn) {
+	if (conn)
+	{
 		SocketClass *sock = conn->sock;
 
-		if (conn->errormsg && conn->errormsg[0] != '\0') {
+		if (conn->errormsg && conn->errormsg[0] != '\0')
+		{
 			pos = strlen(msg);
 			sprintf(&msg[pos], ";\n%s", conn->errormsg);
 		}
 
-		if (sock && sock->errormsg && sock->errormsg[0] != '\0') {
+		if (sock && sock->errormsg && sock->errormsg[0] != '\0')
+		{
 			pos = strlen(msg);
 			sprintf(&msg[pos], ";\n%s", sock->errormsg);
 		}
@@ -562,15 +639,17 @@ static char msg[4096];
 char
 SC_get_error(StatementClass *self, int *number, char **message)
 {
-char rv;
+	char		rv;
 
 /*	Create a very informative errormsg if it hasn't been done yet. */
-	if ( ! self->errormsg_created) {
+	if (!self->errormsg_created)
+	{
 		self->errormsg = SC_create_errormsg(self);
 		self->errormsg_created = TRUE;
 	}
 
-	if ( self->errornumber) {
+	if (self->errornumber)
+	{
 		*number = self->errornumber;
 		*message = self->errormsg;
 		self->errormsg = NULL;
@@ -595,28 +674,34 @@ SC_get_bookmark(StatementClass *self)
 RETCODE
 SC_fetch(StatementClass *self)
 {
-static char *func = "SC_fetch";
-QResultClass *res = self->result;
-int retval, result;
-Int2 num_cols, lf;
-Oid type;
-char *value;
-ColumnInfoClass *ci;
+	static char *func = "SC_fetch";
+	QResultClass *res = self->result;
+	int			retval,
+				result;
+	Int2		num_cols,
+				lf;
+	Oid			type;
+	char	   *value;
+	ColumnInfoClass *ci;
+
 /* TupleField *tupleField; */
 
 	self->last_fetch_count = 0;
-	ci = QR_get_fields(res);		/* the column info */
+	ci = QR_get_fields(res);	/* the column info */
 
 	mylog("manual_result = %d, use_declarefetch = %d\n", self->manual_result, globals.use_declarefetch);
 
-	if ( self->manual_result || ! globals.use_declarefetch) {
+	if (self->manual_result || !globals.use_declarefetch)
+	{
 
-		if (self->currTuple >= QR_get_num_tuples(res) -1 ||
-			(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1)) {
+		if (self->currTuple >= QR_get_num_tuples(res) - 1 ||
+			(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1))
+		{
 
-			/*	if at the end of the tuples, return "no data found"
-				and set the cursor past the end of the result set
-			*/
+			/*
+			 * if at the end of the tuples, return "no data found" and set
+			 * the cursor past the end of the result set
+			 */
 			self->currTuple = QR_get_num_tuples(res);
 			return SQL_NO_DATA_FOUND;
 		}
@@ -624,18 +709,21 @@ ColumnInfoClass *ci;
 		mylog("**** SQLFetch: manual_result\n");
 		(self->currTuple)++;
 	}
-	else {
+	else
+	{
 
 		/* read from the cache or the physical next tuple */
 		retval = QR_next_tuple(res);
-		if (retval < 0) {
+		if (retval < 0)
+		{
 			mylog("**** SQLFetch: end_tuples\n");
 			return SQL_NO_DATA_FOUND;
 		}
 		else if (retval > 0)
-			(self->currTuple)++;		/* all is well */
+			(self->currTuple)++;/* all is well */
 
-		else {
+		else
+		{
 			mylog("SQLFetch: error\n");
 			self->errornumber = STMT_EXEC_ERROR;
 			self->errormsg = "Error fetching next row";
@@ -649,89 +737,95 @@ ColumnInfoClass *ci;
 	result = SQL_SUCCESS;
 	self->last_fetch_count = 1;
 
-	/*	If the bookmark column was bound then return a bookmark.
-		Since this is used with SQLExtendedFetch, and the rowset size
-		may be greater than 1, and an application can use row or column wise
-		binding, use the code in copy_and_convert_field() to handle that.
-	*/
-	if (self->bookmark.buffer) {
-		char buf[32];
+	/*
+	 * If the bookmark column was bound then return a bookmark. Since this
+	 * is used with SQLExtendedFetch, and the rowset size may be greater
+	 * than 1, and an application can use row or column wise binding, use
+	 * the code in copy_and_convert_field() to handle that.
+	 */
+	if (self->bookmark.buffer)
+	{
+		char		buf[32];
 
 		sprintf(buf, "%ld", SC_get_bookmark(self));
 		result = copy_and_convert_field(self, 0, buf,
-								SQL_C_ULONG, self->bookmark.buffer, 0, self->bookmark.used);
+			 SQL_C_ULONG, self->bookmark.buffer, 0, self->bookmark.used);
 	}
 
-	for (lf=0; lf < num_cols; lf++) {
+	for (lf = 0; lf < num_cols; lf++)
+	{
 
 		mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer);
 
-		/*	reset for SQLGetData */
+		/* reset for SQLGetData */
 		self->bindings[lf].data_left = -1;
 
-		if (self->bindings[lf].buffer != NULL) {
+		if (self->bindings[lf].buffer != NULL)
+		{
 			/* this column has a binding */
 
 			/* type = QR_get_field_type(res, lf); */
-			type = CI_get_oid(ci, lf);		/* speed things up */
+			type = CI_get_oid(ci, lf);	/* speed things up */
 
 			mylog("type = %d\n", type);
 
-			if (self->manual_result) {
+			if (self->manual_result)
+			{
 				value = QR_get_value_manual(res, self->currTuple, lf);
 				mylog("manual_result\n");
 			}
 			else if (globals.use_declarefetch)
 				value = QR_get_value_backend(res, lf);
-			else {
+			else
 				value = QR_get_value_backend_row(res, self->currTuple, lf);
-			}
 
-			mylog("value = '%s'\n",  (value==NULL)?"<NULL>":value);
+			mylog("value = '%s'\n", (value == NULL) ? "<NULL>" : value);
 
 			retval = copy_and_convert_field_bindinfo(self, type, value, lf);
 
 			mylog("copy_and_convert: retval = %d\n", retval);
 
-			switch(retval) {
-			case COPY_OK:
-				break;	/*	OK, do next bound column */
-
-			case COPY_UNSUPPORTED_TYPE:
-				self->errormsg = "Received an unsupported type from Postgres.";
-				self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-				SC_log_error(func, "", self);
-				result = SQL_ERROR;
-				break;
-
-			case COPY_UNSUPPORTED_CONVERSION:
-				self->errormsg = "Couldn't handle the necessary data type conversion.";
-				self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-				SC_log_error(func, "", self);
-				result = SQL_ERROR;
-				break;
-
-			case COPY_RESULT_TRUNCATED:
-				self->errornumber = STMT_TRUNCATED;
-				self->errormsg = "The buffer was too small for the result.";
-				result = SQL_SUCCESS_WITH_INFO;
-				break;
-
-			case COPY_GENERAL_ERROR:	/* error msg already filled in */
-				SC_log_error(func, "", self);
-				result = SQL_ERROR;
-				break;
-
-			/*  This would not be meaningful in SQLFetch. */
-			case COPY_NO_DATA_FOUND:
-				break;
-
-			default:
-				self->errormsg = "Unrecognized return value from copy_and_convert_field.";
-				self->errornumber = STMT_INTERNAL_ERROR;
-				SC_log_error(func, "", self);
-				result = SQL_ERROR;
-				break;
+			switch (retval)
+			{
+				case COPY_OK:
+					break;		/* OK, do next bound column */
+
+				case COPY_UNSUPPORTED_TYPE:
+					self->errormsg = "Received an unsupported type from Postgres.";
+					self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+					SC_log_error(func, "", self);
+					result = SQL_ERROR;
+					break;
+
+				case COPY_UNSUPPORTED_CONVERSION:
+					self->errormsg = "Couldn't handle the necessary data type conversion.";
+					self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+					SC_log_error(func, "", self);
+					result = SQL_ERROR;
+					break;
+
+				case COPY_RESULT_TRUNCATED:
+					self->errornumber = STMT_TRUNCATED;
+					self->errormsg = "The buffer was too small for the result.";
+					result = SQL_SUCCESS_WITH_INFO;
+					break;
+
+				case COPY_GENERAL_ERROR:		/* error msg already
+												 * filled in */
+					SC_log_error(func, "", self);
+					result = SQL_ERROR;
+					break;
+
+					/* This would not be meaningful in SQLFetch. */
+				case COPY_NO_DATA_FOUND:
+					break;
+
+				default:
+					self->errormsg = "Unrecognized return value from copy_and_convert_field.";
+					self->errornumber = STMT_INTERNAL_ERROR;
+					SC_log_error(func, "", self);
+					result = SQL_ERROR;
+					break;
 			}
 		}
 	}
@@ -740,19 +834,24 @@ ColumnInfoClass *ci;
 }
 
 
-RETCODE SC_execute(StatementClass *self)
+RETCODE
+SC_execute(StatementClass *self)
 {
-static char *func="SC_execute";
-ConnectionClass *conn;
-QResultClass *res;
-char ok, was_ok, was_nonfatal;
-Int2 oldstatus, numcols;
-QueryInfo qi;
+	static char *func = "SC_execute";
+	ConnectionClass *conn;
+	QResultClass *res;
+	char		ok,
+				was_ok,
+				was_nonfatal;
+	Int2		oldstatus,
+				numcols;
+	QueryInfo	qi;
 
 
 	conn = SC_get_conn(self);
 
-	/*	Begin a transaction if one is not already in progress */
+	/* Begin a transaction if one is not already in progress */
+
 	/*
 	 * Basically we don't have to begin a transaction in autocommit mode
 	 * because Postgres backend runs in autocomit mode. We issue "BEGIN"
@@ -766,7 +865,8 @@ QueryInfo qi;
 	{
 		mylog("   about to begin a transaction on statement = %u\n", self);
 		res = CC_send_query(conn, "BEGIN", NULL);
-		if (QR_aborted(res)) {
+		if (QR_aborted(res))
+		{
 			self->errormsg = "Could not begin a transaction";
 			self->errornumber = STMT_EXEC_ERROR;
 			SC_log_error(func, "", self);
@@ -779,7 +879,8 @@ QueryInfo qi;
 
 		QR_Destructor(res);
 
-		if (!ok) {
+		if (!ok)
+		{
 			self->errormsg = "Could not begin a transaction";
 			self->errornumber = STMT_EXEC_ERROR;
 			SC_log_error(func, "", self);
@@ -796,38 +897,49 @@ QueryInfo qi;
 	self->status = STMT_EXECUTING;
 
 
-	/*	If it's a SELECT statement, use a cursor. */
-	/*	Note that the declare cursor has already been prepended to the statement */
-	/*	in copy_statement... */
-	if (self->statement_type == STMT_TYPE_SELECT) {
+	/* If it's a SELECT statement, use a cursor. */
+
+	/*
+	 * Note that the declare cursor has already been prepended to the
+	 * statement
+	 */
+	/* in copy_statement... */
+	if (self->statement_type == STMT_TYPE_SELECT)
+	{
 
-		char fetch[128];
+		char		fetch[128];
 
 		mylog("       Sending SELECT statement on stmt=%u, cursor_name='%s'\n", self, self->cursor_name);
 
 
-		/*	send the declare/select */
+		/* send the declare/select */
 		self->result = CC_send_query(conn, self->stmt_with_params, NULL);
 
 		if (globals.use_declarefetch && self->result != NULL &&
-			QR_command_successful(self->result)) {
+			QR_command_successful(self->result))
+		{
 
 			QR_Destructor(self->result);
 
-			/*	That worked, so now send the fetch to start getting data back */
+			/*
+			 * That worked, so now send the fetch to start getting data
+			 * back
+			 */
 			qi.result_in = NULL;
 			qi.cursor = self->cursor_name;
 			qi.row_size = globals.fetch_max;
 
-			/*	Most likely the rowset size will not be set by the application until
-				after the statement	is executed, so might as well use the cache size.
-				The qr_next_tuple() function will correct for any discrepancies in
-				sizes and adjust the cache accordingly.
-			*/
+			/*
+			 * Most likely the rowset size will not be set by the
+			 * application until after the statement is executed, so might
+			 * as well use the cache size. The qr_next_tuple() function
+			 * will correct for any discrepancies in sizes and adjust the
+			 * cache accordingly.
+			 */
 
 			sprintf(fetch, "fetch %d in %s", qi.row_size, self->cursor_name);
 
-			self->result = CC_send_query( conn, fetch, &qi);
+			self->result = CC_send_query(conn, fetch, &qi);
 		}
 
 		mylog("     done sending the query:\n");
@@ -835,41 +947,47 @@ QueryInfo qi;
 
 
 	}
-	else  { /* not a SELECT statement so don't use a cursor */
+	else
+	{							/* not a SELECT statement so don't use a
+								 * cursor */
 		mylog("      it's NOT a select statement: stmt=%u\n", self);
 		self->result = CC_send_query(conn, self->stmt_with_params, NULL);
 
-		/*	We shouldn't send COMMIT. Postgres backend does the
-			autocommit if neccessary. (Zoltan, 04/26/2000)
-		*/
-		/*	Above seems wrong.
-			Even in case of autocommit, started transactions
-			must be committed. (Hiroshi, 02/11/2001)
-		 */ 
-		if ( ! self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
-		 {                   
-			res = CC_send_query(conn, "COMMIT", NULL); 
+		/*
+		 * We shouldn't send COMMIT. Postgres backend does the autocommit
+		 * if neccessary. (Zoltan, 04/26/2000)
+		 */
+
+		/*
+		 * Above seems wrong. Even in case of autocommit, started
+		 * transactions must be committed. (Hiroshi, 02/11/2001)
+		 */
+		if (!self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
+		{
+			res = CC_send_query(conn, "COMMIT", NULL);
 			QR_Destructor(res);
 			CC_set_no_trans(conn);
-		} 
-	
+		}
+
 	}
 
 	conn->status = oldstatus;
 	self->status = STMT_FINISHED;
 
-	/*	Check the status of the result */
-	if (self->result) {
+	/* Check the status of the result */
+	if (self->result)
+	{
 
 		was_ok = QR_command_successful(self->result);
 		was_nonfatal = QR_command_nonfatal(self->result);
 
-		if ( was_ok)
+		if (was_ok)
 			self->errornumber = STMT_OK;
 		else
 			self->errornumber = was_nonfatal ? STMT_INFO_ONLY : STMT_ERROR_TAKEN_FROM_BACKEND;
 
-		self->currTuple = -1; /* set cursor before the first tuple in the list */
+		self->currTuple = -1;	/* set cursor before the first tuple in
+								 * the list */
 		self->current_col = -1;
 		self->rowset_start = -1;
 
@@ -877,47 +995,57 @@ QueryInfo qi;
 		numcols = QR_NumResultCols(self->result);
 
 		/* now allocate the array to hold the binding info */
-		if (numcols > 0) {
+		if (numcols > 0)
+		{
 			extend_bindings(self, numcols);
-			if (self->bindings == NULL) {
+			if (self->bindings == NULL)
+			{
 				self->errornumber = STMT_NO_MEMORY_ERROR;
 				self->errormsg = "Could not get enough free memory to store the binding information";
 				SC_log_error(func, "", self);
 				return SQL_ERROR;
 			}
 		}
-		/* issue "ABORT" when query aborted */ 
-		if (QR_get_aborted(self->result) && ! self->internal )                   
+		/* issue "ABORT" when query aborted */
+		if (QR_get_aborted(self->result) && !self->internal)
 			CC_abort(conn);
-	} else {		/* Bad Error -- The error message will be in the Connection */
+	}
+	else
+	{							/* Bad Error -- The error message will be
+								 * in the Connection */
 
-		if (self->statement_type == STMT_TYPE_CREATE) {
+		if (self->statement_type == STMT_TYPE_CREATE)
+		{
 			self->errornumber = STMT_CREATE_TABLE_ERROR;
 			self->errormsg = "Error creating the table";
-			/*	This would allow the table to already exists, thus appending
-				rows to it.  BUT, if the table didn't have the same attributes,
-				it would fail.
-				return SQL_SUCCESS_WITH_INFO;
-			*/
+
+			/*
+			 * This would allow the table to already exists, thus
+			 * appending rows to it.  BUT, if the table didn't have the
+			 * same attributes, it would fail. return
+			 * SQL_SUCCESS_WITH_INFO;
+			 */
 		}
-		else {
+		else
+		{
 			self->errornumber = STMT_EXEC_ERROR;
 			self->errormsg = "Error while executing the query";
 		}
 
-		if ( ! self->internal)
+		if (!self->internal)
 			CC_abort(conn);
 	}
 
 	if (self->errornumber == STMT_OK)
 		return SQL_SUCCESS;
 
-	else {
+	else
+	{
 		/* Modified, 2000-04-29, Zoltan */
 		if (self->errornumber == STMT_INFO_ONLY)
-		    self->errormsg = "Error while executing the query (non-fatal)";
+			self->errormsg = "Error while executing the query (non-fatal)";
 		else
-		    self->errormsg = "Unknown error";
+			self->errormsg = "Unknown error";
 		SC_log_error(func, "", self);
 		return SQL_ERROR;
 	}
@@ -929,7 +1057,8 @@ SC_log_error(char *func, char *desc, StatementClass *self)
 #ifdef PRN_NULLCHECK
 #define nullcheck(a) (a ? a : "(NULL)")
 #endif
-	if (self) {
+	if (self)
+	{
 		qlog("STATEMENT ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
 		mylog("STATEMENT ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
 		qlog("                 ------------------------------------------------------------\n");
@@ -946,19 +1075,20 @@ SC_log_error(char *func, char *desc, StatementClass *self)
 
 		qlog("                 ----------------QResult Info -------------------------------\n");
 
-		if (self->result) {
-		QResultClass *res = self->result;
-		qlog("                 fields=%u, manual_tuples=%u, backend_tuples=%u, tupleField=%d, conn=%u\n", res->fields, res->manual_tuples, res->backend_tuples, res->tupleField, res->conn);
-		qlog("                 fetch_count=%d, fcount=%d, num_fields=%d, cursor='%s'\n", res->fetch_count, res->fcount, res->num_fields, nullcheck(res->cursor));
-		qlog("                 message='%s', command='%s', notice='%s'\n", nullcheck(res->message), nullcheck(res->command), nullcheck(res->notice));
-		qlog("                 status=%d, inTuples=%d\n", res->status, res->inTuples);
+		if (self->result)
+		{
+			QResultClass *res = self->result;
+
+			qlog("                 fields=%u, manual_tuples=%u, backend_tuples=%u, tupleField=%d, conn=%u\n", res->fields, res->manual_tuples, res->backend_tuples, res->tupleField, res->conn);
+			qlog("                 fetch_count=%d, fcount=%d, num_fields=%d, cursor='%s'\n", res->fetch_count, res->fcount, res->num_fields, nullcheck(res->cursor));
+			qlog("                 message='%s', command='%s', notice='%s'\n", nullcheck(res->message), nullcheck(res->command), nullcheck(res->notice));
+			qlog("                 status=%d, inTuples=%d\n", res->status, res->inTuples);
 		}
 
-		/*	Log the connection error if there is one */
+		/* Log the connection error if there is one */
 		CC_log_error(func, desc, self->hdbc);
 	}
 	else
 		qlog("INVALID STATEMENT HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 #undef PRN_NULLCHECK
 }
-
diff --git a/src/interfaces/odbc/statement.h b/src/interfaces/odbc/statement.h
index ae2df856b2572af682062af45efece8d0aa8d600..9907c28ae915bda93d1277770f32e9c7f2f91ddb 100644
--- a/src/interfaces/odbc/statement.h
+++ b/src/interfaces/odbc/statement.h
@@ -1,9 +1,9 @@
 
-/* File:            statement.h
+/* File:			statement.h
  *
- * Description:     See "statement.c"
+ * Description:		See "statement.c"
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -33,21 +33,28 @@
 #define TRUE	(BOOL)1
 #endif
 
-typedef enum {
-    STMT_ALLOCATED,     /* The statement handle is allocated, but not used so far */
-    STMT_READY,         /* the statement is waiting to be executed */
-    STMT_PREMATURE,     /* ODBC states that it is legal to call e.g. SQLDescribeCol before
-                           a call to SQLExecute, but after SQLPrepare. To get all the necessary
-                           information in such a case, we simply execute the query _before_ the
-                           actual call to SQLExecute, so that statement is considered to be "premature".
-                        */   
-    STMT_FINISHED,      /* statement execution has finished */
-    STMT_EXECUTING      /* statement execution is still going on */
+typedef enum
+{
+	STMT_ALLOCATED,				/* The statement handle is allocated, but
+								 * not used so far */
+	STMT_READY,					/* the statement is waiting to be executed */
+	STMT_PREMATURE,				/* ODBC states that it is legal to call
+								 * e.g. SQLDescribeCol before a call to
+								 * SQLExecute, but after SQLPrepare. To
+								 * get all the necessary information in
+								 * such a case, we simply execute the
+								 * query _before_ the actual call to
+								 * SQLExecute, so that statement is
+								 * considered to be "premature". */
+	STMT_FINISHED,				/* statement execution has finished */
+	STMT_EXECUTING				/* statement execution is still going on */
 } STMT_Status;
 
 #define STMT_TRUNCATED -2
-#define STMT_INFO_ONLY -1 /* not an error message, just a notification to be returned by SQLError */
-#define STMT_OK 0 /* will be interpreted as "no error pending" */
+#define STMT_INFO_ONLY -1		/* not an error message, just a
+								 * notification to be returned by SQLError */
+#define STMT_OK 0				/* will be interpreted as "no error
+								 * pending" */
 #define STMT_EXEC_ERROR 1
 #define STMT_STATUS_ERROR 2
 #define STMT_SEQUENCE_ERROR 3
@@ -77,7 +84,8 @@ typedef enum {
 #define STMT_BAD_ERROR 27
 
 /* statement types */
-enum {
+enum
+{
 	STMT_TYPE_UNKNOWN = -2,
 	STMT_TYPE_OTHER = -1,
 	STMT_TYPE_SELECT = 0,
@@ -95,7 +103,8 @@ enum {
 
 
 /*	Parsing status */
-enum {
+enum
+{
 	STMT_PARSE_NONE = 0,
 	STMT_PARSE_COMPLETE,
 	STMT_PARSE_INCOMPLETE,
@@ -103,92 +112,110 @@ enum {
 };
 
 /*	Result style */
-enum {
+enum
+{
 	STMT_FETCH_NONE = 0,
 	STMT_FETCH_NORMAL,
 	STMT_FETCH_EXTENDED,
 };
 
-typedef struct {
-	COL_INFO		*col_info;		/* cached SQLColumns info for this table */
-	char 			name[MAX_TABLE_LEN+1];
-	char			alias[MAX_TABLE_LEN+1];
+typedef struct
+{
+	COL_INFO   *col_info;		/* cached SQLColumns info for this table */
+	char		name[MAX_TABLE_LEN + 1];
+	char		alias[MAX_TABLE_LEN + 1];
 } TABLE_INFO;
 
-typedef struct {
-	TABLE_INFO  	*ti;			/* resolve to explicit table names */
-	int				precision;
-	int				display_size;
-	int				length;
-	int				type;
-	char			nullable;
-	char			func;
-	char			expr;
-	char			quote;
-	char			dquote;
-	char			numeric;
-	char			dot[MAX_TABLE_LEN+1];
-	char			name[MAX_COLUMN_LEN+1];
-	char			alias[MAX_COLUMN_LEN+1];
+typedef struct
+{
+	TABLE_INFO *ti;				/* resolve to explicit table names */
+	int			precision;
+	int			display_size;
+	int			length;
+	int			type;
+	char		nullable;
+	char		func;
+	char		expr;
+	char		quote;
+	char		dquote;
+	char		numeric;
+	char		dot[MAX_TABLE_LEN + 1];
+	char		name[MAX_COLUMN_LEN + 1];
+	char		alias[MAX_COLUMN_LEN + 1];
 } FIELD_INFO;
 
 
 /********	Statement Handle	***********/
-struct StatementClass_ {
-    ConnectionClass *hdbc;		/* pointer to ConnectionClass this statement belongs to */
-    QResultClass *result;		/* result of the current statement */
-	HSTMT FAR *phstmt;
+struct StatementClass_
+{
+	ConnectionClass *hdbc;		/* pointer to ConnectionClass this
+								 * statement belongs to */
+	QResultClass *result;		/* result of the current statement */
+	HSTMT FAR  *phstmt;
 	StatementOptions options;
 
-    STMT_Status status;
-    char *errormsg;
-    int errornumber;
+	STMT_Status status;
+	char	   *errormsg;
+	int			errornumber;
 
-    /* information on bindings */
-    BindInfoClass *bindings;	/* array to store the binding information */
+	/* information on bindings */
+	BindInfoClass *bindings;	/* array to store the binding information */
 	BindInfoClass bookmark;
-    int bindings_allocated;
-
-    /* information on statement parameters */
-    int parameters_allocated;
-    ParameterInfoClass *parameters;
-
-	Int4 currTuple;				/* current absolute row number (GetData, SetPos, SQLFetch) */
-	int  save_rowset_size;		/* saved rowset size in case of change/FETCH_NEXT */
-	int  rowset_start;			/* start of rowset (an absolute row number) */
-	int  bind_row;				/* current offset for Multiple row/column binding */
-	int  last_fetch_count;      /* number of rows retrieved in last fetch/extended fetch */
-	int  current_col;			/* current column for GetData -- used to handle multiple calls */
-	int  lobj_fd;				/* fd of the current large object */
-
-    char *statement;			/* if non--null pointer to the SQL statement that has been executed */
-
-	TABLE_INFO	**ti;
-	FIELD_INFO	**fi;
+	int			bindings_allocated;
+
+	/* information on statement parameters */
+	int			parameters_allocated;
+	ParameterInfoClass *parameters;
+
+	Int4		currTuple;		/* current absolute row number (GetData,
+								 * SetPos, SQLFetch) */
+	int			save_rowset_size;		/* saved rowset size in case of
+										 * change/FETCH_NEXT */
+	int			rowset_start;	/* start of rowset (an absolute row
+								 * number) */
+	int			bind_row;		/* current offset for Multiple row/column
+								 * binding */
+	int			last_fetch_count;		/* number of rows retrieved in
+										 * last fetch/extended fetch */
+	int			current_col;	/* current column for GetData -- used to
+								 * handle multiple calls */
+	int			lobj_fd;		/* fd of the current large object */
+
+	char	   *statement;		/* if non--null pointer to the SQL
+								 * statement that has been executed */
+
+	TABLE_INFO **ti;
+	FIELD_INFO **fi;
 	int			nfld;
 	int			ntab;
 
-	int parse_status;
+	int			parse_status;
 
-    int statement_type;			/* According to the defines above */
-	int data_at_exec;			/* Number of params needing SQLPutData */
-	int current_exec_param;		/* The current parameter for SQLPutData */
+	int			statement_type; /* According to the defines above */
+	int			data_at_exec;	/* Number of params needing SQLPutData */
+	int			current_exec_param;		/* The current parameter for
+										 * SQLPutData */
 
-	char put_data;				/* Has SQLPutData been called yet? */
+	char		put_data;		/* Has SQLPutData been called yet? */
 
-	char errormsg_created;		/* has an informative error msg been created?  */
-	char manual_result;			/* Is the statement result manually built? */
-	char prepare;				/* is this statement a prepared statement or direct */
+	char		errormsg_created;		/* has an informative error msg
+										 * been created?  */
+	char		manual_result;	/* Is the statement result manually built? */
+	char		prepare;		/* is this statement a prepared statement
+								 * or direct */
 
-	char internal;				/* Is this statement being called internally? */
+	char		internal;		/* Is this statement being called
+								 * internally? */
 
-	char cursor_name[MAX_CURSOR_LEN+1];
+	char		cursor_name[MAX_CURSOR_LEN + 1];
 
-	char stmt_with_params[STD_STATEMENT_LEN];		/* statement after parameter substitution */
+	char		stmt_with_params[STD_STATEMENT_LEN];	/* statement after
+														 * parameter
+														 * substitution */
 
 };
 
-#define SC_get_conn(a)    (a->hdbc)
+#define SC_get_conn(a)	  (a->hdbc)
 #define SC_get_Result(a)  (a->result);
 
 /*	options for SC_free_params() */
@@ -197,21 +224,21 @@ struct StatementClass_ {
 
 /*	Statement prototypes */
 StatementClass *SC_Constructor(void);
-void InitializeStatementOptions(StatementOptions *opt);
-char SC_Destructor(StatementClass *self);
-int statement_type(char *statement);
-char parse_statement(StatementClass *stmt);
-void SC_pre_execute(StatementClass *self);
-char SC_unbind_cols(StatementClass *self);
-char SC_recycle_statement(StatementClass *self);
-
-void SC_clear_error(StatementClass *self);
-char SC_get_error(StatementClass *self, int *number, char **message);
-char *SC_create_errormsg(StatementClass *self);
-RETCODE SC_execute(StatementClass *self);
-RETCODE SC_fetch(StatementClass *self);
-void SC_free_params(StatementClass *self, char option);
-void SC_log_error(char *func, char *desc, StatementClass *self);
+void		InitializeStatementOptions(StatementOptions *opt);
+char		SC_Destructor(StatementClass *self);
+int			statement_type(char *statement);
+char		parse_statement(StatementClass *stmt);
+void		SC_pre_execute(StatementClass *self);
+char		SC_unbind_cols(StatementClass *self);
+char		SC_recycle_statement(StatementClass *self);
+
+void		SC_clear_error(StatementClass *self);
+char		SC_get_error(StatementClass *self, int *number, char **message);
+char	   *SC_create_errormsg(StatementClass *self);
+RETCODE		SC_execute(StatementClass *self);
+RETCODE		SC_fetch(StatementClass *self);
+void		SC_free_params(StatementClass *self, char option);
+void		SC_log_error(char *func, char *desc, StatementClass *self);
 unsigned long SC_get_bookmark(StatementClass *self);
 
 
diff --git a/src/interfaces/odbc/tuple.c b/src/interfaces/odbc/tuple.c
index 303476fef28cb090619c3e9ba68c7a615955c572..473b0aadbc053a39f7c964e105c3dee203bebe41 100644
--- a/src/interfaces/odbc/tuple.c
+++ b/src/interfaces/odbc/tuple.c
@@ -1,17 +1,17 @@
 
-/* Module:          tuple.c
+/* Module:			tuple.c
  *
- * Description:     This module contains functions for setting the data for individual
- *                  fields (TupleField structure) of a manual result set.
+ * Description:		This module contains functions for setting the data for individual
+ *					fields (TupleField structure) of a manual result set.
  *
- * Important Note:  These functions are ONLY used in building manual result sets for 
- *                  info functions (SQLTables, SQLColumns, etc.)
+ * Important Note:	These functions are ONLY used in building manual result sets for
+ *					info functions (SQLTables, SQLColumns, etc.)
  *
- * Classes:         n/a
+ * Classes:			n/a
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -19,39 +19,43 @@
 #include <string.h>
 #include <stdlib.h>
 
-void set_tuplefield_null(TupleField *tuple_field)
+void
+set_tuplefield_null(TupleField *tuple_field)
 {
 	tuple_field->len = 0;
-	tuple_field->value = NULL;  /* strdup(""); */
+	tuple_field->value = NULL;	/* strdup(""); */
 }
 
-void set_tuplefield_string(TupleField *tuple_field, char *string)
+void
+set_tuplefield_string(TupleField *tuple_field, char *string)
 {
 	tuple_field->len = strlen(string);
-	tuple_field->value = malloc(strlen(string)+1);
+	tuple_field->value = malloc(strlen(string) + 1);
 	strcpy(tuple_field->value, string);
 }
 
 
-void set_tuplefield_int2(TupleField *tuple_field, Int2 value)
+void
+set_tuplefield_int2(TupleField *tuple_field, Int2 value)
 {
-char buffer[10];
+	char		buffer[10];
 
 
-	sprintf(buffer,"%d", value);
+	sprintf(buffer, "%d", value);
 
-	tuple_field->len = strlen(buffer)+1;
+	tuple_field->len = strlen(buffer) + 1;
 	/* +1 ... is this correct (better be on the save side-...) */
 	tuple_field->value = strdup(buffer);
 }
 
-void set_tuplefield_int4(TupleField *tuple_field, Int4 value)
+void
+set_tuplefield_int4(TupleField *tuple_field, Int4 value)
 {
-char buffer[15];
+	char		buffer[15];
 
-	sprintf(buffer,"%ld", value);
+	sprintf(buffer, "%ld", value);
 
-	tuple_field->len = strlen(buffer)+1;
+	tuple_field->len = strlen(buffer) + 1;
 	/* +1 ... is this correct (better be on the save side-...) */
 	tuple_field->value = strdup(buffer);
 }
diff --git a/src/interfaces/odbc/tuple.h b/src/interfaces/odbc/tuple.h
index 628d5ce449c75abe22eae3fdd49076b67cf74590..f3d3d997d13eb7323e0092ab3a50a6dc785ff71c 100644
--- a/src/interfaces/odbc/tuple.h
+++ b/src/interfaces/odbc/tuple.h
@@ -1,13 +1,13 @@
 
-/* File:            tuple.h
+/* File:			tuple.h
  *
- * Description:     See "tuple.c"
+ * Description:		See "tuple.c"
  *
- * Important NOTE:  The TupleField structure is used both to hold backend data and
- *                  manual result set data.  The "set_" functions and the TupleNode
- *                  structure are only used for manual result sets by info routines.  
+ * Important NOTE:	The TupleField structure is used both to hold backend data and
+ *					manual result set data.  The "set_" functions and the TupleNode
+ *					structure are only used for manual result sets by info routines.
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,15 +17,18 @@
 #include "psqlodbc.h"
 
 /*	Used by backend data AND manual result sets */
-struct TupleField_ {
-    Int4 len;     /* length of the current Tuple */
-    void *value;  /* an array representing the value */
+struct TupleField_
+{
+	Int4		len;			/* length of the current Tuple */
+	void	   *value;			/* an array representing the value */
 };
 
 /*	Used ONLY for manual result sets */
-struct TupleNode_ {
-    struct TupleNode_ *prev, *next;
-    TupleField tuple[1];
+struct TupleNode_
+{
+	struct TupleNode_ *prev,
+			   *next;
+	TupleField	tuple[1];
 };
 
 /*	These macros are wrappers for the corresponding set_tuplefield functions
@@ -36,9 +39,9 @@ struct TupleNode_ {
 #define set_nullfield_int2(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD))
 #define set_nullfield_int4(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD))
 
-void set_tuplefield_null(TupleField *tuple_field);
-void set_tuplefield_string(TupleField *tuple_field, char *string);
-void set_tuplefield_int2(TupleField *tuple_field, Int2 value);
-void set_tuplefield_int4(TupleField *tuple_field, Int4 value);
+void		set_tuplefield_null(TupleField *tuple_field);
+void		set_tuplefield_string(TupleField *tuple_field, char *string);
+void		set_tuplefield_int2(TupleField *tuple_field, Int2 value);
+void		set_tuplefield_int4(TupleField *tuple_field, Int4 value);
 
 #endif
diff --git a/src/interfaces/odbc/tuplelist.c b/src/interfaces/odbc/tuplelist.c
index 31acb9c9c908ffd6edfc1da7d6b523af05691b72..e50bd4aefbaae282531c468ac247d9e7ba05249f 100644
--- a/src/interfaces/odbc/tuplelist.c
+++ b/src/interfaces/odbc/tuplelist.c
@@ -1,14 +1,14 @@
 
-/* Module:          tuplelist.c
+/* Module:			tuplelist.c
  *
- * Description:     This module contains functions for creating a manual result set
- *                  (the TupleList) and retrieving data from it for a specific row/column.
+ * Description:		This module contains functions for creating a manual result set
+ *					(the TupleList) and retrieving data from it for a specific row/column.
  *
- * Classes:         TupleListClass (Functions prefix: "TL_")
+ * Classes:			TupleListClass (Functions prefix: "TL_")
  *
- * API functions:   none
+ * API functions:	none
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -19,19 +19,20 @@
 TupleListClass *
 TL_Constructor(UInt4 fieldcnt)
 {
-TupleListClass *rv;
+	TupleListClass *rv;
 
 	mylog("in TL_Constructor\n");
 
 	rv = (TupleListClass *) malloc(sizeof(TupleListClass));
-	if (rv) {
-
-        rv->num_fields = fieldcnt;
-        rv->num_tuples = 0;
-        rv->list_start = NULL;
-        rv->list_end = NULL;
-        rv->lastref = NULL;
-        rv->last_indexed = -1;
+	if (rv)
+	{
+
+		rv->num_fields = fieldcnt;
+		rv->num_tuples = 0;
+		rv->list_start = NULL;
+		rv->list_end = NULL;
+		rv->lastref = NULL;
+		rv->last_indexed = -1;
 	}
 
 	mylog("exit TL_Constructor\n");
@@ -42,35 +43,38 @@ TupleListClass *rv;
 void
 TL_Destructor(TupleListClass *self)
 {
-int lf;
-TupleNode *node, *tp;
+	int			lf;
+	TupleNode  *node,
+			   *tp;
 
 	mylog("TupleList: in DESTRUCTOR\n");
 
-    node = self->list_start;
-    while(node != NULL) {
-        for (lf=0; lf < self->num_fields; lf++)
-            if (node->tuple[lf].value != NULL) {
-                free(node->tuple[lf].value);
-            }
-        tp = node->next;
-        free(node);
-        node = tp;
-    }
+	node = self->list_start;
+	while (node != NULL)
+	{
+		for (lf = 0; lf < self->num_fields; lf++)
+			if (node->tuple[lf].value != NULL)
+				free(node->tuple[lf].value);
+		tp = node->next;
+		free(node);
+		node = tp;
+	}
 
 	free(self);
 
 	mylog("TupleList: exit DESTRUCTOR\n");
 }
-			
+
 
 void *
 TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
 {
-Int4 lf;
-Int4 delta, from_end;
-char end_is_closer, start_is_closer;
-TupleNode *rv;
+	Int4		lf;
+	Int4		delta,
+				from_end;
+	char		end_is_closer,
+				start_is_closer;
+	TupleNode  *rv;
 
 	if (self->last_indexed == -1)
 		/* we have an empty tuple list */
@@ -85,67 +89,88 @@ TupleNode *rv;
 		/* illegel field number range */
 		return NULL;
 
- /* check if we are accessing the same tuple that was used in
-    the last fetch (e.g: for fetching all the fields one after
-    another. Do this to speed things up
- */
+	/*
+	 * check if we are accessing the same tuple that was used in the last
+	 * fetch (e.g: for fetching all the fields one after another. Do this
+	 * to speed things up
+	 */
 	if (tupleno == self->last_indexed)
 		return self->lastref->tuple[fieldno].value;
 
- /* now for the tricky part... */
+	/* now for the tricky part... */
 
- /*
- Since random access is quite inefficient for linked lists we use
- the lastref pointer that points to the last element referenced
- by a get_fieldval() call in conjunction with the its index number
- that is stored in last_indexed. (So we use some locality of
- reference principle to speed things up)
- */
+	/*
+	 * Since random access is quite inefficient for linked lists we use
+	 * the lastref pointer that points to the last element referenced by a
+	 * get_fieldval() call in conjunction with the its index number that
+	 * is stored in last_indexed. (So we use some locality of reference
+	 * principle to speed things up)
+	 */
 
 	delta = tupleno - self->last_indexed;
 	/* if delta is positive, we have to go forward */
 
-	/* now check if we are closer to the start or the end of the list
-	than to our last_indexed pointer
-	*/
+	/*
+	 * now check if we are closer to the start or the end of the list than
+	 * to our last_indexed pointer
+	 */
 	from_end = (self->num_tuples - 1) - tupleno;
 
 	start_is_closer = labs(delta) > tupleno;
-	/* true if we are closer to the start of the list than to the
-	last_indexed pointer
-	*/
+
+	/*
+	 * true if we are closer to the start of the list than to the
+	 * last_indexed pointer
+	 */
 
 	end_is_closer = labs(delta) > from_end;
 	/* true if we are closer at the end of the list */
 
-	if (end_is_closer) {
+	if (end_is_closer)
+	{
 		/* scanning from the end is the shortest way. so we do that... */
 		rv = self->list_end;
-		for (lf=0; lf < from_end; lf++)
+		for (lf = 0; lf < from_end; lf++)
 			rv = rv->prev;
-	} else if (start_is_closer) {
-		/* the shortest way is to start the search from the head of the list */
+	}
+	else if (start_is_closer)
+	{
+
+		/*
+		 * the shortest way is to start the search from the head of the
+		 * list
+		 */
 		rv = self->list_start;
-		for (lf=0; lf < tupleno; lf++)
+		for (lf = 0; lf < tupleno; lf++)
 			rv = rv->next;
-	} else {
+	}
+	else
+	{
 		/* the closest way is starting from our lastref - pointer */
 		rv = self->lastref;
-		/* at first determine whether we have to search forward or backwards */
-		if (delta < 0) {
+
+		/*
+		 * at first determine whether we have to search forward or
+		 * backwards
+		 */
+		if (delta < 0)
+		{
 			/* we have to search backwards */
-			for(lf=0; lf < (-1)*delta; lf++)
+			for (lf = 0; lf < (-1) * delta; lf++)
 				rv = rv->prev;
-		} else {
+		}
+		else
+		{
 			/* ok, we have to search forward... */
-			for (lf=0; lf < delta; lf++)
-			rv = rv->next;
+			for (lf = 0; lf < delta; lf++)
+				rv = rv->next;
 		}
 	}
 
-	/* now we have got our return pointer, so update the lastref
-		and the last_indexed values
-	*/
+	/*
+	 * now we have got our return pointer, so update the lastref and the
+	 * last_indexed values
+	 */
 	self->lastref = rv;
 	self->last_indexed = tupleno;
 
@@ -157,23 +182,30 @@ TupleNode *rv;
 char
 TL_add_tuple(TupleListClass *self, TupleNode *new_field)
 {
- /* we append the tuple at the end of the doubly linked list
-    of the tuples we have already read in
- */
+
+	/*
+	 * we append the tuple at the end of the doubly linked list of the
+	 * tuples we have already read in
+	 */
 
 	new_field->prev = NULL;
 	new_field->next = NULL;
 
-	if (self->list_start == NULL) {
+	if (self->list_start == NULL)
+	{
 		/* the list is empty, we have to add the first tuple */
 		self->list_start = new_field;
 		self->list_end = new_field;
 		self->lastref = new_field;
 		self->last_indexed = 0;
-	} else {
-		/* there is already an element in the list, so add the new
-			one at the end of the list
-		*/
+	}
+	else
+	{
+
+		/*
+		 * there is already an element in the list, so add the new one at
+		 * the end of the list
+		 */
 		self->list_end->next = new_field;
 		new_field->prev = self->list_end;
 		self->list_end = new_field;
@@ -183,5 +215,3 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field)
 	/* this method of building a list cannot fail, so we return 1 */
 	return 1;
 }
-
-
diff --git a/src/interfaces/odbc/tuplelist.h b/src/interfaces/odbc/tuplelist.h
index 0f0bdb42ffb41f85d281d202a2d6714b87de8d3e..2b255bece76d0133dbdd342484a4584f4bf3dfdb 100644
--- a/src/interfaces/odbc/tuplelist.h
+++ b/src/interfaces/odbc/tuplelist.h
@@ -1,12 +1,12 @@
 
-/* File:            tuplelist.h
+/* File:			tuplelist.h
  *
- * Description:     See "tuplelist.c"
+ * Description:		See "tuplelist.c"
  *
- * Important Note:  This structure and its functions are ONLY used in building manual result
- *                  sets for info functions (SQLTables, SQLColumns, etc.)
+ * Important Note:	This structure and its functions are ONLY used in building manual result
+ *					sets for info functions (SQLTables, SQLColumns, etc.)
  *
- * Comments:        See "notice.txt" for copyright and license information.
+ * Comments:		See "notice.txt" for copyright and license information.
  *
  */
 
@@ -15,19 +15,22 @@
 
 #include "psqlodbc.h"
 
-struct TupleListClass_ {
-	Int4 num_fields;
-	Int4 num_tuples;  
-	TupleNode *list_start, *list_end, *lastref;
-	Int4 last_indexed;
+struct TupleListClass_
+{
+	Int4		num_fields;
+	Int4		num_tuples;
+	TupleNode  *list_start,
+			   *list_end,
+			   *lastref;
+	Int4		last_indexed;
 };
 
 #define TL_get_num_tuples(x)	(x->num_tuples)
 
 /* Create a TupleList. Each tuple consits of fieldcnt columns */
 TupleListClass *TL_Constructor(UInt4 fieldcnt);
-void TL_Destructor(TupleListClass *self);  
-void *TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno);
-char TL_add_tuple(TupleListClass *self, TupleNode *new_field);
+void		TL_Destructor(TupleListClass *self);
+void	   *TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno);
+char		TL_add_tuple(TupleListClass *self, TupleNode *new_field);
 
 #endif
diff --git a/src/interfaces/perl5/ppport.h b/src/interfaces/perl5/ppport.h
index 7a3c59fc9a6c857225844049ad0d2844f8174f3d..be5f99087aba05a9569713df55023a7224174492 100644
--- a/src/interfaces/perl5/ppport.h
+++ b/src/interfaces/perl5/ppport.h
@@ -6,11 +6,11 @@
 
 /* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
    distributed under the same license as any version of Perl. */
-   
+
 /* For the latest version of this code, please retreive the Devel::PPPort
    module from CPAN, contact the author at <kjahds@kjahds.com>, or check
    with the Perl maintainers. */
-   
+
 /* If you needed to customize this file for your project, please mention
    your changes, and visible alter the version number. */
 
@@ -29,29 +29,29 @@
    for a static include, or use the GLOBAL request in a single module to
    produce a global definition that can be referenced from the other
    modules.
-   
-   Function:            Static define:           Extern define:
-   newCONSTSUB()        NEED_newCONSTSUB         NEED_newCONSTSUB_GLOBAL
+
+   Function:			Static define:			 Extern define:
+   newCONSTSUB()		NEED_newCONSTSUB		 NEED_newCONSTSUB_GLOBAL
 
 */
- 
+
 
 /* To verify whether ppport.h is needed for your module, and whether any
    special defines should be used, ppport.h can be run through Perl to check
    your source code. Simply say:
-   
-   	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
-   
+
+	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+
    The result will be a list of patches suggesting changes that should at
    least be acceptable, if not necessarily the most efficient solution, or a
    fix for all possible problems. It won't catch where dTHR is needed, and
    doesn't attempt to account for global macro or function definitions,
    nested includes, typemaps, etc.
-   
+
    In order to test for the need of dTHR, please try your module under a
    recent version of Perl that has threading compiled-in.
- 
-*/ 
+
+*/
 
 
 /*
@@ -109,11 +109,11 @@ foreach $filename (map(glob($_),@ARGV)) {
 			$need_include = 1;
 		}
 	}
-	
+
 	if (scalar(keys %add_func) or $need_include != $has_include) {
 		if (!$has_include) {
 			$inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
-			       "#include \"ppport.h\"\n";
+				   "#include \"ppport.h\"\n";
 			$c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
 		} elsif (keys %add_func) {
 			$inc = join('',map("#define NEED_$_\n", sort keys %add_func));
@@ -125,7 +125,7 @@ foreach $filename (map(glob($_),@ARGV)) {
 		}
 		$changes++;
 	}
-	
+
 	if ($changes) {
 		open(OUT,">/tmp/ppport.h.$$");
 		print OUT $c;
@@ -142,87 +142,90 @@ __DATA__
 */
 
 #ifndef PERL_REVISION
-#   ifndef __PATCHLEVEL_H_INCLUDED__
-#       include "patchlevel.h"
-#   endif
-#   ifndef PERL_REVISION
-#	define PERL_REVISION	(5)
-        /* Replace: 1 */
-#       define PERL_VERSION	PATCHLEVEL
-#       define PERL_SUBVERSION	SUBVERSION
-        /* Replace PERL_PATCHLEVEL with PERL_VERSION */
-        /* Replace: 0 */
-#   endif
+#ifndef __PATCHLEVEL_H_INCLUDED__
+#include "patchlevel.h"
+#endif
+#ifndef PERL_REVISION
+#define PERL_REVISION	 (5)
+ /* Replace: 1 */
+#define PERL_VERSION PATCHLEVEL
+#define PERL_SUBVERSION  SUBVERSION
+ /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+ /* Replace: 0 */
+#endif
 #endif
 
 #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
 
 #ifndef ERRSV
-#	define ERRSV perl_get_sv("@",FALSE)
+#define ERRSV perl_get_sv("@",FALSE)
 #endif
 
 #if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
 /* Replace: 1 */
-#	define PL_sv_undef	sv_undef
-#	define PL_sv_yes	sv_yes
-#	define PL_sv_no		sv_no
-#	define PL_na		na
-#	define PL_stdingv	stdingv
-#	define PL_hints		hints
-#	define PL_curcop	curcop
-#	define PL_curstash	curstash
-#	define PL_copline	copline
-#	define PL_Sv		Sv
+#define PL_sv_undef  sv_undef
+#define PL_sv_yes	 sv_yes
+#define PL_sv_no	 sv_no
+#define PL_na		 na
+#define PL_stdingv	 stdingv
+#define PL_hints	 hints
+#define PL_curcop	 curcop
+#define PL_curstash  curstash
+#define PL_copline	 copline
+#define PL_Sv		 Sv
 /* Replace: 0 */
 #endif
 
 #ifndef dTHR
-#  ifdef WIN32
-#	define dTHR extern int Perl___notused
-#  else
-#	define dTHR extern int errno
-#  endif
+#ifdef WIN32
+#define dTHR extern int Perl___notused
+#else
+#define dTHR extern int errno
+#endif
 #endif
 
 #ifndef boolSV
-#	define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
 #endif
 
 #ifndef gv_stashpvn
-#	define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
 #endif
 
 #ifndef newSVpvn
-#	define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
 #endif
 
 #ifndef newRV_inc
 /* Replace: 1 */
-#	define newRV_inc(sv) newRV(sv)
+#define newRV_inc(sv) newRV(sv)
 /* Replace: 0 */
 #endif
 
 #ifndef newRV_noinc
-#  ifdef __GNUC__
-#    define newRV_noinc(sv)               \
-      ({                                  \
-          SV *nsv = (SV*)newRV(sv);       \
-          SvREFCNT_dec(sv);               \
-          nsv;                            \
-      })
-#  else
-#    if defined(CRIPPLED_CC) || defined(USE_THREADS)
-static SV * newRV_noinc (SV * sv)
+#ifdef __GNUC__
+#define newRV_noinc(sv)				  \
+	  ({								  \
+		  SV *nsv = (SV*)newRV(sv);		  \
+		  SvREFCNT_dec(sv);				  \
+		  nsv;							  \
+	  })
+#else
+#if defined(CRIPPLED_CC) || defined(USE_THREADS)
+static SV  *
+newRV_noinc(SV * sv)
 {
-          SV *nsv = (SV*)newRV(sv);       
-          SvREFCNT_dec(sv);               
-          return nsv;                     
+	SV		   *nsv = (SV *) newRV(sv);
+
+	SvREFCNT_dec(sv);
+	return nsv;
 }
-#    else
-#      define newRV_noinc(sv)    \
-        ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
-#    endif
-#  endif
+
+#else
+#define newRV_noinc(sv)    \
+		((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+#endif
+#endif
 #endif
 
 /* Provide: newCONSTSUB */
@@ -233,20 +236,22 @@ static SV * newRV_noinc (SV * sv)
 #if defined(NEED_newCONSTSUB)
 static
 #else
-extern void newCONSTSUB _((HV * stash, char * name, SV *sv));
+extern void newCONSTSUB _((HV * stash, char *name, SV * sv));
+
 #endif
 
 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
 void
-newCONSTSUB(stash,name,sv)
-HV *stash;
-char *name;
-SV *sv;
+newCONSTSUB(stash, name, sv)
+HV		   *stash;
+char	   *name;
+SV		   *sv;
 {
-	U32 oldhints = PL_hints;
-	HV *old_cop_stash = PL_curcop->cop_stash;
-	HV *old_curstash = PL_curstash;
-	line_t oldline = PL_curcop->cop_line;
+	U32			oldhints = PL_hints;
+	HV		   *old_cop_stash = PL_curcop->cop_stash;
+	HV		   *old_curstash = PL_curstash;
+	line_t		oldline = PL_curcop->cop_line;
+
 	PL_curcop->cop_line = PL_copline;
 
 	PL_hints &= ~HINT_BLOCK_SCOPE;
@@ -256,31 +261,33 @@ SV *sv;
 	newSUB(
 
 #if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
-     /* before 5.003_22 */
-		start_subparse(),
+	/* before 5.003_22 */
+		   start_subparse(),
 #else
-#  if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
-     /* 5.003_22 */
-     		start_subparse(0),
-#  else
-     /* 5.003_23  onwards */
-     		start_subparse(FALSE, 0),
-#  endif
+#if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+	/* 5.003_22 */
+		   start_subparse(0),
+#else
+	/* 5.003_23  onwards */
+		   start_subparse(FALSE, 0),
+#endif
 #endif
 
-		newSVOP(OP_CONST, 0, newSVpv(name,0)),
-		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
-		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
-	);
+		   newSVOP(OP_CONST, 0, newSVpv(name, 0)),
+		   newSVOP(OP_CONST, 0, &PL_sv_no),		/* SvPV(&PL_sv_no) == ""
+												 * -- GMB */
+		   newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+		);
 
 	PL_hints = oldhints;
 	PL_curcop->cop_stash = old_cop_stash;
 	PL_curstash = old_curstash;
 	PL_curcop->cop_line = oldline;
 }
+
 #endif
 
-#endif /* newCONSTSUB */
+#endif	 /* newCONSTSUB */
 
 
-#endif /* _P_P_PORTABILITY_H_ */
+#endif	 /* _P_P_PORTABILITY_H_ */
diff --git a/src/interfaces/python/pgmodule.c b/src/interfaces/python/pgmodule.c
index 70f8c02f10e5e7f3a2eb5c2cdb22c74432c7d352..bae459a1724b15ffaa9fbd55f03fe86306ffdf82 100644
--- a/src/interfaces/python/pgmodule.c
+++ b/src/interfaces/python/pgmodule.c
@@ -37,22 +37,22 @@
 /* really bad stuff here - I'm so naughty */
 /* If you need to you can run mkdefines to get */
 /* current defines but it should not have changed */
-#define	INT2OID		21
-#define	INT4OID		23
-#define	OIDOID		26
-#define	FLOAT4OID	700
-#define	FLOAT8OID	701
-#define	CASHOID		790
+#define INT2OID		21
+#define INT4OID		23
+#define OIDOID		26
+#define FLOAT4OID	700
+#define FLOAT8OID	701
+#define CASHOID		790
 
-static PyObject		*PGError;
-static const char	*PyPgVersion = "3.1";
+static PyObject *PGError;
+static const char *PyPgVersion = "3.1";
 
 /* taken from fileobject.c */
 #define BUF(v) PyString_AS_STRING((PyStringObject *)(v))
 
 /* default values */
-#define	MODULE_NAME			"pgsql"
-#define	ARRAYSIZE			1
+#define MODULE_NAME			"pgsql"
+#define ARRAYSIZE			1
 
 /* flags for object validity checks */
 #define CHECK_OPEN			1
@@ -75,21 +75,21 @@ static const char	*PyPgVersion = "3.1";
 
 /* moves names for errors */
 const char *__movename[5] =
-		{ "", "movefirst", "movelast", "movenext", "moveprev" };
+{"", "movefirst", "movelast", "movenext", "moveprev"};
 
-#define MAX_BUFFER_SIZE	8192	/* maximum transaction size */
+#define MAX_BUFFER_SIZE 8192	/* maximum transaction size */
 
 #ifndef NO_DIRECT
 #define DIRECT_ACCESS	1		/* enables direct access functions */
-#endif							/* NO_DIRECT */
+#endif	 /* NO_DIRECT */
 
 #ifndef NO_LARGE
 #define LARGE_OBJECTS	1		/* enables large objects support */
-#endif							/* NO_LARGE */
+#endif	 /* NO_LARGE */
 
 #ifndef NO_DEF_VAR
 #define DEFAULT_VARS	1		/* enables default variables use */
-#endif							/* NO_DEF_VAR */
+#endif	 /* NO_DEF_VAR */
 
 #ifdef MS_WIN32
 #define NO_SNPRINTF 1
@@ -101,15 +101,15 @@ const char *__movename[5] =
 
 #ifdef DEFAULT_VARS
 
-static PyObject	*pg_default_host;		/* default database host */
-static PyObject	*pg_default_base;		/* default database name */
-static PyObject	*pg_default_opt;		/* default connection options */
-static PyObject	*pg_default_tty;		/* default debug tty */
-static PyObject	*pg_default_port;		/* default connection port */
-static PyObject	*pg_default_user;		/* default username */
-static PyObject	*pg_default_passwd;		/* default password */
+static PyObject *pg_default_host;		/* default database host */
+static PyObject *pg_default_base;		/* default database name */
+static PyObject *pg_default_opt;/* default connection options */
+static PyObject *pg_default_tty;/* default debug tty */
+static PyObject *pg_default_port;		/* default connection port */
+static PyObject *pg_default_user;		/* default username */
+static PyObject *pg_default_passwd;		/* default password */
 
-#endif							/* DEFAULT_VARS */
+#endif	 /* DEFAULT_VARS */
 
 /* --------------------------------------------------------------------- */
 /* OBJECTS DECLARATION */
@@ -120,9 +120,9 @@ typedef struct
 {
 	PyObject_HEAD
 	int			valid;			/* validity flag */
-	PGconn		*cnx;			/* PostGres connection handle */
-	PGresult	*last_result;	/* last result content */
-} pgobject;
+	PGconn	   *cnx;			/* PostGres connection handle */
+	PGresult   *last_result;	/* last result content */
+}			pgobject;
 
 staticforward PyTypeObject PgType;
 
@@ -131,7 +131,7 @@ staticforward PyTypeObject PgType;
 static PyObject *
 pgobject_New(void)
 {
-	pgobject *pgobj;
+	pgobject   *pgobj;
 
 	if ((pgobj = PyObject_NEW(pgobject, &PgType)) == NULL)
 		return NULL;
@@ -139,7 +139,7 @@ pgobject_New(void)
 	pgobj->valid = 1;
 	pgobj->last_result = NULL;
 	pgobj->cnx = NULL;
-	return (PyObject*)pgobj;
+	return (PyObject *) pgobj;
 }
 
 /* pg query object */
@@ -147,11 +147,11 @@ pgobject_New(void)
 typedef struct
 {
 	PyObject_HEAD
-	PGresult	*last_result;	/* last result content */
+	PGresult   *last_result;	/* last result content */
 	int			result_type;	/* type of previous result */
 	long		current_pos;	/* current position in last result */
 	long		num_rows;		/* number of (affected) rows */
-} pgqueryobject;
+}			pgqueryobject;
 
 staticforward PyTypeObject PgQueryType;
 
@@ -162,15 +162,15 @@ staticforward PyTypeObject PgQueryType;
 typedef struct
 {
 	PyObject_HEAD
-	int				valid;			/* validity flag */
-	pgobject		*pgcnx;			/* parent connection object */
-	PGresult		*last_result;	/* last result content */
-	int				result_type;	/* result type (DDL/DML/DQL) */
-	long			arraysize;		/* array size for fetch method */
-	int				current_row;	/* current selected row */
-	int				max_row;		/* number of rows in the result */
-	int				num_fields;		/* number of fields in each row */
-} pgsourceobject;
+	int			valid;			/* validity flag */
+	pgobject   *pgcnx;			/* parent connection object */
+	PGresult   *last_result;	/* last result content */
+	int			result_type;	/* result type (DDL/DML/DQL) */
+	long		arraysize;		/* array size for fetch method */
+	int			current_row;	/* current selected row */
+	int			max_row;		/* number of rows in the result */
+	int			num_fields;		/* number of fields in each row */
+}			pgsourceobject;
 
 staticforward PyTypeObject PgSourceType;
 
@@ -183,15 +183,15 @@ staticforward PyTypeObject PgSourceType;
 typedef struct
 {
 	PyObject_HEAD
-	pgobject		*pgcnx;			/* parent connection object */
-	Oid				lo_oid;			/* large object oid */
-	int				lo_fd;			/* large object fd */
-} pglargeobject;
+	pgobject * pgcnx;			/* parent connection object */
+	Oid			lo_oid;			/* large object oid */
+	int			lo_fd;			/* large object fd */
+}			pglargeobject;
 
 staticforward PyTypeObject PglargeType;
 
 #define is_pglargeobject(v) ((v)->ob_type == &PglargeType)
-#endif							/* LARGE_OBJECTS */
+#endif	 /* LARGE_OBJECTS */
 
 /* --------------------------------------------------------------------- */
 /* INTERNAL FUNCTIONS */
@@ -200,7 +200,8 @@ staticforward PyTypeObject PglargeType;
 static int
 check_cnx_obj(pgobject * self)
 {
-	if (!self->valid) {
+	if (!self->valid)
+	{
 		PyErr_SetString(PGError, "connection has been closed");
 		return 0;
 	}
@@ -242,7 +243,7 @@ check_lo_obj(pglargeobject * self, int level)
 	return 1;
 }
 
-#endif							/* LARGE_OBJECTS */
+#endif	 /* LARGE_OBJECTS */
 
 /* checks source object validity */
 static int
@@ -276,8 +277,8 @@ check_source_obj(pgsourceobject * self, int level)
 int *
 get_type_array(PGresult *result, int nfields)
 {
-	int *typ;
-	int j;
+	int		   *typ;
+	int			j;
 
 	if ((typ = malloc(sizeof(int) * nfields)) == NULL)
 	{
@@ -315,7 +316,7 @@ get_type_array(PGresult *result, int nfields)
 
 
 /* prototypes for constructors */
-static pgsourceobject * pgsource_new(pgobject * pgcnx);
+static pgsourceobject *pgsource_new(pgobject * pgcnx);
 
 /* --------------------------------------------------------------------- */
 /* PG SOURCE OBJECT IMPLEMENTATION */
@@ -324,7 +325,7 @@ static pgsourceobject * pgsource_new(pgobject * pgcnx);
 static pgsourceobject *
 pgsource_new(pgobject * pgcnx)
 {
-	pgsourceobject * npgobj;
+	pgsourceobject *npgobj;
 
 	/* allocates new query object */
 	if ((npgobj = PyObject_NEW(pgsourceobject, &PgSourceType)) == NULL)
@@ -392,9 +393,9 @@ static char pgsource_execute__doc__[] =
 static PyObject *
 pgsource_execute(pgsourceobject * self, PyObject * args)
 {
-	char			*query;
-	const char		*temp;
-	long			num_rows;
+	char	   *query;
+	const char *temp;
+	long		num_rows;
 
 	/* checks validity */
 	if (!check_source_obj(self, CHECK_CNX))
@@ -419,11 +420,11 @@ pgsource_execute(pgsourceobject * self, PyObject * args)
 
 	/* gets result */
 	Py_BEGIN_ALLOW_THREADS
-	self->last_result = PQexec(self->pgcnx->cnx, query);
+		self->last_result = PQexec(self->pgcnx->cnx, query);
 	Py_END_ALLOW_THREADS
 
 	/* checks result validity */
-	if (!self->last_result)
+		if (!self->last_result)
 	{
 		PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->pgcnx->cnx));
 		return NULL;
@@ -433,38 +434,39 @@ pgsource_execute(pgsourceobject * self, PyObject * args)
 	switch (PQresultStatus(self->last_result))
 	{
 
-	/* query succeeded */
-	case PGRES_TUPLES_OK:	/* DQL: returns None (DB-SIG compliant) */
-		self->result_type = RESULT_DQL;
-		self->max_row = PQntuples(self->last_result);
-		self->num_fields = PQnfields(self->last_result);
-		Py_INCREF(Py_None);
-		return Py_None;
-	case PGRES_COMMAND_OK: /* other requests */
-	case PGRES_COPY_OUT:
-	case PGRES_COPY_IN:
-		self->result_type = RESULT_DDL;
-		temp = PQcmdTuples(self->last_result);
-		num_rows = 1;
-		if (temp[0] != 0) {
-			self->result_type = RESULT_DML;
-			num_rows = atol(temp);
-		}
-		return PyInt_FromLong(num_rows);
-
-	/* query failed */
-	case PGRES_EMPTY_QUERY:
-		PyErr_SetString(PyExc_ValueError, "empty query.");
-		break;
-	case PGRES_BAD_RESPONSE:
-	case PGRES_FATAL_ERROR:
-	case PGRES_NONFATAL_ERROR:
-		PyErr_SetString(PGError, PQerrorMessage(self->pgcnx->cnx));
-		break;
-	default:
-		PyErr_SetString(PGError, "internal error: "
-			"unknown result status.");
-		break;
+			/* query succeeded */
+		case PGRES_TUPLES_OK:	/* DQL: returns None (DB-SIG compliant) */
+			self->result_type = RESULT_DQL;
+			self->max_row = PQntuples(self->last_result);
+			self->num_fields = PQnfields(self->last_result);
+			Py_INCREF(Py_None);
+			return Py_None;
+		case PGRES_COMMAND_OK:	/* other requests */
+		case PGRES_COPY_OUT:
+		case PGRES_COPY_IN:
+			self->result_type = RESULT_DDL;
+			temp = PQcmdTuples(self->last_result);
+			num_rows = 1;
+			if (temp[0] != 0)
+			{
+				self->result_type = RESULT_DML;
+				num_rows = atol(temp);
+			}
+			return PyInt_FromLong(num_rows);
+
+			/* query failed */
+		case PGRES_EMPTY_QUERY:
+			PyErr_SetString(PyExc_ValueError, "empty query.");
+			break;
+		case PGRES_BAD_RESPONSE:
+		case PGRES_FATAL_ERROR:
+		case PGRES_NONFATAL_ERROR:
+			PyErr_SetString(PGError, PQerrorMessage(self->pgcnx->cnx));
+			break;
+		default:
+			PyErr_SetString(PGError, "internal error: "
+							"unknown result status.");
+			break;
 	}
 
 	/* frees result and returns error */
@@ -492,7 +494,7 @@ pgsource_oidstatus(pgsourceobject * self, PyObject * args)
 	if ((args != NULL) && (!PyArg_ParseTuple(args, "")))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-			"method oidstatus() takes no parameters.");
+						"method oidstatus() takes no parameters.");
 		return NULL;
 	}
 
@@ -512,9 +514,12 @@ static char pgsource_fetch__doc__[] =
 static PyObject *
 pgsource_fetch(pgsourceobject * self, PyObject * args)
 {
-	PyObject *rowtuple, *reslist, *str;
-	int i, j;
-	long size;
+	PyObject   *rowtuple,
+			   *reslist,
+			   *str;
+	int			i,
+				j;
+	long		size;
 
 	/* checks validity */
 	if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL))
@@ -525,7 +530,7 @@ pgsource_fetch(pgsourceobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "|l", &size))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-			"fetch(num), with num (integer, optional).");
+						"fetch(num), with num (integer, optional).");
 		return NULL;
 	}
 
@@ -578,13 +583,13 @@ pgsource_move(pgsourceobject * self, PyObject * args, int move)
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
-		char errbuf[256];
+		char		errbuf[256];
 
 #ifdef	NO_SNPRINTF
 		sprintf(errbuf, "method %s() takes no parameter.", __movename[move]);
 #else
 		snprintf(errbuf, sizeof(errbuf),
-			"method %s() takes no parameter.", __movename[move]);
+				 "method %s() takes no parameter.", __movename[move]);
 #endif
 
 		PyErr_SetString(PyExc_SyntaxError, errbuf);
@@ -592,19 +597,22 @@ pgsource_move(pgsourceobject * self, PyObject * args, int move)
 	}
 
 	/* changes the current row */
-	switch(move) {
-	case QUERY_MOVEFIRST:
-		self->current_row = 0;
-		break;
-	case QUERY_MOVELAST:
-		self->current_row = self->max_row - 1;
-		break;
-	case QUERY_MOVENEXT:
-		if (self->current_row != self->max_row) self->current_row++;
-		break;
-	case QUERY_MOVEPREV:
-		if (self->current_row > 0) self->current_row--;
-		break;
+	switch (move)
+	{
+		case QUERY_MOVEFIRST:
+			self->current_row = 0;
+			break;
+		case QUERY_MOVELAST:
+			self->current_row = self->max_row - 1;
+			break;
+		case QUERY_MOVENEXT:
+			if (self->current_row != self->max_row)
+				self->current_row++;
+			break;
+		case QUERY_MOVEPREV:
+			if (self->current_row > 0)
+				self->current_row--;
+			break;
 	}
 
 	Py_INCREF(Py_None);
@@ -653,9 +661,9 @@ pgsource_moveprev(pgsourceobject * self, PyObject * args)
 
 /* finds field number from string/integer (internal use only) */
 static int
-pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char * usage)
+pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char *usage)
 {
-	int num;
+	int			num;
 
 	/* checks validity */
 	if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL))
@@ -663,13 +671,9 @@ pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char * usage)
 
 	/* gets field number */
 	if (PyString_Check(param))
-	{
 		num = PQfnumber(self->last_result, PyString_AsString(param));
-	}
 	else if (PyInt_Check(param))
-	{
 		num = PyInt_AsLong(param);
-	}
 	else
 	{
 		PyErr_SetString(PyExc_TypeError, usage);
@@ -677,7 +681,7 @@ pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char * usage)
 	}
 
 	/* checks field validity */
-	if (num<0 || num>=self->num_fields)
+	if (num < 0 || num >= self->num_fields)
 	{
 		PyErr_SetString(PyExc_ValueError, "Unknown field.");
 		return -1;
@@ -690,7 +694,7 @@ pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char * usage)
 static PyObject *
 pgsource_buildinfo(pgsourceobject * self, int num)
 {
-	PyObject * result;
+	PyObject   *result;
 
 	/* allocates tuple */
 	result = PyTuple_New(3);
@@ -700,9 +704,9 @@ pgsource_buildinfo(pgsourceobject * self, int num)
 	/* affects field information */
 	PyTuple_SET_ITEM(result, 0, PyInt_FromLong(num));
 	PyTuple_SET_ITEM(result, 1,
-		PyString_FromString(PQfname(self->last_result, num)));
+				   PyString_FromString(PQfname(self->last_result, num)));
 	PyTuple_SET_ITEM(result, 2,
-		PyInt_FromLong(PQftype(self->last_result, num)));
+					 PyInt_FromLong(PQftype(self->last_result, num)));
 
 	return result;
 }
@@ -715,8 +719,9 @@ static char pgsource_listinfo__doc__[] =
 static PyObject *
 pgsource_listinfo(pgsourceobject * self, PyObject * args)
 {
-	int i;
-	PyObject * result, * info;
+	int			i;
+	PyObject   *result,
+			   *info;
 
 	/* checks validity */
 	if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL))
@@ -726,7 +731,7 @@ pgsource_listinfo(pgsourceobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_TypeError,
-			"method listinfo() takes no parameter.");
+						"method listinfo() takes no parameter.");
 		return NULL;
 	}
 
@@ -734,7 +739,7 @@ pgsource_listinfo(pgsourceobject * self, PyObject * args)
 	if ((result = PyTuple_New(self->num_fields)) == NULL)
 		return NULL;
 
-	for (i=0; i<self->num_fields; i++)
+	for (i = 0; i < self->num_fields; i++)
 	{
 		info = pgsource_buildinfo(self, i);
 		if (!info)
@@ -758,9 +763,9 @@ static PyObject *
 pgsource_fieldinfo(pgsourceobject * self, PyObject * args)
 {
 	static const char short_usage[] =
-		"fieldinfo(desc), with desc (string|integer).";
-	int num;
-	PyObject * param;
+	"fieldinfo(desc), with desc (string|integer).";
+	int			num;
+	PyObject   *param;
 
 	/* gets args */
 	if (!PyArg_ParseTuple(args, "O", &param))
@@ -785,9 +790,9 @@ static PyObject *
 pgsource_field(pgsourceobject * self, PyObject * args)
 {
 	static const char short_usage[] =
-		"field(desc), with desc (string|integer).";
-	int num;
-	PyObject * param;
+	"field(desc), with desc (string|integer).";
+	int			num;
+	PyObject   *param;
 
 	/* gets args */
 	if (!PyArg_ParseTuple(args, "O", &param))
@@ -801,34 +806,34 @@ pgsource_field(pgsourceobject * self, PyObject * args)
 		return NULL;
 
 	return PyString_FromString(PQgetvalue(self->last_result,
-		self->current_row, num));
+										  self->current_row, num));
 }
 
 /* query object methods */
 static PyMethodDef pgsource_methods[] = {
-	{ "close", (PyCFunction) pgsource_close, 1,
-		pgsource_close__doc__ },
-	{ "execute", (PyCFunction) pgsource_execute, 1,
-		pgsource_execute__doc__ },
-	{ "oidstatus", (PyCFunction) pgsource_oidstatus, 1,
-		pgsource_oidstatus__doc__ },
-	{ "fetch", (PyCFunction) pgsource_fetch, 1,
-		pgsource_fetch__doc__ },
-	{ "movefirst", (PyCFunction) pgsource_movefirst, 1,
-		pgsource_movefirst__doc__ },
-	{ "movelast", (PyCFunction) pgsource_movelast, 1,
-		pgsource_movelast__doc__ },
-	{ "movenext", (PyCFunction) pgsource_movenext, 1,
-		pgsource_movenext__doc__ },
-	{ "moveprev", (PyCFunction) pgsource_moveprev, 1,
-		pgsource_moveprev__doc__ },
-	{ "field", (PyCFunction) pgsource_field, 1,
-		pgsource_field__doc__ },
-	{ "fieldinfo", (PyCFunction) pgsource_fieldinfo, 1,
-		pgsource_fieldinfo__doc__ },
-	{ "listinfo", (PyCFunction) pgsource_listinfo, 1,
-		pgsource_listinfo__doc__ },
-	{ NULL, NULL }
+	{"close", (PyCFunction) pgsource_close, 1,
+	pgsource_close__doc__},
+	{"execute", (PyCFunction) pgsource_execute, 1,
+	pgsource_execute__doc__},
+	{"oidstatus", (PyCFunction) pgsource_oidstatus, 1,
+	pgsource_oidstatus__doc__},
+	{"fetch", (PyCFunction) pgsource_fetch, 1,
+	pgsource_fetch__doc__},
+	{"movefirst", (PyCFunction) pgsource_movefirst, 1,
+	pgsource_movefirst__doc__},
+	{"movelast", (PyCFunction) pgsource_movelast, 1,
+	pgsource_movelast__doc__},
+	{"movenext", (PyCFunction) pgsource_movenext, 1,
+	pgsource_movenext__doc__},
+	{"moveprev", (PyCFunction) pgsource_moveprev, 1,
+	pgsource_moveprev__doc__},
+	{"field", (PyCFunction) pgsource_field, 1,
+	pgsource_field__doc__},
+	{"fieldinfo", (PyCFunction) pgsource_fieldinfo, 1,
+	pgsource_fieldinfo__doc__},
+	{"listinfo", (PyCFunction) pgsource_listinfo, 1,
+	pgsource_listinfo__doc__},
+	{NULL, NULL}
 };
 
 /* gets query object attributes */
@@ -864,8 +869,9 @@ pgsource_getattr(pgsourceobject * self, char *name)
 		return PyInt_FromLong(self->num_fields);
 
 	/* attributes list */
-	if (!strcmp(name, "__members__")) {
-		PyObject *list = PyList_New(5);
+	if (!strcmp(name, "__members__"))
+	{
+		PyObject   *list = PyList_New(5);
 
 		PyList_SET_ITEM(list, 0, PyString_FromString("pgcnx"));
 		PyList_SET_ITEM(list, 1, PyString_FromString("arraysize"));
@@ -890,7 +896,7 @@ pgsource_getattr(pgsourceobject * self, char *name)
 
 /* sets query object attributes */
 static int
-pgsource_setattr(pgsourceobject * self, char * name, PyObject * v)
+pgsource_setattr(pgsourceobject * self, char *name, PyObject * v)
 {
 	/* arraysize */
 	if (!strcmp(name, "arraysize"))
@@ -914,26 +920,26 @@ pgsource_setattr(pgsourceobject * self, char * name, PyObject * v)
 static int
 pgsource_print(pgsourceobject * self, FILE *fp, int flags)
 {
-	PQprintOpt op;
+	PQprintOpt	op;
 
 	switch (self->result_type)
 	{
-	case RESULT_DQL:
-		memset(&op, 0, sizeof(op));
-		op.align = 1;
-		op.header = 1;
-		op.fieldSep = "|";
-		op.pager = 1;
-		PQprint(fp, self->last_result, &op);
-		break;
-	case RESULT_DDL:
-	case RESULT_DML:
-		fputs(PQcmdStatus(self->last_result), fp);
-		break;
-	case RESULT_EMPTY:
-	default:
-		fputs("Empty PostgreSQL source object.", fp);
-		break;
+		case RESULT_DQL:
+			memset(&op, 0, sizeof(op));
+			op.align = 1;
+			op.header = 1;
+			op.fieldSep = "|";
+			op.pager = 1;
+			PQprint(fp, self->last_result, &op);
+			break;
+		case RESULT_DDL:
+		case RESULT_DML:
+			fputs(PQcmdStatus(self->last_result), fp);
+			break;
+		case RESULT_EMPTY:
+		default:
+			fputs("Empty PostgreSQL source object.", fp);
+			break;
 	}
 
 	return 0;
@@ -947,21 +953,21 @@ staticforward PyTypeObject PgSourceType = {
 	PyObject_HEAD_INIT(NULL)
 #endif
 
-	0,								/* ob_size */
-	"pgsourceobject",				/* tp_name */
-	sizeof(pgsourceobject),			/* tp_basicsize */
-	0,								/* tp_itemsize */
+	0,							/* ob_size */
+	"pgsourceobject",			/* tp_name */
+	sizeof(pgsourceobject),		/* tp_basicsize */
+	0,							/* tp_itemsize */
 	/* methods */
-	(destructor) pgsource_dealloc,	/* tp_dealloc */
-	(printfunc) pgsource_print,		/* tp_print */
-	(getattrfunc) pgsource_getattr,	/* tp_getattr */
-	(setattrfunc) pgsource_setattr,	/* tp_setattr */
-	0,								/* tp_compare */
-	0,								/* tp_repr */
-	0,								/* tp_as_number */
-	0,								/* tp_as_sequence */
-	0,								/* tp_as_mapping */
-	0,								/* tp_hash */
+	(destructor) pgsource_dealloc,		/* tp_dealloc */
+	(printfunc) pgsource_print, /* tp_print */
+	(getattrfunc) pgsource_getattr,		/* tp_getattr */
+	(setattrfunc) pgsource_setattr,		/* tp_setattr */
+	0,							/* tp_compare */
+	0,							/* tp_repr */
+	0,							/* tp_as_number */
+	0,							/* tp_as_sequence */
+	0,							/* tp_as_mapping */
+	0,							/* tp_hash */
 };
 
 /* --------------------------------------------------------------------- */
@@ -973,7 +979,7 @@ staticforward PyTypeObject PgSourceType = {
 static pglargeobject *
 pglarge_new(pgobject * pgcnx, Oid oid)
 {
-	pglargeobject * npglo;
+	pglargeobject *npglo;
 
 	if ((npglo = PyObject_NEW(pglargeobject, &PglargeType)) == NULL)
 		return NULL;
@@ -999,13 +1005,14 @@ pglarge_dealloc(pglargeobject * self)
 
 /* opens large object */
 static char pglarge_open__doc__[] =
-	"open(mode) -- open access to large object with specified mode "
-	"(INV_READ, INV_WRITE constants defined by module).";
+"open(mode) -- open access to large object with specified mode "
+"(INV_READ, INV_WRITE constants defined by module).";
 
 static PyObject *
 pglarge_open(pglargeobject * self, PyObject * args)
 {
-	int		mode, fd;
+	int			mode,
+				fd;
 
 	/* check validity */
 	if (!check_lo_obj(self, CHECK_CLOSE))
@@ -1033,7 +1040,7 @@ pglarge_open(pglargeobject * self, PyObject * args)
 
 /* close large object */
 static char pglarge_close__doc__[] =
-	"close() -- close access to large object data.";
+"close() -- close access to large object data.";
 
 static PyObject *
 pglarge_close(pglargeobject * self, PyObject * args)
@@ -1042,7 +1049,7 @@ pglarge_close(pglargeobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method close() takes no parameters.");
+						"method close() takes no parameters.");
 		return NULL;
 	}
 
@@ -1065,14 +1072,14 @@ pglarge_close(pglargeobject * self, PyObject * args)
 
 /* reads from large object */
 static char pglarge_read__doc__[] =
-	"read(integer) -- read from large object to sized string. "
-	"Object must be opened in read mode before calling this method.";
+"read(integer) -- read from large object to sized string. "
+"Object must be opened in read mode before calling this method.";
 
 static PyObject *
 pglarge_read(pglargeobject * self, PyObject * args)
 {
 	int			size;
-	PyObject	*buffer;
+	PyObject   *buffer;
 
 	/* checks validity */
 	if (!check_lo_obj(self, CHECK_OPEN))
@@ -1108,14 +1115,15 @@ pglarge_read(pglargeobject * self, PyObject * args)
 
 /* write to large object */
 static char pglarge_write__doc__[] =
-	"write(string) -- write sized string to large object. "
-	"Object must be opened in read mode before calling this method.";
+"write(string) -- write sized string to large object. "
+"Object must be opened in read mode before calling this method.";
 
 static PyObject *
 pglarge_write(pglargeobject * self, PyObject * args)
 {
-	char	*buffer;
-	int		size, bufsize;
+	char	   *buffer;
+	int			size,
+				bufsize;
 
 	/* checks validity */
 	if (!check_lo_obj(self, CHECK_OPEN))
@@ -1125,13 +1133,13 @@ pglarge_write(pglargeobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "s#", &buffer, &bufsize))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"write(buffer), with buffer (sized string).");
+						"write(buffer), with buffer (sized string).");
 		return NULL;
 	}
 
 	/* sends query */
 	if ((size = lo_write(self->pgcnx->cnx, self->lo_fd, buffer,
-					bufsize)) < bufsize)
+						 bufsize)) < bufsize)
 	{
 		PyErr_SetString(PyExc_IOError, "buffer truncated during write.");
 		return NULL;
@@ -1144,15 +1152,17 @@ pglarge_write(pglargeobject * self, PyObject * args)
 
 /* go to position in large object */
 static char pglarge_seek__doc__[] =
-	"seek(off, whence) -- move to specified position. Object must be opened "
-	"before calling this method. whence can be SEEK_SET, SEEK_CUR or SEEK_END, "
-	"constants defined by module.";
+"seek(off, whence) -- move to specified position. Object must be opened "
+"before calling this method. whence can be SEEK_SET, SEEK_CUR or SEEK_END, "
+"constants defined by module.";
 
 static PyObject *
 pglarge_lseek(pglargeobject * self, PyObject * args)
 {
 	/* offset and whence are initialized to keep compiler happy */
-	int		ret, offset = 0, whence = 0;
+	int			ret,
+				offset = 0,
+				whence = 0;
 
 	/* checks validity */
 	if (!check_lo_obj(self, CHECK_OPEN))
@@ -1162,7 +1172,7 @@ pglarge_lseek(pglargeobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "ii", &offset, &whence))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"lseek(offset, whence), with offset and whence (integers).");
+			"lseek(offset, whence), with offset and whence (integers).");
 		return NULL;
 	}
 
@@ -1179,19 +1189,20 @@ pglarge_lseek(pglargeobject * self, PyObject * args)
 
 /* gets large object size */
 static char pglarge_size__doc__[] =
-	"size() -- return large object size. "
-	"Object must be opened before calling this method.";
+"size() -- return large object size. "
+"Object must be opened before calling this method.";
 
 static PyObject *
 pglarge_size(pglargeobject * self, PyObject * args)
 {
-	int		start, end;
+	int			start,
+				end;
 
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method size() takes no parameters.");
+						"method size() takes no parameters.");
 		return NULL;
 	}
 
@@ -1214,10 +1225,10 @@ pglarge_size(pglargeobject * self, PyObject * args)
 	}
 
 	/* move back to start position */
-	if ((start = lo_lseek(self->pgcnx->cnx,self->lo_fd,start,SEEK_SET)) == -1)
+	if ((start = lo_lseek(self->pgcnx->cnx, self->lo_fd, start, SEEK_SET)) == -1)
 	{
 		PyErr_SetString(PyExc_IOError,
-				"error while moving back to first position.");
+						"error while moving back to first position.");
 		return NULL;
 	}
 
@@ -1227,19 +1238,19 @@ pglarge_size(pglargeobject * self, PyObject * args)
 
 /* gets large object cursor position */
 static char pglarge_tell__doc__[] =
-	"tell() -- give current position in large object. "
-	"Object must be opened before calling this method.";
+"tell() -- give current position in large object. "
+"Object must be opened before calling this method.";
 
 static PyObject *
 pglarge_tell(pglargeobject * self, PyObject * args)
 {
-	int		start;
+	int			start;
 
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method tell() takes no parameters.");
+						"method tell() takes no parameters.");
 		return NULL;
 	}
 
@@ -1260,13 +1271,13 @@ pglarge_tell(pglargeobject * self, PyObject * args)
 
 /* exports large object as unix file */
 static char pglarge_export__doc__[] =
-	"export(string) -- export large object data to specified file. "
-	"Object must be closed when calling this method.";
+"export(string) -- export large object data to specified file. "
+"Object must be closed when calling this method.";
 
 static PyObject *
 pglarge_export(pglargeobject * self, PyObject * args)
 {
-	char	*name;
+	char	   *name;
 
 	/* checks validity */
 	if (!check_lo_obj(self, CHECK_CLOSE))
@@ -1276,7 +1287,7 @@ pglarge_export(pglargeobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "s", &name))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"export(filename), with filename (string).");
+						"export(filename), with filename (string).");
 		return NULL;
 	}
 
@@ -1293,8 +1304,8 @@ pglarge_export(pglargeobject * self, PyObject * args)
 
 /* deletes a large object */
 static char pglarge_unlink__doc__[] =
-	"unlink() -- destroy large object. "
-	"Object must be closed when calling this method.";
+"unlink() -- destroy large object. "
+"Object must be closed when calling this method.";
 
 static PyObject *
 pglarge_unlink(pglargeobject * self, PyObject * args)
@@ -1303,7 +1314,7 @@ pglarge_unlink(pglargeobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method unlink() takes no parameters.");
+						"method unlink() takes no parameters.");
 		return NULL;
 	}
 
@@ -1325,15 +1336,15 @@ pglarge_unlink(pglargeobject * self, PyObject * args)
 
 /* large object methods */
 static struct PyMethodDef pglarge_methods[] = {
-	{"open",	(PyCFunction) pglarge_open, 1, pglarge_open__doc__ },
-	{"close",	(PyCFunction) pglarge_close, 1, pglarge_close__doc__ },
-	{"read",	(PyCFunction) pglarge_read, 1, pglarge_read__doc__ },
-	{"write",	(PyCFunction) pglarge_write, 1, pglarge_write__doc__ },
-	{"seek",	(PyCFunction) pglarge_lseek, 1, pglarge_seek__doc__ },
-	{"size",	(PyCFunction) pglarge_size, 1, pglarge_size__doc__ },
-	{"tell",	(PyCFunction) pglarge_tell, 1, pglarge_tell__doc__ },
-	{"export",	(PyCFunction) pglarge_export, 1, pglarge_export__doc__ },
-	{"unlink",	(PyCFunction) pglarge_unlink, 1, pglarge_unlink__doc__ },
+	{"open", (PyCFunction) pglarge_open, 1, pglarge_open__doc__},
+	{"close", (PyCFunction) pglarge_close, 1, pglarge_close__doc__},
+	{"read", (PyCFunction) pglarge_read, 1, pglarge_read__doc__},
+	{"write", (PyCFunction) pglarge_write, 1, pglarge_write__doc__},
+	{"seek", (PyCFunction) pglarge_lseek, 1, pglarge_seek__doc__},
+	{"size", (PyCFunction) pglarge_size, 1, pglarge_size__doc__},
+	{"tell", (PyCFunction) pglarge_tell, 1, pglarge_tell__doc__},
+	{"export", (PyCFunction) pglarge_export, 1, pglarge_export__doc__},
+	{"unlink", (PyCFunction) pglarge_unlink, 1, pglarge_unlink__doc__},
 	{NULL, NULL}
 };
 
@@ -1373,7 +1384,7 @@ pglarge_getattr(pglargeobject * self, char *name)
 	/* attributes list */
 	if (!strcmp(name, "__members__"))
 	{
-		PyObject	*list = PyList_New(3);
+		PyObject   *list = PyList_New(3);
 
 		if (list)
 		{
@@ -1401,16 +1412,16 @@ pglarge_getattr(pglargeobject * self, char *name)
 static int
 pglarge_print(pglargeobject * self, FILE *fp, int flags)
 {
-	char print_buffer[128];
+	char		print_buffer[128];
 
 	if (self->lo_fd >= 0)
 	{
 #ifdef	NO_SNPRINTF
 		sprintf(print_buffer,
-			"Opened large object, oid %ld", (long)self->lo_oid);
+				"Opened large object, oid %ld", (long) self->lo_oid);
 #else
 		snprintf(print_buffer, sizeof(print_buffer),
-			"Opened large object, oid %ld", (long)self->lo_oid);
+				 "Opened large object, oid %ld", (long) self->lo_oid);
 #endif
 		fputs(print_buffer, fp);
 	}
@@ -1418,10 +1429,10 @@ pglarge_print(pglargeobject * self, FILE *fp, int flags)
 	{
 #ifdef	NO_SNPRINTF
 		sprintf(print_buffer,
-			"Closed large object, oid %ld", (long)self->lo_oid);
+				"Closed large object, oid %ld", (long) self->lo_oid);
 #else
 		snprintf(print_buffer, sizeof(print_buffer),
-			"Closed large object, oid %ld", (long)self->lo_oid);
+				 "Closed large object, oid %ld", (long) self->lo_oid);
 #endif
 		fputs(print_buffer, fp);
 	}
@@ -1432,25 +1443,25 @@ pglarge_print(pglargeobject * self, FILE *fp, int flags)
 /* object type definition */
 staticforward PyTypeObject PglargeType = {
 	PyObject_HEAD_INIT(NULL)
-	0,								/* ob_size */
-	"pglarge",						/* tp_name */
-	sizeof(pglargeobject),			/* tp_basicsize */
-	0,								/* tp_itemsize */
+	0,							/* ob_size */
+	"pglarge",					/* tp_name */
+	sizeof(pglargeobject),		/* tp_basicsize */
+	0,							/* tp_itemsize */
 
 	/* methods */
-	(destructor) pglarge_dealloc,	/* tp_dealloc */
-	(printfunc) pglarge_print,		/* tp_print */
-	(getattrfunc) pglarge_getattr,	/* tp_getattr */
-	0,								/* tp_setattr */
-	0,								/* tp_compare */
-	0,								/* tp_repr */
-	0,								/* tp_as_number */
-	0,								/* tp_as_sequence */
-	0,								/* tp_as_mapping */
-	0,								/* tp_hash */
+	(destructor) pglarge_dealloc,		/* tp_dealloc */
+	(printfunc) pglarge_print,	/* tp_print */
+	(getattrfunc) pglarge_getattr,		/* tp_getattr */
+	0,							/* tp_setattr */
+	0,							/* tp_compare */
+	0,							/* tp_repr */
+	0,							/* tp_as_number */
+	0,							/* tp_as_sequence */
+	0,							/* tp_as_mapping */
+	0,							/* tp_hash */
 };
 
-#endif							/* LARGE_OBJECTS */
+#endif	 /* LARGE_OBJECTS */
 
 
 /* --------------------------------------------------------------------- */
@@ -1458,29 +1469,35 @@ staticforward PyTypeObject PglargeType = {
 
 /* connects to a database */
 static char connect__doc__[] =
-	"connect(dbname, host, port, opt, tty) -- connect to a PostgreSQL database "
-	"using specified parameters (optionals, keywords aware).";
+"connect(dbname, host, port, opt, tty) -- connect to a PostgreSQL database "
+"using specified parameters (optionals, keywords aware).";
 
 static PyObject *
-pgconnect(pgobject *self, PyObject *args, PyObject *dict)
-{
-	static const char	*kwlist[] = { "dbname", "host", "port", "opt",
-									"tty", "user", "passwd" , NULL };
-	char				*pghost, *pgopt, *pgtty, *pgdbname, *pguser, *pgpasswd;
-	int					pgport;
-	char				port_buffer[20];
-	pgobject			*npgobj;
+pgconnect(pgobject * self, PyObject * args, PyObject * dict)
+{
+	static const char *kwlist[] = {"dbname", "host", "port", "opt",
+	"tty", "user", "passwd", NULL};
+	char	   *pghost,
+			   *pgopt,
+			   *pgtty,
+			   *pgdbname,
+			   *pguser,
+			   *pgpasswd;
+	int			pgport;
+	char		port_buffer[20];
+	pgobject   *npgobj;
 
 	pghost = pgopt = pgtty = pgdbname = pguser = pgpasswd = NULL;
 	pgport = -1;
 
-	/* parses standard arguments
-	 * With the right compiler warnings, this will issue a diagnostic.
-	 * There is really no way around it.  If I don't declare kwlist as
-	 * const char *kwlist[] then it complains when I try to assign all
-	 * those constant strings to it. */
+	/*
+	 * parses standard arguments With the right compiler warnings, this
+	 * will issue a diagnostic. There is really no way around it.  If I
+	 * don't declare kwlist as const char *kwlist[] then it complains when
+	 * I try to assign all those constant strings to it.
+	 */
 	if (!PyArg_ParseTupleAndKeywords(args, dict, "|zzlzzzz", (char **) kwlist,
-			&pgdbname, &pghost, &pgport, &pgopt, &pgtty, &pguser, &pgpasswd))
+		&pgdbname, &pghost, &pgport, &pgopt, &pgtty, &pguser, &pgpasswd))
 		return NULL;
 
 #ifdef DEFAULT_VARS
@@ -1505,9 +1522,9 @@ pgconnect(pgobject *self, PyObject *args, PyObject *dict)
 
 	if ((!pgpasswd) && (pg_default_passwd != Py_None))
 		pgpasswd = PyString_AsString(pg_default_passwd);
-#endif							/* DEFAULT_VARS */
+#endif	 /* DEFAULT_VARS */
 
-	if ((npgobj = (pgobject*)pgobject_New()) == NULL)
+	if ((npgobj = (pgobject *) pgobject_New()) == NULL)
 		return NULL;
 
 	if (pgport != -1)
@@ -1515,11 +1532,11 @@ pgconnect(pgobject *self, PyObject *args, PyObject *dict)
 		memset(port_buffer, 0, sizeof(port_buffer));
 		sprintf(port_buffer, "%d", pgport);
 		npgobj->cnx = PQsetdbLogin(pghost, port_buffer, pgopt, pgtty, pgdbname,
-					pguser, pgpasswd);
+								   pguser, pgpasswd);
 	}
 	else
 		npgobj->cnx = PQsetdbLogin(pghost, NULL, pgopt, pgtty, pgdbname,
-					pguser, pgpasswd);
+								   pguser, pgpasswd);
 
 	if (PQstatus(npgobj->cnx) == CONNECTION_BAD)
 	{
@@ -1545,12 +1562,12 @@ pg_dealloc(pgobject * self)
 
 /* close without deleting */
 static char pg_close__doc__[] =
-	"close() -- close connection. All instances of the connection object and "
-	"derived objects (queries and large objects) can no longer be used after "
-	"this call.";
+"close() -- close connection. All instances of the connection object and "
+"derived objects (queries and large objects) can no longer be used after "
+"this call.";
 
 static PyObject *
-pg_close(pgobject *self, PyObject *args)
+pg_close(pgobject * self, PyObject * args)
 {
 	/* gets args */
 	if (!PyArg_ParseTuple(args, ""))
@@ -1578,9 +1595,9 @@ pgquery_dealloc(pgqueryobject * self)
 
 /* resets connection */
 static char pg_reset__doc__[] =
-	"reset() -- reset connection with current parameters. All derived queries "
-	"and large objects derived from this connection will not be usable after "
-	"this call.";
+"reset() -- reset connection with current parameters. All derived queries "
+"and large objects derived from this connection will not be usable after "
+"this call.";
 
 static PyObject *
 pg_reset(pgobject * self, PyObject * args)
@@ -1595,7 +1612,7 @@ pg_reset(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method reset() takes no parameters.");
+						"method reset() takes no parameters.");
 		return NULL;
 	}
 
@@ -1607,7 +1624,7 @@ pg_reset(pgobject * self, PyObject * args)
 
 /* get connection socket */
 static char pg_fileno__doc__[] =
-	"fileno() -- return database connection socket file handle.";
+"fileno() -- return database connection socket file handle.";
 
 static PyObject *
 pg_fileno(pgobject * self, PyObject * args)
@@ -1622,7 +1639,7 @@ pg_fileno(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method fileno() takes no parameters.");
+						"method fileno() takes no parameters.");
 		return NULL;
 	}
 
@@ -1635,7 +1652,7 @@ pg_fileno(pgobject * self, PyObject * args)
 
 /* get number of rows */
 static char pgquery_ntuples__doc__[] =
-	"ntuples() -- returns number of tuples returned by query.";
+"ntuples() -- returns number of tuples returned by query.";
 
 static PyObject *
 pgquery_ntuples(pgqueryobject * self, PyObject * args)
@@ -1644,7 +1661,7 @@ pgquery_ntuples(pgqueryobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-			"method ntuples() takes no parameters.");
+						"method ntuples() takes no parameters.");
 		return NULL;
 	}
 
@@ -1653,20 +1670,22 @@ pgquery_ntuples(pgqueryobject * self, PyObject * args)
 
 /* list fields names from query result */
 static char pgquery_listfields__doc__[] =
-	"listfields() -- Lists field names from result.";
+"listfields() -- Lists field names from result.";
 
 static PyObject *
 pgquery_listfields(pgqueryobject * self, PyObject * args)
 {
-	int			i, n;
-	char		*name;
-	PyObject	*fieldstuple, *str;
+	int			i,
+				n;
+	char	   *name;
+	PyObject   *fieldstuple,
+			   *str;
 
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method listfields() takes no parameters.");
+						"method listfields() takes no parameters.");
 		return NULL;
 	}
 
@@ -1686,19 +1705,19 @@ pgquery_listfields(pgqueryobject * self, PyObject * args)
 
 /* get field name from last result */
 static char pgquery_fieldname__doc__[] =
-	"fieldname() -- returns name of field from result from its position.";
+"fieldname() -- returns name of field from result from its position.";
 
 static PyObject *
 pgquery_fieldname(pgqueryobject * self, PyObject * args)
 {
-	int		i;
-	char	*name;
+	int			i;
+	char	   *name;
 
 	/* gets args */
 	if (!PyArg_ParseTuple(args, "i", &i))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"fieldname(number), with number(integer).");
+						"fieldname(number), with number(integer).");
 		return NULL;
 	}
 
@@ -1716,13 +1735,13 @@ pgquery_fieldname(pgqueryobject * self, PyObject * args)
 
 /* gets fields number from name in last result */
 static char pgquery_fieldnum__doc__[] =
-	"fieldnum() -- returns position in query for field from its name.";
+"fieldnum() -- returns position in query for field from its name.";
 
 static PyObject *
 pgquery_fieldnum(pgqueryobject * self, PyObject * args)
 {
-	char	*name;
-	int		num;
+	char	   *name;
+	int			num;
 
 	/* gets args */
 	if (!PyArg_ParseTuple(args, "s", &name))
@@ -1743,21 +1762,27 @@ pgquery_fieldnum(pgqueryobject * self, PyObject * args)
 
 /* retrieves last result */
 static char pgquery_getresult__doc__[] =
-	"getresult() -- Gets the result of a query.  The result is returned "
-	"as a list of rows, each one a list of fields in the order returned "
-	"by the server.";
+"getresult() -- Gets the result of a query.  The result is returned "
+"as a list of rows, each one a list of fields in the order returned "
+"by the server.";
 
 static PyObject *
 pgquery_getresult(pgqueryobject * self, PyObject * args)
 {
-	PyObject	*rowtuple, *reslist, *val;
-	int			i, j, m, n, *typ;
+	PyObject   *rowtuple,
+			   *reslist,
+			   *val;
+	int			i,
+				j,
+				m,
+				n,
+			   *typ;
 
 	/* checks args (args == NULL for an internal call) */
 	if ((args != NULL) && (!PyArg_ParseTuple(args, "")))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method getresult() takes no parameters.");
+						"method getresult() takes no parameters.");
 		return NULL;
 	}
 
@@ -1808,44 +1833,46 @@ pgquery_getresult(pgqueryobject * self, PyObject * args)
 
 		for (j = 0; j < n; j++)
 		{
-			int		k;
-			char	*s = PQgetvalue(self->last_result, i, j);
-			char	cashbuf[64];
+			int			k;
+			char	   *s = PQgetvalue(self->last_result, i, j);
+			char		cashbuf[64];
 
 			if (PQgetisnull(self->last_result, i, j))
 			{
 				Py_INCREF(Py_None);
 				val = Py_None;
 			}
-			else switch (typ[j])
-			{
-				case 1:
-					val = PyInt_FromLong(strtol(s, NULL, 10));
-					break;
+			else
+				switch (typ[j])
+				{
+					case 1:
+						val = PyInt_FromLong(strtol(s, NULL, 10));
+						break;
 
-				case 2:
-					val = PyFloat_FromDouble(strtod(s, NULL));
-					break;
+					case 2:
+						val = PyFloat_FromDouble(strtod(s, NULL));
+						break;
 
-				case 3:		/* get rid of the '$' and commas */
-					if (*s == '$')	/* there's talk of getting rid of it */
-						s++;
+					case 3:		/* get rid of the '$' and commas */
+						if (*s == '$')	/* there's talk of getting rid of
+										 * it */
+							s++;
 
-					if ((s[0] == '-' || s[0] == '(') && s[1] == '$')
-						*(++s) = '-';
+						if ((s[0] == '-' || s[0] == '(') && s[1] == '$')
+							*(++s) = '-';
 
-					for (k = 0; *s; s++)
-						if (*s != ',')
-							cashbuf[k++] = *s;
+						for (k = 0; *s; s++)
+							if (*s != ',')
+								cashbuf[k++] = *s;
 
-					cashbuf[k] = 0;
-					val = PyFloat_FromDouble(strtod(cashbuf, NULL));
-					break;
+						cashbuf[k] = 0;
+						val = PyFloat_FromDouble(strtod(cashbuf, NULL));
+						break;
 
-				default:
-					val = PyString_FromString(s);
-					break;
-			}
+					default:
+						val = PyString_FromString(s);
+						break;
+				}
 
 			if (val == NULL)
 			{
@@ -1870,21 +1897,27 @@ exit:
 
 /* retrieves last result as a list of dictionaries*/
 static char pgquery_dictresult__doc__[] =
-	"dictresult() -- Gets the result of a query.  The result is returned "
-	"as a list of rows, each one a dictionary with the field names used "
-	"as the labels.";
+"dictresult() -- Gets the result of a query.  The result is returned "
+"as a list of rows, each one a dictionary with the field names used "
+"as the labels.";
 
 static PyObject *
 pgquery_dictresult(pgqueryobject * self, PyObject * args)
 {
-	PyObject	*dict, *reslist, *val;
-	int			i, j, m, n, *typ;
+	PyObject   *dict,
+			   *reslist,
+			   *val;
+	int			i,
+				j,
+				m,
+				n,
+			   *typ;
 
 	/* checks args (args == NULL for an internal call) */
 	if ((args != NULL) && (!PyArg_ParseTuple(args, "")))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method getresult() takes no parameters.");
+						"method getresult() takes no parameters.");
 		return NULL;
 	}
 
@@ -1935,44 +1968,46 @@ pgquery_dictresult(pgqueryobject * self, PyObject * args)
 
 		for (j = 0; j < n; j++)
 		{
-			int		k;
-			char	*s = PQgetvalue(self->last_result, i, j);
-			char	cashbuf[64];
+			int			k;
+			char	   *s = PQgetvalue(self->last_result, i, j);
+			char		cashbuf[64];
 
 			if (PQgetisnull(self->last_result, i, j))
 			{
 				Py_INCREF(Py_None);
 				val = Py_None;
 			}
-			else switch (typ[j])
-			{
-				case 1:
-					val = PyInt_FromLong(strtol(s, NULL, 10));
-					break;
+			else
+				switch (typ[j])
+				{
+					case 1:
+						val = PyInt_FromLong(strtol(s, NULL, 10));
+						break;
 
-				case 2:
-					val = PyFloat_FromDouble(strtod(s, NULL));
-					break;
+					case 2:
+						val = PyFloat_FromDouble(strtod(s, NULL));
+						break;
 
-				case 3:		/* get rid of the '$' and commas */
-					if (*s == '$')	/* there's talk of getting rid of it */
-						s++;
+					case 3:		/* get rid of the '$' and commas */
+						if (*s == '$')	/* there's talk of getting rid of
+										 * it */
+							s++;
 
-					if ((s[0] == '-' || s[0] == '(') && s[1] == '$')
-						*(++s) = '-';
+						if ((s[0] == '-' || s[0] == '(') && s[1] == '$')
+							*(++s) = '-';
 
-					for (k = 0; *s; s++)
-						if (*s != ',')
-							cashbuf[k++] = *s;
+						for (k = 0; *s; s++)
+							if (*s != ',')
+								cashbuf[k++] = *s;
 
-					cashbuf[k] = 0;
-					val = PyFloat_FromDouble(strtod(cashbuf, NULL));
-					break;
+						cashbuf[k] = 0;
+						val = PyFloat_FromDouble(strtod(cashbuf, NULL));
+						break;
 
-				default:
-					val = PyString_FromString(s);
-					break;
-			}
+					default:
+						val = PyString_FromString(s);
+						break;
+				}
 
 			if (val == NULL)
 			{
@@ -1998,14 +2033,15 @@ exit:
 
 /* gets asynchronous notify */
 static char pg_getnotify__doc__[] =
-	"getnotify() -- get database notify for this connection.";
+"getnotify() -- get database notify for this connection.";
 
 static PyObject *
 pg_getnotify(pgobject * self, PyObject * args)
 {
-	PGnotify	*notify;
-	PGresult	*result;
-	PyObject	*notify_result, *temp;
+	PGnotify   *notify;
+	PGresult   *result;
+	PyObject   *notify_result,
+			   *temp;
 
 	if (!self->cnx)
 	{
@@ -2017,17 +2053,21 @@ pg_getnotify(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method getnotify() takes no parameters.");
+						"method getnotify() takes no parameters.");
 		return NULL;
 	}
 
 	/* gets notify and builds result */
-	/* notifies only come back as result of a query, so I send an empty query */
+
+	/*
+	 * notifies only come back as result of a query, so I send an empty
+	 * query
+	 */
 	Py_BEGIN_ALLOW_THREADS
-	result = PQexec(self->cnx, " ");
+		result = PQexec(self->cnx, " ");
 	Py_END_ALLOW_THREADS
 
-	if ((notify = PQnotifies(self->cnx)) != NULL)
+		if ((notify = PQnotifies(self->cnx)) != NULL)
 	{
 		if ((notify_result = PyTuple_New(2)) == NULL)
 		{
@@ -2067,7 +2107,7 @@ pg_getnotify(pgobject * self, PyObject * args)
 
 /* source creation */
 static char pg_source__doc__[] =
-	"source() -- creates a new source object for this connection";
+"source() -- creates a new source object for this connection";
 
 static PyObject *
 pg_source(pgobject * self, PyObject * args)
@@ -2084,21 +2124,21 @@ pg_source(pgobject * self, PyObject * args)
 	}
 
 	/* allocate new pg query object */
-	return (PyObject *)pgsource_new(self);
+	return (PyObject *) pgsource_new(self);
 }
 
 /* database query */
 static char pg_query__doc__[] =
-	"query(sql) -- creates a new query object for this connection,"
-	" using sql (string) request.";
+"query(sql) -- creates a new query object for this connection,"
+" using sql (string) request.";
 
 static PyObject *
 pg_query(pgobject * self, PyObject * args)
 {
-	char			*query;
-	PGresult		*result;
-	pgqueryobject	*npgobj;
-	int				status;
+	char	   *query;
+	PGresult   *result;
+	pgqueryobject *npgobj;
+	int			status;
 
 	if (!self->cnx)
 	{
@@ -2122,11 +2162,11 @@ pg_query(pgobject * self, PyObject * args)
 
 	/* gets result */
 	Py_BEGIN_ALLOW_THREADS
-	result = PQexec(self->cnx, query);
+		result = PQexec(self->cnx, query);
 	Py_END_ALLOW_THREADS
 
 	/* checks result validity */
-	if (!result)
+		if (!result)
 	{
 		PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->cnx));
 		return NULL;
@@ -2135,7 +2175,7 @@ pg_query(pgobject * self, PyObject * args)
 	/* checks result status */
 	if ((status = PQresultStatus(result)) != PGRES_TUPLES_OK)
 	{
-		Oid		oid;
+		Oid			oid;
 
 		PQclear(result);
 
@@ -2149,7 +2189,7 @@ pg_query(pgobject * self, PyObject * args)
 			case PGRES_NONFATAL_ERROR:
 				PyErr_SetString(PGError, PQerrorMessage(self->cnx));
 				break;
-			case PGRES_COMMAND_OK:	/* could be an INSERT */
+			case PGRES_COMMAND_OK:		/* could be an INSERT */
 				if ((oid = PQoidValue(result)) == InvalidOid)	/* nope */
 				{
 					Py_INCREF(Py_None);
@@ -2159,13 +2199,13 @@ pg_query(pgobject * self, PyObject * args)
 				/* otherwise, return the oid */
 				return PyInt_FromLong(oid);
 
-			case PGRES_COPY_OUT:	/* no data will be received */
+			case PGRES_COPY_OUT:		/* no data will be received */
 			case PGRES_COPY_IN:
 				Py_INCREF(Py_None);
 				return Py_None;
 			default:
 				PyErr_SetString(PGError, "internal error: "
-											"unknown result status.");
+								"unknown result status.");
 				break;
 		}
 
@@ -2182,13 +2222,13 @@ pg_query(pgobject * self, PyObject * args)
 
 #ifdef DIRECT_ACCESS
 static char pg_putline__doc__[] =
-	"putline() -- sends a line directly to the backend";
+"putline() -- sends a line directly to the backend";
 
 /* direct acces function : putline */
 static PyObject *
 pg_putline(pgobject * self, PyObject * args)
 {
-	char	*line;
+	char	   *line;
 
 	if (!self->cnx)
 	{
@@ -2211,13 +2251,13 @@ pg_putline(pgobject * self, PyObject * args)
 
 /* direct access function : getline */
 static char pg_getline__doc__[] =
-	"getline() -- gets a line directly from the backend.";
+"getline() -- gets a line directly from the backend.";
 
 static PyObject *
 pg_getline(pgobject * self, PyObject * args)
 {
 	char		line[MAX_BUFFER_SIZE];
-	PyObject	*str = NULL; /* GCC */
+	PyObject   *str = NULL;		/* GCC */
 
 	if (!self->cnx)
 	{
@@ -2229,7 +2269,7 @@ pg_getline(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method getline() takes no parameters.");
+						"method getline() takes no parameters.");
 		return NULL;
 	}
 
@@ -2254,7 +2294,7 @@ pg_getline(pgobject * self, PyObject * args)
 
 /* direct access function : end copy */
 static char pg_endcopy__doc__[] =
-	"endcopy() -- synchronizes client and server";
+"endcopy() -- synchronizes client and server";
 
 static PyObject *
 pg_endcopy(pgobject * self, PyObject * args)
@@ -2269,7 +2309,7 @@ pg_endcopy(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method endcopy() takes no parameters.");
+						"method endcopy() takes no parameters.");
 		return NULL;
 	}
 
@@ -2278,13 +2318,14 @@ pg_endcopy(pgobject * self, PyObject * args)
 	Py_INCREF(Py_None);
 	return Py_None;
 }
-#endif							/* DIRECT_ACCESS */
+
+#endif	 /* DIRECT_ACCESS */
 
 
 static PyObject *
-pgquery_print(pgqueryobject *self, FILE *fp, int flags)
+pgquery_print(pgqueryobject * self, FILE *fp, int flags)
 {
-	PQprintOpt		op;
+	PQprintOpt	op;
 
 	memset(&op, 0, sizeof(op));
 	op.align = 1;
@@ -2296,26 +2337,31 @@ pgquery_print(pgqueryobject *self, FILE *fp, int flags)
 }
 
 static PyObject *
-pgquery_repr(pgqueryobject *self)
+pgquery_repr(pgqueryobject * self)
 {
 	return PyString_FromString("<pg query result>");
 }
 
 /* insert table */
 static char pg_inserttable__doc__[] =
-	"inserttable(string, list) -- insert list in table. The fields in the "
-	"list must be in the same order as in the table.";
+"inserttable(string, list) -- insert list in table. The fields in the "
+"list must be in the same order as in the table.";
 
 static PyObject *
 pg_inserttable(pgobject * self, PyObject * args)
 {
-	PGresult	*result;
-	char		*table, *buffer, *temp;
+	PGresult   *result;
+	char	   *table,
+			   *buffer,
+			   *temp;
 	char		temp_buffer[256];
-	PyObject	*list, *sublist, *item;
-	PyObject	*(*getitem) (PyObject *, int);
-	PyObject	*(*getsubitem) (PyObject *, int);
-	int			i, j;
+	PyObject   *list,
+			   *sublist,
+			   *item;
+	PyObject   *(*getitem) (PyObject *, int);
+	PyObject   *(*getsubitem) (PyObject *, int);
+	int			i,
+				j;
 
 	if (!self->cnx)
 	{
@@ -2327,8 +2373,8 @@ pg_inserttable(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "sO:filter", &table, &list))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"tableinsert(table, content), with table (string) "
-					"and content (list).");
+					  "tableinsert(table, content), with table (string) "
+						"and content (list).");
 		return NULL;
 	}
 
@@ -2340,7 +2386,7 @@ pg_inserttable(pgobject * self, PyObject * args)
 	else
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"second arg must be some kind of array.");
+						"second arg must be some kind of array.");
 		return NULL;
 	}
 
@@ -2350,7 +2396,7 @@ pg_inserttable(pgobject * self, PyObject * args)
 		if (!PyTuple_Check(sublist) && !PyList_Check(sublist))
 		{
 			PyErr_SetString(PyExc_TypeError,
-					"second arg must contain some kind of arrays.");
+						 "second arg must contain some kind of arrays.");
 			return NULL;
 		}
 	}
@@ -2366,10 +2412,10 @@ pg_inserttable(pgobject * self, PyObject * args)
 	sprintf(buffer, "copy %s from stdin", table);
 
 	Py_BEGIN_ALLOW_THREADS
-	result = PQexec(self->cnx, buffer);
+		result = PQexec(self->cnx, buffer);
 	Py_END_ALLOW_THREADS
 
-	if (!result)
+		if (!result)
 	{
 		free(buffer);
 		PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->cnx));
@@ -2396,7 +2442,7 @@ pg_inserttable(pgobject * self, PyObject * args)
 				temp = PyString_AS_STRING(item);
 			else if (PyInt_Check(item))
 			{
-				long	k;
+				long		k;
 
 				k = PyInt_AsLong(item);
 				sprintf(temp_buffer, "%ld", k);
@@ -2404,7 +2450,7 @@ pg_inserttable(pgobject * self, PyObject * args)
 			}
 			else if (PyLong_Check(item))
 			{
-				long	k;
+				long		k;
 
 				k = PyLong_AsLong(item);
 				sprintf(temp_buffer, "%ld", k);
@@ -2412,7 +2458,7 @@ pg_inserttable(pgobject * self, PyObject * args)
 			}
 			else if (PyFloat_Check(item))
 			{
-				double	k;
+				double		k;
 
 				k = PyFloat_AS_DOUBLE(item);
 				sprintf(temp_buffer, "%g", k);
@@ -2422,8 +2468,8 @@ pg_inserttable(pgobject * self, PyObject * args)
 			{
 				free(buffer);
 				PyErr_SetString(PyExc_ValueError,
-						"items must be strings, integers, "
-							"longs or double (real).");
+								"items must be strings, integers, "
+								"longs or double (real).");
 				return NULL;
 			}
 
@@ -2453,13 +2499,13 @@ pg_inserttable(pgobject * self, PyObject * args)
 
 /* creates large object */
 static char pg_locreate__doc__[] =
-	"locreate() -- creates a new large object in the database.";
+"locreate() -- creates a new large object in the database.";
 
 static PyObject *
 pg_locreate(pgobject * self, PyObject * args)
 {
-	int		mode;
-	Oid		lo_oid;
+	int			mode;
+	Oid			lo_oid;
 
 	/* checks validity */
 	if (!check_cnx_obj(self))
@@ -2469,7 +2515,7 @@ pg_locreate(pgobject * self, PyObject * args)
 	if (!PyArg_ParseTuple(args, "i", &mode))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"locreate(mode), with mode (integer).");
+						"locreate(mode), with mode (integer).");
 		return NULL;
 	}
 
@@ -2486,12 +2532,12 @@ pg_locreate(pgobject * self, PyObject * args)
 
 /* init from already known oid */
 static char pg_getlo__doc__[] =
-	"getlo(long) -- create a large object instance for the specified oid.";
+"getlo(long) -- create a large object instance for the specified oid.";
 
 static PyObject *
 pg_getlo(pgobject * self, PyObject * args)
 {
-	int		lo_oid;
+	int			lo_oid;
 
 	/* checks validity */
 	if (!check_cnx_obj(self))
@@ -2516,13 +2562,13 @@ pg_getlo(pgobject * self, PyObject * args)
 
 /* import unix file */
 static char pg_loimport__doc__[] =
-	"loimport(string) -- create a new large object from specified file.";
+"loimport(string) -- create a new large object from specified file.";
 
 static PyObject *
 pg_loimport(pgobject * self, PyObject * args)
 {
-	char	*name;
-	Oid		lo_oid;
+	char	   *name;
+	Oid			lo_oid;
 
 	/* checks validity */
 	if (!check_cnx_obj(self))
@@ -2549,25 +2595,25 @@ pg_loimport(pgobject * self, PyObject * args)
 
 /* connection object methods */
 static struct PyMethodDef pgobj_methods[] = {
-	{"source",		(PyCFunction) pg_source, 1, pg_source__doc__ },
-	{"query",		(PyCFunction) pg_query, 1, pg_query__doc__ },
-	{"reset",		(PyCFunction) pg_reset, 1, pg_reset__doc__ },
-	{"close",		(PyCFunction) pg_close, 1, pg_close__doc__ },
-	{"fileno",		(PyCFunction) pg_fileno,1, pg_fileno__doc__ },
-	{"getnotify",	(PyCFunction) pg_getnotify, 1, pg_getnotify__doc__ },
-	{"inserttable",	(PyCFunction) pg_inserttable, 1, pg_inserttable__doc__ },
+	{"source", (PyCFunction) pg_source, 1, pg_source__doc__},
+	{"query", (PyCFunction) pg_query, 1, pg_query__doc__},
+	{"reset", (PyCFunction) pg_reset, 1, pg_reset__doc__},
+	{"close", (PyCFunction) pg_close, 1, pg_close__doc__},
+	{"fileno", (PyCFunction) pg_fileno, 1, pg_fileno__doc__},
+	{"getnotify", (PyCFunction) pg_getnotify, 1, pg_getnotify__doc__},
+	{"inserttable", (PyCFunction) pg_inserttable, 1, pg_inserttable__doc__},
 
 #ifdef DIRECT_ACCESS
-	{"putline",		(PyCFunction) pg_putline, 1, pg_putline__doc__ },
-	{"getline",		(PyCFunction) pg_getline, 1, pg_getline__doc__ },
-	{"endcopy",		(PyCFunction) pg_endcopy, 1, pg_endcopy__doc__ },
-#endif							/* DIRECT_ACCESS */
+	{"putline", (PyCFunction) pg_putline, 1, pg_putline__doc__},
+	{"getline", (PyCFunction) pg_getline, 1, pg_getline__doc__},
+	{"endcopy", (PyCFunction) pg_endcopy, 1, pg_endcopy__doc__},
+#endif	 /* DIRECT_ACCESS */
 
 #ifdef LARGE_OBJECTS
-	{"locreate",	(PyCFunction) pg_locreate, 1, pg_locreate__doc__ },
-	{"getlo",		(PyCFunction) pg_getlo, 1, pg_getlo__doc__ },
-	{"loimport",	(PyCFunction) pg_loimport, 1, pg_loimport__doc__ },
-#endif							/* LARGE_OBJECTS */
+	{"locreate", (PyCFunction) pg_locreate, 1, pg_locreate__doc__},
+	{"getlo", (PyCFunction) pg_getlo, 1, pg_getlo__doc__},
+	{"loimport", (PyCFunction) pg_loimport, 1, pg_loimport__doc__},
+#endif	 /* LARGE_OBJECTS */
 
 	{NULL, NULL}				/* sentinel */
 };
@@ -2576,9 +2622,11 @@ static struct PyMethodDef pgobj_methods[] = {
 static PyObject *
 pg_getattr(pgobject * self, char *name)
 {
-	/* Although we could check individually, there are only a few
-	 * attributes that don't require a live connection and unless
-	 * someone has an urgent need, this will have to do
+
+	/*
+	 * Although we could check individually, there are only a few
+	 * attributes that don't require a live connection and unless someone
+	 * has an urgent need, this will have to do
 	 */
 	if (!self->cnx)
 	{
@@ -2591,7 +2639,8 @@ pg_getattr(pgobject * self, char *name)
 	/* postmaster host */
 	if (!strcmp(name, "host"))
 	{
-		char	*r = PQhost(self->cnx);
+		char	   *r = PQhost(self->cnx);
+
 		return r ? PyString_FromString(r) : PyString_FromString("localhost");
 	}
 
@@ -2622,12 +2671,12 @@ pg_getattr(pgobject * self, char *name)
 	/* provided user name */
 	if (!strcmp(name, "user"))
 		return PyString_FromString("Deprecated facility");
-		/* return PyString_FromString(fe_getauthname("<unknown user>")); */
+	/* return PyString_FromString(fe_getauthname("<unknown user>")); */
 
 	/* attributes list */
 	if (!strcmp(name, "__members__"))
 	{
-		PyObject	*list = PyList_New(8);
+		PyObject   *list = PyList_New(8);
 
 		if (list)
 		{
@@ -2670,12 +2719,12 @@ staticforward PyTypeObject PgType = {
 
 /* query object methods */
 static struct PyMethodDef pgquery_methods[] = {
-	{"getresult",	(PyCFunction) pgquery_getresult, 1, pgquery_getresult__doc__},
-	{"dictresult",	(PyCFunction) pgquery_dictresult, 1, pgquery_dictresult__doc__},
-	{"fieldname",	(PyCFunction) pgquery_fieldname, 1, pgquery_fieldname__doc__},
-	{"fieldnum",	(PyCFunction) pgquery_fieldnum, 1, pgquery_fieldnum__doc__},
-	{"listfields",	(PyCFunction) pgquery_listfields, 1, pgquery_listfields__doc__},
-	{"ntuples",		(PyCFunction) pgquery_ntuples, 1, pgquery_ntuples__doc__},
+	{"getresult", (PyCFunction) pgquery_getresult, 1, pgquery_getresult__doc__},
+	{"dictresult", (PyCFunction) pgquery_dictresult, 1, pgquery_dictresult__doc__},
+	{"fieldname", (PyCFunction) pgquery_fieldname, 1, pgquery_fieldname__doc__},
+	{"fieldnum", (PyCFunction) pgquery_fieldnum, 1, pgquery_fieldnum__doc__},
+	{"listfields", (PyCFunction) pgquery_listfields, 1, pgquery_listfields__doc__},
+	{"ntuples", (PyCFunction) pgquery_ntuples, 1, pgquery_ntuples__doc__},
 	{NULL, NULL}
 };
 
@@ -2690,21 +2739,21 @@ pgquery_getattr(pgqueryobject * self, char *name)
 /* query type definition */
 staticforward PyTypeObject PgQueryType = {
 	PyObject_HEAD_INIT(NULL)
-	0,								/* ob_size */
-	"pgqueryobject",				/* tp_name */
-	sizeof(pgqueryobject),			/* tp_basicsize */
-	0,								/* tp_itemsize */
+	0,							/* ob_size */
+	"pgqueryobject",			/* tp_name */
+	sizeof(pgqueryobject),		/* tp_basicsize */
+	0,							/* tp_itemsize */
 	/* methods */
-	(destructor) pgquery_dealloc,	/* tp_dealloc */
-	(printfunc) pgquery_print,		/* tp_print */
-	(getattrfunc) pgquery_getattr,	/* tp_getattr */
-	0,								/* tp_setattr */
-	0,								/* tp_compare */
-	(reprfunc) pgquery_repr,		/* tp_repr */
-	0,								/* tp_as_number */
-	0,								/* tp_as_sequence */
-	0,								/* tp_as_mapping */
-	0,								/* tp_hash */
+	(destructor) pgquery_dealloc,		/* tp_dealloc */
+	(printfunc) pgquery_print,	/* tp_print */
+	(getattrfunc) pgquery_getattr,		/* tp_getattr */
+	0,							/* tp_setattr */
+	0,							/* tp_compare */
+	(reprfunc) pgquery_repr,	/* tp_repr */
+	0,							/* tp_as_number */
+	0,							/* tp_as_sequence */
+	0,							/* tp_as_mapping */
+	0,							/* tp_hash */
 };
 
 
@@ -2717,16 +2766,16 @@ staticforward PyTypeObject PgQueryType = {
 
 /* gets default host */
 static char getdefhost__doc__[] =
-	"get_defhost() -- return default database host.";
+"get_defhost() -- return default database host.";
 
 static PyObject *
-pggetdefhost(PyObject *self, PyObject *args)
+pggetdefhost(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method get_defhost() takes no parameter.");
+						"method get_defhost() takes no parameter.");
 		return NULL;
 	}
 
@@ -2736,19 +2785,19 @@ pggetdefhost(PyObject *self, PyObject *args)
 
 /* sets default host */
 static char setdefhost__doc__[] =
-	"set_defhost(string) -- set default database host. Return previous value.";
+"set_defhost(string) -- set default database host. Return previous value.";
 
 static PyObject *
-pgsetdefhost(PyObject * self, PyObject *args)
+pgsetdefhost(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"set_defhost(name), with name (string/None).");
+						"set_defhost(name), with name (string/None).");
 		return NULL;
 	}
 
@@ -2768,16 +2817,16 @@ pgsetdefhost(PyObject * self, PyObject *args)
 
 /* gets default base */
 static char getdefbase__doc__[] =
-	"get_defbase() -- return default database name.";
+"get_defbase() -- return default database name.";
 
 static PyObject *
-pggetdefbase(PyObject * self, PyObject *args)
+pggetdefbase(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method get_defbase() takes no parameter.");
+						"method get_defbase() takes no parameter.");
 		return NULL;
 	}
 
@@ -2787,19 +2836,19 @@ pggetdefbase(PyObject * self, PyObject *args)
 
 /* sets default base */
 static char setdefbase__doc__[] =
-	"set_defbase(string) -- set default database name. Return previous value";
+"set_defbase(string) -- set default database name. Return previous value";
 
 static PyObject *
-pgsetdefbase(PyObject * self, PyObject *args)
+pgsetdefbase(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"set_defbase(name), with name (string/None).");
+						"set_defbase(name), with name (string/None).");
 		return NULL;
 	}
 
@@ -2819,16 +2868,16 @@ pgsetdefbase(PyObject * self, PyObject *args)
 
 /* gets default options */
 static char getdefopt__doc__[] =
-	"get_defopt() -- return default database options.";
+"get_defopt() -- return default database options.";
 
 static PyObject *
-pggetdefopt(PyObject * self, PyObject *args)
+pggetdefopt(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method get_defopt() takes no parameter.");
+						"method get_defopt() takes no parameter.");
 		return NULL;
 	}
 
@@ -2838,19 +2887,19 @@ pggetdefopt(PyObject * self, PyObject *args)
 
 /* sets default opt */
 static char setdefopt__doc__[] =
-	"set_defopt(string) -- set default database options. Return previous value.";
+"set_defopt(string) -- set default database options. Return previous value.";
 
 static PyObject *
-pgsetdefopt(PyObject * self, PyObject *args)
+pgsetdefopt(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"set_defopt(name), with name (string/None).");
+						"set_defopt(name), with name (string/None).");
 		return NULL;
 	}
 
@@ -2870,16 +2919,16 @@ pgsetdefopt(PyObject * self, PyObject *args)
 
 /* gets default tty */
 static char getdeftty__doc__[] =
-	"get_deftty() -- return default database debug terminal.";
+"get_deftty() -- return default database debug terminal.";
 
 static PyObject *
-pggetdeftty(PyObject * self, PyObject *args)
+pggetdeftty(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method get_deftty() takes no parameter.");
+						"method get_deftty() takes no parameter.");
 		return NULL;
 	}
 
@@ -2889,20 +2938,20 @@ pggetdeftty(PyObject * self, PyObject *args)
 
 /* sets default tty */
 static char setdeftty__doc__[] =
-	"set_deftty(string) -- set default database debug terminal. "
-	"Return previous value.";
+"set_deftty(string) -- set default database debug terminal. "
+"Return previous value.";
 
 static PyObject *
-pgsetdeftty(PyObject * self, PyObject *args)
+pgsetdeftty(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"set_deftty(name), with name (string/None).");
+						"set_deftty(name), with name (string/None).");
 		return NULL;
 	}
 
@@ -2922,16 +2971,16 @@ pgsetdeftty(PyObject * self, PyObject *args)
 
 /* gets default username */
 static char getdefuser__doc__[] =
-	"get_defuser() -- return default database username.";
+"get_defuser() -- return default database username.";
 
 static PyObject *
-pggetdefuser(PyObject * self, PyObject *args)
+pggetdefuser(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-			"method get_defuser() takes no parameter.");
+						"method get_defuser() takes no parameter.");
 
 		return NULL;
 	}
@@ -2942,19 +2991,19 @@ pggetdefuser(PyObject * self, PyObject *args)
 
 /* sets default username */
 static char setdefuser__doc__[] =
-	"set_defuser() -- set default database username. Return previous value.";
+"set_defuser() -- set default database username. Return previous value.";
 
 static PyObject *
-pgsetdefuser(PyObject * self, PyObject *args)
+pgsetdefuser(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
 	{
 		PyErr_SetString(PyExc_TypeError,
-				"set_defuser(name), with name (string/None).");
+						"set_defuser(name), with name (string/None).");
 		return NULL;
 	}
 
@@ -2974,13 +3023,13 @@ pgsetdefuser(PyObject * self, PyObject *args)
 
 /* sets default password */
 static char setdefpasswd__doc__[] =
-	"set_defpasswd() -- set default database password.";
+"set_defpasswd() -- set default database password.";
 
 static PyObject *
-pgsetdefpasswd(PyObject * self, PyObject *args)
+pgsetdefpasswd(PyObject * self, PyObject * args)
 {
-	char		*temp = NULL;
-	PyObject	*old;
+	char	   *temp = NULL;
+	PyObject   *old;
 
 	/* gets arguments */
 	if (!PyArg_ParseTuple(args, "z", &temp))
@@ -3007,16 +3056,16 @@ pgsetdefpasswd(PyObject * self, PyObject *args)
 
 /* gets default port */
 static char getdefport__doc__[] =
-	"get_defport() -- return default database port.";
+"get_defport() -- return default database port.";
 
 static PyObject *
-pggetdefport(PyObject * self, PyObject *args)
+pggetdefport(PyObject * self, PyObject * args)
 {
 	/* checks args */
 	if (!PyArg_ParseTuple(args, ""))
 	{
 		PyErr_SetString(PyExc_SyntaxError,
-				"method get_defport() takes no parameter.");
+						"method get_defport() takes no parameter.");
 		return NULL;
 	}
 
@@ -3026,19 +3075,19 @@ pggetdefport(PyObject * self, PyObject *args)
 
 /* sets default port */
 static char setdefport__doc__[] =
-	"set_defport(integer) -- set default database port. Return previous value.";
+"set_defport(integer) -- set default database port. Return previous value.";
 
 static PyObject *
-pgsetdefport(PyObject * self, PyObject *args)
+pgsetdefport(PyObject * self, PyObject * args)
 {
 	long int	port = -2;
-	PyObject	*old;
+	PyObject   *old;
 
 	/* gets arguments */
 	if ((!PyArg_ParseTuple(args, "l", &port)) || (port < -1))
 	{
 		PyErr_SetString(PyExc_TypeError, "set_defport(port), with port "
-					"(positive integer/-1).");
+						"(positive integer/-1).");
 		return NULL;
 	}
 
@@ -3056,28 +3105,28 @@ pgsetdefport(PyObject * self, PyObject *args)
 	return old;
 }
 
-#endif							/* DEFAULT_VARS */
+#endif	 /* DEFAULT_VARS */
 
 /* List of functions defined in the module */
 
 static struct PyMethodDef pg_methods[] = {
-	{"connect", (PyCFunction) pgconnect, 3, connect__doc__ },
+	{"connect", (PyCFunction) pgconnect, 3, connect__doc__},
 
 #ifdef DEFAULT_VARS
-	{"get_defhost",		pggetdefhost, 1, getdefhost__doc__ },
-	{"set_defhost",		pgsetdefhost, 1, setdefhost__doc__ },
-	{"get_defbase",		pggetdefbase, 1, getdefbase__doc__ },
-	{"set_defbase",		pgsetdefbase, 1, setdefbase__doc__ },
-	{"get_defopt",		pggetdefopt, 1, getdefopt__doc__ },
-	{"set_defopt",		pgsetdefopt, 1, setdefopt__doc__ },
-	{"get_deftty",		pggetdeftty, 1, getdeftty__doc__ },
-	{"set_deftty",		pgsetdeftty, 1, setdeftty__doc__ },
-	{"get_defport",		pggetdefport, 1, getdefport__doc__ },
-	{"set_defport",		pgsetdefport, 1, setdefport__doc__ },
-	{"get_defuser",		pggetdefuser, 1, getdefuser__doc__ },
-	{"set_defuser",		pgsetdefuser, 1, setdefuser__doc__ },
-	{"set_defpasswd",	pgsetdefpasswd, 1, setdefpasswd__doc__ },
-#endif							/* DEFAULT_VARS */
+	{"get_defhost", pggetdefhost, 1, getdefhost__doc__},
+	{"set_defhost", pgsetdefhost, 1, setdefhost__doc__},
+	{"get_defbase", pggetdefbase, 1, getdefbase__doc__},
+	{"set_defbase", pgsetdefbase, 1, setdefbase__doc__},
+	{"get_defopt", pggetdefopt, 1, getdefopt__doc__},
+	{"set_defopt", pgsetdefopt, 1, setdefopt__doc__},
+	{"get_deftty", pggetdeftty, 1, getdeftty__doc__},
+	{"set_deftty", pgsetdeftty, 1, setdeftty__doc__},
+	{"get_defport", pggetdefport, 1, getdefport__doc__},
+	{"set_defport", pgsetdefport, 1, setdefport__doc__},
+	{"get_defuser", pggetdefuser, 1, getdefuser__doc__},
+	{"set_defuser", pgsetdefuser, 1, setdefuser__doc__},
+	{"set_defpasswd", pgsetdefpasswd, 1, setdefpasswd__doc__},
+#endif	 /* DEFAULT_VARS */
 	{NULL, NULL}				/* sentinel */
 };
 
@@ -3087,7 +3136,9 @@ static char pg__doc__[] = "Python interface to PostgreSQL DB";
 DL_EXPORT(void)
 init_pg(void)
 {
-	PyObject	*mod, *dict, *v;
+	PyObject   *mod,
+			   *dict,
+			   *v;
 
 	/* Initialize here because some WIN platforms get confused otherwise */
 	PglargeType.ob_type = PgType.ob_type = PgQueryType.ob_type = &PyType_Type;
@@ -3121,18 +3172,25 @@ init_pg(void)
 	PyDict_SetItemString(dict, "SEEK_SET", PyInt_FromLong(SEEK_SET));
 	PyDict_SetItemString(dict, "SEEK_CUR", PyInt_FromLong(SEEK_CUR));
 	PyDict_SetItemString(dict, "SEEK_END", PyInt_FromLong(SEEK_END));
-#endif							/* LARGE_OBJECTS */
+#endif	 /* LARGE_OBJECTS */
 
 #ifdef DEFAULT_VARS
 	/* prepares default values */
-	Py_INCREF(Py_None); pg_default_host = Py_None;
-	Py_INCREF(Py_None); pg_default_base = Py_None;
-	Py_INCREF(Py_None); pg_default_opt = Py_None;
-	Py_INCREF(Py_None); pg_default_port = Py_None;
-	Py_INCREF(Py_None); pg_default_tty = Py_None;
-	Py_INCREF(Py_None); pg_default_user = Py_None;
-	Py_INCREF(Py_None); pg_default_passwd = Py_None;
-#endif							/* DEFAULT_VARS */
+	Py_INCREF(Py_None);
+	pg_default_host = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_base = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_opt = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_port = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_tty = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_user = Py_None;
+	Py_INCREF(Py_None);
+	pg_default_passwd = Py_None;
+#endif	 /* DEFAULT_VARS */
 
 	/* Check for errors */
 	if (PyErr_Occurred())
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 21a78bdfaece23e06c46a9a5e73372d851653b15..091b4e4071d3760541836817b01493c9faeee587 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -33,7 +33,7 @@
  *	  ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.18 2001/01/19 16:14:36 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.19 2001/03/22 04:01:40 momjian Exp $
  *
  **********************************************************************/
 
@@ -135,7 +135,7 @@ static Tcl_HashTable *plperl_query_hash = NULL;
 static void plperl_init_all(void);
 static void plperl_init_safe_interp(void);
 
-Datum plperl_call_handler(PG_FUNCTION_ARGS);
+Datum		plperl_call_handler(PG_FUNCTION_ARGS);
 
 static Datum plperl_func_handler(PG_FUNCTION_ARGS);
 
@@ -223,14 +223,17 @@ plperl_init_safe_interp(void)
 {
 
 	char	   *embedding[3] = {
-		"", "-e", 
-		/* no commas between the next 4 please. They are supposed to be one string
+		"", "-e",
+
+		/*
+		 * no commas between the next 4 please. They are supposed to be
+		 * one string
 		 */
 		"require Safe; SPI::bootstrap();"
 		"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');$x->permit(':base_math');"
 		"$x->share(qw[&elog &DEBUG &NOTICE &NOIND &ERROR]);"
 		" return $x->reval(qq[sub { $_[0] }]); }"
-		};
+	};
 
 	plperl_safe_interp = perl_alloc();
 	if (!plperl_safe_interp)
@@ -312,17 +315,17 @@ plperl_call_handler(PG_FUNCTION_ARGS)
  **********************************************************************/
 static
 SV *
-plperl_create_sub(char * s)
+plperl_create_sub(char *s)
 {
 	dSP;
 
 	SV		   *subref = NULL;
-	int count;
+	int			count;
 
 	ENTER;
 	SAVETMPS;
 	PUSHMARK(SP);
-	XPUSHs(sv_2mortal(newSVpv(s,0)));
+	XPUSHs(sv_2mortal(newSVpv(s, 0)));
 	PUTBACK;
 	count = perl_call_pv("mksafefunc", G_SCALAR | G_EVAL | G_KEEPERR);
 	SPAGAIN;
@@ -336,9 +339,8 @@ plperl_create_sub(char * s)
 		elog(ERROR, "creation of function failed: %s", SvPV(ERRSV, PL_na));
 	}
 
-	if (count != 1) {
+	if (count != 1)
 		elog(ERROR, "creation of function failed - no return from mksafefunc");
-	}
 
 	/*
 	 * need to make a deep copy of the return. it comes off the stack as a
@@ -412,28 +414,27 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
 			TupleTableSlot *slot = (TupleTableSlot *) fcinfo->arg[i];
 			SV		   *hashref;
 
-			Assert(slot != NULL && ! fcinfo->argnull[i]);
+			Assert(slot != NULL && !fcinfo->argnull[i]);
+
 			/*
 			 * plperl_build_tuple_argument better return a mortal SV.
 			 */
 			hashref = plperl_build_tuple_argument(slot->val,
-												  slot->ttc_tupleDescriptor);
+											  slot->ttc_tupleDescriptor);
 			XPUSHs(hashref);
 		}
 		else
 		{
 			if (fcinfo->argnull[i])
-			{
 				XPUSHs(&PL_sv_undef);
-			}
 			else
 			{
 				char	   *tmp;
 
 				tmp = DatumGetCString(FunctionCall3(&(desc->arg_out_func[i]),
-									  fcinfo->arg[i],
-									  ObjectIdGetDatum(desc->arg_out_elem[i]),
-									  Int32GetDatum(desc->arg_out_len[i])));
+													fcinfo->arg[i],
+								 ObjectIdGetDatum(desc->arg_out_elem[i]),
+								   Int32GetDatum(desc->arg_out_len[i])));
 				XPUSHs(sv_2mortal(newSVpv(tmp, 0)));
 				pfree(tmp);
 			}
@@ -607,7 +608,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
 		 *
 		 ************************************************************/
 		proc_source = DatumGetCString(DirectFunctionCall1(textout,
-									PointerGetDatum(&procStruct->prosrc)));
+								  PointerGetDatum(&procStruct->prosrc)));
 
 		/************************************************************
 		 * Create the procedure in the interpreter
@@ -804,7 +805,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
 						  "unset i v\n\n", -1);
 
 		proc_source = DatumGetCString(DirectFunctionCall1(textout,
-									PointerGetDatum(&procStruct->prosrc)));
+								  PointerGetDatum(&procStruct->prosrc)));
 		Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
 		pfree(proc_source);
 		Tcl_DStringAppendElement(&proc_internal_def,
@@ -876,7 +877,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
 
 	/* The oid of the trigger relation for argument TG_relid */
 	stroid = DatumGetCString(DirectFunctionCall1(oidout,
-							 ObjectIdGetDatum(trigdata->tg_relation->rd_id)));
+						ObjectIdGetDatum(trigdata->tg_relation->rd_id)));
 	Tcl_DStringAppendElement(&tcl_cmd, stroid);
 	pfree(stroid);
 
@@ -1104,7 +1105,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
 			FunctionCall3(&finfo,
 						  CStringGetDatum(ret_values[i++]),
 						  ObjectIdGetDatum(typelem),
-						  Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
+				   Int32GetDatum(tupdesc->attrs[attnum - 1]->atttypmod));
 	}
 
 
@@ -2124,9 +2125,9 @@ plperl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
 		if (!isnull && OidIsValid(typoutput))
 		{
 			outputstr = DatumGetCString(OidFunctionCall3(typoutput,
-										attr,
-										ObjectIdGetDatum(typelem),
-										Int32GetDatum(tupdesc->attrs[i]->attlen)));
+														 attr,
+											   ObjectIdGetDatum(typelem),
+							  Int32GetDatum(tupdesc->attrs[i]->attlen)));
 			Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
 			pfree(outputstr);
 		}
@@ -2194,9 +2195,9 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc)
 		if (!isnull && OidIsValid(typoutput))
 		{
 			outputstr = DatumGetCString(OidFunctionCall3(typoutput,
-										attr,
-										ObjectIdGetDatum(typelem),
-										Int32GetDatum(tupdesc->attrs[i]->attlen)));
+														 attr,
+											   ObjectIdGetDatum(typelem),
+							  Int32GetDatum(tupdesc->attrs[i]->attlen)));
 			sv_catpvf(output, "'%s' => '%s',", attname, outputstr);
 			pfree(outputstr);
 		}
diff --git a/src/pl/plperl/ppport.h b/src/pl/plperl/ppport.h
index 7a3c59fc9a6c857225844049ad0d2844f8174f3d..be5f99087aba05a9569713df55023a7224174492 100644
--- a/src/pl/plperl/ppport.h
+++ b/src/pl/plperl/ppport.h
@@ -6,11 +6,11 @@
 
 /* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
    distributed under the same license as any version of Perl. */
-   
+
 /* For the latest version of this code, please retreive the Devel::PPPort
    module from CPAN, contact the author at <kjahds@kjahds.com>, or check
    with the Perl maintainers. */
-   
+
 /* If you needed to customize this file for your project, please mention
    your changes, and visible alter the version number. */
 
@@ -29,29 +29,29 @@
    for a static include, or use the GLOBAL request in a single module to
    produce a global definition that can be referenced from the other
    modules.
-   
-   Function:            Static define:           Extern define:
-   newCONSTSUB()        NEED_newCONSTSUB         NEED_newCONSTSUB_GLOBAL
+
+   Function:			Static define:			 Extern define:
+   newCONSTSUB()		NEED_newCONSTSUB		 NEED_newCONSTSUB_GLOBAL
 
 */
- 
+
 
 /* To verify whether ppport.h is needed for your module, and whether any
    special defines should be used, ppport.h can be run through Perl to check
    your source code. Simply say:
-   
-   	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
-   
+
+	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+
    The result will be a list of patches suggesting changes that should at
    least be acceptable, if not necessarily the most efficient solution, or a
    fix for all possible problems. It won't catch where dTHR is needed, and
    doesn't attempt to account for global macro or function definitions,
    nested includes, typemaps, etc.
-   
+
    In order to test for the need of dTHR, please try your module under a
    recent version of Perl that has threading compiled-in.
- 
-*/ 
+
+*/
 
 
 /*
@@ -109,11 +109,11 @@ foreach $filename (map(glob($_),@ARGV)) {
 			$need_include = 1;
 		}
 	}
-	
+
 	if (scalar(keys %add_func) or $need_include != $has_include) {
 		if (!$has_include) {
 			$inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
-			       "#include \"ppport.h\"\n";
+				   "#include \"ppport.h\"\n";
 			$c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
 		} elsif (keys %add_func) {
 			$inc = join('',map("#define NEED_$_\n", sort keys %add_func));
@@ -125,7 +125,7 @@ foreach $filename (map(glob($_),@ARGV)) {
 		}
 		$changes++;
 	}
-	
+
 	if ($changes) {
 		open(OUT,">/tmp/ppport.h.$$");
 		print OUT $c;
@@ -142,87 +142,90 @@ __DATA__
 */
 
 #ifndef PERL_REVISION
-#   ifndef __PATCHLEVEL_H_INCLUDED__
-#       include "patchlevel.h"
-#   endif
-#   ifndef PERL_REVISION
-#	define PERL_REVISION	(5)
-        /* Replace: 1 */
-#       define PERL_VERSION	PATCHLEVEL
-#       define PERL_SUBVERSION	SUBVERSION
-        /* Replace PERL_PATCHLEVEL with PERL_VERSION */
-        /* Replace: 0 */
-#   endif
+#ifndef __PATCHLEVEL_H_INCLUDED__
+#include "patchlevel.h"
+#endif
+#ifndef PERL_REVISION
+#define PERL_REVISION	 (5)
+ /* Replace: 1 */
+#define PERL_VERSION PATCHLEVEL
+#define PERL_SUBVERSION  SUBVERSION
+ /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+ /* Replace: 0 */
+#endif
 #endif
 
 #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
 
 #ifndef ERRSV
-#	define ERRSV perl_get_sv("@",FALSE)
+#define ERRSV perl_get_sv("@",FALSE)
 #endif
 
 #if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
 /* Replace: 1 */
-#	define PL_sv_undef	sv_undef
-#	define PL_sv_yes	sv_yes
-#	define PL_sv_no		sv_no
-#	define PL_na		na
-#	define PL_stdingv	stdingv
-#	define PL_hints		hints
-#	define PL_curcop	curcop
-#	define PL_curstash	curstash
-#	define PL_copline	copline
-#	define PL_Sv		Sv
+#define PL_sv_undef  sv_undef
+#define PL_sv_yes	 sv_yes
+#define PL_sv_no	 sv_no
+#define PL_na		 na
+#define PL_stdingv	 stdingv
+#define PL_hints	 hints
+#define PL_curcop	 curcop
+#define PL_curstash  curstash
+#define PL_copline	 copline
+#define PL_Sv		 Sv
 /* Replace: 0 */
 #endif
 
 #ifndef dTHR
-#  ifdef WIN32
-#	define dTHR extern int Perl___notused
-#  else
-#	define dTHR extern int errno
-#  endif
+#ifdef WIN32
+#define dTHR extern int Perl___notused
+#else
+#define dTHR extern int errno
+#endif
 #endif
 
 #ifndef boolSV
-#	define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
 #endif
 
 #ifndef gv_stashpvn
-#	define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
 #endif
 
 #ifndef newSVpvn
-#	define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
 #endif
 
 #ifndef newRV_inc
 /* Replace: 1 */
-#	define newRV_inc(sv) newRV(sv)
+#define newRV_inc(sv) newRV(sv)
 /* Replace: 0 */
 #endif
 
 #ifndef newRV_noinc
-#  ifdef __GNUC__
-#    define newRV_noinc(sv)               \
-      ({                                  \
-          SV *nsv = (SV*)newRV(sv);       \
-          SvREFCNT_dec(sv);               \
-          nsv;                            \
-      })
-#  else
-#    if defined(CRIPPLED_CC) || defined(USE_THREADS)
-static SV * newRV_noinc (SV * sv)
+#ifdef __GNUC__
+#define newRV_noinc(sv)				  \
+	  ({								  \
+		  SV *nsv = (SV*)newRV(sv);		  \
+		  SvREFCNT_dec(sv);				  \
+		  nsv;							  \
+	  })
+#else
+#if defined(CRIPPLED_CC) || defined(USE_THREADS)
+static SV  *
+newRV_noinc(SV * sv)
 {
-          SV *nsv = (SV*)newRV(sv);       
-          SvREFCNT_dec(sv);               
-          return nsv;                     
+	SV		   *nsv = (SV *) newRV(sv);
+
+	SvREFCNT_dec(sv);
+	return nsv;
 }
-#    else
-#      define newRV_noinc(sv)    \
-        ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
-#    endif
-#  endif
+
+#else
+#define newRV_noinc(sv)    \
+		((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+#endif
+#endif
 #endif
 
 /* Provide: newCONSTSUB */
@@ -233,20 +236,22 @@ static SV * newRV_noinc (SV * sv)
 #if defined(NEED_newCONSTSUB)
 static
 #else
-extern void newCONSTSUB _((HV * stash, char * name, SV *sv));
+extern void newCONSTSUB _((HV * stash, char *name, SV * sv));
+
 #endif
 
 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
 void
-newCONSTSUB(stash,name,sv)
-HV *stash;
-char *name;
-SV *sv;
+newCONSTSUB(stash, name, sv)
+HV		   *stash;
+char	   *name;
+SV		   *sv;
 {
-	U32 oldhints = PL_hints;
-	HV *old_cop_stash = PL_curcop->cop_stash;
-	HV *old_curstash = PL_curstash;
-	line_t oldline = PL_curcop->cop_line;
+	U32			oldhints = PL_hints;
+	HV		   *old_cop_stash = PL_curcop->cop_stash;
+	HV		   *old_curstash = PL_curstash;
+	line_t		oldline = PL_curcop->cop_line;
+
 	PL_curcop->cop_line = PL_copline;
 
 	PL_hints &= ~HINT_BLOCK_SCOPE;
@@ -256,31 +261,33 @@ SV *sv;
 	newSUB(
 
 #if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
-     /* before 5.003_22 */
-		start_subparse(),
+	/* before 5.003_22 */
+		   start_subparse(),
 #else
-#  if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
-     /* 5.003_22 */
-     		start_subparse(0),
-#  else
-     /* 5.003_23  onwards */
-     		start_subparse(FALSE, 0),
-#  endif
+#if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+	/* 5.003_22 */
+		   start_subparse(0),
+#else
+	/* 5.003_23  onwards */
+		   start_subparse(FALSE, 0),
+#endif
 #endif
 
-		newSVOP(OP_CONST, 0, newSVpv(name,0)),
-		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
-		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
-	);
+		   newSVOP(OP_CONST, 0, newSVpv(name, 0)),
+		   newSVOP(OP_CONST, 0, &PL_sv_no),		/* SvPV(&PL_sv_no) == ""
+												 * -- GMB */
+		   newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+		);
 
 	PL_hints = oldhints;
 	PL_curcop->cop_stash = old_cop_stash;
 	PL_curstash = old_curstash;
 	PL_curcop->cop_line = oldline;
 }
+
 #endif
 
-#endif /* newCONSTSUB */
+#endif	 /* newCONSTSUB */
 
 
-#endif /* _P_P_PORTABILITY_H_ */
+#endif	 /* _P_P_PORTABILITY_H_ */
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index ffcb7d72d6fd70f19b1372a0408513a7838d8050..1ea7a58aac16e9c46d92b760c438397d1db5223d 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -3,7 +3,7 @@
  *			  procedural language
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.26 2001/02/09 03:26:28 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.27 2001/03/22 04:01:41 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -135,10 +135,10 @@ plpgsql_compile(Oid fn_oid, int functype)
 	 */
 	procStruct = (Form_pg_proc) GETSTRUCT(procTup);
 	proc_source = DatumGetCString(DirectFunctionCall1(textout,
-									PointerGetDatum(&procStruct->prosrc)));
+								  PointerGetDatum(&procStruct->prosrc)));
 	plpgsql_setinput(proc_source, functype);
 	plpgsql_error_funcname = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(procStruct->proname))));
+								  NameGetDatum(&(procStruct->proname))));
 	plpgsql_error_lineno = 0;
 
 	/* ----------
@@ -152,7 +152,7 @@ plpgsql_compile(Oid fn_oid, int functype)
 	function->fn_functype = functype;
 	function->fn_oid = fn_oid;
 	function->fn_name = strdup(DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(procStruct->proname)))));
+								 NameGetDatum(&(procStruct->proname)))));
 
 	switch (functype)
 	{
@@ -169,7 +169,7 @@ plpgsql_compile(Oid fn_oid, int functype)
 			 * ----------
 			 */
 			typeTup = SearchSysCache(TYPEOID,
-									 ObjectIdGetDatum(procStruct->prorettype),
+								ObjectIdGetDatum(procStruct->prorettype),
 									 0, 0, 0);
 			if (!HeapTupleIsValid(typeTup))
 			{
@@ -206,7 +206,7 @@ plpgsql_compile(Oid fn_oid, int functype)
 				 * ----------
 				 */
 				typeTup = SearchSysCache(TYPEOID,
-										 ObjectIdGetDatum(procStruct->proargtypes[i]),
+							ObjectIdGetDatum(procStruct->proargtypes[i]),
 										 0, 0, 0);
 				if (!HeapTupleIsValid(typeTup))
 				{
@@ -228,7 +228,7 @@ plpgsql_compile(Oid fn_oid, int functype)
 					 */
 					sprintf(buf, "%s%%rowtype",
 							DatumGetCString(DirectFunctionCall1(nameout,
-							NameGetDatum(&(typeStruct->typname)))));
+								 NameGetDatum(&(typeStruct->typname)))));
 					if (plpgsql_parse_wordrowtype(buf) != T_ROW)
 					{
 						plpgsql_comperrinfo();
@@ -262,7 +262,7 @@ plpgsql_compile(Oid fn_oid, int functype)
 					var->refname = strdup(buf);
 					var->lineno = 0;
 					var->datatype->typname = DatumGetCString(DirectFunctionCall1(nameout,
-									NameGetDatum(&(typeStruct->typname))));
+								  NameGetDatum(&(typeStruct->typname))));
 					var->datatype->typoid = procStruct->proargtypes[i];
 					fmgr_info(typeStruct->typinput, &(var->datatype->typinput));
 					var->datatype->typelem = typeStruct->typelem;
@@ -630,7 +630,7 @@ plpgsql_parse_word(char *word)
 		typ = (PLpgSQL_type *) malloc(sizeof(PLpgSQL_type));
 
 		typ->typname = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(typeStruct->typname))));
+								  NameGetDatum(&(typeStruct->typname))));
 		typ->typoid = typeTup->t_data->t_oid;
 		fmgr_info(typeStruct->typinput, &(typ->typinput));
 		typ->typelem = typeStruct->typelem;
@@ -958,7 +958,7 @@ plpgsql_parse_wordtype(char *word)
 		typ = (PLpgSQL_type *) malloc(sizeof(PLpgSQL_type));
 
 		typ->typname = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(typeStruct->typname))));
+								  NameGetDatum(&(typeStruct->typname))));
 		typ->typoid = typeTup->t_data->t_oid;
 		fmgr_info(typeStruct->typinput, &(typ->typinput));
 		typ->typelem = typeStruct->typelem;
@@ -1109,7 +1109,7 @@ plpgsql_parse_dblwordtype(char *string)
 	typ = (PLpgSQL_type *) malloc(sizeof(PLpgSQL_type));
 
 	typ->typname = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(typeStruct->typname))));
+								  NameGetDatum(&(typeStruct->typname))));
 	typ->typoid = typetup->t_data->t_oid;
 	fmgr_info(typeStruct->typinput, &(typ->typinput));
 	typ->typelem = typeStruct->typelem;
@@ -1205,7 +1205,7 @@ plpgsql_parse_wordrowtype(char *string)
 		 * ----------
 		 */
 		attrtup = SearchSysCache(ATTNUM,
-								 ObjectIdGetDatum(classtup->t_data->t_oid),
+							   ObjectIdGetDatum(classtup->t_data->t_oid),
 								 Int16GetDatum(i + 1),
 								 0, 0);
 		if (!HeapTupleIsValid(attrtup))
@@ -1217,7 +1217,7 @@ plpgsql_parse_wordrowtype(char *string)
 		attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
 
 		cp = DatumGetCString(DirectFunctionCall1(nameout,
-						NameGetDatum(&(attrStruct->attname))));
+								  NameGetDatum(&(attrStruct->attname))));
 
 		typetup = SearchSysCache(TYPEOID,
 								 ObjectIdGetDatum(attrStruct->atttypid),
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 94dc0be45dee0dc3eef3190d0b93f1cc67ce5534..c51a633af85a07bac8cf69ab6b7d0203f06cea25 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3,7 +3,7 @@
  *			  procedural language
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.38 2001/02/19 19:49:53 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.39 2001/03/22 04:01:41 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -82,7 +82,7 @@ static int exec_stmt(PLpgSQL_execstate * estate,
 static int exec_stmt_assign(PLpgSQL_execstate * estate,
 				 PLpgSQL_stmt_assign * stmt);
 static int exec_stmt_getdiag(PLpgSQL_execstate * estate,
-							 PLpgSQL_stmt_getdiag * stmt);
+				  PLpgSQL_stmt_getdiag * stmt);
 static int exec_stmt_if(PLpgSQL_execstate * estate,
 			 PLpgSQL_stmt_if * stmt);
 static int exec_stmt_loop(PLpgSQL_execstate * estate,
@@ -104,9 +104,9 @@ static int exec_stmt_raise(PLpgSQL_execstate * estate,
 static int exec_stmt_execsql(PLpgSQL_execstate * estate,
 				  PLpgSQL_stmt_execsql * stmt);
 static int exec_stmt_dynexecute(PLpgSQL_execstate * estate,
-				  PLpgSQL_stmt_dynexecute * stmt);
+					 PLpgSQL_stmt_dynexecute * stmt);
 static int exec_stmt_dynfors(PLpgSQL_execstate * estate,
-			   PLpgSQL_stmt_dynfors * stmt);
+				  PLpgSQL_stmt_dynfors * stmt);
 
 static void exec_prepare_plan(PLpgSQL_execstate * estate,
 				  PLpgSQL_expr * expr);
@@ -330,7 +330,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
 					HeapTuple	tup;
 					TupleDesc	tupdesc;
 
-					Assert(slot != NULL && ! fcinfo->argnull[i]);
+					Assert(slot != NULL && !fcinfo->argnull[i]);
 					tup = slot->val;
 					tupdesc = slot->ttc_tupleDescriptor;
 					exec_move_row(&estate, NULL, row, tup, tupdesc);
@@ -663,7 +663,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
 	var = (PLpgSQL_var *) (estate.datums[func->tg_name_varno]);
 	var->isnull = false;
 	var->value = DirectFunctionCall1(namein,
-							CStringGetDatum(trigdata->tg_trigger->tgname));
+						  CStringGetDatum(trigdata->tg_trigger->tgname));
 
 	var = (PLpgSQL_var *) (estate.datums[func->tg_when_varno]);
 	var->isnull = false;
@@ -690,7 +690,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
 	var = (PLpgSQL_var *) (estate.datums[func->tg_relname_varno]);
 	var->isnull = false;
 	var->value = DirectFunctionCall1(namein,
-			CStringGetDatum(RelationGetRelationName(trigdata->tg_relation)));
+		CStringGetDatum(RelationGetRelationName(trigdata->tg_relation)));
 
 	var = (PLpgSQL_var *) (estate.datums[func->tg_nargs_varno]);
 	var->isnull = false;
@@ -710,7 +710,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
 		estate.trig_argv = palloc(sizeof(Datum) * estate.trig_nargs);
 		for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
 			estate.trig_argv[i] = DirectFunctionCall1(textin,
-							CStringGetDatum(trigdata->tg_trigger->tgargs[i]));
+					   CStringGetDatum(trigdata->tg_trigger->tgargs[i]));
 	}
 
 	/* ----------
@@ -1060,24 +1060,24 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
 }
 
 /* ----------
- * exec_stmt_getdiag                    Put internal PG information into
- *                                      specified variables.
+ * exec_stmt_getdiag					Put internal PG information into
+ *										specified variables.
  * ----------
  */
 static int
 exec_stmt_getdiag(PLpgSQL_execstate * estate, PLpgSQL_stmt_getdiag * stmt)
 {
-	int		i;
-	PLpgSQL_datum 	*var;
-	bool            isnull = false;
+	int			i;
+	PLpgSQL_datum *var;
+	bool		isnull = false;
 
-	for ( i=0 ; i < stmt->ndtitems ; i++) 
+	for (i = 0; i < stmt->ndtitems; i++)
 	{
-		PLpgSQL_diag_item *dtitem = & stmt->dtitems[i];
+		PLpgSQL_diag_item *dtitem = &stmt->dtitems[i];
 
 		if (dtitem->target <= 0)
 			continue;
-	
+
 		var = (estate->datums[dtitem->target]);
 
 		if (var == NULL)
@@ -1098,12 +1098,12 @@ exec_stmt_getdiag(PLpgSQL_execstate * estate, PLpgSQL_stmt_getdiag * stmt)
 				break;
 
 			default:
-			
+
 				elog(ERROR, "unknown attribute request %d in get_diagnostic",
 					 dtitem->item);
 		}
 	}
-	
+
 	return PLPGSQL_RC_OK;
 }
 
@@ -1647,7 +1647,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
 					else
 					{
 						typetup = SearchSysCache(TYPEOID,
-												 ObjectIdGetDatum(var->datatype->typoid),
+								 ObjectIdGetDatum(var->datatype->typoid),
 												 0, 0, 0);
 						if (!HeapTupleIsValid(typetup))
 							elog(ERROR, "cache lookup for type %u failed (1)",
@@ -1656,9 +1656,9 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
 
 						fmgr_info(typeStruct->typoutput, &finfo_output);
 						extval = DatumGetCString(FunctionCall3(&finfo_output,
-									var->value,
-									ObjectIdGetDatum(typeStruct->typelem),
-									Int32GetDatum(var->datatype->atttypmod)));
+															   var->value,
+								   ObjectIdGetDatum(typeStruct->typelem),
+							   Int32GetDatum(var->datatype->atttypmod)));
 						ReleaseSysCache(typetup);
 					}
 					plpgsql_dstring_append(&ds, extval);
@@ -1702,7 +1702,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
 								extval = "<OUT_OF_RANGE>";
 							else
 								extval = DatumGetCString(DirectFunctionCall1(textout,
-													estate->trig_argv[value]));
+											  estate->trig_argv[value]));
 						}
 						plpgsql_dstring_append(&ds, extval);
 					}
@@ -1945,7 +1945,7 @@ exec_stmt_execsql(PLpgSQL_execstate * estate,
  */
 static int
 exec_stmt_dynexecute(PLpgSQL_execstate * estate,
-				  PLpgSQL_stmt_dynexecute * stmt)
+					 PLpgSQL_stmt_dynexecute * stmt)
 {
 	Datum		query;
 	bool		isnull = false;
@@ -1980,16 +1980,16 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate,
 	fmgr_info(typeStruct->typoutput, &finfo_output);
 	querystr = DatumGetCString(FunctionCall3(&finfo_output,
 											 query,
-											 ObjectIdGetDatum(typeStruct->typelem),
+								   ObjectIdGetDatum(typeStruct->typelem),
 											 Int32GetDatum(-1)));
 
-	if(!typeStruct->typbyval)
-		pfree((void *)query);
+	if (!typeStruct->typbyval)
+		pfree((void *) query);
 
 	ReleaseSysCache(typetup);
 
 	/* ----------
-	 * Call SPI_exec() without preparing a saved plan. 
+	 * Call SPI_exec() without preparing a saved plan.
 	 * The returncode can be any standard OK.  Note that
 	 * while a SELECT is allowed, its results will be discarded.
 	 * ----------
@@ -2005,17 +2005,20 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate,
 			break;
 
 		case 0:
-			/* Also allow a zero return, which implies the querystring
+
+			/*
+			 * Also allow a zero return, which implies the querystring
 			 * contained no commands.
 			 */
 			break;
 
 		case SPI_OK_SELINTO:
+
 			/*
-			 * Disallow this for now, because its behavior is not consistent
-			 * with SELECT INTO in a normal plpgsql context.  We need to
-			 * reimplement EXECUTE to parse the string as a plpgsql command,
-			 * not just feed it to SPI_exec.
+			 * Disallow this for now, because its behavior is not
+			 * consistent with SELECT INTO in a normal plpgsql context.
+			 * We need to reimplement EXECUTE to parse the string as a
+			 * plpgsql command, not just feed it to SPI_exec.
 			 */
 			elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet");
 			break;
@@ -2098,12 +2101,12 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
 
 	fmgr_info(typeStruct->typoutput, &finfo_output);
 	querystr = DatumGetCString(FunctionCall3(&finfo_output,
-				query,
-				ObjectIdGetDatum(typeStruct->typelem),
-				Int32GetDatum(-1)));
+											 query,
+								   ObjectIdGetDatum(typeStruct->typelem),
+											 Int32GetDatum(-1)));
 
-	if(!typeStruct->typbyval)
-		pfree((void *)query);
+	if (!typeStruct->typbyval)
+		pfree((void *) query);
 
 	ReleaseSysCache(typetup);
 
@@ -2632,10 +2635,10 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
 	SPI_pop();
 
 	/*
-	 * Copy the result out of the expression-evaluation memory context,
-	 * so that we can free the expression context.
+	 * Copy the result out of the expression-evaluation memory context, so
+	 * that we can free the expression context.
 	 */
-	if (! *isNull)
+	if (!*isNull)
 	{
 		int16		typeLength;
 		bool		byValue;
@@ -2772,9 +2775,9 @@ exec_cast_value(Datum value, Oid valtype,
 
 			fmgr_info(typeStruct->typoutput, &finfo_output);
 			extval = DatumGetCString(FunctionCall3(&finfo_output,
-									 value,
-									 ObjectIdGetDatum(typeStruct->typelem),
-									 Int32GetDatum(-1)));
+												   value,
+								   ObjectIdGetDatum(typeStruct->typelem),
+												   Int32GetDatum(-1)));
 			value = FunctionCall3(reqinput,
 								  CStringGetDatum(extval),
 								  ObjectIdGetDatum(reqtypelem),
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 2b3605d2a105a9d14fee38ec3a0e176dc125fc89..ac069fec4a5ff3a990d71a711f22d7bab28d1bb4 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -3,7 +3,7 @@
  *			  procedural language
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.10 2001/02/19 19:49:53 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.11 2001/03/22 04:01:41 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -711,16 +711,16 @@ dump_getdiag(PLpgSQL_stmt_getdiag * stmt)
 	printf("GET DIAGNOSTICS ");
 	for (i = 0; i < stmt->ndtitems; i++)
 	{
-		PLpgSQL_diag_item *dtitem = & stmt->dtitems[i];
+		PLpgSQL_diag_item *dtitem = &stmt->dtitems[i];
 
 		if (i != 0)
 			printf(", ");
 
 		printf("{var %d} = ", dtitem->target);
 
-	    switch (dtitem->item)
+		switch (dtitem->item)
 		{
-		    case PLPGSQL_GETDIAG_ROW_COUNT:
+			case PLPGSQL_GETDIAG_ROW_COUNT:
 				printf("ROW_COUNT");
 				break;
 
@@ -729,7 +729,7 @@ dump_getdiag(PLpgSQL_stmt_getdiag * stmt)
 				break;
 
 			default:
-			    printf("???");
+				printf("???");
 				break;
 		}
 	}
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index d9e208ee98b987aa544e09d3ba8aea3cd7e6f559..ee6542f608ffb1bfaaa3f51a50327101414972d9 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -3,7 +3,7 @@
  *			  procedural language
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.6 2000/11/20 20:36:52 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.7 2001/03/22 04:01:42 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -94,7 +94,7 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
 		 * Check if we already compiled this function
 		 * ----------
 		 */
-		Oid		funcOid = fcinfo->flinfo->fn_oid;
+		Oid			funcOid = fcinfo->flinfo->fn_oid;
 
 		for (func = compiled_functions; func != NULL; func = func->next)
 		{
@@ -128,7 +128,7 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
 	 */
 	if (isTrigger)
 		retval = PointerGetDatum(plpgsql_exec_trigger(func,
-										(TriggerData *) fcinfo->context));
+									   (TriggerData *) fcinfo->context));
 	else
 		retval = plpgsql_exec_function(func, fcinfo);
 
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 727035bbb61729177f22f7d1761e3a75ae3e9576..f364b39e12c06c95d559b5a319757932bdfe1411 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -3,7 +3,7 @@
  *			  procedural language
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.12 2001/02/19 19:49:53 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.13 2001/03/22 04:01:42 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -115,8 +115,8 @@ enum
  */
 enum
 {
-        PLPGSQL_GETDIAG_ROW_COUNT,
-        PLPGSQL_GETDIAG_RESULT_OID
+	PLPGSQL_GETDIAG_ROW_COUNT,
+	PLPGSQL_GETDIAG_RESULT_OID
 };
 
 
@@ -512,9 +512,9 @@ extern Datum plpgsql_call_handler(PG_FUNCTION_ARGS);
  * ----------
  */
 extern Datum plpgsql_exec_function(PLpgSQL_function * func,
-								   FunctionCallInfo fcinfo);
+					  FunctionCallInfo fcinfo);
 extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function * func,
-									  TriggerData *trigdata);
+					 TriggerData *trigdata);
 
 
 /* ----------
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index a13ad19f98466f21b9c0a87854257e8f836ff61e..1fd8d67a468aca1c584fef1d96ae260fa429bbb8 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -1,6 +1,6 @@
 /**********************************************************************
  * pltcl.c		- PostgreSQL support for Tcl as
- *			  	  procedural language (PL)
+ *				  procedural language (PL)
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -31,7 +31,7 @@
  *	  ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.33 2001/03/07 16:18:08 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.34 2001/03/22 04:01:42 momjian Exp $
  *
  **********************************************************************/
 
@@ -116,8 +116,8 @@ static void pltcl_init_load_unknown(Tcl_Interp *interp);
 
 #endif	 /* PLTCL_UNKNOWN_SUPPORT */
 
-Datum pltcl_call_handler(PG_FUNCTION_ARGS);
-Datum pltclu_call_handler(PG_FUNCTION_ARGS);
+Datum		pltcl_call_handler(PG_FUNCTION_ARGS);
+Datum		pltclu_call_handler(PG_FUNCTION_ARGS);
 
 static Datum pltcl_func_handler(PG_FUNCTION_ARGS);
 
@@ -128,9 +128,9 @@ static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
 static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
 			int argc, char *argv[]);
 static int pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
-			int argc, char *argv[]);
+				int argc, char *argv[]);
 static int pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
-			int argc, char *argv[]);
+				 int argc, char *argv[]);
 
 static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
 			   int argc, char *argv[]);
@@ -178,7 +178,7 @@ pltcl_init_all(void)
 		 Tcl_CreateSlave(pltcl_hold_interp, "norm", 0)) == NULL)
 	{
 		elog(ERROR,
-			 "pltcl: internal error - cannot create 'normal' interpreter");
+		   "pltcl: internal error - cannot create 'normal' interpreter");
 	}
 	pltcl_init_interp(pltcl_norm_interp);
 
@@ -360,7 +360,9 @@ pltcl_call_handler(PG_FUNCTION_ARGS)
 	{
 		pltcl_current_fcinfo = NULL;
 		retval = PointerGetDatum(pltcl_trigger_handler(fcinfo));
-	} else {
+	}
+	else
+	{
 		pltcl_current_fcinfo = fcinfo;
 		retval = pltcl_func_handler(fcinfo);
 	}
@@ -422,17 +424,17 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
 		 *
 		 * Then we load the procedure into the safe interpreter.
 		 ************************************************************/
-		HeapTuple		procTup;
-		HeapTuple		langTup;
-		HeapTuple		typeTup;
-		Form_pg_proc	procStruct;
+		HeapTuple	procTup;
+		HeapTuple	langTup;
+		HeapTuple	typeTup;
+		Form_pg_proc procStruct;
 		Form_pg_language langStruct;
-		Form_pg_type	typeStruct;
-		Tcl_DString		proc_internal_def;
-		Tcl_DString		proc_internal_body;
-		char			proc_internal_args[4096];
-		char		   *proc_source;
-		char			buf[512];
+		Form_pg_type typeStruct;
+		Tcl_DString proc_internal_def;
+		Tcl_DString proc_internal_body;
+		char		proc_internal_args[4096];
+		char	   *proc_source;
+		char		buf[512];
 
 		/************************************************************
 		 * Allocate a new procedure description block
@@ -584,7 +586,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
 			Tcl_DStringAppend(&proc_internal_body, buf, -1);
 		}
 		proc_source = DatumGetCString(DirectFunctionCall1(textout,
-									PointerGetDatum(&procStruct->prosrc)));
+								  PointerGetDatum(&procStruct->prosrc)));
 		Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
 		pfree(proc_source);
 		Tcl_DStringAppendElement(&proc_internal_def,
@@ -622,9 +624,9 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
 		prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
 
 		if (prodesc->lanpltrusted)
-		    interp = pltcl_safe_interp;
+			interp = pltcl_safe_interp;
 		else
-		    interp = pltcl_norm_interp;
+			interp = pltcl_norm_interp;
 	}
 
 	/************************************************************
@@ -662,7 +664,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
 			 **************************************************/
 			TupleTableSlot *slot = (TupleTableSlot *) fcinfo->arg[i];
 
-			Assert(slot != NULL && ! fcinfo->argnull[i]);
+			Assert(slot != NULL && !fcinfo->argnull[i]);
 			Tcl_DStringInit(&list_tmp);
 			pltcl_build_tuple_argument(slot->val,
 									   slot->ttc_tupleDescriptor,
@@ -678,17 +680,15 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
 			 * of their external representation
 			 **************************************************/
 			if (fcinfo->argnull[i])
-			{
 				Tcl_DStringAppendElement(&tcl_cmd, "");
-			}
 			else
 			{
 				char	   *tmp;
 
 				tmp = DatumGetCString(FunctionCall3(&prodesc->arg_out_func[i],
-									  fcinfo->arg[i],
-									  ObjectIdGetDatum(prodesc->arg_out_elem[i]),
-									  Int32GetDatum(prodesc->arg_out_len[i])));
+													fcinfo->arg[i],
+							  ObjectIdGetDatum(prodesc->arg_out_elem[i]),
+								Int32GetDatum(prodesc->arg_out_len[i])));
 				Tcl_DStringAppendElement(&tcl_cmd, tmp);
 				pfree(tmp);
 			}
@@ -902,7 +902,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
 						  "unset i v\n\n", -1);
 
 		proc_source = DatumGetCString(DirectFunctionCall1(textout,
-									PointerGetDatum(&procStruct->prosrc)));
+								  PointerGetDatum(&procStruct->prosrc)));
 		Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
 		pfree(proc_source);
 		Tcl_DStringAppendElement(&proc_internal_def,
@@ -979,7 +979,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
 
 	/* The oid of the trigger relation for argument TG_relid */
 	stroid = DatumGetCString(DirectFunctionCall1(oidout,
-							 ObjectIdGetDatum(trigdata->tg_relation->rd_id)));
+						ObjectIdGetDatum(trigdata->tg_relation->rd_id)));
 	Tcl_DStringAppendElement(&tcl_cmd, stroid);
 	pfree(stroid);
 
@@ -1208,7 +1208,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
 			FunctionCall3(&finfo,
 						  CStringGetDatum(ret_values[i++]),
 						  ObjectIdGetDatum(typelem),
-						  Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
+				   Int32GetDatum(tupdesc->attrs[attnum - 1]->atttypmod));
 	}
 
 	rettup = SPI_modifytuple(trigdata->tg_relation, rettup, tupdesc->natts,
@@ -1352,9 +1352,9 @@ pltcl_quote(ClientData cdata, Tcl_Interp *interp,
  **********************************************************************/
 static int
 pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
-			int argc, char *argv[])
+				int argc, char *argv[])
 {
-	int		argno;
+	int			argno;
 	FunctionCallInfo fcinfo = pltcl_current_fcinfo;
 
 	/************************************************************
@@ -1371,7 +1371,7 @@ pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
 	 ************************************************************/
 	if (fcinfo == NULL)
 	{
-		Tcl_SetResult(interp, "argisnull cannot be used in triggers", 
+		Tcl_SetResult(interp, "argisnull cannot be used in triggers",
 					  TCL_VOLATILE);
 		return TCL_ERROR;
 	}
@@ -1409,9 +1409,9 @@ pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
  **********************************************************************/
 static int
 pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
-			int argc, char *argv[])
+				 int argc, char *argv[])
 {
-	int		argno;
+	int			argno;
 	FunctionCallInfo fcinfo = pltcl_current_fcinfo;
 
 	/************************************************************
@@ -1428,7 +1428,7 @@ pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
 	 ************************************************************/
 	if (fcinfo == NULL)
 	{
-		Tcl_SetResult(interp, "return_null cannot be used in triggers", 
+		Tcl_SetResult(interp, "return_null cannot be used in triggers",
 					  TCL_VOLATILE);
 		return TCL_ERROR;
 	}
@@ -1851,9 +1851,9 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
 	 * the key to the caller
 	 ************************************************************/
 	if (interp == pltcl_norm_interp)
-	    query_hash = pltcl_norm_query_hash;
+		query_hash = pltcl_norm_query_hash;
 	else
-	    query_hash = pltcl_safe_query_hash;
+		query_hash = pltcl_safe_query_hash;
 
 	memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
 	hashent = Tcl_CreateHashEntry(query_hash, qdesc->qname, &hashnew);
@@ -2335,9 +2335,9 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
 		if (!isnull && OidIsValid(typoutput))
 		{
 			outputstr = DatumGetCString(OidFunctionCall3(typoutput,
-										attr,
-										ObjectIdGetDatum(typelem),
-										Int32GetDatum(tupdesc->attrs[i]->attlen)));
+														 attr,
+											   ObjectIdGetDatum(typelem),
+							  Int32GetDatum(tupdesc->attrs[i]->attlen)));
 			Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
 			pfree(outputstr);
 		}
@@ -2405,9 +2405,9 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
 		if (!isnull && OidIsValid(typoutput))
 		{
 			outputstr = DatumGetCString(OidFunctionCall3(typoutput,
-										attr,
-										ObjectIdGetDatum(typelem),
-										Int32GetDatum(tupdesc->attrs[i]->attlen)));
+														 attr,
+											   ObjectIdGetDatum(typelem),
+							  Int32GetDatum(tupdesc->attrs[i]->attlen)));
 			Tcl_DStringAppendElement(retval, attname);
 			Tcl_DStringAppendElement(retval, outputstr);
 			pfree(outputstr);
diff --git a/src/test/examples/testlo.c b/src/test/examples/testlo.c
index 706f408047c02a008e868647a312f6780acaa6b9..47f1d9d38d085365109b641389851595b8c1cec8 100644
--- a/src/test/examples/testlo.c
+++ b/src/test/examples/testlo.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.17 2001/01/24 19:43:32 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.18 2001/03/22 04:01:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -236,9 +236,7 @@ main(int argc, char **argv)
 /*	lobjOid = importFile(conn, in_filename); */
 	lobjOid = lo_import(conn, in_filename);
 	if (lobjOid == 0)
-	{
 		fprintf(stderr, "%s\n", PQerrorMessage(conn));
-	}
 	else
 	{
 		printf("\tas large object %u.\n", lobjOid);
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index d8777e916ac49d32af1b602b02240abbf345a273..062cd0c5a6296c19fcf029043a59f3392d7244f5 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.46 2001/02/10 02:31:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.47 2001/03/22 04:01:44 momjian Exp $
  */
 
 #include "postgres.h"
@@ -25,7 +25,7 @@ extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2);
 extern Datum overpaid(PG_FUNCTION_ARGS);
 extern Datum boxarea(PG_FUNCTION_ARGS);
 extern char *reverse_name(char *string);
-extern int oldstyle_length(int n, text *t);
+extern int	oldstyle_length(int n, text *t);
 
 /*
 ** Distance from a point to a path
@@ -60,8 +60,8 @@ regress_dist_ptpath(PG_FUNCTION_ARGS)
 			{
 				regress_lseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
 				tmp = DatumGetFloat8(DirectFunctionCall2(dist_ps,
-													PointPGetDatum(pt),
-													LsegPGetDatum(&lseg)));
+													  PointPGetDatum(pt),
+												  LsegPGetDatum(&lseg)));
 				if (i == 0 || tmp < result)
 					result = tmp;
 			}
@@ -96,7 +96,7 @@ regress_path_dist(PG_FUNCTION_ARGS)
 
 			tmp = DatumGetFloat8(DirectFunctionCall2(lseg_distance,
 													 LsegPGetDatum(&seg1),
-													 LsegPGetDatum(&seg2)));
+												  LsegPGetDatum(&seg2)));
 			if (!have_min || tmp < min)
 			{
 				min = tmp;
@@ -105,7 +105,7 @@ regress_path_dist(PG_FUNCTION_ARGS)
 		}
 	}
 
-	if (! have_min)
+	if (!have_min)
 		PG_RETURN_NULL();
 
 	PG_RETURN_FLOAT8(min);
@@ -165,7 +165,8 @@ interpt_pp(PG_FUNCTION_ARGS)
 	if (!found)
 		PG_RETURN_NULL();
 
-	/* Note: DirectFunctionCall2 will kick out an error if lseg_interpt()
+	/*
+	 * Note: DirectFunctionCall2 will kick out an error if lseg_interpt()
 	 * returns NULL, but that should be impossible since we know the two
 	 * segments intersect.
 	 */
@@ -319,7 +320,7 @@ reverse_name(char *string)
 int
 oldstyle_length(int n, text *t)
 {
-	int		len = 0;
+	int			len = 0;
 
 	if (t)
 		len = VARSIZE(t) - VARHDRSZ;
@@ -428,11 +429,11 @@ funny_dup17(PG_FUNCTION_ARGS)
 	if (SPI_processed > 0)
 	{
 		selected = DatumGetInt32(DirectFunctionCall1(int4in,
-								 CStringGetDatum(SPI_getvalue(
-									   SPI_tuptable->vals[0],
-									   SPI_tuptable->tupdesc,
-									   1
-									   ))));
+											CStringGetDatum(SPI_getvalue(
+												   SPI_tuptable->vals[0],
+												   SPI_tuptable->tupdesc,
+																		 1
+																	))));
 	}
 
 	elog(NOTICE, "funny_dup17 (fired %s) on level %3d: %d/%d tuples inserted/selected",
@@ -559,8 +560,8 @@ ttdummy(PG_FUNCTION_ARGS)
 	}
 
 	{
-		text   *seqname = DatumGetTextP(DirectFunctionCall1(textin,
-											CStringGetDatum("ttdummy_seq")));
+		text	   *seqname = DatumGetTextP(DirectFunctionCall1(textin,
+										CStringGetDatum("ttdummy_seq")));
 
 		newoff = DirectFunctionCall1(nextval,
 									 PointerGetDatum(seqname));
diff --git a/src/tools/entab/halt.c b/src/tools/entab/halt.c
index b94fdd3c504c749ac56b79ba783e3060df7343f3..c7b9ab6bb95429942bf0d4d274c3e3499946b54e 100644
--- a/src/tools/entab/halt.c
+++ b/src/tools/entab/halt.c
@@ -42,17 +42,17 @@ va_dcl
 	fflush(stderr);
 
 	/* call one clean up function if defined */
-	if ((sig_func = signal(SIGTERM, SIG_DFL)) !=SIG_DFL &&
-		sig_func !=SIG_IGN)
+	if ((sig_func = signal(SIGTERM, SIG_DFL)) != SIG_DFL &&
+		sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGHUP, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGHUP, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGINT, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGINT, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
-	else if ((sig_func = signal(SIGQUIT, SIG_DFL)) !=SIG_DFL &&
-			 sig_func !=SIG_IGN)
+	else if ((sig_func = signal(SIGQUIT, SIG_DFL)) != SIG_DFL &&
+			 sig_func != SIG_IGN)
 		(*sig_func) (0);
 	exit(1);
 }
diff --git a/src/tutorial/beard.c b/src/tutorial/beard.c
index af0ec28128d1c2f174153b42db7e7dab3c53c0be..fb2c8ae43a374d5f0a53137d80253c487d049e14 100644
--- a/src/tutorial/beard.c
+++ b/src/tutorial/beard.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/tutorial/Attic/beard.c,v 1.5 2001/01/24 19:43:32 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/tutorial/Attic/beard.c,v 1.6 2001/03/22 04:01:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ beard(Oid picture)
 
 	beard_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
 												 ObjectIdGetDatum(beard),
-												 Int32GetDatum(INV_WRITE)));
+											  Int32GetDatum(INV_WRITE)));
 	if (beard_fd < 0)
 		elog(ERROR, "Cannot access beard large object");
 
diff --git a/src/tutorial/funcs.c b/src/tutorial/funcs.c
index 58ede56cc88432317b7fc068da2751f0d7095755..cb3de3e6e76b80575becc72528492a7a41566bc2 100644
--- a/src/tutorial/funcs.c
+++ b/src/tutorial/funcs.c
@@ -18,20 +18,20 @@
 /* These prototypes just prevent possible warnings from gcc. */
 
 int			add_one(int arg);
-float8     *add_one_float8(float8 *arg);
+float8	   *add_one_float8(float8 *arg);
 Point	   *makepoint(Point *pointx, Point *pointy);
 text	   *copytext(text *t);
-text       *concat_text(text *arg1, text *arg2);
+text	   *concat_text(text *arg1, text *arg2);
 bool c_overpaid(TupleTableSlot *t,	/* the current instance of EMP */
 		   int32 limit);
 
 
 /* By Value */
-         
+
 int
 add_one(int arg)
 {
-    return arg + 1;
+	return arg + 1;
 }
 
 /* By Reference, Fixed Length */
@@ -39,22 +39,22 @@ add_one(int arg)
 float8 *
 add_one_float8(float8 *arg)
 {
-    float8    *result = (float8 *) palloc(sizeof(float8));
+	float8	   *result = (float8 *) palloc(sizeof(float8));
+
+	*result = *arg + 1.0;
 
-    *result = *arg + 1.0;
-       
-    return result;
+	return result;
 }
 
 Point *
 makepoint(Point *pointx, Point *pointy)
 {
-    Point     *new_point = (Point *) palloc(sizeof(Point));
+	Point	   *new_point = (Point *) palloc(sizeof(Point));
+
+	new_point->x = pointx->x;
+	new_point->y = pointy->y;
 
-    new_point->x = pointx->x;
-    new_point->y = pointy->y;
-       
-    return new_point;
+	return new_point;
 }
 
 /* By Reference, Variable Length */
@@ -62,31 +62,34 @@ makepoint(Point *pointx, Point *pointy)
 text *
 copytext(text *t)
 {
-    /*
-     * VARSIZE is the total size of the struct in bytes.
-     */
-    text *new_t = (text *) palloc(VARSIZE(t));
-    VARATT_SIZEP(new_t) = VARSIZE(t);
-    /*
-     * VARDATA is a pointer to the data region of the struct.
-     */
-    memcpy((void *) VARDATA(new_t), /* destination */
-           (void *) VARDATA(t),     /* source */
-           VARSIZE(t)-VARHDRSZ);    /* how many bytes */
-    return new_t;
+
+	/*
+	 * VARSIZE is the total size of the struct in bytes.
+	 */
+	text	   *new_t = (text *) palloc(VARSIZE(t));
+
+	VARATT_SIZEP(new_t) = VARSIZE(t);
+
+	/*
+	 * VARDATA is a pointer to the data region of the struct.
+	 */
+	memcpy((void *) VARDATA(new_t),		/* destination */
+		   (void *) VARDATA(t), /* source */
+		   VARSIZE(t) - VARHDRSZ);		/* how many bytes */
+	return new_t;
 }
 
 text *
 concat_text(text *arg1, text *arg2)
 {
-    int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;
-    text *new_text = (text *) palloc(new_text_size);
-
-    memset((void *) new_text, 0, new_text_size);
-    VARATT_SIZEP(new_text) = new_text_size;
-    strncpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ);
-    strncat(VARDATA(new_text), VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ);
-    return new_text;
+	int32		new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;
+	text	   *new_text = (text *) palloc(new_text_size);
+
+	memset((void *) new_text, 0, new_text_size);
+	VARATT_SIZEP(new_text) = new_text_size;
+	strncpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1) - VARHDRSZ);
+	strncat(VARDATA(new_text), VARDATA(arg2), VARSIZE(arg2) - VARHDRSZ);
+	return new_text;
 }
 
 /* Composite types */
@@ -95,11 +98,11 @@ bool
 c_overpaid(TupleTableSlot *t,	/* the current instance of EMP */
 		   int32 limit)
 {
-    bool isnull;
-    int32 salary;
+	bool		isnull;
+	int32		salary;
 
-    salary = DatumGetInt32(GetAttributeByName(t, "salary", &isnull));
-    if (isnull)
-        return (false);
-    return salary > limit;
+	salary = DatumGetInt32(GetAttributeByName(t, "salary", &isnull));
+	if (isnull)
+		return (false);
+	return salary > limit;
 }
diff --git a/src/tutorial/funcs_new.c b/src/tutorial/funcs_new.c
index b8972688330cdad8b4e96954ceb913d99290439e..c9413096bcf8da55da1bc331b8f002bf8d477a81 100644
--- a/src/tutorial/funcs_new.c
+++ b/src/tutorial/funcs_new.c
@@ -11,31 +11,31 @@
 
 #include "postgres.h"			/* general Postgres declarations */
 
-#include "fmgr.h"               /* for argument/result macros */
+#include "fmgr.h"				/* for argument/result macros */
 #include "executor/executor.h"	/* for GetAttributeByName() */
 #include "utils/geo_decls.h"	/* for point type */
 
 
 /* These prototypes just prevent possible warnings from gcc. */
 
-Datum	add_one(PG_FUNCTION_ARGS);
-Datum	add_one_float8(PG_FUNCTION_ARGS);
-Datum	makepoint(PG_FUNCTION_ARGS);
-Datum	copytext(PG_FUNCTION_ARGS);
-Datum	concat_text(PG_FUNCTION_ARGS);
-Datum   c_overpaid(PG_FUNCTION_ARGS);
+Datum		add_one(PG_FUNCTION_ARGS);
+Datum		add_one_float8(PG_FUNCTION_ARGS);
+Datum		makepoint(PG_FUNCTION_ARGS);
+Datum		copytext(PG_FUNCTION_ARGS);
+Datum		concat_text(PG_FUNCTION_ARGS);
+Datum		c_overpaid(PG_FUNCTION_ARGS);
 
 
 /* By Value */
-         
+
 PG_FUNCTION_INFO_V1(add_one);
 
 Datum
 add_one(PG_FUNCTION_ARGS)
 {
-    int32   arg = PG_GETARG_INT32(0);
+	int32		arg = PG_GETARG_INT32(0);
 
-    PG_RETURN_INT32(arg + 1);
+	PG_RETURN_INT32(arg + 1);
 }
 
 /* By Reference, Fixed Length */
@@ -45,10 +45,10 @@ PG_FUNCTION_INFO_V1(add_one_float8);
 Datum
 add_one_float8(PG_FUNCTION_ARGS)
 {
-    /* The macros for FLOAT8 hide its pass-by-reference nature */
-    float8   arg = PG_GETARG_FLOAT8(0);
+	/* The macros for FLOAT8 hide its pass-by-reference nature */
+	float8		arg = PG_GETARG_FLOAT8(0);
 
-    PG_RETURN_FLOAT8(arg + 1.0);
+	PG_RETURN_FLOAT8(arg + 1.0);
 }
 
 PG_FUNCTION_INFO_V1(makepoint);
@@ -56,14 +56,14 @@ PG_FUNCTION_INFO_V1(makepoint);
 Datum
 makepoint(PG_FUNCTION_ARGS)
 {
-    Point     *pointx = PG_GETARG_POINT_P(0);
-    Point     *pointy = PG_GETARG_POINT_P(1);
-    Point     *new_point = (Point *) palloc(sizeof(Point));
-
-    new_point->x = pointx->x;
-    new_point->y = pointy->y;
-       
-    PG_RETURN_POINT_P(new_point);
+	Point	   *pointx = PG_GETARG_POINT_P(0);
+	Point	   *pointy = PG_GETARG_POINT_P(1);
+	Point	   *new_point = (Point *) palloc(sizeof(Point));
+
+	new_point->x = pointx->x;
+	new_point->y = pointy->y;
+
+	PG_RETURN_POINT_P(new_point);
 }
 
 /* By Reference, Variable Length */
@@ -73,19 +73,22 @@ PG_FUNCTION_INFO_V1(copytext);
 Datum
 copytext(PG_FUNCTION_ARGS)
 {
-    text     *t = PG_GETARG_TEXT_P(0);
-    /*
-     * VARSIZE is the total size of the struct in bytes.
-     */
-    text     *new_t = (text *) palloc(VARSIZE(t));
-    VARATT_SIZEP(new_t) = VARSIZE(t);
-    /*
-     * VARDATA is a pointer to the data region of the struct.
-     */
-    memcpy((void *) VARDATA(new_t), /* destination */
-           (void *) VARDATA(t),     /* source */
-           VARSIZE(t)-VARHDRSZ);        /* how many bytes */
-    PG_RETURN_TEXT_P(new_t);
+	text	   *t = PG_GETARG_TEXT_P(0);
+
+	/*
+	 * VARSIZE is the total size of the struct in bytes.
+	 */
+	text	   *new_t = (text *) palloc(VARSIZE(t));
+
+	VARATT_SIZEP(new_t) = VARSIZE(t);
+
+	/*
+	 * VARDATA is a pointer to the data region of the struct.
+	 */
+	memcpy((void *) VARDATA(new_t),		/* destination */
+		   (void *) VARDATA(t), /* source */
+		   VARSIZE(t) - VARHDRSZ);		/* how many bytes */
+	PG_RETURN_TEXT_P(new_t);
 }
 
 PG_FUNCTION_INFO_V1(concat_text);
@@ -93,16 +96,16 @@ PG_FUNCTION_INFO_V1(concat_text);
 Datum
 concat_text(PG_FUNCTION_ARGS)
 {
-    text  *arg1 = PG_GETARG_TEXT_P(0);
-    text  *arg2 = PG_GETARG_TEXT_P(1);
-    int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;
-    text *new_text = (text *) palloc(new_text_size);
-
-    memset((void *) new_text, 0, new_text_size);
-    VARATT_SIZEP(new_text) = new_text_size;
-    strncpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ);
-    strncat(VARDATA(new_text), VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ);
-    PG_RETURN_TEXT_P(new_text);
+	text	   *arg1 = PG_GETARG_TEXT_P(0);
+	text	   *arg2 = PG_GETARG_TEXT_P(1);
+	int32		new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;
+	text	   *new_text = (text *) palloc(new_text_size);
+
+	memset((void *) new_text, 0, new_text_size);
+	VARATT_SIZEP(new_text) = new_text_size;
+	strncpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1) - VARHDRSZ);
+	strncat(VARDATA(new_text), VARDATA(arg2), VARSIZE(arg2) - VARHDRSZ);
+	PG_RETURN_TEXT_P(new_text);
 }
 
 /* Composite types */
@@ -112,15 +115,19 @@ PG_FUNCTION_INFO_V1(c_overpaid);
 Datum
 c_overpaid(PG_FUNCTION_ARGS)
 {
-    TupleTableSlot  *t = (TupleTableSlot *) PG_GETARG_POINTER(0);
-    int32            limit = PG_GETARG_INT32(1);
-    bool isnull;
-    int32 salary;
+	TupleTableSlot *t = (TupleTableSlot *) PG_GETARG_POINTER(0);
+	int32		limit = PG_GETARG_INT32(1);
+	bool		isnull;
+	int32		salary;
+
+	salary = DatumGetInt32(GetAttributeByName(t, "salary", &isnull));
+	if (isnull)
+		PG_RETURN_BOOL(false);
 
-    salary = DatumGetInt32(GetAttributeByName(t, "salary", &isnull));
-    if (isnull)
-        PG_RETURN_BOOL(false);
-    /* Alternatively, we might prefer to do PG_RETURN_NULL() for null salary */
+	/*
+	 * Alternatively, we might prefer to do PG_RETURN_NULL() for null
+	 * salary
+	 */
 
-    PG_RETURN_BOOL(salary > limit);
+	PG_RETURN_BOOL(salary > limit);
 }
diff --git a/src/utils/dllinit.c b/src/utils/dllinit.c
index 03c07d1521cb857c766f7c33b0f11e9dfd38e637..0d3a55214ba55de4c7557cc545ee3184317367c1 100644
--- a/src/utils/dllinit.c
+++ b/src/utils/dllinit.c
@@ -106,4 +106,4 @@ DllMain(
 	return TRUE;
 }
 
-#endif /* CYGWIN_VERSION_DLL_MAJOR < 1001 */
+#endif	 /* CYGWIN_VERSION_DLL_MAJOR < 1001 */