GIST_LEAF() causes error in GiST methods union and penalty

From: Marios Vodas <mvodas(at)outlook(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: GIST_LEAF() causes error in GiST methods union and penalty
Date: 2013-02-26 08:39:09
Message-ID: DUB002-W1237D59E443B9BA677F2594DEFC0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-02-26 10:21:04 Re: [PATCH] Add PQconninfoParseParams and PQconninfodefaultsMerge to libpq
Previous Message Heikki Linnakangas 2013-02-26 08:06:08 Re: [PATCH] Add PQconninfoParseParams and PQconninfodefaultsMerge to libpq