diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 466180757bb46f069a6cb98b8cf46e305c9f60ce..cc25cf94ba05953dca88a0771534b862dccb85f9 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -1,5 +1,5 @@
 # Macros to detect C compiler features
-# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.15 2008/02/17 16:36:42 petere Exp $
+# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.16 2008/04/18 18:43:08 alvherre Exp $
 
 
 # PGAC_C_SIGNED
@@ -62,7 +62,7 @@ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])],
 
 Ac_define=$Ac_cachevar
 if test x"$Ac_cachevar" = xyes ; then
-  AC_DEFINE(Ac_define,, [Define to 1 if `]$1[' works and is 64 bits.])
+  AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.])
 fi
 undefine([Ac_define])dnl
 undefine([Ac_cachevar])dnl
diff --git a/configure b/configure
index 8691fa0ce41e5e5c3e9103c98d497313f381f5da..e9f6302e7e9dea8bf437b42ff7395e5d164601af 100755
--- a/configure
+++ b/configure
@@ -19693,7 +19693,7 @@ HAVE_LONG_INT_64=$pgac_cv_type_long_int_64
 if test x"$pgac_cv_type_long_int_64" = xyes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_INT_64
+#define HAVE_LONG_INT_64 1
 _ACEOF
 
 fi
@@ -19826,7 +19826,7 @@ HAVE_LONG_LONG_INT_64=$pgac_cv_type_long_long_int_64
 if test x"$pgac_cv_type_long_long_int_64" = xyes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG_INT_64
+#define HAVE_LONG_LONG_INT_64 1
 _ACEOF
 
 fi
diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c
index 9798d015635d8f611f3f42452a94b11d7af46897..c7b41f16c1e2c6a80f9cb06efed72d9c8bf8dac2 100644
--- a/contrib/btree_gist/btree_utils_num.c
+++ b/contrib/btree_gist/btree_utils_num.c
@@ -13,10 +13,11 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo
 		{
 			int16		i2;
 			int32		i4;
+			float4		f4;
 			DateADT		dt;
 		}			v;
 
-		GBT_NUMKEY *r = (GBT_NUMKEY *) palloc(2 * tinfo->size);
+		GBT_NUMKEY *r = (GBT_NUMKEY *) palloc0(2 * tinfo->size);
 		void	   *leaf = NULL;
 
 		switch (tinfo->t)
@@ -37,11 +38,14 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo
 				v.dt = DatumGetDateADT(entry->key);
 				leaf = &v.dt;
 				break;
+			case gbt_t_float4:
+				v.f4 = DatumGetFloat4(entry->key);
+				leaf = &v.f4;
+				break;
 			default:
 				leaf = DatumGetPointer(entry->key);
 		}
 
-		memset((void *) &r[0], 0, 2 * tinfo->size);
 		memcpy((void *) &r[0], leaf, tinfo->size);
 		memcpy((void *) &r[tinfo->size], leaf, tinfo->size);
 		retval = palloc(sizeof(GISTENTRY));
diff --git a/contrib/seg/data/test_seg.data b/contrib/seg/data/test_seg.data
index dba9ac90452ad72ea165e0e40aa12cb54f858986..69658067a14e91495b7b5fbc135cc852c9ca4983 100644
--- a/contrib/seg/data/test_seg.data
+++ b/contrib/seg/data/test_seg.data
@@ -2575,3 +2575,4 @@
 23.7
 24
 24.0
+\N
diff --git a/contrib/seg/expected/seg.out b/contrib/seg/expected/seg.out
index de410490bc7187c6de1f12f134d45527d2d7b0c3..69bcfa144197aec32dbebd4042f1d6eeb27ae1de 100644
--- a/contrib/seg/expected/seg.out
+++ b/contrib/seg/expected/seg.out
@@ -1065,3 +1065,154 @@ SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
  10.7 .. 12.3
 (143 rows)
 
+-- Test functions
+SELECT seg_lower(s), seg_center(s), seg_upper(s)
+FROM test_seg WHERE s @> '11.2..11.3' OR s IS NULL ORDER BY s;
+ seg_lower | seg_center | seg_upper 
+-----------+------------+-----------
+ -Infinity |  -Infinity |        40
+ -Infinity |  -Infinity |        82
+ -Infinity |  -Infinity |        90
+         1 |          7 |        13
+       1.3 |       6.65 |        12
+         2 |       6.75 |      11.5
+       2.1 |       6.95 |      11.8
+       2.3 |   Infinity |  Infinity
+       2.3 |   Infinity |  Infinity
+       2.4 |       6.85 |      11.3
+       2.5 |          7 |      11.5
+       2.5 |       7.15 |      11.8
+       2.6 |   Infinity |  Infinity
+       2.7 |       7.35 |        12
+         3 |   Infinity |  Infinity
+         3 |       30.5 |        58
+       3.1 |        7.3 |      11.5
+       3.5 |        7.5 |      11.5
+       3.5 |       7.85 |      12.2
+         4 |          8 |        12
+         4 |   Infinity |  Infinity
+         4 |          8 |        12
+         4 |       7.85 |      11.7
+         4 |       8.25 |      12.5
+         4 |        8.5 |        13
+         4 |         32 |        60
+         4 |   Infinity |  Infinity
+       4.2 |       7.85 |      11.5
+       4.2 |       7.95 |      11.7
+       4.5 |       8.25 |        12
+       4.5 |          8 |      11.5
+       4.5 |       8.25 |        12
+       4.5 |       8.25 |        12
+       4.5 |        8.5 |      12.5
+       4.5 |      59.75 |       115
+       4.7 |       8.25 |      11.8
+       4.8 |       8.15 |      11.5
+       4.8 |        8.2 |      11.6
+       4.8 |       8.65 |      12.5
+       4.8 |   Infinity |  Infinity
+       4.9 |       8.45 |        12
+       4.9 |   Infinity |  Infinity
+         5 |       8.25 |      11.5
+         5 |        8.5 |        12
+         5 |       17.5 |        30
+         5 |        8.2 |      11.4
+         5 |       8.25 |      11.5
+         5 |        8.3 |      11.6
+         5 |       8.35 |      11.7
+         5 |        8.5 |        12
+         5 |        8.5 |        12
+         5 |        8.5 |        12
+       5.2 |       8.35 |      11.5
+       5.2 |        8.6 |        12
+      5.25 |      8.625 |        12
+       5.3 |        8.4 |      11.5
+       5.3 |       9.15 |        13
+       5.3 |      47.65 |        90
+       5.3 |   Infinity |  Infinity
+       5.4 |   Infinity |  Infinity
+       5.5 |        8.5 |      11.5
+       5.5 |        8.6 |      11.7
+       5.5 |       8.75 |        12
+       5.5 |       8.75 |        12
+       5.5 |          9 |      12.5
+       5.5 |        9.5 |      13.5
+       5.5 |   Infinity |  Infinity
+       5.5 |   Infinity |  Infinity
+       5.7 |   Infinity |  Infinity
+       5.9 |   Infinity |  Infinity
+         6 |       8.75 |      11.5
+         6 |          9 |        12
+         6 |       8.75 |      11.5
+         6 |        9.5 |        13
+         6 |       8.75 |      11.5
+       6.1 |       9.05 |        12
+       6.1 |   Infinity |  Infinity
+       6.2 |       8.85 |      11.5
+       6.3 |   Infinity |  Infinity
+       6.5 |          9 |      11.5
+       6.5 |       9.25 |        12
+       6.5 |       9.25 |        12
+       6.5 |   Infinity |  Infinity
+       6.6 |   Infinity |  Infinity
+       6.7 |        9.1 |      11.5
+       6.7 |   Infinity |  Infinity
+      6.75 |   Infinity |  Infinity
+       6.8 |   Infinity |  Infinity
+       6.9 |       9.55 |      12.2
+       6.9 |      48.45 |        90
+       6.9 |   Infinity |  Infinity
+         7 |       9.25 |      11.5
+         7 |       9.25 |      11.5
+         7 |       9.25 |      11.5
+         7 |   Infinity |  Infinity
+      7.15 |   Infinity |  Infinity
+       7.2 |      10.35 |      13.5
+       7.3 |      48.65 |        90
+       7.3 |   Infinity |  Infinity
+       7.3 |   Infinity |  Infinity
+       7.4 |       9.75 |      12.1
+       7.4 |   Infinity |  Infinity
+       7.5 |        9.5 |      11.5
+       7.5 |       9.75 |        12
+       7.5 |   Infinity |  Infinity
+       7.7 |        9.6 |      11.5
+       7.7 |   Infinity |  Infinity
+      7.75 |   Infinity |  Infinity
+         8 |       9.85 |      11.7
+         8 |         10 |        12
+         8 |       10.5 |        13
+       8.2 |   Infinity |  Infinity
+       8.3 |   Infinity |  Infinity
+       8.5 |         10 |      11.5
+       8.5 |       10.5 |      12.5
+       8.5 |   Infinity |  Infinity
+       8.6 |       53.8 |        99
+       8.7 |         10 |      11.3
+       8.7 |       10.2 |      11.7
+       8.9 |       10.2 |      11.5
+         9 |       10.5 |        12
+         9 |      10.15 |      11.3
+         9 |      10.25 |      11.5
+         9 |       10.5 |        12
+         9 |   Infinity |  Infinity
+       9.2 |       10.6 |        12
+       9.4 |       10.8 |      12.2
+       9.5 |      10.75 |        12
+       9.5 |      10.85 |      12.2
+       9.5 |   Infinity |  Infinity
+       9.6 |      10.55 |      11.5
+       9.7 |       10.6 |      11.5
+       9.7 |      10.85 |        12
+       9.8 |      11.15 |      12.5
+        10 |       10.8 |      11.6
+        10 |      10.75 |      11.5
+        10 |      11.25 |      12.5
+        10 |      11.25 |      12.5
+      10.2 |         11 |      11.8
+      10.5 |         11 |      11.5
+      10.5 |         11 |      11.5
+      10.5 |         12 |      13.5
+      10.7 |       11.5 |      12.3
+           |            |          
+(144 rows)
+
diff --git a/contrib/seg/expected/seg_1.out b/contrib/seg/expected/seg_1.out
index 446714f8ba020ec24eca915a486c39e6b42cb2f8..aef3df8aea1c5fab77dc3da223de6c4f49caf5a2 100644
--- a/contrib/seg/expected/seg_1.out
+++ b/contrib/seg/expected/seg_1.out
@@ -1065,3 +1065,154 @@ SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
  10.7 .. 12.3
 (143 rows)
 
+-- Test functions
+SELECT seg_lower(s), seg_center(s), seg_upper(s)
+FROM test_seg WHERE s @> '11.2..11.3' OR s IS NULL ORDER BY s;
+ seg_lower | seg_center | seg_upper 
+-----------+------------+-----------
+ -Infinity |  -Infinity |        40
+ -Infinity |  -Infinity |        82
+ -Infinity |  -Infinity |        90
+         1 |          7 |        13
+       1.3 |       6.65 |        12
+         2 |       6.75 |      11.5
+       2.1 |       6.95 |      11.8
+       2.3 |   Infinity |  Infinity
+       2.3 |   Infinity |  Infinity
+       2.4 |       6.85 |      11.3
+       2.5 |          7 |      11.5
+       2.5 |       7.15 |      11.8
+       2.6 |   Infinity |  Infinity
+       2.7 |       7.35 |        12
+         3 |   Infinity |  Infinity
+         3 |       30.5 |        58
+       3.1 |        7.3 |      11.5
+       3.5 |        7.5 |      11.5
+       3.5 |       7.85 |      12.2
+         4 |          8 |        12
+         4 |   Infinity |  Infinity
+         4 |          8 |        12
+         4 |       7.85 |      11.7
+         4 |       8.25 |      12.5
+         4 |        8.5 |        13
+         4 |         32 |        60
+         4 |   Infinity |  Infinity
+       4.2 |       7.85 |      11.5
+       4.2 |       7.95 |      11.7
+       4.5 |       8.25 |        12
+       4.5 |          8 |      11.5
+       4.5 |       8.25 |        12
+       4.5 |       8.25 |        12
+       4.5 |        8.5 |      12.5
+       4.5 |      59.75 |       115
+       4.7 |       8.25 |      11.8
+       4.8 |       8.15 |      11.5
+       4.8 |        8.2 |      11.6
+       4.8 |       8.65 |      12.5
+       4.8 |   Infinity |  Infinity
+       4.9 |       8.45 |        12
+       4.9 |   Infinity |  Infinity
+         5 |       8.25 |      11.5
+         5 |        8.5 |        12
+         5 |       17.5 |        30
+         5 |        8.2 |      11.4
+         5 |       8.25 |      11.5
+         5 |        8.3 |      11.6
+         5 |       8.35 |      11.7
+         5 |        8.5 |        12
+         5 |        8.5 |        12
+         5 |        8.5 |        12
+       5.2 |       8.35 |      11.5
+       5.2 |        8.6 |        12
+      5.25 |      8.625 |        12
+       5.3 |        8.4 |      11.5
+       5.3 |       9.15 |        13
+       5.3 |      47.65 |        90
+       5.3 |   Infinity |  Infinity
+       5.4 |   Infinity |  Infinity
+       5.5 |        8.5 |      11.5
+       5.5 |        8.6 |      11.7
+       5.5 |       8.75 |        12
+       5.5 |       8.75 |        12
+       5.5 |          9 |      12.5
+       5.5 |        9.5 |      13.5
+       5.5 |   Infinity |  Infinity
+       5.5 |   Infinity |  Infinity
+       5.7 |   Infinity |  Infinity
+       5.9 |   Infinity |  Infinity
+         6 |       8.75 |      11.5
+         6 |          9 |        12
+         6 |       8.75 |      11.5
+         6 |        9.5 |        13
+         6 |       8.75 |      11.5
+       6.1 |       9.05 |        12
+       6.1 |   Infinity |  Infinity
+       6.2 |       8.85 |      11.5
+       6.3 |   Infinity |  Infinity
+       6.5 |          9 |      11.5
+       6.5 |       9.25 |        12
+       6.5 |       9.25 |        12
+       6.5 |   Infinity |  Infinity
+       6.6 |   Infinity |  Infinity
+       6.7 |        9.1 |      11.5
+       6.7 |   Infinity |  Infinity
+      6.75 |   Infinity |  Infinity
+       6.8 |   Infinity |  Infinity
+       6.9 |       9.55 |      12.2
+       6.9 |      48.45 |        90
+       6.9 |   Infinity |  Infinity
+         7 |       9.25 |      11.5
+         7 |       9.25 |      11.5
+         7 |       9.25 |      11.5
+         7 |   Infinity |  Infinity
+      7.15 |   Infinity |  Infinity
+       7.2 |      10.35 |      13.5
+       7.3 |      48.65 |        90
+       7.3 |   Infinity |  Infinity
+       7.3 |   Infinity |  Infinity
+       7.4 |       9.75 |      12.1
+       7.4 |   Infinity |  Infinity
+       7.5 |        9.5 |      11.5
+       7.5 |       9.75 |        12
+       7.5 |   Infinity |  Infinity
+       7.7 |        9.6 |      11.5
+       7.7 |   Infinity |  Infinity
+      7.75 |   Infinity |  Infinity
+         8 |       9.85 |      11.7
+         8 |         10 |        12
+         8 |       10.5 |        13
+       8.2 |   Infinity |  Infinity
+       8.3 |   Infinity |  Infinity
+       8.5 |         10 |      11.5
+       8.5 |       10.5 |      12.5
+       8.5 |   Infinity |  Infinity
+       8.6 |       53.8 |        99
+       8.7 |         10 |      11.3
+       8.7 |       10.2 |      11.7
+       8.9 |       10.2 |      11.5
+         9 |       10.5 |        12
+         9 |      10.15 |      11.3
+         9 |      10.25 |      11.5
+         9 |       10.5 |        12
+         9 |   Infinity |  Infinity
+       9.2 |       10.6 |        12
+       9.4 |       10.8 |      12.2
+       9.5 |      10.75 |        12
+       9.5 |      10.85 |      12.2
+       9.5 |   Infinity |  Infinity
+       9.6 |      10.55 |      11.5
+       9.7 |       10.6 |      11.5
+       9.7 |      10.85 |        12
+       9.8 |      11.15 |      12.5
+        10 |       10.8 |      11.6
+        10 |      10.75 |      11.5
+        10 |      11.25 |      12.5
+        10 |      11.25 |      12.5
+      10.2 |         11 |      11.8
+      10.5 |         11 |      11.5
+      10.5 |         11 |      11.5
+      10.5 |         12 |      13.5
+      10.7 |       11.5 |      12.3
+           |            |          
+(144 rows)
+
diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c
index 65ddda1671f9b0bfc517f5f98c527dca24112a48..9579eeab3ef446108e3646150e8b72a417c6e6f4 100644
--- a/contrib/seg/seg.c
+++ b/contrib/seg/seg.c
@@ -35,9 +35,9 @@ extern int	 seg_yydebug;
 */
 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);
+float4		seg_lower(SEG * seg);
+float4		seg_upper(SEG * seg);
+float4		seg_center(SEG * seg);
 
 /*
 ** GiST support methods
@@ -138,14 +138,14 @@ seg_out(SEG * seg)
 	{
 		if (seg->l_ext != '-')
 		{
-			/* print the lower boudary if exists */
+			/* print the lower boundary 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 */
+			/* print the upper boundary if exists */
 			p += sprintf(p, " ");
 			if (seg->u_ext == '>' || seg->u_ext == '<' || seg->l_ext == '~')
 				p += sprintf(p, "%c", seg->u_ext);
@@ -156,40 +156,22 @@ seg_out(SEG * seg)
 	return (result);
 }
 
-float32
+float4
 seg_center(SEG * seg)
 {
-	float32		result = (float32) palloc(sizeof(float32data));
-
-	if (!seg)
-		return (float32) NULL;
-
-	*result = ((float) seg->lower + (float) seg->upper) / 2.0;
-	return (result);
+	return ((float) seg->lower + (float) seg->upper) / 2.0;
 }
 
-float32
+float4
 seg_lower(SEG * seg)
 {
-	float32		result = (float32) palloc(sizeof(float32data));
-
-	if (!seg)
-		return (float32) NULL;
-
-	*result = (float) seg->lower;
-	return (result);
+	return seg->lower;
 }
 
-float32
+float4
 seg_upper(SEG * seg)
 {
-	float32		result = (float32) palloc(sizeof(float32data));
-
-	if (!seg)
-		return (float32) NULL;
-
-	*result = (float) seg->upper;
-	return (result);
+	return seg->upper;
 }
 
 
diff --git a/contrib/seg/seg.sql.in b/contrib/seg/seg.sql.in
index 6f7d1a6438a2af28e5d8633c52813d074f6cf3b2..ae71929a73eff7dc16fda4c498d5b95d6fc24395 100644
--- a/contrib/seg/seg.sql.in
+++ b/contrib/seg/seg.sql.in
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/seg/seg.sql.in,v 1.17 2008/04/14 17:05:32 tgl Exp $ */
+/* $PostgreSQL: pgsql/contrib/seg/seg.sql.in,v 1.18 2008/04/18 18:43:08 alvherre Exp $ */
 
 -- Adjust this setting to control where the objects get created.
 SET search_path = public;
@@ -164,6 +164,11 @@ LANGUAGE C STRICT IMMUTABLE;
 
 -- miscellaneous
 
+CREATE OR REPLACE FUNCTION seg_center(seg)
+RETURNS float4
+AS 'MODULE_PATHNAME'
+LANGUAGE C STRICT IMMUTABLE;
+
 CREATE OR REPLACE FUNCTION seg_upper(seg)
 RETURNS float4
 AS 'MODULE_PATHNAME'
diff --git a/contrib/seg/segdata.h b/contrib/seg/segdata.h
index 69d85e0bc0caeebe1266838718127b313eec20fe..420df739c51ca4417d2756bc0340b8becd466967 100644
--- a/contrib/seg/segdata.h
+++ b/contrib/seg/segdata.h
@@ -1,7 +1,7 @@
 typedef struct SEG
 {
-	float		lower;
-	float		upper;
+	float4		lower;
+	float4		upper;
 	char		l_sigd;
 	char		u_sigd;
 	char		l_ext;
diff --git a/contrib/seg/sql/seg.sql b/contrib/seg/sql/seg.sql
index 91d771db181ce11e2fe4329ec87c666f8ee8c3fa..61ad519613e3ab423f1022aa45e08a8a6b55d595 100644
--- a/contrib/seg/sql/seg.sql
+++ b/contrib/seg/sql/seg.sql
@@ -223,3 +223,7 @@ SELECT count(*) FROM test_seg WHERE s @> '11..11.3';
 
 -- Test sorting 
 SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
+
+-- Test functions
+SELECT seg_lower(s), seg_center(s), seg_upper(s)
+FROM test_seg WHERE s @> '11.2..11.3' OR s IS NULL ORDER BY s;
diff --git a/contrib/seg/uninstall_seg.sql b/contrib/seg/uninstall_seg.sql
index 2822927531db915d712de985552175cde717b7c1..f706bfb73958e4eaa87df7170c6f5e60b8952e72 100644
--- a/contrib/seg/uninstall_seg.sql
+++ b/contrib/seg/uninstall_seg.sql
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/seg/uninstall_seg.sql,v 1.6 2008/04/14 17:05:32 tgl Exp $ */
+/* $PostgreSQL: pgsql/contrib/seg/uninstall_seg.sql,v 1.7 2008/04/18 18:43:08 alvherre Exp $ */
 
 -- Adjust this setting to control where the objects get dropped.
 SET search_path = public;
@@ -51,6 +51,8 @@ DROP OPERATOR <= (seg, seg);
 
 DROP OPERATOR < (seg, seg);
 
+DROP FUNCTION seq_center(seg);
+
 DROP FUNCTION seg_lower(seg);
 
 DROP FUNCTION seg_upper(seg);
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index dd70a8c807e4eef90a251fc1d50fc573195ea769..a5c013bd6c68fd9cdcf29ce2f762ecf05bd7e89a 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.240 2008/03/26 21:10:37 alvherre Exp $
+ *	  $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.241 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -122,7 +122,7 @@ static const struct typinfo TypInfo[] = {
 	F_INT2IN, F_INT2OUT},
 	{"int4", INT4OID, 0, 4, true, 'i', 'p',
 	F_INT4IN, F_INT4OUT},
-	{"float4", FLOAT4OID, 0, 4, false, 'i', 'p',
+	{"float4", FLOAT4OID, 0, 4, true, 'i', 'p',
 	F_FLOAT4IN, F_FLOAT4OUT},
 	{"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'i', 'p',
 	F_NAMEIN, F_NAMEOUT},
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 96550744158da3f217de3e17237f60c94fcbf249..0363b213a9c805832ad10fb9ab2ef2e08c6945dd 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.117 2008/04/03 16:27:25 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.118 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1304,7 +1304,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
 				/* XXX knows more than it should about type float4: */
 				arry = construct_array(numdatums, nnum,
 									   FLOAT4OID,
-									   sizeof(float4), false, 'i');
+									   sizeof(float4), true, 'i');
 				values[i++] = PointerGetDatum(arry);	/* stanumbersN */
 			}
 			else
diff --git a/src/backend/utils/fmgr/README b/src/backend/utils/fmgr/README
index 3fd3a158ea407ccf3de9698ebb330d2b2d93b893..63990ca1587bcaca47e9ffe116f8f985306c3966 100644
--- a/src/backend/utils/fmgr/README
+++ b/src/backend/utils/fmgr/README
@@ -1,4 +1,4 @@
-$PostgreSQL: pgsql/src/backend/utils/fmgr/README,v 1.10 2008/03/20 17:55:15 momjian Exp $
+$PostgreSQL: pgsql/src/backend/utils/fmgr/README,v 1.11 2008/04/18 18:43:09 alvherre Exp $
 
 Function Manager
 ================
@@ -211,14 +211,13 @@ also amenable to machine processing --- for example, we could probably
 write a script that scans code like this and extracts argument and result
 type info for comparison to the pg_proc table.
 
-For the standard data types float4, float8, and int8, these macros should
+For the standard data types float8 and int8, these macros should
 hide the indirection and space allocation involved, so that the function's
 code is not explicitly aware that these types are pass-by-reference.  This
 will offer a considerable gain in readability, and it also opens up the
 opportunity to make these types be pass-by-value on machines where it's
 feasible to do so.  (For example, on an Alpha it's pretty silly to make int8
-be pass-by-ref, since Datum is going to be 64 bits anyway.  float4 could
-become pass-by-value on all machines...)
+be pass-by-ref, since Datum is going to be 64 bits anyway.)
 
 Here are the proposed macros and coding conventions:
 
@@ -248,20 +247,20 @@ which expands to
 Argument values are ordinarily fetched using code like
 	int32	name = PG_GETARG_INT32(number);
 
-For float4, float8, and int8, the PG_GETARG macros will hide the pass-by-
-reference nature of the data types; for example PG_GETARG_FLOAT4 expands to
-	(* (float4 *) DatumGetPointer(fcinfo->arg[number]))
+For float8 and int8, the PG_GETARG macros will hide the pass-by-reference
+nature of the data types; for example PG_GETARG_FLOAT8 expands to
+	(* (float8 *) DatumGetPointer(fcinfo->arg[number]))
 and would typically be called like this:
-	float4  arg = PG_GETARG_FLOAT4(0);
-Note that "float4" and "float8" are the recommended typedefs to use, not
-"float32data" and "float64data", and the macros are named accordingly.
-But 64-bit ints should be declared as "int64".
+	float8  arg = PG_GETARG_FLOAT8(0);
+Note that "float8" is the recommended typedef to use, not "float64data", and
+the macros are named accordingly.  But 64-bit ints should be declared as
+"int64".
 
 Non-null values are returned with a PG_RETURN_XXX macro of the appropriate
 type.  For example, PG_RETURN_INT32 expands to
 	return Int32GetDatum(x)
-PG_RETURN_FLOAT4, PG_RETURN_FLOAT8, and PG_RETURN_INT64 hide the pass-by-
-reference nature of their datatypes.
+PG_RETURN_FLOAT8 and PG_RETURN_INT64 hide the pass-by-reference nature of
+their datatypes.
 
 fmgr.h will provide PG_GETARG and PG_RETURN macros for all the basic data
 types.  Modules or header files that define specialized SQL datatypes
@@ -334,7 +333,7 @@ Again, this style of coding does not allow for expressing NULL inputs
 or receiving a NULL result.
 
 As with the callee-side situation, I propose adding argument conversion
-macros that hide the pass-by-reference nature of int8, float4, and
+macros that hide the pass-by-reference nature of int8, and
 float8, with an eye to making those types relatively painless to convert
 to pass-by-value.
 
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index 44667e62be4137ea41c74b960192a0072a152f23..853fb9eda93f4bdc37e78a8fd48a788d1c44d15e 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.115 2008/04/17 21:37:28 alvherre Exp $
+ *	  $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.116 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2060,10 +2060,25 @@ Int64GetDatum(int64 X)
 Datum
 Float4GetDatum(float4 X)
 {
-	float4	   *retval = (float4 *) palloc(sizeof(float4));
+	union {
+		float4	value;
+		int32	retval;
+	} myunion;
 
-	*retval = X;
-	return PointerGetDatum(retval);
+	myunion.value = X;
+	return SET_4_BYTES(myunion.retval);
+}
+
+float4
+DatumGetFloat4(Datum X)
+{
+	union {
+		int32	value; 
+		float4	retval;
+	} myunion;
+
+	myunion.value = GET_4_BYTES(X);
+	return myunion.retval;
 }
 
 Datum
diff --git a/src/include/c.h b/src/include/c.h
index f9b0acf957131b8e3387ef8acbfc1854f2d8ff6c..e2697099cbd91262eb6bb0e19d2401db5d13f58a 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/c.h,v 1.224 2008/03/17 19:44:41 petere Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.225 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -253,8 +253,8 @@ typedef uint32 bits32;			/* >= 32 bits */
  *		Floating point number, AT LEAST N BITS IN SIZE,
  *		used for numerical computations.
  *
- *		Since sizeof(floatN) may be > sizeof(char *), always pass
- *		floatN by reference.
+ *		Since sizeof(float8) may be > sizeof(char *), always pass
+ *		float8 by reference.  float4 is passed by value.
  *
  * XXX: these typedefs are now deprecated in favor of float4 and float8.
  * They will eventually go away.
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index f80d918c656ab63ff1825ea565eccc2a73d79bcd..83c0dbd36940e16a13bb813265bc1b72afb5932e 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.448 2008/04/14 17:05:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.449 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*							yyyymmddN */
-#define CATALOG_VERSION_NO	200804141
+#define CATALOG_VERSION_NO	200804181
 
 #endif
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index 2a39d2a6b995710ef14e84b1995228706d5a032d..08b18da37d6486b14b7c8e65adfa9507f3b0365e 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.135 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.136 2008/04/18 18:43:09 alvherre Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -287,8 +287,8 @@ DATA(insert ( 1247 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
 { 1255, {"pronamespace"},		26, -1, 4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1255, {"proowner"},			26, -1, 4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1255, {"prolang"},			26, -1, 4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"procost"},		   700, -1, 4,	5, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"prorows"},		   700, -1, 4,	6, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
+{ 1255, {"procost"},		   700, -1, 4,	5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
+{ 1255, {"prorows"},		   700, -1, 4,	6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1255, {"proisagg"},			16, -1, 1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
 { 1255, {"prosecdef"},			16, -1, 1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
 { 1255, {"proisstrict"},		16, -1, 1,	9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
@@ -309,8 +309,8 @@ DATA(insert ( 1255 proname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0));
 DATA(insert ( 1255 pronamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1255 proowner			26 -1 4   3 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1255 prolang			26 -1 4   4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 procost		   700 -1 4   5 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1255 prorows		   700 -1 4   6 0 -1 -1 f p i t f f t 0));
+DATA(insert ( 1255 procost		   700 -1 4   5 0 -1 -1 t p i t f f t 0));
+DATA(insert ( 1255 prorows		   700 -1 4   6 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1255 proisagg			16 -1 1   7 0 -1 -1 t p c t f f t 0));
 DATA(insert ( 1255 prosecdef		16 -1 1   8 0 -1 -1 t p c t f f t 0));
 DATA(insert ( 1255 proisstrict		16 -1 1   9 0 -1 -1 t p c t f f t 0));
@@ -395,7 +395,7 @@ DATA(insert ( 1249 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
 { 1259, {"relfilenode"},   26, -1,	4,	6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1259, {"reltablespace"}, 26, -1,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1259, {"relpages"},	   23, -1,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltuples"},	   700, -1, 4,	9, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
+{ 1259, {"reltuples"},	   700, -1, 4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1259, {"reltoastrelid"}, 26, -1,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1259, {"reltoastidxid"}, 26, -1,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
 { 1259, {"relhasindex"},   16, -1,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
@@ -423,7 +423,7 @@ DATA(insert ( 1259 relam			26 -1 4   5 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 relfilenode		26 -1 4   6 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 reltablespace	26 -1 4   7 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 relpages			23 -1 4   8 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 reltuples	   700 -1 4   9 0 -1 -1 f p i t f f t 0));
+DATA(insert ( 1259 reltuples	   700 -1 4   9 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 reltoastrelid	26 -1 4  10 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 reltoastidxid	26 -1 4  11 0 -1 -1 t p i t f f t 0));
 DATA(insert ( 1259 relhasindex		16 -1 1  12 0 -1 -1 t p c t f f t 0));
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 8f2ca40093ff9ba62f5ebe91da5ea27dfbbc3c88..2c98f2b5466362d2f64c6a77cd0554089ae44f53 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.193 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.194 2008/04/18 18:43:09 alvherre Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -368,7 +368,7 @@ DESCR("");
 
 /* OIDS 700 - 799 */
 
-DATA(insert OID = 700 (  float4    PGNSP PGUID	4 f b t \054 0	 0 1021 float4in float4out float4recv float4send - - - i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 700 (  float4    PGNSP PGUID	4 t b t \054 0	 0 1021 float4in float4out float4recv float4send - - - i p f 0 -1 0 _null_ _null_ ));
 DESCR("single-precision floating point number, 4-byte storage");
 #define FLOAT4OID 700
 DATA(insert OID = 701 (  float8    PGNSP PGUID	8 f b t \054 0	 0 1022 float8in float8out float8recv float8send - - - d p f 0 -1 0 _null_ _null_ ));
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 3c4f414f643c43706a42d611053cae54478c02aa..40ecd451a850c3d4cfdc6144aa6764b290ae1232 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1995, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/postgres.h,v 1.89 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/postgres.h,v 1.90 2008/04/18 18:43:09 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -546,18 +546,13 @@ extern Datum Int64GetDatum(int64 X);
 /*
  * DatumGetFloat4
  *		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.
  */
 
-#define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X)))
+extern float4 DatumGetFloat4(Datum X);
 
 /*
  * Float4GetDatum
  *		Returns datum representation for a 4-byte floating point number.
- *
- * Note: this routine returns a reference to palloc'd space.
  */
 
 extern Datum Float4GetDatum(float4 X);
@@ -583,57 +578,12 @@ extern Datum Float4GetDatum(float4 X);
 extern Datum Float8GetDatum(float8 X);
 
 
-/*
- * DatumGetFloat32
- *		Returns 32-bit floating point value of a datum.
- *		This is really a pointer, of course.
- *
- * XXX: this macro is now deprecated in favor of DatumGetFloat4.
- * It will eventually go away.
- */
-
-#define DatumGetFloat32(X) ((float32) DatumGetPointer(X))
-
-/*
- * Float32GetDatum
- *		Returns datum representation for a 32-bit floating point number.
- *		This is really a pointer, of course.
- *
- * XXX: this macro is now deprecated in favor of Float4GetDatum.
- * It will eventually go away.
- */
-
-#define Float32GetDatum(X) PointerGetDatum(X)
-
-/*
- * DatumGetFloat64
- *		Returns 64-bit floating point value of a datum.
- *		This is really a pointer, of course.
- *
- * XXX: this macro is now deprecated in favor of DatumGetFloat8.
- * It will eventually go away.
- */
-
-#define DatumGetFloat64(X) ((float64) DatumGetPointer(X))
-
-/*
- * Float64GetDatum
- *		Returns datum representation for a 64-bit floating point number.
- *		This is really a pointer, of course.
- *
- * XXX: this macro is now deprecated in favor of Float8GetDatum.
- * It will eventually go away.
- */
-
-#define Float64GetDatum(X) PointerGetDatum(X)
-
 /*
  * Int64GetDatumFast
- * Float4GetDatumFast
  * Float8GetDatumFast
  *
  * These macros are intended to allow writing code that does not depend on
- * whether int64, float4, float8 are pass-by-reference types, while not
+ * whether int64, float8 are pass-by-reference types, while not
  * sacrificing performance when they are.  The argument must be a variable
  * that will exist and have the same value for as long as the Datum is needed.
  * In the pass-by-ref case, the address of the variable is taken to use as
@@ -642,7 +592,6 @@ extern Datum Float8GetDatum(float8 X);
  */
 
 #define Int64GetDatumFast(X)  PointerGetDatum(&(X))
-#define Float4GetDatumFast(X) PointerGetDatum(&(X))
 #define Float8GetDatumFast(X) PointerGetDatum(&(X))