1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Modify the float4 datatype to be pass-by-val. Along the way, remove the last

uses of the long-deprecated float32 in contrib/seg; the definitions themselves
are still there, but no longer used.  fmgr/README updated to match.

I added a CREATE FUNCTION to account for existing seg_center() code in seg.c
too, and some tests for it and the neighbor functions.  At the same time,
remove checks for NULL which are not needed (because the functions are declared
STRICT).

I had to do some adjustments to contrib's btree_gist too.  The choices for
representation there are not ideal for changing the underlying types :-(

Original patch by Zoltan Boszormenyi, with some adjustments by me.
This commit is contained in:
Alvaro Herrera
2008-04-18 18:43:09 +00:00
parent b8e5581d76
commit 7861d72ea2
20 changed files with 392 additions and 129 deletions

View File

@ -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));