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: | dfebc1f10912310358n196112adpf90613a092cddbf4@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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));
// THIS IS THE ERROR LINE
* curr = DatumGetMovP(entryvec->vector[0].key);*
make_now(curr);
memcpy((void *) pageunion, (void *) curr, sizeof(moving_object));
for(int i = 1; i < num_obj; i++)
{
curr = DatumGetMovP(entryvec->vector[i].key);
make_now(curr);
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);
PG_RETURN_POINTER(pageunion);
}*
*
Can anybody know what the problem ? I imagine that my defined function
returns not pointer, but stucture (??) ?
Best regards,
Sergej Galkin
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2009-12-31 12:14:07 | Re: Hot Standy introduced problem with query cancel behavior |
Previous Message | fangfang liu | 2009-12-31 11:43:14 | Re: add xml support function |