Well, I hope that bug reported by Michael is old bug.
Simple example:
bt=> create table test (x text);
CREATE
bt=> create index test_i on test (x);
CREATE
bt=> insert into test values ('0');
INSERT 449464
bt=> copy test from '/home/postgres/My/Btree/BUG/B';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
400 records with '12345'
COPY
bt=> vacuum verbose test;
NOTICE:Rel test: Pages 4: Changed 4, Reapped 0, Empty 0, New 0; Tup 401: Vac 0, Crash 0, UnUsed 0, MinLen 53, MaxLen
57;Re-using: Free/Avail. Space 0/0; EndEmpty/Avail. Pages 0/0. Elapsed 0/0 sec.
NOTICE:Ind test_i: Pages 5; Tuples 400. Elapsed 0/0 sec.
NOTICE:Ind test_i: NUMBER OF INDEX' TUPLES (400) IS NOT THE SAME AS HEAP' (401)
VACUUM
(I've got the same results under 6.0)
: splitting occures when there are 1 '0' and 291 '12345' on the first btree
page - PageGetFreeSpace(page) returns 0. Following duplicates handling
rules, '0' has to go on the 1st page and 291 '12345' - on the new page.
+ new '12345' item will also go on the new page!!!
But there is no space for '12345' here: we got rid of '0' - 8 bytes of
data - and want to add 16 bytes (double aligning).
New item wasn't added, silently. Check added now, so you'll
get FATAL...
There is no time to fix it now. I'll try to do it latter.
...Original Lehman and Yao algorithm doesn't allow duplicates at all.
Old team added some hacks... and we have to add yet more...
BTW, there shouldn't be problems in using btree for variable
length attributes if there are no duplicates... Michael, are there
duplicates in your table ?
Marc, did you use btree for variable length attributes?
Do you have duplicates ?
Vadim
------------------------------