diff -dcrpN pgsql.orig-byref/config/c-compiler.m4 pgsql-float4-byval/config/c-compiler.m4
*** pgsql.orig-byref/config/c-compiler.m4	2008-02-18 13:49:56.000000000 +0100
--- pgsql-float4-byval/config/c-compiler.m4	2008-03-31 09:34:03.000000000 +0200
*************** AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_
*** 62,68 ****
  
  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.])
  fi
  undefine([Ac_define])dnl
  undefine([Ac_cachevar])dnl
--- 62,68 ----
  
  Ac_define=$Ac_cachevar
  if test x"$Ac_cachevar" = xyes ; then
!   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 -dcrpN pgsql.orig-byref/src/backend/bootstrap/bootstrap.c pgsql-float4-byval/src/backend/bootstrap/bootstrap.c
*** pgsql.orig-byref/src/backend/bootstrap/bootstrap.c	2008-03-30 13:29:44.000000000 +0200
--- pgsql-float4-byval/src/backend/bootstrap/bootstrap.c	2008-03-31 09:34:03.000000000 +0200
*************** static const struct typinfo TypInfo[] = 
*** 122,128 ****
  	F_INT2IN, F_INT2OUT},
  	{"int4", INT4OID, 0, 4, true, 'i', 'p',
  	F_INT4IN, F_INT4OUT},
! 	{"float4", FLOAT4OID, 0, 4, false, 'i', 'p',
  	F_FLOAT4IN, F_FLOAT4OUT},
  	{"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'i', 'p',
  	F_NAMEIN, F_NAMEOUT},
--- 122,128 ----
  	F_INT2IN, F_INT2OUT},
  	{"int4", INT4OID, 0, 4, true, 'i', 'p',
  	F_INT4IN, F_INT4OUT},
! 	{"float4", FLOAT4OID, 0, 4, true, 'i', 'p',
  	F_FLOAT4IN, F_FLOAT4OUT},
  	{"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'i', 'p',
  	F_NAMEIN, F_NAMEOUT},
diff -dcrpN pgsql.orig-byref/src/backend/commands/analyze.c pgsql-float4-byval/src/backend/commands/analyze.c
*** pgsql.orig-byref/src/backend/commands/analyze.c	2008-03-30 13:29:45.000000000 +0200
--- pgsql-float4-byval/src/backend/commands/analyze.c	2008-03-31 09:34:03.000000000 +0200
*************** update_attstats(Oid relid, int natts, Va
*** 1224,1230 ****
  				/* XXX knows more than it should about type float4: */
  				arry = construct_array(numdatums, nnum,
  									   FLOAT4OID,
! 									   sizeof(float4), false, 'i');
  				values[i++] = PointerGetDatum(arry);	/* stanumbersN */
  			}
  			else
--- 1224,1230 ----
  				/* XXX knows more than it should about type float4: */
  				arry = construct_array(numdatums, nnum,
  									   FLOAT4OID,
! 									   sizeof(float4), true, 'i');
  				values[i++] = PointerGetDatum(arry);	/* stanumbersN */
  			}
  			else
diff -dcrpN pgsql.orig-byref/src/backend/utils/fmgr/fmgr.c pgsql-float4-byval/src/backend/utils/fmgr/fmgr.c
*** pgsql.orig-byref/src/backend/utils/fmgr/fmgr.c	2008-03-26 10:15:15.000000000 +0100
--- pgsql-float4-byval/src/backend/utils/fmgr/fmgr.c	2008-03-31 09:34:03.000000000 +0200
*************** Int64GetDatum(int64 X)
*** 2060,2069 ****
  Datum
  Float4GetDatum(float4 X)
  {
! 	float4	   *retval = (float4 *) palloc(sizeof(float4));
  
! 	*retval = X;
! 	return PointerGetDatum(retval);
  }
  
  Datum
--- 2060,2084 ----
  Datum
  Float4GetDatum(float4 X)
  {
! 	union {
! 		float4	value;
! 		int32	retval;
! 	} myunion;
  
! 	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 -dcrpN pgsql.orig-byref/src/include/catalog/pg_attribute.h pgsql-float4-byval/src/include/catalog/pg_attribute.h
*** pgsql.orig-byref/src/include/catalog/pg_attribute.h	2008-03-30 13:29:50.000000000 +0200
--- pgsql-float4-byval/src/include/catalog/pg_attribute.h	2008-03-31 09:34:03.000000000 +0200
*************** DATA(insert ( 1247 tableoid			26 0  4  -
*** 287,294 ****
  { 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, {"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 }, \
--- 287,294 ----
  { 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, 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 }, \
*************** DATA(insert ( 1255 proname			19 -1 NAMED
*** 309,316 ****
  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 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));
--- 309,316 ----
  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 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));
*************** DATA(insert ( 1249 tableoid			26 0  4  -
*** 395,401 ****
  { 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, {"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 }, \
--- 395,401 ----
  { 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, 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 }, \
*************** DATA(insert ( 1259 relam			26 -1 4   5 0
*** 423,429 ****
  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 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));
--- 423,429 ----
  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 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 -dcrpN pgsql.orig-byref/src/include/catalog/pg_type.h pgsql-float4-byval/src/include/catalog/pg_type.h
*** pgsql.orig-byref/src/include/catalog/pg_type.h	2008-03-30 13:29:50.000000000 +0200
--- pgsql-float4-byval/src/include/catalog/pg_type.h	2008-03-31 09:34:03.000000000 +0200
*************** DESCR("");
*** 368,374 ****
  
  /* 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_ ));
  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_ ));
--- 368,374 ----
  
  /* OIDS 700 - 799 */
  
! 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 -dcrpN pgsql.orig-byref/src/include/postgres.h pgsql-float4-byval/src/include/postgres.h
*** pgsql.orig-byref/src/include/postgres.h	2008-03-30 13:29:50.000000000 +0200
--- pgsql-float4-byval/src/include/postgres.h	2008-03-31 09:34:03.000000000 +0200
*************** extern Datum Int64GetDatum(int64 X);
*** 546,563 ****
  /*
   * 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)))
  
  /*
   * 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);
--- 546,558 ----
  /*
   * DatumGetFloat4
   *		Returns 4-byte floating point value of a datum.
   */
  
! extern float4 DatumGetFloat4(Datum X);
  
  /*
   * Float4GetDatum
   *		Returns datum representation for a 4-byte floating point number.
   */
  
  extern Datum Float4GetDatum(float4 X);
*************** extern Datum Float8GetDatum(float8 X);
*** 584,639 ****
  
  
  /*
-  * 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
   * 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
--- 579,589 ----
  
  
  /*
   * Int64GetDatumFast
   * Float8GetDatumFast
   *
   * These macros are intended to allow writing code that does not depend on
!  * 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
*************** extern Datum Float8GetDatum(float8 X);
*** 642,648 ****
   */
  
  #define Int64GetDatumFast(X)  PointerGetDatum(&(X))
- #define Float4GetDatumFast(X) PointerGetDatum(&(X))
  #define Float8GetDatumFast(X) PointerGetDatum(&(X))
  
  
--- 592,597 ----
