Skip site navigation (1) Skip section navigation (2)

Re: gist access methods parameter types

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: (view raw, whole thread or download thread mbox)
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

Datum delta3d_compress(PG_FUNCTION_ARGS) {
    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",
            e = DatumGetHeapTupleHeader(GetAttributeByName(in, "e",

            delta3d *compressed_data = (delta3d *) palloc(sizeof (delta3d));
            compressed_data->xi = DatumGetFloat8(GetAttributeByName(i, "x",
            compressed_data->yi = DatumGetFloat8(GetAttributeByName(i, "y",
            compressed_data->ti = DatumGetTimestamp(GetAttributeByName(i,
"t", &isnull));
            compressed_data->xe = DatumGetFloat8(GetAttributeByName(e, "x",
            compressed_data->ye = DatumGetFloat8(GetAttributeByName(e, "y",
            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?*


In response to

pgsql-hackers by date

Next:From: Guillaume Du PasquierDate: 2010-09-27 15:53:35
Subject: client socket TIME_WAIT state after PQfinish
Previous:From: Alvaro HerreraDate: 2010-09-27 15:35:24
Subject: Re: A small update for postgresql.conf.sample

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group