Re: gist access methods parameter types - Mailing list pgsql-hackers

From Marios Vodas
Subject Re: gist access methods parameter types
Date
Msg-id AANLkTi=Gt5uFQF9RG+t3Bx0HMEmNuDdfXb0YZeMf9jWV@mail.gmail.com
Whole thread Raw
In response to Re: gist access methods parameter types  (Dimitri Fontaine <dfontaine@hi-media.com>)
Responses Re: gist access methods parameter types
List pgsql-hackers
Let me explain better what I want to do.
I want to have the types in sql level (composite types) like this:
--Spatio-Temporal Position in 3 Dimensions(cartessian x, cartessian y, time)
CREATE TYPE pos3d AS
(
  x double precision,
  y double precision,
  t timestamp
);

--Spatio-Temporal Delta (comes from Δ, meaning alteration/change)
  --i stands for (i)nitial position
  --e stands for (e)nding position
  --trajectory holds the id of the trajectory in which the current delta belongs to
CREATE TYPE delta3d AS
(
  i pos3d,
  e pos3d,
  trajectory integer
);

Having them in sql level eases my work much more than having them as base types in C. But I need an index to speed up some operations. So I build two types in C just for indexing purposes:
typedef struct {
    float8 xi, yi;
    Timestamp ti;
    float8 xe, ye;
    Timestamp te;
    int32 trajectory;
} delta3d;

typedef struct {
    float8 xl, yl;
    Timestamp tl;
    float8 xh, yh;
    Timestamp th;
} delta3d_mbb;

As you see the first is a replica of my sql type in C and the second misses some information (it is just the minimum bounding box which means that we don't know initial/ending positions neither the trajectory id). The second type is intended for non-leaf nodes while the first for leaf nodes.
My implementation of the tree is a kind of 3D-Rtree.
Now I am a little confused about the type of the arguments that each access method (consistent, union, compress, decompress, penalty, picksplit, same) requires in order to accomplish my goal.
Another black spot I have regarding compress.
If the entry passed to compress is a leaf entry then it is going to be of sql type (composite type) delta3d (meaning I will get the values using tuples etc). Correct? If not of what type is it going to be?
Assume it is a non-leaf entry. In that case of what type will it be? If it is delta3d_mbb (C type) then I don't have to change it. But is it going to be?
I am sorry if I seem importunate, but it has only been 2 weeks since I started messing with postgresql C extensions, and I need help...

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Large objects.
Next
From: Robert Haas
Date:
Subject: Re: Improving prep_buildtree used in VPATH builds