Re: gist access methods parameter types
От | Marios Vodas |
---|---|
Тема | Re: gist access methods parameter types |
Дата | |
Msg-id | AANLkTi=TYUrWad9wO_mj9WeRZeYEYOgwc45-ZLYhbf_Y@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: gist access methods parameter types (Marios Vodas <mvodas@gmail.com>) |
Список | 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);}
В списке pgsql-hackers по дате отправления: