gist picksplit iteration

Started by Marios Vodasover 15 years ago2 messages
#1Marios Vodas
mvodas@gmail.com

At this page in documentation
http://www.postgresql.org/docs/9.0/static/gist-implementation.html and under
"picksplit" the loop that iterates through entryvec->vector[] starts from 1
(since FirstOffsetNumber equals 1).
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))

I would expect it to start from 0, since C arrays are 0 based.
So my question is why does this happen?

#2Dimitri Fontaine
dimitri@2ndQuadrant.fr
In reply to: Marios Vodas (#1)
Re: gist picksplit iteration

Marios Vodas <mvodas@gmail.com> writes:

I would expect it to start from 0, since C arrays are 0 based.
So my question is why does this happen?

Well I don't have any good answer other than "it's the API".

Time to have a look at some contrib code and some other, maybe, like
ip4r or prefix (the former is fixed size, the later a varlena struct,
pick a good example for you).

--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support