From: | Marios Vodas <mvodas(at)gmail(dot)com> |
---|---|
To: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: gist access methods parameter types |
Date: | 2010-09-27 15:52:07 |
Message-ID: | AANLkTi=TYUrWad9wO_mj9WeRZeYEYOgwc45-ZLYhbf_Y@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Please can you answer the question of whether entry->key in compress should
be of delta3d sql type (composite type) and if not of what it should be
since the type I index is different from the type stored in tree?
Taking into consideration the types I described before this is my code for
compress.
Datum delta3d_compress(PG_FUNCTION_ARGS) {
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
GISTENTRY *retval;
HeapTupleHeader in;
HeapTupleHeader i;
HeapTupleHeader e;
bool isnull;
if (entry->leafkey) {
in = DatumGetHeapTupleHeader(entry->key);
if (in != NULL) {
i = DatumGetHeapTupleHeader(GetAttributeByName(in, "i",
&isnull));
e = DatumGetHeapTupleHeader(GetAttributeByName(in, "e",
&isnull));
delta3d *compressed_data = (delta3d *) palloc(sizeof (delta3d));
compressed_data->xi = DatumGetFloat8(GetAttributeByName(i, "x",
&isnull));
compressed_data->yi = DatumGetFloat8(GetAttributeByName(i, "y",
&isnull));
compressed_data->ti = DatumGetTimestamp(GetAttributeByName(i,
"t", &isnull));
compressed_data->xe = DatumGetFloat8(GetAttributeByName(e, "x",
&isnull));
compressed_data->ye = DatumGetFloat8(GetAttributeByName(e, "y",
&isnull));
compressed_data->te = DatumGetTimestamp(GetAttributeByName(e,
"t", &isnull));
compressed_data->trajectory =
DatumGetInt32(GetAttributeByName(in, "trajectory", &isnull));
retval = palloc(sizeof (GISTENTRY));
gistentryinit(*retval, PointerGetDatum(compressed_data),
entry->rel, entry->page, entry->offset, FALSE);
} else {
retval = palloc(sizeof (GISTENTRY));
gistentryinit(*retval, (Datum) 0, entry->rel, entry->page,
entry->offset, FALSE);
}
} else {
retval = entry; *//does this have to change? I thing it is going to
be of C type delta3d_mbb, am I right?*
}
PG_RETURN_POINTER(retval);
}
From | Date | Subject | |
---|---|---|---|
Next Message | Guillaume Du Pasquier | 2010-09-27 15:53:35 | client socket TIME_WAIT state after PQfinish |
Previous Message | Alvaro Herrera | 2010-09-27 15:35:24 | Re: A small update for postgresql.conf.sample |