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

problem with realizing gist index

From: Sergej Galkin <sergej(dot)galkin(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: problem with realizing gist index
Date: 2009-12-31 11:58:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Hello all,
I'm creating gist index for testing purpuses :)

I created index element structure:

typedef struct moving_object
    double x_high;
    double y_high;
    double x_low;
    double y_low;
    time_t mov_time;
    double x_plus;
    double y_plus;
    double x_minus;
    double y_minus;
} moving_object;

And defined macros that return pointer to this structure:

#define DatumGetMovP(x) ((moving_object*)DatumGetPointer(x))

but index interface function gives me error: Incompatible type in assignment
Error line I style - bold

Datum gist_mov_union(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
     int *sizep = (int *) PG_GETARG_POINTER(1);
    int num_obj;
    moving_object *pageunion, curr;

    num_obj = entryvec->n;

    pageunion = (moving_object*) palloc(sizeof(moving_object));
   * curr = DatumGetMovP(entryvec->vector[0].key);*
    memcpy((void *) pageunion, (void *) curr, sizeof(moving_object));

    for(int i = 1; i < num_obj; i++)
        curr = DatumGetMovP(entryvec->vector[i].key);
        if (pageunion->x_high > curr->x_high)
            pageunion->x_high = curr->x_high;
        if (pageunion->y_high < curr->y_high)
            pageunion->y_high = curr->y_high;
        if (pageunion->x_low < curr->x_low)
            pageunion->x_low = curr->x_low;
        if (pageunion->y_low > curr->y_low)
            pageunion->y_low = curr->y_low;

    *sizep = sizeof(moving_object);

Can anybody know what the problem ? I imagine that my defined function
returns not pointer, but stucture (??) ?

Best regards,
Sergej Galkin


pgsql-hackers by date

Next:From: Andres FreundDate: 2009-12-31 12:14:07
Subject: Re: Hot Standy introduced problem with query cancel behavior
Previous:From: fangfang liuDate: 2009-12-31 11:43:14
Subject: Re: add xml support function

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