Hello all, I tried to use GIST_LEAF() macro in union and penalty methods of 
GiST and it fails with a terrible error when I run "CREATE INDEX" (in windows 
postgresql daemon shuts down). On the other hand, GIST_LEAF() works as expected 
in consistent, distance, and picksplit methods. My leaf nodes contain the 
indexed column data type whilst the non-leaf nodes have a different (internal) 
data type that is only known in C level (all types are fixed-length). I don't 
specify the "STORAGE" parameter in "CREATE OPERATOR CLASS ... USING gist" since 
the leaves are exactly of the same type as the column. Moreover, compress and 
decompress don't do anything just return the pointer they received (only 
compress checks for NULLs since there should be no NULLs in the column in my 
case).I also noticed in the documentation that in compress we determine if the 
page is leaf or not by using "if (entry->leafkey)" instead of GIST_LEAF() 
macro. What is the difference between "if (entry->leafkey)" and GIST_LEAF() and 
when should each one be used? I believe there are some conventions that GiST 
takes into account w.r.t. when it calls union and penalty and with what 
parameters, but I am not sure if they are right. So, I think that "union" is 
called only in leaf pages so the GistEntryVector parameter contains always leaf 
enties of my leaf data type (I am calling this an assumption because 
GIST_LEAF() breaks in union and "if (entry->leafkey)" always returns false 
which doesn't sound logical and makes me think that entry->leafkey should not 
be used). Also, the "GISTENTRY *origentry" of "penalty" is always of the 
non-leaf data type because it contains non-leaf entries whilst "GISTENTRY 
*newentry" is always of the leaf data type. Are the previous 
thoughts-assumptions correct? This is very important to me because I have to 
handle different leaf/non-leaf data types. And one last question, the two 
parameters of the "same" method are always of the non-leaf data type? Kind 
regards,Marios Vodas                                      

Reply via email to