Hackers,
Attached patch enables GIN to store additional information with item pointers in posting lists and trees.
Such additional information could be positions of words, positions of trigrams, lengths of arrays and so on.
This is the first and most huge patch of serie of GIN improvements which was presented at PGConf.EU
Patch modifies GIN interface as following:
1) Two arguments are added to extractValue
Datum **addInfo, bool **addInfoIsNull
2) Two arguments are added to consistent
Datum addInfo[], bool addInfoIsNull[]
3) New method config is introduced which returns datatype oid of addtional information (analogy with SP-GiST config method).
Patch completely changes storage in posting lists and leaf pages of posting trees. It uses varbyte encoding for BlockNumber and OffsetNumber. BlockNumber are stored incremental in page. Additionally one bit of OffsetNumber is reserved for additional information NULL flag. To be able to find position in leaf data page quickly patch introduces small index in the end of page.
------
With best regards,
Alexander Korotkov.